diff options
Diffstat (limited to 'bleach/callbacks.py')
-rw-r--r-- | bleach/callbacks.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/bleach/callbacks.py b/bleach/callbacks.py new file mode 100644 index 0000000..cc4682d --- /dev/null +++ b/bleach/callbacks.py @@ -0,0 +1,15 @@ +"""A set of basic callbacks for bleach.linkify.""" + + +def nofollow(attrs, new=False): + if attrs['href'].startswith('mailto:'): + return attrs + attrs['rel'] = 'nofollow' + return attrs + + +def target_blank(attrs, new=False): + if attrs['href'].startswith('mailto:'): + return attrs + attrs['target'] = '_blank' + return attrs |