Skip to content

Commit

Permalink
docgen: move to shared RST state (fix #16990) (#18256)
Browse files Browse the repository at this point in the history
* docgen: move to shared RST state (fix #16990)

* Update lib/packages/docutils/rst.nim

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>

* Update lib/packages/docutils/rst.nim

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>

* Update lib/packages/docutils/rst.nim

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>

* Update compiler/docgen.nim

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>

* Update compiler/docgen.nim

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>

* Update compiler/docgen.nim

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>

* Update lib/packages/docutils/rst.nim

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>

* rename `cmdDoc2` to `cmdDoc`

* fix (P)RstSharedState convention

* new style of initialization

* misc suggestions

* 1 more rename

* fix a regression

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
  • Loading branch information
3 people authored Jun 20, 2021
1 parent 128d21b commit 590d457
Show file tree
Hide file tree
Showing 8 changed files with 293 additions and 193 deletions.
2 changes: 1 addition & 1 deletion compiler/commands.nim
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ proc parseCommand*(command: string): Command =
of "check": cmdCheck
of "e": cmdNimscript
of "doc0": cmdDoc0
of "doc2", "doc": cmdDoc2
of "doc2", "doc": cmdDoc
of "doc2tex": cmdDoc2tex
of "rst2html": cmdRst2html
of "rst2tex": cmdRst2tex
Expand Down
243 changes: 160 additions & 83 deletions compiler/docgen.nim

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions compiler/docgen2.nim
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ template closeImpl(body: untyped) {.dirty.} =
let useWarning = sfMainModule notin g.module.flags
let groupedToc = true
if shouldProcess(g):
finishGenerateDoc(g.doc)
body
try:
generateIndex(g.doc)
Expand Down
2 changes: 1 addition & 1 deletion compiler/main.nim
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ proc mainCommand*(graph: ModuleGraph) =
else:
rawMessage(conf, errGenerated, "'run' command not available; rebuild with -d:tinyc")
of cmdDoc0: docLikeCmd commandDoc(cache, conf)
of cmdDoc2:
of cmdDoc:
docLikeCmd():
conf.setNoteDefaults(warnLockLevel, false) # issue #13218
conf.setNoteDefaults(warnRedefinitionOfLabel, false) # issue #13218
Expand Down
6 changes: 3 additions & 3 deletions compiler/options.nim
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ type
cmdIdeTools # ide tools (e.g. nimsuggest)
cmdNimscript # evaluate nimscript
cmdDoc0
cmdDoc2
cmdDoc2tex
cmdDoc # convert .nim doc comments to HTML
cmdDoc2tex # convert .nim doc comments to LaTeX
cmdRst2html # convert a reStructuredText file to HTML
cmdRst2tex # convert a reStructuredText file to TeX
cmdJsondoc0
Expand All @@ -161,7 +161,7 @@ type

const
cmdBackends* = {cmdCompileToC, cmdCompileToCpp, cmdCompileToOC, cmdCompileToJS, cmdCrun}
cmdDocLike* = {cmdDoc0, cmdDoc2, cmdDoc2tex, cmdJsondoc0, cmdJsondoc,
cmdDocLike* = {cmdDoc0, cmdDoc, cmdDoc2tex, cmdJsondoc0, cmdJsondoc,
cmdCtags, cmdBuildindex}

type
Expand Down
Loading

0 comments on commit 590d457

Please sign in to comment.