docs now include theindex.html (w all procs) + search (#116)

* nim docs now generates theindex.html

* doc: enable doc search

* fixup
This commit is contained in:
Timothee Cour 2019-02-08 14:32:06 -08:00 committed by genotrance
commit bed87aa2d8

View file

@ -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}"