Skip to content

Commit

Permalink
Merge pull request #613 from Crozzers/fix-smarty-pants-runtime-check
Browse files Browse the repository at this point in the history
Fix smarty pants extra not triggering when it should (#611)
  • Loading branch information
nicholasserra authored Dec 7, 2024
2 parents 1032d35 + 7677802 commit ed820a6
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 1 deletion.
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

0 comments on commit ed820a6

Please sign in to comment.