diff options
author | Jorge Israel Peña <jorgepblank@gmail.com> | 2013-09-16 23:25:45 -0700 |
---|---|---|
committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2013-09-18 22:38:54 +0200 |
commit | a590a9a57f2f74547670469db946407be02e2a11 (patch) | |
tree | 918843e032ac7af5aeebbaea63e5a429ff430fea /src | |
parent | 36f9a9cfeb9b408cb595d9652e0af8fa30551c75 (diff) | |
download | hakyll-a590a9a57f2f74547670469db946407be02e2a11.tar.gz |
updated to work with pandoc 1.12
Pandoc 1.12 decouples citeproc-hs from itself, so there is no longer a
Text.Pandoc.Biblio module in Pandoc. Further, citeproc-hs depends on
pandoc-types 1.10 but Pandoc 1.12 depends on pandoc-types 1.12. To
alleviate these issues, pandoc-citeproc was created which includes a
copy of the citeproc-hs source made to be compatible, since the
developer of citeproc-hs is apparently MIA.
pandoc-citeproc is a separate module that handles the mixture of
citeproc-hs and Pandoc. It includes `processCites` in Text.CSL.Pandoc,
which is the new name of what used to be `processBiblio` from
Text.Pandoc.Biblio
Most of these changes are seamless, consisting of simple name changes in
both functions and modules. However, a more direct change in the
Hakyll API itself is that `readPandocBiblio`'s second parameter, the
CSL, is now mandatory, i.e. not of type Maybe. This is to reflect the
same change in the underlying processing function from Text.CSL.Pandoc,
`processCites`, where the Style argument is now mandatory, and the style
is derived from the CSL.
See the old function:
processBiblio :: Maybe Style -> [Reference] -> Pandoc -> Pandoc
Compared to the new one:
processCites :: Style -> [Reference] -> Pandoc -> Pandoc
Sources:
* http://hackage.haskell.org/packages/archive/pandoc/1.11.1/doc/html/Text-Pandoc-Biblio.html
* http://hackage.haskell.org/packages/archive/pandoc-citeproc/0.1/doc/html/Text-CSL-Pandoc.html
Similarly, there is no longer a `readerReferences` field in the reader
options structure.
Diffstat (limited to 'src')
-rw-r--r-- | src/Hakyll/Web/Pandoc/Biblio.hs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/Hakyll/Web/Pandoc/Biblio.hs b/src/Hakyll/Web/Pandoc/Biblio.hs index 9c4b0bf..db022bc 100644 --- a/src/Hakyll/Web/Pandoc/Biblio.hs +++ b/src/Hakyll/Web/Pandoc/Biblio.hs @@ -22,12 +22,10 @@ module Hakyll.Web.Pandoc.Biblio -------------------------------------------------------------------------------- import Control.Applicative ((<$>)) import Data.Binary (Binary (..)) -import Data.Traversable (traverse) import Data.Typeable (Typeable) import qualified Text.CSL as CSL +import Text.CSL.Pandoc (processCites) import Text.Pandoc (Pandoc, ReaderOptions (..)) -import Text.Pandoc.Biblio (processBiblio) - -------------------------------------------------------------------------------- import Hakyll.Core.Compiler @@ -86,21 +84,20 @@ biblioCompiler = do -------------------------------------------------------------------------------- readPandocBiblio :: ReaderOptions - -> Maybe (Item CSL) + -> Item CSL -> Item Biblio -> (Item String) -> Compiler (Item Pandoc) readPandocBiblio ropt csl biblio item = do -- Parse CSL file, if given - style <- unsafeCompiler $ - traverse (CSL.readCSLFile . toFilePath . itemIdentifier) csl + style <- unsafeCompiler $ CSL.readCSLFile . toFilePath . itemIdentifier $ csl -- We need to know the citation keys, add then *before* actually parsing the -- actual page. If we don't do this, pandoc won't even consider them -- citations! let Biblio refs = itemBody biblio - ropt' = ropt {readerReferences = readerReferences ropt ++ refs} - pandoc = itemBody $ readPandocWith ropt' item - pandoc' = processBiblio style refs pandoc + pandoc = itemBody $ readPandocWith ropt item + pandoc' = processCites style refs pandoc return $ fmap (const pandoc') item + |