Update to new Pandoc and Hakyll.
This commit is contained in:
+14
-12
@@ -1,3 +1,5 @@
|
||||
module Main where
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
import Data.Monoid
|
||||
@@ -56,33 +58,33 @@ bib2bibParse file =
|
||||
--------------------------------------------------------------------------------
|
||||
main :: IO ()
|
||||
main = hakyllWith config $ do
|
||||
match "files/**" $ do
|
||||
match (fromGlob "files/**") $ do
|
||||
route idRoute
|
||||
compile copyFileCompiler
|
||||
|
||||
match "images/**" $ do
|
||||
match (fromGlob "images/**") $ do
|
||||
route idRoute
|
||||
compile copyFileCompiler
|
||||
|
||||
match "css/*.scss" $ do
|
||||
match (fromGlob "css/*.scss") $ do
|
||||
route $ setExtension "css"
|
||||
compile $ compass
|
||||
|
||||
forM_ bibHeaders $ \(nick, flags) ->
|
||||
create [fromCapture "bibs/*.html" nick] $ do
|
||||
create [fromCapture (fromGlob "bibs/*.html") nick] $ do
|
||||
route idRoute
|
||||
compile $
|
||||
let biblioCtx = mconcat
|
||||
[ field "bibitems" $ return . itemBody ] in do
|
||||
bibTpl <- loadBody "templates/bibitemtpl.html"
|
||||
bibTpl <- loadBody $ fromFilePath "templates/bibitemtpl.html"
|
||||
(bib2bib flags)
|
||||
>>= bib2bibParse
|
||||
>>= applyTemplateList bibTpl bibEntryContext
|
||||
>>= makeItem
|
||||
>>= loadAndApplyTemplate "templates/biblisttpl.html" biblioCtx
|
||||
>>= loadAndApplyTemplate (fromFilePath "templates/biblisttpl.html") biblioCtx
|
||||
>>= relativizeUrls
|
||||
|
||||
match "content/biblio.md" $ do
|
||||
match (fromGlob "content/biblio.md") $ do
|
||||
route $ setExtension "html"
|
||||
compile $ do
|
||||
let makeBibCtx (nick, _) =
|
||||
@@ -93,26 +95,26 @@ main = hakyllWith config $ do
|
||||
>>= applyAsTemplate biblioCtx
|
||||
>>= relativizeUrls
|
||||
|
||||
match "content/*.md" $ do
|
||||
match (fromGlob "content/*.md") $ do
|
||||
route $ setExtension "html"
|
||||
compile $ do
|
||||
let secDiv = defaultHakyllWriterOptions { writerSectionDivs = True }
|
||||
pandocCompilerWith defaultHakyllReaderOptions secDiv
|
||||
>>= relativizeUrls
|
||||
|
||||
match "index.html" $ do
|
||||
match (fromGlob "index.html") $ do
|
||||
route idRoute
|
||||
compile $ do
|
||||
let loadSec sec = field sec
|
||||
(\_ -> loadBody (fromFilePath $ "content/" ++ sec ++ ".md"))
|
||||
mainContext = mconcat $ fmap loadSec contentSections
|
||||
indexContext =
|
||||
field "footer" (\_ -> loadBody "content/footer.md")
|
||||
field "footer" (\_ -> loadBody $ fromFilePath "content/footer.md")
|
||||
`mappend`
|
||||
defaultContext
|
||||
getResourceBody
|
||||
>>= applyAsTemplate mainContext
|
||||
>>= loadAndApplyTemplate "templates/main.html" indexContext
|
||||
>>= loadAndApplyTemplate (fromFilePath "templates/main.html") indexContext
|
||||
>>= relativizeUrls
|
||||
|
||||
match "templates/*" $ compile templateCompiler
|
||||
match (fromGlob "templates/*") $ compile templateCompiler
|
||||
|
||||
Reference in New Issue
Block a user