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

[FEATURE] Indent custom block form_start in Twig #476

Closed
2 tasks done
lukepass opened this issue Dec 7, 2022 · 10 comments
Closed
2 tasks done

[FEATURE] Indent custom block form_start in Twig #476

lukepass opened this issue Dec 7, 2022 · 10 comments
Labels

Comments

@lukepass
Copy link

lukepass commented Dec 7, 2022

Feature Request

Hello, I tried using the custom_blocks and custom_html configuration parameters but I couldn't get the indentation to work when using form_start (a Symfony helper). How can I indent this with djLint?

{{ form_start }}
    {{ form_widget(form) }}
    <!-- Other -->
{{ form_end }}

My configuration:

{
  "extension": "html.twig",
  "profile": "nunjucks",
  "custom_blocks": "form_start,form_end",
  "custom_html": "turbo-frame"
}

Thanks!

@christopherpickering
Copy link
Contributor

Hi @lukepass this syntax isn't curretly supported > when hugo support is added then it should work.
currently only {% ... %} tags can be used for indent blocks but w/ hugo we should be able to do {{ ... }} indent blocks.

@lukepass
Copy link
Author

Hello and thanks for the answer! What is hugo support?

@christopherpickering
Copy link
Contributor

I should have been clearer :) The Hugo template language. They are also using {{ for blocks. What template language are you using? or where do the {{ blocks come from?

@lukepass
Copy link
Author

I am using Twig (with Symfony).
The {{ syntax is for outputting things and the {% is for other things. For example:

{% set test = 'Test' %}
<p>{{ dump(test) }}</p>

@christopherpickering
Copy link
Contributor

Thanks!

@lukepass
Copy link
Author

Hello, is there any news about this issue?

Thanks!

@christopherpickering
Copy link
Contributor

Hey @lukepass nothing yet. I think it will be a hefty project. Do you happen to have a public repo with html using this tag style that I could practice on?

@lukepass
Copy link
Author

Yes, you can try the official Symfony Demo project which has a lot of recommended practices, here you can find a file containing {{ form_start(form) }} indented:

https://github.com/symfony/demo/blob/main/templates/user/edit.html.twig

Thanks.

@christopherpickering
Copy link
Contributor

@lukepass I finally read the symfony docs and reallized that this is the only tag they have in {{ }} double curly. I will add it in the next release.

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