template <-
'Hello {{name}}
You have just won ${{value}}!
{{#in_ca}}
Well, ${{taxed_value}}, after taxes.
{{/in_ca}}'
data <- list( name = "Chris"
, value = 10000
, taxed_value = 10000 - (10000 * 0.4)
, in_ca = TRUE
)
whisker.render(template, data)
base <-
'Names
{{#names}}
{{> user}}
{{/names}}'
user <- '{{name}}'
names <- list(list(name="Alice"), list(name="Bob"))
whisker.render(base, partials=list(user=user))
Run the code above in your browser using DataLab