parent
5ebd1248df
commit
557d79e7a2
3 changed files with 29 additions and 10 deletions
|
|
@ -1124,6 +1124,8 @@ proc genJsonItem(d: PDoc, n, nameNode: PNode, k: TSymKind): JsonItem =
|
|||
for kind in genericParam.sym.typ.sons:
|
||||
param["types"].add %($kind)
|
||||
result.json["signature"]["genericParams"].add param
|
||||
if optGenIndex in d.conf.globalOptions:
|
||||
genItem(d, n, nameNode, k, kForceExport)
|
||||
|
||||
proc setDoctype(d: PDoc, n: PNode) =
|
||||
## Processes `{.doctype.}` pragma changing Markdown/RST parsing options.
|
||||
|
|
@ -1782,3 +1784,17 @@ proc commandBuildIndex*(conf: ConfigRef, dir: string, outFile = RelativeFile"")
|
|||
writeFile(filename, code)
|
||||
except:
|
||||
rawMessage(conf, errCannotOpenFile, filename.string)
|
||||
|
||||
proc commandBuildIndexJson*(conf: ConfigRef, dir: string, outFile = RelativeFile"") =
|
||||
var (modules, symbols, docs) = readIndexDir(dir)
|
||||
let documents = toSeq(keys(Table[IndexEntry, seq[IndexEntry]](docs)))
|
||||
let body = %*({"documents": documents, "modules": modules, "symbols": symbols})
|
||||
|
||||
var outFile = outFile
|
||||
if outFile.isEmpty: outFile = theindexFname.RelativeFile.changeFileExt("")
|
||||
let filename = getOutFile(conf, outFile, JsonExt)
|
||||
|
||||
try:
|
||||
writeFile(filename, $body)
|
||||
except:
|
||||
rawMessage(conf, errCannotOpenFile, filename.string)
|
||||
|
|
|
|||
|
|
@ -325,7 +325,11 @@ proc mainCommand*(graph: ModuleGraph) =
|
|||
else:
|
||||
docLikeCmd commandDoc2(graph, TexExt)
|
||||
of cmdJsondoc0: docLikeCmd commandJson(cache, conf)
|
||||
of cmdJsondoc: docLikeCmd commandDoc2(graph, JsonExt)
|
||||
of cmdJsondoc:
|
||||
docLikeCmd():
|
||||
commandDoc2(graph, JsonExt)
|
||||
if optGenIndex in conf.globalOptions and optWholeProject in conf.globalOptions:
|
||||
commandBuildIndexJson(conf, $conf.outDir)
|
||||
of cmdCtags: docLikeCmd commandTags(cache, conf)
|
||||
of cmdBuildindex: docLikeCmd commandBuildIndex(conf, $conf.projectFull, conf.outFile)
|
||||
of cmdGendepend: commandGenDepend(graph)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue