4.49. kink/doc/render/sphinx/SPHINX_RENDER_TOOL

Launcheable mod to render a kink doc to a set of reStructuredText files for Sphinx document generator.

Usage: kink [Kink_options]... mod:kink/doc/render/sphinx/SPHINX_RENDER_TOOL [Mod_options] Dir <Json

The comman reads the kink doc JSON from the standard input, converts it to a set of reStructuredText files for Sphinx, and writes them to the directory specified as `Dir`.

Mod_options

• --anchor-prefix {Prefix} : Uses `Prefix` as the prefix of anchors in generated reST files. By default `kinkdoc-` is used.

• --help : Prints out the help and exits.

Generated files

The command outputs following files in the destination directory.

• index.rst : The content of the top level section of the document, and a `toctree` directive including pages.

• reST files for each module : The contents below each second level section, which usually corresponds to a module.

Example:

• index.rst

• kink-STR.rst : for kink/STR mod

• kink-NUM.rst : for kink/NUM mod

• kink-container-FLAT_SET.rst : for kink/container/FLAT_SET mod

• ...

Anchors

For the heading of each third and lesser level section, an anchor is added for cross reference. For example:

.. _kinkdoc-0123456789abcdef0123456789abcdef0123456788abcdef0123456789abcdef:

type finger\_tree
=================

A finger tree is an immutable data structure for O\(log N\)
concatenation and splitting\.

.. _kinkdoc-fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210:

Ft\.size
--------

\`size\` returns the size of the finger tree\.

reST files in the Sphinx document other than the generated files can refer to a section using :ref: role like:

You can call :ref:`Ft.size <kinkdoc-fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210>`
to get the size of the finger tree.

Note that generated anchors cannot be used in kink doc comments, because kink doc itself does not have cross reference feature.

Anchors are generated from the title of the section and the titles of the parent sections. If you change a section title, anchors within the section will change.

Usage example

$ kink mod:kink/doc/DOC_PARSE_TOOL --title 'API reference' src >doc.json
...
$ kink mod:kink/doc/render/sphinx/SPHINX_RENDER_TOOL src/sphinx/api  <doc.json

Note that src/sphinx/api directory must exist before the command is executed.

4.49.1. SPHINX_RENDER_TOOL.main(Argv)

Launcher of the mod.