jinja2cpp / jinja2cpp/Jinja2Cpp
Support for "not in" syntax (works in Python jinja2)
- Dominant language
- C++
- Stars
- 600
- Forks
- 114
- PR merge metrics
- No merged PRs in 30d
Description
The following template (`foo in (...)`) compiles fine in both Python jinja2 and Jinja2Cpp.
```
{% macro foo(val) %}
{{1 if val in ('', "''", 'foo')}}
{% endmacro %}
```
Whereas this slight variant (`foo not in (...)`) works only in Python jinja2.
```
{% macro foo(val) %}
{{1 if val not in ('', "''", 'foo')}}
{% endmacro %}
```
This seems like a bug that it doesn't work in Jinja2Cpp. I'm happy to make the code fix here, but would appreciate some pointers in the code as to what the fix might look like here. I suspect there may be a simple fix here. Help would be much appreciated!
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the two macro examples from the issue and compare their compilation behavior in Jinja2Cpp with Python jinja2. Trace how the parser handles the `in` operator and its `not in` variant; done means the second template compiles and behaves consistently with the first and with Python jinja2.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100