Skip to content

Commit

Permalink
fixes #13986 [backport:1.2] (#14173)
Browse files Browse the repository at this point in the history
(cherry picked from commit cf3e000)
  • Loading branch information
Araq authored and narimiran committed May 6, 2020
1 parent ff90206 commit b997e32
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion compiler/docgen.nim
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,14 @@ proc presentationPath*(conf: ConfigRef, file: AbsoluteFile, isTitle = false): Re
result = relativeTo(file, conf.docRoot.AbsoluteDir)
else:
bail()
if isAbsolute(result.string):
result = file.string.splitPath()[1].RelativeFile
if isTitle:
result = result.string.nativeToUnix.RelativeFile
else:
result = result.string.replace("..", "@@").RelativeFile ## refs #13223
doAssert not result.isEmpty
doAssert not isAbsolute(result.string)

proc whichType(d: PDoc; n: PNode): PSym =
if n.kind == nkSym:
Expand Down Expand Up @@ -1140,7 +1143,10 @@ proc generateIndex*(d: PDoc) =
proc updateOutfile(d: PDoc, outfile: AbsoluteFile) =
if d.module == nil or sfMainModule in d.module.flags: # nil for eg for commandRst2Html
if d.conf.outDir.isEmpty: d.conf.outDir = d.conf.docOutDir
if d.conf.outFile.isEmpty: d.conf.outFile = outfile.relativeTo(d.conf.outDir)
if d.conf.outFile.isEmpty:
d.conf.outFile = outfile.relativeTo(d.conf.outDir)
if isAbsolute(d.conf.outFile.string):
d.conf.outFile = splitPath(d.conf.outFile.string)[1].RelativeFile

proc writeOutput*(d: PDoc, useWarning = false) =
runAllExamples(d)
Expand Down

0 comments on commit b997e32

Please sign in to comment.