whisker
whisker copied to clipboard
impossible to use named sections when key is unknown
Thanks for a great package. R really needs a good templating engine.
If the names of hash$people
are unknown, there appears to be now way of accessing the data in it's children.
library(whisker)
hash <- list(
people = list(
a = list(
first = "john",
last = "johnsson"
),
b = list(
first = "peter",
last = "petersson"
),
c = list(
first = "steve",
last = "stevesson"
)
),
stuff = c(1:5)
)
template <- "
{{#people}}
<h1>Hello {{first}}</h1>
{{/people}}
"
result <- whisker::whisker.render(template = template, data = hash)
print(HTML(result))