Skip to content

Feature Request: customizable behaviour on unknown value #110

@robbrit

Description

@robbrit

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:

  • Raise an error on an unknown field; this helps us fail-fast when the result is due to a misspelling.
  • Ignore the template directive, just render the text as is. So in the example above, leave it as 'hello {{ value2 }}'.

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.

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