-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow reserved pages in toctree #2849
Changes from all commits
b29f897
ca807bc
12887e6
42cc9af
00d3e45
317766f
00e25d7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -150,7 +150,8 @@ tables of contents. The ``toctree`` directive is the central element. | |||||
|
||||||
The special entry name ``self`` stands for the document containing the | ||||||
toctree directive. This is useful if you want to generate a "sitemap" from | ||||||
the toctree. | ||||||
the toctree. The special document names ``genindex``, ``modindex``, and | ||||||
``search`` can also be used. | ||||||
|
||||||
You can use the ``reversed`` flag option to reverse the order of the entries | ||||||
in the list. This can be useful when using the ``glob`` flag option to | ||||||
|
@@ -220,6 +221,9 @@ tables of contents. The ``toctree`` directive is the central element. | |||||
.. versionchanged:: 1.3 | ||||||
Added "caption" and "name" option. | ||||||
|
||||||
.. versionchanged:: 4.5 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
If you re-target the PR to |
||||||
Added support for "genindex", "modindex", and "search" references. | ||||||
|
||||||
Special names | ||||||
^^^^^^^^^^^^^ | ||||||
|
||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -124,7 +124,7 @@ def parse_content(self, toctree: addnodes.toctree) -> List[Node]: | |
break | ||
# absolutize filenames | ||
docname = docname_join(self.env.docname, docname) | ||
if url_re.match(ref) or ref == 'self': | ||
if url_re.match(ref) or ref in ('self', 'genindex', 'modindex', 'search'): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd prefer if this 4-tuple was factored out somewhere as it is used more than once, but there aren't any great locations that come to mind. |
||
toctree['entries'].append((title, ref)) | ||
elif docname not in self.env.found_docs: | ||
if excluded(self.env.doc2path(docname, None)): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,9 @@ Contents: | |
bar | ||
http://sphinx-doc.org/ | ||
self | ||
genindex | ||
Modules <modindex> | ||
search | ||
|
||
.. only:: html | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps expand this, as the special names can also be used indirectly, as you illustrate in the test.