Merge pull request #1748 from boydgreenfield/improved-doc-styling
Improved doc styling
This commit is contained in:
commit
6a1ae0d616
3 changed files with 1127 additions and 221 deletions
1326
config/nimdoc.cfg
1326
config/nimdoc.cfg
File diff suppressed because it is too large
Load diff
|
|
@ -688,7 +688,7 @@ proc renderHeadline(d: PDoc, n: PRstNode, result: var string) =
|
||||||
d.tocPart[length].header = tmp
|
d.tocPart[length].header = tmp
|
||||||
|
|
||||||
dispA(d.target, result, "\n<h$1><a class=\"toc-backref\" " &
|
dispA(d.target, result, "\n<h$1><a class=\"toc-backref\" " &
|
||||||
"id=\"$2\" href=\"#$2_toc\">$3</a></h$1>", "\\rsth$4{$3}\\label{$2}\n",
|
"id=\"$2\" href=\"#$2\">$3</a></h$1>", "\\rsth$4{$3}\\label{$2}\n",
|
||||||
[$n.level, d.tocPart[length].refname, tmp, $chr(n.level - 1 + ord('A'))])
|
[$n.level, d.tocPart[length].refname, tmp, $chr(n.level - 1 + ord('A'))])
|
||||||
else:
|
else:
|
||||||
dispA(d.target, result, "\n<h$1 id=\"$2\">$3</h$1>",
|
dispA(d.target, result, "\n<h$1 id=\"$2\">$3</h$1>",
|
||||||
|
|
@ -836,7 +836,7 @@ proc buildLinesHTMLTable(params: CodeBlockParams, code: string):
|
||||||
|
|
||||||
var codeLines = 1 + code.strip.countLines
|
var codeLines = 1 + code.strip.countLines
|
||||||
assert codeLines > 0
|
assert codeLines > 0
|
||||||
result.beginTable = """<table><tbody><tr><td class="blob-line-nums"><pre>"""
|
result.beginTable = """<table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre>"""
|
||||||
var line = params.startLine
|
var line = params.startLine
|
||||||
while codeLines > 0:
|
while codeLines > 0:
|
||||||
result.beginTable.add($line & "\n")
|
result.beginTable.add($line & "\n")
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ type
|
||||||
authors, projectName, projectTitle, logo, infile, outdir, ticker: string
|
authors, projectName, projectTitle, logo, infile, outdir, ticker: string
|
||||||
vars: StringTableRef
|
vars: StringTableRef
|
||||||
nimArgs: string
|
nimArgs: string
|
||||||
|
gitRepo: string
|
||||||
gitCommit: string
|
gitCommit: string
|
||||||
quotations: Table[string, tuple[quote, author: string]]
|
quotations: Table[string, tuple[quote, author: string]]
|
||||||
numProcessors: int # Set by parallelBuild:n, only works for values > 0.
|
numProcessors: int # Set by parallelBuild:n, only works for values > 0.
|
||||||
|
|
@ -46,6 +47,7 @@ proc initConfigData(c: var TConfigData) =
|
||||||
c.logo = ""
|
c.logo = ""
|
||||||
c.ticker = ""
|
c.ticker = ""
|
||||||
c.vars = newStringTable(modeStyleInsensitive)
|
c.vars = newStringTable(modeStyleInsensitive)
|
||||||
|
c.gitRepo = "https://github.com/Araq/Nimrod/tree"
|
||||||
c.gitCommit = "master"
|
c.gitCommit = "master"
|
||||||
c.numProcessors = countProcessors()
|
c.numProcessors = countProcessors()
|
||||||
# Attempts to obtain the git current commit.
|
# 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))
|
commands = newSeq[string](len(c.doc) + len(c.srcdoc) + len(c.srcdoc2))
|
||||||
i = 0
|
i = 0
|
||||||
for d in items(c.doc):
|
for d in items(c.doc):
|
||||||
commands[i] = "nim rst2html $# --docSeeSrcUrl:$# -o:$# --index:on $#" %
|
commands[i] = "nim rst2html $# --docSeeSrcUrl:$#/$#/$# -o:$# --index:on $#" %
|
||||||
[c.nimArgs, c.gitCommit,
|
[c.nimArgs, c.gitRepo, c.gitCommit, splitFile(d).dir,
|
||||||
destPath / changeFileExt(splitFile(d).name, "html"), d]
|
destPath / changeFileExt(splitFile(d).name, "html"), d]
|
||||||
i.inc
|
i.inc
|
||||||
for d in items(c.srcdoc):
|
for d in items(c.srcdoc):
|
||||||
commands[i] = "nim doc $# --docSeeSrcUrl:$# -o:$# --index:on $#" %
|
commands[i] = "nim doc $# --docSeeSrcUrl:$#/$#/$# -o:$# --index:on $#" %
|
||||||
[c.nimArgs, c.gitCommit,
|
[c.nimArgs, c.gitRepo, c.gitCommit, splitFile(d).dir,
|
||||||
destPath / changeFileExt(splitFile(d).name, "html"), d]
|
destPath / changeFileExt(splitFile(d).name, "html"), d]
|
||||||
i.inc
|
i.inc
|
||||||
for d in items(c.srcdoc2):
|
for d in items(c.srcdoc2):
|
||||||
commands[i] = "nim doc2 $# --docSeeSrcUrl:$# -o:$# --index:on $#" %
|
commands[i] = "nim doc2 $# --docSeeSrcUrl:$#/$#/$# -o:$# --index:on $#" %
|
||||||
[c.nimArgs, c.gitCommit,
|
[c.nimArgs, c.gitRepo, c.gitCommit, splitFile(d).dir,
|
||||||
destPath / changeFileExt(splitFile(d).name, "html"), d]
|
destPath / changeFileExt(splitFile(d).name, "html"), d]
|
||||||
i.inc
|
i.inc
|
||||||
|
|
||||||
|
|
@ -309,8 +311,8 @@ proc buildAddDoc(c: var TConfigData, destPath: string) =
|
||||||
# build additional documentation (without the index):
|
# build additional documentation (without the index):
|
||||||
var commands = newSeq[string](c.webdoc.len)
|
var commands = newSeq[string](c.webdoc.len)
|
||||||
for i, doc in pairs(c.webdoc):
|
for i, doc in pairs(c.webdoc):
|
||||||
commands[i] = "nim doc $# --docSeeSrcUrl:$# -o:$# $#" %
|
commands[i] = "nim doc $# --docSeeSrcUrl:$#/$#/$# -o:$# $#" %
|
||||||
[c.nimArgs, c.gitCommit,
|
[c.nimArgs, c.gitRepo, c.gitCommit, splitFile(doc).dir,
|
||||||
destPath / changeFileExt(splitFile(doc).name, "html"), doc]
|
destPath / changeFileExt(splitFile(doc).name, "html"), doc]
|
||||||
mexec(commands, c.numProcessors)
|
mexec(commands, c.numProcessors)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue