Skip to content

Commit

Permalink
fixes #19607 (#21576)
Browse files Browse the repository at this point in the history
  • Loading branch information
Araq authored Jun 16, 2023
1 parent 3ac2d81 commit 0750210
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions compiler/docgen.nim
Original file line number Diff line number Diff line change
Expand Up @@ -418,10 +418,13 @@ proc getVarIdx(varnames: openArray[string], id: string): int =
proc genComment(d: PDoc, n: PNode): PRstNode =
if n.comment.len > 0:
d.sharedState.currFileIdx = addRstFileIndex(d, n.info)
result = parseRst(n.comment,
toLinenumber(n.info),
toColumn(n.info) + DocColOffset,
d.conf, d.sharedState)
try:
result = parseRst(n.comment,
toLinenumber(n.info),
toColumn(n.info) + DocColOffset,
d.conf, d.sharedState)
except ERecoverableError:
result = nil

proc genRecCommentAux(d: PDoc, n: PNode): PRstNode =
if n == nil: return nil
Expand Down Expand Up @@ -1811,13 +1814,16 @@ proc commandRstAux(cache: IdentCache, conf: ConfigRef;
var filen = addFileExt(filename, "txt")
var d = newDocumentor(filen, cache, conf, outExt, standaloneDoc = true,
preferMarkdown = preferMarkdown, hasToc = false)
let rst = parseRst(readFile(filen.string),
line=LineRstInit, column=ColRstInit,
conf, d.sharedState)
d.modDescPre = @[ItemFragment(isRst: true, rst: rst)]
finishGenerateDoc(d)
writeOutput(d)
generateIndex(d)
try:
let rst = parseRst(readFile(filen.string),
line=LineRstInit, column=ColRstInit,
conf, d.sharedState)
d.modDescPre = @[ItemFragment(isRst: true, rst: rst)]
finishGenerateDoc(d)
writeOutput(d)
generateIndex(d)
except ERecoverableError:
discard "already reported the error"

proc commandRst2Html*(cache: IdentCache, conf: ConfigRef,
preferMarkdown=false) =
Expand Down

0 comments on commit 0750210

Please sign in to comment.