Some docgen fixes.
This commit is contained in:
parent
37149dcf86
commit
69d4eb14bc
3 changed files with 20 additions and 19 deletions
|
|
@ -446,7 +446,7 @@ proc unescape*(uri: cstring): cstring {.importc, nodecl.}
|
||||||
|
|
||||||
proc decodeURIComponent*(uri: cstring): cstring {.importc, nodecl.}
|
proc decodeURIComponent*(uri: cstring): cstring {.importc, nodecl.}
|
||||||
proc encodeURIComponent*(uri: cstring): cstring {.importc, nodecl.}
|
proc encodeURIComponent*(uri: cstring): cstring {.importc, nodecl.}
|
||||||
proc isFinite*(x: biggestFloat): bool {.importc, nodecl.}
|
proc isFinite*(x: BiggestFloat): bool {.importc, nodecl.}
|
||||||
proc isNaN*(x: biggestFloat): bool {.importc, nodecl.}
|
proc isNaN*(x: BiggestFloat): bool {.importc, nodecl.}
|
||||||
proc parseFloat*(s: cstring): biggestFloat {.importc, nodecl.}
|
proc parseFloat*(s: cstring): BiggestFloat {.importc, nodecl.}
|
||||||
proc parseInt*(s: cstring): int {.importc, nodecl.}
|
proc parseInt*(s: cstring): int {.importc, nodecl.}
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@ template encodeInternal(s: expr, lineLen: int, newLine: string): stmt {.immediat
|
||||||
setLen(result, r+4)
|
setLen(result, r+4)
|
||||||
else:
|
else:
|
||||||
#assert(r == result.len)
|
#assert(r == result.len)
|
||||||
|
discard
|
||||||
|
|
||||||
proc encode*[T:SomeInteger|char](s: openarray[T], lineLen = 75, newLine="\13\10"): string =
|
proc encode*[T:SomeInteger|char](s: openarray[T], lineLen = 75, newLine="\13\10"): string =
|
||||||
## encodes `s` into base64 representation. After `lineLen` characters, a
|
## encodes `s` into base64 representation. After `lineLen` characters, a
|
||||||
|
|
|
||||||
|
|
@ -53,8 +53,8 @@ include "website.tmpl"
|
||||||
# ------------------------- configuration file -------------------------------
|
# ------------------------- configuration file -------------------------------
|
||||||
|
|
||||||
const
|
const
|
||||||
Version = "0.7"
|
version = "0.7"
|
||||||
Usage = "nimweb - Nim Website Generator Version " & version & """
|
usage = "nimweb - Nim Website Generator Version " & version & """
|
||||||
|
|
||||||
(c) 2012 Andreas Rumpf
|
(c) 2012 Andreas Rumpf
|
||||||
Usage:
|
Usage:
|
||||||
|
|
@ -115,19 +115,19 @@ proc parseCmdLine(c: var TConfigData) =
|
||||||
of cmdLongOption, cmdShortOption:
|
of cmdLongOption, cmdShortOption:
|
||||||
case normalize(key)
|
case normalize(key)
|
||||||
of "help", "h":
|
of "help", "h":
|
||||||
stdout.write(Usage)
|
stdout.write(usage)
|
||||||
quit(0)
|
quit(0)
|
||||||
of "version", "v":
|
of "version", "v":
|
||||||
stdout.write(Version & "\n")
|
stdout.write(version & "\n")
|
||||||
quit(0)
|
quit(0)
|
||||||
of "o", "output": c.outdir = val
|
of "o", "output": c.outdir = val
|
||||||
of "var":
|
of "var":
|
||||||
var idx = val.find('=')
|
var idx = val.find('=')
|
||||||
if idx < 0: quit("invalid command line")
|
if idx < 0: quit("invalid command line")
|
||||||
c.vars[substr(val, 0, idx-1)] = substr(val, idx+1)
|
c.vars[substr(val, 0, idx-1)] = substr(val, idx+1)
|
||||||
else: quit(Usage)
|
else: quit(usage)
|
||||||
of cmdEnd: break
|
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) =
|
proc walkDirRecursively(s: var seq[string], root, ext: string) =
|
||||||
for k, f in walkDir(root):
|
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
|
## it didn't make much sense to integrate into the existing generic
|
||||||
## documentation builders.
|
## documentation builders.
|
||||||
const src = "doc"/"docgen_sample.nim"
|
const src = "doc"/"docgen_sample.nim"
|
||||||
exec("nimrod doc $# -o:$# $#" %
|
exec("nim doc $# -o:$# $#" %
|
||||||
[c.nimrodArgs, destPath / "docgen_sample.html", src])
|
[c.nimrodArgs, destPath / "docgen_sample.html", src])
|
||||||
exec("nimrod doc2 $# -o:$# $#" %
|
exec("nim doc2 $# -o:$# $#" %
|
||||||
[c.nimrodArgs, destPath / "docgen_sample2.html", src])
|
[c.nimrodArgs, destPath / "docgen_sample2.html", src])
|
||||||
|
|
||||||
proc buildDoc(c: var TConfigData, destPath: string) =
|
proc buildDoc(c: var TConfigData, destPath: string) =
|
||||||
# call nim for the documentation:
|
# call nim for the documentation:
|
||||||
for d in items(c.doc):
|
for d in items(c.doc):
|
||||||
exec("nimrod rst2html $# --docSeeSrcUrl:$# -o:$# --index:on $#" %
|
exec("nim rst2html $# --docSeeSrcUrl:$# -o:$# --index:on $#" %
|
||||||
[c.nimrodArgs, c.gitCommit,
|
[c.nimrodArgs, c.gitCommit,
|
||||||
destPath / changeFileExt(splitFile(d).name, "html"), d])
|
destPath / changeFileExt(splitFile(d).name, "html"), d])
|
||||||
for d in items(c.srcdoc):
|
for d in items(c.srcdoc):
|
||||||
exec("nimrod doc $# --docSeeSrcUrl:$# -o:$# --index:on $#" %
|
exec("nim doc $# --docSeeSrcUrl:$# -o:$# --index:on $#" %
|
||||||
[c.nimrodArgs, c.gitCommit,
|
[c.nimrodArgs, c.gitCommit,
|
||||||
destPath / changeFileExt(splitFile(d).name, "html"), d])
|
destPath / changeFileExt(splitFile(d).name, "html"), d])
|
||||||
for d in items(c.srcdoc2):
|
for d in items(c.srcdoc2):
|
||||||
exec("nimrod doc2 $# --docSeeSrcUrl:$# -o:$# --index:on $#" %
|
exec("nim doc2 $# --docSeeSrcUrl:$# -o:$# --index:on $#" %
|
||||||
[c.nimrodArgs, c.gitCommit,
|
[c.nimrodArgs, c.gitCommit,
|
||||||
destPath / changeFileExt(splitFile(d).name, "html"), d])
|
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) =
|
proc buildPdfDoc(c: var TConfigData, destPath: string) =
|
||||||
if os.execShellCmd("pdflatex -version") != 0:
|
if os.execShellCmd("pdflatex -version") != 0:
|
||||||
echo "pdflatex not found; no PDF documentation generated"
|
echo "pdflatex not found; no PDF documentation generated"
|
||||||
else:
|
else:
|
||||||
for d in items(c.pdf):
|
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:
|
# call LaTeX twice to get cross references right:
|
||||||
exec("pdflatex " & changeFileExt(d, "tex"))
|
exec("pdflatex " & changeFileExt(d, "tex"))
|
||||||
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) =
|
proc buildAddDoc(c: var TConfigData, destPath: string) =
|
||||||
# build additional documentation (without the index):
|
# build additional documentation (without the index):
|
||||||
for d in items(c.webdoc):
|
for d in items(c.webdoc):
|
||||||
exec("nimrod doc $# --docSeeSrcUrl:$# -o:$# $#" %
|
exec("nim doc $# --docSeeSrcUrl:$# -o:$# $#" %
|
||||||
[c.nimrodArgs, c.gitCommit,
|
[c.nimrodArgs, c.gitCommit,
|
||||||
destPath / changeFileExt(splitFile(d).name, "html"), d])
|
destPath / changeFileExt(splitFile(d).name, "html"), d])
|
||||||
|
|
||||||
|
|
@ -349,12 +349,12 @@ proc buildNewsRss(c: var TConfigData, destPath: string) =
|
||||||
generateRss(destFilename, parseNewsTitles(srcFilename))
|
generateRss(destFilename, parseNewsTitles(srcFilename))
|
||||||
|
|
||||||
proc buildJS(destPath: string) =
|
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"])
|
[destPath / "babelpkglist.js"])
|
||||||
|
|
||||||
proc main(c: var TConfigData) =
|
proc main(c: var TConfigData) =
|
||||||
const
|
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:
|
if c.ticker.len > 0:
|
||||||
try:
|
try:
|
||||||
c.ticker = readFile("web" / c.ticker)
|
c.ticker = readFile("web" / c.ticker)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue