2011-02-12 14:16:42 +00:00
|
|
|
{-# LANGUAGE OverloadedStrings #-}
|
|
|
|
import Hakyll
|
|
|
|
import Control.Monad (forM_)
|
|
|
|
import Control.Arrow ((>>>), arr)
|
2011-06-13 16:26:04 +00:00
|
|
|
import Data.Monoid (mempty)
|
2011-02-12 14:21:26 +00:00
|
|
|
import Text.Pandoc
|
2010-01-02 19:47:52 +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
|
2011-04-05 14:20:43 +00:00
|
|
|
forM_ pages $ \p -> match p $ do
|
|
|
|
route $ setExtension "html"
|
|
|
|
compile $ pageCompiler
|
2011-02-12 14:16:42 +00:00
|
|
|
>>> requireA "sidebar.markdown" (setFieldA "sidebar" $ arr pageBody)
|
2011-02-26 14:49:46 +00:00
|
|
|
>>> applyTemplateCompiler "templates/default.html"
|
|
|
|
>>> relativizeUrlsCompiler
|
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"
|
2011-06-13 16:26:04 +00:00
|
|
|
compile $ pageCompilerWith defaultHakyllParserState withToc
|
2011-04-05 14:20:43 +00:00
|
|
|
>>> requireA "sidebar.markdown" (setFieldA "sidebar" $ arr pageBody)
|
2011-06-13 16:26:04 +00:00
|
|
|
>>> applyTemplateCompiler "templates/tutorial.html"
|
2011-04-05 14:20:43 +00:00
|
|
|
>>> applyTemplateCompiler "templates/default.html"
|
|
|
|
>>> relativizeUrlsCompiler
|
2009-12-29 18:26:51 +00:00
|
|
|
|
2011-06-13 16:26:04 +00:00
|
|
|
-- Tutorial list
|
|
|
|
match "tutorials.html" $ route idRoute
|
|
|
|
create "tutorials.html" $ constA mempty
|
|
|
|
>>> arr (setField "title" "Tutorials")
|
|
|
|
>>> setFieldPageList chronological
|
|
|
|
"templates/tutorial-item.html" "tutorials" "tutorials/*"
|
|
|
|
>>> requireA "sidebar.markdown" (setFieldA "sidebar" $ arr pageBody)
|
|
|
|
>>> applyTemplateCompiler "templates/tutorials.html"
|
|
|
|
>>> applyTemplateCompiler "templates/default.html"
|
|
|
|
>>> relativizeUrlsCompiler
|
|
|
|
|
2011-02-12 14:16:42 +00:00
|
|
|
-- Sidebar
|
2011-04-05 14:20:43 +00:00
|
|
|
match "sidebar.markdown" $ compile pageCompiler
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
pages = [ "about.markdown"
|
|
|
|
, "changelog.markdown"
|
2011-05-29 09:43:54 +00:00
|
|
|
, "examples.markdown"
|
2011-02-12 14:16:42 +00:00
|
|
|
, "index.markdown"
|
|
|
|
, "philosophy.markdown"
|
|
|
|
, "reference.markdown"
|
|
|
|
]
|
2011-06-16 09:51:55 +00:00
|
|
|
|
|
|
|
config :: HakyllConfiguration
|
|
|
|
config = defaultHakyllConfiguration
|
|
|
|
{ deployCommand = "rsync --checksum -ave 'ssh -p 2222' \
|
|
|
|
\_site/* jaspervdj@jaspervdj.be:jaspervdj.be/hakyll"
|
|
|
|
}
|