diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2010-03-05 12:02:54 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2010-03-05 12:02:54 +0100 |
commit | cd51ba5789243d47b1bb0701c563eef8be6e1d8e (patch) | |
tree | ca62f9318a9813d1876cd4a03aeb056fa3cb1a71 /src/Text | |
parent | 5d577bb8ef62d41c08a3e17af3ca411d581ac88c (diff) | |
download | hakyll-cd51ba5789243d47b1bb0701c563eef8be6e1d8e.tar.gz |
Removes superfluous functions, added some logging.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Hakyll/Internal/Render.hs | 28 | ||||
-rw-r--r-- | src/Text/Hakyll/RenderAction.hs | 6 |
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 |