1 {-# LANGUAGE QuasiQuotes #-} 2 {-# LANGUAGE TemplateHaskell #-} 3 4 module HBlog.Lib 5 ( caselessre 6 , hblogPandocReaderOptions 7 , hblogPandocWriterOptions 8 ) where 9 10 import Text.Regex.PCRE.Heavy as PCRE 11 import Text.Regex.PCRE.Light.Base as PCREL 12 import Language.Haskell.TH.Quote 13 import Text.Pandoc (def, WriterOptions(..), enableExtension, Extension(..), pandocExtensions, ReaderOptions(..)) 14 import Text.Pandoc.Highlighting (pygments) 15 16 -- Case-insensitive regular expression quasi-quoter, used in unphone 17 caselessre :: QuasiQuoter 18 caselessre = PCRE.mkRegexQQ [utf8, caseless] 19 20 -- Stolen from lib/Hakyll/Web/Pandoc.hs 21 hblogPandocWriterOptions :: WriterOptions 22 hblogPandocWriterOptions = def 23 { -- This option causes literate haskell to be written using '>' marks in 24 -- html, which I think is a good default. 25 writerExtensions = enableExtension Ext_smart pandocExtensions 26 , -- We want to have hightlighting by default, to be compatible with earlier 27 -- Hakyll releases 28 writerHighlightStyle = Just pygments 29 } 30 hblogPandocReaderOptions :: ReaderOptions 31 hblogPandocReaderOptions = def 32 { -- The following option causes pandoc to read smart typography, a nice 33 -- and free bonus. 34 readerExtensions = enableExtension Ext_smart pandocExtensions 35 } 36