djLint icon indicating copy to clipboard operation
djLint copied to clipboard

[BUG] [Formatter] Incorrect indentation around `timezone` tags

Open samamorgan opened this issue 11 months ago • 2 comments

System Info

  • macOS Sonoma 14.2.1
  • Python 3.10.11
  • djLint 1.34.1
  • template language: Django

Issue

The formatter incorrectly indents around timezone tags.

How To Reproduce

The following code pasted into a template

<div>
  <div>
    {% timezone object.zone_info %}
      <p>{% now "F jS, Y h:i A e" %}</p>
    {% endtimezone %}
  </div>
</div>

Indents like so

<div>
  <div>
    {% timezone object.zone_info %}
    <p>{% now "F jS, Y h:i A e" %}</p>
  {% endtimezone %}
</div>
</div>

samamorgan avatar Mar 04 '24 16:03 samamorgan

Note: I was able to resolve this by adding custom_blocks = "timezone" to pyproject, but this is a Django feature and should be internally recognized by djlint

samamorgan avatar Mar 04 '24 16:03 samamorgan

@samamorgan I am having the same issue with blocktrans, but setting custom_blocks = "blocktrans" doesn't do anything for me. Is it the same for you?

SilvanVerhoeven avatar Aug 04 '24 20:08 SilvanVerhoeven