mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-06 13:07:48 +00:00
Merge pull request #1748 from boydgreenfield/improved-doc-styling
Improved doc styling
This commit is contained in:
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
|
||||
|
||||
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'))])
|
||||
else:
|
||||
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
|
||||
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
|
||||
while codeLines > 0:
|
||||
result.beginTable.add($line & "\n")
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user