diff options
author | Waylan Limberg <waylan@gmail.com> | 2014-01-08 22:37:22 -0500 |
---|---|---|
committer | Waylan Limberg <waylan@gmail.com> | 2014-01-08 22:37:22 -0500 |
commit | 88f75ee760bb92e51fc64c3805a73b8be896e641 (patch) | |
tree | a66a466a31e6153cab0871d7047dbbf675e7ea4e /markdown/treeprocessors.py | |
parent | 809195fb900c8e8bd3ff65a2e69de78075224096 (diff) | |
download | markdown-88f75ee760bb92e51fc64c3805a73b8be896e641.tar.gz markdown-88f75ee760bb92e51fc64c3805a73b8be896e641.tar.bz2 markdown-88f75ee760bb92e51fc64c3805a73b8be896e641.zip |
Address various depreciated APIs in Python
This mostly revolves around old APIs for ElementTree, but includes a few
others as well. Fixes #254. Thanks for the report.
Diffstat (limited to 'markdown/treeprocessors.py')
-rw-r--r-- | markdown/treeprocessors.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/markdown/treeprocessors.py b/markdown/treeprocessors.py index e6d3dc9..ef0a2aa 100644 --- a/markdown/treeprocessors.py +++ b/markdown/treeprocessors.py @@ -131,7 +131,7 @@ class InlineProcessor(Treeprocessor): childResult = self.__processPlaceholders(text, subnode) if not isText and node is not subnode: - pos = node.getchildren().index(subnode) + pos = list(node).index(subnode) node.remove(subnode) else: pos = 0 @@ -179,7 +179,7 @@ class InlineProcessor(Treeprocessor): linkText(text) if not isString(node): # it's Element - for child in [node] + node.getchildren(): + for child in [node] + list(node): if child.tail: if child.tail.strip(): self.__processElementText(node, child,False) @@ -237,7 +237,7 @@ class InlineProcessor(Treeprocessor): if not isString(node): if not isinstance(node.text, util.AtomicString): # We need to process current node too - for child in [node] + node.getchildren(): + for child in [node] + list(node): if not isString(node): if child.text: child.text = self.__handleInline(child.text, @@ -276,7 +276,7 @@ class InlineProcessor(Treeprocessor): while stack: currElement = stack.pop() insertQueue = [] - for child in currElement.getchildren(): + for child in currElement: if child.text and not isinstance(child.text, util.AtomicString): text = child.text child.text = None @@ -292,11 +292,11 @@ class InlineProcessor(Treeprocessor): child.tail = dumby.text else: child.tail = None - pos = currElement.getchildren().index(child) + 1 + pos = list(currElement).index(child) + 1 tailResult.reverse() for newChild in tailResult: currElement.insert(pos, newChild) - if child.getchildren(): + if len(child): stack.append(child) for element, lst in insertQueue: |