site: upgrade to hakyll 3

This commit is contained in:
Simon Michael 2011-08-28 18:03:20 +00:00
parent 3547542937
commit 1cf1c7f506
33 changed files with 87 additions and 127 deletions

View File

@ -25,9 +25,9 @@ href="../MANUAL.html#installing">installation docs</a>.
<table> <table>
<tr> <tr>
<th width="34%" colspan=2><img src="../linux.png" /><br />GNU/Linux</th> <th width="34%" colspan=2><img src="images/linux.png" /><br />GNU/Linux</th>
<th width="33%"><img src="../mac.png" border=0 /><br />Mac</th> <th width="33%"><img src="images/mac.png" border=0 /><br />Mac</th>
<th width="33%"><img src="../windows.png" border=0 /><br />Windows</th> <th width="33%"><img src="images/windows.png" border=0 /><br />Windows</th>
</tr> </tr>
<tr style="text-align:center; white-space:nowrap;"> <tr style="text-align:center; white-space:nowrap;">
<td width="25%">**32-bit**</td> <td width="25%">**32-bit**</td>

View File

@ -452,17 +452,9 @@ docs: site codedocs
# build the hledger.org website # build the hledger.org website
# Requires hakyll (cabal install hakyll) # Requires hakyll (cabal install hakyll)
.PHONY: site .PHONY: site
site: site/hakyll site/_site/index.html site/_site/profs site: site/hakyll
cd site; ./hakyll build cd site; ./hakyll build
site/_site/index.html:
mkdir -p site/_site
cd site/_site; ln -sf README.html index.html; ln -sf ../../profs
site/_site/profs:
mkdir -p site/_site
cd site/_site; ln -sf ../../profs
cleansite: site/hakyll cleansite: site/hakyll
cd site; ./hakyll clean cd site; ./hakyll clean
@ -472,7 +464,7 @@ previewsite: site/hakyll
site/hakyll: site/hakyll.hs site/hakyll: site/hakyll.hs
cd site; ghc --make hakyll.hs $(PREFERMACUSRLIBFLAGS) cd site; ghc --make hakyll.hs $(PREFERMACUSRLIBFLAGS)
siteci: autosite:
cd site; sp --no-exts --no-default-map -o hakyll ghc --make hakyll.hs $(PREFERMACUSRLIBFLAGS) --run preview cd site; sp --no-exts --no-default-map -o hakyll ghc --make hakyll.hs $(PREFERMACUSRLIBFLAGS) --run preview
viewsite: site viewsite: site

View File

@ -12,21 +12,21 @@ Click to enlarge, or mouse over for captions..
.highslide-caption {color:white; background-color:black;} .highslide-caption {color:white; background-color:black;}
</style> </style>
<a name="hledger-screen-1" href="hledger-screen-1.png" class="highslide" onclick="return hs.expand(this)"> <a name="hledger-screen-1" href="images/hledger-screen-1.png" class="highslide" onclick="return hs.expand(this)">
<img src="hledger-screen-1.png" title="Basic command-line reports, like ledger" /></a> <img src="images/hledger-screen-1.png" title="Basic command-line reports, like ledger" /></a>
<a name="sshot" href="sshot.png" class="highslide" onclick="return hs.expand(this)"> <a name="sshot" href="images/sshot.png" class="highslide" onclick="return hs.expand(this)">
<img src="sshot.png" title="The vty (curses-style) interface" /></a> <img src="images/sshot.png" title="The vty (curses-style) interface" /></a>
<a name="watchhours" href="watchhours.png" class="highslide" onclick="return hs.expand(this)"> <a name="watchhours" href="images/watchhours.png" class="highslide" onclick="return hs.expand(this)">
<img src="watchhours.png" title="A time dashboard in emacs. The upper window displays today's time report every minute (using ansi-term, watch, a helper script, and hledger invoked via 'hours' symlink.) The lower window is viewing the timelog file, to tweak clock-ins/clock-outs made with C-x t i and C-x t o." /></a> <img src="images/watchhours.png" title="A time dashboard in emacs. The upper window displays today's time report every minute (using ansi-term, watch, a helper script, and hledger invoked via 'hours' symlink.) The lower window is viewing the timelog file, to tweak clock-ins/clock-outs made with C-x t i and C-x t o." /></a>
<a name="hledger-charts-2" href="hledger-charts-2.png" class="highslide" onclick="return hs.expand(this)"> <a name="hledger-charts-2" href="images/hledger-charts-2.png" class="highslide" onclick="return hs.expand(this)">
<img src="hledger-charts-2.png" title="Viewing a year of monthly expense charts in emacs (hledger 0.10 with -fchart)." /></a> <img src="images/hledger-charts-2.png" title="Viewing a year of monthly expense charts in emacs (hledger 0.10 with -fchart)." /></a>
<a name="hledger-web-journal" href="hledger-web-journal.png" class="highslide" onclick="return hs.expand(this)"> <a name="hledger-web-journal" href="images/hledger-web-journal.png" class="highslide" onclick="return hs.expand(this)">
<img src="hledger-web-journal.png" title="The web interface (hledger 0.11pre with -fwebyesod)." /></a> <img src="images/hledger-web-journal.png" title="The web interface (hledger 0.11pre with -fwebyesod)." /></a>
<!-- <a name="" href=".png" class="highslide" onclick="return hs.expand(this)"> --> <!-- <a name="" href="images/.png" class="highslide" onclick="return hs.expand(this)"> -->
<!-- <img height="150" src=".png" alt="" title="Click to enlarge" /></a> --> <!-- <img height="150" src="images/.png" alt="" title="Click to enlarge" /></a> -->

