Repository metrics
- Stars
- (15 stars)
- PR merge metrics
- (PR metrics pending)
Description
There are some subtle and not-so-subtle variations in the different implementations of Django-style templates. For instance, default values in Django look like this, which is really just a holdover from Smarty:
{{ foo|default:"bar" }}
Whereas Jinja (and Nunjucks, which followed its lead) uses the function-style syntax:
{{ foo|default("bar") }}
I'm inclined to go with the Jinja syntax since Django can be made to work with Jinja templates, but not vice-versa. The goal here isn't necessarily full cross-compatibility of templates between systems, but I'd like to avoid anything proprietary to Nunjucks that would make it difficult to make a move (or at least a port) to Python, for instance, at a later date. It may also be possible to standardize on the form:
{{ foo and foo or "bar" }}