Permalink
Browse files

add meta to context for pre parse transformers

  • Loading branch information...
1 parent 1758546 commit b2ffd528c3c2dc1828ba59dea4037e9c976d8807 @sakari sakari committed Aug 13, 2011
Showing with 7 additions and 2 deletions.
  1. +7 −2 Network/Gitit/ContentTransformer.hs
@@ -308,12 +308,17 @@ applyWikiTemplate c = do
-- | Converts Page to Pandoc, applies page transforms, and adds page
-- title.
pageToWikiPandoc :: Page -> ContentTransformer Pandoc
-pageToWikiPandoc page' =
+pageToWikiPandoc page' = do
+ addMetaToContext page'
pageToWikiPandoc' page' >>= addPageTitleToPandoc (pageTitle page')
pageToWikiPandoc' :: Page -> ContentTransformer Pandoc
pageToWikiPandoc' = applyPreParseTransforms >=>
- pageToPandoc >=> applyPageTransforms
+ pageToPandoc >=> applyPageTransforms
+
+-- | Add metadata to context
+addMetaToContext :: Page -> ContentTransformer ()
+addMetaToContext page = modifyContext $ \ctx -> ctx { ctxMeta = pageMeta page }
-- | Converts source text to Pandoc using default page type.
pageToPandoc :: Page -> ContentTransformer Pandoc

0 comments on commit b2ffd52

Please sign in to comment.