Allow writing filters inside parenthesis

There is no way to write this in one line:

{{ [1, 2, 3] | length + 1 }}

This will result in an error. Also, this not compiles too:

{{ ([1, 2, 3] | length) + 1 }}

The only working approach is:

{% set temp = [1, 2, 3] | length %}
{{ temp + 1 }}

Which is not convenient. So, I suggest allowing writing filters inside parenthesis. Or allow using filters as a functions:

{{ length(value=[1, 2, 3]) + 1 }}

That already works on the Tera v2 parser but there is no timeline for that to be released.

1 Like