change paths in code, scripts, readme

This commit is contained in:
Simon Michael 2017-12-06 18:16:35 -08:00
parent d637e2fbcd
commit b425e50ad1
4 changed files with 69 additions and 47 deletions

View File

@ -150,10 +150,10 @@ CABALFILES:= \
MANUALSOURCEFILES:= \
doc/lib.m4 \
*/*/*.m4.md \
*/*.m4.md \
MANUALGENFILES:= \
hledger*/doc/hledger*.[15]{,.info,.txt} \
hledger*/hledger*.{1,5,info,txt} \
# site/*.md includes website source files and generated web manual files
# WEBDOCFILES:= \
@ -1399,8 +1399,8 @@ genmanuals: Shake #$(call def-help,genmanuals, regenerate embedded manuals (migh
./Shake manuals
updatemanuals: genmanuals $(call def-help,updatemanuals, regenerate embedded manuals and commit (might need -B) )
@read -p "please review changes then press enter to commit: $(shell ls hledger*/doc/*.[15]*)"
git commit -m "update embedded manuals" hledger*/doc/*.[15]*
@read -p "please review changes then press enter to commit: $(shell ls hledger*/hledger*.{1,5,info,txt})"
git commit -m "update embedded manuals" hledger*/hledger*.{1,5,info,txt}
tagrelease: \

View File

@ -112,17 +112,33 @@ main = do
,"hledger_timeclock.5"
,"hledger_timedot.5"
]
-- 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)
manualNames = map manpageNameToManualName manpageNames
-- hledger.1 -> hledger, hledger_journal.5 -> hledger_journal
manpageNameToManualName = dropNumericSuffix
where
dropNumericSuffix s = reverse $
case reverse s of
c : '.' : cs | isDigit c -> cs
cs -> cs
-- hledger -> hledger.1, hledger_journal -> hledger_journal.5
manualNameToManpageName s
| '_' `elem` s = s <.> "5"
| otherwise = s <.> "1"
-- manuals m4 source; may include other source files (hledger/hledger.m4.md)
m4manpages = [manualDir m </> m <.> "m4.md" | m <- manualNames]
-- manuals rendered to nroff, ready for man (hledger/hledger.1)
nroffmanpages = [manpageDir m </> m | m <- manpageNames]
-- manuals rendered to text, ready for embedding (hledger/doc/hledger.1.txt)
txtmanpages = [manpageDir m </> m <.> "txt" | m <- manpageNames]
-- manuals rendered to text, ready for embedding (hledger/hledger.txt)
txtmanpages = [manualDir m </> m <.> "txt" | m <- manualNames]
-- manuals rendered to info, ready for info (hledger/doc/hledger.1.info)
infomanpages = [manpageDir m </> m <.> "info" | m <- manpageNames]
-- manuals rendered to info, ready for info (hledger/hledger.info)
infomanpages = [manualDir m </> m <.> "info" | m <- manualNames]
-- manuals rendered to markdown, ready for web output by hakyll (site/hledger.md)
webmanpages = ["site" </> manpageNameToUri m <.>"md" | m <- manpageNames]
@ -154,8 +170,13 @@ main = do
-- hledger.1 -> hledger/doc, hledger_journal.5 -> hledger-lib/doc
manpageDir m
| '_' `elem` m = "hledger-lib" </> "doc"
| otherwise = dropExtension m </> "doc"
| '_' `elem` m = "hledger-lib"
| otherwise = dropExtension m
-- hledger -> hledger, hledger_journal -> hledger-lib
manualDir m
| '_' `elem` m = "hledger-lib"
| otherwise = m
-- hledger.1 -> hledger, hledger_journal.5 -> journal
manpageNameToUri m | "hledger_" `isPrefixOf` m = dropExtension $ drop 8 m
@ -183,8 +204,8 @@ main = do
-- 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 <.> "m4.md"
nroffmanpages |%> \out -> do -- hledger/hledger.1
let src = manpageNameToManualName out <.> "m4.md"
lib = "doc/lib.m4"
dir = takeDirectory out
tmpl = "doc/manpage.nroff"
@ -204,15 +225,15 @@ main = do
-- render man page nroffs to fixed-width text for embedding in executables, with nroff
phony "txtmanpages" $ need txtmanpages
txtmanpages |%> \out -> do -- hledger/doc/hledger.1.txt
let src = dropExtension out
txtmanpages |%> \out -> do -- hledger/hledger.txt
let src = dropExtension out <.> "m4.md"
need [src]
cmd Shell groff "-t -e -mandoc -Tascii" src "| col -bx >" out -- http://www.tldp.org/HOWTO/Man-Page/q10.html
-- use m4 and pandoc to process macros, filter content, and convert to info, suitable for info viewing
phony "infomanpages" $ need infomanpages
infomanpages |%> \out -> do -- hledger/doc/hledger.1.info
infomanpages |%> \out -> do -- hledger/hledger.info
let src = out -<.> "m4.md"
lib = "doc/lib.m4"
dir = takeDirectory out
@ -249,11 +270,12 @@ main = do
phony "webmanpages" $ need webmanpages
webmanpages |%> \out -> do -- site/hledger.md
let m = manpageUriToName $ dropExtension $ takeFileName out -- hledger.1
dir = manpageDir m
src = dir </> m <.> "m4.md"
let manpage = manpageUriToName $ dropExtension $ takeFileName out -- hledger
manual = manpageNameToManualName manpage
dir = manpageDir manpage
src = dir </> manual <.> "m4.md"
lib = "doc/lib.m4"
heading = let h = dropExtension m
heading = let h = manual
in if "hledger_" `isPrefixOf` h
then drop 8 h ++ " format"
else h

