Merge pull request #8866 from tk0miya/8865_IndexInSectionTitleTransform

LaTeX: Restructure the index nodes inside title nodes only on LaTeX builds
This commit is contained in:
Takeshi KOMIYA 2021-02-13 00:46:52 +09:00 committed by GitHub
commit 13d475aa73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -146,6 +146,8 @@ Bugs fixed
the :ref:`'sphinxsetup' <latexsphinxsetup>` key of ``latex_elements``)
* #8183: LaTeX: Remove substitution_reference nodes from doctree only on LaTeX
builds
* #8865: LaTeX: Restructure the index nodes inside title nodes only on LaTeX
builds
Testing
--------

View File

@ -572,7 +572,7 @@ class DocumentTargetTransform(SphinxPostTransform):
section['ids'].append(':doc') # special label for :doc:
class IndexInSectionTitleTransform(SphinxTransform):
class IndexInSectionTitleTransform(SphinxPostTransform):
"""Move index nodes in section title to outside of the title.
LaTeX index macro is not compatible with some handling of section titles
@ -599,8 +599,9 @@ class IndexInSectionTitleTransform(SphinxTransform):
...
"""
default_priority = 400
builders = ('latex',)
def apply(self, **kwargs: Any) -> None:
def run(self, **kwargs: Any) -> None:
for node in self.document.traverse(nodes.title):
if isinstance(node.parent, nodes.section):
for i, index in enumerate(node.traverse(addnodes.index)):