Skip to content

Commit

Permalink
fix docutils deprecation warning
Browse files Browse the repository at this point in the history
Node.traverse() is obsoleted by Node.findall() in docutils 0.18
larsoner authored Jun 3, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 4f9e220 commit 4fbda63
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/sphinxcontrib/bibtex/transforms.py
Original file line number Diff line number Diff line change
@@ -56,7 +56,9 @@ def run(self, **kwargs):
"""
env = cast("BuildEnvironment", self.document.settings.env)
domain = cast("BibtexDomain", env.get_domain('cite'))
for bibnode in self.document.traverse(bibliography_node):
# Can just use "findall" once docutils 0.18+ is required
meth = 'findall' if hasattr(self.document, 'findall') else 'traverse'
for bibnode in getattr(self.document, meth)(bibliography_node):
# reminder: env.docname may be equal to 'index' instead of
# bibnode['docname'] in post-transform phase (e.g. latex builder)
bib_key = BibliographyKey(

0 comments on commit 4fbda63

Please sign in to comment.