Просмотр исходного кода

clean up setup_theme_function()

tags/v0.3.0
Garrick Aden-Buie 6 лет назад
Родитель
Сommit
2db8633282
1 измененных файлов: 5 добавлений и 7 удалений
  1. +5
    -7
      inst/scripts/generate_theme_functions.R

+ 5
- 7
inst/scripts/generate_theme_functions.R Просмотреть файл

@@ -10,14 +10,12 @@ setup_theme_function <- function(
body = " eval(parse(text = call_style_xaringan()))"
) {
if (file == "clip" && !requireNamespace("clipr", quietly = TRUE)) file <- ""
body <- c(
f_body <- c(
" # DO NOT EDIT - Generated from inst/scripts/generate_theme_functions.R",
body
)
tv <- template
null_default <- purrr::map_lgl(tv$default, is.null)
tv[null_default, "default"] <- "{NULL}"
x <- c(
f_def <- c(
"# Generated by inst/scripts/generate_theme_functions.R: do not edit by hand\n",
as.character(
glue::glue_data(
@@ -43,12 +41,12 @@ setup_theme_function <- function(
" outfile = \"xaringan-themer.css\"",
") {"
)
if (!is.null(body)) x <- c(x, body, "}")
if (!is.null(f_body)) f_def <- c(f_def, f_body, "}")
if (file == "clip") {
clipr::write_clip(x)
clipr::write_clip(f_def)
message("Wrote ", f_name, " function signature to clipboard.")
} else {
cat(reflow_roxygen(x), sep = "\n", file = file)
cat(reflow_roxygen(f_def), sep = "\n", file = file)
message("Wrote ", f_name, " to ", file)
}
invisible()

Загрузка…
Отмена
Сохранить