aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan.limberg@icloud.com>2018-01-04 14:24:30 -0500
committerWaylan Limberg <waylan.limberg@icloud.com>2018-01-04 14:47:58 -0500
commitbbada79726d900ef9ae5410ab3a0ce573a742c00 (patch)
tree4d8f9ae5ee7fb8dbc7ae4d4fa96c4b102604c006
parenta7d211b53afbdb3c3febf881127dfbea4da422ee (diff)
downloadmarkdown-bbada79726d900ef9ae5410ab3a0ce573a742c00.tar.gz
markdown-bbada79726d900ef9ae5410ab3a0ce573a742c00.tar.bz2
markdown-bbada79726d900ef9ae5410ab3a0ce573a742c00.zip
Avoid DeprecationWarnings for etree
Fixes #618.
-rw-r--r--markdown/extensions/footnotes.py4
-rw-r--r--markdown/treeprocessors.py6
2 files changed, 5 insertions, 5 deletions
diff --git a/markdown/extensions/footnotes.py b/markdown/extensions/footnotes.py
index 620cf0b..cdaf391 100644
--- a/markdown/extensions/footnotes.py
+++ b/markdown/extensions/footnotes.py
@@ -202,7 +202,7 @@ class FootnoteExtension(Extension):
)
backlink.text = FN_BACKLINK_TEXT
- if li.getchildren():
+ if len(li):
node = li[-1]
if node.tag == "p":
node.text = node.text + NBSP_PLACEHOLDER
@@ -393,7 +393,7 @@ class FootnoteTreeprocessor(Treeprocessor):
result = self.footnotes.findFootnotesPlaceholder(root)
if result:
child, parent, isText = result
- ind = parent.getchildren().index(child)
+ ind = list(parent).index(child)
if isText:
parent.remove(child)
parent.insert(ind, footnotesDiv)
diff --git a/markdown/treeprocessors.py b/markdown/treeprocessors.py
index f159a8a..8feea8d 100644
--- a/markdown/treeprocessors.py
+++ b/markdown/treeprocessors.py
@@ -272,8 +272,8 @@ class InlineProcessor(Treeprocessor):
def __build_ancestors(self, parent, parents):
"""Build the ancestor list."""
ancestors = []
- while parent:
- if parent:
+ while parent is not None:
+ if parent is not None:
ancestors.append(parent.tag.lower())
parent = self.parent_map.get(parent)
ancestors.reverse()
@@ -303,7 +303,7 @@ class InlineProcessor(Treeprocessor):
# to ensure we don't have the user accidentally change it on us.
tree_parents = [] if ancestors is None else ancestors[:]
- self.parent_map = dict((c, p) for p in tree.getiterator() for c in p)
+ self.parent_map = dict((c, p) for p in tree.iter() for c in p)
stack = [(tree, tree_parents)]
while stack: