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
Edit: Note that lists also render slightly differently in MiniJinja compared to Python Jinja2. Python Jinja2 renders string elements/entries in lists (and tuples) with single quotes, whereas MiniJinja renders string elements/entries in lists with double quotes. See the example above where Python Jinja2 output has single quotes and MiniJinja output has double quotes.
Reproduction steps
Feed the input template through Python Jinja2
Feed the input template through MiniJinja
See that the results are not the same
What did you expect
Would love to see Tuples supported at parity in MiniJinja with Python Jinja2. Is this a technically complex / challenging to achieve, or has there just not been strong enough motivation yet for parity with Python Jinja2 for this?
The text was updated successfully, but these errors were encountered:
Jinja2 never really defined how these things render, it's whatever the underlying thing in Python does. Since most code does not directly emit values and look at their representation the differences between tuples and lists in templates are not particularly meaningful.
MiniJinja does support the creation of lists via tuple literals:
$ minijinja-cli -t '{{ ("Hello",) }}'
["Hello"]
It's not clear to me that it makes sense to create a lot of complexity in MiniJinja to tell these things apart given that they basically behave the same in the context of the engine.
Description
I encountered that Tuples behaved differently in MiniJinja and then noticed that it is indeed documented that they aren't supported.
https://github.com/mitsuhiko/minijinja/blob/main/COMPATIBILITY.md#tuples
Here's an example.
Input template
Python Jinja2 output
MiniJinja output
Edit: Note that lists also render slightly differently in MiniJinja compared to Python Jinja2. Python Jinja2 renders string elements/entries in lists (and tuples) with single quotes, whereas MiniJinja renders string elements/entries in lists with double quotes. See the example above where Python Jinja2 output has single quotes and MiniJinja output has double quotes.
Reproduction steps
What did you expect
Would love to see Tuples supported at parity in MiniJinja with Python Jinja2. Is this a technically complex / challenging to achieve, or has there just not been strong enough motivation yet for parity with Python Jinja2 for this?
The text was updated successfully, but these errors were encountered: