djLint icon indicating copy to clipboard operation
djLint copied to clipboard

[BUG] [Formatter] Template Variable in HTML Attribute gets formatted to multi-lines

Open nitsujri opened this issue 9 months ago • 0 comments

System Info

  • OS: osx 15.3 M1
  • Python Version (3.12.8)
  • djLint Version (1.36.4)
  • template language: e.g. Django standard

Issue

Latest formatter breaks up html attributes if there is a Template Variable {{ }} i.e. data-{{st_controller}}-target

How To Reproduce

input:

     <input type="file" name="file" class="d-none" data-{{ st_controller }}-target= "documentFile" multiple />

output:

    <input type="file"
           name="file"
           class="d-none"
           data-
           {{ st_controller }}
           -target="documentFile"
           multiple />

expected:

    <input type="file"
           name="file"
           class="d-none"
           data-{{ st_controller }}-target="documentFile"
           multiple />

Specifically data-{{st_controller}}-target needs to remain on one line.

nitsujri avatar Mar 12 '25 23:03 nitsujri