mirror of
https://github.com/ilyakooo0/hakyll.git
synced 2024-10-06 17:27:55 +03:00
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.
This commit is contained in:
parent
36f9a9cfeb
commit
a590a9a57f
112
hakyll.cabal
112
hakyll.cabal
@ -141,33 +141,33 @@ Library
|
||||
Paths_hakyll
|
||||
|
||||
Build-Depends:
|
||||
base >= 4 && < 5,
|
||||
binary >= 0.5 && < 0.8,
|
||||
blaze-html >= 0.5 && < 0.7,
|
||||
blaze-markup >= 0.5.1 && < 0.6,
|
||||
bytestring >= 0.9 && < 0.11,
|
||||
citeproc-hs >= 0.3.2 && < 0.4,
|
||||
cmdargs >= 0.10 && < 0.11,
|
||||
containers >= 0.3 && < 0.6,
|
||||
cryptohash >= 0.7 && < 0.11,
|
||||
data-default >= 0.4 && < 0.6,
|
||||
deepseq >= 1.3 && < 1.4,
|
||||
directory >= 1.0 && < 1.3,
|
||||
filepath >= 1.0 && < 1.4,
|
||||
lrucache >= 1.1.1 && < 1.2,
|
||||
mtl >= 1 && < 2.2,
|
||||
network >= 2.4 && < 2.5,
|
||||
old-locale >= 1.0 && < 1.1,
|
||||
old-time >= 1.0 && < 1.2,
|
||||
pandoc >= 1.10 && < 1.12,
|
||||
parsec >= 3.0 && < 3.2,
|
||||
process >= 1.0 && < 1.2,
|
||||
random >= 1.0 && < 1.1,
|
||||
regex-base >= 0.93 && < 0.94,
|
||||
regex-tdfa >= 1.1 && < 1.2,
|
||||
tagsoup >= 0.12.6 && < 0.13,
|
||||
text >= 0.11 && < 1.12,
|
||||
time >= 1.1 && < 1.5
|
||||
base >= 4 && < 5,
|
||||
binary >= 0.5 && < 0.8,
|
||||
blaze-html >= 0.5 && < 0.7,
|
||||
blaze-markup >= 0.5.1 && < 0.6,
|
||||
bytestring >= 0.9 && < 0.11,
|
||||
cmdargs >= 0.10 && < 0.11,
|
||||
containers >= 0.3 && < 0.6,
|
||||
cryptohash >= 0.7 && < 0.11,
|
||||
data-default >= 0.4 && < 0.6,
|
||||
deepseq >= 1.3 && < 1.4,
|
||||
directory >= 1.0 && < 1.3,
|
||||
filepath >= 1.0 && < 1.4,
|
||||
lrucache >= 1.1.1 && < 1.2,
|
||||
mtl >= 1 && < 2.2,
|
||||
network >= 2.4 && < 2.5,
|
||||
old-locale >= 1.0 && < 1.1,
|
||||
old-time >= 1.0 && < 1.2,
|
||||
pandoc >= 1.12 && < 1.14,
|
||||
pandoc-citeproc >= 0.1 && < 0.2,
|
||||
parsec >= 3.0 && < 3.2,
|
||||
process >= 1.0 && < 1.2,
|
||||
random >= 1.0 && < 1.1,
|
||||
regex-base >= 0.93 && < 0.94,
|
||||
regex-tdfa >= 1.1 && < 1.2,
|
||||
tagsoup >= 0.12.6 && < 0.13,
|
||||
text >= 0.11 && < 1.12,
|
||||
time >= 1.1 && < 1.5
|
||||
|
||||
If flag(previewServer)
|
||||
Build-depends:
|
||||
@ -224,36 +224,36 @@ Test-suite hakyll-tests
|
||||
HUnit >= 1.2 && < 1.3,
|
||||
QuickCheck >= 2.4 && < 2.7,
|
||||
test-framework >= 0.4 && < 0.9,
|
||||
test-framework-hunit >= 0.2 && < 0.4,
|
||||
test-framework-quickcheck2 >= 0.2 && < 0.4,
|
||||
test-framework-hunit >= 0.3 && < 0.4,
|
||||
test-framework-quickcheck2 >= 0.3 && < 0.4,
|
||||
-- Copy pasted from hakyll dependencies:
|
||||
base >= 4 && < 5,
|
||||
binary >= 0.5 && < 0.8,
|
||||
blaze-html >= 0.5 && < 0.7,
|
||||
blaze-markup >= 0.5.1 && < 0.6,
|
||||
bytestring >= 0.9 && < 0.11,
|
||||
citeproc-hs >= 0.3.2 && < 0.4,
|
||||
cmdargs >= 0.10 && < 0.11,
|
||||
containers >= 0.3 && < 0.6,
|
||||
cryptohash >= 0.7 && < 0.11,
|
||||
data-default >= 0.4 && < 0.6,
|
||||
deepseq >= 1.3 && < 1.4,
|
||||
directory >= 1.0 && < 1.3,
|
||||
filepath >= 1.0 && < 1.4,
|
||||
lrucache >= 1.1.1 && < 1.2,
|
||||
mtl >= 1 && < 2.2,
|
||||
network >= 2.4 && < 2.5,
|
||||
old-locale >= 1.0 && < 1.1,
|
||||
old-time >= 1.0 && < 1.2,
|
||||
pandoc >= 1.10 && < 1.12,
|
||||
parsec >= 3.0 && < 3.2,
|
||||
process >= 1.0 && < 1.2,
|
||||
random >= 1.0 && < 1.1,
|
||||
regex-base >= 0.93 && < 0.94,
|
||||
regex-tdfa >= 1.1 && < 1.2,
|
||||
tagsoup >= 0.12.6 && < 0.13,
|
||||
text >= 0.11 && < 1.12,
|
||||
time >= 1.1 && < 1.5
|
||||
base >= 4 && < 5,
|
||||
binary >= 0.5 && < 0.8,
|
||||
blaze-html >= 0.5 && < 0.7,
|
||||
blaze-markup >= 0.5.1 && < 0.6,
|
||||
bytestring >= 0.9 && < 0.11,
|
||||
cmdargs >= 0.10 && < 0.11,
|
||||
containers >= 0.3 && < 0.6,
|
||||
cryptohash >= 0.7 && < 0.11,
|
||||
data-default >= 0.4 && < 0.6,
|
||||
deepseq >= 1.3 && < 1.4,
|
||||
directory >= 1.0 && < 1.3,
|
||||
filepath >= 1.0 && < 1.4,
|
||||
lrucache >= 1.1.1 && < 1.2,
|
||||
mtl >= 1 && < 2.2,
|
||||
network >= 2.4 && < 2.5,
|
||||
old-locale >= 1.0 && < 1.1,
|
||||
old-time >= 1.0 && < 1.2,
|
||||
pandoc >= 1.12 && < 1.14,
|
||||
pandoc-citeproc >= 0.1 && < 0.2,
|
||||
parsec >= 3.0 && < 3.2,
|
||||
process >= 1.0 && < 1.2,
|
||||
random >= 1.0 && < 1.1,
|
||||
regex-base >= 0.93 && < 0.94,
|
||||
regex-tdfa >= 1.1 && < 1.2,
|
||||
tagsoup >= 0.12.6 && < 0.13,
|
||||
text >= 0.11 && < 1.12,
|
||||
time >= 1.1 && < 1.5
|
||||
|
||||
If flag(previewServer)
|
||||
Build-depends:
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user