djlint / djLint

✨ HTML Template Linter and Formatter. Django - Jinja - Nunjucks - Handlebars - GoLang
https://djLint.com
GNU General Public License v3.0
686 stars 84 forks source link

[BUG] [Formatter] Infinite indentation when right arrow (-->) occurs in JavaScript in Django template #733

Closed eilmiv closed 1 year ago

eilmiv commented 1 year ago

System Info

Issue

If there is JavaScript in a Django template block that contains "-->" in a string or comment, all JavaScript lines below the line that contains "-->" are indented always one more level when running djlint --reformat on the file.

How To Reproduce

Create file djlint_error.html with the following contents:

{% block script %}
  <script>
    let arrow = "-->";
                    let on_the_move = 1;
                    let just_following_the_sign = 2;
  </script>
{% endblock %}

Run djlint --reformat djlint_error.html and the lines with on_the_move and just_following_the_sign get even more indented.

welcome[bot] commented 1 year ago

Thanks for opening your first issue here!

christopherpickering commented 1 year ago

:tada: This issue has been resolved in version 1.33.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: