Commit e871ddf5 authored by Nicolas Joyard's avatar Nicolas Joyard
Browse files

Fix social nickname extraction

parent 54b19a1f
......@@ -10,23 +10,23 @@ link = '<a class="{network}-link" href="{url}" target="_blank">{label}</a>'
def twitter_link(url):
return mark_safe(link.format(network='twitter', url=url,
label=re.sub(r'.*/@?([^/]+)', '@\\1', url)))
label=re.sub(r'.*/@?([^/]+)', '@\\1', re.sub(r'/$', '', url.strip()))))
def facebook_link(url):
return mark_safe(link.format(network='facebook', url=url,
label=re.sub(r'.*/([^/]+)', '\\1', url)))
label=re.sub(r'.*/([^/]+)', '\\1', re.sub(r'/$', '', url.strip()))))
def website_link(url):
short_url = re.sub(r'^https?://([^/]+).*', '\\1', url)
return mark_safe(link.format(network='website', url=url,
def email_link(address):
return mark_safe(link.format(network='email', url='mailto:%s' % address,
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment