LaTeX: Restructure the index nodes inside title nodes only on LaTeX builds

refs: #8865
This commit is contained in:
Takeshi KOMIYA 2021-02-11 00:36:08 +09:00
parent 674831cf10
commit 9411051131
2 changed files with 5 additions and 2 deletions

View File

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

View File

@ -574,7 +574,7 @@ class DocumentTargetTransform(SphinxPostTransform):
section['ids'].append(':doc') # special label for :doc: 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. """Move index nodes in section title to outside of the title.
LaTeX index macro is not compatible with some handling of section titles LaTeX index macro is not compatible with some handling of section titles
@ -601,8 +601,9 @@ class IndexInSectionTitleTransform(SphinxTransform):
... ...
""" """
default_priority = 400 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): for node in self.document.traverse(nodes.title):
if isinstance(node.parent, nodes.section): if isinstance(node.parent, nodes.section):
for i, index in enumerate(node.traverse(addnodes.index)): for i, index in enumerate(node.traverse(addnodes.index)):