docgen: different attachedType generation
This commit is contained in:
parent
3e87ef35fa
commit
07fcce6e63
2 changed files with 9 additions and 8 deletions
|
|
@ -440,11 +440,6 @@ proc genItem(d: PDoc, n, nameNode: PNode, k: TSymKind) =
|
||||||
dispA(result, "<span class=\"Other\">$1</span>", "\\spanOther{$1}",
|
dispA(result, "<span class=\"Other\">$1</span>", "\\spanOther{$1}",
|
||||||
[rope(esc(d.target, literal))])
|
[rope(esc(d.target, literal))])
|
||||||
|
|
||||||
if k in routineKinds and nameNode.kind == nkSym:
|
|
||||||
let att = attachToType(d, nameNode.sym)
|
|
||||||
if att != nil:
|
|
||||||
dispA(result, """<span class="attachedType" style="visibility:hidden">$1</span>""", "",
|
|
||||||
[rope esc(d.target, att.name.s)])
|
|
||||||
inc(d.id)
|
inc(d.id)
|
||||||
let
|
let
|
||||||
plainNameRope = rope(xmltree.escape(plainName.strip))
|
plainNameRope = rope(xmltree.escape(plainName.strip))
|
||||||
|
|
@ -476,12 +471,18 @@ proc genItem(d: PDoc, n, nameNode: PNode, k: TSymKind) =
|
||||||
"itemSymOrID", "itemSymEnc", "itemSymOrIDEnc", "seeSrc"],
|
"itemSymOrID", "itemSymEnc", "itemSymOrIDEnc", "seeSrc"],
|
||||||
[nameRope, result, comm, itemIDRope, plainNameRope, plainSymbolRope,
|
[nameRope, result, comm, itemIDRope, plainNameRope, plainSymbolRope,
|
||||||
symbolOrIdRope, plainSymbolEncRope, symbolOrIdEncRope, seeSrcRope]))
|
symbolOrIdRope, plainSymbolEncRope, symbolOrIdEncRope, seeSrcRope]))
|
||||||
|
|
||||||
|
var attype: Rope
|
||||||
|
if k in routineKinds and nameNode.kind == nkSym:
|
||||||
|
let att = attachToType(d, nameNode.sym)
|
||||||
|
if att != nil:
|
||||||
|
attype = rope esc(d.target, att.name.s)
|
||||||
add(d.toc[k], ropeFormatNamedVars(getConfigVar("doc.item.toc"),
|
add(d.toc[k], ropeFormatNamedVars(getConfigVar("doc.item.toc"),
|
||||||
["name", "header", "desc", "itemID", "header_plain", "itemSym",
|
["name", "header", "desc", "itemID", "header_plain", "itemSym",
|
||||||
"itemSymOrID", "itemSymEnc", "itemSymOrIDEnc"],
|
"itemSymOrID", "itemSymEnc", "itemSymOrIDEnc", "attype"],
|
||||||
[rope(getName(d, nameNode, d.splitAfter)), result, comm,
|
[rope(getName(d, nameNode, d.splitAfter)), result, comm,
|
||||||
itemIDRope, plainNameRope, plainSymbolRope, symbolOrIdRope,
|
itemIDRope, plainNameRope, plainSymbolRope, symbolOrIdRope,
|
||||||
plainSymbolEncRope, symbolOrIdEncRope]))
|
plainSymbolEncRope, symbolOrIdEncRope, attype]))
|
||||||
|
|
||||||
# Ironically for types the complexSymbol is *cleaner* than the plainName
|
# Ironically for types the complexSymbol is *cleaner* than the plainName
|
||||||
# because it doesn't include object fields or documentation comments. So we
|
# because it doesn't include object fields or documentation comments. So we
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ $seeSrc
|
||||||
# See doc.item for available substitution variables.
|
# See doc.item for available substitution variables.
|
||||||
doc.item.toc = """
|
doc.item.toc = """
|
||||||
<li><a class="reference" href="#$itemSymOrID"
|
<li><a class="reference" href="#$itemSymOrID"
|
||||||
title="$header_plain">$name</a></li>
|
title="$header_plain">$name<span class="attachedType" style="visibility:hidden">$attype</span></a></li>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# HTML rendered for doc.item's seeSrc variable. Note that this will render to
|
# HTML rendered for doc.item's seeSrc variable. Note that this will render to
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue