-
Notifications
You must be signed in to change notification settings - Fork 338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce Nunjucks macros abstracting data attribute rendering #2917
Comments
I notice that an i18n related macro was added a couple of months ago, that seems related to this idea. Is this issue still relevant or in need of updates in response to that? |
That macro is related to this idea indeed. It proposed to expand on it to set up a macro for rendering attributes in general, as we often do the same thing for rendering them: check if they're undefined, escape them... Under the hood, the i18n macro would likely delegate to this generic macro for outputting its attribute, allowing it to focus on the bits specific to i18n (fishing the plural forms and formatting the attribute names). The issue remains relevant I think. It doesn't need tackling urgently though (and is open to counter arguments if we think it's unhelpful 😊) |
Hadn't realised this issue existed. We nearly implemented this in: Fairly quick to pull out another macro (for data- or regular attributes in general) from |
What
Abstract rendering of data-attributes for passing configuration into a
govukDataAttributes
with a call of the following shape:Expand the concept with a helper for internationalisation attributes that relies on
plurals
orstring
key instead ofvalue
and delegates togovukDataAttributes
, building thei18n.<attribute-name>[.plural-category]
attribute name. Based on the ideas in this comment.Why
Setting the attributes is very repetitive in the templates and always the same shape:
Who needs to work on this
Developers
Who needs to review this
Developers
Done when
The text was updated successfully, but these errors were encountered: