mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-06 13:11:15 -07:00
Add bleach library to clean notification HTML
This commit is contained in:
parent
f001e19728
commit
453c46df00
4 changed files with 631 additions and 0 deletions
20
lib/bleach/callbacks.py
Normal file
20
lib/bleach/callbacks.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
"""A set of basic callbacks for bleach.linkify."""
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
def nofollow(attrs, new=False):
|
||||
if attrs['href'].startswith('mailto:'):
|
||||
return attrs
|
||||
rel = [x for x in attrs.get('rel', '').split(' ') if x]
|
||||
if 'nofollow' not in [x.lower() for x in rel]:
|
||||
rel.append('nofollow')
|
||||
attrs['rel'] = ' '.join(rel)
|
||||
|
||||
return attrs
|
||||
|
||||
|
||||
def target_blank(attrs, new=False):
|
||||
if attrs['href'].startswith('mailto:'):
|
||||
return attrs
|
||||
attrs['target'] = '_blank'
|
||||
return attrs
|
Loading…
Add table
Add a link
Reference in a new issue