summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hakyll.cabal16
-rw-r--r--lib/Hakyll/Web/Pandoc.hs21
-rw-r--r--stack.yaml8
3 files changed, 23 insertions, 22 deletions
diff --git a/hakyll.cabal b/hakyll.cabal
index 969f50c..79cf1e9 100644
--- a/hakyll.cabal
+++ b/hakyll.cabal
@@ -168,10 +168,10 @@ Library
mtl >= 1 && < 2.3,
network >= 2.6 && < 2.7,
network-uri >= 2.6 && < 2.7,
- pandoc >= 1.14 && < 1.20,
- pandoc-citeproc >= 0.10.5 && < 0.11,
+ pandoc >= 2.0 && < 2.1,
+ pandoc-citeproc >= 0.12 && < 0.13,
parsec >= 3.0 && < 3.2,
- process >= 1.0 && < 1.6,
+ process >= 1.6 && < 1.7,
random >= 1.0 && < 1.2,
regex-base >= 0.93 && < 0.94,
regex-tdfa >= 1.1 && < 1.3,
@@ -179,7 +179,7 @@ Library
scientific >= 0.3.4 && < 0.4,
tagsoup >= 0.13.1 && < 0.15,
text >= 0.11 && < 1.3,
- time >= 1.4 && < 1.8,
+ time >= 1.8 && < 1.9,
time-locale-compat >= 0.1 && < 0.2,
unordered-containers >= 0.2 && < 0.3,
vector >= 0.11 && < 0.13,
@@ -263,10 +263,10 @@ Test-suite hakyll-tests
mtl >= 1 && < 2.3,
network >= 2.6 && < 2.7,
network-uri >= 2.6 && < 2.7,
- pandoc >= 1.14 && < 1.20,
- pandoc-citeproc >= 0.10.5 && < 0.11,
+ pandoc >= 2.0 && < 2.1,
+ pandoc-citeproc >= 0.12 && < 0.13,
parsec >= 3.0 && < 3.2,
- process >= 1.0 && < 1.6,
+ process >= 1.6 && < 1.7,
random >= 1.0 && < 1.2,
regex-base >= 0.93 && < 0.94,
regex-tdfa >= 1.1 && < 1.3,
@@ -274,7 +274,7 @@ Test-suite hakyll-tests
scientific >= 0.3.4 && < 0.4,
tagsoup >= 0.13.1 && < 0.15,
text >= 0.11 && < 1.3,
- time >= 1.4 && < 1.8,
+ time >= 1.8 && < 1.9,
time-locale-compat >= 0.1 && < 0.2,
unordered-containers >= 0.2 && < 0.3,
vector >= 0.11 && < 0.13,
diff --git a/lib/Hakyll/Web/Pandoc.hs b/lib/Hakyll/Web/Pandoc.hs
index eec0a8a..6dcae32 100644
--- a/lib/Hakyll/Web/Pandoc.hs
+++ b/lib/Hakyll/Web/Pandoc.hs
@@ -25,6 +25,8 @@ module Hakyll.Web.Pandoc
import qualified Data.Set as S
import Text.Pandoc
import Text.Pandoc.Error (PandocError (..))
+import Text.Pandoc.Highlighting (pygments)
+import qualified Data.Text as T
--------------------------------------------------------------------------------
@@ -48,10 +50,10 @@ readPandocWith
-> Item String -- ^ String to read
-> Compiler (Item Pandoc) -- ^ Resulting document
readPandocWith ropt item =
- case traverse (reader ropt (itemFileType item)) item of
- Left (ParseFailure err) -> fail $
+ case runPure $ traverse (reader ropt (itemFileType item)) (fmap T.pack item) of
+ Left (PandocParseError err) -> fail $
"Hakyll.Web.Pandoc.readPandocWith: parse failed: " ++ err
- Left (ParsecError _ err) -> fail $
+ Left (PandocParsecError _ err) -> fail $
"Hakyll.Web.Pandoc.readPandocWith: parse failed: " ++ show err
Right item' -> return item'
where
@@ -69,7 +71,7 @@ readPandocWith ropt item =
"Hakyll.Web.readPandocWith: I don't know how to read a file of " ++
"the type " ++ show t ++ " for: " ++ show (itemIdentifier item)
- addExt ro e = ro {readerExtensions = S.insert e $ readerExtensions ro}
+ addExt ro e = ro {readerExtensions = enableExtension e $ readerExtensions ro}
--------------------------------------------------------------------------------
@@ -84,7 +86,10 @@ writePandoc = writePandocWith defaultHakyllWriterOptions
writePandocWith :: WriterOptions -- ^ Writer options for pandoc
-> Item Pandoc -- ^ Document to write
-> Item String -- ^ Resulting HTML
-writePandocWith wopt = fmap $ writeHtmlString wopt
+writePandocWith wopt (Item itemi doc) =
+ case runPure $ writeHtml5String wopt doc of
+ Left (PandocSomeError err) -> error $ "Hakyll.Web.Pandoc.writePandocWith: unknown error: " ++ err
+ Right item' -> Item itemi $ T.unpack item'
--------------------------------------------------------------------------------
@@ -147,7 +152,7 @@ defaultHakyllReaderOptions :: ReaderOptions
defaultHakyllReaderOptions = def
{ -- The following option causes pandoc to read smart typography, a nice
-- and free bonus.
- readerSmart = True
+ readerExtensions = enableExtension Ext_smart pandocExtensions
}
@@ -157,8 +162,8 @@ defaultHakyllWriterOptions :: WriterOptions
defaultHakyllWriterOptions = def
{ -- This option causes literate haskell to be written using '>' marks in
-- html, which I think is a good default.
- writerExtensions = S.insert Ext_literate_haskell (writerExtensions def)
+ writerExtensions = enableExtension Ext_smart pandocExtensions
, -- We want to have hightlighting by default, to be compatible with earlier
-- Hakyll releases
- writerHighlight = True
+ writerHighlightStyle = Just pygments
}
diff --git a/stack.yaml b/stack.yaml
index 2e88e47..389a469 100644
--- a/stack.yaml
+++ b/stack.yaml
@@ -1,10 +1,6 @@
-resolver: nightly-2017-06-19
+resolver: nightly-2017-11-20
extra-package-dbs: []
-extra-deps:
-- 'optparse-applicative-0.14.0.0'
-- 'pandoc-citeproc-0.10.5.1'
-- 'QuickCheck-2.10.0.1'
-- 'tasty-quickcheck-0.9'
+extra-deps: []
flags:
hakyll: