summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f15ced1)
raw | patch | inline | side by side (parent: f15ced1)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Mon, 12 Jul 2010 04:14:02 +0000 (04:14 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Mon, 12 Jul 2010 04:14:02 +0000 (04:14 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4497 57a73879-2fb5-44c3-a270-3262357dd7e2
CHANGES.txt | patch | blob | history | |
doc/acknowledgements.txt | patch | blob | history | |
roundup/cgi/templating.py | patch | blob | history | |
test/test_templating.py | patch | blob | history |
diff --git a/CHANGES.txt b/CHANGES.txt
index d0338316a6f877ed51d4d951704b8fee9fac209d..8e063f50afc61f1eda52b33fb8f7bce1c2cb1fc6 100644 (file)
--- a/CHANGES.txt
+++ b/CHANGES.txt
Fixed:
- A bunch of regressions were introduced in the last release making Roundup
no longer work in Python releases prior to 2.6
+- make URL detection a little smarter about brackets per issue2550657
+ (thanks Ezio Melotti)
2010-07-01 1.4.14
index b6b7ccc958f2d714308fefba105affac9c5334d0..ddeec33d88068ad000aa356ee0bfb9e3eaac886b 100644 (file)
--- a/doc/acknowledgements.txt
+++ b/doc/acknowledgements.txt
Gordon McMillan,
John F Meinel Jr,
Roland Meister,
+Ezio Melotti,
Ulrik Mikaelsson,
John Mitchell,
Ramiro Morales,
index 271955e52df9612b442e5591f475a7fd92560a4f..6296a137651edb73853c3b4e50837e9c2b28f260 100644 (file)
u = s = match.group('url')
if not self.protocol_re.search(s):
u = 'http://' + s
- # catch an escaped ">" at the end of the URL
if s.endswith('>'):
+ # catch an escaped ">" at the end of the URL
u = s = s[:-4]
e = '>'
+ elif s.count('(') != s.count(')'):
+ # don't include extraneous ')' in the link
+ pos = s.rfind(')')
+ e = s[pos:]
+ u = s = s[:pos]
else:
e = ''
- return '<a href="%s">%s</a>%s'%(u, s, e)
+ return '<a href="%s">%s</a>%s' % (u, s, e)
elif match.group('email'):
s = match.group('email')
- return '<a href="mailto:%s">%s</a>'%(s, s)
+ return '<a href="mailto:%s">%s</a>' % (s, s)
elif len(match.group('id')) < 10:
return self._hyper_repl_item(match,
'<a href="%(cls)s%(id)s">%(item)s</a>')
index ad6d7585ac94ee37522bc94d37b4f3edefc0462d..d176842d4c7fcc8be07458103b37935a7a8aa979 100644 (file)
--- a/test/test_templating.py
+++ b/test/test_templating.py
p = StringHTMLProperty(self.client, 'test', '1', None, 'test', '')
def t(s): return p.hyper_re.sub(p._hyper_repl, s)
ae = self.assertEquals
- ae(t('http://roundup.net/'), '<a href="http://roundup.net/">http://roundup.net/</a>')
- ae(t('<HTTP://roundup.net/>'), '<<a href="HTTP://roundup.net/">HTTP://roundup.net/</a>>')
- ae(t('<www.roundup.net>'), '<<a href="http://www.roundup.net">www.roundup.net</a>>')
ae(t('item123123123123'), 'item123123123123')
+ ae(t('http://roundup.net/'),
+ '<a href="http://roundup.net/">http://roundup.net/</a>')
+ ae(t('<HTTP://roundup.net/>'),
+ '<<a href="HTTP://roundup.net/">HTTP://roundup.net/</a>>')
+ ae(t('<www.roundup.net>'),
+ '<<a href="http://www.roundup.net">www.roundup.net</a>>')
+ ae(t('(www.roundup.net)'),
+ '(<a href="http://www.roundup.net">www.roundup.net</a>)')
+ ae(t('foo http://msdn.microsoft.com/en-us/library/ms741540(VS.85).aspx bar'),
+ 'foo <a href="http://msdn.microsoft.com/en-us/library/ms741540(VS.85).aspx">'
+ 'http://msdn.microsoft.com/en-us/library/ms741540(VS.85).aspx</a> bar')
+ ae(t('(e.g. http://en.wikipedia.org/wiki/Python_(programming_language))'),
+ '(e.g. <a href="http://en.wikipedia.org/wiki/Python_(programming_language)">'
+ 'http://en.wikipedia.org/wiki/Python_(programming_language)</a>)')
+ ae(t('(e.g. http://en.wikipedia.org/wiki/Python_(programming_language)).'),
+ '(e.g. <a href="http://en.wikipedia.org/wiki/Python_(programming_language)">'
+ 'http://en.wikipedia.org/wiki/Python_(programming_language)</a>).')
'''
class HTMLPermissions: