diff --git a/config/nimdoc.cfg b/config/nimdoc.cfg
index 975c7c06af..7bb63ddaa3 100644
--- a/config/nimdoc.cfg
+++ b/config/nimdoc.cfg
@@ -1,15 +1,15 @@
# This is the config file for the documentation generator.
# (c) 2012 Andreas Rumpf
# Feel free to edit the templates as you need. If you modify this file, it
-# might be worth updating the hardcoded values in packages/docutils/rstgen.ni
+# might be worth updating the hardcoded values in packages/docutils/rstgen.nim
-split.item.toc = "20"
+split.item.toc = "20"
# too long entries in the table of contents wrap around
# after this number of characters
doc.section = """
-$moduledesc
-$content
+
+
+ $tableofcontents
+
+
+
$moduledesc
+ $content
+
"""
@@ -89,136 +93,774 @@ doc.file = """
+
+
+
+
+
+
+
+
+
$title
-
-
$title
-$content
-
Generated: $date $time UTC
+
+
$title
+ $content
+
+
+
+
+ Made with Nim. Generated: $date $time UTC
+
+
+
diff --git a/lib/packages/docutils/rstgen.nim b/lib/packages/docutils/rstgen.nim
index fc60b36721..09373ac9e8 100644
--- a/lib/packages/docutils/rstgen.nim
+++ b/lib/packages/docutils/rstgen.nim
@@ -688,7 +688,7 @@ proc renderHeadline(d: PDoc, n: PRstNode, result: var string) =
d.tocPart[length].header = tmp
dispA(d.target, result, "\n
$3 ", "\\rsth$4{$3}\\label{$2}\n",
+ "id=\"$2\" href=\"#$2\">$3", "\\rsth$4{$3}\\label{$2}\n",
[$n.level, d.tocPart[length].refname, tmp, $chr(n.level - 1 + ord('A'))])
else:
dispA(d.target, result, "\n
$3 ",
@@ -836,7 +836,7 @@ proc buildLinesHTMLTable(params: CodeBlockParams, code: string):
var codeLines = 1 + code.strip.countLines
assert codeLines > 0
- result.beginTable = """
"""
+ result.beginTable = """ """
var line = params.startLine
while codeLines > 0:
result.beginTable.add($line & "\n")
diff --git a/tools/nimweb.nim b/tools/nimweb.nim
index fa4f159951..d56b6aecf4 100644
--- a/tools/nimweb.nim
+++ b/tools/nimweb.nim
@@ -19,6 +19,7 @@ type
authors, projectName, projectTitle, logo, infile, outdir, ticker: string
vars: StringTableRef
nimArgs: string
+ gitRepo: string
gitCommit: string
quotations: Table[string, tuple[quote, author: string]]
numProcessors: int # Set by parallelBuild:n, only works for values > 0.
@@ -46,6 +47,7 @@ proc initConfigData(c: var TConfigData) =
c.logo = ""
c.ticker = ""
c.vars = newStringTable(modeStyleInsensitive)
+ c.gitRepo = "https://github.com/Araq/Nimrod/tree"
c.gitCommit = "master"
c.numProcessors = countProcessors()
# Attempts to obtain the git current commit.
@@ -266,18 +268,18 @@ proc buildDoc(c: var TConfigData, destPath: string) =
commands = newSeq[string](len(c.doc) + len(c.srcdoc) + len(c.srcdoc2))
i = 0
for d in items(c.doc):
- commands[i] = "nim rst2html $# --docSeeSrcUrl:$# -o:$# --index:on $#" %
- [c.nimArgs, c.gitCommit,
+ commands[i] = "nim rst2html $# --docSeeSrcUrl:$#/$#/$# -o:$# --index:on $#" %
+ [c.nimArgs, c.gitRepo, c.gitCommit, splitFile(d).dir,
destPath / changeFileExt(splitFile(d).name, "html"), d]
i.inc
for d in items(c.srcdoc):
- commands[i] = "nim doc $# --docSeeSrcUrl:$# -o:$# --index:on $#" %
- [c.nimArgs, c.gitCommit,
+ commands[i] = "nim doc $# --docSeeSrcUrl:$#/$#/$# -o:$# --index:on $#" %
+ [c.nimArgs, c.gitRepo, c.gitCommit, splitFile(d).dir,
destPath / changeFileExt(splitFile(d).name, "html"), d]
i.inc
for d in items(c.srcdoc2):
- commands[i] = "nim doc2 $# --docSeeSrcUrl:$# -o:$# --index:on $#" %
- [c.nimArgs, c.gitCommit,
+ commands[i] = "nim doc2 $# --docSeeSrcUrl:$#/$#/$# -o:$# --index:on $#" %
+ [c.nimArgs, c.gitRepo, c.gitCommit, splitFile(d).dir,
destPath / changeFileExt(splitFile(d).name, "html"), d]
i.inc
@@ -309,8 +311,8 @@ proc buildAddDoc(c: var TConfigData, destPath: string) =
# build additional documentation (without the index):
var commands = newSeq[string](c.webdoc.len)
for i, doc in pairs(c.webdoc):
- commands[i] = "nim doc $# --docSeeSrcUrl:$# -o:$# $#" %
- [c.nimArgs, c.gitCommit,
+ commands[i] = "nim doc $# --docSeeSrcUrl:$#/$#/$# -o:$# $#" %
+ [c.nimArgs, c.gitRepo, c.gitCommit, splitFile(doc).dir,
destPath / changeFileExt(splitFile(doc).name, "html"), doc]
mexec(commands, c.numProcessors)