noahmorrison / chevron

A Python implementation of mustache
MIT License
480 stars 52 forks source link

Feature Request: customizable behaviour on unknown value #110

Open robbrit opened 2 years ago

robbrit commented 2 years ago

Currently if a variable does not exist, Chevron just replaces it with an unknown value:

# This will render 'hello '
result = chevron.render('{{ value1 }} {{ value2 }}', { 'value1': 'hello' })

Is it possible to customize this? There's two main cases that would be useful:

The first is useful in general; the second is useful for multi-pass rendering where we receive data at different stages, and want to render a partially-evaluated version of the template.

robbrit commented 2 years ago

Looks like the second is supported using the keep flag, but hasn't been released yet.

michaelrccurtis commented 2 years ago

Looks like this release is still pending. Is this project still being maintained? Would be great to see this release being pushed, and happy to contribute a pr that raises an error in the event of unknown field if it would be welcomed?

michaelrccurtis commented 2 years ago

Actually, looks like someone has already contributed said PR with #109