Skip to content

Cannot loop some expressions in for that Jinja2 can #180

Closed
@jpcima

Description

@jpcima

Hi, I have tried a set of expressions which are not currently working as expected.

1. {% for v in [1, 2] %}{{v}}{% endfor %}
2. {% for v in [1, 2]+[3, 4] %}{{v}}{% endfor %}
3. {% for v in "ab" %}{{v}}{% endfor %}
4. {% for v in "ab"+"cd" %}{{v}}{% endfor %}
5. {% for v in 'a' ~ 'b' %}{{v}}{% endfor %}

According to Jinja2:

1. 12
2. 1234
3. ab
4. abcd
5. ab

In Jinja2cpp, I find only the first one is working, the other 4 evaluate as empty.

I believe that 3 4 and 5 are because it's not handled to loop over characters.
Regarding 2, I'm under impression it's the + operation not supported for concatenating lists. (possibly in scope of issue #135)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions