From d143a4d490f567a1d911e824d23a3fe4d0e582c5 Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Wed, 26 Feb 2020 13:25:26 +0100 Subject: Fix compilation issues --- web/site.hs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'web') diff --git a/web/site.hs b/web/site.hs index cb3ade4..dc86b69 100644 --- a/web/site.hs +++ b/web/site.hs @@ -3,12 +3,11 @@ import Control.Arrow (second) import Control.Monad (filterM, forM_) import Data.List (isPrefixOf, sortBy) -import Data.Monoid ((<>)) import Data.Ord (comparing) import Hakyll import System.Directory (copyFile) import System.FilePath (dropTrailingPathSeparator, splitPath) -import Text.Pandoc +import qualified Text.Pandoc as Pandoc -------------------------------------------------------------------------------- @@ -67,10 +66,16 @@ main = hakyllWith config $ do match "templates/*" $ compile templateCompiler where withToc = defaultHakyllWriterOptions - { writerTableOfContents = True - , writerTemplate = Just "$toc$\n$body$" + { Pandoc.writerTableOfContents = True + , Pandoc.writerTemplate = Just tocTemplate } + -- When did it get so hard to compile a string to a Pandoc template? + tocTemplate = + either error id $ either (error . show) id $ + Pandoc.runPure $ Pandoc.runWithDefaultPartials $ + Pandoc.compileTemplate "" "$toc$\n$body$" + -------------------------------------------------------------------------------- config :: Configuration -- cgit v1.2.3