@@ -7,6 +7,8 @@
77-- refer to these files when you use 'pageReadPandocBiblio'. This function also
88-- takes the reader options for completeness -- you can use
99-- 'defaultHakyllReaderOptions' if you're unsure.
10+-- 'pandocBiblioCompiler' is a convenience wrapper which works like 'pandocCompiler',
11+-- but also takes paths to compiled bibliography and csl files.
1012{-# LANGUAGE Arrows #-}
1113{-# LANGUAGE DeriveDataTypeable #-}
1214{-# LANGUAGE GeneralizedNewtypeDeriving #-}
@@ -21,8 +23,9 @@ module Hakyll.Web.Pandoc.Biblio
2123
2224--------------------------------------------------------------------------------
2325import Control.Applicative ((<$>))
24−import Control.Monad (replicateM)
26+import Control.Monad (replicateM, liftM)
2527import Data.Binary (Binary (..))
28+import Data.Default (def)
2629import Data.Typeable (Typeable)
2730import qualified Text.CSL as CSL
2831import Text.CSL.Pandoc (processCites)
@@ -105,3 +108,9 @@ readPandocBiblio ropt csl biblio item = do
105108
106109 return $ fmap (const pandoc') item
107110
111+pandocBiblioCompiler :: String -> String -> Compiler (Item String)
112+pandocBiblioCompiler cslFileName bibFileName = do
113+ csl <- load $ fromFilePath cslFileName
114+ bib <- load $ fromFilePath bibFileName
115+ liftM writePandoc
116+ (getResourceBody >>= readPandocBiblio def csl bib)