whisker.render

0th

Percentile

Logicless templating

Logicless templating

Usage
whisker.render(template, data = parent.frame(), partials = list(),
  debug = FALSE, strict = TRUE)
Arguments
template

character with template text

data

named list or environment with variables that will be used during rendering

partials

named list with partial templates, will be used during template construction

debug

Used for debugging purposes, likely to disappear

strict

logical if TRUE the seperation symbol is a "." otherwise a "$"

Value

character with rendered template

Note

By default whisker applies html escaping on the generated text. To prevent this use {{{variable}}} (triple) in stead of {{variable}}.

Aliases
  • whisker.render
Examples
# NOT RUN {
template <- "Hello {{place}}!"
place <- "World"

whisker.render(template)

# 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)
# I'm escaped: <My Name="Nescio&">
# And I'm not: <My Name="Nescio&">
# }
Documentation reproduced from package whisker, version 0.4, License: GPL-3

Community examples

Looks like there are no examples yet.