From 7dcb91a70f56bc53c858b5b23eeb88b2cb8eb63a Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Mon, 17 May 2010 14:33:05 +0000 Subject: [PATCH] docs: build site with hakyll --- CONTRIBUTORS => CONTRIBUTORS.rst | 3 +++ MANUAL => MANUAL.rst | 7 ++++-- Makefile | 28 +++++++++++++-------- NEWS => NEWS.rst | 3 +++ README => README.rst | 3 +++ README2 => README2.rst | 3 +++ SCREENSHOTS => SCREENSHOTS.rst | 5 +++- website/footer.html | 4 --- website/hakyll.hs | 32 ++++++++++++++++++++++++ website/header.html | 10 -------- website/hoogle-small.html | 11 --------- website/site.tmpl | 40 ++++++++++++++++++++++++++++++ website/style.css | 42 ++++++++++++++++++++++---------- 13 files changed, 140 insertions(+), 51 deletions(-) rename CONTRIBUTORS => CONTRIBUTORS.rst (97%) rename MANUAL => MANUAL.rst (99%) rename NEWS => NEWS.rst (99%) rename README => README.rst (98%) rename README2 => README2.rst (99%) rename SCREENSHOTS => SCREENSHOTS.rst (95%) delete mode 100644 website/footer.html create mode 100644 website/hakyll.hs delete mode 100644 website/header.html delete mode 100644 website/hoogle-small.html create mode 100644 website/site.tmpl diff --git a/CONTRIBUTORS b/CONTRIBUTORS.rst similarity index 97% rename from CONTRIBUTORS rename to CONTRIBUTORS.rst index ad7ba3004..299d1d2dd 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS.rst @@ -1,3 +1,6 @@ +--- +title: hledger Contributor List and Agreement +--- hledger Contributor List and Agreement ====================================== diff --git a/MANUAL b/MANUAL.rst similarity index 99% rename from MANUAL rename to MANUAL.rst index 16aab400c..9edf2b550 100644 --- a/MANUAL +++ b/MANUAL.rst @@ -1,3 +1,6 @@ +--- +title: hledger manual +--- hledger manual ============== @@ -9,7 +12,7 @@ A tip: on hledger.org, these docs are also available with .pdf suffix. User Guide ----------- +:::::::::: Introduction ............ @@ -161,7 +164,7 @@ For more details, see `File format compatibility <#file-format-compatibility>`_. Reference ---------- +::::::::: Overview ........ diff --git a/Makefile b/Makefile index e37c3f4cc..3f5a6c78d 100644 --- a/Makefile +++ b/Makefile @@ -20,8 +20,6 @@ COVCMD=test BENCHEXES=hledger-0.7 hledger-0.8 ledger-3pre # misc. tools -PANDOC=pandoc -RST2HTML=rst2html RST2PDF=rst2pdf #VIEWHTML=open VIEWHTML=open -a 'Google Chrome' @@ -277,17 +275,27 @@ cleandocs: rm -rf website/[A-Z]*.html website/api-doc/* # rebuild all docs -docs: html pdf apidocs +docs: site apidocs + +# build the hledger.org website +# Requires hakyll (cabal install hakyll) +site: website/hakyll + cd website; ./hakyll build + cd website/_site; ln -sf README.html index.html + +website/hakyll: website/hakyll.hs + cd website; ghc --make hakyll.hs + +viewsite: site + $(VIEWHTML) website/_site/index.html # generate html versions of docs (and the hledger.org website) # work around pandoc not handling full rst image directive -html: - for d in $(DOCFILES); do $(PANDOC) --toc -s -H website/header.html -A website/footer.html -r rst $$d >website/$$d.html; done - cd website && ln -sf ../SCREENSHOTS && $(RST2HTML) SCREENSHOTS >SCREENSHOTS.html && rm -f SCREENSHOTS - cd website; rm -f index.html; ln -s README.html index.html; rm -f profs; ln -s ../profs +# html: +# for d in $(DOCFILES); do $(PANDOC) --toc -s -H website/header.html -A website/footer.html -r rst $$d >website/$$d.html; done +# cd website && ln -sf ../SCREENSHOTS && $(RST2HTML) SCREENSHOTS >SCREENSHOTS.html && rm -f SCREENSHOTS +# cd website; rm -f index.html; ln -s README.html index.html; rm -f profs; ln -s ../profs -viewhtml: html - $(VIEWHTML) website/index.html pdf: docspdf codepdf @@ -314,7 +322,7 @@ printall: pdf $(PRINT) $(PDFS) # push latest docs etc. and update the hledger.org site -site: push +pushdocs: push ssh joyful.com 'make -C/repos/hledger docs' # generate api docs diff --git a/NEWS b/NEWS.rst similarity index 99% rename from NEWS rename to NEWS.rst index e0a0a013c..4b86f17e7 100644 --- a/NEWS +++ b/NEWS.rst @@ -1,3 +1,6 @@ +--- +title: hledger news +--- hledger news ============ diff --git a/README b/README.rst similarity index 98% rename from README rename to README.rst index 17cdd6a6a..c622c4710 100644 --- a/README +++ b/README.rst @@ -1,3 +1,6 @@ +--- +title: hledger +--- hledger ======= diff --git a/README2 b/README2.rst similarity index 99% rename from README2 rename to README2.rst index 92fab0da3..d9d4c0f34 100644 --- a/README2 +++ b/README2.rst @@ -1,3 +1,6 @@ +--- +title: hledger for techies +--- hledger for techies =================== diff --git a/SCREENSHOTS b/SCREENSHOTS.rst similarity index 95% rename from SCREENSHOTS rename to SCREENSHOTS.rst index 8ccd12456..f66e5966b 100644 --- a/SCREENSHOTS +++ b/SCREENSHOTS.rst @@ -1,10 +1,13 @@ +--- +title: hledger screenshots +--- hledger screenshots =================== .. .................................................................... .. raw:: html -

