diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2022-01-01 19:06:24 +0300 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2022-01-02 18:35:29 +0300 |
commit | 05a898ecb4ff8e654a053a1ba5131715a4514812 (patch) | |
tree | 1b9d286602ff2a43c903f861a525c570cb702a6e /sphinx/writers/texinfo.py | |
parent | daf57f2488dacc6f3c45edf551fafcc32c404fc9 (diff) |
Migrate to Node.findall() from Node.traverse()
Node.traverse() was marked as deprecated since docutils-0.18. Instead
of it, Node.findall() has been added as successor of traverse().
This applies a patch to docutils-0.17 or older to be available
Node.findall() and use it.
Diffstat (limited to 'sphinx/writers/texinfo.py')
-rw-r--r-- | sphinx/writers/texinfo.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sphinx/writers/texinfo.py b/sphinx/writers/texinfo.py index 7551136ff..351aef2f7 100644 --- a/sphinx/writers/texinfo.py +++ b/sphinx/writers/texinfo.py @@ -286,7 +286,7 @@ class TexinfoTranslator(SphinxTranslator): self.indices = [(add_node_name(name), content) for name, content in self.indices] # each section is also a node - for section in self.document.traverse(nodes.section): + for section in self.document.findall(nodes.section): title = cast(nodes.TextElement, section.next_node(nodes.Titular)) name = title.astext() if title else '<untitled>' section['node_name'] = add_node_name(name) @@ -295,7 +295,7 @@ class TexinfoTranslator(SphinxTranslator): """Collect the menu entries for each "node" section.""" node_menus = self.node_menus targets: List[Element] = [self.document] - targets.extend(self.document.traverse(nodes.section)) + targets.extend(self.document.findall(nodes.section)) for node in targets: assert 'node_name' in node and node['node_name'] entries = [s['node_name'] for s in find_subsections(node)] |