From 2fe5b5b5803c138f70e5c90aaa77f85f3c596f1d Mon Sep 17 00:00:00 2001
From: Waylan Limberg
Date: Thu, 9 Aug 2012 06:15:17 -0400
Subject: Fixed #129. Footnotes now output valid HTML5.
As HTML5 has depreciated use of `rev=anything` and `rel=footnotes`, they are no
longer inlcuded in the output when the output_format is set to HTML5. Note that
if someone successful registers a spec for `rel=footnotes` in the future (as
a microformat), then that could be considered valid. But until that happens,
it is invlaid to use in HTML5. Therefore, we remove it from the output (when
outputing HTML% only).
As an alternative, two new classes are set (in all output_formats). On the link
to the footnote (where `rel=footnotes` was used), we set `class=footnote-ref`
and on the backlink (where `rev=footnote` was used), we set
`class=footnote-backref`.
Also updated the tests to reflect to the new classes in the output.
---
markdown/extensions/footnotes.py | 9 +++++++--
tests/extensions/extra/footnote.html | 12 ++++++------
tests/extensions/extra/footnote_placeholder.html | 4 ++--
tests/extensions/extra/named_markers.html | 14 +++++++-------
4 files changed, 22 insertions(+), 17 deletions(-)
diff --git a/markdown/extensions/footnotes.py b/markdown/extensions/footnotes.py
index 3d83807..cfe41ed 100644
--- a/markdown/extensions/footnotes.py
+++ b/markdown/extensions/footnotes.py
@@ -61,6 +61,7 @@ class FootnoteExtension(markdown.Extension):
""" Add pieces to Markdown. """
md.registerExtension(self)
self.parser = md.parser
+ self.md = md
# Insert a preprocessor before ReferencePreprocessor
md.preprocessors.add("footnote", FootnotePreprocessor(self),
"This is the body with a footnote1 or two2 or more3 4 5.
+This is the body with a footnote or two or more .
Also a reference that does not exist[^6].
\ No newline at end of file
diff --git a/tests/extensions/extra/footnote_placeholder.html b/tests/extensions/extra/footnote_placeholder.html
index 9c89391..0143145 100644
--- a/tests/extensions/extra/footnote_placeholder.html
+++ b/tests/extensions/extra/footnote_placeholder.html
@@ -2,8 +2,8 @@
-
-
A Footnote. ↩
+A Footnote.
-Some text with a footnote1.
\ No newline at end of file
+Some text with a footnote.
\ No newline at end of file
diff --git a/tests/extensions/extra/named_markers.html b/tests/extensions/extra/named_markers.html
index f643b7b..55cea31 100644
--- a/tests/extensions/extra/named_markers.html
+++ b/tests/extensions/extra/named_markers.html
@@ -1,20 +1,20 @@
-This is the body with footnotes1
-that have named2 markers and
-oddly3 numbered4 markers.
+This is the body with footnotes
+that have named markers and
+oddly numbered markers.
\ No newline at end of file
--
cgit v1.2.3