Logicless templating
whisker.render(template, data = parent.frame(), partials = list(),
debug = FALSE, strict = TRUE)character with template text
named list or environment with variables that will be used during rendering
named list with partial templates, will be used during template construction
Used for debugging purposes, likely to disappear
logical if TRUE the seperation symbol is a "." otherwise a "$"
character with rendered template
By default whisker applies html escaping on the generated text. To prevent this use {{{variable}}} (triple) in stead of {{variable}}.
template <- "Hello {{place}}!"
place <- "World"
whisker.render(template)
#> [1] "Hello World!"
# to prevent html escaping use triple {{{}}}
template <-
"I'm escaped: {{name}}
And I'm not: {{{name}}}"
data <- list( name = '<My Name="Nescio&">')
whisker.render(template, data)
#> [1] "I'm escaped: <My Name="Nescio&">\nAnd I'm not: <My Name=\"Nescio&\">"
# I'm escaped: <My Name="Nescio&">
# And I'm not: <My Name="Nescio&">