Use the correct HTML file reference in "nim doc" generated idx files (#11326)

* Use the correct HTML file reference in "nim doc" generated idx files

Now "nim doc --out:foo.html --index:on bar.nim" generates "foo.html"
and the generated "bar.idx" contains references to "foo.html".

Fixes https://github.com/nim-lang/Nim/issues/11325.

* Refactor the nim doc tester to extend it for more tests

* Reference the HTML files relative to the outDir, not project dir

* Add test for issues #11312 and #11325

- https://github.com/nim-lang/Nim/issues/11312
- https://github.com/nim-lang/Nim/issues/11325
This commit is contained in:
Kaushal Modi 2019-05-25 14:20:25 -04:00 • committed by Andreas Rumpf
commit 2f610d621f
6 changed files with 1716 additions and 11 deletions

View file

@ -670,7 +670,7 @@ proc genItem(d: PDoc, n, nameNode: PNode, k: TSymKind) =
[nameRope, result, comm, itemIDRope, plainNameRope, plainSymbolRope,
symbolOrIdRope, plainSymbolEncRope, symbolOrIdEncRope, seeSrcRope]))
let external = AbsoluteFile(d.filename).relativeTo(d.conf.projectPath, '/').changeFileExt(HtmlExt).string
let external = AbsoluteFile(d.destFile).relativeTo(d.conf.outDir, '/').changeFileExt(HtmlExt).string
var attype: Rope
if k in routineKinds and nameNode.kind == nkSym: