summaryrefslogtreecommitdiff
path: root/bleach/callbacks.py
diff options
context:
space:
mode:
authorPer Andersson <avtobiff@gmail.com>2013-06-09 19:45:54 +0200
committerPer Andersson <avtobiff@gmail.com>2013-06-09 19:45:54 +0200
commitfac84c6d90e0875e6c1b10c5ef02d577ee008af4 (patch)
tree4080efdb87c814d5dc409e9e87aa449f4b273ff3 /bleach/callbacks.py
parent38dc3b8f231cf36bcc771001318556d9e84c2889 (diff)
downloadpython-bleach-upstream/1.2.2.tar
python-bleach-upstream/1.2.2.tar.gz
Imported Upstream version 1.2.2upstream/1.2.2
Diffstat (limited to 'bleach/callbacks.py')
-rw-r--r--bleach/callbacks.py15
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