mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Merge pull request #2949 from avaris/docutils-update
Use docutils.Node.findall instead of traverse
This commit is contained in:
commit
57c5296a44
1 changed files with 8 additions and 1 deletions
|
|
@ -222,7 +222,14 @@ class RstReader(BaseReader):
|
||||||
'Ensure exactly one top level section',
|
'Ensure exactly one top level section',
|
||||||
source_path)
|
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:
|
for element in docinfo.children:
|
||||||
if element.tagname == 'field': # custom fields (e.g. summary)
|
if element.tagname == 'field': # custom fields (e.g. summary)
|
||||||
name_elem, body_elem = element.children
|
name_elem, body_elem = element.children
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue