From 9f8372ece0b824e2038a7b728064ae454283db68 Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Thu, 29 Nov 2007 17:18:33 +0000 Subject: Footnotes that end in anyting but a

(list, blockquote, codeblock) now have the backlink in a

which is appended to the end of the footnote. Fixes [1831600] Also fixed multiparagraph footnotes so that the first paragraph is actually wrapped in a

element. This results in one-liners also wrapped in

elements, but this is inline with PHP Markdown Extra's behavior. That means the test for `node.type == "text"` should never get a match, but I'm leaving it in for now. Also added some tests, although they are not properly included in a test directory for use with the testing framework. Seeing the framework currently ignores extensions, we'll worry about that later. --- mdx_footnotes.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'mdx_footnotes.py') diff --git a/mdx_footnotes.py b/mdx_footnotes.py index 56ffd3a..b9641ce 100644 --- a/mdx_footnotes.py +++ b/mdx_footnotes.py @@ -116,7 +116,7 @@ class FootnoteExtension (markdown.Extension): li = doc.createElement('li') li.setAttribute('id', self.makeFootnoteId(i)) - self.md._processSection(li, self.footnotes[id].split("\n")) + self.md._processSection(li, self.footnotes[id].split("\n"), looseList=1) #li.appendChild(doc.createTextNode(self.footnotes[id])) @@ -130,8 +130,13 @@ class FootnoteExtension (markdown.Extension): if li.childNodes : node = li.childNodes[-1] if node.type == "text" : - node = li - node.appendChild(backlink) + li.appendChild(backlink) + elif node.nodeName == "p": + node.appendChild(backlink) + else: + p = doc.createElement('p') + p.appendChild(backlink) + li.appendChild(p) ol.appendChild(li) -- cgit v1.2.3