diff -r 957a0fc20021 roundup/cgi/templating.py --- a/roundup/cgi/templating.py Sun Oct 25 16:12:15 2020 -0400 +++ b/roundup/cgi/templating.py Wed Oct 28 10:36:17 2020 +0100 @@ -1621,6 +1621,23 @@ return match.group(0) def _hyper_repl_markdown(self, match): + for group in ['url', 'email']: + if match.group(group): + start = match.start(group) - 1 + end = match.end(group) + if start >= 0: + prefix = match.string[start] + if end < len(match.string): + suffix = match.string[end] + if (prefix, suffix) in { + ('<', '>'), + ('(', ')'), + }: + continue + if prefix == '(' and match.string[end - 1] == ')': + continue + s = match.group(group) + return '<%s>' % s if match.group('id') and len(match.group('id')) < 10: return self._hyper_repl_item(match,'[%(item)s](%(cls)s%(id)s)') else: diff -r 957a0fc20021 test/test_templating.py --- a/test/test_templating.py Sun Oct 25 16:12:15 2020 -0400 +++ b/test/test_templating.py Wed Oct 28 10:36:17 2020 +0100 @@ -487,6 +487,28 @@ m = p.markdown() self.assertEqual(0, m.count('http://example.com/

\n') + + p = StringHTMLProperty(self.client, 'test', '1', None, 'test', u2s(u'')) + m = p.markdown(hyperlink=1) + self.assertEqual(m, '

http://example.com/

\n') + + p = StringHTMLProperty(self.client, 'test', '1', None, 'test', u2s(u'![](http://example.com/)')) + m = p.markdown(hyperlink=1) + self.assertIn(m, [ + '

\n', + '

\n', + '

\n', + ]) + + p = StringHTMLProperty(self.client, 'test', '1', None, 'test', u2s(u'An URL http://example.com/ with text')) + m = p.markdown(hyperlink=1) + self.assertEqual(m, '

An URL http://example.com/ with text

\n') + + @skip_mistune class MistuneTestCase(TemplatingTestCase, MarkdownTests) :