Adds explicit titles to documentation index.
This commit is contained in:
parent
bc79f40281
commit
1d0175ed27
2 changed files with 16 additions and 7 deletions
|
|
@ -541,8 +541,14 @@ proc genOutFile(d: PDoc): PRope =
|
||||||
if toc != nil:
|
if toc != nil:
|
||||||
toc = ropeFormatNamedVars(getConfigVar("doc.toc"), ["content"], [toc])
|
toc = ropeFormatNamedVars(getConfigVar("doc.toc"), ["content"], [toc])
|
||||||
for i in countup(low(TSymKind), high(TSymKind)): app(code, d.section[i])
|
for i in countup(low(TSymKind), high(TSymKind)): app(code, d.section[i])
|
||||||
if d.meta[metaTitle].len != 0: title = d.meta[metaTitle]
|
|
||||||
else: title = "Module " & extractFilename(changeFileExt(d.filename, ""))
|
# Extract the title. Non API modules generate an entry in the index table.
|
||||||
|
if d.meta[metaTitle].len != 0:
|
||||||
|
title = d.meta[metaTitle]
|
||||||
|
setIndexTerm(d[], "", title)
|
||||||
|
else:
|
||||||
|
# Modules get an automatic title for the HTML, but no entry in the index.
|
||||||
|
title = "Module " & extractFilename(changeFileExt(d.filename, ""))
|
||||||
|
|
||||||
let bodyname = if d.hasToc: "doc.body_toc" else: "doc.body_no_toc"
|
let bodyname = if d.hasToc: "doc.body_toc" else: "doc.body_no_toc"
|
||||||
content = ropeFormatNamedVars(getConfigVar(bodyname), ["title",
|
content = ropeFormatNamedVars(getConfigVar(bodyname), ["title",
|
||||||
|
|
|
||||||
|
|
@ -256,9 +256,11 @@ proc setIndexTerm*(d: var TRstGenerator, id, term: string,
|
||||||
##
|
##
|
||||||
## The ``d.theIndex`` string will be used to append the term in the format
|
## The ``d.theIndex`` string will be used to append the term in the format
|
||||||
## ``term<tab>file#id``. The anchor will be the based on the name of the file
|
## ``term<tab>file#id``. The anchor will be the based on the name of the file
|
||||||
## currently being parsed plus the `id`, which will be appended after a hash.
|
## currently being parsed plus the specified `id`. The `id` will be appended
|
||||||
## If `linkTitle` or `linkDesc` are not the empty string, two additional
|
## with a hash character only if its length is not zero, otherwise no
|
||||||
## columns with their contents will be added.
|
## specific anchor will be generated. If `linkTitle` or `linkDesc` are not
|
||||||
|
## the empty string, two additional columns with their contents will be
|
||||||
|
## added.
|
||||||
##
|
##
|
||||||
## The index won't be written to disk unless you call ``writeIndexFile``. The
|
## The index won't be written to disk unless you call ``writeIndexFile``. The
|
||||||
## purpose of the index is documented in the `docgen tools guide
|
## purpose of the index is documented in the `docgen tools guide
|
||||||
|
|
@ -267,8 +269,9 @@ proc setIndexTerm*(d: var TRstGenerator, id, term: string,
|
||||||
d.theIndex.add('\t')
|
d.theIndex.add('\t')
|
||||||
let htmlFile = changeFileExt(extractFilename(d.filename), HtmlExt)
|
let htmlFile = changeFileExt(extractFilename(d.filename), HtmlExt)
|
||||||
d.theIndex.add(htmlFile)
|
d.theIndex.add(htmlFile)
|
||||||
d.theIndex.add('#')
|
if id.len > 0:
|
||||||
d.theIndex.add(id)
|
d.theIndex.add('#')
|
||||||
|
d.theIndex.add(id)
|
||||||
if linkTitle.len > 0 or linkDesc.len > 0:
|
if linkTitle.len > 0 or linkDesc.len > 0:
|
||||||
d.theIndex.add('\t' & linkTitle.quoteIndexColumn)
|
d.theIndex.add('\t' & linkTitle.quoteIndexColumn)
|
||||||
d.theIndex.add('\t' & linkDesc.quoteIndexColumn)
|
d.theIndex.add('\t' & linkDesc.quoteIndexColumn)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue