Skip to content

epoxy 1.0.0

Latest
Compare
Choose a tag to compare
@gadenbuie gadenbuie released this 20 Sep 15:55
67da1f7

Breaking Changes

  • Breaking change: epoxy_latex() and the epoxy_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 the expr 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 a whisker chunk, and
    relied on the whisker 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 previously data was used in some places. It
    works in whisker and epoxy chunks, and is more consistent with the .data
    argument of glue() and epoxy(). (#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 the whisker or mustache 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() and epoxy_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,
    and epoxy_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 of epoxy() or the data
    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 all epoxy_*
    knitr engines gain a .collapse argument to determine how a vector of
    epoxy-transformed templates should be collapsed. The default is NULL, 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 applying tools::toTitleCase(), since toTitleCase()
    will throw an error for non-character inputs. (#112)

  • epoxy(), epoxy_html(), epoxy_latex() and epoxy_mustache() (and their
    related knitr engines) will all collect remote tbl_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).