site: update to hakyll 4
This commit is contained in:
parent
cbce921d63
commit
ae8d4882b4
@ -149,7 +149,7 @@ img {
|
|||||||
border: 10px solid #F8F8F8; /* Soft grey border */
|
border: 10px solid #F8F8F8; /* Soft grey border */
|
||||||
}
|
}
|
||||||
|
|
||||||
#TOC {
|
#toc {
|
||||||
float:right;
|
float:right;
|
||||||
font-size:small;
|
font-size:small;
|
||||||
margin:2em 0 1em 1em;
|
margin:2em 0 1em 1em;
|
||||||
@ -157,7 +157,7 @@ img {
|
|||||||
background-color:#f0f0f0;
|
background-color:#f0f0f0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#TOC ul {
|
#toc ul {
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
padding:0 1em 0 1em;
|
padding:0 1em 0 1em;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,40 +0,0 @@
|
|||||||
!!!
|
|
||||||
<html
|
|
||||||
<head
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
|
||||||
<title>#{title}
|
|
||||||
<link rel="stylesheet" type="text/css" href="/css/style.css" />
|
|
||||||
<style
|
|
||||||
<link rel="stylesheet" type="text/css" href="/js/highslide/highslide.css" />
|
|
||||||
<script type="text/javascript" src="/js/highslide/highslide.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
hs.graphicsDir = '/js/highslide/graphics/';
|
|
||||||
hs.outlineType = 'rounded-black';
|
|
||||||
hs.captionEval = 'this.thumb.title';
|
|
||||||
|
|
||||||
<body
|
|
||||||
<div style="text-align:center;"
|
|
||||||
<!-- <a href="/"><img src="/logo.jpg" border="0" ALT="" /></a> -->
|
|
||||||
<div#navigation
|
|
||||||
<a href="/README.html">Home</a>
|
|
||||||
<a href="/DOWNLOAD.html">Download</a>
|
|
||||||
<a href="/NEWS.html">News</a>
|
|
||||||
<a href="/MANUAL.html">Docs</a>
|
|
||||||
<a href="/DEVELOPMENT.html">Contribute</a>
|
|
||||||
<a href="http://wiki.hledger.org">Wiki</a>
|
|
||||||
<a href="http://demo.hledger.org">Demo</a>
|
|
||||||
|
|
||||||
#{body}
|
|
||||||
|
|
||||||
<div#footer
|
|
||||||
<hr />
|
|
||||||
© 2007-2012 <a href="http://joyful.com/">Simon Michael</a> and contributors
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
var gaJsHost = (('https:' == document.location.protocol) ? 'https://ssl.' : 'http://www.');
|
|
||||||
document.write(unescape('%3Cscript src=\'' + gaJsHost + 'google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E'));
|
|
||||||
<script type="text/javascript">
|
|
||||||
try {
|
|
||||||
var pageTracker = _gat._getTracker('UA-3456280-3');
|
|
||||||
pageTracker._trackPageview();
|
|
||||||
} catch(err) {}
|
|
||||||
139
site/site.hs
139
site/site.hs
@ -1,125 +1,46 @@
|
|||||||
#!/usr/bin/env runhaskell
|
#!/usr/bin/env runhaskell
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
{-
|
import Control.Applicative ((<$>))
|
||||||
hakyll (3.2) build script for hledger.org
|
import Data.Monoid (mappend)
|
||||||
-}
|
import Hakyll
|
||||||
|
|
||||||
|
import Control.Monad
|
||||||
import Prelude hiding (id)
|
import Data.List
|
||||||
import Control.Arrow ((>>>)) --, (***), arr)
|
import System.Directory
|
||||||
-- import Control.Category (id)
|
import System.Process
|
||||||
import Control.Monad
|
import Text.Pandoc.Options
|
||||||
import Data.List
|
import Text.Printf
|
||||||
-- import Data.Monoid (mempty, mconcat)
|
|
||||||
import Hakyll
|
|
||||||
import System.Directory
|
|
||||||
import System.Process (system)
|
|
||||||
import Text.Pandoc
|
|
||||||
import Text.Printf
|
|
||||||
|
|
||||||
main = do
|
main = do
|
||||||
symlinkPagesFromParentDir
|
symlinkPagesFromParentDir
|
||||||
symlinkIndexHtml
|
symlinkIndexHtml
|
||||||
symlinkProfsDir
|
symlinkProfsDir
|
||||||
hakyll $ do
|
hakyll $ do
|
||||||
match "*.hamlet" hamlet
|
match ("images/*" .||. "js/**" .||. "robots.txt") $ do
|
||||||
match "*.md" page
|
route idRoute
|
||||||
match "css/*" css
|
compile copyFileCompiler
|
||||||
match "images/*" file
|
match "css/*" $ do
|
||||||
match "js/**" file
|
route idRoute
|
||||||
match "robots.txt" file
|
compile compressCssCompiler
|
||||||
|
match "templates/*" $ compile templateCompiler
|
||||||
|
match "*.md" $ do
|
||||||
|
route $ setExtension "html"
|
||||||
|
compile $
|
||||||
|
pandocCompilerWith
|
||||||
|
def
|
||||||
|
def{writerTableOfContents=True
|
||||||
|
,writerStandalone=True
|
||||||
|
,writerTemplate="<div id=toc>$toc$</div>\n$body$"
|
||||||
|
}
|
||||||
|
>>= loadAndApplyTemplate "templates/default.html" defaultContext
|
||||||
|
>>= relativizeUrls
|
||||||
|
|
||||||
symlinkPagesFromParentDir = do
|
symlinkPagesFromParentDir = do
|
||||||
fs <- filter (".md" `isSuffixOf`) `fmap` getDirectoryContents ".."
|
fs <- filter (".md" `isSuffixOf`) `fmap` getDirectoryContents ".."
|
||||||
forM_ fs $ \f -> system $ printf "[ -f %s ] || ln -s ../%s" f f
|
forM_ fs $ \f -> system $ printf "[ -f %s ] || ln -s ../%s" f f
|
||||||
|
|
||||||
symlinkIndexHtml = ensureSiteDir >> system "ln -sf README.html _site/index.html"
|
symlinkIndexHtml = ensureSiteDir >> system "ln -sf README.html _site/index.html"
|
||||||
|
|
||||||
symlinkProfsDir = ensureSiteDir >> system "ln -sf ../../profs _site/profs"
|
symlinkProfsDir = ensureSiteDir >> system "ln -sf ../../profs _site/profs"
|
||||||
|
|
||||||
ensureSiteDir = system "mkdir -p _site"
|
ensureSiteDir = system "mkdir -p _site"
|
||||||
hamlet = compile templateCompiler
|
|
||||||
file = route idRoute >> compile copyFileCompiler
|
|
||||||
css = route idRoute >> compile compressCssCompiler
|
|
||||||
page = do
|
|
||||||
route $ setExtension "html"
|
|
||||||
compile $ pageCompilerWith pandocParserState pandocWriterOptions >>> applyTemplateCompiler "site.hamlet" >>> relativizeUrlsCompiler
|
|
||||||
|
|
||||||
pandocParserState = defaultParserState {-
|
|
||||||
-- stateParseRaw = False, -- ^ Parse raw HTML and LaTeX?
|
|
||||||
-- stateParserContext = NullState, -- ^ Inside list?
|
|
||||||
-- stateQuoteContext = NoQuote, -- ^ Inside quoted environment?
|
|
||||||
-- stateSanitizeHTML = False, -- ^ Sanitize HTML?
|
|
||||||
-- stateKeys = [], -- ^ List of reference keys
|
|
||||||
-- stateNotes = [], -- ^ List of notes
|
|
||||||
-- stateTabStop = 4, -- ^ Tab stop
|
|
||||||
-- stateStandalone = False, -- ^ Parse bibliographic info?
|
|
||||||
-- stateTitle = [], -- ^ Title of document
|
|
||||||
-- stateAuthors = [], -- ^ Authors of document
|
|
||||||
-- stateDate = [], -- ^ Date of document
|
|
||||||
-- stateStrict = False, -- ^ Use strict markdown syntax?
|
|
||||||
-- stateSmart = False -- ^ Use smart typography?
|
|
||||||
-- stateLiterateHaskell = False, -- ^ Treat input as literate haskell
|
|
||||||
-- stateColumns = 80, -- ^ Number of columns in terminal
|
|
||||||
-- stateHeaderTable = [], -- ^ Ordered list of header types used
|
|
||||||
-- stateIndentedCodeClasses = [] -- ^ Classes to use for indented code blocks
|
|
||||||
-}
|
|
||||||
|
|
||||||
pandocWriterOptions = defaultWriterOptions {
|
|
||||||
writerStandalone = True, -- ^ Include header and footer -- needs to be true to have a toc
|
|
||||||
writerTemplate = -- ^ Template to use in standalone mode
|
|
||||||
unlines
|
|
||||||
[
|
|
||||||
"$for(include-before)$",
|
|
||||||
"$include-before$",
|
|
||||||
"$endfor$",
|
|
||||||
"$if(title)$",
|
|
||||||
"$if(html5)$",
|
|
||||||
"<header>",
|
|
||||||
"$else$",
|
|
||||||
"<div id=\"$idprefix$header\">",
|
|
||||||
"$endif$",
|
|
||||||
"<h1 class=\"title\">$title$</h1>",
|
|
||||||
"$for(author)$",
|
|
||||||
"<h3 class=\"author\">$author$</h3>",
|
|
||||||
"$endfor$",
|
|
||||||
"$if(date)$",
|
|
||||||
"<h4 class=\"date\">$date$</h4>",
|
|
||||||
"$endif$",
|
|
||||||
"$if(html5)$",
|
|
||||||
"</header>",
|
|
||||||
"$else$",
|
|
||||||
"</div>",
|
|
||||||
"$endif$",
|
|
||||||
"$endif$",
|
|
||||||
"$if(toc)$",
|
|
||||||
"$if(html5)$",
|
|
||||||
"<nav id=\"$idprefix$TOC\">",
|
|
||||||
"$toc$",
|
|
||||||
"</nav>",
|
|
||||||
"$else$",
|
|
||||||
"<div id=\"$idprefix$TOC\">",
|
|
||||||
"$toc$",
|
|
||||||
"</div>",
|
|
||||||
"$endif$",
|
|
||||||
"$endif$",
|
|
||||||
"$body$",
|
|
||||||
"$for(include-after)$",
|
|
||||||
"$include-after$",
|
|
||||||
"$endfor$"
|
|
||||||
],
|
|
||||||
-- writerVariables = [], -- ^ Variables to set in template
|
|
||||||
-- writerIncludeBefore = "", -- ^ Text to include before the body
|
|
||||||
-- writerIncludeAfter = "", -- ^ Text to include after the body
|
|
||||||
-- writerTabStop = 4, -- ^ Tabstop for conversion btw spaces and tabs
|
|
||||||
writerTableOfContents = True -- ^ Include table of contents
|
|
||||||
-- writerS5 = False, -- ^ We're writing S5
|
|
||||||
-- writerXeTeX = False, -- ^ Create latex suitable for use by xetex
|
|
||||||
-- writerHTMLMathMethod = PlainMath, -- ^ How to print math in HTML
|
|
||||||
-- writerIgnoreNotes = False, -- ^ Ignore footnotes (used in making toc)
|
|
||||||
-- writerIncremental = False, -- ^ Incremental S5 lists
|
|
||||||
-- writerNumberSections = False, -- ^ Number sections in LaTeX
|
|
||||||
-- writerStrictMarkdown = False, -- ^ Use strict markdown syntax
|
|
||||||
-- writerReferenceLinks = False, -- ^ Use reference links in writing markdown, rst
|
|
||||||
-- writerWrapText = True, -- ^ Wrap text to line length
|
|
||||||
-- writerLiterateHaskell = False, -- ^ Write as literate haskell
|
|
||||||
-- writerEmailObfuscation = JavascriptObfuscation, -- ^ How to obfuscate emails
|
|
||||||
-- writerIdentifierPrefix = "", -- ^ Prefix for section & note ids in HTML
|
|
||||||
}
|
|
||||||
|
|||||||
47
site/templates/default.html
Normal file
47
site/templates/default.html
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||||
|
<title>$title$</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="/css/style.css" />
|
||||||
|
<link rel="stylesheet" type="text/css" href="/js/highslide/highslide.css" />
|
||||||
|
<script type="text/javascript" src="/js/highslide/highslide.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
hs.graphicsDir = '/js/highslide/graphics/';
|
||||||
|
hs.outlineType = 'rounded-black';
|
||||||
|
hs.captionEval = 'this.thumb.title';
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div style="text-align:center;">
|
||||||
|
<!-- <a href="/"><img src="/logo.jpg" border="0" ALT="" /></a> -->
|
||||||
|
</div>
|
||||||
|
<div id="navigation">
|
||||||
|
<a href="/README.html">Home</a>
|
||||||
|
<a href="/DOWNLOAD.html">Download</a>
|
||||||
|
<a href="/NEWS.html">News</a>
|
||||||
|
<a href="/MANUAL.html">Docs</a>
|
||||||
|
<a href="/DEVELOPMENT.html">Contribute</a>
|
||||||
|
<a href="http://wiki.hledger.org" class="offsite">Wiki</a>
|
||||||
|
<a href="http://demo.hledger.org" class="offsite">Demo</a>
|
||||||
|
</div>
|
||||||
|
$body$
|
||||||
|
<div id="footer">
|
||||||
|
<hr />
|
||||||
|
© 2007-2013 <a href="http://joyful.com/">Simon Michael</a> and contributors
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
var gaJsHost = (('https:' == document.location.protocol) ? 'https://ssl.' : 'http://www.');
|
||||||
|
document.write(unescape('%3Cscript src=\'' + gaJsHost + 'google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E'));
|
||||||
|
</script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
try {
|
||||||
|
var pageTracker = _gat._getTracker('UA-3456280-3');
|
||||||
|
pageTracker._trackPageview();
|
||||||
|
} catch(err) {}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Loading…
Reference in New Issue
Block a user