How to filter already filtered value in twig? Filters: replace, title, raw in the same expression

时间:2015-07-28 16:52:43

标签: twig

I need to use filter |title to the below outcome:

{{ sentence|lower|replace({(word): '<span style="font-weight: bold;">'~word~'</span>'})|raw }}

how to do that?


edit:

I'm trying:

{% autoescape false %}
{% set foo %}
    {{ sentence|lower|replace({(word): '<span style="font-weight: bold;">'~word~'</span>'})|raw }}
{% endset %}
{% endautoescape %}

then:

{{ foo|title }}

but it results below in source code:

&lt;Span Style=&quot;font-Weight: Bold;&quot;&gt;Emily&lt;/span&gt; Dickinson

and render on the screen:

<Span Style="font-Weight: Bold;">Emily</span> Dickinson

0 个答案:

没有答案