summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2010-03-05 12:02:54 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2010-03-05 12:02:54 +0100
commitcd51ba5789243d47b1bb0701c563eef8be6e1d8e (patch)
treeca62f9318a9813d1876cd4a03aeb056fa3cb1a71
parent5d577bb8ef62d41c08a3e17af3ca411d581ac88c (diff)
downloadhakyll-cd51ba5789243d47b1bb0701c563eef8be6e1d8e.tar.gz
Removes superfluous functions, added some logging.
-rw-r--r--src/Text/Hakyll/Internal/Render.hs28
-rw-r--r--src/Text/Hakyll/RenderAction.hs6
2 files changed, 5 insertions, 29 deletions
diff --git a/src/Text/Hakyll/Internal/Render.hs b/src/Text/Hakyll/Internal/Render.hs
index 0fae8a7..739db7a 100644
--- a/src/Text/Hakyll/Internal/Render.hs
+++ b/src/Text/Hakyll/Internal/Render.hs
@@ -4,15 +4,13 @@ module Text.Hakyll.Internal.Render
, regularSubstitute
, finalSubstitute
, pureRenderWith
- , pureRenderAndConcatWith
- , pureRenderChainWith
, writePage
) where
import qualified Data.Map as M
import Control.Monad.Reader (liftIO)
-import Data.List (foldl')
import Data.Maybe (fromMaybe)
+import System.IO (hPutStrLn, stderr)
import Text.Hakyll.Context (Context, ContextManipulation)
import Text.Hakyll.File
@@ -32,26 +30,6 @@ pureRenderWith manipulation template context =
body = regularSubstitute template contextIgnoringRoot
in M.insert "body" body context
--- | A pure renderAndConcat function.
-pureRenderAndConcatWith :: ContextManipulation -- ^ Manipulation to apply.
- -> [Template] -- ^ Templates to use.
- -> [Context] -- ^ Different renderables.
- -> String
-pureRenderAndConcatWith manipulation templates =
- concatMap renderAndConcat
- where
- renderAndConcat = fromMaybe "" . M.lookup "body"
- . pureRenderChainWith manipulation templates
-
--- | A pure renderChain function.
-pureRenderChainWith :: ContextManipulation
- -> [Template]
- -> Context
- -> Context
-pureRenderChainWith manipulation templates context =
- let initial = manipulation context
- in foldl' (flip $ pureRenderWith id) initial templates
-
-- | Write a page to the site destination. Final action after render
-- chains and such.
writePage :: RenderAction Context ()
@@ -64,4 +42,6 @@ writePage = createRenderAction $ \initialContext -> do
destination <- toDestination url
makeDirectories destination
    -- Substitute $root here, just before writing.
- liftIO $ writeFile destination $ finalSubstitute (fromString body) context
+ liftIO $ do
+ writeFile destination $ finalSubstitute (fromString body) context
+ hPutStrLn stderr $ "Writing " ++ destination
diff --git a/src/Text/Hakyll/RenderAction.hs b/src/Text/Hakyll/RenderAction.hs
index 28c8e09..9fb9477 100644
--- a/src/Text/Hakyll/RenderAction.hs
+++ b/src/Text/Hakyll/RenderAction.hs
@@ -21,11 +21,7 @@ data RenderAction a b = RenderAction
}
createRenderAction :: (a -> Hakyll b) -> RenderAction a b
-createRenderAction f = RenderAction
- { actionDependencies = []
- , actionUrl = Nothing
- , actionFunction = f
- }
+createRenderAction f = id { actionFunction = f }
createSimpleRenderAction :: Hakyll b -> RenderAction () b
createSimpleRenderAction = createRenderAction . const