You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adding a space before '%}' on the first line will make the template actually function correctly.
Ideally, jinja2cpp would be able to handle this template just fine, like Python jinja2.
This looks like it fixes the crash and this example behaves correctly, although it's unclear to me whether this change might introduce other bugs. I noticed there was a similar check during end of expression for "'" (single quote) as well, so I remove that one too.
Yeah, looks like string parsing is not handled fully correctly. Things like this appear to work fine in Python jinja2, but don't work in jinja2cpp (regardless of the code change above).
works in jinja2cpp without code change above but fails without
{% if '%}' == '%}' %}
1
{% endif %}
fails in jinja2cpp with or without code change above
{% if 'foo%}' == 'foo%}' %}
2
{% endif %}
It seems that the "check previous char" logic does not fully handle statement closing handling correctly, so removing that logic feels like the right thing to do.
Seems like we need to somehow detect that we are "inside a string literal" and ignore closing statement in such cases.
The text was updated successfully, but these errors were encountered:
The following template loads and renders fine with Python jinja2, but crashes with jinja2cpp.
Note that removing elif, else will instead result in a load error (not a crash).
Adding a space before '%}' on the first line will make the template actually function correctly.
Ideally, jinja2cpp would be able to handle this template just fine, like Python jinja2.
This looks like it fixes the crash and this example behaves correctly, although it's unclear to me whether this change might introduce other bugs. I noticed there was a similar check during end of expression for "'" (single quote) as well, so I remove that one too.
Yeah, looks like string parsing is not handled fully correctly. Things like this appear to work fine in Python jinja2, but don't work in jinja2cpp (regardless of the code change above).
It seems that the "check previous char" logic does not fully handle statement closing handling correctly, so removing that logic feels like the right thing to do.
Seems like we need to somehow detect that we are "inside a string literal" and ignore closing statement in such cases.
The text was updated successfully, but these errors were encountered: