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
File details
Details for the file django-smarty-0.1.3.tar.gz
.
File metadata
- Download URL: django-smarty-0.1.3.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54caad77846c101f9e354b55db7e901e2d56a889d94309ebd794ff66356c9734 |
|
MD5 | 02cd74da2740e9e2d6655a1ec8600342 |
|
BLAKE2b-256 | 22ef24ad1262e1a4b308e7e5b69e758b9d70a81d9bf5828ad38b6a231413733f |
File details
Details for the file django_smarty-0.1.3-py2.py3-none-any.whl
.
File metadata
- Download URL: django_smarty-0.1.3-py2.py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2664f03a62e3db7a94f6e05f1f2fc49f69b492d5bdd5a7e1c80a6b58a69b6071 |
|
MD5 | 2c1786bd2d64daaacb8a489608e93293 |
|
BLAKE2b-256 | cbe638e898f5aa393e5a5dbccc729bffd3a90de4c0582d7292879b890b4b07df |