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

Fix smarty pants extra not triggering when it should (#611) #613

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- [pull #607] Fix `middle-word-em` extra preventing strongs from being recognized (#606)
- [pull #609] Add option to output to file in CLI (#608)
- [pull #612] Fix footnote labels appearing out-of-order (#536)
- [pull #613] Fix smarty pants extra not triggering when it should (#611)


## python-markdown2 2.5.1
Expand Down
8 changes: 7 additions & 1 deletion lib/markdown2.py
Original file line number Diff line number Diff line change
Expand Up @@ -3321,7 +3321,13 @@ def run(self, text):
return text

def test(self, text):
return "'" in text or '"' in text
return any(i in text for i in (
"'",
'"',
'--',
'...',
'. . .'
))


class Strike(Extra):
Expand Down
3 changes: 3 additions & 0 deletions test/tm-cases/smarty_pants_issue611.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<p>ho ho &#8212; ho ho</p>

<p>ho &#8220;ho&#8221; &#8212; ho ho</p>
1 change: 1 addition & 0 deletions test/tm-cases/smarty_pants_issue611.opts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"extras": ["smarty-pants"]}
3 changes: 3 additions & 0 deletions test/tm-cases/smarty_pants_issue611.text
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ho ho --- ho ho

ho "ho" --- ho ho
Loading