From 9e6d8191ac16e86d84711c0e140d74053048d8c4 Mon Sep 17 00:00:00 2001 From: Brian Murray Date: Sat, 13 Dec 2008 21:13:25 -0800 Subject: [PATCH] Increase of possible matches for LP bug numbers as URLs --- terminatorlib/terminatorterm.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/terminatorlib/terminatorterm.py b/terminatorlib/terminatorterm.py index 75d2469d..b8728065 100755 --- a/terminatorlib/terminatorterm.py +++ b/terminatorlib/terminatorterm.py @@ -398,7 +398,8 @@ text/plain self.matches['addr_only'] = self._vte.match_add (lboundry + "(www|ftp)[" + hostchars + "]*\.[" + hostchars + ".]+(:[0-9]+)?(" + urlpath + ")?" + rboundry + "/?") 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) self.matches['nntp'] = self._vte.match_add (lboundry + '''news:[-A-Z\^_a-z{|}~!"#$%&'()*+,./0-9;:=?`]+@[-A-Za-z0-9.]+(:[0-9]+)?''' + rboundry) - self.matches['launchpad'] = self._vte.match_add ('\\bLP #[0-9]+\\b') + # if the url looks like a Launchpad changelog closure entry LP: #92953 - make it a url to http://bugs.launchpad.net + self.matches['launchpad'] = self._vte.match_add ('\\bLP:? #?[0-9]+\\b') def _path_lookup(self, command): if os.path.isabs (command): @@ -647,7 +648,8 @@ text/plain if (url[0][0:7] != "mailto:") & (url[1] == self.matches['email']): address = "mailto:" + url[0] elif url[1] == self.matches['launchpad']: - address = "https://bugs.launchpad.net/bugs/%s" % url[0][4:] + # the only part of 'launchpad' we need are the actual numbers for the bug + address = "https://bugs.launchpad.net/bugs/%s" % re.sub(r'[^0-9]+', '', url[0]) else: address = url[0] self.openurl ( address ) @@ -890,7 +892,8 @@ text/plain # Assume http address = "http://" + url[0] elif url[1] == self.matches['launchpad']: - address = "https://bugs.launchpad.net/bugs/%s" % url[0][4:] + # the only part of 'launchpad' we need are the actual numbers for the bug + address = "https://bugs.launchpad.net/bugs/%s" % re.sub(r'[^0-9]+', '', url[0]) else: address = url[0] nameopen = _("_Open Link")