A Django template filter to convert ASCII punctuation into typographic punctuation HTML entities.
Project description
Django Smarty is a Django template filter application to convert ASCII punctuation characters into smart typographic punctuation HTML entities with SmartyPants. Uses the Python smartypants package.
Install
$ pipenv install django-smarty
Add to settings.py.
INSTALLED_APPS = [
# ...
'smarty',
]
Usage
{% load smarty_tags %}
{{ post.body|smarty }}
Result:
“Hello—world!”
Settings
smarty is a filter composed of several smaller filters:
smartypants is the original SmartyPants
smartycaps wraps capital letters in <span class="initialism"></span>
One can apply any filter individually. For example, if one preferred the original SmartyPants, write {{ post.body|smartypants }}.
One can customize the application and order of smarty filters with the SMARTY_FILTERS setting. By default, the SMARTY_FILTERS setting is:
SMARTY_FILTERS = [
'smartypants',
'smartycaps',
]
One can also customize the HTML class of smartycaps with the SMARTY_CAPS_CLASS setting. By default, the SMARTY_CAPS_CLASS setting is:
SMARTY_CAPS_CLASS = 'initialism'
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_smarty-0.1.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9bec93aa8fdbf84cca5348cc400af03426688aa7c5ca0908c9e063308643b390 |
|
MD5 | 751823c4bcbd8fab2ca6317c451c7c76 |
|
BLAKE2b-256 | 06cc566b380290dd71f38c14e094d05a8342c07294b4d8a9bfe64121e06e8da4 |