better gluon/contrib/autolinks.py (still not sure this is behavior I want)

This commit is contained in:
Massimo Di Pierro
2012-05-03 18:48:30 -05:00
parent f69af10885
commit ecc5ae10e1
2 changed files with 2 additions and 2 deletions

View File

@@ -1 +1 @@
Version 1.99.7 (2012-05-03 17:55:38) dev
Version 1.99.7 (2012-05-03 18:48:09) dev

View File

@@ -158,7 +158,7 @@ def expand_one(url,cdict):
def expand_html(html,cdict=None):
soup = BeautifulSoup(html)
for txt in soup.findAll(text=True):
if txt.parent.name != 'a':
if not txt.parent.name in ('a','script','pre','code','embed','object','audio','video'):
ntxt = regex_link.sub(
lambda match: expand_one(match.group(0),cdict), txt)
txt.replaceWith(BeautifulSoup(ntxt))