aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2008-08-05 00:41:34 +0000
committerRobin H. Johnson <robbat2@gentoo.org>2008-08-05 00:41:34 +0000
commit4706bbe7aeff71a596a0018918ca70b17bb9193e (patch)
tree9fc1c4dfbb6e5ea20d1744638c405a8a098b7c33 /web
parentTemp fix for broken pkginfo expansion. (diff)
downloadpackages-4706bbe7aeff71a596a0018918ca70b17bb9193e.tar.gz
packages-4706bbe7aeff71a596a0018918ca70b17bb9193e.tar.bz2
packages-4706bbe7aeff71a596a0018918ca70b17bb9193e.zip
Fix for bug #232234.
Diffstat (limited to 'web')
-rw-r--r--web/lib/changelog_formatter.py23
1 files changed, 19 insertions, 4 deletions
diff --git a/web/lib/changelog_formatter.py b/web/lib/changelog_formatter.py
index 9a4ab70..872cc98 100644
--- a/web/lib/changelog_formatter.py
+++ b/web/lib/changelog_formatter.py
@@ -33,8 +33,9 @@ def _single_pass_re_loop(reo, callback, instr):
"""For every match of the given regex, replace the entire match
with the string given by callback.
Callback takes the re.match object."""
- while True:
- m = reo.search(instr)
+ for m in reo.finditer(instr):
+ #while True:
+ #m = reo.search(instr)
if m is None:
break
repl = callback(m)
@@ -45,7 +46,9 @@ re_email1 = re.compile(r'<([^@ ]+)@gentoo.org>')
re_email2 = re.compile(r'([^@ ]+)@gentoo.org')
re_file = re.compile(r'([\+-]?)(\S+)([:,]|[:,]$)')
re_bugid = re.compile(r'([Bb][uU][gG] ?#?)(\d+)')
-re_url = re.compile(r'(http://[\S]+[\w/])([\s).]|$)')
+re_url_base = '(https?://[^\s/)>]+(?:/[\S]+)?)'
+re_url = re.compile("([\s<(]*)"+re_url_base+"([\s>)]+?.?|$)?")
+re_url_notend = re.compile(r'[\s.)>]+$')
def _pretty_changelog_pass1(cat, pn, changelog):
"""Changelog prettification, pass1: replace text with markers"""
@@ -84,7 +87,19 @@ def _pretty_changelog_pass1(cat, pn, changelog):
return '%s__BUG__%s__/BUG__' % (m.group(1), m.group(2))
newline = _single_pass_re_loop(re_bugid, bug_markup, newline)
def url_markup(m):
- return '__URL__%s__/URL__%s' % (m.group(1)[7:], m.group(2))
+ prefix = m.group(1)
+ url = m.group(2)
+ suffix = m.group(3)
+ if prefix is None:
+ prefix = ''
+ if suffix is None:
+ suffix = ''
+ extra_suffix = re_url_notend.search(url)
+ if extra_suffix:
+ extra_suffix = extra_suffix.group(0)
+ suffix = extra_suffix + suffix
+ url = url[0:-len(extra_suffix)]
+ return '%s__URL__%s__/URL__%s' % (prefix, url, suffix)
newline = _single_pass_re_loop(re_url, url_markup, newline)
changelog_lines[i] = newline
if oldline.endswith(':'):