aboutsummaryrefslogtreecommitdiffstats
path: root/markdown/extensions/footnotes.py
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2010-08-20 10:56:42 -0400
committerWaylan Limberg <waylan@gmail.com>2010-08-20 10:56:42 -0400
commitdc63c6881893c0a518a4914c3f4622c5d9a25c93 (patch)
treedd145be21919db203fd83bc567885b86e0d53c3d /markdown/extensions/footnotes.py
parentad2e798a81d63de5e1822a489688b885ca412c96 (diff)
parent3bd36d4c8f0ca1f7345999a58d7b8c2f5e6f9fbe (diff)
downloadmarkdown-dc63c6881893c0a518a4914c3f4622c5d9a25c93.tar.gz
markdown-dc63c6881893c0a518a4914c3f4622c5d9a25c93.tar.bz2
markdown-dc63c6881893c0a518a4914c3f4622c5d9a25c93.zip
Merge branch 'master' of git@gitorious.org:python-markdown/mainline
Diffstat (limited to 'markdown/extensions/footnotes.py')
-rw-r--r--markdown/extensions/footnotes.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/markdown/extensions/footnotes.py b/markdown/extensions/footnotes.py
index f9e5101..2bdabe9 100644
--- a/markdown/extensions/footnotes.py
+++ b/markdown/extensions/footnotes.py
@@ -84,10 +84,10 @@ class FootnoteExtension(markdown.Extension):
for child in element:
if child.text:
if child.text.find(self.getConfig("PLACE_MARKER")) > -1:
- return child, True
+ return child, element, True
if child.tail:
if child.tail.find(self.getConfig("PLACE_MARKER")) > -1:
- return (child, element), False
+ return child, element, False
finder(child)
return None
@@ -282,16 +282,14 @@ class FootnoteTreeprocessor(markdown.treeprocessors.Treeprocessor):
if footnotesDiv:
result = self.footnotes.findFootnotesPlaceholder(root)
if result:
- node, isText = result
+ child, parent, isText = result
+ ind = parent.getchildren().index(child)
if isText:
- node.text = None
- node.getchildren().insert(0, footnotesDiv)
+ parent.remove(child)
+ parent.insert(ind, footnotesDiv)
else:
- child, element = node
- ind = element.getchildren().find(child)
- element.getchildren().insert(ind + 1, footnotesDiv)
+ parent.insert(ind + 1, footnotesDiv)
child.tail = None
- fnPlaceholder.parent.replaceChild(fnPlaceholder, footnotesDiv)
else:
root.append(footnotesDiv)