forked from github/pelican
use docutils.Node.findall instead of traverse
docutils.Node.traverse is being deprecated as of docutils==0.18.1
This commit is contained in:
parent
1b87ef6a7b
commit
8eb4be521f
1 changed files with 8 additions and 1 deletions
|
|
@ -222,7 +222,14 @@ class RstReader(BaseReader):
|
|||
'Ensure exactly one top level section',
|
||||
source_path)
|
||||
|
||||
for docinfo in document.traverse(docutils.nodes.docinfo):
|
||||
try:
|
||||
# docutils 0.18.1+
|
||||
nodes = document.findall(docutils.nodes.docinfo)
|
||||
except AttributeError:
|
||||
# docutils 0.18.0 or before
|
||||
nodes = document.traverse(docutils.nodes.docinfo)
|
||||
|
||||
for docinfo in nodes:
|
||||
for element in docinfo.children:
|
||||
if element.tagname == 'field': # custom fields (e.g. summary)
|
||||
name_elem, body_elem = element.children
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue