Open tremby opened 8 years ago
kind of a pointless feature don't you think? since any valid expression will already work inside of a double quoted string with the correct syntax ie {{}}
or {%%}
No, I don't think so.
In case we're talking at cross purposes, the feature affects a double-quoted string which is already inside {{}}
or {%%}
. So instead of {{ "foo " ~ bar ~ " baz" }}
you can do {{ "foo #{bar} baz" }}
.
I'm not sure if it is easy to support. Maybe @connorhu can support it in his lexer branch?
One scenario I encountered was a situation like this:
{% extends "core::#{globals.twig.master}" %}
Is this issue still in the pipeline? I have the same issue using a macro:
{{ svg.svg({class:"miz-comp-button_search--icon",title:"Search"},{href:"#{site.parent_theme}images/icons/miz-sprite.svg#action--search"}) }}
Just renders:
<svg class="miz-icon--sm miz-comp-button_search--icon" aria-hidden="true" focusable="false" title="Search">
<use xlink:href="#{site.parent_theme}images/icons/miz-sprite.svg#action--search"></use>
</svg>
Any solutions or just isn't supported?
looks like it's not working for now
input:
{% set foo = 'bar' %}
{{ "#{foo} baz" }}
output:
#{foo} baz
Really a must-have since this feature is heavily used in existing Twig template. Twing's lexer supports it, may worth switching it (avoid NIH and combinate efforts)
It doesn't look like string interpolation is supported.
See http://twig.sensiolabs.org/doc/templates.html#string-interpolation