Skip to content

Commit f55e509

Browse files
committed
#2550759: Trailing punctuation is no longer included when URLs are converted to links.
1 parent efba862 commit f55e509

File tree

3 files changed

+30
-17
lines changed

3 files changed

+30
-17
lines changed

CHANGES.txt

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Features:
1111

1212
Fixed:
1313

14+
- issue2550759: Trailing punctuation is no longer included when URLs are
15+
converted to links. (Ezio Melotti)
1416
- issue2550574: Restore sample detectors removed in roundup 1.4.9
1517
(Thomas Arendsen Hein)
1618
- Prevent AttributeError when removing all roles of a user
@@ -37,7 +39,7 @@ Features:
3739
developement. If you found a bug in Chameleon support, please report after
3840
testing against latest Roundup source from the Mercurial repository.
3941
- issue2550678: Allow pagesize=-1 which returns all results.
40-
Suggested and implemented by John Kristensen.
42+
Suggested and implemented by John Kristensen.
4143
Tested by Satchidanand Haridas. (Bernhard)
4244
- Allow to turn off translation of generated html options in menu method
4345
of LinkHTMLProperty and MultilinkHTMLProperty -- default is
@@ -62,7 +64,7 @@ Fixed:
6264
- issue2550712: exportcsvaction errors poorly when given invalid columns.
6365
Reported by Will Kahn-Greene, fixed by C�dric Krier. (Bernhard)
6466
- issue2550695: 'No sort or group' settings not retained when editing queries.
65-
Reported and fixed by John Kristensen. Tested by Satchidanand Haridas.
67+
Reported and fixed by John Kristensen. Tested by Satchidanand Haridas.
6668
(Bernhard)
6769
- Fix matching of incoming email addresses to the alternate_addresses
6870
field of a user -- this would match substrings, e.g. if the user has
@@ -113,7 +115,7 @@ Fixed:
113115
Thanks to Joseph Myers for reporting. (Ralf)
114116
- Fix another XSS with the ok- and error message, see issue2550724. We
115117
solve this differently from the proposals in the bug-report by not
116-
allowing *any* html-tags in ok/error messages anymore. Thanks to
118+
allowing *any* html-tags in ok/error messages anymore. Thanks to
117119
David Benjamin for the bug-report and to Ezio Melotti for several
118120
proposed fixes. (Ralf)
119121

@@ -122,7 +124,7 @@ Fixed:
122124

123125
Features:
124126

125-
- Xapian indexing improved: Slightly faster and slightly smaller database.
127+
- Xapian indexing improved: Slightly faster and slightly smaller database.
126128
Closes issue2550687. Thanks to Olly Betts for the patch. (Bernhard Reiter)
127129
- PostgreSQL backend minor improvement: database creation less likely to fail
128130
for PostgreSQL versions >= 8.1 as the table "postgres" is used by default.
@@ -133,15 +135,15 @@ Features:
133135

134136
Fixed:
135137

136-
- Installation: Fixed an issue that prevented to use EasyInstall
138+
- Installation: Fixed an issue that prevented to use EasyInstall
137139
and a Python egg. Thanks to Satchidanand Haridas for the patch and
138140
John Kristensen for testing it. (Bernhard Reiter)
139-
- The PostgreSQL backend quotes database names now for CREATE and DROP,
140-
enabling more exotic tracker names. Closes issue2550497.
141+
- The PostgreSQL backend quotes database names now for CREATE and DROP,
142+
enabling more exotic tracker names. Closes issue2550497.
141143
Thanks to Sebastian Harl for providing the patch. (Bernhard Reiter)
142144
- Updated the url to point to www.roundup-tracker.org in two places in the
143145
docs. (Bernhard Reiter)
144-
- Do not depend on a CPython implementation detail anymore to make Roundup
146+
- Do not depend on a CPython implementation detail anymore to make Roundup
145147
more compatible with other Python implementations like PyPy.
146148
Closes issue2550707. Thanks to Christof Meerwald. (Bernhard Reiter, Richard)
147149
- Yet another fix to the mail gateway, messages got *all* files of
@@ -179,9 +181,9 @@ Features:
179181
Fixed:
180182

