djLint icon indicating copy to clipboard operation
djLint copied to clipboard

[BUG] [Linter] Cache is not among default block tags

Open PetrDlouhy opened this issue 3 months ago • 0 comments

System Info

  • OS: e.g. ubuntu 23.10
  • Python Version: Python 3.11.6
  • djLint Version: djlint, version 1.34.1
  • profile: django

Issue

djlint is not treating cache as block tag:

<body>
    {% block top_navbar %}
        {% cache 600 %}
        {% endcache %}
    {% endblock top_navbar %}
</body>

Would be reformated by djlint blenderhub/templates/base.html --reformat --profile=django to:

<body>
    {% block top_navbar %}
        {% cache 600 %}
    {% endcache %}
{% endblock top_navbar %}
</body>

The {% cache %} is official Django block tag: https://docs.djangoproject.com/en/5.0/topics/cache/

How To Reproduce

See above. With settings custom_blocks="cache" the reformat works as expected.j

Contents of .djlintrc/pyproject.toml [tool.djlint]

[tool.djlint]
profile="django"
# custom_blocks="cache"

PetrDlouhy avatar Mar 29 '24 10:03 PetrDlouhy