Jinja2 renders collections with Python str()/repr() semantics. ginger renders list and map GVals by concatenating element text, so containers flatten to their contents and undefined elements render as the empty string.
Reproduction
| template |
Jinja2 |
ginger |
{{ [1] }} |
[1] |
1 |
{{ {} }} |
{} |
empty |
{{ [r] }}, r undefined |
[Undefined] |
empty |
{{ {r: i} }}, r and i undefined |
{Undefined: Undefined} |
empty |
Root cause
The ToGVal text instances for lists and maps are mconcat . map asText (src/Text/Ginger/GVal.hs:336-349, :352-365, :375), and undefined/null values render as the empty string.
Jinja2 renders collections with Python
str()/repr()semantics. ginger renders list and mapGVals by concatenating element text, so containers flatten to their contents and undefined elements render as the empty string.Reproduction
{{ [1] }}[1]1{{ {} }}{}{{ [r] }},rundefined[Undefined]{{ {r: i} }},randiundefined{Undefined: Undefined}Root cause
The
ToGValtext instances for lists and maps aremconcat . map asText(src/Text/Ginger/GVal.hs:336-349,:352-365,:375), and undefined/null values render as the empty string.