-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add inherit.blank argument to element constructors #1754
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
Changes from 4 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
fcf9081
Add inherit.blank argument to element constructors
thomasp85 37deef5
Look for inherit.blank when combining
thomasp85 3b27d0f
Update default themes for the new setup
thomasp85 aaa64e5
News bullet
thomasp85 ace0dee
Better documentation
thomasp85 84fd9f5
Set inherit.blank = TRUE automatically when theme is complete
thomasp85 edb2436
Merge branch 'hadley/master' into inherit-blank
thomasp85 fdbe5d0
Set all replacements to complete so inherit.blank is true
thomasp85 30e5493
Check value of inherit.blank
thomasp85 ea9b57e
Test all exported themes have inherit.blank = TRUE elements
thomasp85 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -633,10 +633,14 @@ calc_element <- function(element, theme, verbose = FALSE) { | |
combine_elements <- function(e1, e2) { | ||
|
||
# If e2 is NULL, nothing to inherit | ||
if (is.null(e2)) return(e1) | ||
|
||
if (is.null(e2) || inherits(e1, "element_blank")) return(e1) | ||
# If e1 is NULL inherit everything from e2 | ||
if (is.null(e1)) return(e2) | ||
# If e1 is NULL, or if e2 is element_blank, inherit everything from e2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment needs updating too, right? |
||
if (is.null(e1) || inherits(e2, "element_blank")) return(e2) | ||
if (inherits(e2, "element_blank")) { | ||
if (e1$inherit.blank) return(e2) | ||
else return(e1) | ||
} | ||
|
||
# If e1 has any NULL properties, inherit them from e2 | ||
n <- vapply(e1[names(e2)], is.null, logical(1)) | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you expand on this a little bit? I assume if it's
TRUE
the "blank-ness" will be inherited, otherwise it will skip the parent and look at the grand parent?