Skip to content

Commit

Permalink
Merge pull request #429 from Tigge/patch-1
Browse files Browse the repository at this point in the history
Fix find footnote placeholder to recurse
  • Loading branch information
waylan committed Aug 29, 2015
2 parents 904d4e6 + c3f7b2b commit d442f57
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
4 changes: 3 additions & 1 deletion markdown/extensions/footnotes.py
Expand Up @@ -96,7 +96,9 @@ def finder(element):
if child.tail:
if child.tail.find(self.getConfig("PLACE_MARKER")) > -1:
return child, element, False
finder(child)
child_res = finder(child)
if child_res is not None:
return child_res
return None

res = finder(root)
Expand Down
13 changes: 13 additions & 0 deletions tests/extensions/extra/footnote_placeholder_depth.html
@@ -0,0 +1,13 @@
<blockquote>
<blockquote>
<div class="footnote">
<hr />
<ol>
<li id="fn:1">
<p>A Footnote.&#160;<a class="footnote-backref" href="#fnref:1" rev="footnote" title="Jump back to footnote 1 in the text">&#8617;</a></p>
</li>
</ol>
</div>
<p>Some text with a footnote<sup id="fnref:1"><a class="footnote-ref" href="#fn:1" rel="footnote">1</a></sup>.</p>
</blockquote>
</blockquote>
5 changes: 5 additions & 0 deletions tests/extensions/extra/footnote_placeholder_depth.txt
@@ -0,0 +1,5 @@
>> ///Footnotes Go Here///
>>
>> Some text with a footnote[^1].

[^1]: A Footnote.

0 comments on commit d442f57

Please sign in to comment.