diff options
-rw-r--r-- | compiler/docgen.nim | 6 | ||||
-rw-r--r-- | lib/packages/docutils/rstgen.nim | 7 |
2 files changed, 9 insertions, 4 deletions
diff --git a/compiler/docgen.nim b/compiler/docgen.nim index d989905b0..207294597 100644 --- a/compiler/docgen.nim +++ b/compiler/docgen.nim @@ -100,7 +100,7 @@ proc presentationPath*(conf: ConfigRef, file: AbsoluteFile, isTitle = false): Re if isTitle: result = result.string.nativeToUnix.RelativeFile else: - result = result.string.replace("..", "@@").RelativeFile ## refs #13223 + result = result.string.replace("..", dotdotMangle).RelativeFile doAssert not result.isEmpty doAssert not isAbsolute(result.string) @@ -926,7 +926,7 @@ proc traceDeps(d: PDoc, it: PNode) = if d.section[k] != nil: d.section[k].add(", ") dispA(d.conf, d.section[k], "<a class=\"reference external\" href=\"$2\">$1</a>", - "$1", [rope esc(d.target, changeFileExt(external, "")), + "$1", [rope esc(d.target, external.prettyLink), rope changeFileExt(external, "html")]) proc exportSym(d: PDoc; s: PSym) = @@ -936,7 +936,7 @@ proc exportSym(d: PDoc; s: PSym) = if d.section[k] != nil: d.section[k].add(", ") dispA(d.conf, d.section[k], "<a class=\"reference external\" href=\"$2\">$1</a>", - "$1", [rope esc(d.target, changeFileExt(external, "")), + "$1", [rope esc(d.target, external.prettyLink), rope changeFileExt(external, "html")]) elif s.kind != skModule and s.owner != nil: let module = originatingModule(s) diff --git a/lib/packages/docutils/rstgen.nim b/lib/packages/docutils/rstgen.nim index 816d724ef..2929b2f9a 100644 --- a/lib/packages/docutils/rstgen.nim +++ b/lib/packages/docutils/rstgen.nim @@ -78,6 +78,11 @@ type testCmd: string status: int +const dotdotMangle* = "@@" ## refs #13223 + +proc prettyLink*(file: string): string = + changeFileExt(file, "").replace(dotdotMangle, "..") + proc init(p: var CodeBlockParams) = ## Default initialisation of CodeBlockParams to sane values. p.startLine = 1 @@ -574,7 +579,7 @@ proc generateModuleJumps(modules: seq[string]): string = var chunks: seq[string] = @[] for name in modules: - chunks.add("<a href=\"" & name & ".html\">" & name & "</a>") + chunks.add("<a href=\"$1.html\">$2</a>" % [name, name.prettyLink]) result.add(chunks.join(", ") & ".<br/>") |