mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Added `titlesonly option to toctree` directive.
This commit is contained in:
2
CHANGES
2
CHANGES
@@ -1,6 +1,8 @@
|
|||||||
Release 1.0 (in development)
|
Release 1.0 (in development)
|
||||||
============================
|
============================
|
||||||
|
|
||||||
|
* Added ``titlesonly`` option to ``toctree`` directive.
|
||||||
|
|
||||||
* Removed the deprecated ``sphinx.builder`` module.
|
* Removed the deprecated ``sphinx.builder`` module.
|
||||||
|
|
||||||
* #193: Added a ``visitedlinkcolor`` theme option to the default
|
* #193: Added a ``visitedlinkcolor`` theme option to the default
|
||||||
|
|||||||
@@ -89,6 +89,15 @@ tables of contents. The ``toctree`` directive is the central element.
|
|||||||
Numbering then starts at the heading of ``foo``. Sub-toctrees are
|
Numbering then starts at the heading of ``foo``. Sub-toctrees are
|
||||||
automatically numbered (don't give the ``numbered`` flag to those).
|
automatically numbered (don't give the ``numbered`` flag to those).
|
||||||
|
|
||||||
|
If you want only the titles of documents in the tree to show up, not other
|
||||||
|
headings of the same level, you can use the ``titlesonly`` option::
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:titlesonly:
|
||||||
|
|
||||||
|
foo
|
||||||
|
bar
|
||||||
|
|
||||||
You can use "globbing" in toctree directives, by giving the ``glob`` flag
|
You can use "globbing" in toctree directives, by giving the ``glob`` flag
|
||||||
option. All entries are then matched against the list of available
|
option. All entries are then matched against the list of available
|
||||||
documents, and matches are inserted into the list alphabetically. Example::
|
documents, and matches are inserted into the list alphabetically. Example::
|
||||||
@@ -139,6 +148,9 @@ tables of contents. The ``toctree`` directive is the central element.
|
|||||||
Added "numbered" and "hidden" options as well as external links and
|
Added "numbered" and "hidden" options as well as external links and
|
||||||
support for "self" references.
|
support for "self" references.
|
||||||
|
|
||||||
|
.. versionchanged:: 1.0
|
||||||
|
Added "titlesonly" option.
|
||||||
|
|
||||||
|
|
||||||
Special names
|
Special names
|
||||||
-------------
|
-------------
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ class TocTree(Directive):
|
|||||||
'glob': directives.flag,
|
'glob': directives.flag,
|
||||||
'hidden': directives.flag,
|
'hidden': directives.flag,
|
||||||
'numbered': directives.flag,
|
'numbered': directives.flag,
|
||||||
|
'titlesonly': directives.flag,
|
||||||
}
|
}
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
@@ -97,6 +98,7 @@ class TocTree(Directive):
|
|||||||
subnode['glob'] = glob
|
subnode['glob'] = glob
|
||||||
subnode['hidden'] = 'hidden' in self.options
|
subnode['hidden'] = 'hidden' in self.options
|
||||||
subnode['numbered'] = 'numbered' in self.options
|
subnode['numbered'] = 'numbered' in self.options
|
||||||
|
subnode['titlesonly'] = 'titlesonly' in self.options
|
||||||
ret.append(subnode)
|
ret.append(subnode)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|||||||
@@ -1132,6 +1132,8 @@ class BuildEnvironment:
|
|||||||
return entries
|
return entries
|
||||||
|
|
||||||
maxdepth = maxdepth or toctree.get('maxdepth', -1)
|
maxdepth = maxdepth or toctree.get('maxdepth', -1)
|
||||||
|
if not titles_only and toctree.get('titlesonly', False):
|
||||||
|
titles_only = 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
|
||||||
|
|||||||
Reference in New Issue
Block a user