Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Un-smart-quote footnote back refs #317

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/markdown2.py
Expand Up @@ -1981,6 +1981,13 @@ def _do_smart_punctuation(self, text):
text = text.replace("...", "…")
text = text.replace(" . . . ", "…")
text = text.replace(". . .", "…")

# TODO: See issue #150
if "footnotes" in self.extras and "footnote-ref" in text:
# Quotes in the footnote back ref get converted to "smart" quotes
# Change them back here to ensure they work.
text = text.replace('class="footnote-ref”', 'class="footnote-ref"')

return text

_block_quote_base = r'''
Expand Down
14 changes: 14 additions & 0 deletions test/tm-cases/footnotes_smarty-pants.html
@@ -0,0 +1,14 @@
<p>This is a para with a footnote.<sup class="footnote-ref" id="fnref-1"><a href="#fn-1">1</a></sup></p>

<div class="footnotes">
<hr />
<ol>
<li id="fn-1">
<p>Here is the <em>body</em> of <span class="yo">the</span> footnote.</p>

<div class="blah">And here is the second para of the footnote.</div>

<p><a href="#fnref-1" class="footnoteBackLink" title="Jump back to footnote 1 in the text.">&#8617;</a></p>
</li>
</ol>
</div>
1 change: 1 addition & 0 deletions test/tm-cases/footnotes_smarty-pants.opts
@@ -0,0 +1 @@
{"extras": ["footnotes", "smarty-pants"]}
5 changes: 5 additions & 0 deletions test/tm-cases/footnotes_smarty-pants.text
@@ -0,0 +1,5 @@
This is a para with a footnote.[^1]

[^1]: Here is the <em>body</em> of <span class="yo">the</span> footnote.

<div class="blah">And here is the second para of the footnote.</div>