181183
- File-unlink defect in mailgw fixed! If an email was received
182-
that contained no attachments, all previous files of the issue were unlinked.
183-
This defect was introduced with the 1.4.17 release as an unwanted result
184-
of the mail gate code refactoring. Thanks to Rafal Bisingier for reporting
184+
that contained no attachments, all previous files of the issue were unlinked.
185+
This defect was introduced with the 1.4.17 release as an unwanted result
186+
of the mail gate code refactoring. Thanks to Rafal Bisingier for reporting
185187
and proposing a fix. There is now a regression test in place. (Ralf)
186188

187189
2011-05-13: 1.4.17
@@ -229,10 +231,10 @@ Fixed:
229231
doesn't have access to a property but can deduce the content by
230232
crafting a clever search, group or sort query.
231233
see doc/upgrading.txt for how to fix your trackers! (Ralf Schlatterbeck).
232-
- Range support in roundup-server so large files can be served,
233-
e.g. media files on iOS/iPads; issue2550694. (Bernhard Reiter;
234+
- Range support in roundup-server so large files can be served,
235+
e.g. media files on iOS/iPads; issue2550694. (Bernhard Reiter;
234236
Thanks to Jon C. Thomason for the patch.)
235-
- Fix search for xapian 1.2 issue2550676
237+
- Fix search for xapian 1.2 issue2550676
236238
(Bernhard Reiter; Thanks to Olly Betts for providing the patch.)
237239
- Some minor typos fixed in doc/customizing.txt (Thanks Ralf Hemmecke).
238240
- XML-RPC documentation now linked from the docs/index (Bernhard Reiter).
@@ -384,7 +386,7 @@ Fixes:
384386
- Fix handling of non-ascii in realname in the nosy mailer, this used to
385387
mangle the email address making it unusable when replying. Thanks to
386388
intevation for funding the fix.
387-
- Fix documentation on user required to run the tests, fixes
389+
- Fix documentation on user required to run the tests, fixes
388390
issue2550618, thanks to Chris aka 'radioking'
389391
- Add simple doc about translating customised tracker content
390392
- Add "flup" setup documentation, thanks Christian Glass
@@ -470,7 +472,7 @@ Fixes:
470472
- Indexers behaviour made more consistent regarding length of indexed words
471473
and stopwords (thanks Thomas Arendsen Hein, Bernhard Reiter)(issue 2550584)
472474
- fixed typos in the installation instructions (thanks Thomas Arendsen Hein)
473-
(issue 2550573)
475+
(issue 2550573)
474476
- New config option csv_field_size: Pythons csv module (which is used
475477
for export/import) has a new field size limit starting with python2.5.
476478
We now issue a warning during export if the limit is too small and use
@@ -480,7 +482,7 @@ Fixes:
480482
worked only for 2.5 and beyond due to a change in the xmlrpc interface
481483
in python (Ralf Schlatterbeck)
482484
- Document filter method of xmlrpc interface (Ralf Schlatterbeck)
483-
- Fix interaction of SSL and XMLRPC, now XMLRPC works with SSL
485+
- Fix interaction of SSL and XMLRPC, now XMLRPC works with SSL
484486
(Ralf Schlatterbeck)
485487

486488
2009-08-10: 1.4.9

roundup/cgi/templating.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,6 +1277,10 @@ def _hyper_repl_url(self, match, replacement):
12771277
pos = s.find('>')
12781278
end = s[pos:]
12791279
u = s = s[:pos]
1280+
if s.endswith(tuple('.,;:!')):
1281+
# don't include trailing punctuation
1282+
end = s[-1:] + end
1283+
u = s = s[:-1]
12801284
if ')' in s and s.count('(') != s.count(')'):
12811285
# don't include extraneous ')' in the link
12821286
pos = s.rfind(')')

test/test_templating.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,13 @@ def t(s): return p.hyper_re.sub(p._hyper_repl, s)
173173
ae(t('(e.g. http://en.wikipedia.org/wiki/Python_(programming_language>)).'),
174174
'(e.g. <a href="http://en.wikipedia.org/wiki/Python_(programming_language">'
175175
'http://en.wikipedia.org/wiki/Python_(programming_language</a>&gt;)).')
176+
for c in '.,;:!':
177+
# trailing punctuation is not included
178+
ae(t('http://roundup.net/%c ' % c),
179+
'<a href="http://roundup.net/">http://roundup.net/</a>%c ' % c)
180+
# but it's included if it's part of the URL
181+
ae(t('http://roundup.net/%c/' % c),
182+
'<a href="http://roundup.net/%c/">http://roundup.net/%c/</a>' % (c, c))
176183

177184
'''
178185
class HTMLPermissions:

0 commit comments

Comments
 (0)