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] Whitespaces in Jinja Code #287

Closed
3 tasks done
sr-verde opened this issue Jul 8, 2022 · 4 comments
Closed
3 tasks done

[BUG] [Formatter] Whitespaces in Jinja Code #287

sr-verde opened this issue Jul 8, 2022 · 4 comments

Comments

@sr-verde
Copy link

sr-verde commented Jul 8, 2022

System Info

  • OS: Linux 5.18.9-arch1-1
  • Python Version: 3.10.5
  • djLint Version: 1.6.0
  • template language: Jinja2

Issue

Jinja code with list and tuples with whitespaces are not reformatted consistently.
I know, one can interpret that as a bug or as a feature request.

How To Reproduce

Try to reformat this file:

{% set table_keys = [ ( "date_started", "Start date"), ( "name", "Name" )] %}

I would expect no whitespaces within the tuple definition:

{% set table_keys = [("date_started", "Start date"), ("name", "Name")] %}

But djlint does not reformat this file in any way.

Notes

Thank you and all contributors for this awesome project!

@sr-verde sr-verde added 🦠 bug Something isn't working 🧽 formatter labels Jul 8, 2022
@christopherpickering
Copy link
Contributor

Thanks! Currently the contents of {% tags %} are not changed. I'm going to change this to a feature request - once we switch to the template parser (instead of regex and line splitting) I think it will be easily doable.

@christopherpickering christopherpickering added 🚂 enhancement New feature or request and removed 🦠 bug Something isn't working labels Jul 8, 2022
@christopherpickering
Copy link
Contributor

#168

christopherpickering pushed a commit that referenced this issue May 8, 2023
## [1.25.1](v1.25.0...v1.25.1) (2023-05-08)

### Bug Fixes

* **js indent:** fixed an issue where literal strings were double indented ([b1e8ab2](b1e8ab2)), closes [#614](#614)
* **set:** added formatting of json/list style set contents ([85aca4c](85aca4c)), closes [#287](#287) [#518](#518) [#370](#370)
@christopherpickering
Copy link
Contributor

🎉 This issue has been resolved in version 1.25.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@sr-verde
Copy link
Author

sr-verde commented May 8, 2023

🎉 👍

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

No branches or pull requests

2 participants