Skip to content

Add support for chained epoxy_style_* transformers #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 23, 2022

Conversation

gadenbuie
Copy link
Owner

@gadenbuie gadenbuie commented Apr 23, 2022

Adds an epoxy_style() function that allows you to chain epoxy's style transformers together. In an epoxy chunk (or in glue::glue()) you can pass epoxy_style() to the .transformer argument to apply a series of transformers during the string replacement.

# bold each item and then collapse
glue::glue("{letters[1:3]&}", .transformer = epoxy_style("bold", "collapse"))
#> **a**, **b** and **c**

# Note that order matters, left -> right is inner -> outer
glue::glue("{letters[1:3]&}", .transformer = epoxy_style("collapse", "bold"))
#> **a, b and c**

# epoxy_style() can be string, function symbol, or function call
glue(
  "{letters[1:3]&}",
  .transformer = epoxy_style(
    "code",
    epoxy_style_bold,
    epoxy_style_collapse(last_and = ", ... and ... ")
  )
)
#> **`a`**, **`b`**, ... and ... **`c`**

Fixes #13

@gadenbuie
Copy link
Owner Author

Reference docs preview for epoxy_style(): http://pkg.garrickadenbuie.com/epoxy/preview/pr26/reference/epoxy_style.html

@gadenbuie gadenbuie merged commit 720a9f5 into main Apr 23, 2022
@gadenbuie gadenbuie deleted the epoxy-style-chaining branch April 23, 2022 19:08
@github-actions github-actions bot restored the epoxy-style-chaining branch April 23, 2022 19:10
@gadenbuie gadenbuie deleted the epoxy-style-chaining branch April 23, 2022 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

using both bold and collapse option inside .transformer
1 participant