diff --git a/Makefile b/Makefile
index 563063e4e..7ed636bd9 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/SCREENSHOTS.md b/SCREENSHOTS.md
index 3aa37a31d..105346c62 100644
--- a/SCREENSHOTS.md
+++ b/SCREENSHOTS.md
@@ -12,21 +12,21 @@ Click to enlarge, or mouse over for captions..
.highslide-caption {color:white; background-color:black;}
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
diff --git a/site/style.css b/site/css/style.css
similarity index 100%
rename from site/style.css
rename to site/css/style.css
diff --git a/site/hakyll.hs b/site/hakyll.hs
index 68a90062d..71b413811 100644
--- a/site/hakyll.hs
+++ b/site/hakyll.hs
@@ -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)$"
+ , "
$title$
"
+ , "$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)$"
- , "
$title$
"
- , "$endif$"
- , "$for(include-before)$"
- , "$include-before$"
- , "$endfor$"
- , "$if(toc)$"
- , "$toc$"
- , "$endif$"
- , "$body$"
- , "$for(include-after)$"
- , "$include-after$"
- , "$endfor$"
- ]
diff --git a/site/hledger-charts-2.png b/site/images/hledger-charts-2.png
similarity index 100%
rename from site/hledger-charts-2.png
rename to site/images/hledger-charts-2.png
diff --git a/site/hledger-screen-1.png b/site/images/hledger-screen-1.png
similarity index 100%
rename from site/hledger-screen-1.png
rename to site/images/hledger-screen-1.png
diff --git a/site/hledger-web-journal.png b/site/images/hledger-web-journal.png
similarity index 100%
rename from site/hledger-web-journal.png
rename to site/images/hledger-web-journal.png
diff --git a/site/linux.png b/site/images/linux.png
similarity index 100%
rename from site/linux.png
rename to site/images/linux.png
diff --git a/site/mac.png b/site/images/mac.png
similarity index 100%
rename from site/mac.png
rename to site/images/mac.png
diff --git a/site/sshot.png b/site/images/sshot.png
similarity index 100%
rename from site/sshot.png
rename to site/images/sshot.png
diff --git a/site/watchhours.png b/site/images/watchhours.png
similarity index 100%
rename from site/watchhours.png
rename to site/images/watchhours.png
diff --git a/site/windows.png b/site/images/windows.png
similarity index 100%
rename from site/windows.png
rename to site/images/windows.png
diff --git a/site/highslide/graphics/close.png b/site/js/highslide/graphics/close.png
similarity index 100%
rename from site/highslide/graphics/close.png
rename to site/js/highslide/graphics/close.png
diff --git a/site/highslide/graphics/closeX.png b/site/js/highslide/graphics/closeX.png
similarity index 100%
rename from site/highslide/graphics/closeX.png
rename to site/js/highslide/graphics/closeX.png
diff --git a/site/highslide/graphics/fullexpand.gif b/site/js/highslide/graphics/fullexpand.gif
similarity index 100%
rename from site/highslide/graphics/fullexpand.gif
rename to site/js/highslide/graphics/fullexpand.gif
diff --git a/site/highslide/graphics/geckodimmer.png b/site/js/highslide/graphics/geckodimmer.png
similarity index 100%
rename from site/highslide/graphics/geckodimmer.png
rename to site/js/highslide/graphics/geckodimmer.png
diff --git a/site/highslide/graphics/icon.gif b/site/js/highslide/graphics/icon.gif
similarity index 100%
rename from site/highslide/graphics/icon.gif
rename to site/js/highslide/graphics/icon.gif
diff --git a/site/highslide/graphics/loader.gif b/site/js/highslide/graphics/loader.gif
similarity index 100%
rename from site/highslide/graphics/loader.gif
rename to site/js/highslide/graphics/loader.gif
diff --git a/site/highslide/graphics/loader.white.gif b/site/js/highslide/graphics/loader.white.gif
similarity index 100%
rename from site/highslide/graphics/loader.white.gif
rename to site/js/highslide/graphics/loader.white.gif
diff --git a/site/highslide/graphics/outlines/beveled.png b/site/js/highslide/graphics/outlines/beveled.png
similarity index 100%
rename from site/highslide/graphics/outlines/beveled.png
rename to site/js/highslide/graphics/outlines/beveled.png
diff --git a/site/highslide/graphics/outlines/drop-shadow.png b/site/js/highslide/graphics/outlines/drop-shadow.png
similarity index 100%
rename from site/highslide/graphics/outlines/drop-shadow.png
rename to site/js/highslide/graphics/outlines/drop-shadow.png
diff --git a/site/highslide/graphics/outlines/glossy-dark.png b/site/js/highslide/graphics/outlines/glossy-dark.png
similarity index 100%
rename from site/highslide/graphics/outlines/glossy-dark.png
rename to site/js/highslide/graphics/outlines/glossy-dark.png
diff --git a/site/highslide/graphics/outlines/outer-glow.png b/site/js/highslide/graphics/outlines/outer-glow.png
similarity index 100%
rename from site/highslide/graphics/outlines/outer-glow.png
rename to site/js/highslide/graphics/outlines/outer-glow.png
diff --git a/site/highslide/graphics/outlines/rounded-black.png b/site/js/highslide/graphics/outlines/rounded-black.png
similarity index 100%
rename from site/highslide/graphics/outlines/rounded-black.png
rename to site/js/highslide/graphics/outlines/rounded-black.png
diff --git a/site/highslide/graphics/outlines/rounded-white.png b/site/js/highslide/graphics/outlines/rounded-white.png
similarity index 100%
rename from site/highslide/graphics/outlines/rounded-white.png
rename to site/js/highslide/graphics/outlines/rounded-white.png
diff --git a/site/highslide/graphics/resize.gif b/site/js/highslide/graphics/resize.gif
similarity index 100%
rename from site/highslide/graphics/resize.gif
rename to site/js/highslide/graphics/resize.gif
diff --git a/site/highslide/graphics/zoomin.cur b/site/js/highslide/graphics/zoomin.cur
similarity index 100%
rename from site/highslide/graphics/zoomin.cur
rename to site/js/highslide/graphics/zoomin.cur
diff --git a/site/highslide/graphics/zoomout.cur b/site/js/highslide/graphics/zoomout.cur
similarity index 100%
rename from site/highslide/graphics/zoomout.cur
rename to site/js/highslide/graphics/zoomout.cur
diff --git a/site/highslide/highslide-ie6.css b/site/js/highslide/highslide-ie6.css
similarity index 100%
rename from site/highslide/highslide-ie6.css
rename to site/js/highslide/highslide-ie6.css
diff --git a/site/highslide/highslide.css b/site/js/highslide/highslide.css
similarity index 100%
rename from site/highslide/highslide.css
rename to site/js/highslide/highslide.css
diff --git a/site/highslide/highslide.js b/site/js/highslide/highslide.js
similarity index 100%
rename from site/highslide/highslide.js
rename to site/js/highslide/highslide.js
diff --git a/site/site.tmpl b/site/templates/default.html
similarity index 61%
rename from site/site.tmpl
rename to site/templates/default.html
index dcd1c0b65..22451faa7 100644
--- a/site/site.tmpl
+++ b/site/templates/default.html
@@ -4,30 +4,30 @@
- hledger.org - $title
-
-
-
+ hledger.org - $title$
+
+
+