Increase of possible matches for LP bug numbers as URLs

This commit is contained in:
Brian Murray 2008-12-13 21:13:25 -08:00
parent 75194f24cd
commit 9e6d8191ac
1 changed files with 6 additions and 3 deletions

View File

@ -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['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['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['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): def _path_lookup(self, command):
if os.path.isabs (command): if os.path.isabs (command):
@ -647,7 +648,8 @@ text/plain
if (url[0][0:7] != "mailto:") & (url[1] == self.matches['email']): if (url[0][0:7] != "mailto:") & (url[1] == self.matches['email']):
address = "mailto:" + url[0] address = "mailto:" + url[0]
elif url[1] == self.matches['launchpad']: 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: else:
address = url[0] address = url[0]
self.openurl ( address ) self.openurl ( address )
@ -890,7 +892,8 @@ text/plain
# Assume http # Assume http
address = "http://" + url[0] address = "http://" + url[0]
elif url[1] == self.matches['launchpad']: 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: else:
address = url[0] address = url[0]
nameopen = _("_Open Link") nameopen = _("_Open Link")