autolink emails
This commit is contained in:
2
VERSION
2
VERSION
@@ -1 +1 @@
|
||||
Version 2.8.2-stable+timestamp.2013.12.15.22.22.52
|
||||
Version 2.8.2-stable+timestamp.2013.12.16.21.55.21
|
||||
|
||||
@@ -159,6 +159,8 @@ def extension(url):
|
||||
|
||||
def expand_one(url, cdict):
|
||||
# try ombed but first check in cache
|
||||
if '@' in url and not '://'in url:
|
||||
return '<a href="mailto:%s">%s</a>' % (url, url)
|
||||
if cdict and url in cdict:
|
||||
r = cdict[url]
|
||||
else:
|
||||
|
||||
@@ -551,7 +551,7 @@ regex_list=re.compile('^(?:(?:(#{1,6})|(?:(\.+|\++|\-+)(\.)?))\s*)?(.*)$')
|
||||
regex_bq_headline=re.compile('^(?:(\.+|\++|\-+)(\.)?\s+)?(-{3}-*)$')
|
||||
regex_tq=re.compile('^(-{3}-*)(?::(?P<c>[a-zA-Z][_a-zA-Z\-\d]*)(?:\[(?P<p>[a-zA-Z][_a-zA-Z\-\d]*)\])?)?$')
|
||||
regex_proto = re.compile(r'(?<!["\w>/=])(?P<p>\w+):(?P<k>\w+://[\w\d\-+=?%&/:.]+)', re.M)
|
||||
regex_auto = re.compile(r'(?<!["\w>/=])(?P<k>\w+://[\w\d\-+_=?%&/:.,;#]+\w)',re.M)
|
||||
regex_auto = re.compile(r'(?<!["\w>/=])(?P<k>\w+://[\w\d\-+_=?%&/:.,;#]+\w|[\w\-.]+@[\w\-.]+)',re.M)
|
||||
regex_link=re.compile(r'('+LINK+r')|\[\[(?P<s>.+?)\]\]',re.S)
|
||||
regex_link_level2=re.compile(r'^(?P<t>\S.*?)?(?:\s+\[(?P<a>.+?)\])?(?:\s+(?P<k>\S+))?(?:\s+(?P<p>popup))?\s*$',re.S)
|
||||
regex_media_level2=re.compile(r'^(?P<t>\S.*?)?(?:\s+\[(?P<a>.+?)\])?(?:\s+(?P<k>\S+))?\s+(?P<p>img|IMG|left|right|center|video|audio|blockleft|blockright)(?:\s+(?P<w>\d+px))?\s*$',re.S)
|
||||
@@ -648,7 +648,9 @@ def autolinks_simple(url):
|
||||
image, video or audio tag
|
||||
"""
|
||||
u_url=url.lower()
|
||||
if u_url.endswith(('.jpg','.jpeg','.gif','.png')):
|
||||
if '@' in url and not '://' in url:
|
||||
return '<a href="mailto:%s">%s</a>' % (url, url)
|
||||
elif u_url.endswith(('.jpg','.jpeg','.gif','.png')):
|
||||
return '<img src="%s" controls />' % url
|
||||
elif u_url.endswith(('.mp4','.mpeg','.mov','.ogv')):
|
||||
return '<video src="%s" controls></video>' % url
|
||||
@@ -673,6 +675,9 @@ def protolinks_simple(proto, url):
|
||||
return '<img style="width:100px" src="http://chart.apis.google.com/chart?cht=qr&chs=100x100&chl=%s&choe=UTF-8&chld=H" alt="QR Code" title="QR Code" />'%url
|
||||
return proto+':'+url
|
||||
|
||||
def email_simple(email):
|
||||
return '<a href="mailto:%s">%s</a>' % (email, email)
|
||||
|
||||
def render(text,
|
||||
extra={},
|
||||
allowed={},
|
||||
|
||||
Reference in New Issue
Block a user