on master help sign in
Removes superfluous functions, added some logging.
commitcd51ba5789243d47b1bb0701c563eef8be6e1d8e authorJasper Van der Jeugt <jaspervdj@gmail.com> dateFri 5 Mar 2010, 12:02 (17 years ago) parent5d577bb
2 files changed+5−29
src/Text/Hakyll/Internal/Render.hs+4−24 src/Text/Hakyll/RenderAction.hs+1−5
src/Text/Hakyll/Internal/Render.hs+4−24
@@ -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
src/Text/Hakyll/RenderAction.hs+1−5
@@ -21,11 +21,7 @@ data RenderAction a b = RenderAction
2121 }
2222
2323createRenderAction :: (a -> Hakyll b) -> RenderAction a b
24−createRenderAction f = RenderAction
25− { actionDependencies = []
26− , actionUrl = Nothing
27− , actionFunction = f
28− }
24+createRenderAction f = id { actionFunction = f }
2925
3026createSimpleRenderAction :: Hakyll b -> RenderAction () b
3127createSimpleRenderAction = createRenderAction . const