fix: partial context with literal parameters#695
Conversation
|
I'm not sure if this is within the scope of this pull request, but it seems that even with this fix, hash params in --- a/src/partial.rs
+++ b/src/partial.rs
@@ -754,5 +754,14 @@ outer third line",
hbs.register_template_string("t2", t2).unwrap();
assert_eq!("1", hbs.render("t2", &()).unwrap());
+
+ let t1 = "{{#each this}}{{@key}}:{{this}},{{/each}}";
+ let t2 = "{{> t1 a=1}}";
+
+ let mut hbs = Registry::new();
+ hbs.register_template_string("t1", t1).unwrap();
+ hbs.register_template_string("t2", t2).unwrap();
+
+ assert_eq!("a:1,", hbs.render("t2", &()).unwrap());
}
}(Same problem occurs when using block param syntax, e.g. It turns out this is a recent regression—it works in handlebars-rust v6.3.0 but not v6.3.1 (it also works in handlebars.js). Perhaps it was a side effect of #694? Please let me know if you'd like me to file a separate issue about this. |
|
@mkantor Thank you for reporting! In #694 I changed hash implementation from merging into context to block param. It seems we still need to merge the hash into the partial context for But this is another issue can be address in separated PR. I will merge this and work on the issue when I have ideas. |
This patch add support for literal parameters on partial.
Fixes #643