Skip to main content

A Django template formatter.

Project description

https://img.shields.io/github/actions/workflow/status/adamchainz/djade/main.yml.svg?branch=main&style=for-the-badge https://img.shields.io/badge/Coverage-100%25-success?style=for-the-badge https://img.shields.io/pypi/v/djade.svg?style=for-the-badge https://img.shields.io/badge/code%20style-black-000000.svg?style=for-the-badge pre-commit
Any color you like, as long as it’s jade.

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

djade-0.1.0.tar.gz (19.4 kB view details)

Uploaded Source

Built Distributions

djade-0.1.0-py3-none-win_arm64.whl (802.8 kB view details)

Uploaded Python 3 Windows ARM64

djade-0.1.0-py3-none-win_amd64.whl (877.4 kB view details)

Uploaded Python 3 Windows x86-64

djade-0.1.0-py3-none-win32.whl (795.8 kB view details)

Uploaded Python 3 Windows x86

djade-0.1.0-py3-none-musllinux_1_1_x86_64.whl (1.2 MB view details)

Uploaded Python 3 musllinux: musl 1.1+ x86-64

djade-0.1.0-py3-none-musllinux_1_1_aarch64.whl (1.1 MB view details)

Uploaded Python 3 musllinux: musl 1.1+ ARM64

djade-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ x86-64

djade-0.1.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl (1.2 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ i686

djade-0.1.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.1 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ ARMv7l

djade-0.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ ARM64

djade-0.1.0-py3-none-macosx_11_0_arm64.whl (982.6 kB view details)

Uploaded Python 3 macOS 11.0+ ARM64

djade-0.1.0-py3-none-macosx_10_12_x86_64.whl (1.0 MB view details)

Uploaded Python 3 macOS 10.12+ x86-64

File details

Details for the file djade-0.1.0.tar.gz.

File metadata

  • Download URL: djade-0.1.0.tar.gz
  • Upload date:
  • Size: 19.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for djade-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3de993d826b191ade652e2ce19193ae45fbcc2e3327f54c49a69443c58ca31f0
MD5 df1a4f0ef9125ee80211f0f75c70e47d
BLAKE2b-256 da86db35ae2bfb57b94cfa98aa2c5463050c0ce82ded6e988e3d21ee7af09fe2

See more details on using hashes here.

File details

Details for the file djade-0.1.0-py3-none-win_arm64.whl.

File metadata

  • Download URL: djade-0.1.0-py3-none-win_arm64.whl
  • Upload date:
  • Size: 802.8 kB
  • Tags: Python 3, Windows ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for djade-0.1.0-py3-none-win_arm64.whl
Algorithm Hash digest
SHA256 16c9feefec5eabcb53be79f94e0ca99dfcc7d207256a986eca1754a76b3268d2
MD5 b3f865da399305d107feaee75e39524b
BLAKE2b-256 cca3335f0d124a7a9189719f2ddaa8f222e3fc45551da4deeb71e3b0d8618713

See more details on using hashes here.

File details

Details for the file djade-0.1.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: djade-0.1.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 877.4 kB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for djade-0.1.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 02496eeb99f470bfdc9908df9b92dbd2133b484df2c54935b3046c9fcc3713cf
MD5 27d5448d8de81096007cd4689ea1a067
BLAKE2b-256 61dab447968a5b4c485c440a92709bfff8409bef5b58e6c60096851e2cbc8a1a

See more details on using hashes here.

File details

Details for the file djade-0.1.0-py3-none-win32.whl.

File metadata

  • Download URL: djade-0.1.0-py3-none-win32.whl
  • Upload date:
  • Size: 795.8 kB
  • Tags: Python 3, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for djade-0.1.0-py3-none-win32.whl
Algorithm Hash digest
SHA256 a6050c444258e3ea0f08e765821c928dd54b2596cf50e41a1a6703528fefc430
MD5 9672a19e69295fb3a6bea0db9542c75f
BLAKE2b-256 1595d41a0ca0904f54e70bb8853b3d204992edf56eb9582446b1507f15048355

See more details on using hashes here.

File details

Details for the file djade-0.1.0-py3-none-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for djade-0.1.0-py3-none-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 d862eb09421346975f0f258ac75f30b2ec5b8de874422ffd0250c7016f62d01a
MD5 8d91a41381e49d6b7648fa5b96c124bf
BLAKE2b-256 173a9abe538a7b2430c85cb8a4d31143e8de3dbddd50a0e59e996ff4a53b86f4

See more details on using hashes here.

File details

Details for the file djade-0.1.0-py3-none-musllinux_1_1_aarch64.whl.

File metadata

File hashes

Hashes for djade-0.1.0-py3-none-musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 dc171c91bc22734fc5ac6f88d74a5226faf3423a52171313ccd2d6c74867bf25
MD5 7f0e4ed5090a49a5b9726d709ecc5cea
BLAKE2b-256 52a68508b4c337add04edac1c91840db216a1d5451ea7b9e14dbc2190b076462

See more details on using hashes here.

File details

Details for the file djade-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

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

See more details on using hashes here.

File details

Details for the file djade-0.1.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

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

See more details on using hashes here.

File details

Details for the file djade-0.1.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

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

See more details on using hashes here.

File details

Details for the file djade-0.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

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

See more details on using hashes here.

File details

Details for the file djade-0.1.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for djade-0.1.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b8274dd3cbaa8e2ea05659507a3eaefb6765bb5e2450e1e1500d9859aaf9fd17
MD5 25dc24581d3b2936d1e8a5236fdee20a
BLAKE2b-256 27ed4178a91bba66f705318884a25eba7f05bbe9369e84dc1dfe07087e972421

See more details on using hashes here.

File details

Details for the file djade-0.1.0-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for djade-0.1.0-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 1887cd11550cdc2ad399b3eab48f0f00e392e5c9d31824f53d512ccbe33acefc
MD5 222ef914b4bd5bd7fd4599660d32248d
BLAKE2b-256 6c5b4f229c4bdbc6a76f1c6e26ebda883cb5927664c020b0c248d5b501e698b2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page