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] Formating of {% set = .. %} generate unparsable result for Jina2 #682

Closed
3 tasks done
ikus060 opened this issue Jun 2, 2023 · 4 comments · Fixed by #683
Closed
3 tasks done
Labels

Comments

@ikus060
Copy link

ikus060 commented Jun 2, 2023

System Info

  • OS: Debian Bullseye
  • Python Version: 3.10
  • djLint Version: 1.30 (issue since 1.25.1)
  • template language: Jinja2

Issue

Formating

{% set classes =  {
'sPaging': 'd-flex justify-content-center ',
'sPageButton': 'btn btn-outline-primary ms-1 me-1',
'sPageButtonActive': 'active',
}%}

Output

{% set classes = {
  sPaging: "d-flex justify-content-center ",
  sPageButton: "btn btn-outline-primary ms-1 me-1",
  sPageButtonActive: "active"
} %}

The indentation is fixed, but the quotes around sPaging are required for Jinja2.

This changes seams to be introduce by 85aca4c

I don't see an option to disable that behavior either.

@ikus060 ikus060 added 🦠 bug Something isn't working 🧽 formatter labels Jun 2, 2023
@welcome
Copy link

welcome bot commented Jun 2, 2023

Thanks for opening your first issue here!

@christopherpickering
Copy link
Contributor

Thanks, I will make quoted keys the default if Jinja requires it. This option was for jinja/njk so we will follow their lead :)

christopherpickering added a commit that referenced this issue Jun 2, 2023
@christopherpickering
Copy link
Contributor

I also added flags to disable set/function formatting in case other issues come up and I cannot resolve quickly.

christopherpickering pushed a commit that referenced this issue Jun 2, 2023
## [1.30.2](v1.30.1...v1.30.2) (2023-06-02)

### Bug Fixes

* **formatter:** added quotes to json keys, added option to disable set/function formatting ([6f7df03](6f7df03)), closes [#682](#682)
@christopherpickering
Copy link
Contributor

🎉 This issue has been resolved in version 1.30.2 🎉

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

Successfully merging a pull request may close this issue.

2 participants