View File

@ -24,7 +24,7 @@ These are in the respective package directories:
hledger*/package.yaml source for package metadata (description, etc.)
hledger*/README package readme, displayed on hackage
hledger*/CHANGES package changelog, displayed on hackage
hledger*/doc/hledger*.m4.md package manual source file(s)
hledger*/hledger*.m4.md package manual source file(s)
4. The project website and additional docs - home page, FAQ, tutorials,
how-tos, developer guide, etc. These are in the site directory:

View File

@ -35,44 +35,44 @@ type Topic = String
docFiles :: IsString a => [(Topic, (a, a, a))]
docFiles = [
("hledger",
($(makeRelativeToProject "doc/hledger.1" >>= embedStringFile)
,$(makeRelativeToProject "doc/hledger.1.txt" >>= embedStringFile)
,$(makeRelativeToProject "doc/hledger.1.info" >>= embedStringFile)
($(makeRelativeToProject "hledger.1" >>= embedStringFile)
,$(makeRelativeToProject "hledger.txt" >>= embedStringFile)
,$(makeRelativeToProject "hledger.info" >>= embedStringFile)
))
,("hledger-ui",
($(makeRelativeToProject "doc/other/hledger-ui.1" >>= embedStringFile)
,$(makeRelativeToProject "doc/other/hledger-ui.1.txt" >>= embedStringFile)
,$(makeRelativeToProject "doc/other/hledger-ui.1.info" >>= embedStringFile)
($(makeRelativeToProject ".otherdocs/hledger-ui.1" >>= embedStringFile)
,$(makeRelativeToProject ".otherdocs/hledger-ui.txt" >>= embedStringFile)
,$(makeRelativeToProject ".otherdocs/hledger-ui.info" >>= embedStringFile)
))
,("hledger-web",
($(makeRelativeToProject "doc/other/hledger-web.1" >>= embedStringFile)
,$(makeRelativeToProject "doc/other/hledger-web.1.txt" >>= embedStringFile)
,$(makeRelativeToProject "doc/other/hledger-web.1.info" >>= embedStringFile)
($(makeRelativeToProject ".otherdocs/hledger-web.1" >>= embedStringFile)
,$(makeRelativeToProject ".otherdocs/hledger-web.txt" >>= embedStringFile)
,$(makeRelativeToProject ".otherdocs/hledger-web.info" >>= embedStringFile)
))
,("hledger-api",
($(makeRelativeToProject "doc/other/hledger-api.1" >>= embedStringFile)
,$(makeRelativeToProject "doc/other/hledger-api.1.txt" >>= embedStringFile)
,$(makeRelativeToProject "doc/other/hledger-api.1.info" >>= embedStringFile)
($(makeRelativeToProject ".otherdocs/hledger-api.1" >>= embedStringFile)
,$(makeRelativeToProject ".otherdocs/hledger-api.txt" >>= embedStringFile)
,$(makeRelativeToProject ".otherdocs/hledger-api.info" >>= embedStringFile)
))
,("journal",
($(makeRelativeToProject "doc/other/hledger_journal.5" >>= embedStringFile)
,$(makeRelativeToProject "doc/other/hledger_journal.5.txt" >>= embedStringFile)
,$(makeRelativeToProject "doc/other/hledger_journal.5.info" >>= embedStringFile)
($(makeRelativeToProject ".otherdocs/hledger_journal.5" >>= embedStringFile)
,$(makeRelativeToProject ".otherdocs/hledger_journal.txt" >>= embedStringFile)
,$(makeRelativeToProject ".otherdocs/hledger_journal.info" >>= embedStringFile)
))
,("csv",
($(makeRelativeToProject "doc/other/hledger_csv.5" >>= embedStringFile)
,$(makeRelativeToProject "doc/other/hledger_csv.5.txt" >>= embedStringFile)
,$(makeRelativeToProject "doc/other/hledger_csv.5.info" >>= embedStringFile)
($(makeRelativeToProject ".otherdocs/hledger_csv.5" >>= embedStringFile)
,$(makeRelativeToProject ".otherdocs/hledger_csv.txt" >>= embedStringFile)
,$(makeRelativeToProject ".otherdocs/hledger_csv.info" >>= embedStringFile)
))
,("timeclock",
($(makeRelativeToProject "doc/other/hledger_timeclock.5" >>= embedStringFile)
,$(makeRelativeToProject "doc/other/hledger_timeclock.5.txt" >>= embedStringFile)
,$(makeRelativeToProject "doc/other/hledger_timeclock.5.info" >>= embedStringFile)
($(makeRelativeToProject ".otherdocs/hledger_timeclock.5" >>= embedStringFile)
,$(makeRelativeToProject ".otherdocs/hledger_timeclock.txt" >>= embedStringFile)
,$(makeRelativeToProject ".otherdocs/hledger_timeclock.info" >>= embedStringFile)
))
,("timedot",
($(makeRelativeToProject "doc/other/hledger_timedot.5" >>= embedStringFile)
,$(makeRelativeToProject "doc/other/hledger_timedot.5.txt" >>= embedStringFile)
,$(makeRelativeToProject "doc/other/hledger_timedot.5.info" >>= embedStringFile)
($(makeRelativeToProject ".otherdocs/hledger_timedot.5" >>= embedStringFile)
,$(makeRelativeToProject ".otherdocs/hledger_timedot.txt" >>= embedStringFile)
,$(makeRelativeToProject ".otherdocs/hledger_timedot.info" >>= embedStringFile)
))
]