Skip to content

Commit

Permalink
make sure tags are internally lowercase
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasp85 committed Apr 17, 2024
1 parent 25d15fa commit 7a91f21
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion R/style_set.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
#' is a marquee style it will overwrite the tag and subsequent arguments are
#' ignored
#' @param style_set A style set to modify
#' @param tag The name of a tag to modify or remove
#' @param tag The name of a tag to modify or remove. Tags are internally all
#' lowercase and `tag` will be converted to lowercase before matching
#'
#' @return A style set object
#'
Expand Down Expand Up @@ -40,6 +41,7 @@ style_set <- function(...) {
if (any(vapply(styles$body, is.null, logical(1)))) {
cli::cli_abort("The body style must be a complete style specification")
}
names(styles) <- tolower(names(styles))
class(styles) <- "marquee_style_set"
styles
}
Expand All @@ -65,6 +67,7 @@ print.marquee_style_set <- function(x, ...) {
#' @rdname style_set
#' @export
modify_style <- function(style_set, tag, ...) {
tag <- tolower(tag)
if (!is_style_set(style_set)) {
stop_input_type(style_set, "a style set object")
}
Expand All @@ -91,6 +94,7 @@ modify_style <- function(style_set, tag, ...) {
#' @rdname style_set
#' @export
remove_style <- function(style_set, tag) {
tag <- tolower(tag)
if (!is_style_set(style_set)) {
stop_input_type(style_set, "a style set object")
}
Expand Down
3 changes: 2 additions & 1 deletion man/style_set.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7a91f21

Please sign in to comment.