Git Product home page Git Product logo

Comments (13)

soukicz avatar soukicz commented on June 22, 2024

This could be solved be enabling FullCompatibilityTwigExtension, but that would enable less strict syntax.

from twital.

soukicz avatar soukicz commented on June 22, 2024

Is is working correctly with ContextAwareEscapingSubscriber disabled

from twital.

goetas avatar goetas commented on June 22, 2024

hi! the right syntax for your code should be:

<img t:attr=" true ? src='/a/x.jpg' ">

See http://twital.readthedocs.org/en/latest/tags/attr.html

from twital.

goetas avatar goetas commented on June 22, 2024

The syntax used by you should work only with FullCompatibilityTwigExtension enabled. Does it work?

from twital.

soukicz avatar soukicz commented on June 22, 2024

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"> #}

from twital.

goetas avatar goetas commented on June 22, 2024

It make sense, i Will take a look

from twital.

soukicz avatar soukicz commented on June 22, 2024

The will be probably somewhere in ContextAwareEscapingSubscriber (esapeUrls?) but I can't find specific place.

from twital.

goetas avatar goetas commented on June 22, 2024

I'm unable to reproduce the issue (see branch escaping test case I22Test).

Feel free to fork it and create a failing test case.

from twital.

goetas avatar goetas commented on June 22, 2024

any news in this?

from twital.

goetas avatar goetas commented on June 22, 2024

@Soukiii ping

from twital.

soukicz avatar soukicz commented on June 22, 2024

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.

from twital.

goetas avatar goetas commented on June 22, 2024

added test https://github.com/goetas/twital/commits/master no way to reproduce

from twital.

soukicz avatar soukicz commented on June 22, 2024

These test were definitely failing with master version which means that you fixed it with some other changes.

from twital.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.