From 4fbda6347a76ad4cc0ea8b62e7bf325e545da291 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Fri, 3 Jun 2022 11:32:54 -0400 Subject: [PATCH] fix docutils deprecation warning Node.traverse() is obsoleted by Node.findall() in docutils 0.18 --- src/sphinxcontrib/bibtex/transforms.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/sphinxcontrib/bibtex/transforms.py b/src/sphinxcontrib/bibtex/transforms.py index bb3ec995..832551ed 100644 --- a/src/sphinxcontrib/bibtex/transforms.py +++ b/src/sphinxcontrib/bibtex/transforms.py @@ -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(