;Shake webmanuals: add a "generated by" comment (hledger_site/#10)

[ci skip]
This commit is contained in:
Simon Michael 2019-12-09 06:33:08 -08:00
parent 3aaea1ef4e
commit eb1bb0702d

View File

@ -331,15 +331,21 @@ main = do
in if "hledger_" `isPrefixOf` h
then drop 8 h ++ " format"
else h
-- 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, commonm4, packagem4] ++ deps
-- assume any other m4 files in dir are included by this one XXX not true in hledger-lib
subfiles <- liftIO $ filter (/= src) . filter (".m4.md" `isSuffixOf`) . map (dir </>) <$> S.getDirectoryContents dir
let deps = [src, commonm4, packagem4] ++ subfiles
need deps
when (manual=="hledger") $ need commandmds
-- add the web page's heading.
-- XXX Might be nice to do this atomically with the below, so
-- make avoid any double refresh when watch docs with entr/livereload.
-- But cmd Shell doesn't handle arguments containing spaces properly.
liftIO $ writeFile out $ "# " ++ heading ++ "\n\n"
liftIO $ writeFile out $ unlines [
"<!-- " ++ "Generated by \"Shake webmanuals\" from " ++ unwords deps ++ " -->"
,""
,"# " ++ heading
,""
]
cmd Shell
"m4 -P -DMAN -DWEB -I" dir commonm4 packagem4 src "|"
pandoc fromsrcmd towebmd