summaryrefslogtreecommitdiff
path: root/src/Hakyll/Web/Page.hs
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2011-05-29 12:17:55 +0200
committerJasper Van der Jeugt <jaspervdj@gmail.com>2011-05-29 12:17:55 +0200
commitcd0228ac2bb845b25b30095d4b4d9649eac447b2 (patch)
tree85bdb82f05563d8ffbb7fe06fa4d0df70b9e6972 /src/Hakyll/Web/Page.hs
parent25b28d8ba4792bf31e2add88607f868f7b88bdd8 (diff)
parent51f0bfc195aca8b911614fe3d84cb2551d722e3d (diff)
downloadhakyll-cd0228ac2bb845b25b30095d4b4d9649eac447b2.tar.gz
Merge branch 'master' into type-safe-identifiers
Diffstat (limited to 'src/Hakyll/Web/Page.hs')
-rw-r--r--src/Hakyll/Web/Page.hs23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/Hakyll/Web/Page.hs b/src/Hakyll/Web/Page.hs
index a9c622c..1450702 100644
--- a/src/Hakyll/Web/Page.hs
+++ b/src/Hakyll/Web/Page.hs
@@ -54,6 +54,7 @@ module Hakyll.Web.Page
, readPageCompiler
, pageCompiler
, pageCompilerWith
+ , pageCompilerWithPandoc
, addDefaultFields
, sortByBaseName
) where
@@ -66,7 +67,7 @@ import qualified Data.Map as M
import Data.List (sortBy)
import Data.Ord (comparing)
-import Text.Pandoc (ParserState, WriterOptions)
+import Text.Pandoc (Pandoc, ParserState, WriterOptions)
import Hakyll.Core.Identifier
import Hakyll.Core.Compiler
@@ -91,16 +92,26 @@ readPageCompiler = getResourceString >>^ readPage
-- | Read a page, add default fields, substitute fields and render using pandoc
--
pageCompiler :: Compiler Resource (Page String)
-pageCompiler = cached "Hakyll.Web.Page.pageCompiler" $
- readPageCompiler >>> addDefaultFields >>> arr applySelf >>> pageRenderPandoc
+pageCompiler =
+ pageCompilerWith defaultHakyllParserState defaultHakyllWriterOptions
-- | A version of 'pageCompiler' which allows you to specify your own pandoc
-- options
--
-pageCompilerWith :: ParserState -> WriterOptions -> Compiler Resource (Page String)
-pageCompilerWith state options = cached "pageCompilerWith" $
+pageCompilerWith :: ParserState -> WriterOptions
+ -> Compiler Resource (Page String)
+pageCompilerWith state options = pageCompilerWithPandoc state options id
+
+-- | An extension of 'pageCompilerWith' which allows you to specify a custom
+-- pandoc transformer for the content
+--
+pageCompilerWithPandoc :: ParserState -> WriterOptions
+ -> (Pandoc -> Pandoc)
+ -> Compiler Resource (Page String)
+pageCompilerWithPandoc state options f = cached "pageCompilerWithPandoc" $
readPageCompiler >>> addDefaultFields >>> arr applySelf
- >>> pageRenderPandocWith state options
+ >>> pageReadPandocWith state
+ >>> arr (fmap (writePandocWith options . f))
-- | Add a number of default metadata fields to a page. These fields include:
--