autolink expand_one now does unicode
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 2.00.0 (2012-07-31 10:47:18) dev
|
Version 2.00.0 (2012-07-31 11:22:34) dev
|
||||||
|
|||||||
+11
-10
@@ -145,18 +145,19 @@ def expand_one(url,cdict):
|
|||||||
r = oembed(url)
|
r = oembed(url)
|
||||||
# if oembed service
|
# if oembed service
|
||||||
if 'html' in r:
|
if 'html' in r:
|
||||||
if r['html'].startswith('<object'):
|
html = r['html'].encode('utf8')
|
||||||
return '<embed style="max-width:100%%">%s</embed>' % r['html']
|
if html.startswith('<object'):
|
||||||
|
return '<embed style="max-width:100%%">%s</embed>' % html
|
||||||
else:
|
else:
|
||||||
return r['html']
|
return html
|
||||||
elif 'url' in r:
|
elif 'url' in r:
|
||||||
url = r['url']
|
url = r['url'].encode('utf8')
|
||||||
# embed images, video, audio files
|
# embed images, video, audio files
|
||||||
ext = extension(url)
|
ext = extension(url)
|
||||||
if ext in EXTENSION_MAPS:
|
if ext in EXTENSION_MAPS:
|
||||||
return EXTENSION_MAPS[ext](url)
|
return EXTENSION_MAPS[ext](url)
|
||||||
# else regular link
|
# else regular link
|
||||||
return '<a href="%(u)s">%(u)s</a>' % dict(u=url)
|
return '<a href="%(u)s">%(u)s</a>' % dict(u=url)
|
||||||
|
|
||||||
def expand_html(html,cdict=None):
|
def expand_html(html,cdict=None):
|
||||||
soup = BeautifulSoup(html)
|
soup = BeautifulSoup(html)
|
||||||
|
|||||||
Reference in New Issue
Block a user