Crown-Commercial-Service / govuk-frontend-jinja

Tools to use the GOV.UK Design System with Python webapps that use Jinja2 and Flask 🐍
MIT License
9 stars 6 forks source link

Warn user when they haven't quoted dictionary keys in Jinja files #47

Open lfdebrux opened 5 years ago

lfdebrux commented 5 years ago

In Nunjucks files we automagically quote the keys of dictionaries, because if Jinja sees a dictionary with unquoted keys it silently ignores the values; see lines 29 to 32 in njk_to_j2().

It would be nice if we could catch this error in non-Nunjucks templates, as it is quite a common mistake when copying code from examples for Nunjucks.