summaryrefslogtreecommitdiff
path: root/src/Text/Hakyll/Render.hs
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2010-01-12 14:48:16 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2010-01-12 14:48:16 +0100
commita26f84dab5a49ce0fa00c7a0acfe84059451db5b (patch)
tree90884deb9f3793f39dd699866a9313dd24ccc609 /src/Text/Hakyll/Render.hs
parentecd00b386e2848cab19c16afdcaeae3133f39569 (diff)
downloadhakyll-a26f84dab5a49ce0fa00c7a0acfe84059451db5b.tar.gz
Added pure renderAndConcat function.
Diffstat (limited to 'src/Text/Hakyll/Render.hs')
-rw-r--r--src/Text/Hakyll/Render.hs14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/Text/Hakyll/Render.hs b/src/Text/Hakyll/Render.hs
index c55e5d8..d8deea2 100644
--- a/src/Text/Hakyll/Render.hs
+++ b/src/Text/Hakyll/Render.hs
@@ -10,7 +10,7 @@ module Text.Hakyll.Render
, css
) where
-import Control.Monad (unless, mapM, foldM)
+import Control.Monad (unless, mapM)
import System.Directory (copyFile)
import System.IO
@@ -64,14 +64,10 @@ renderAndConcatWith :: Renderable a
-> FilePath
-> [a]
-> IO String
-renderAndConcatWith manipulation templatePath renderables =
- foldM concatRender' [] renderables
- where
- concatRender' :: Renderable a => String -> a -> IO String
- concatRender' chunk renderable = do
- rendered <- renderWith manipulation templatePath renderable
- let body = getBody rendered
- return $ chunk ++ body
+renderAndConcatWith manipulation templatePath renderables = do
+ template <- readFile templatePath
+ contexts <- mapM toContext renderables
+ return $ pureRenderAndConcatWith manipulation template contexts
-- | Chain a render action for a page with a number of templates. This will
-- also write the result to the site destination. This is the preferred way