module sphinxext.sphinx_tocdelay_extension
¶
Short summary¶
module pyquickhelper.sphinxext.sphinx_tocdelay_extension
Defines a sphinx extension which proposes a new version of .. toctree::
which takes into account titles dynamically added.
Classes¶
class |
truncated documentation |
---|---|
defines |
|
Defines a sphinx extension which proposes a new version of `` |
Functions¶
function |
truncated documentation |
---|---|
does nothing |
|
Collect all tocdelay in the environment. Look for the section or document which contain them. Put them into the … |
|
setup for |
|
The function is called by event |
|
does nothing |
Properties¶
property |
truncated documentation |
---|---|
|
Return the document root node of the tree containing this Node. |
Methods¶
method |
truncated documentation |
---|---|
Just add a |
Documentation¶
Defines a sphinx extension which proposes a new version of .. toctree::
which takes into account titles dynamically added.
- class pyquickhelper.sphinxext.sphinx_tocdelay_extension.TocDelayDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]¶
Bases:
Directive
Defines a sphinx extension which proposes a new version of
.. toctree::
which takes into account titles dynamically added. It only considers one level.Example:
.. tocdelay:: document
Directive
.. toctree::
only considers titles defined by the user, not titles dynamically created by another directives.Warning
It is not recommended to dynamically insert such a directive. It is not recursive.
Parameter rule implements specific behaviors. It contains the name of the node which holds the document name, the title, the id. In case of the blog, the rule is:
blogpost_node,toctitle,tocid,tocdoc
. That means the TocDelayDirective will look for nodesblogpost_node
and fetch attributes toctitle, tocid, tocdoc to fill the toc contents. No depth is allowed at this point. The previous value is the default value. Option path is mostly used to test the directive.- node_class[source]¶
alias of
tocdelay_node
- option_spec = {'path': <function unchanged>, 'rule': <function unchanged>}[source]¶
Mapping of option names to validator functions.
- run()[source]¶
Just add a
tocdelay_node
and list the documents to add.- Returns:
of nodes or list of nodes, container
- pyquickhelper.sphinxext.sphinx_tocdelay_extension._print_loop_on_children(node, indent='', msg='-')[source]¶
- pyquickhelper.sphinxext.sphinx_tocdelay_extension.depart_tocdelay_node(self, node)[source]¶
does nothing
- pyquickhelper.sphinxext.sphinx_tocdelay_extension.process_tocdelay(app, doctree)[source]¶
Collect all tocdelay in the environment. Look for the section or document which contain them. Put them into the variable tocdelay_all_tocdelay in the config.
- class pyquickhelper.sphinxext.sphinx_tocdelay_extension.tocdelay_node(rawsource='', text='', *children, **attributes)[source]¶
Bases:
paragraph
defines
tocdelay
node
- pyquickhelper.sphinxext.sphinx_tocdelay_extension.transform_tocdelay(app, doctree, fromdocname)[source]¶
The function is called by event
'doctree_resolved'
. It looks for every section in page stored in tocdelay_all_tocdelay in the configuration and builds a short table of contents. The instruction.. toctree::
is resolved before every directive in the page is executed, the instruction.. tocdelay::
is resolved after.- Parameters:
app – Sphinx application
doctree – doctree
fromdocname – docname
Thiis directive should be used if you need to capture a section which was dynamically added by another one. For example
RunPythonDirective
calls functionnested_parse_with_titles
... tocdelay::
will capture the new section this function might eventually add to the page.