-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Allow comments within components / function calls #4001
Comments
Not sure what the best way forward is, but I would also like to point out this extremely painful TwigComponent usecase for us where we have to resort to writing prop explanations above the whole thing instead of inline. It becomes increasingly less readable the more props we have of course. {# props
propOne: Lorem ipsum dolor sit amet
propTwo: Lorem ipsum dolor sit amet
propThree: Lorem ipsum dolor sit amet
#}
{% props
propOne = 1, // This is not a valid comment
propTwo = null, /* nor is this */
propThree = null, {# nor is this of course #}
%} |
Allowing I had a look at Jinja and they don't support it. Liquid has a syntax though, they use {% liquid
# this is a comment
assign topic = 'Learning about comments!'
echo topic
%} I think it could work. IIUC, such comments in Liquid must be on their own line. |
@fabpot Thanks for considering this. That would work fine for my common use cases. |
3 lines of code, 130 lines of tests and docs 😂 |
This PR was squashed before being merged into the 2.x branch. Discussion ---------- [Doc] Misc updates in TogglePassword docs | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | Issues | - | License | MIT Twig recently added inline comments (twigphp/Twig#4349) and this doc was used an example of invalid Twig syntax (twigphp/Twig#4001). So, let's fix it. Commits ------- 11276a0 [Doc] Misc updates in TogglePassword docs
It is so natural to comment out HTML attributes that it's easy to think that Twig supports this. So easy that even the Symfony UX documentation has an example.
https://symfony.com/bundles/ux-toggle-password/current/index.html#usage-without-symfony-forms
I started to make a PR to fix the docs, but it's not easy to decide where to move it. It'd be awesome if twig allowed this, as I frequently use it for in-line comments as well as disabling attributes.
The text was updated successfully, but these errors were encountered: