diff --git a/roundup/cgi/templating.py b/roundup/cgi/templating.py --- a/roundup/cgi/templating.py +++ b/roundup/cgi/templating.py @@ -1277,6 +1277,10 @@ pos = s.find('>') end = s[pos:] u = s = s[:pos] + if s.endswith(tuple('.,;:!')): + # don't include trailing punctuation + end = s[-1:] + end + u = s = s[:-1] if ')' in s and s.count('(') != s.count(')'): # don't include extraneous ')' in the link pos = s.rfind(')') diff --git a/test/test_templating.py b/test/test_templating.py --- a/test/test_templating.py +++ b/test/test_templating.py @@ -173,6 +173,13 @@ ae(t('(e.g. http://en.wikipedia.org/wiki/Python_(programming_language>)).'), '(e.g. ' 'http://en.wikipedia.org/wiki/Python_(programming_language>)).') + for c in '.,;:!': + # trailing punctuation is not included + ae(t('http://roundup.net/%c ' % c), + 'http://roundup.net/%c ' % c) + # but it's included if it's part of the URL + ae(t('http://roundup.net/%c/' % c), + 'http://roundup.net/%c/' % (c, c)) ''' class HTMLPermissions: