Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
3 tasks done
eilmiv opened this issue Aug 7, 2023 · 2 comments
Labels

Comments

@eilmiv
Copy link

eilmiv commented Aug 7, 2023

System Info

  • OS: ubuntu 22.04
  • Python Version 3.10.12
  • djLint Version 1.32.1
  • template language: Django

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.

@eilmiv eilmiv added 🦠 bug Something isn't working 🧽 formatter labels Aug 7, 2023
@welcome
Copy link

welcome bot commented Aug 7, 2023

Thanks for opening your first issue here!

christopherpickering pushed a commit that referenced this issue Sep 18, 2023
# [1.33.0](v1.32.1...v1.33.0) (2023-09-18)

### Bug Fixes

* **formatter:** fixed extra breaks added around html tags inside template tags ([6091ffb](6091ffb)), closes [#742](#742)
* **formatter:** fixed extra indend in script tags ([9d04d51](9d04d51)), closes [#733](#733)
* **formatter:** fixed formatting on functions that used python keywords as the param name ([183a7c0](183a7c0)), closes [#756](#756)
* **h033:** fix rull to not match data-action ([f6881e0](f6881e0))
* **linter:** fixed false positive on DJ018 ([78d81dc](78d81dc)), closes [#755](#755)

### Features

* **formatter:** added support for nunjucks async loop tags ([5a32bb3](5a32bb3))
@christopherpickering
Copy link
Contributor

🎉 This issue has been resolved in version 1.33.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants