@@ -10,7 +10,7 @@ module Text.Hakyll.Render
1010 , css
1111 ) where
1212
13−import Control.Monad (unless, liftM, foldM)
13+import Control.Monad (unless, mapM, foldM)
1414
1515import System.Directory (copyFile)
1616import System.IO
@@ -49,7 +49,7 @@ renderWith :: Renderable a
4949renderWith manipulation templatePath renderable = do
5050 template <- readFile templatePath
5151 context <- toContext renderable
52− return $ pureRenderWith manipulation template context
52+ return $ fromContext $ pureRenderWith manipulation template context
5353
5454-- | Render each renderable with the given template, then concatenate the
5555-- result.
@@ -83,11 +83,12 @@ renderChain = renderChainWith id
8383-- "ContextManipulation" which to apply on the context when it is read first.
8484renderChainWith :: Renderable a
8585 => ContextManipulation -> [FilePath] -> a -> IO ()
86−renderChainWith manipulation templates renderable =
87− depends (getURL renderable) (getDependencies renderable ++ templates) $
88− do initialPage <- liftM manipulation $ toContext renderable
89− result <- foldM (flip render) (fromContext initialPage) templates
90− writePage result
86+renderChainWith manipulation templatePaths renderable =
87+ depends (getURL renderable) (getDependencies renderable ++ templatePaths) $
88+ do templates <- mapM readFile templatePaths
89+ context <- toContext renderable
90+ let result = pureRenderChainWith manipulation templates context
91+ writePage $ fromContext result
9192
9293-- | Mark a certain file as static, so it will just be copied when the site is
9394-- generated.