site: pandoc: compile math to mathml
authorLucian Mogosanu <lucian.mogosanu@gmail.com>
Thu, 25 Jul 2013 09:56:32 +0000 (12:56 +0300)
committerLucian Mogosanu <lucian.mogosanu@gmail.com>
Thu, 25 Jul 2013 09:56:32 +0000 (12:56 +0300)
site.hs

diff --git a/site.hs b/site.hs
index 0f9a4b6..4510c2d 100644 (file)
--- a/site.hs
+++ b/site.hs
@@ -1,5 +1,6 @@
 {-# LANGUAGE OverloadedStrings #-}
 import Data.Monoid (mappend)
+import Text.Pandoc
 import Hakyll
 import Hakyll.Core.Configuration
 
@@ -52,7 +53,7 @@ compilePosts :: Tags -> Rules ()
 compilePosts tags = do
   route $ setExtension "html"
   let ctx = tagsCtx tags
-  compile $ pandocCompiler
+  compile $ tarpitCompiler
     >>= saveSnapshot "content"
     >>= loadAndApplyTemplate "templates/post.html" ctx
     >>= loadAndApplyTemplate "templates/default.html" ctx
@@ -66,7 +67,7 @@ compileImages = do
 compilePages :: Rules ()
 compilePages = do
   route $ setExtension "html"
-  compile $ pandocCompiler
+  compile $ tarpitCompiler
     >>= loadAndApplyTemplate "templates/default.html" defaultContext
     -- relative URLs break 404 pages, so don't do it here
     -- >>= relativizeUrls
@@ -132,6 +133,18 @@ tarpitConfiguration = defaultConfiguration
   commStr = "rsync -avz -e 'ssh -p 2200' "
          ++ "_site/* mogosanu.ro:/virtual/sites/thetarpit.org"
 
+-- pandoc reader and writer options
+tarpitReaderOptions :: ReaderOptions
+tarpitReaderOptions = defaultHakyllReaderOptions
+
+tarpitWriterOptions :: WriterOptions
+tarpitWriterOptions = defaultHakyllWriterOptions
+  { writerHTMLMathMethod = MathML Nothing }
+
+-- tarpit compiler
+tarpitCompiler :: Compiler (Item String)
+tarpitCompiler = pandocCompilerWith tarpitReaderOptions tarpitWriterOptions
+
 -- support for RSS feeds
 tarpitFeed :: FeedConfiguration
 tarpitFeed = FeedConfiguration