diff --git a/compiler/docgen.nim b/compiler/docgen.nim index bf8bdde143a49..9fb201f73ea56 100644 --- a/compiler/docgen.nim +++ b/compiler/docgen.nim @@ -1086,6 +1086,9 @@ proc genItem(d: PDoc, n, nameNode: PNode, k: TSymKind, docFlags: DocFlags, nonEx symbolOrIdEnc = encodeUrl(symbolOrId, usePlus = false) deprecationMsg = genDeprecationMsg(d, pragmaNode) rstLangSymbol = toLangSymbol(k, n, cleanPlainSymbol) + symNameNode = + if nameNode.kind == nkPostfix: nameNode[1] + else: nameNode # we generate anchors automatically for subsequent use in doc comments let lineinfo = rstast.TLineInfo( @@ -1122,18 +1125,19 @@ proc genItem(d: PDoc, n, nameNode: PNode, k: TSymKind, docFlags: DocFlags, nonEx let external = d.destFile.AbsoluteFile.relativeTo(d.conf.outDir, '/').changeFileExt(HtmlExt).string var attype = "" - if k in routineKinds and nameNode.kind == nkSym: + if k in routineKinds and symNameNode.kind == nkSym: let att = attachToType(d, nameNode.sym) if att != nil: attype = esc(d.target, att.name.s) - elif k == skType and nameNode.kind == nkSym and nameNode.sym.typ.kind in {tyEnum, tyBool}: - let etyp = nameNode.sym.typ + elif k == skType and symNameNode.kind == nkSym and + symNameNode.sym.typ.kind in {tyEnum, tyBool}: + let etyp = symNameNode.sym.typ for e in etyp.n: if e.sym.kind != skEnumField: continue let plain = renderPlainSymbolName(e) let symbolOrId = d.newUniquePlainSymbol(plain) setIndexTerm(d[], ieNim, htmlFile = external, id = symbolOrId, - term = plain, linkTitle = nameNode.sym.name.s & '.' & plain, + term = plain, linkTitle = symNameNode.sym.name.s & '.' & plain, linkDesc = xmltree.escape(getPlainDocstring(e).docstringSummary), line = n.info.line.int) @@ -1154,8 +1158,8 @@ proc genItem(d: PDoc, n, nameNode: PNode, k: TSymKind, docFlags: DocFlags, nonEx linkTitle = detailedName, linkDesc = xmltree.escape(plainDocstring.docstringSummary), line = n.info.line.int) - if k == skType and nameNode.kind == nkSym: - d.types.strTableAdd nameNode.sym + if k == skType and symNameNode.kind == nkSym: + d.types.strTableAdd symNameNode.sym proc genJsonItem(d: PDoc, n, nameNode: PNode, k: TSymKind, nonExports = false): JsonItem = if not isVisible(d, nameNode): return diff --git a/nimdoc/extlinks/project/expected/main.html b/nimdoc/extlinks/project/expected/main.html index 1a58ea2ac7b07..e1afdf15e6608 100644 --- a/nimdoc/extlinks/project/expected/main.html +++ b/nimdoc/extlinks/project/expected/main.html @@ -55,7 +55,7 @@
A = object +
A* = object
submoduleInt = distinct int
submoduleInt* = distinct int
SomeType = enum +
SomeType* = enum enumValueA, enumValueB, enumValueC
AnotherObject = object +
AnotherObject* = object case x*: bool of true: y*: proc (x: string) @@ -392,7 +392,7 @@Types
FooBuzz {....deprecated: "FooBuzz msg".} = int
FooBuzz* {....deprecated: "FooBuzz msg".} = int
MyObject = object +
MyObject* = object someString*: string ## This is a string annotated* {.somePragma.}: string ## This is an annotated string