diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2010-01-24 14:05:18 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2010-01-24 14:05:18 +0100 |
commit | d6fbe303ae389d8c0c17b7181cfba2180f404fb4 (patch) | |
tree | a7fac47da2c034bea81c43cfd0e1e502d5e51124 /src/Text | |
parent | 788a37cd3ea28e890c3f6f4ffca087e580dafcbd (diff) | |
download | hakyll-d6fbe303ae389d8c0c17b7181cfba2180f404fb4.tar.gz |
Simplified pureRenderAndConcat function.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Hakyll/Render/Internal.hs | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/Text/Hakyll/Render/Internal.hs b/src/Text/Hakyll/Render/Internal.hs index ecde1d7..03210ac 100644 --- a/src/Text/Hakyll/Render/Internal.hs +++ b/src/Text/Hakyll/Render/Internal.hs @@ -11,7 +11,6 @@ module Text.Hakyll.Render.Internal import qualified Data.Map as M import Text.Hakyll.Context (Context, ContextManipulation) -import Control.DeepSeq (deepseq) import Control.Monad.Reader (liftIO) import Data.List (isPrefixOf, foldl') import Data.Char (isAlphaNum) @@ -56,20 +55,18 @@ pureRenderWith manipulation template context = -- final render (just before writing). let contextIgnoringRoot = M.insert "root" "$root" (manipulation context) body = regularSubstitute template contextIgnoringRoot - -- Force the body to be rendered. - in body `deepseq` M.insert "body" body context + in M.insert "body" body context -- | A pure renderAndConcat function. pureRenderAndConcatWith :: ContextManipulation -- ^ Manipulation to apply. -> [String] -- ^ Templates to use. -> [Context] -- ^ Different renderables. -> String -pureRenderAndConcatWith manipulation templates contexts = - foldl' renderAndConcat [] contexts +pureRenderAndConcatWith manipulation templates = + concatMap renderAndConcat where - renderAndConcat chunk context = - let rendered = pureRenderChainWith manipulation templates context - in chunk ++ fromMaybe "" (M.lookup "body" rendered) + renderAndConcat = fromMaybe "" . M.lookup "body" + . pureRenderChainWith manipulation templates -- | A pure renderChain function. pureRenderChainWith :: ContextManipulation |