tools: hakyll-std updates, use pandoc 2

This commit is contained in:
Simon Michael 2018-03-25 13:08:30 +01:00
parent 1fe3d7e824
commit 28f4b1a0ec
2 changed files with 10 additions and 5 deletions

View File

@ -14,6 +14,7 @@ import Text.Pandoc
import Text.Pandoc.Walk (walk, query)
import Data.List (groupBy)
import Data.Text (unpack)
import Data.Tree (Forest, Tree(Node))
#if !(MIN_VERSION_base(4,11,0))
import Data.Monoid ((<>), mconcat)
@ -53,9 +54,9 @@ markupHeader :: Tree Block -> H.Html
markupHeader (Node (Header _ (ident, _, keyvals) inline) headers)
| headers == [] = H.li $ link
| otherwise = H.li $ link <> (H.ol $ markupHeaders headers)
where render x = writeHtmlString def (Pandoc nullMeta [(Plain x)])
where render x = write5HtmlString def (Pandoc nullMeta [(Plain x)])
section = fromMaybe (render inline) (lookup "toc" keyvals)
link = H.a ! A.href (H.toValue $ "#" ++ ident) $ preEscapedToHtml section
link = H.a ! A.href (H.toValue $ "#" ++ ident) $ preEscapedToHtml $ unpack section
markupHeader _ = error "what"
markupHeaders :: Forest Block -> H.Html

View File

@ -5,9 +5,13 @@
--package pandoc
-- ghc
-}
-- Need to stick stack-ghc8.2.yaml for hakyll/pandoc. hledger and
-- Shake use stack.yaml by default so you may end up downloading and
-- building two snapshots. hakyll-std will go away soon hopefully.
-- pandoc must be >= 2
--
-- must use older stack-ghc8.2.yaml for hakyll/pandoc
-- (hledger and Shake use stack.yaml by default so you may
-- end up downloading and building two large snapshots)
--
-- hakyll-std will go away soon hopefully
{- |