Merge lp://staging/~brian-murray/terminator/lp-links into lp://staging/terminator/trunk

Proposed by Brian Murray
Status: Merged
Merged at revision: not available
Proposed branch: lp://staging/~brian-murray/terminator/lp-links
Merge into: lp://staging/terminator/trunk
Diff against target: None lines
To merge this branch: bzr merge lp://staging/~brian-murray/terminator/lp-links
Reviewer Review Type Date Requested Status
Nicolas Valcarcel (community) sponsoring Approve
Review via email: mp+10333@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
Brian Murray (brian-murray) wrote :

This branch expands the linkification of LP: #1 to match the regular expression specified in the Ubuntu Policy Manual footnote 20. It is actually a bit more lax as people sometimes don't get the syntax exactly right and it would still be useful to have those typos linkified.

This also adds a new feature of linkifying multiple bugs in a list. For example:

LP: #180692, #415500

Both of these will become links to the correct Launchpad bug numbers.

Revision history for this message
Nicolas Valcarcel (nvalcarcel) wrote :

Looks good to me

review: Approve
Revision history for this message
Nicolas Valcarcel (nvalcarcel) wrote :

The branches seems to be quite different, i'm nitpicking the patch and ignoring the rest, sorry if that causes something to be missing in the log.

Revision history for this message
Nicolas Valcarcel (nvalcarcel) wrote :

> The branches seems to be quite different, i'm nitpicking the patch and
s/nitpicking/cherrypicking/g

Revision history for this message
Nicolas Valcarcel (nvalcarcel) wrote :

Just uploaded the changes, thank you for your contribution!

review: Approve (sponsoring)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'terminatorlib/terminatorterm.py'
2--- terminatorlib/terminatorterm.py 2009-08-14 18:15:32 +0000
3+++ terminatorlib/terminatorterm.py 2009-08-18 17:59:06 +0000
4@@ -382,7 +382,9 @@
5 elif match == self.matches['addr_only']:
6 url = 'http://' + url
7 elif match == self.matches['launchpad']:
8- url = 'https://bugs.launchpad.net/bugs/%s' % re.sub (r'[^0-9]+', '', url)
9+ for item in re.findall(r'[0-9]+',url):
10+ url = 'https://bugs.launchpad.net/bugs/%s' % item
11+ return url
12
13 return url
14
15@@ -625,7 +627,8 @@
16 self.matches['email'] = self._vte.match_add (lboundry + "(mailto:)?[a-zA-Z0-9][a-zA-Z0-9.+-]*@[a-zA-Z0-9][a-zA-Z0-9-]*\.[a-zA-Z0-9][a-zA-Z0-9-]+[.a-zA-Z0-9-]*" + rboundry)
17 self.matches['nntp'] = self._vte.match_add (lboundry + '''news:[-A-Z\^_a-z{|}~!"#$%&'()*+,./0-9;:=?`]+@[-A-Za-z0-9.]+(:[0-9]+)?''' + rboundry)
18 # if the url looks like a Launchpad changelog closure entry LP: #92953 - make it a url to http://bugs.launchpad.net
19- self.matches['launchpad'] = self._vte.match_add ('\\bLP:? #?[0-9]+\\b')
20+ # the regular expression is similar to the perl one specified in the Ubuntu Policy Manual - /lp:\s+\#\d+(?:,\s*\#\d+)*/i
21+ self.matches['launchpad'] = self._vte.match_add ('\\b(lp|LP):?\s?#?[0-9]+(,\s*#?[0-9]+)*\\b')
22
23 def _path_lookup(self, command):
24 if os.path.isabs (command):