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