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>
<tr>
<th width="34%" colspan=2><img src="../linux.png" /><br />GNU/Linux</th>
<th width="33%"><img src="../mac.png" border=0 /><br />Mac</th>
<th width="33%"><img src="../windows.png" border=0 /><br />Windows</th>
<th width="34%" colspan=2><img src="images/linux.png" /><br />GNU/Linux</th>
<th width="33%"><img src="images/mac.png" border=0 /><br />Mac</th>
<th width="33%"><img src="images/windows.png" border=0 /><br />Windows</th>
</tr>
<tr style="text-align:center; white-space:nowrap;">
<td width="25%">**32-bit**</td>

View File

@ -452,17 +452,9 @@ docs: site codedocs
# build the hledger.org website
# Requires hakyll (cabal install hakyll)
.PHONY: site
site: site/hakyll site/_site/index.html site/_site/profs
site: site/hakyll
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
cd site; ./hakyll clean
@ -472,7 +464,7 @@ previewsite: site/hakyll
site/hakyll: site/hakyll.hs
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
viewsite: site

View File

@ -12,21 +12,21 @@ Click to enlarge, or mouse over for captions..
.highslide-caption {color:white; background-color:black;}
</style>
<a name="hledger-screen-1" href="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>
<a name="hledger-screen-1" href="images/hledger-screen-1.png" class="highslide" onclick="return hs.expand(this)">
<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)">
<img src="sshot.png" title="The vty (curses-style) interface" /></a>
<a name="sshot" href="images/sshot.png" class="highslide" onclick="return hs.expand(this)">
<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)">
<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>
<a name="watchhours" href="images/watchhours.png" class="highslide" onclick="return hs.expand(this)">
<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)">
<img src="hledger-charts-2.png" title="Viewing a year of monthly expense charts in emacs (hledger 0.10 with -fchart)." /></a>
<a name="hledger-charts-2" href="images/hledger-charts-2.png" class="highslide" onclick="return hs.expand(this)">
<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)">
<img src="hledger-web-journal.png" title="The web interface (hledger 0.11pre with -fwebyesod)." /></a>
<a name="hledger-web-journal" href="images/hledger-web-journal.png" class="highslide" onclick="return hs.expand(this)">
<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)"> -->
<!-- <img height="150" src=".png" alt="" title="Click to enlarge" /></a> -->
<!-- <a name="" href="images/.png" class="highslide" onclick="return hs.expand(this)"> -->
<!-- <img height="150" src="images/.png" alt="" title="Click to enlarge" /></a> -->

View File

@ -1,76 +1,47 @@
#!/usr/bin/env runhaskell
{-# LANGUAGE OverloadedStrings #-}
{-
hakyll build script for hledger.org
requires Hakyll >= 2.1, pandoc >= 1.5
hakyll (3.2) build script for hledger.org
-}
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 Text.Hakyll (hakyllWithConfiguration, defaultHakyllConfiguration)
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.Pandoc
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
mapM_ renderParentDirPage
["README.md"
,"DOWNLOAD.md"
,"SCREENSHOTS.md"
,"MANUAL.md"
,"FAQ.md"
,"NEWS.md"
,"DEVELOPMENT.md"
,"CONTRIBUTORS.md"
]
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
symlinkPagesFromParentDir = do
fs <- filter (".md" `isSuffixOf`) `fmap` getDirectoryContents ".."
forM_ fs $ \f -> system $ printf "[ -f %s ] || ln -s ../%s" f f
symlinkIndexHtml = ensureSiteDir >> system "ln -sf README.html _site/index.html"
symlinkProfsDir = ensureSiteDir >> system "ln -sf ../../profs _site/profs"
ensureSiteDir = system "mkdir -p _site"
file = route idRoute >> compile copyFileCompiler
css = route idRoute >> compile compressCssCompiler
page = do
route $ setExtension "html"
compile $ pageCompilerWith pandocParserState pandocWriterOptions >>> applyTemplateCompiler "templates/default.html" >>> relativizeUrlsCompiler
cfg :: HakyllConfiguration
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 {
pandocParserState = defaultParserState {-
-- stateParseRaw = False, -- ^ Parse raw HTML and LaTeX?
-- stateParserContext = NullState, -- ^ Inside list?
-- stateQuoteContext = NoQuote, -- ^ Inside quoted environment?
@ -83,16 +54,31 @@ cfg = (defaultHakyllConfiguration baseurl) {
-- stateAuthors = [], -- ^ Authors of document
-- stateDate = [], -- ^ Date of document
-- stateStrict = False, -- ^ Use strict markdown syntax?
stateSmart = False -- ^ Use smart typography?
-- 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 {
-- so we can have a TOC:
writerStandalone = True, -- ^ Include header and footer
writerTemplate = pandocTemplate, -- ^ Template to use in standalone mode
-}
pandocWriterOptions = defaultWriterOptions {
writerStandalone = True, -- ^ Include header and footer -- needs to be true to have a toc
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
-- writerIncludeBefore = "", -- ^ Text to include before the body
-- writerIncludeAfter = "", -- ^ Text to include after the body
@ -111,21 +97,3 @@ cfg = (defaultHakyllConfiguration baseurl) {
-- writerEmailObfuscation = JavascriptObfuscation, -- ^ How to obfuscate emails
-- 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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>hledger.org - $title</title>
<link rel="stylesheet" type="text/css" href="$root/style.css" />
<script type="text/javascript" src="$root/highslide/highslide.js"></script>
<link rel="stylesheet" type="text/css" href="$root/highslide/highslide.css" />
<title>hledger.org - $title$</title>
<link rel="stylesheet" type="text/css" href="/css/style.css" />
<script type="text/javascript" src="/js/highslide/highslide.js"></script>
<link rel="stylesheet" type="text/css" href="/js/highslide/highslide.css" />
<script type="text/javascript">
hs.graphicsDir = '$root/highslide/graphics/';
hs.graphicsDir = '/js/highslide/graphics/';
hs.outlineType = 'rounded-black';
hs.captionEval = 'this.thumb.title';
</script>
</head>
<body>
<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 id="navigation">
<a href="$root/README.html">About</a>
<a href="$root/DOWNLOAD.html">Download</a>
<a href="$root/MANUAL.html">Docs</a>
<a href="$root/DEVELOPMENT.html">Development</a>
<a href="$root/NEWS.html">News</a>
<a href="$root/SCREENSHOTS.html">Screenshots</a>
<a href="/README.html">About</a>
<a href="/DOWNLOAD.html">Download</a>
<a href="/MANUAL.html">Docs</a>
<a href="/DEVELOPMENT.html">Development</a>
<a href="/NEWS.html">News</a>
<a href="/SCREENSHOTS.html">Screenshots</a>
<a href="http://demo.hledger.org">Demo</a>
</div>
$body
$body$
<div id="footer">
<hr />