-
Notifications
You must be signed in to change notification settings - Fork 14
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
Unnecessary escaping in attributes #22
Comments
This could be solved be enabling FullCompatibilityTwigExtension, but that would enable less strict syntax. |
Is is working correctly with ContextAwareEscapingSubscriber disabled |
hi! the right syntax for your code should be: <img t:attr=" true ? src='/a/x.jpg' "> |
The syntax used by you should work only with |
I realize that, but it would require rewrite large amount of template code before migration and FullCompatibilityTwigExtension enables a lot of others things. It is also inconsistent: <img src="{%if true%}/a/x.jpg{%endif%}">
{# output <img src="%2Fa%2Fx.jpg"> #}
<img src="{{ true ? '/a/x.jpg' }}">
{# output <img src="/a/x.jpg"> #} |
It make sense, i Will take a look |
The will be probably somewhere in ContextAwareEscapingSubscriber (esapeUrls?) but I can't find specific place. |
any news in this? |
@Soukiii ping |
I am using this test for my quick&dirty fix: public function testAttributes() {
$this->assertHtml('<img src="/a/x.jpg">', '<img src="{{a}}">', ['a' => '/a/x.jpg']);
$this->assertHtml('<img src="/b/x.jpg">', '<img src="{{ true ? "/b/x.jpg"}}">');
$this->assertHtml('<img src="/c/x.jpg">', '<img src="{%if true%}/c/x.jpg{%endif%}">');
$this->assertHtml('<img src="/d/x.jpg">', '<img src="{%if true%}{{a}}{%else%}{{b}}{%endif%}">', ['a' => '/d/x.jpg', 'b' => '/b/x.jpg']);
} I will try to look at it later. |
added test https://github.com/goetas/twital/commits/master no way to reproduce |
These test were definitely failing with master version which means that you fixed it with some other changes. |
I am trying to migrate templates from Twig to Twital and there is problem with this code:
(autoescaping is on)
Expected result:
Actual result:
I could rewrite code but it would be much more practical if it could be compatible with Twig.
The text was updated successfully, but these errors were encountered: