handlebars-rust
handlebars-rust copied to clipboard
Recursive rendering, is it possible?
I have a template that is pretty much just Hello {{name}}
, and the name
is {{real_name}}
, which is world
, but when doing rendering it will only return Hello {{real_name}}
.
I tried to see in the docs and code if there was a clear way of recursing the render while expressions are present but doesn't seem to be anything out there that i perceive.
Thanks for the work, pretty neat library
If there is only one level of recursing, you can use lookup
helper. See this example: https://sunng87.github.io/handlebars-rust/?tpl=Hello%20world%20from%20%7B%7Blookup%20this%20name%7D%7D&data=%7B%22name%22%3A%20%22realname%22%2C%20%22realname%22%3A%20%22tom%22%7D