A Django template formatter.
Project description
A Django template formatter.
Improve your Django and Git skills with my books.
Installation
Use pip:
python -m pip install djade
Python 3.8 to 3.13 supported.
Usage
djade is a commandline tool that rewrites files in place. Run it on a file to modify it:
djade templates/index.html
Djade implements some rules listed in the Django contribution style guide’s template style section:
One space around variables and tags:
-{{egg}} +{{ egg }} -{% crack egg %} +{% crack egg %}
Add labels to {% endblock %} tags that aren’t on the same line as their opening {% block %} tag:
{% block shell %} ... -{% endblock %} +{% endblock shell %}
In {% load %} tags, alphabetically sort libraries:
-{% load omelette frittata %} +{% load friattata omelette %}
Djade also implements some extra rules:
Leading empty lines are removed:
- {% extends 'white.html' %} ...
Trailing empty lines are removed, and a trailing newline inserted if necessary:
... {% endblock content %} - -
One space around comment tags:
-{#egg#} +{# egg #}
Remove labels from {% endblock %} tags on the same line as their opening {% block %} tag:
-{% block shell %}...{% endblock shell %} +{% block shell %}...{% endblock %}
Merge consecutive {% load %} tags:
-{% load omelette %} - -{% load frittata %} +{% load frittata omelette %}
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 Distributions
Hashes for djade-0.1.0-py3-none-win_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16c9feefec5eabcb53be79f94e0ca99dfcc7d207256a986eca1754a76b3268d2 |
|
MD5 | b3f865da399305d107feaee75e39524b |
|
BLAKE2b-256 | cca3335f0d124a7a9189719f2ddaa8f222e3fc45551da4deeb71e3b0d8618713 |
Hashes for djade-0.1.0-py3-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02496eeb99f470bfdc9908df9b92dbd2133b484df2c54935b3046c9fcc3713cf |
|
MD5 | 27d5448d8de81096007cd4689ea1a067 |
|
BLAKE2b-256 | 61dab447968a5b4c485c440a92709bfff8409bef5b58e6c60096851e2cbc8a1a |
Hashes for djade-0.1.0-py3-none-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d862eb09421346975f0f258ac75f30b2ec5b8de874422ffd0250c7016f62d01a |
|
MD5 | 8d91a41381e49d6b7648fa5b96c124bf |
|
BLAKE2b-256 | 173a9abe538a7b2430c85cb8a4d31143e8de3dbddd50a0e59e996ff4a53b86f4 |
Hashes for djade-0.1.0-py3-none-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc171c91bc22734fc5ac6f88d74a5226faf3423a52171313ccd2d6c74867bf25 |
|
MD5 | 7f0e4ed5090a49a5b9726d709ecc5cea |
|
BLAKE2b-256 | 52a68508b4c337add04edac1c91840db216a1d5451ea7b9e14dbc2190b076462 |
Hashes for djade-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e159714e608c0c299be86e76f01c4560597795aa0e435e59aa8510ea43ef8804 |
|
MD5 | b2c2d76c98f1a9689990d8bb9714a76d |
|
BLAKE2b-256 | e0bcd45661470254a5de13b53ee4b3f53881bf8793d0b17a0b4ac4c9fae5191f |
Hashes for djade-0.1.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1cf624c31ce5a48db2b5057cf4731b062cf6604e2d3f3184ab2a0d6154fa0370 |
|
MD5 | cccb6775416fe46497ee547c9ef2661a |
|
BLAKE2b-256 | 808e81f09ba65e81a5234d43bfab8c7c7e17470a1b0273c3b18f2908327cc93e |
Hashes for djade-0.1.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51f21e06d33a979464dedee0a19c921cf374f3f60b888902d94ff62a9a029fb8 |
|
MD5 | b72cda581a57dc4caff91beed8e0c098 |
|
BLAKE2b-256 | 23d48a02bcd9b8ac4607d3e2a638ace4e75b6e5d53b2202e24be278333bc1f26 |
Hashes for djade-0.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa80cf21cb36f5dfb189aa1dc86281f4feb05931ea85bc350bed833f4b0f4151 |
|
MD5 | 4d92b70d86b9ce8a3bb4a1870db8db1b |
|
BLAKE2b-256 | c771867dc77041053d866a97cf78c9d508484c182b91c5ad409e392c33e98d5c |
Hashes for djade-0.1.0-py3-none-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b8274dd3cbaa8e2ea05659507a3eaefb6765bb5e2450e1e1500d9859aaf9fd17 |
|
MD5 | 25dc24581d3b2936d1e8a5236fdee20a |
|
BLAKE2b-256 | 27ed4178a91bba66f705318884a25eba7f05bbe9369e84dc1dfe07087e972421 |
Hashes for djade-0.1.0-py3-none-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1887cd11550cdc2ad399b3eab48f0f00e392e5c9d31824f53d512ccbe33acefc |
|
MD5 | 222ef914b4bd5bd7fd4599660d32248d |
|
BLAKE2b-256 | 6c5b4f229c4bdbc6a76f1c6e26ebda883cb5927664c020b0c248d5b501e698b2 |