doc: don't use sed; fix accidental dedenting of some lists (#961)

The sed code was showing an error message, not too precise.
Pandoc's lua filters to the rescue!

[ci skip]
This commit is contained in:
Simon Michael 2019-01-31 08:34:49 -08:00
parent 3474cb08bd
commit 5435150d39
5 changed files with 36 additions and 43 deletions

View File

@ -20,7 +20,6 @@ compiling is recommended; run the script in interpreted mode to do that.
It requires stack (https://haskell-lang.org/get-started) and
auto-installs the packages above. Also, some rules require:
- GNU sed
- groff
- m4
- makeinfo
@ -86,10 +85,6 @@ towebmd = "-t markdown-smart-fenced_divs --atx-headers"
main = do
-- try to ensure we have a modern sed
sed' <- readCreateProcess (shell "which gsed || which sed") ""
let sed = sed' ++ " -E"
-- hledger manual also includes the markdown files from here:
let commandsdir = "hledger/Hledger/Cli/Commands"
commandmds <- filter (".md" `isSuffixOf`) . map (commandsdir </>) <$> S.getDirectoryContents commandsdir
@ -378,9 +373,7 @@ main = do
need [src]
cmd Shell
-- "m4 -P -DHELP -I" commandsdir lib src "|"
pandoc fromsrcmd src "-t plain"
"|" sed "-e" ["'s/^ //'"]
">" out
pandoc fromsrcmd src "--lua-filter" "tools/pandoc-dedent-code-blocks.lua" "-t plain" ">" out
-- MISC