@@ -25,17 +25,19 @@ module Hakyll.Web.Pandoc.Biblio
2525--------------------------------------------------------------------------------
2626import Control.Monad (liftM, replicateM)
2727import Data.Binary (Binary (..))
28−import Data.Default (def)
2928import Data.Typeable (Typeable)
3029import Hakyll.Core.Compiler
30+import Hakyll.Core.Compiler.Internal
3131import Hakyll.Core.Identifier
3232import Hakyll.Core.Item
33+import Hakyll.Core.Provider
3334import Hakyll.Core.Writable
3435import Hakyll.Web.Pandoc
3536import Hakyll.Web.Pandoc.Binary ()
3637import qualified Text.CSL as CSL
3738import Text.CSL.Pandoc (processCites)
38−import Text.Pandoc (Pandoc, ReaderOptions (..))
39+import Text.Pandoc (Pandoc, ReaderOptions (..),
40+ enableExtension, Extension (..))
3941
4042
4143--------------------------------------------------------------------------------
@@ -83,7 +85,7 @@ instance Writable Biblio where
8385--------------------------------------------------------------------------------
8486biblioCompiler :: Compiler (Item Biblio)
8587biblioCompiler = do
86− filePath <- toFilePath <$> getUnderlying
88+ filePath <- getResourceFilePath
8789 makeItem =<< unsafeCompiler (Biblio <$> CSL.readBiblioFile idpred filePath)
8890 where
8991 -- This is a filter on citations. We include all citations.
@@ -98,7 +100,9 @@ readPandocBiblio :: ReaderOptions
98100 -> Compiler (Item Pandoc)
99101readPandocBiblio ropt csl biblio item = do
100102 -- Parse CSL file, if given
101− style <- unsafeCompiler $ CSL.readCSLFile Nothing . toFilePath . itemIdentifier $ csl
103+ provider <- compilerProvider <$> compilerAsk
104+ style <- unsafeCompiler $
105+ CSL.readCSLFile Nothing . (resourceFilePath provider) . itemIdentifier $ csl
102106
103107 -- We need to know the citation keys, add then *before* actually parsing the
104108 -- actual page. If we don't do this, pandoc won't even consider them
@@ -115,4 +119,8 @@ pandocBiblioCompiler cslFileName bibFileName = do
115119 csl <- load $ fromFilePath cslFileName
116120 bib <- load $ fromFilePath bibFileName
117121 liftM writePandoc
118− (getResourceBody >>= readPandocBiblio def csl bib)
122+ (getResourceBody >>= readPandocBiblio ropt csl bib)
123+ where ropt = defaultHakyllReaderOptions
124+ { -- The following option enables citation rendering
125+ readerExtensions = enableExtension Ext_citations $ readerExtensions defaultHakyllReaderOptions
126+ }