diff options
| author | Ganesh Viswanathan <dev@genotrance.com> | 2019-10-07 10:52:04 -0500 |
|---|---|---|
| committer | Ganesh Viswanathan <dev@genotrance.com> | 2019-10-07 10:52:04 -0500 |
| commit | 8e2a3d3ad4e186f75a2cba39c1ed339752b64e7b (patch) | |
| tree | 749129a6e2f62474ee8a059ccaa847f8b1f34df9 | |
| parent | e78fa71ed1658e53b902c84ae56ac1ab0413e1b7 (diff) | |
| download | nimterop-8e2a3d3ad4e186f75a2cba39c1ed339752b64e7b.tar.gz nimterop-8e2a3d3ad4e186f75a2cba39c1ed339752b64e7b.zip | |
Defines to doc, nim compiler path
| -rw-r--r-- | nimterop/docs.nim | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/nimterop/docs.nim b/nimterop/docs.nim index 0b46967..8fd396b 100644 --- a/nimterop/docs.nim +++ b/nimterop/docs.nim @@ -1,7 +1,7 @@ import macros, strformat when (NimMajor, NimMinor, NimPatch) >= (0, 19, 9): - from os import parentDir + from os import parentDir, getCurrentCompilerExe proc getNimRootDir(): string = #[ hack, but works @@ -11,8 +11,12 @@ when (NimMajor, NimMinor, NimPatch) >= (0, 19, 9): nimRootDir ]# fmt"{currentSourcePath}".parentDir.parentDir.parentDir +else: + proc getCurrentCompilerExe*(): string = + "nim" -proc buildDocs*(files: seq[string], path: string, baseDir = getProjectPath() & "/") = +proc buildDocs*(files: openArray[string], path: string, baseDir = getProjectPath() & "/", + defines: openArray[string] = @[]) = ## Generate docs for all specified nim `files` to the specified `path` ## ## `baseDir` is the project path by default and `files` and `path` are relative @@ -30,16 +34,22 @@ proc buildDocs*(files: seq[string], path: string, baseDir = getProjectPath() & " else: baseDir path = baseDir & path + defStr = block: + var defStr = "" + for def in defines: + defStr &= " -d:" & def + defStr + nim = getCurrentCompilerExe() for file in files: - echo gorge(&"nim doc -o:{path} --project --index:on {baseDir & file}") + echo gorge(&"{nim} doc {defStr} -o:{path} --project --index:on {baseDir & file}") - echo gorge(&"nim buildIndex -o:{path}/theindex.html {path}") + echo gorge(&"{nim} buildIndex -o:{path}/theindex.html {path}") when declared(getNimRootDir): #[ this enables doc search, works at least locally with: cd {path} && python -m SimpleHTTPServer 9009 ]# - echo gorge(&"nim js -o:{path}/dochack.js {getNimRootDir()}/tools/dochack/dochack.nim") + echo gorge(&"{nim} js -o:{path}/dochack.js {getNimRootDir()}/tools/dochack/dochack.nim") for i in 0 .. paramCount(): if paramStr(i) == "--publish": |
