Some docgen fixes.

This commit is contained in:
Dominik Picheta
2014-09-13 15:35:09 +01:00
parent 37149dcf86
commit 69d4eb14bc
3 changed files with 20 additions and 19 deletions

View File

@@ -446,7 +446,7 @@ proc unescape*(uri: cstring): cstring {.importc, nodecl.}
proc decodeURIComponent*(uri: cstring): cstring {.importc, nodecl.}
proc encodeURIComponent*(uri: cstring): cstring {.importc, nodecl.}
proc isFinite*(x: biggestFloat): bool {.importc, nodecl.}
proc isNaN*(x: biggestFloat): bool {.importc, nodecl.}
proc parseFloat*(s: cstring): biggestFloat {.importc, nodecl.}
proc isFinite*(x: BiggestFloat): bool {.importc, nodecl.}
proc isNaN*(x: BiggestFloat): bool {.importc, nodecl.}
proc parseFloat*(s: cstring): BiggestFloat {.importc, nodecl.}
proc parseInt*(s: cstring): int {.importc, nodecl.}

View File

@@ -59,6 +59,7 @@ template encodeInternal(s: expr, lineLen: int, newLine: string): stmt {.immediat
setLen(result, r+4)
else:
#assert(r == result.len)
discard
proc encode*[T:SomeInteger|char](s: openarray[T], lineLen = 75, newLine="\13\10"): string =
## encodes `s` into base64 representation. After `lineLen` characters, a

View File

@@ -53,8 +53,8 @@ include "website.tmpl"
# ------------------------- configuration file -------------------------------
const
Version = "0.7"
Usage = "nimweb - Nim Website Generator Version " & version & """
version = "0.7"
usage = "nimweb - Nim Website Generator Version " & version & """
(c) 2012 Andreas Rumpf
Usage:
@@ -115,19 +115,19 @@ proc parseCmdLine(c: var TConfigData) =
of cmdLongOption, cmdShortOption:
case normalize(key)
of "help", "h":
stdout.write(Usage)
stdout.write(usage)
quit(0)
of "version", "v":
stdout.write(Version & "\n")
stdout.write(version & "\n")
quit(0)
of "o", "output": c.outdir = val
of "var":
var idx = val.find('=')
if idx < 0: quit("invalid command line")
c.vars[substr(val, 0, idx-1)] = substr(val, idx+1)
else: quit(Usage)
else: quit(usage)
of cmdEnd: break
if c.infile.len == 0: quit(Usage)
if c.infile.len == 0: quit(usage)
proc walkDirRecursively(s: var seq[string], root, ext: string) =
for k, f in walkDir(root):
@@ -222,33 +222,33 @@ proc buildDocSamples(c: var TConfigData, destPath: string) =
## it didn't make much sense to integrate into the existing generic
## documentation builders.
const src = "doc"/"docgen_sample.nim"
exec("nimrod doc $# -o:$# $#" %
exec("nim doc $# -o:$# $#" %
[c.nimrodArgs, destPath / "docgen_sample.html", src])
exec("nimrod doc2 $# -o:$# $#" %
exec("nim doc2 $# -o:$# $#" %
[c.nimrodArgs, destPath / "docgen_sample2.html", src])
proc buildDoc(c: var TConfigData, destPath: string) =
# call nim for the documentation:
for d in items(c.doc):
exec("nimrod rst2html $# --docSeeSrcUrl:$# -o:$# --index:on $#" %
exec("nim rst2html $# --docSeeSrcUrl:$# -o:$# --index:on $#" %
[c.nimrodArgs, c.gitCommit,
destPath / changeFileExt(splitFile(d).name, "html"), d])
for d in items(c.srcdoc):
exec("nimrod doc $# --docSeeSrcUrl:$# -o:$# --index:on $#" %
exec("nim doc $# --docSeeSrcUrl:$# -o:$# --index:on $#" %
[c.nimrodArgs, c.gitCommit,
destPath / changeFileExt(splitFile(d).name, "html"), d])
for d in items(c.srcdoc2):
exec("nimrod doc2 $# --docSeeSrcUrl:$# -o:$# --index:on $#" %
exec("nim doc2 $# --docSeeSrcUrl:$# -o:$# --index:on $#" %
[c.nimrodArgs, c.gitCommit,
destPath / changeFileExt(splitFile(d).name, "html"), d])
exec("nimrod buildIndex -o:$1/theindex.html $1" % [destPath])
exec("nim buildIndex -o:$1/theindex.html $1" % [destPath])
proc buildPdfDoc(c: var TConfigData, destPath: string) =
if os.execShellCmd("pdflatex -version") != 0:
echo "pdflatex not found; no PDF documentation generated"
else:
for d in items(c.pdf):
exec("nimrod rst2tex $# $#" % [c.nimrodArgs, d])
exec("nim rst2tex $# $#" % [c.nimrodArgs, d])
# call LaTeX twice to get cross references right:
exec("pdflatex " & changeFileExt(d, "tex"))
exec("pdflatex " & changeFileExt(d, "tex"))
@@ -265,7 +265,7 @@ proc buildPdfDoc(c: var TConfigData, destPath: string) =
proc buildAddDoc(c: var TConfigData, destPath: string) =
# build additional documentation (without the index):
for d in items(c.webdoc):
exec("nimrod doc $# --docSeeSrcUrl:$# -o:$# $#" %
exec("nim doc $# --docSeeSrcUrl:$# -o:$# $#" %
[c.nimrodArgs, c.gitCommit,
destPath / changeFileExt(splitFile(d).name, "html"), d])
@@ -349,12 +349,12 @@ proc buildNewsRss(c: var TConfigData, destPath: string) =
generateRss(destFilename, parseNewsTitles(srcFilename))
proc buildJS(destPath: string) =
exec("nimrod js -d:release --out:$1 web/babelpkglist.nim" %
exec("nim js -d:release --out:$1 web/babelpkglist.nim" %
[destPath / "babelpkglist.js"])
proc main(c: var TConfigData) =
const
cmd = "nimrod rst2html --compileonly $1 -o:web/$2.temp web/$2.txt"
cmd = "nim rst2html --compileonly $1 -o:web/$2.temp web/$2.txt"
if c.ticker.len > 0:
try:
c.ticker = readFile("web" / c.ticker)