From e7d459a36821d94bf69ba3baa21f7b64655fb5fb Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Thu, 26 Jan 2017 06:40:50 -0800 Subject: [PATCH] site: begin organising a cookbook --- Shake.hs | 45 ++++++++++++++++--- ...-account-aliases.md => account-aliases.md} | 0 ...ator-character.md => account-separator.md} | 0 ...how-to-read-csv-files.md => csv-import.md} | 0 site/docs.md | 44 ++++++++++-------- 5 files changed, 65 insertions(+), 24 deletions(-) rename site/{how-to-use-account-aliases.md => account-aliases.md} (100%) rename site/{how-to-use-another-account-separator-character.md => account-separator.md} (100%) rename site/{how-to-read-csv-files.md => csv-import.md} (100%) diff --git a/Shake.hs b/Shake.hs index 800e200e9..510849574 100755 --- a/Shake.hs +++ b/Shake.hs @@ -60,6 +60,7 @@ usage = unlines -- ,"./Shake infomanpages # generate info files for info" -- ,"./Shake webmanpages # generate individual web man pages for hakyll" -- ,"./Shake webmanall # generate all-in-one web manual for hakyll" +-- ,"./Shake cookbookall # generate all-in-one web cookbook for hakyll" ,"./Shake site/doc/VER/.snapshot # generate and save a versioned web site snapshot" ,"./Shake all # generate everything" ,"./Shake clean # clean generated files" @@ -114,17 +115,33 @@ main = do ] -- manuals m4 source, may include other files (hledger/doc/hledger.1.m4.md) m4manpages = [manpageDir m m <.> "m4.md" | m <- manpageNames] - -- manuals rendered to nroff, ready for man (hledger/doc/hledger.1) + + -- manuals rendered to nroff, ready for man (hledger/doc/hledger.1) nroffmanpages = [manpageDir m m | m <- manpageNames] - -- manuals rendered to text, ready for embedding (hledger/doc/hledger.1.txt) + + -- manuals rendered to text, ready for embedding (hledger/doc/hledger.1.txt) txtmanpages = [manpageDir m m <.> "txt" | m <- manpageNames] - -- manuals rendered to info, ready for info (hledger/doc/hledger.1.info) + + -- manuals rendered to info, ready for info (hledger/doc/hledger.1.info) infomanpages = [manpageDir m m <.> "info" | m <- manpageNames] - -- manuals rendered to markdown, ready for web output by hakyll (site/hledger.md) + + -- manuals rendered to markdown, ready for web output by hakyll (site/hledger.md) webmanpages = ["site" manpageNameToUri m <.>"md" | m <- manpageNames] - -- manuals rendered to markdown and combined, ready for web output by hakyll + + -- manuals rendered to markdown and combined, ready for web output by hakyll webmanall = "site/manual.md" + -- cookbook pages in markdown, ready for web output by hakyll (site/csv-import.md) + -- keeping these in the main site directory allows hakyll-std to see them (and simpler urls) + cookbookpages = [ + "site/account-aliases.md" + ,"site/account-separator.md" + ,"site/csv-import.md" + ] + + -- cookbook pages combined, ready for web output by hakyll + cookbookall = "site/cookbook.md" + -- hledger.1 -> hledger/doc, hledger_journal.5 -> hledger-lib/doc manpageDir m | '_' `elem` m = "hledger-lib" "doc" @@ -209,6 +226,7 @@ main = do need $ webmanpages ++ [webmanall + ,cookbookall ,hakyllstd ] cmd Shell (Cwd "site") "hakyll-std/hakyll-std" "build" @@ -254,6 +272,21 @@ main = do "--filter tools/pandoc-demote-headers" ">>" webmanall :: Action ExitCode + -- adjust and combine recipe mds for single-page web output, using pandoc + phony "cookbookall" $ need [ cookbookall ] + + cookbookall %> \out -> do + need cookbookpages + liftIO $ writeFile cookbookall "* toc\n\n" + forM_ cookbookpages $ \f -> do -- site/csv-import.md, site/account-aliases.md, ... + cmd Shell ("printf '\\n\\n' >>") cookbookall :: Action ExitCode + cmd Shell "pandoc" f "-t markdown --atx-headers" + -- "--filter tools/pandoc-drop-man-blocks" + "--filter tools/pandoc-drop-toc" + -- "--filter tools/pandoc-capitalize-headers" + "--filter tools/pandoc-demote-headers" + ">>" cookbookall :: Action ExitCode + -- build the currently checked out web docs and save as a named snapshot "site/doc/*/.snapshot" %> \out -> do need [ webmanall ] @@ -283,7 +316,7 @@ main = do phony "clean" $ do putNormal "Cleaning generated files" removeFilesAfter "." webmanpages - removeFilesAfter "." [webmanall] + removeFilesAfter "." [webmanall, cookbookall] -- removeFilesAfter "." ["site/doc/[0-9]*"] cmd Shell "rm -rf site/doc/[0-9]*" diff --git a/site/how-to-use-account-aliases.md b/site/account-aliases.md similarity index 100% rename from site/how-to-use-account-aliases.md rename to site/account-aliases.md diff --git a/site/how-to-use-another-account-separator-character.md b/site/account-separator.md similarity index 100% rename from site/how-to-use-another-account-separator-character.md rename to site/account-separator.md diff --git a/site/how-to-read-csv-files.md b/site/csv-import.md similarity index 100% rename from site/how-to-read-csv-files.md rename to site/csv-import.md diff --git a/site/docs.md b/site/docs.md index 71321e896..53e2d9710 100644 --- a/site/docs.md +++ b/site/docs.md @@ -26,46 +26,53 @@ Small, guided exercises introducing data entry, reporting, and accounting. #### [FAQ](faq.html) +#### [Misc. links](more-docs.html) +A few links not yet moved to... + +#### [plaintextaccounting.org](http://plaintextaccounting.org) +More overview, tips and tools from the plain text accounting community +
## Reference #### [Big Manual](manual.html) -All manuals combined on one page. +All manuals combined on one page, +including:
**Tool manuals** -#### [`hledger`](hledger.html) -The main command-line UI. -Good for precision, flexibility and automation. +##### [`hledger`](hledger.html) +The command-line UI +, for flexibility and automation. -#### [`hledger-ui`](hledger-ui.html) +##### [`hledger-ui`](hledger-ui.html) A curses-style UI , for quick review and monitoring. -#### [`hledger-web`](hledger-web.html) +##### [`hledger-web`](hledger-web.html) A web UI , for browsing, sharing, and collaboration. -#### [`hledger-api`](hledger-api.html) +##### [`hledger-api`](hledger-api.html) A basic web API , for building client-side apps. **File format manuals** -#### [Journal](journal.html) +##### [Journal](journal.html) hledger's native data format, representing an accounting journal. -#### [CSV](csv.html) +##### [CSV](csv.html) Comma Separated Values, used for import/export. -#### [Timeclock](timeclock.html) +##### [Timeclock](timeclock.html) For time logging, with clock-in/clock-out records. -#### [Timedot](timedot.html) +##### [Timedot](timedot.html) A more human-friendly time logging format.
@@ -75,17 +82,18 @@ A more human-friendly time logging format. ## More -#### [How to read CSV files](how-to-read-csv-files.html) +#### [User Cookbook](cookbook.html) +Practical day-to-day recipes combined on one page, including: -#### [How to use account aliases](how-to-use-account-aliases.html) +
-#### [How to use another account separator character](how-to-use-another-account-separator-character.html) +##### [How to read CSV files](csv-import.html) -#### [More docs](more-docs.html) -Some useful links not yet moved to.. +##### [How to use account aliases](account-aliases.html) -#### [plaintextaccounting.org](http://plaintextaccounting.org) -More tips and tools from the plain text accounting community +##### [How to use another account separator character](account-separator.html) + +