summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfacelessuser <faceless.shop@gmail.com>2017-11-17 18:25:41 -0700
committerfacelessuser <faceless.shop@gmail.com>2017-11-17 18:25:41 -0700
commitd105848ae0631cd45c5e3d31c3e09224b8490858 (patch)
tree14cdb43d24f5cf3e4fcc808d725af63d5558063b
parent82f7feea7ae88a4f5e2d4e9d99006c4cdd3325a7 (diff)
downloadpython-markdown-d105848ae0631cd45c5e3d31c3e09224b8490858.tar.gz
Move ancestor push and pop under conditionals
-rw-r--r--markdown/treeprocessors.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/markdown/treeprocessors.py b/markdown/treeprocessors.py
index 31adbce..ab31dd6 100644
--- a/markdown/treeprocessors.py
+++ b/markdown/treeprocessors.py
@@ -251,12 +251,12 @@ class InlineProcessor(Treeprocessor):
# We need to process current node too
for child in [node] + list(node):
if not isString(node):
- self.ancestors.append(child.tag.lower())
if child.text:
+ self.ancestors.append(child.tag.lower())
child.text = self.__handleInline(
child.text, patternIndex + 1
)
- self.ancestors.pop()
+ self.ancestors.pop()
if child.tail:
child.tail = self.__handleInline(
child.tail, patternIndex
@@ -313,10 +313,10 @@ class InlineProcessor(Treeprocessor):
insertQueue = []
for child in currElement:
- self.ancestors.append(child.tag.lower())
if child.text and not isinstance(
child.text, util.AtomicString
):
+ self.ancestors.append(child.tag.lower())
text = child.text
child.text = None
lst = self.__processPlaceholders(
@@ -326,7 +326,7 @@ class InlineProcessor(Treeprocessor):
self.parent_map[l[0]] = child
stack += lst
insertQueue.append((child, lst))
- self.ancestors.pop()
+ self.ancestors.pop()
if child.tail:
tail = self.__handleInline(child.tail)
dumby = util.etree.Element('d')