aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2019-02-08 14:32:06 -0800
committergenotrance <dev@genotrance.com>2019-02-08 16:32:05 -0600
commitbed87aa2d897368f9c0afcb25ee20bbfd20032b4 (patch)
treee38ee4bcb52aec039dc02814a102acc1327a3876
parent52264204749a2159153113b4ffb6545d2eccc2e4 (diff)
downloadnimterop-bed87aa2d897368f9c0afcb25ee20bbfd20032b4.tar.gz
nimterop-bed87aa2d897368f9c0afcb25ee20bbfd20032b4.zip
docs now include theindex.html (w all procs) + search (#116)
* nim docs now generates theindex.html * doc: enable doc search * fixup
-rw-r--r--nimterop.nimble22
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}"