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] Quote removed unexpectedly from HTML attribute #652

Closed
3 tasks done
du-song opened this issue May 18, 2023 · 3 comments
Closed
3 tasks done

[BUG] [Formatter] Quote removed unexpectedly from HTML attribute #652

du-song opened this issue May 18, 2023 · 3 comments
Labels

Comments

@du-song
Copy link

du-song commented May 18, 2023

System Info

  • OS: macOS 13
  • Python Version (python --version) 3.10.8
  • djLint Version (djlint --version) djlint, version 1.27.2
  • template language: Django

Issue

as seen below, a double quote at the end of first line was removed unexpectedly

How To Reproduce

$ cat test.html
<a {% if piece.owner == request.user %} class="disabled {% if not piece.like_count %}hidden{% endif %}"
   {% else %}
   hx-post="x"
   {% endif %}>
    test
    {% if piece.like_count %}<span>{{ piece.like_count }}</span>{% endif %}
</a>
$ djlint --reformat test.html

Reformatting 1/1 files  ━ 00:00

test.html
──
@@ -1,4 +1,4 @@

-<a {% if piece.owner == request.user %} class="disabled {% if not piece.like_count %}hidden{% endif %}"
+<a {% if piece.owner == request.user %} class="disabled {% if not piece.like_count %}hidden{% endif %}
    {% else %}
    hx-post="x"
    {% endif %}>

1 file was updated.
@du-song du-song added 🦠 bug Something isn't working 🧽 formatter labels May 18, 2023
@welcome
Copy link

welcome bot commented May 18, 2023

Thanks for opening your first issue here!

@christopherpickering
Copy link
Contributor

Thanks @freewizard - unmatched quotes (ie quotes alone outside a template statement) were being dropped. I'm going to release an update that keeps them. Thanks!

christopherpickering pushed a commit that referenced this issue Jun 12, 2023
# [1.31.0](v1.30.2...v1.31.0) (2023-06-12)

### Bug Fixes

* **formatter:** fixed `line_break_after_multiline_tag` to force break in all cases ([3b37ec8](3b37ec8)), closes [#680](#680)
* **formatter:** fixed isolated quotes being deleted from attributes ([19425f9](19425f9)), closes [#652](#652)
* **formatter:** fixed wild match on template tags ([d288b78](d288b78)), closes [#686](#686)
* **linter:** fixed false positive on t001 ([1caf4c4](1caf4c4)), closes [#606](#606)

### Features

* **formatter:** added `max-blank-lines` flag to consolidate blank lines ([4a7897f](4a7897f)), closes [#675](#675)
* **formatter:** added support for symphony forms ([e716ddc](e716ddc)), closes [#476](#476)
@christopherpickering
Copy link
Contributor

🎉 This issue has been resolved in version 1.31.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