2012-12-05 15:54:57 +00:00
|
|
|
--------------------------------------------------------------------------------
|
2011-02-12 14:16:42 +00:00
|
|
|
{-# LANGUAGE OverloadedStrings #-}
|
2012-12-05 15:54:57 +00:00
|
|
|
import Control.Monad (forM_)
|
|
|
|
import Data.Monoid (mappend)
|
|
|
|
import Hakyll
|
|
|
|
import Text.Pandoc
|
2010-01-02 19:47:52 +00:00
|
|
|
|
2012-12-05 15:54:57 +00:00
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
2011-02-12 14:16:42 +00:00
|
|
|
main :: IO ()
|
2011-06-16 09:51:55 +00:00
|
|
|
main = hakyllWith config $ do
|
2011-04-05 14:20:43 +00:00
|
|
|
match "css/*" $ do
|
|
|
|
route idRoute
|
|
|
|
compile compressCssCompiler
|
2009-12-29 18:26:51 +00:00
|
|
|
|
2011-02-12 14:16:42 +00:00
|
|
|
-- Static directories
|
2011-06-11 19:01:20 +00:00
|
|
|
forM_ ["images/*", "examples/*", "reference/**"] $ \f -> match f $ do
|
2011-04-05 14:20:43 +00:00
|
|
|
route idRoute
|
|
|
|
compile copyFileCompiler
|
2010-01-02 19:47:52 +00:00
|
|
|
|
2011-02-12 14:16:42 +00:00
|
|
|
-- Pages
|
2012-12-05 15:54:57 +00:00
|
|
|
match "*.markdown" $ do
|
2011-04-05 14:20:43 +00:00
|
|
|
route $ setExtension "html"
|
2012-12-16 09:05:21 +00:00
|
|
|
compile $ pandocCompiler
|
2012-12-14 09:42:30 +00:00
|
|
|
>>= loadAndApplyTemplate "templates/default.html" defaultContext
|
2012-12-05 15:54:57 +00:00
|
|
|
>>= relativizeUrls
|
2010-03-30 17:36:41 +00:00
|
|
|
|
2011-06-13 16:26:04 +00:00
|
|
|
-- Tutorials
|
|
|
|
match "tutorials/*" $ do
|
2011-04-05 14:20:43 +00:00
|
|
|
route $ setExtension "html"
|
2012-12-16 09:05:21 +00:00
|
|
|
compile $ pandocCompilerWith defaultHakyllParserState withToc
|
2012-12-14 09:42:30 +00:00
|
|
|
>>= loadAndApplyTemplate "templates/tutorial.html" defaultContext
|
|
|
|
>>= loadAndApplyTemplate "templates/default.html" defaultContext
|
2012-12-05 15:54:57 +00:00
|
|
|
>>= relativizeUrls
|
2009-12-29 18:26:51 +00:00
|
|
|
|
2011-06-13 16:26:04 +00:00
|
|
|
-- Tutorial list
|
2012-12-05 15:54:57 +00:00
|
|
|
match "tutorials.html" $ do
|
|
|
|
route idRoute
|
|
|
|
compile $ do
|
2012-12-14 09:42:30 +00:00
|
|
|
tutorials <- loadAll "tutorials/*"
|
|
|
|
itemTpl <- loadBody "templates/tutorial-item.html"
|
2012-12-05 15:54:57 +00:00
|
|
|
list <- applyTemplateList itemTpl defaultContext $
|
|
|
|
chronological tutorials
|
|
|
|
|
|
|
|
let tutorialsCtx =
|
|
|
|
constField "title" "Tutorials" `mappend`
|
|
|
|
constField "tutorials" list `mappend`
|
|
|
|
defaultContext
|
2011-06-13 16:26:04 +00:00
|
|
|
|
2012-12-05 15:54:57 +00:00
|
|
|
makeItem ""
|
2012-12-14 09:42:30 +00:00
|
|
|
>>= loadAndApplyTemplate "templates/tutorials.html" tutorialsCtx
|
|
|
|
>>= loadAndApplyTemplate "templates/default.html" tutorialsCtx
|
2012-12-05 15:54:57 +00:00
|
|
|
>>= relativizeUrls
|
2011-02-12 14:16:42 +00:00
|
|
|
|
|
|
|
-- Templates
|
2011-04-05 14:20:43 +00:00
|
|
|
match "templates/*" $ compile templateCompiler
|
2010-01-19 09:08:57 +00:00
|
|
|
where
|
2011-02-12 14:21:26 +00:00
|
|
|
withToc = defaultHakyllWriterOptions
|
2011-02-12 14:16:42 +00:00
|
|
|
{ writerTableOfContents = True
|
2011-06-13 16:26:04 +00:00
|
|
|
, writerTemplate = "$toc$\n$body$"
|
2011-02-12 14:16:42 +00:00
|
|
|
, writerStandalone = True
|
|
|
|
}
|
|
|
|
|
2011-06-16 09:51:55 +00:00
|
|
|
|
2012-12-05 15:54:57 +00:00
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
config :: Configuration
|
|
|
|
config = defaultConfiguration
|
|
|
|
{ verbosity = Debug
|
|
|
|
, deployCommand = "rsync --checksum -ave 'ssh -p 2222' \
|
2012-12-17 16:28:12 +00:00
|
|
|
\_site/* jaspervdj@jaspervdj.be:jaspervdj.be/tmp/hakyll4"
|
2011-06-16 09:51:55 +00:00
|
|
|
}
|