Roundup Tracker - Issues

Issue 2550759

classification
Improve handling of trailing punctuation when URLs are converted to links
Type: behavior Severity: normal
Components: Web interface Versions: 1.4
process
Status: closed fixed
:
: ezio.melotti : ber, ezio.melotti, schlatterbeck, techtonik
Priority: normal : patch

Created on 2012-05-27 03:29 by ezio.melotti, last changed 2012-07-29 03:46 by ezio.melotti.

Files
File name Uploaded Description Edit Remove
trailing-punct.diff ezio.melotti, 2012-05-27 03:29
Messages
msg4570 Author: [hidden] (ezio.melotti) Date: 2012-05-27 03:29
The attached patch prevents the inclusion of trailing punctuation
(".,;:!") when URLs are converted to links.
E.g., the punctuation is not included in:
http://roundup.net/.
http://roundup.net/,
http://roundup.net/!
but it still is in:
http://roundup.net/./
http://roundup.net/,/
http://roundup.net/!/
msg4571 Author: [hidden] (ber) Date: 2012-05-29 08:06
Ezio, 
thanks for the patch! Can you be more elaborate, why it is an issue
to include trailing punctuation? I guess I lack imagination
on the first sight. ;)
msg4572 Author: [hidden] (techtonik) Date: 2012-05-29 08:46
It looks like this is for StringHTMLProperty class. 
http://roundup.hg.sourceforge.net/hgweb/roundup/roundup/file/227e7f8614d
d/roundup/cgi/templating.py#l1233

I see this architecture for the first time, and there is immediately a 
question:
1. Does it allow to implement my own replacement rules?
1.1. for example I want to add tiny bits of link ids/classes for JS
1.2. for example I want to do replacement for my own tokens like 
wiki:Stuff should go to http://wiki.python.org/Stuff

Is there any subclassing or other kind of magic for customization? It is 
completely obscure from the code. I also expected some kind of 
tokenization to occur - it's more reliable than chained regexp rules and 
probably easier to debug.

So perhaps it's worth refactoring these replacements into more generic 
utils stuff? It will be easier to test in standalone mode and perhaps 
there is already snippets in other projects that do the same.
msg4573 Author: [hidden] (techtonik) Date: 2012-05-29 08:48
The above post is a good example of ill-behaving chained regexp rules. =)
msg4576 Author: [hidden] (ezio.melotti) Date: 2012-06-14 12:24
The issue is that the trailing punctuation usually is not part of the
link, see also http://psf.upfronthosting.co.za/roundup/meta/issue437.
msg4590 Author: [hidden] (ezio.melotti) Date: 2012-07-17 14:00
Fixed in 11b6601629d7.
History
Date User Action Args
2012-07-29 03:46:12ezio.melottisetassignee: ezio.melotti
2012-07-17 14:00:31ezio.melottisetpriority: normal
status: new -> closed
resolution: fixed
messages: + msg4590
2012-06-14 12:24:05ezio.melottisetmessages: + msg4576
2012-05-29 08:48:50techtoniksetmessages: + msg4573
2012-05-29 08:46:01techtoniksetnosy: + techtonik
messages: + msg4572
2012-05-29 08:06:11bersetnosy: + ber
messages: + msg4571
2012-05-27 03:29:49ezio.melotticreate