diff --git a/Shake.hs b/Shake.hs index f6abad1a0..bb496ba1a 100755 --- a/Shake.hs +++ b/Shake.hs @@ -97,8 +97,6 @@ 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 markdown, ready for adjusting to web or man pages by pandoc (hledger/doc/hledger.1.md) - mdmanpages = [manpageDir m m <.> "md" | m <- manpageNames] -- 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) @@ -135,26 +133,21 @@ main = do -- man pages - -- process m4 includes and macros to get markdown, ready for further processing by pandoc - mdmanpages |%> \out -> do -- hledger/doc/hledger.1.md - let dir = takeDirectory out - src = out -<.> "m4.md" - lib = "doc/lib.m4" - -- assume all other m4 files in dir are included by this one XXX not true in hledger-lib - deps <- liftIO $ filter (/= src) . filter (".m4.md" `isSuffixOf`) . map (dir ) - <$> S.getDirectoryContents dir - need $ src : lib : deps - cmd Shell "m4 -P -DWEB -DMAN -I" dir lib src ">" out - - -- adjust man page mds for man output and convert to nroff, with pandoc + -- use m4 and pandoc to process macros, filter content, and convert to nroff suitable for man output phony "manpages" $ need nroffmanpages nroffmanpages |%> \out -> do -- hledger/doc/hledger.1 - let src = out <.> "md" + let src = out <.> "m4.md" + lib = "doc/lib.m4" + dir = takeDirectory out tmpl = "doc/manpage.nroff" - need $ src : tmpl : pandocFilters - cmd pandoc src "-s --template" tmpl - "--filter doc/pandoc-drop-web-blocks" + -- assume all other m4 files in dir are included by this one XXX not true in hledger-lib + deps <- liftIO $ filter (/= src) . filter (".m4.md" `isSuffixOf`) . map (dir ) <$> S.getDirectoryContents dir + need $ src : lib : tmpl : deps ++ pandocFilters + cmd Shell + "m4 -P -DMAN -I" dir lib src "|" + pandoc "-f markdown -s --template" tmpl + -- "--filter doc/pandoc-drop-web-blocks" "--filter doc/pandoc-drop-html-blocks" "--filter doc/pandoc-drop-html-inlines" "--filter doc/pandoc-drop-links" @@ -180,19 +173,25 @@ main = do ] cmd Shell (Cwd "site") "hakyll-std/hakyll-std" "build" - -- adjust man page mds for web output, with pandoc + -- use m4 and pandoc to process macros and filter content, leaving markdown suitable for web output phony "webmanpages" $ need webmanpages webmanpages |%> \out -> do -- site/hledger.md let m = manpageUriToName $ dropExtension $ takeFileName out -- hledger.1 - src = manpageDir m m <.> "md" -- hledger/doc/hledger.1.md + dir = manpageDir m + src = dir m <.> "m4.md" + lib = "doc/lib.m4" heading = let h = dropExtension m in if "hledger_" `isPrefixOf` h then drop 8 h ++ " format" else h - need $ src : pandocFilters + -- assume all other m4 files in dir are included by this one XXX not true in hledger-lib + deps <- liftIO $ filter (/= src) . filter (".m4.md" `isSuffixOf`) . map (dir ) <$> S.getDirectoryContents dir + need $ src : lib : deps ++ pandocFilters liftIO $ writeFile out $ "# " ++ heading ++ "\n\n" - cmd Shell pandoc src "-t markdown --atx-headers" + cmd Shell + "m4 -P -DMAN -DWEB -I" dir lib src "|" + pandoc "-f markdown -t markdown --atx-headers" "--filter doc/pandoc-demote-headers" -- "--filter doc/pandoc-add-toc" -- "--filter doc/pandoc-drop-man-blocks" @@ -231,7 +230,6 @@ main = do phony "clean" $ do putNormal "Cleaning generated files" - removeFilesAfter "." mdmanpages removeFilesAfter "." webmanpages removeFilesAfter "." [webmanual] diff --git a/hledger-api/doc/hledger-api.1.m4.md b/hledger-api/doc/hledger-api.1.m4.md index 609008ac5..e8953f704 100644 --- a/hledger-api/doc/hledger-api.1.m4.md +++ b/hledger-api/doc/hledger-api.1.m4.md @@ -2,12 +2,12 @@ % % January 2016 -
+_web_({{ _versions_({{hledger-api}}) * toc -
-
+}}) +_man_({{ # NAME @@ -24,7 +24,7 @@ hledger is a cross-platform program for tracking money, time, or any other commo using double-entry accounting and a simple, editable file format. hledger is inspired by and largely compatible with ledger(1). -
+}}) hledger-api is a simple web API server, intended to support client-side web apps operating on hledger data. It comes with a series @@ -110,7 +110,7 @@ access. -
+_man_({{ # ENVIRONMENT @@ -142,4 +142,4 @@ The need to precede options with `--` when invoked from hledger is awkward. -
+}}) diff --git a/hledger-lib/doc/hledger_csv.5.m4.md b/hledger-lib/doc/hledger_csv.5.m4.md index 09d2d3112..1473f0849 100644 --- a/hledger-lib/doc/hledger_csv.5.m4.md +++ b/hledger-lib/doc/hledger_csv.5.m4.md @@ -2,12 +2,12 @@ % % April 2016 -
+_web_({{ _versions_({{csv}}) * toc -
-
+}}) +_man_({{ # NAME @@ -15,7 +15,7 @@ CSV - how hledger reads CSV data, and the CSV rules file format # DESCRIPTION -
+}}) hledger can read [CSV](http://en.wikipedia.org/wiki/Comma-separated_values) files, diff --git a/hledger-lib/doc/hledger_journal.5.m4.md b/hledger-lib/doc/hledger_journal.5.m4.md index be35b970e..d0b87c2ed 100644 --- a/hledger-lib/doc/hledger_journal.5.m4.md +++ b/hledger-lib/doc/hledger_journal.5.m4.md @@ -2,12 +2,12 @@ % % April 2016 -
+_web_({{ _versions_({{journal}}) * toc -
-
+}}) +_man_({{ # NAME @@ -15,7 +15,7 @@ Journal - hledger's default file format, representing a General Journal # DESCRIPTION -
+}}) hledger's usual data source is a plain text file containing journal entries in hledger journal format. This file represents a standard accounting [general journal](http://en.wikipedia.org/wiki/General_journal). diff --git a/hledger-lib/doc/hledger_timeclock.5.m4.md b/hledger-lib/doc/hledger_timeclock.5.m4.md index f6f41d92f..c7417d18f 100644 --- a/hledger-lib/doc/hledger_timeclock.5.m4.md +++ b/hledger-lib/doc/hledger_timeclock.5.m4.md @@ -2,12 +2,12 @@ % % April 2016 -
+_web_({{ _versions_({{timeclock}}) * toc -
-
+}}) +_man_({{ # NAME @@ -15,7 +15,7 @@ Timeclock - the time logging format of timeclock.el, as read by hledger # DESCRIPTION -
+}}) hledger can read timeclock files. [As with Ledger](http://ledger-cli.org/3.0/doc/ledger3.html#Time-Keeping), diff --git a/hledger-lib/doc/hledger_timedot.5.m4.md b/hledger-lib/doc/hledger_timedot.5.m4.md index 55e83d5a0..b52e0aea7 100644 --- a/hledger-lib/doc/hledger_timedot.5.m4.md +++ b/hledger-lib/doc/hledger_timedot.5.m4.md @@ -2,12 +2,12 @@ % % April 2016 -
+_web_({{ _versions_({{timedot}}) * toc -
-
+}}) +_man_({{ # NAME @@ -15,7 +15,7 @@ Timedot - hledger's human-friendly time logging format # DESCRIPTION -
+}}) Timedot is a plain text format for logging dated, categorised quantities (eg time), supported by hledger. It is convenient for approximate and retroactive time logging, diff --git a/hledger-ui/doc/hledger-ui.1.m4.md b/hledger-ui/doc/hledger-ui.1.m4.md index 23975e66b..c0e39ca2d 100644 --- a/hledger-ui/doc/hledger-ui.1.m4.md +++ b/hledger-ui/doc/hledger-ui.1.m4.md @@ -2,7 +2,7 @@ % % October 2015 -
+_web_({{ _versions_({{hledger-ui}}) * toc @@ -20,8 +20,8 @@ _versions_({{hledger-ui}}) -
-
+}}) +_man_({{ # NAME @@ -38,13 +38,13 @@ hledger is a cross-platform program for tracking money, time, or any other commo using double-entry accounting and a simple, editable file format. hledger is inspired by and largely compatible with ledger(1). -
+}}) hledger-ui is hledger's curses-style interface. It reads a hledger journal file -
+_man_({{ (~/.hledger.journal, $LEDGER_FILE, or -f FILE; see hledger(1) or hledger_journal(5)) -
+}}) and provides a simple full-screen console interface for viewing account balances and transactions. It is simpler and more convenient for @@ -231,7 +231,7 @@ This screen will appear if there is a problem, such as a parse error, when you press g to reload. Once you have fixed the problem described, press g again to reload and restore normal operation. -
+_man_({{ # ENVIRONMENT @@ -263,4 +263,4 @@ The register screen's switching between historic balance and running total based on query arguments may be confusing, and there is no column heading to indicate which is being displayed. -
+}}) diff --git a/hledger-web/doc/hledger-web.1.m4.md b/hledger-web/doc/hledger-web.1.m4.md index 1506966f8..6716a8924 100644 --- a/hledger-web/doc/hledger-web.1.m4.md +++ b/hledger-web/doc/hledger-web.1.m4.md @@ -2,12 +2,12 @@ % % October 2015 -
+_web_({{ _versions_({{hledger-web}}) * toc -
-
+}}) +_man_({{ # NAME hledger-web - web interface for the hledger accounting tool @@ -32,7 +32,7 @@ hledger-web - web interface for the hledger accounting tool hledger is a cross-platform program for tracking money, time, or any other commodity, using double-entry accounting and a simple, editable file format. hledger is inspired by and largely compatible with ledger(1). -
+}}) hledger-web is hledger's web interface. It starts a simple web application for browsing and adding transactions, and optionally @@ -176,7 +176,7 @@ The following common hledger options should also work: `-B --cost` : show amounts in their cost price's commodity -
+_man_({{ # ENVIRONMENT @@ -208,4 +208,4 @@ If you start two instances on the same port, the second one will appear to run normally, but you will be seeing pages served from the first one. -
+}}) diff --git a/hledger/doc/hledger.1.m4.md b/hledger/doc/hledger.1.m4.md index 248f7b554..22c151900 100644 --- a/hledger/doc/hledger.1.m4.md +++ b/hledger/doc/hledger.1.m4.md @@ -2,12 +2,12 @@ % % April 2016 -
+_web_({{ _versions_({{hledger}}) * toc -
-
+}}) +_man_({{ # NAME @@ -26,16 +26,14 @@ file format. It is inspired by and largely compatible with ledger(1). Tested on unix, mac, windows, hledger aims to be a reliable, practical tool for daily use. -
- +}}) _include_(description.m4.md) _include_(examples.m4.md) _include_(options.m4.md) _include_(queries.m4.md) _include_(commands.m4.md) _include_(troubleshooting.m4.md) - -
+_man_({{ # ENVIRONMENT @@ -60,4 +58,4 @@ hledger can't render non-ascii characters when run from a Windows command prompt When input data contains non-ascii characters, a suitable system locale must be configured (or there will be an unhelpful error). Eg on POSIX, set LANG to something other than C. -
+}})