@@ -11,7 +11,6 @@ module Text.Hakyll.Render.Internal
12import qualified Data.Map as M
12import qualified Data.Map as M
13import Text.Hakyll.Context (Context, ContextManipulation)
13import Text.Hakyll.Context (Context, ContextManipulation)
14−import Control.DeepSeq (deepseq)
15import Control.Monad.Reader (liftIO)
14import Control.Monad.Reader (liftIO)
16import Data.List (isPrefixOf, foldl')
15import Data.List (isPrefixOf, foldl')
17import Data.Char (isAlphaNum)
16import Data.Char (isAlphaNum)
@@ -56,20 +55,18 @@ pureRenderWith manipulation template context =
56 -- final render (just before writing).
55 -- final render (just before writing).
57 let contextIgnoringRoot = M.insert "root" "$root" (manipulation context)
56 let contextIgnoringRoot = M.insert "root" "$root" (manipulation context)
58 body = regularSubstitute template contextIgnoringRoot
57 body = regularSubstitute template contextIgnoringRoot
59− -- Force the body to be rendered.
60− in body `deepseq` M.insert "body" body context
58+ in M.insert "body" body context
62-- | A pure renderAndConcat function.
60-- | A pure renderAndConcat function.
63pureRenderAndConcatWith :: ContextManipulation -- ^ Manipulation to apply.
61pureRenderAndConcatWith :: ContextManipulation -- ^ Manipulation to apply.
64 -> [String] -- ^ Templates to use.
62 -> [String] -- ^ Templates to use.
65 -> [Context] -- ^ Different renderables.
63 -> [Context] -- ^ Different renderables.
67−pureRenderAndConcatWith manipulation templates contexts =
65+pureRenderAndConcatWith manipulation templates =
68− foldl' renderAndConcat [] contexts
66+ concatMap renderAndConcat
70− renderAndConcat chunk context =
71− let rendered = pureRenderChainWith manipulation templates context
72− in chunk ++ fromMaybe "" (M.lookup "body" rendered)
68+ renderAndConcat = fromMaybe "" . M.lookup "body"
69+ . pureRenderChainWith manipulation templates
74-- | A pure renderChain function.
71-- | A pure renderChain function.
75pureRenderChainWith :: ContextManipulation
72pureRenderChainWith :: ContextManipulation