View File

@ -1,76 +1,47 @@
#!/usr/bin/env runhaskell #!/usr/bin/env runhaskell
{-# LANGUAGE OverloadedStrings #-}
{- {-
hakyll build script for hledger.org hakyll (3.2) build script for hledger.org
requires Hakyll >= 2.1, pandoc >= 1.5
-} -}
import Control.Monad (forM_)
import Control.Monad.Trans (liftIO)
import Prelude hiding (id)
import Control.Arrow ((>>>)) --, (***), arr)
-- import Control.Category (id)
import Control.Monad
import Data.List
-- import Data.Monoid (mempty, mconcat)
import Hakyll
import System.Directory
import System.Process (system) import System.Process (system)
import Text.Hakyll (hakyllWithConfiguration, defaultHakyllConfiguration) import Text.Pandoc
import Text.Hakyll.HakyllMonad (HakyllConfiguration(..))
import Text.Hakyll.Render (renderChain, static)
import Text.Hakyll.CreateContext (createPage, createCustomPage, createListing)
import Text.Pandoc (ParserState(..), WriterOptions(..), defaultParserState, defaultWriterOptions)
import Text.Printf import Text.Printf
baseurl = "http://hledger.org" main = do
symlinkPagesFromParentDir
symlinkIndexHtml
symlinkProfsDir
hakyll $ do
match "templates/*" $ compile templateCompiler
match "css/*" css
match "images/*" file
match "js/**" file
match "robots.txt" file
match "*.md" page
main = hakyllWithConfiguration cfg $ do symlinkPagesFromParentDir = do
mapM_ renderParentDirPage fs <- filter (".md" `isSuffixOf`) `fmap` getDirectoryContents ".."
["README.md" forM_ fs $ \f -> system $ printf "[ -f %s ] || ln -s ../%s" f f
,"DOWNLOAD.md" symlinkIndexHtml = ensureSiteDir >> system "ln -sf README.html _site/index.html"
,"SCREENSHOTS.md" symlinkProfsDir = ensureSiteDir >> system "ln -sf ../../profs _site/profs"
,"MANUAL.md" ensureSiteDir = system "mkdir -p _site"
,"FAQ.md" file = route idRoute >> compile copyFileCompiler
,"NEWS.md" css = route idRoute >> compile compressCssCompiler
,"DEVELOPMENT.md" page = do
,"CONTRIBUTORS.md" route $ setExtension "html"
] compile $ pageCompilerWith pandocParserState pandocWriterOptions >>> applyTemplateCompiler "templates/default.html" >>> relativizeUrlsCompiler
mapM_ static
["style.css"
,"highslide/highslide.js"
,"highslide/highslide.css"
,"highslide/highslide-ie6.css"
,"highslide/graphics/zoomin.cur"
,"highslide/graphics/zoomout.cur"
,"highslide/graphics/outlines/rounded-black.png"
,"highslide/graphics/outlines/rounded-white.png"
,"highslide/graphics/outlines/beveled.png"
,"highslide/graphics/outlines/drop-shadow.png"
,"highslide/graphics/outlines/glossy-dark.png"
,"highslide/graphics/outlines/outer-glow.png"
,"highslide/graphics/loader.gif"
,"highslide/graphics/loader.white.gif"
,"highslide/graphics/icon.gif"
,"highslide/graphics/resize.gif"
,"highslide/graphics/fullexpand.gif"
,"highslide/graphics/geckodimmer.png"
,"highslide/graphics/close.png"
,"highslide/graphics/closeX.png"
,"linux.png"
,"mac.png"
,"windows.png"
,"sshot.png"
,"watchhours.png"
,"hledger-screen-1.png"
,"hledger-charts-2.png"
,"hledger-web-journal.png"
]
where
-- Render a page from the parent directory as if it was in the hakyll
-- root dir, setting up a symbolic link when needed.
renderParentDirPage p = do
liftIO $ system $ printf "[ -f %s ] || ln -s ../%s" p p
renderChain ["site.tmpl"] $ createPage p
cfg :: HakyllConfiguration pandocParserState = defaultParserState {-
cfg = (defaultHakyllConfiguration baseurl) {
-- additionalContext = Context, -- An additional context to use when rendering. This additional context is used globally.
-- siteDirectory = FilePath, -- Directory where the site is placed.
-- cacheDirectory = FilePath, -- Directory for cache files.
-- enableIndexUrl = False, -- Enable index links.
-- previewPollDelay = Int, -- Delay between polls in preview mode.
pandocParserState = defaultParserState {
-- stateParseRaw = False, -- ^ Parse raw HTML and LaTeX? -- stateParseRaw = False, -- ^ Parse raw HTML and LaTeX?
-- stateParserContext = NullState, -- ^ Inside list? -- stateParserContext = NullState, -- ^ Inside list?
-- stateQuoteContext = NoQuote, -- ^ Inside quoted environment? -- stateQuoteContext = NoQuote, -- ^ Inside quoted environment?
@ -83,16 +54,31 @@ cfg = (defaultHakyllConfiguration baseurl) {
-- stateAuthors = [], -- ^ Authors of document -- stateAuthors = [], -- ^ Authors of document
-- stateDate = [], -- ^ Date of document -- stateDate = [], -- ^ Date of document
-- stateStrict = False, -- ^ Use strict markdown syntax? -- stateStrict = False, -- ^ Use strict markdown syntax?
stateSmart = False -- ^ Use smart typography? -- stateSmart = False -- ^ Use smart typography?
-- stateLiterateHaskell = False, -- ^ Treat input as literate haskell -- stateLiterateHaskell = False, -- ^ Treat input as literate haskell
-- stateColumns = 80, -- ^ Number of columns in terminal -- stateColumns = 80, -- ^ Number of columns in terminal
-- stateHeaderTable = [], -- ^ Ordered list of header types used -- stateHeaderTable = [], -- ^ Ordered list of header types used
-- stateIndentedCodeClasses = [] -- ^ Classes to use for indented code blocks -- stateIndentedCodeClasses = [] -- ^ Classes to use for indented code blocks
}, -}
pandocWriterOptions = defaultWriterOptions {
-- so we can have a TOC: pandocWriterOptions = defaultWriterOptions {
writerStandalone = True, -- ^ Include header and footer writerStandalone = True, -- ^ Include header and footer -- needs to be true to have a toc
writerTemplate = pandocTemplate, -- ^ Template to use in standalone mode writerTemplate = -- ^ Template to use in standalone mode
unlines
[ "$if(title)$"
, "<h1 class=\"title\">$title$</h1>"
, "$endif$"
, "$for(include-before)$"
, "$include-before$"
, "$endfor$"
, "$if(toc)$"
, "$toc$"
, "$endif$"
, "$body$"
, "$for(include-after)$"
, "$include-after$"
, "$endfor$"
],
-- writerVariables = [], -- ^ Variables to set in template -- writerVariables = [], -- ^ Variables to set in template
-- writerIncludeBefore = "", -- ^ Text to include before the body -- writerIncludeBefore = "", -- ^ Text to include before the body
-- writerIncludeAfter = "", -- ^ Text to include after the body -- writerIncludeAfter = "", -- ^ Text to include after the body
@ -111,21 +97,3 @@ cfg = (defaultHakyllConfiguration baseurl) {
-- writerEmailObfuscation = JavascriptObfuscation, -- ^ How to obfuscate emails -- writerEmailObfuscation = JavascriptObfuscation, -- ^ How to obfuscate emails
-- writerIdentifierPrefix = "", -- ^ Prefix for section & note ids in HTML -- writerIdentifierPrefix = "", -- ^ Prefix for section & note ids in HTML
} }
}
-- the body part of pandoc 1.5.1.1's html output template
pandocTemplate = unlines
[ "$if(title)$"
, "<h1 class=\"title\">$title$</h1>"
, "$endif$"
, "$for(include-before)$"
, "$include-before$"
, "$endfor$"
, "$if(toc)$"
, "$toc$"
, "$endif$"
, "$body$"
, "$for(include-after)$"
, "$include-after$"
, "$endfor$"
]

View File

Before

Width:  |  Height:  |  Size: 219 KiB

After

Width:  |  Height:  |  Size: 219 KiB

View File

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 65 KiB

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 84 KiB

View File

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 209 B

After

Width:  |  Height:  |  Size: 209 B

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 867 B

After

Width:  |  Height:  |  Size: 867 B

View File

Before

Width:  |  Height:  |  Size: 668 B

After

Width:  |  Height:  |  Size: 668 B

View File

Before

Width:  |  Height:  |  Size: 673 B

After

Width:  |  Height:  |  Size: 673 B

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 70 B

After

Width:  |  Height:  |  Size: 70 B

View File

Before

Width:  |  Height:  |  Size: 326 B

After

Width:  |  Height:  |  Size: 326 B

View File

Before

Width:  |  Height:  |  Size: 326 B

After

Width:  |  Height:  |  Size: 326 B

View File

@ -4,30 +4,30 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>hledger.org - $title</title> <title>hledger.org - $title$</title>
<link rel="stylesheet" type="text/css" href="$root/style.css" /> <link rel="stylesheet" type="text/css" href="/css/style.css" />
<script type="text/javascript" src="$root/highslide/highslide.js"></script> <script type="text/javascript" src="/js/highslide/highslide.js"></script>
<link rel="stylesheet" type="text/css" href="$root/highslide/highslide.css" /> <link rel="stylesheet" type="text/css" href="/js/highslide/highslide.css" />
<script type="text/javascript"> <script type="text/javascript">
hs.graphicsDir = '$root/highslide/graphics/'; hs.graphicsDir = '/js/highslide/graphics/';
hs.outlineType = 'rounded-black'; hs.outlineType = 'rounded-black';
hs.captionEval = 'this.thumb.title'; hs.captionEval = 'this.thumb.title';
</script> </script>
</head> </head>
<body> <body>
<div style="text-align:center;"> <div style="text-align:center;">
<!-- <a href="$root/"><img src="$root/logo.jpg" border="0" ALT="" /></a> --> <!-- <a href="/"><img src="/logo.jpg" border="0" ALT="" /></a> -->
</div> </div>
<div id="navigation"> <div id="navigation">
<a href="$root/README.html">About</a> <a href="/README.html">About</a>
<a href="$root/DOWNLOAD.html">Download</a> <a href="/DOWNLOAD.html">Download</a>
<a href="$root/MANUAL.html">Docs</a> <a href="/MANUAL.html">Docs</a>
<a href="$root/DEVELOPMENT.html">Development</a> <a href="/DEVELOPMENT.html">Development</a>
<a href="$root/NEWS.html">News</a> <a href="/NEWS.html">News</a>
<a href="$root/SCREENSHOTS.html">Screenshots</a> <a href="/SCREENSHOTS.html">Screenshots</a>
<a href="http://demo.hledger.org">Demo</a> <a href="http://demo.hledger.org">Demo</a>
</div> </div>
$body $body$
<div id="footer"> <div id="footer">
<hr /> <hr />