Skip to content

Commit 518dbc2

Browse files
committed
Merge branch 'DemocracyClub-150-fix-footnote-back-refs'
2 parents 2369d36 + 3ad3c98 commit 518dbc2

File tree

4 files changed

+27
-0
lines changed

4 files changed

+27
-0
lines changed

lib/markdown2.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1981,6 +1981,13 @@ def _do_smart_punctuation(self, text):
19811981
text = text.replace("...", "…")
19821982
text = text.replace(" . . . ", "…")
19831983
text = text.replace(". . .", "…")
1984+
1985+
# TODO: Temporary hack to fix https://github.com/trentm/python-markdown2/issues/150
1986+
if "footnotes" in self.extras and "footnote-ref" in text:
1987+
# Quotes in the footnote back ref get converted to "smart" quotes
1988+
# Change them back here to ensure they work.
1989+
text = text.replace('class="footnote-ref”', 'class="footnote-ref"')
1990+
19841991
return text
19851992

19861993
_block_quote_base = r'''
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<p>This is a para with a footnote.<sup class="footnote-ref" id="fnref-1"><a href="#fn-1">1</a></sup></p>
2+
3+
<div class="footnotes">
4+
<hr />
5+
<ol>
6+
<li id="fn-1">
7+
<p>Here is the <em>body</em> of <span class="yo">the</span> footnote.</p>
8+
9+
<div class="blah">And here is the second para of the footnote.</div>
10+
11+
<p><a href="#fnref-1" class="footnoteBackLink" title="Jump back to footnote 1 in the text.">&#8617;</a></p>
12+
</li>
13+
</ol>
14+
</div>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"extras": ["footnotes", "smarty-pants"]}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
This is a para with a footnote.[^1]
2+
3+
[^1]: Here is the <em>body</em> of <span class="yo">the</span> footnote.
4+
5+
<div class="blah">And here is the second para of the footnote.</div>

0 commit comments

Comments
 (0)