Skip to main content

django-whiteless

Django template tags which deal with pesky whitespaces!

CircleCI

  • Django 2.x and 3.x
  • Python 3.7, 3.8, 3.9

Installation

Install the latest version from PyPI:

$ pip install django-whiteless

Add "whiteless" to INSTALLED_APPS:

INSTALLED_APPS = (
    # ...
    "whiteless",
)

Usage

The library consists of two template tags, {% whiteless %} and {% eof %}. This is how you use them.

Remove all whitespaces

{% whiteless %}
    ...
{% endwhiteless %}

Remove leading whitespaces

{% whiteless leading %}
    ...
{% endwhiteless %}

Remove trailing whitespaces

{% whiteless trailing %}
    ...
{% endwhiteless %}

Remove leading and trailing whitespaces

{% whiteless leading trailing %}
    ...
{% endwhiteless %}

Replace whitespaces with a single space

{% whiteless space %}
    ...
{% endwhiteless %}

Note that if there are leading or trailing whitespaces in the block, those will also be replaced by a single space. In order to remove leading and trailing whitespaces and replace all other whitespaces with a single space, use:

{% whiteless space leading trailing %}
    ...
{% endwhiteless %}

Remove trailing whitespaces at end of file

Hello there!{% eof %}

This is useful if e.g. your project style guide requires all files to end with a newline but that causes issues with your template.

Note that {% eof %} cannot be used inside other tags. It only removes whitespaces that immediately follow itself.

Development

$ poetry shell
$ poetry install
$ pre-commit install  # install git hooks
$ tox  # run tests

License

MIT

Metadata

Release files for django-whiteless 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-whiteless 1.0.0
File Size Uploaded Provenance
django-whiteless-1.0.0.tar.gz 4.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-whiteless 1.0.0
File Interpreter ABI Platform
django_whiteless-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.3 kB

Release files / django-whiteless-1.0.0.tar.gz

Download URL django-whiteless-1.0.0.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
940655f8d8adda47db7c086f32ae7ed8be7bb67efefa04abf47b7a53e5f293a5
BLAKE2b-256 checksum
How to use checksums
7234b59e5c512b67b6efdd1ca06f95fbde89dd7848dfc6cdd9e7793eb5180107
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.6 CPython/3.9.3 Darwin/20.4.0

Release files / django_whiteless-1.0.0-py3-none-any.whl

Download URL django_whiteless-1.0.0-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1787ae27e15499f1eac7b380e5c4af45fc70364b9f15c85e0acb524f95413f76
BLAKE2b-256 checksum
How to use checksums
374a1c64704aa2ce10d19f142146c84a6ae4a86d7283948a0df157aee8425853
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.6 CPython/3.9.3 Darwin/20.4.0

Security for django-whiteless 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page