I'm evaluating handlebars-rust where it needs to be able to support this sort of recursive lookup scenario as part of supporting some legacy applications with existing templates:
{{#each children}}
outer={{{outer_value}}}
inner={{{inner_value}}}
{{/each}}
with input data:
{
"children": [{"inner_value": "foo"}],
"outer_value": "outer"
}
the legacy application runs with handlebars.js running in compat mode:
Handlebars deviates from Mustache slightly in that it does not perform recursive lookup by default. The compile time compat flag must be set to enable this functionality. Users should note that there is a performance cost for enabling this flag. The exact cost varies by template, but it's recommended that performance sensitive operations should avoid this mode and instead opt for explicit path references.
so the template renders as:
handlebars-rust renders it as:
Is adding optional support for this kind of recursive lookup something that you'd want in handlebars-rust?
I'm willing to look at working up a PR to support this if you can point me to the roughly the right place!
I'm evaluating handlebars-rust where it needs to be able to support this sort of recursive lookup scenario as part of supporting some legacy applications with existing templates:
with input data:
{ "children": [{"inner_value": "foo"}], "outer_value": "outer" }the legacy application runs with handlebars.js running in
compatmode:so the template renders as:
handlebars-rust renders it as:
Is adding optional support for this kind of recursive lookup something that you'd want in handlebars-rust?
I'm willing to look at working up a PR to support this if you can point me to the roughly the right place!