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(