2 from django.utils.html import escape
3 from django.utils.safestring import mark_safe
4 from django.utils.translation import ugettext as _
5 from django import template
7 register = template.Library()
11 def email_link(email):
12 email_safe = escape(email)
14 name, domain = email_safe.split('@', 1)
19 dot = escape(_('dot'))
20 mangled = "%s %s %s" % (name, at, (' %s ' % dot).join(domain.split('.')))
21 return mark_safe("<a class='mangled' data-addr1='%(name)s' "
22 "data-addr2='%(domain)s'>%(mangled)s</a>" % {
23 'name': codecs.encode(name, 'rot13'),
24 'domain': codecs.encode(domain, 'rot13'),