+ Basic command-line reports, like ledger: diff --git a/website/footer.html b/website/footer.html deleted file mode 100644 index 7b6f1a6eb..000000000 --- a/website/footer.html +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/website/hakyll.hs b/website/hakyll.hs new file mode 100644 index 000000000..48669c409 --- /dev/null +++ b/website/hakyll.hs @@ -0,0 +1,32 @@ +#!/usr/bin/env runhaskell + +import Control.Monad (forM_) +import Control.Monad.Trans (liftIO) +import System.Process +import Text.Hakyll (hakyll) +import Text.Hakyll.Render +import Text.Hakyll.CreateContext (createPage, createCustomPage, createListing) +import Text.Printf + +main = hakyll "http://hledger.org" $ do + mapM_ renderParentDirPage + ["README.rst" + ,"README2.rst" + ,"NEWS.rst" + ,"SCREENSHOTS.rst" + ,"MANUAL.rst" + ,"CONTRIBUTORS.rst" + ] + mapM_ static + ["style.css" + ,"sshot.png" + ,"watchhours.png" + ,"hledger-screen-1.png" + ,"hledger-charts-2.png" + ] + +-- 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 diff --git a/website/header.html b/website/header.html deleted file mode 100644 index 90b090c02..000000000 --- a/website/header.html +++ /dev/null @@ -1,10 +0,0 @@ - - - diff --git a/website/hoogle-small.html b/website/hoogle-small.html deleted file mode 100644 index 969b26c3b..000000000 --- a/website/hoogle-small.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - diff --git a/website/site.tmpl b/website/site.tmpl new file mode 100644 index 000000000..4908466df --- /dev/null +++ b/website/site.tmpl @@ -0,0 +1,40 @@ + + + + + + hledger.org - $title + + + +
+ +
+ + $body + + + + + + + + diff --git a/website/style.css b/website/style.css index cb09fcb2c..f343e4fd2 100644 --- a/website/style.css +++ b/website/style.css @@ -6,6 +6,22 @@ body { font-family: "helvetica","arial", "sans serif"; } +div#navigation { + /* text-align: center; */ + /* border-bottom: 4px solid #226600; */ +} + +div#navigation a { + color: white; + font-weight:bold; + font-family:sans-serif; + /* font-size:small; */ + text-decoration: none; + background-color: #226600; + padding: 3px 10px 3px 10px; + margin: 0 5px 0 0; +} + #footer { padding-top: 1em; /* font-size: 70%; */ @@ -22,23 +38,23 @@ code { margin: 0 auto; width: 700px; } -h1.title { - font-size: 3.8em; +h1 { + font-size: 3em; /* color: #49637C; */ - color: #226600; + /* color: #226600; */ margin-bottom: 3px; text-align: left; } -h1 { - margin-top:1em; - text-align: left; -} -h1 .small { - font-size: 0.4em; -} -h1 a { - text-decoration: none; -} +/* h1 { */ +/* margin-top:1em; */ +/* text-align: left; */ +/* } */ +/* h1 .small { */ +/* font-size: 0.4em; */ +/* } */ +/* h1 a { */ +/* text-decoration: none; */ +/* } */ h2 { font-size: 1.5em; }