summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2020-05-25 18:16:00 -0700
committerGitHub <noreply@github.com>2020-05-25 18:16:00 -0700
commit55758920f446ebf1eecab980460bf6e664b8dba7 (patch)
tree85f9b5d1c0879ac881dc2567c4017fb2c333374d /lib
parentacadda8da281fbe796386ba05ffab957883f0fef (diff)
downloadNim-55758920f446ebf1eecab980460bf6e664b8dba7.tar.gz
docgen: fix #14448 show @@ as .. in href text (#14451)
Diffstat (limited to 'lib')
-rw-r--r--lib/packages/docutils/rstgen.nim7
1 files changed, 6 insertions, 1 deletions
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/>")