-
Notifications
You must be signed in to change notification settings - Fork 10
Reuse epoxy chunks #106
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
Reuse epoxy chunks #106
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
📕 Preview documentation for this PR has been cleaned up. |
Codecov Report
@@ Coverage Diff @@
## main #106 +/- ##
==========================================
+ Coverage 95.71% 95.94% +0.23%
==========================================
Files 9 11 +2
Lines 886 938 +52
==========================================
+ Hits 848 900 +52
Misses 38 38
|
With extra features for detecting inline knitr code chunks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a helper function to make it easier to reuse epoxy chunks as templates throughout a document.
Or you could even call it inline:
📖 Preview the docs: http://pkg.garrickadenbuie.com/epoxy/preview/pr106/reference/epoxy_use_chunk.html
Name
I initially called this function
epoxy_template_chunk()
, but as I started to write the docs and setup pkgdown I've realized that I use the word template throughout epoxy. I think it's still correct – I use template to mean the text with the{.emph title}
strings – but it might be clearer with another naming convention. I also envision another function that uses templates stored in files, so we need to accomodate at least a_file
suffix.Here are some other ideas I considered:
epoxy_reuse_chunk()
epoxy_use_chunk()
epoxy_with_chunk()
epoxy_from_chunk()
epoxy_render_chunk()
After sitting on this for a bit, I've decided to go with
epoxy_use_*()
as the prefix, as inepoxy_use_chunk()
andepoxy_use_file()
. In addition to being the shortest function name, it's also a reasonable explanation of what happens. You aren't re-using just the template itself, you're also using all of the settings from the chunk (or from the file when that's implemented).TODO
epoxy_use_chunk()