mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge remote-tracking branch 'JonhVillalovos/master'
This commit is contained in:
commit
8481ed3560
@ -123,6 +123,16 @@ tables of contents. The ``toctree`` directive is the central element.
|
||||
toctree directive. This is useful if you want to generate a "sitemap" from
|
||||
the toctree.
|
||||
|
||||
You can use the ``reverse`` flag option to reverse the order of the entries
|
||||
in the list. This can be useful when using the ``glob`` flag option to
|
||||
reverse the ordering of the files. Example::
|
||||
|
||||
.. toctree::
|
||||
:glob:
|
||||
:reverse:
|
||||
|
||||
recipe/*
|
||||
|
||||
You can also give a "hidden" option to the directive, like this::
|
||||
|
||||
.. toctree::
|
||||
|
@ -46,6 +46,7 @@ class TocTree(Directive):
|
||||
'includehidden': directives.flag,
|
||||
'numbered': int_or_nothing,
|
||||
'titlesonly': directives.flag,
|
||||
'reverse': directives.flag,
|
||||
}
|
||||
|
||||
def run(self):
|
||||
@ -109,6 +110,8 @@ class TocTree(Directive):
|
||||
subnode = addnodes.toctree()
|
||||
subnode['parent'] = env.docname
|
||||
# entries contains all entries (self references, external links etc.)
|
||||
if 'reverse' in self.options:
|
||||
entries.reverse()
|
||||
subnode['entries'] = entries
|
||||
# includefiles only entries that are documents
|
||||
subnode['includefiles'] = includefiles
|
||||
|
Loading…
Reference in New Issue
Block a user