Skip to content

Commit c3e835d

Browse files
committed
issue2551104 - fix issue with markdown autolink next to punctuation
Given: [label](http://example.com/). generated href including the ').' This fixes that.
1 parent 62b2b78 commit c3e835d

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Fixed:
5555
- removed run_tests.py. Newer pytest doesn't support generating
5656
stand alone testing bundles. Python 3.9 generates errors running
5757
the current run_tests.py.
58+
- issue2551104 - fix issue with markdown autolink next to punctuation (ced)
5859

5960
Features:
6061
- issue2550522 - Add 'filter' command to command-line

roundup/cgi/templating.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1686,7 +1686,7 @@ def _hyper_repl_markdown(self, match):
16861686
('(', ')'),
16871687
}:
16881688
continue
1689-
if prefix == '(' and match.string[end - 1] == ')':
1689+
if prefix == '(' and ')' in match.group(group):
16901690
continue
16911691
s = match.group(group)
16921692
return '<%s>' % s

test/test_templating.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,11 @@ def test_markdown_hyperlinked_url(self):
566566
m = self.mangleMarkdown2(m)
567567
self.assertEqual(m.rstrip('\n'), '<p><a href="http://example.com/" rel="nofollow noopener" title="a title">label</a></p>')
568568

569+
p = StringHTMLProperty(self.client, 'test', '1', None, 'test', u2s(u'[label](http://example.com/).'))
570+
m = p.markdown(hyperlink=1)
571+
m = self.mangleMarkdown2(m)
572+
self.assertEqual(m.rstrip('\n'), '<p><a href="http://example.com/" rel="nofollow noopener">label</a>.</p>')
573+
569574
p = StringHTMLProperty(self.client, 'test', '1', None, 'test', u2s(u'![](http://example.com/)'))
570575
m = p.markdown(hyperlink=1)
571576
m = self.mangleMarkdown2(m)

0 commit comments

Comments
 (0)