-
Notifications
You must be signed in to change notification settings - Fork 479
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
Inconsistent syntax for partials with dynamic names and context #262
Comments
This issue is same as #383
Dust is stepping into Colon syntax limits value lookup only to that context, preventing going up the context chain and into global. So in example above Dust will try to find Being limited to only data in the context set with colon syntax is very constraining and un-intuitive. We are considering deprecating this syntax in favor of using parameters as more familiar and predictable workaround:
inside the partial
|
I never found the :context useful except to provide access to a second set of context stack values that might otherwise not be reachable. With the 2.0 change to let paths reach up the stack, this use is no longer of interest further eliminating a need for it. What is our deprecation notification mechanism? WIki? |
Ideally we would release a version of Dust that prints warning messages when colon syntax is encountered saying it's deprecated and will be removed in new version. Immediately after that publish a new version on Dust that does not support colon syntax. We should document this on Wiki. Also having some kind of release notes would be great. We should start it if we don't have it already. @smfoote has a linting tool for Dust. We can extend it to find colon syntax and make it available here, so migration path is somewhat easier. This will have to be major version bump since this is backward incompatible. Perhaps we should bundle this with possible whitespace change #238, to minimize number of major releases that require migration. |
When scoping a partial to a context: {>"{partial}":context /} The evaluation of the partial name was done in `context` instead of the current scope. Fixes linkedin#262 Closes linkedin#261
When scoping a partial with a dynamic name to a context like this: {>"{partial}":context /} The evaluation of the partial name was done in `context` instead of the current scope. Fixes linkedin#262 Closes linkedin#261
When scoping a partial with a dynamic name to a context like this: {>"{partial}":context /} The evaluation of the partial name was done in `context` instead of the current scope. Fixes linkedin#262 Closes linkedin#261
Took long enough, but it's fixed! "I'm Mickey, and you can find me at Medallia" has haunted me in my dreams FWIW |
Hey guys, I noticed some inconsistencies in the syntax for invoking partials with dynamic names and a scope.
Let's say this is my scope:
And this is a partial that I've got saved in person.dust:
Here's where the problems begin. This is my template:
I would expect this to output "Hi, I'm Mickey, and you can find me at Medallia!" six times. However, the last two partial invokations throw errors.
My understanding is that this behavior is inconsistent. See #261 for failing the failing specs.
Do you guys agree? Is there a rationale for the inconsistent syntax?
Thanks!
P.S. My actual use case for this functionality is rendering a heterogeneous collection, in which each entity is aware of its subtemplate and subtemplate-scope. I would like to render the subtemplate, even if the scope is empty, which makes the colon-syntax cleaner than a conditional.
The text was updated successfully, but these errors were encountered: