-
Notifications
You must be signed in to change notification settings - Fork 323
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
Add keyword arguments for all macros #752
Conversation
Switch from text v html to text plus safe
…ing the tests - doh)
Hey @solidgoldpig ! Thanks for spending the time to put this together, we're still not sure if this is the approach we want to take to solve this issue. I think if we were to go down this route we'd want to have some form of being able to set a default via a global. Since one of the biggest concerns is that users that are prototyping may find this behaviour hard to understand. |
The introduction of keyword arguments allows the following approaches to get the same result (NB. including the putative html deprecation in this PR is a red herring - mea culpa - since it doesn't affect the action of the keyword args)
and for unescaped html
So what, you might ask? Personally, when I'm prototyping I prefer to have as flat a data structure as possible:
However, the real strength of this approach is that it allows more compact macros of the call, while preserving all the params passed except for those explicitly overridden.
This approach could also make it easier to pass fieldset legends (pass the legend directly to radios, checkboxes, select etc and mix it in to the legend) I did something like this for the fieldset role which in the current implementation prevents passing any other attributes
|
The above approach is predicated on doing it all in Nunjucks. If you could mandate a bare minimum bit of code to add such a global
it 's trivial to do work around Nunjuck's bizarre intransigence when it comes to updating object properties
This is arguably much more powerful. |
Hey @solidgoldpig This PR is trying to do two things:
For 2. we have decided we will not be changing this behaviour right now before launch, and will instead try to document the current behaviour and risks. If this changes we'll update the thread here: #514 For 1. we're not sure what problem you're trying to solve, so if you could put together a proposal (or even an issue on this repo) we'd love to figure that out with you. I'm going to close this out but will catch up with you when/if we do any work around here to get your thoughts. |
Also, switch from text v html to text plus safe