Open
Description
Is your proposal related to a problem?
- there are some Django template conventions we would like to enforce with a linting rule
- example: require using trimmed with blocktrans
Describe the solution you’d like
- template tag requires - a configurable list of regex (might be simplest) that runs inside any template tag usages (in Django those with
{% ... %}
Describe alternatives you’ve considered
- add a custom tool that does a regex parse across all html files within a folder
- monkey patch the Django template system (or add a custom template order that extends the Django one), when running in test or Dev mode any template tags that do not conform will throw an error
Additional context
- Django blocktrans reference https://docs.djangoproject.com/en/4.0/topics/i18n/translation/
- Wagtail is likely to adopt blocktrans using trimmed across all translations - Add trimmed to blocktrans tags wagtail/wagtail#8226 & Add trimmed attribute to all blocktrans usage wagtail/wagtail#8217
- there are a few other translation behaviours we would love to enforce at the template level - Internationalisation / i18n - testing and guidelines 🌐 wagtail/wagtail#8017
- this is kind of similar in concept to eslint no-restricted-syntax https://eslint.org/docs/rules/no-restricted-syntax
Activity