From 97c680b7819984b72a723ad893e7ec628484fddc Mon Sep 17 00:00:00 2001 From: sda030 Date: Sun, 28 Jul 2024 09:48:46 +0200 Subject: [PATCH] draft_report(path = tempdir() --- R/draft_report.R | 13 ++++++------- R/update_dots.R | 2 +- R/zzz.R | 6 +++++- man/draft_report.Rd | 6 +++--- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/R/draft_report.R b/R/draft_report.R index 13169d9..6b17b17 100644 --- a/R/draft_report.R +++ b/R/draft_report.R @@ -85,9 +85,9 @@ #' #' @param path *Output path* #' -#' `scalar` // *default:* `NULL` (`optional`) +#' `scalar` // *default:* `tempdir()` (`optional`) #' -#' Path to save all output. +#' Path to save all output. Defaults to a temporary directory. #' #' @param require_common_categories *Check common categories* #' @@ -181,7 +181,7 @@ draft_report <- function(data, chapter_structure, ..., - path, + path = tempdir(), title = "Report", authors = NULL, authors_col = "author", @@ -246,7 +246,6 @@ draft_report <- gen_qmd_chapters, chapter_structure = chapter_structure, data = data, - path = path, !!!args[!names(args) %in% .saros.env$ignore_args]) @@ -256,7 +255,7 @@ draft_report <- report_filepath <- gen_qmd_file( - path = path, + path = args$path, filename = args$report_filename, yaml_file = args$report_yaml_file, qmd_start_section_filepath = args$report_qmd_start_section_filepath, @@ -270,7 +269,7 @@ draft_report <- index_filepath <- gen_qmd_file( - path = path, + path = args$path, filename = args$index_filename, yaml_file = args$index_yaml_file, qmd_start_section_filepath = args$index_qmd_start_section_filepath, @@ -282,7 +281,7 @@ draft_report <- call = rlang::caller_env()) - validate_path_lengths_on_win(path = path, + validate_path_lengths_on_win(path = args$path, max_path_warning_threshold = max_path_warning_threshold) diff --git a/R/update_dots.R b/R/update_dots.R index ef6a49f..b54b080 100644 --- a/R/update_dots.R +++ b/R/update_dots.R @@ -19,7 +19,7 @@ update_dots <- function(dots = list(), dots_nms <- names(dots) dots <- lapply(seq_along(dots), function(i) { - if(!any(c("call", "...", "chapter_structure", "path") == names(dots)[i])) { + if(!any(.saros.env$ignore_args == names(dots)[i])) { out <- eval(dots[[i]]) } else { out <- dots[[i]] diff --git a/R/zzz.R b/R/zzz.R index 1bde84d..5529350 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -21,7 +21,11 @@ if(!exists(".saros.env")) .saros.env <- NULL "\\.template_variable_type_dep|\\.template_variable_type_indep" - .saros.env$ignore_args <<- c("data", "chapter_overview", "chapter_structure", "path", "...") + .saros.env$ignore_args <<- c("data", + "chapter_overview", + "chapter_structure", + "call", + "...") diff --git a/man/draft_report.Rd b/man/draft_report.Rd index 06ba0b5..beb2a7e 100644 --- a/man/draft_report.Rd +++ b/man/draft_report.Rd @@ -8,7 +8,7 @@ draft_report( data, chapter_structure, ..., - path, + path = tempdir(), title = "Report", authors = NULL, authors_col = "author", @@ -60,9 +60,9 @@ Arguments forwarded to the corresponding functions that create the elements.} \item{path}{\emph{Output path} -\verb{scalar} // \emph{default:} \code{NULL} (\code{optional}) +\verb{scalar} // \emph{default:} \code{tempdir()} (\code{optional}) -Path to save all output.} +Path to save all output. Defaults to a temporary directory.} \item{title}{\emph{Title of report}