Skip to content

Collections and undefined values render by element concatenation instead of Python reprs #87

Description

@Nuhiat-Arefin

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions