Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: sitescripts/templateFilters.py

Issue 4786120848048128: Issue 224 - Links to `Issue ###` in dev build changelogs should link to issues.adblockplus.org (Closed)
Patch Set: Created April 15, 2014, 10:21 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « .hgsubstate ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sitescripts/templateFilters.py
===================================================================
--- a/sitescripts/templateFilters.py
+++ b/sitescripts/templateFilters.py
@@ -84,29 +84,31 @@ def formatBugLinks(value):
def addLink(match):
linkApp = match.group(1)
if linkApp != None:
linkApp = linkApp.lower()
linkType = match.group(2).lower()
linkNum = int(match.group(3))
if linkType == 'topic':
link = 'https://adblockplus.org/forum/viewtopic.php?t=%i' % linkNum
+ elif linkApp == None and linkType == 'issue':
+ link = 'https://issues.adblockplus.org/ticket/%i' % linkNum
elif linkApp == 'webkit':
link = 'https://bugs.webkit.org/show_bug.cgi?id=%i' % linkNum
elif linkApp != None:
link = 'http://code.google.com/p/chromium/issues/detail?id=%i' % linkNum
- elif linkNum > 100000:
+ else:
link = 'https://bugzilla.mozilla.org/show_bug.cgi?id=%i' % linkNum
- else:
- link = 'https://www.mozdev.org/bugs/show_bug.cgi?id=%i' % linkNum
return '<a href="%s">%s</a>' % (link, match.group(0))
- regexp = re.compile(r'(?:\b(WebKit|Chrome|Chromium)\s+)?\b(bug|issue|topic)\s+(\d+)', re.I | re.U)
+ regexp = re.compile(r'(https?://\S+?)([.,:;!?"\']?(?:\s|$))', re.I | re.U)
+ regexp2 = re.compile(r'(?:\b(WebKit|Chrome|Chromium)\s+)?\b(bug|issue|topic)\s+(\d+)', re.I | re.U)
value = unicode(Markup.escape(value))
- value = re.sub(regexp, addLink, value)
+ value = re.sub(regexp, r'<a href="\1">\1</a>\2', value);
+ value = re.sub(regexp2, addLink, value)
return Markup(value)
def urlencode(value):
return urllib.quote(value.encode('utf-8'), '')
def subscriptionSort(value, prioritizeRecommended=True):
value = value[:] # create a copy of the list
if prioritizeRecommended:
« no previous file with comments | « .hgsubstate ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld