fixes #4485; package handling works better; docgen works with --project on Nimble package level

This commit is contained in:
Andreas Rumpf 2016-07-19 14:13:16 +02:00
commit 9eb909baf9
6 changed files with 104 additions and 66 deletions

View file

@ -19,25 +19,25 @@ type
module: PSym
PGen = ref TGen
proc close(p: PPassContext, n: PNode): PNode =
template closeImpl(body: untyped) {.dirty.} =
var g = PGen(p)
let useWarning = sfMainModule notin g.module.flags
if gWholeProject or sfMainModule in g.module.flags:
writeOutput(g.doc, g.module.filename, HtmlExt, useWarning)
echo g.module.name.s, " ", g.module.owner.id, " ", gMainPackageId
if (g.module.owner.id == gMainPackageId and gWholeProject) or
sfMainModule in g.module.flags:
body
try:
generateIndex(g.doc)
except IOError:
discard
proc close(p: PPassContext, n: PNode): PNode =
closeImpl:
writeOutput(g.doc, g.module.filename, HtmlExt, useWarning)
proc closeJson(p: PPassContext, n: PNode): PNode =
var g = PGen(p)
let useWarning = sfMainModule notin g.module.flags
if gWholeProject or sfMainModule in g.module.flags:
closeImpl:
writeOutputJson(g.doc, g.module.filename, ".json", useWarning)
try:
generateIndex(g.doc)
except IOError:
discard
proc processNode(c: PPassContext, n: PNode): PNode =
result = n