diff roundup/cgi/templating.py @ 4647:11b6601629d7

#2550759: Trailing punctuation is no longer included when URLs are converted to links.
author Ezio Melotti <ezio.melotti@gmail.com>
date Sat, 14 Jul 2012 02:39:23 +0200
parents a2eb4fb3e6d8
children beb8d43f4d9d
line wrap: on
line diff
--- a/roundup/cgi/templating.py	Thu Jul 12 22:51:22 2012 +0200
+++ b/roundup/cgi/templating.py	Sat Jul 14 02:39:23 2012 +0200
@@ -1277,6 +1277,10 @@
             pos = s.find('&gt;')
             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(')')

Roundup Issue Tracker: http://roundup-tracker.org/