-
-
Notifications
You must be signed in to change notification settings - Fork 15
Address deprecation of spaceless tag #454
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for catching this!
By running a quick code search there seem to be more then just this one position of spaceless |
Where possible, I would suggest to not use spaceless at all and either not care about the resulting HTML or use the whitespace control characters where whitespace matters in rendering (e.g. inline or in See also this comment: symfony-tools/docs-builder#80 (comment) |
Since Twig 2.7, the spaceless tag is deprecated in favor of the spaceless filter, or the apply tag with a spaceless argument. I picked the latter so as to still benefit from syntax highlighting.
We @wouterj I just talked to @linawolf , most tags are really necessary for inline tags, because for instance if you have <p>
<strong>bold text</strong>
.
</p> This means an unwanted space will appear between the text and the dot. |
We do need spaceless tags in inline node rendering though. Most IDEs will automatically add an empty line at the end of each file. So twig inserts a newline after each textrole. HTML then interprets this newline as space even if there should be no space between the end of the textrole (for example bolt text) and the next char (for example a dot or brace). |
Anyway, I think this is orthogonal to that PR |
Since Twig 2.7, the
spaceless
tag is deprecated in favor of thespaceless
filter, or theapply
tag with aspaceless
argument. I picked the latter so as to still benefit from syntax highlighting.This is the only deprecation I found while running the test suite with
symfony/phpunit-bridge
locally.