diff options
| -rw-r--r-- | nimterop.nimble | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/nimterop.nimble b/nimterop.nimble index d0074ba..c53e4dc 100644 --- a/nimterop.nimble +++ b/nimterop.nimble @@ -46,8 +46,27 @@ proc testAll() = const htmldocsDir = "build/htmldocs" +when (NimMajor, NimMinor, NimPatch) >= (0, 19, 9): + import os + proc getNimRootDir(): string = + #[ + hack, but works + alternatively (but more complex), use (from a nim file, not nims otherwise + you get Error: ambiguous call; both system.fileExists): + import "$nim/testament/lib/stdtest/specialpaths.nim" + nimRootDir + ]# + fmt"{currentSourcePath}".parentDir.parentDir.parentDir + proc runNimDoc() = execCmd &"nim doc -o:{htmldocsDir} --project --index:on nimterop/all.nim" + execCmd &"nim buildIndex -o:{htmldocsDir}/theindex.html {htmldocsDir}" + when declared(getNimRootDir): + #[ + this enables doc search, works at least locally with: + cd {htmldocsDir} && python -m SimpleHTTPServer 9009 + ]# + execCmd &"nim js -o:{htmldocsDir}/dochack.js {getNimRootDir()}/tools/dochack/dochack.nim" task test, "Test": buildToast() @@ -55,6 +74,9 @@ task test, "Test": runNimDoc() task docs, "Generate docs": + runNimDoc() + +task docsPublish, "Generate and publish docs": # Uses: pip install ghp-import runNimDoc() execCmd &"ghp-import --no-jekyll -fp {htmldocsDir}" |
