summaryrefslogtreecommitdiff
path: root/src/Text/Hakyll/Render/Internal.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Hakyll/Render/Internal.hs')
-rw-r--r--src/Text/Hakyll/Render/Internal.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Text/Hakyll/Render/Internal.hs b/src/Text/Hakyll/Render/Internal.hs
index eca15a0..3b9bfbb 100644
--- a/src/Text/Hakyll/Render/Internal.hs
+++ b/src/Text/Hakyll/Render/Internal.hs
@@ -4,6 +4,7 @@ module Text.Hakyll.Render.Internal
, regularSubstitute
, finalSubstitute
, pureRenderWith
+ , pureRenderAndConcatWith
, pureRenderChainWith
, writePage
) where
@@ -55,6 +56,18 @@ pureRenderWith manipulation template context =
-- Force the body to be rendered.
in ($|) id rnf (M.insert "body" body context)
+-- | A pure renderAndConcat function.
+pureRenderAndConcatWith :: ContextManipulation
+ -> String -- ^ Template to use.
+ -> [Context] -- ^ Different renderables.
+ -> String
+pureRenderAndConcatWith manipulation template contexts =
+ foldl' renderAndConcat [] contexts
+ where
+ renderAndConcat chunk context =
+ let rendered = pureRenderWith manipulation template context
+ in chunk ++ fromMaybe "" (M.lookup "body" rendered)
+
-- | A pure renderChain function.
pureRenderChainWith :: ContextManipulation
-> [String]