Each loop not aligned with inline
htakao opened this issue · comments
htakao commented
When looping through items in each with inline, that not aligned.
use handlebars::Handlebars;
use serde_json::json;
fn main() {
let reg = Handlebars::new();
let tpl = r#"
<!-- without inline -->
<ul>
{{#each a}}
<li>{{this}}</li>
{{/each}}
</ul>
<!-- with inline -->
{{#*inline "li"}}
{{#each a}}
<li>{{this}}</li>
{{/each}}
{{/inline}}
<ul>
{{> li}}
</ul>
"#;
println!(
"{}",
reg.render_template(tpl, &json!({"a": [0, 1]})).unwrap()
);
}
Output
<!-- without inline -->
<ul>
<li>0</li>
<li>1</li>
</ul>
<!-- with inline -->
<ul>
<li>0</li>
<li>1</li>
</ul>
It works fine in handlebars.js.
Handlebars.js Playground
Ning Sun commented
htakao commented
Sorry for taking up your time. Thank you.