Skip to content

Commit 09e2ad9

Browse files
Automated package maintenance (#75)
1 parent 18753ca commit 09e2ad9

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

R/style_xaringan.R

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ style_xaringan <- function(
344344
force(code_font_family)
345345
force(code_font_url)
346346
force(code_font_family_fallback)
347-
347+
348348
# the defaults are google fonts
349349
is_default <- function(type, suffix) {
350350
# check if font arg value is from xaringanthemer_font_default
@@ -362,7 +362,7 @@ style_xaringan <- function(
362362
r_set_font_is_google <- glue::glue("{var}_font_is_google <- {var_is_google}")
363363
eval(parse(text = r_set_font_is_google))
364364
}
365-
365+
366366
# Make sure font names are wrapped in quotes if they have spaces
367367
f_args <- names(formals(sys.function()))
368368
for (var in f_args[grepl("font_family$", f_args)]) {
@@ -371,7 +371,7 @@ style_xaringan <- function(
371371
eval(parse(text = paste0(var, "<-quote_elements_w_spaces(", var, ")")))
372372
}
373373
}
374-
374+
375375
# Warn if base_font_size isn't absolute
376376
css_abs_units <- c("cm", "mm", "Q", "in", "pc", "pt", "px")
377377
if (!grepl(paste(tolower(css_abs_units), collapse = "|"), tolower(base_font_size))) {
@@ -385,7 +385,7 @@ style_xaringan <- function(
385385
immediate. = TRUE
386386
)
387387
}
388-
388+
389389
# If certain colors aren't in hexadecimal it may cause problems with theme_xaringan()
390390
# TODO: at some point I'd rather be able to process CSS colors or variables
391391
colors_used_by_theme_xaringan <- list(
@@ -399,18 +399,18 @@ style_xaringan <- function(
399399
)
400400
colors_used_by_theme_xaringan <- purrr::discard(colors_used_by_theme_xaringan, is.null)
401401
colors_are_hex <- purrr::map_lgl(colors_used_by_theme_xaringan, check_color_is_hex, throw = NULL)
402-
402+
403403
if (any(!colors_are_hex)) {
404404
colors_better_as_hex <- names(colors_used_by_theme_xaringan)[!colors_are_hex]
405405
colors_better_as_hex <- paste(colors_better_as_hex, collapse = ", ")
406406
warning(
407407
glue::glue("Colors that will be used by `theme_xaringan()` need to be in ",
408-
"hexadecimal format: {colors_better_as_hex}"),
408+
"hexadecimal format: {colors_better_as_hex}"),
409409
immediate. = TRUE,
410410
call. = FALSE
411411
)
412412
}
413-
413+
414414
# Use font_..._google args to overwrite font args
415415
for (var in f_args[grepl("font_google$", f_args)]) {
416416
gf <- eval(parse(text = var))
@@ -433,10 +433,10 @@ style_xaringan <- function(
433433
}
434434
eval(parse(text = paste0(group, "_font_is_google <- 1")))
435435
}
436-
436+
437437
extra_font_imports <- if (is.null(extra_fonts)) "" else list2fonts(extra_fonts)
438438
extra_font_imports <- paste(extra_font_imports, collapse = "\n")
439-
439+
440440
# convert NA arguments to NULL
441441
for (var in f_args) {
442442
val <- eval(parse(text = var))
@@ -445,7 +445,7 @@ style_xaringan <- function(
445445
is_na <- length(val) == 0
446446
if (is_na) assign(var, NULL, envir = sys.frame(sys.nframe()))
447447
}
448-
448+
449449
# prepare variables for template
450450
body_font_family <- paste(c(text_font_family, text_font_family_fallback, text_font_base), collapse = ", ")
451451
background_size_fallback <- if (is.null(background_position)) "cover" else "100%"
@@ -454,7 +454,7 @@ style_xaringan <- function(
454454
title_slide_background_image %??% "cover"
455455
)
456456
table_row_even_background_color <- table_row_even_background_color %||% background_color
457-
457+
458458
# stash theme settings in package env
459459
lapply(f_args, function(n) assign(n, get(n), envir = xaringanthemer_env))
460460
for (font_is_google in paste0(c("text", "code", "header"), "_font_is_google")) {
@@ -464,9 +464,9 @@ style_xaringan <- function(
464464
envir = xaringanthemer_env
465465
)
466466
}
467-
467+
468468
xaringanthemer_version <- utils::packageVersion("xaringanthemer")
469-
469+
470470
# prepare header background object
471471
needs_leading_dot <- !grepl("^\\.", header_background_ignore_classes)
472472
header_background_ignore_classes[needs_leading_dot] <- paste0(
@@ -491,9 +491,9 @@ style_xaringan <- function(
491491
content_padding_top = header_background_content_padding_top,
492492
ignore = header_background_ignore_classes
493493
)
494-
494+
495495
colors <- prepare_colors(colors)
496-
496+
497497
tf <- system.file("resources", "template.css", package = "xaringanthemer")
498498
template <- readLines(tf, warn = FALSE)
499499
template <- paste(template, collapse = "\n")
706 Bytes
Loading

0 commit comments

Comments
 (0)