@@ -4,15 +4,13 @@ module Text.Hakyll.Internal.Render
44 , regularSubstitute
55 , finalSubstitute
66 , pureRenderWith
7− , pureRenderAndConcatWith
8− , pureRenderChainWith
97 , writePage
108 ) where
119
1210import qualified Data.Map as M
1311import Control.Monad.Reader (liftIO)
14−import Data.List (foldl')
1512import Data.Maybe (fromMaybe)
13+import System.IO (hPutStrLn, stderr)
1614
1715import Text.Hakyll.Context (Context, ContextManipulation)
1816import Text.Hakyll.File
@@ -32,26 +30,6 @@ pureRenderWith manipulation template context =
3230 body = regularSubstitute template contextIgnoringRoot
3331 in M.insert "body" body context
3432
35−-- | A pure renderAndConcat function.
36−pureRenderAndConcatWith :: ContextManipulation -- ^ Manipulation to apply.
37− -> [Template] -- ^ Templates to use.
38− -> [Context] -- ^ Different renderables.
39− -> String
40−pureRenderAndConcatWith manipulation templates =
41− concatMap renderAndConcat
42− where
43− renderAndConcat = fromMaybe "" . M.lookup "body"
44− . pureRenderChainWith manipulation templates
45−
46−-- | A pure renderChain function.
47−pureRenderChainWith :: ContextManipulation
48− -> [Template]
49− -> Context
50− -> Context
51−pureRenderChainWith manipulation templates context =
52− let initial = manipulation context
53− in foldl' (flip $ pureRenderWith id) initial templates
54−
5533-- | Write a page to the site destination. Final action after render
5634-- chains and such.
5735writePage :: RenderAction Context ()
@@ -64,4 +42,6 @@ writePage = createRenderAction $ \initialContext -> do
6442 destination <- toDestination url
6543 makeDirectories destination
6644 -- Substitute $root here, just before writing.
67− liftIO $ writeFile destination $ finalSubstitute (fromString body) context
45+ liftIO $ do
46+ writeFile destination $ finalSubstitute (fromString body) context
47+ hPutStrLn stderr $ "Writing " ++ destination