Breaking Changes
-
Breaking change:
epoxy_latex()
and theepoxy_latex
chunk engine it
powers now use<<
and>>
to delimit inline expressions. Where you
previously may have used<expr>
, please now use<<expr>>
. This breaking
change was necessary to allow theexpr
to include common R operators like
<
and>
. (#107) -
Breaking change: the
whisker
engine is now powered by
epoxy_mustache()
, resulting in a few small changes. In particular, if you
previously used a list for the.data
chunk option in awhisker
chunk, and
relied on thewhisker
engine's special treatment of lists to iterate over
their items, you'll need to specifically opt into this behavior by adding a
.vectorized = TRUE
chunk option.This chunk engine still vectorizes over rows in a data frame by default, where
it's much more likely to be the behavior you want, but bare lists require
specifically opting in. (#103) -
.data
is now the preferred chunk option for passing data frames or lists of
data to epoxy chunks, where previouslydata
was used in some places. It
works inwhisker
andepoxy
chunks, and is more consistent with the.data
argument ofglue()
andepoxy()
. (#102)
New Features
-
New
epoxy_mustache()
provides an epoxy-style interface to the
mustache templating language, using the
whisker package. This function
also now powers thewhisker
ormustache
knitr engines.epoxy
also now
provides aliases for whisker and mustache in all places, so you can use
whichever name resonates with you. (#103) -
New
epoxy_use_chunk()
andepoxy_use_file()
allow you to re-use an
epoxy()
,epoxy_html()
or other epoxy-provided knitr chunk or file as a
template.epoxy_use_chunk()
lets you re-use a template chunk with new data,
andepoxy_use_file()
lets you repeatedly use a template stored in a file.
Both functions also re-use the options from the template chunk or the options
set in the YAML from matter of the template file. See?epoxy_use
for more
details about how options for both functions are determined. (#106, #116)
Improvements and bug fixes
-
epoxy()
now adds a.data
pronoun that allows you to refer to the list or
data frame passed into either the.data
argument ofepoxy()
or thedata
or.data
chunk options. (#100) -
epoxy_html()
now supports inline transformations prefixed with@
instead
of.
, e.g.@strong
instead of.strong
. Previously, you would have to
place the inline transformer in a nested{{ }}
block, e.g.
{{ {{ .strong expr }} }}
, but now you only need{{@strong expr}}
. To combine
the HTML transformer (epoxy_transform_html()
) with the inline
transformer, you still need to nest:{{.text-muted {{@strong expr}}}}
creates<span class="text-muted"><strong>{expr}</strong></span>
. (#120) -
epoxy()
, and by extension the LaTex and HTML counterparts, and allepoxy_*
knitr engines gain a.collapse
argument to determine how a vector of
epoxy-transformed templates should be collapsed. The default isNULL
, which
means that the output is returned as a vector. This argument is also useful in
epoxy_use_chunk()
and for knitr chunks being used as a vectorized template.
(#115) -
Aded
.sentence
(alias.sc
) to the list of inline transformers provided by
epoxy_transform_inline()
. This transformer will capitalize the first letter
of the first word in the expression. This is useful when you want to need to
start a sentence with a variable that may contain more than one word. (#112) -
The
.titlecase
inline transformer now coerces inputs to character with
as.character()
before applyingtools::toTitleCase()
, sincetoTitleCase()
will throw an error for non-character inputs. (#112) -
epoxy()
,epoxy_html()
,epoxy_latex()
andepoxy_mustache()
(and their
related knitr engines) will all collect remotetbl_sql
tables before
evaluation. This makes it much easier to pass data from a remote database
using{dplyr}
and{dbplyr}
. (#117) -
Fixed an issue with
epoxy_inline_transform()
when used with custom
delimiters (#116).