| epoxy_transform_one_shot {epoxy} | R Documentation |
One-shot epoxy transformers
Description
These transformers are useful for applying the same transformation to every replacement in the template.
Usage
epoxy_transform_wrap(
before = "**",
after = before,
engine = NULL,
transformer = glue::identity_transformer,
syntax = lifecycle::deprecated()
)
epoxy_transform_bold(engine = NULL, transformer = glue::identity_transformer)
epoxy_transform_italic(engine = NULL, transformer = glue::identity_transformer)
epoxy_transform_apply(
.f = identity,
...,
transformer = glue::identity_transformer
)
epoxy_transform_code(engine = NULL, transformer = glue::identity_transformer)
epoxy_transform_collapse(
sep = ", ",
last = sep,
language = NULL,
...,
transformer = glue::identity_transformer
)
Arguments
before, after |
In |
engine |
One of |
transformer |
The transformer to apply to the replacement string. This
argument is used for chaining the transformer functions. By providing a
function to this argument you can apply an additional transformation after
the current transformation. In nearly all cases, you can let
|
syntax |
|
.f |
A function, function name or |
... |
Transformer functions, e.g.
epoxy_transform_bold or the name of an epoxy
transform function, e.g. For example, In In |
sep, last |
The separator to use when joining the vector elements when
the expression ends with a |
language |
In |
Value
A function of text and envir suitable for the .transformer argument of
glue::glue().
Functions
-
epoxy_transform_wrap(): Wrap variables with text added before or after the inline expression. -
epoxy_transform_bold(): Embolden variables using**in markdown,<strong>in HTML, or\textbf{}in LaTeX. -
epoxy_transform_italic(): Italicize variables using_in markdown,<em>in HTML, or\emph{}in LaTeX. -
epoxy_transform_apply(): Apply a function to all replacement expressions. -
epoxy_transform_code(): Code format variables using``in markdown,<code>in HTML, or\texttt{}in LaTeX. -
epoxy_transform_collapse(): Collapse vector variables with a succinct syntax (but seeepoxy_transform_inline()for a more readable option).
Examples
abc <- c("a", "b", "c")
epoxy("{abc}", .transformer = epoxy_transform_wrap("'"))
epoxy("{abc}", .transformer = epoxy_transform_bold())
epoxy("{abc}", .transformer = epoxy_transform_italic())
epoxy("{abc}", .transformer = epoxy_transform_code())
epoxy("{abc}", .transformer = epoxy_transform_apply(toupper))