diff options
author | PMunch <peterme@peterme.net> | 2018-03-08 15:11:45 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-03-08 15:11:45 +0100 |
commit | 5003942256ad1e108f7ea1a93b89b54b5ec087ba (patch) | |
tree | 037d0580bf467dbbc8656f47b02556f3b396583c /doc/docgen.rst | |
parent | cbd059aa85c81fefb40159773182fafaf2de9617 (diff) | |
download | Nim-5003942256ad1e108f7ea1a93b89b54b5ec087ba.tar.gz |
Renamed jsondoc2 to jsondoc, similar to doc2 (#7279)
* Update information about jsondoc/jsondoc2 Manual was missing information about jsondoc2 which made it seem like it didn't exist at all. This commit adds mention of the jsondoc2 command along with an example. * Renamed jsondoc2 similar to doc2 and updated docs doc2 was recently renamed to doc while doc was renamed to doc0. This commits renames jsondoc to jsondoc2 and jsondoc2 to jsondoc0 to behave tha same way. The documentation for doc/jsondoc was also lagging behind this change which has also been fixed. I interpreted this as a soft deprecation of doc and jsondoc and therefore removed them from the auto-complete lists.
Diffstat (limited to 'doc/docgen.rst')
-rw-r--r-- | doc/docgen.rst | 65 |
1 files changed, 44 insertions, 21 deletions
diff --git a/doc/docgen.rst b/doc/docgen.rst index 40c464ebd..e6693e153 100644 --- a/doc/docgen.rst +++ b/doc/docgen.rst @@ -84,52 +84,73 @@ Document Types HTML ---- -Generation of HTML documents is done via both the ``doc`` and ``doc2`` -commands. These command take either a single .nim file, outputting a single -.html file with the same base filename, or multiple .nim files, outputting -multiple .html files and, optionally, an index file. +Generation of HTML documents is done via the ``doc`` command. This command +takes either a single .nim file, outputting a single .html file with the same +base filename, or multiple .nim files, outputting multiple .html files and, +optionally, an index file. The ``doc`` command:: nim doc sample Partial Output:: ... - proc helloWorld*(times: int) + proc helloWorld(times: int) {.raises: [], tags: [].} ... -Output can be viewed in full here: `docgen_sample.html <docgen_sample.html>`_. -The next command, called ``doc2``, is very similar to the ``doc`` command, but -will be run after the compiler performs semantic checking on the input nim -module(s), which allows it to process macros. +The full output can be seen here: `docgen_sample2.html <docgen_sample2.html>`_. + +The older version of the ``doc`` command, now renamed ``doc0`` runs before +semantic checking which means it lacks some of the things ``doc`` will output. -The ``doc2`` command:: - nim doc2 sample +The ``doc0`` command:: + nim doc0 sample Partial Output:: ... - proc helloWorld(times: int) {.raises: [], tags: [].} + proc helloWorld*(times: int) ... -The full output can be seen here: `docgen_sample2.html <docgen_sample2.html>`_. -As you can see, the tool has extracted additional information provided to it by -the compiler beyond what the ``doc`` command provides, such as pragmas attached -implicitly by the compiler. This type of information is not available from -looking at the AST (Abstract Syntax Tree) prior to semantic checking, as the -``doc`` command does. +Output can be viewed in full here: `docgen_sample.html <docgen_sample.html>`_. +As you can see, the tool has extracted less information than what the ``doc`` +command provides, such as pragmas attached implicitly by the compiler. This type +of information is not available from looking at the AST (Abstract Syntax Tree) +prior to semantic checking, which is why ``doc0`` doesn't show it. JSON ---- Generation of JSON documents is done via the ``jsondoc`` command. This command -takes in a .nim file, and outputs a .json file with the same base filename. -Note that this tool is built off of the ``doc`` command, and therefore is -performed before semantic checking. +takes in a .nim file, and outputs a .json file with the same base filename. Note +that this tool is built off of the ``doc`` command (previously ``doc2``), and +contains the same information. The ``jsondoc`` command:: nim jsondoc sample Output:: + { + "orig": "docgen_sample.nim", + "nimble": "", + "entries": [ + { + "name": "helloWorld", + "type": "skProc", + "line": 5, + "col": 0, + "description": "Takes an integer and outputs as many "hello world!"s", + "code": "proc helloWorld(times: int) {.raises: [], tags: [].}" + } + ] + } + +Similarly to the old ``doc`` command the old ``jsondoc`` command has been +renamed ``jsondoc0``. + +The ``jsondoc0`` command:: + nim jsondoc0 sample + +Output:: [ { "comment": "This module is a sample." @@ -142,6 +163,8 @@ Output:: } ] +Note that the ``jsondoc`` command outputs it's JSON without pretty-printing it, +while ``jsondoc0`` outputs pretty-printed JSON. Related Options =============== |