Skip to content

Python parity bug(?): Comma-delimited expression #263

Open
@tjsmith-meta

Description

@tjsmith-meta

The following template compiles with Python jinja2 (and yields an output of "1"), but does not work with jinja2cpp.

{% if 0, 'foo' != 'bar' %}
1
{% endif %}

Here's the jinja2cpp error that I get.

LOAD ERROR: noname.j2tpl:2:8: error: Expected end of statement, got: ','
{% if 0, 'foo' != 'bar' %}
    ---^-------

I'm actually not entirely sure what this expression is supposed to mean, or if it is just incidentally supported due to the Python jinja2 implementation.

I was not able to find an explicit call out for what this would mean in the documentation, and I wasn't able to discern how this might be useful from mucking around experimentally with a variety of values.
https://jinja.palletsprojects.com/en/2.10.x/templates/

So unclear if it would make sense to fix in jinja2cpp for parity, or if Python jinja2 should be fixed to not support this "bad template syntax".

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