A Django template filter to convert HTML literals into named, decimal, or hexadecimal forms
Project description
Django Evade is a Django template filter application to pseudo-randomly convert literal HTML characters into equivalent named, numeric, or hexadecimal HTML character entity references.
Useful for obscuring mailto hyperlinks to prevent spammers from collecting e-mail addresses. Inspired by a Django snippet, but rewritten to use the Format Specification Mini-Language. The result is a more severe form of escape, leading to the name “evade.”
Install
$ pip install django-evade
Add to settings.py.
INSTALLED_APPS = [
# ...
"evade",
]
Usage
{% load evade_tags %}
{{ "me@example.com"|evade }}
One possible result:
me@example.com
Note the use of named (@), decimal (p), hexadecimal lowercase (m), and hexadecimal uppercase (l) forms, and the varying length of zero fills (m, e). Each character entity reference is pseudo-randomized.
Can also be imported as a standalone Python module:
>>> from evade import evade
>>> evade("©")
'©'
>>> evade("©")
'©'
>>> evade("©")
'©'
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django_evade-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 292aaee8b3120eee741ddac3c58e4e02f817d6d7d2c650f46f0b94280985131b |
|
MD5 | 4e61a712abdc5356ae7e1bd8eee105fe |
|
BLAKE2b-256 | af11f6708d7de020dccf8809b2d7a56b131e301aa42794f663181a0062b8aa8d |