Skip to content

Commit

Permalink
Support periods in tags.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Kelly authored and rehandalal committed Aug 16, 2012
1 parent d8e3a6d commit d217bca
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions standup/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,26 +374,28 @@ def set_target(attrs, new=False):
attrs['target'] = '_blank'
return attrs

update = clean(update)
update = re.sub(r'(bug) #?(\d+)',
formatted = clean(update)
formatted = re.sub(r'(bug) #?(\d+)',
r'<a href="http://bugzilla.mozilla.org/show_bug.cgi?id=\2">\1 \2</a>',
update, flags=re.I)
formatted, flags=re.I)

if project and project.repo_url:
update = re.sub(r'(pull) #?(\d+)',
r'<a href="%s/pull/\2">\1 \2</a>' % project.repo_url, update,
formatted = re.sub(r'(pull) #?(\d+)',
r'<a href="%s/pull/\2">\1 \2</a>' % project.repo_url, formatted,
flags=re.I)

tags = re.findall(r'(?:^|[^\w\\/])#([a-zA-Z0-9_-]+)(?:\b|$)', update)
formatted = linkify(formatted, target='_blank')

# Search for tags on the original, unformatted string.
tags = re.findall(r'(?:^|[^\w\\/])#([a-zA-Z0-9_\.-]+)(?:\b|$)', update)
if tags:
tags_html = ''
for tag in tags:
tags_html = '{0} <span class="tag tag-{1}">{1}</span>'.format(
tags_html, tag)
update = '%s %s' % (tags_html, update)
formatted = '%s %s' % (tags_html, formatted)

update = linkify(update, target='_blank')
return update
return formatted


@app.context_processor
Expand Down

0 comments on commit d217bca

Please sign in to comment.