Commit 30d4c75b authored by Remi Rampin's avatar Remi Rampin

Show original href as 'title' for disabled links

parent 67bab72d
Pipeline #65597160 failed with stage
in 1 minute and 59 seconds
......@@ -95,7 +95,11 @@ def get_html_body(body):
if not (href.startswith('http://') or
href.startswith('https://') or
href.startswith('mailto:')):
e.attrs['title'] = e.attrs['href']
del e.attrs['href']
else:
if 'title' in e.attrs:
del e.attrs['title']
# Back to string
body = str(soup)
del soup
......@@ -107,7 +111,7 @@ def get_html_body(body):
'h1', 'h2', 'h3', 'h4', 'h5',
'strong', 'em', 'b', 'u',
'ul', 'ol', 'li'],
attributes={'a': ['href'], 'img': ['src', 'width', 'height']},
attributes={'a': ['href', 'title'], 'img': ['src', 'width', 'height']},
strip=True,
)
......
Markdown is supported
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