refactor doc generation

This commit is contained in:
Daylin Morgan 2024-09-26 08:53:01 -05:00
parent 2ad46eda22
commit a6120b3723
Signed by: daylin
GPG key ID: 950D13E9719334AD

View file

@ -7,14 +7,8 @@ task develop, "install cligen for development":
exec "nimble install -l 'illwill@0.4.1'" exec "nimble install -l 'illwill@0.4.1'"
exec "nimble install -l 'cligen@1.7.5'" exec "nimble install -l 'cligen@1.7.5'"
task docs, "Deploy doc html + search index to public/ directory": proc docFixup(deployDir:string, pkgName: string) =
let ## apply renames to api docs
deployDir = getCurrentDir() / "public"
pkgName = "hwylterm"
gitUrl = fmt"https://github.com/daylinmorgan/{pkgName}"
for module in ["cli", "chooser"]:
selfExec fmt"doc --docRoot:{getCurrentDir()}/src/ --index:on --outdir:{deployDir} src/hwylterm/{module}"
selfExec fmt"doc --project --index:on --git.url:{gitUrl} --git.commit:main --outdir:{deployDir} --project src/{pkgName}.nim"
withDir deployDir: withDir deployDir:
mvFile(pkgName & ".html", "index.html") mvFile(pkgName & ".html", "index.html")
for file in walkDirRec(".", {pcFile}): for file in walkDirRec(".", {pcFile}):
@ -23,6 +17,16 @@ task docs, "Deploy doc html + search index to public/ directory":
# drop 'src/' from titles # drop 'src/' from titles
exec(r"sed -i -r 's/<(.*)>src\//<\1>/' $1" % file) exec(r"sed -i -r 's/<(.*)>src\//<\1>/' $1" % file)
task docs, "Deploy doc html + search index to public/ directory":
let
deployDir = getCurrentDir() / "public"
pkgName = "hwylterm"
gitFlags = fmt"--git.url:'https://github.com/daylinmorgan/{pkgName}' --git.commit:main"
for module in ["cli", "chooser"]:
selfExec fmt"doc --docRoot:{getCurrentDir()}/src/ --index:on --outdir:{deployDir} src/hwylterm/{module}"
selfExec fmt"doc --project --index:on {gitFlags} --outdir:{deployDir} --project src/{pkgName}.nim"
docFixup(deployDir,pkgName)
when withDir(thisDir(), system.dirExists("nimbledeps")): when withDir(thisDir(), system.dirExists("nimbledeps")):
--path:"./nimbledeps/pkgs2/cligen-1.7.5-f3ffe7329c8db755677d3ca377d02ff176cec8b1" --path:"./nimbledeps/pkgs2/cligen-1.7.5-f3ffe7329c8db755677d3ca377d02ff176cec8b1"
--path:"./nimbledeps/pkgs2/illwill-0.4.1-9c58351502f89a16caf031cbd1992ad3fdfd3c67" --path:"./nimbledeps/pkgs2/illwill-0.4.1-9c58351502f89a16caf031cbd1992ad3fdfd3c67"