diff --git a/R/check-yaml.R b/R/check-yaml.R index 1dab1f3..6bc5dd7 100644 --- a/R/check-yaml.R +++ b/R/check-yaml.R @@ -7,6 +7,8 @@ #' am error message telling you what doesn't match if needed. #' #' @param type Type of document +#' @param tag_exceptions A vector of YAML tag names that if missing, will not +#' cause an error #' @param verbose Logical. If `TRUE`, print messages #' #' @importFrom rmarkdown yaml_front_matter @@ -17,6 +19,7 @@ check_yaml <- function(type = c("resdoc", "resdoc_pdf", "resdoc_word", "manureport_word", "techreport", "techreport_pdf", "techreport_word"), + tag_exceptions = c("show_continued_text"), verbose = FALSE) { tryCatch({type <- match.arg(type) @@ -54,6 +57,7 @@ check_yaml <- function(type = c("resdoc", "resdoc_pdf", "resdoc_word", )) x_index <- names(yaml_front_matter("index.Rmd")) .diff <- setdiff(x_skeleton, x_index) + .diff <- .diff[-tag_exceptions] if (length(.diff) > 0L) { bail("Your ", fn_color("index.Rmd"), " file is missing the YAML ", "tag(s):\n\n", tag_color(paste(.diff, collapse = "\n"))) diff --git a/R/tables.R b/R/tables.R index 6f8a4b9..940a54d 100644 --- a/R/tables.R +++ b/R/tables.R @@ -208,6 +208,10 @@ csas_table <- function(x, # Insert `Continued on next page ...` and # `... Continued from previous page` for latex + if(!is.logical(show_continued_text)){ + stop("The `show_continued_text` value is non-logical. If setting in ", + "YAML, use `true` or `false`.") + } if(format == "latex" && show_continued_text){ k_lines <- strsplit(k, "\n")[[1]] diff --git a/man/check_yaml.Rd b/man/check_yaml.Rd index 5165004..cf1f8b2 100644 --- a/man/check_yaml.Rd +++ b/man/check_yaml.Rd @@ -8,12 +8,16 @@ check_yaml( type = c("resdoc", "resdoc_pdf", "resdoc_word", "sr", "sr_pdf", "sr_word", "manureport", "manureport_pdf", "manureport_word", "techreport", "techreport_pdf", "techreport_word"), + tag_exceptions = c("show_continued_text"), verbose = FALSE ) } \arguments{ \item{type}{Type of document} +\item{tag_exceptions}{A vector of YAML tag names that if missing, will not +cause an error} + \item{verbose}{Logical. If \code{TRUE}, print messages} } \description{