mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merged in rolmei/sphinx-epub (pull request #106: Add includehidden option to the toctree directive)
This commit is contained in:
commit
69b74303b8
5
CHANGES
5
CHANGES
@ -7,6 +7,11 @@ Release 1.2 (in development)
|
|||||||
Previously, if these values were not set, no output would be genereted by
|
Previously, if these values were not set, no output would be genereted by
|
||||||
their respective builders.
|
their respective builders.
|
||||||
|
|
||||||
|
* The :rst:dir:`toctree` directive and the ``toctree()`` template function now
|
||||||
|
have an ``includehidden`` option that includes hidden toctree entries (bugs
|
||||||
|
#790 and #1047). A bug in the ``maxdepth`` option for the ``toctree()``
|
||||||
|
template function has been fixed (bug #1046).
|
||||||
|
|
||||||
* PR#99: Strip down seealso directives to normal admonitions. This removes
|
* PR#99: Strip down seealso directives to normal admonitions. This removes
|
||||||
their unusual CSS classes (admonition-see-also), inconsistent LaTeX
|
their unusual CSS classes (admonition-see-also), inconsistent LaTeX
|
||||||
admonition title ("See Also" instead of "See also"), and spurious indentation
|
admonition title ("See Also" instead of "See also"), and spurious indentation
|
||||||
|
@ -126,6 +126,18 @@ tables of contents. The ``toctree`` directive is the central element.
|
|||||||
intend to insert these links yourself, in a different style, or in the HTML
|
intend to insert these links yourself, in a different style, or in the HTML
|
||||||
sidebar.
|
sidebar.
|
||||||
|
|
||||||
|
In cases where you want to have only one top-level toctree and hide all other
|
||||||
|
lower level toctrees you can add the "includehidden" option to the top-level
|
||||||
|
toctree entry::
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:includehidden:
|
||||||
|
|
||||||
|
doc_1
|
||||||
|
doc_2
|
||||||
|
|
||||||
|
All other toctree entries can then be eliminated by the "hidden" option.
|
||||||
|
|
||||||
In the end, all documents in the :term:`source directory` (or subdirectories)
|
In the end, all documents in the :term:`source directory` (or subdirectories)
|
||||||
must occur in some ``toctree`` directive; Sphinx will emit a warning if it
|
must occur in some ``toctree`` directive; Sphinx will emit a warning if it
|
||||||
finds a file that is not included, because that means that this file will not
|
finds a file that is not included, because that means that this file will not
|
||||||
@ -150,6 +162,8 @@ tables of contents. The ``toctree`` directive is the central element.
|
|||||||
.. versionchanged:: 1.1
|
.. versionchanged:: 1.1
|
||||||
Added numeric argument to "numbered".
|
Added numeric argument to "numbered".
|
||||||
|
|
||||||
|
.. versionchanged:: 1.2
|
||||||
|
Added "includehidden" option.
|
||||||
|
|
||||||
Special names
|
Special names
|
||||||
-------------
|
-------------
|
||||||
|
@ -43,6 +43,7 @@ class TocTree(Directive):
|
|||||||
'maxdepth': int,
|
'maxdepth': int,
|
||||||
'glob': directives.flag,
|
'glob': directives.flag,
|
||||||
'hidden': directives.flag,
|
'hidden': directives.flag,
|
||||||
|
'includehidden': directives.flag,
|
||||||
'numbered': int_or_nothing,
|
'numbered': int_or_nothing,
|
||||||
'titlesonly': directives.flag,
|
'titlesonly': directives.flag,
|
||||||
}
|
}
|
||||||
@ -108,6 +109,7 @@ class TocTree(Directive):
|
|||||||
subnode['maxdepth'] = self.options.get('maxdepth', -1)
|
subnode['maxdepth'] = self.options.get('maxdepth', -1)
|
||||||
subnode['glob'] = glob
|
subnode['glob'] = glob
|
||||||
subnode['hidden'] = 'hidden' in self.options
|
subnode['hidden'] = 'hidden' in self.options
|
||||||
|
subnode['includehidden'] = 'includehidden' in self.options
|
||||||
subnode['numbered'] = self.options.get('numbered', 0)
|
subnode['numbered'] = self.options.get('numbered', 0)
|
||||||
subnode['titlesonly'] = 'titlesonly' in self.options
|
subnode['titlesonly'] = 'titlesonly' in self.options
|
||||||
set_source_info(self, subnode)
|
set_source_info(self, subnode)
|
||||||
|
@ -1514,6 +1514,8 @@ class BuildEnvironment:
|
|||||||
maxdepth = maxdepth or toctree.get('maxdepth', -1)
|
maxdepth = maxdepth or toctree.get('maxdepth', -1)
|
||||||
if not titles_only and toctree.get('titlesonly', False):
|
if not titles_only and toctree.get('titlesonly', False):
|
||||||
titles_only = True
|
titles_only = True
|
||||||
|
if not includehidden and toctree.get('includehidden', False):
|
||||||
|
includehidden = True
|
||||||
|
|
||||||
# NOTE: previously, this was separate=True, but that leads to artificial
|
# NOTE: previously, this was separate=True, but that leads to artificial
|
||||||
# separation when two or more toctree entries form a logical unit, so
|
# separation when two or more toctree entries form a logical unit, so
|
||||||
|
Loading…
Reference in New Issue
Block a user