-
-
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
Conversation
Synced upstream changes and updated code as it was originally from 5.5 years ago. Also updated tests. |
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.
Please could you rebase on 5.x
and re-target the PR to that branch?
A
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
.. versionchanged:: 4.5 | |
.. versionchanged:: 5.1 |
If you re-target the PR to 5.x
@@ -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 comment
The 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.
the toctree. The special document names ``genindex``, ``modindex``, and | ||
``search`` can also be used. |
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.
Closed by #10673 |
I was looking to add the general index to a toctree and it didn't seem like that was possible, so I created this patch to allow it.
Basically this allows the special document names (genindex, modindex, search) to be used as page names in a toctree either with their default titles or custom ones.
It seems I'm not the only one who was looking for this:
http://stackoverflow.com/questions/36235578/how-can-i-include-the-genindex-in-a-sphinx-toc
http://stackoverflow.com/questions/25243482/how-to-add-sphinx-generated-index-to-the-sidebar-when-using-read-the-docs-theme