hakyll 4.6.9.0 → 4.7.0.0
raw patch · 4 files changed
+27/−16 lines, 4 filesdep ~pandocPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: pandoc
API changes (from Hackage documentation)
- Hakyll.Web.Pandoc: readPandoc :: Item String -> Item Pandoc
+ Hakyll.Web.Pandoc: readPandoc :: Item String -> Compiler (Item Pandoc)
- Hakyll.Web.Pandoc: readPandocWith :: ReaderOptions -> Item String -> Item Pandoc
+ Hakyll.Web.Pandoc: readPandocWith :: ReaderOptions -> Item String -> Compiler (Item Pandoc)
- Hakyll.Web.Pandoc: renderPandoc :: Item String -> Item String
+ Hakyll.Web.Pandoc: renderPandoc :: Item String -> Compiler (Item String)
- Hakyll.Web.Pandoc: renderPandocWith :: ReaderOptions -> WriterOptions -> Item String -> Item String
+ Hakyll.Web.Pandoc: renderPandocWith :: ReaderOptions -> WriterOptions -> Item String -> Compiler (Item String)
Files
- hakyll.cabal +3/−3
- src/Hakyll/Web/Pandoc.hs +21/−10
- src/Hakyll/Web/Pandoc/Biblio.hs +2/−2
- tests/Hakyll/Core/Runtime/Tests.hs +1/−1
hakyll.cabal view
@@ -1,5 +1,5 @@ Name: hakyll-Version: 4.6.9.0+Version: 4.7.0.0 Synopsis: A static website compiler library Description:@@ -158,7 +158,7 @@ network-uri >= 2.6 && < 2.7, old-locale >= 1.0 && < 1.1, old-time >= 1.0 && < 1.2,- pandoc >= 1.12.4 && < 1.14,+ pandoc >= 1.14 && < 1.15, pandoc-citeproc >= 0.4 && < 0.8, parsec >= 3.0 && < 3.2, process >= 1.0 && < 1.3,@@ -246,7 +246,7 @@ network-uri >= 2.6 && < 2.7, old-locale >= 1.0 && < 1.1, old-time >= 1.0 && < 1.2,- pandoc >= 1.12.4 && < 1.14,+ pandoc >= 1.14 && < 1.15, pandoc-citeproc >= 0.4 && < 0.8, parsec >= 3.0 && < 3.2, process >= 1.0 && < 1.3,
src/Hakyll/Web/Pandoc.hs view
@@ -26,6 +26,7 @@ import qualified Data.Set as S import Data.Traversable (traverse) import Text.Pandoc+import Text.Pandoc.Error (PandocError (..)) --------------------------------------------------------------------------------@@ -36,17 +37,25 @@ -------------------------------------------------------------------------------- -- | Read a string using pandoc, with the default options-readPandoc :: Item String -- ^ String to read- -> Item Pandoc -- ^ Resulting document+readPandoc+ :: Item String -- ^ String to read+ -> Compiler (Item Pandoc) -- ^ Resulting document readPandoc = readPandocWith defaultHakyllReaderOptions -------------------------------------------------------------------------------- -- | Read a string using pandoc, with the supplied options-readPandocWith :: ReaderOptions -- ^ Parser options- -> Item String -- ^ String to read- -> Item Pandoc -- ^ Resulting document-readPandocWith ropt item = fmap (reader ropt (itemFileType item)) item+readPandocWith+ :: ReaderOptions -- ^ Parser options+ -> 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 $+ "Hakyll.Web.Pandoc.readPandocWith: parse failed: " ++ err+ Left (ParsecError _ err) -> fail $+ "Hakyll.Web.Pandoc.readPandocWith: parse failed: " ++ show err+ Right item' -> return item' where reader ro t = case t of DocBook -> readDocBook ro@@ -81,15 +90,17 @@ -------------------------------------------------------------------------------- -- | Render the resource using pandoc-renderPandoc :: Item String -> Item String+renderPandoc :: Item String -> Compiler (Item String) renderPandoc = renderPandocWith defaultHakyllReaderOptions defaultHakyllWriterOptions -------------------------------------------------------------------------------- -- | Render the resource using pandoc-renderPandocWith :: ReaderOptions -> WriterOptions -> Item String -> Item String-renderPandocWith ropt wopt = writePandocWith wopt . readPandocWith ropt+renderPandocWith+ :: ReaderOptions -> WriterOptions -> Item String -> Compiler (Item String)+renderPandocWith ropt wopt item =+ writePandocWith wopt <$> readPandocWith ropt item --------------------------------------------------------------------------------@@ -128,7 +139,7 @@ -> Compiler (Item String) pandocCompilerWithTransformM ropt wopt f = writePandocWith wopt <$>- (traverse f =<< readPandocWith ropt <$> getResourceBody)+ (traverse f =<< readPandocWith ropt =<< getResourceBody) --------------------------------------------------------------------------------
src/Hakyll/Web/Pandoc/Biblio.hs view
@@ -100,8 +100,8 @@ -- actual page. If we don't do this, pandoc won't even consider them -- citations! let Biblio refs = itemBody biblio- pandoc = itemBody $ readPandocWith ropt item- pandoc' = processCites style refs pandoc+ pandoc <- itemBody <$> readPandocWith ropt item+ let pandoc' = processCites style refs pandoc return $ fmap (const pandoc') item
tests/Hakyll/Core/Runtime/Tests.hs view
@@ -39,7 +39,7 @@ compile $ do getResourceBody >>= saveSnapshot "raw"- >>= return . renderPandoc+ >>= renderPandoc create ["bodies.txt"] $ do route idRoute