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

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 Просмотреть файл

body = " eval(parse(text = call_style_xaringan()))" body = " eval(parse(text = call_style_xaringan()))"
) { ) {
if (file == "clip" && !requireNamespace("clipr", quietly = TRUE)) file <- "" if (file == "clip" && !requireNamespace("clipr", quietly = TRUE)) file <- ""
body <- c(
f_body <- c(
" # DO NOT EDIT - Generated from inst/scripts/generate_theme_functions.R", " # DO NOT EDIT - Generated from inst/scripts/generate_theme_functions.R",
body body
) )
tv <- template 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", "# Generated by inst/scripts/generate_theme_functions.R: do not edit by hand\n",
as.character( as.character(
glue::glue_data( glue::glue_data(
" outfile = \"xaringan-themer.css\"", " 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") { if (file == "clip") {
clipr::write_clip(x)
clipr::write_clip(f_def)
message("Wrote ", f_name, " function signature to clipboard.") message("Wrote ", f_name, " function signature to clipboard.")
} else { } else {
cat(reflow_roxygen(x), sep = "\n", file = file)
cat(reflow_roxygen(f_def), sep = "\n", file = file)
message("Wrote ", f_name, " to ", file) message("Wrote ", f_name, " to ", file)
} }
invisible() invisible()

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