fix export links in the documentation (#16114) [backport:1.4]
* fix export links in the documentation * fix `len` problem
This commit is contained in:
parent
9a2a83ad71
commit
9a86198ed5
1 changed files with 9 additions and 5 deletions
|
|
@ -718,7 +718,7 @@ proc complexName(k: TSymKind, n: PNode, baseName: string): string =
|
||||||
of skTemplate: result.add(".t")
|
of skTemplate: result.add(".t")
|
||||||
of skConverter: result.add(".c")
|
of skConverter: result.add(".c")
|
||||||
else: discard
|
else: discard
|
||||||
if n.len > paramsPos and n[paramsPos].kind == nkFormalParams:
|
if n.safeLen > paramsPos and n[paramsPos].kind == nkFormalParams:
|
||||||
let params = renderParamTypes(n[paramsPos])
|
let params = renderParamTypes(n[paramsPos])
|
||||||
if params.len > 0:
|
if params.len > 0:
|
||||||
result.add(defaultParamSeparator)
|
result.add(defaultParamSeparator)
|
||||||
|
|
@ -968,13 +968,17 @@ proc exportSym(d: PDoc; s: PSym) =
|
||||||
elif s.kind != skModule and s.owner != nil:
|
elif s.kind != skModule and s.owner != nil:
|
||||||
let module = originatingModule(s)
|
let module = originatingModule(s)
|
||||||
if belongsToPackage(d.conf, module):
|
if belongsToPackage(d.conf, module):
|
||||||
let external = externalDep(d, module)
|
let
|
||||||
|
complexSymbol = complexName(s.kind, s.ast, s.name.s)
|
||||||
|
symbolOrIdRope = rope(d.newUniquePlainSymbol(complexSymbol))
|
||||||
|
external = externalDep(d, module)
|
||||||
if d.section[k] != nil: d.section[k].add(", ")
|
if d.section[k] != nil: d.section[k].add(", ")
|
||||||
# XXX proper anchor generation here
|
# XXX proper anchor generation here
|
||||||
dispA(d.conf, d.section[k],
|
dispA(d.conf, d.section[k],
|
||||||
"<a href=\"$2#$1\"><span class=\"Identifier\">$1</span></a>",
|
"<a href=\"$2#$3\"><span class=\"Identifier\">$1</span></a>",
|
||||||
"$1", [rope esc(d.target, s.name.s),
|
"$1", [rope esc(d.target, s.name.s),
|
||||||
rope changeFileExt(external, "html")])
|
rope changeFileExt(external, "html"),
|
||||||
|
symbolOrIdRope])
|
||||||
|
|
||||||
proc documentNewEffect(cache: IdentCache; n: PNode): PNode =
|
proc documentNewEffect(cache: IdentCache; n: PNode): PNode =
|
||||||
let s = n[namePos].sym
|
let s = n[namePos].sym
|
||||||
|
|
@ -1077,7 +1081,7 @@ proc generateDoc*(d: PDoc, n, orig: PNode, docFlags: DocFlags = kDefault) =
|
||||||
if it.kind == nkSym:
|
if it.kind == nkSym:
|
||||||
if d.module != nil and d.module == it.sym.owner:
|
if d.module != nil and d.module == it.sym.owner:
|
||||||
generateDoc(d, it.sym.ast, orig, kForceExport)
|
generateDoc(d, it.sym.ast, orig, kForceExport)
|
||||||
else:
|
elif it.sym.ast != nil:
|
||||||
exportSym(d, it.sym)
|
exportSym(d, it.sym)
|
||||||
of nkExportExceptStmt: discard "transformed into nkExportStmt by semExportExcept"
|
of nkExportExceptStmt: discard "transformed into nkExportStmt by semExportExcept"
|
||||||
of nkFromStmt, nkImportExceptStmt: traceDeps(d, n[0])
|
of nkFromStmt, nkImportExceptStmt: traceDeps(d, n[0])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue