From c3f7b2ba327c729a36e2a3705514db1742267700 Mon Sep 17 00:00:00 2001 From: Gustav Tiger Date: Fri, 28 Aug 2015 14:01:09 +0200 Subject: Fix find footnote placeholder to recurse --- markdown/extensions/footnotes.py | 4 +++- tests/extensions/extra/footnote_placeholder_depth.html | 13 +++++++++++++ tests/extensions/extra/footnote_placeholder_depth.txt | 5 +++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 tests/extensions/extra/footnote_placeholder_depth.html create mode 100644 tests/extensions/extra/footnote_placeholder_depth.txt diff --git a/markdown/extensions/footnotes.py b/markdown/extensions/footnotes.py index d8caae2..b52815f 100644 --- a/markdown/extensions/footnotes.py +++ b/markdown/extensions/footnotes.py @@ -96,7 +96,9 @@ class FootnoteExtension(Extension): 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) diff --git a/tests/extensions/extra/footnote_placeholder_depth.html b/tests/extensions/extra/footnote_placeholder_depth.html new file mode 100644 index 0000000..9793a49 --- /dev/null +++ b/tests/extensions/extra/footnote_placeholder_depth.html @@ -0,0 +1,13 @@ +
+
+
+
+
    +
  1. +

    A Footnote. 

    +
  2. +
+
+

Some text with a footnote1.

+
+
\ No newline at end of file diff --git a/tests/extensions/extra/footnote_placeholder_depth.txt b/tests/extensions/extra/footnote_placeholder_depth.txt new file mode 100644 index 0000000..cfe87c0 --- /dev/null +++ b/tests/extensions/extra/footnote_placeholder_depth.txt @@ -0,0 +1,5 @@ +>> ///Footnotes Go Here/// +>> +>> Some text with a footnote[^1]. + +[^1]: A Footnote. -- cgit v1.2.3