Skip to content

Commit

Permalink
Adds to previous commit, ensures index files without show_continue_text
Browse files Browse the repository at this point in the history
do not cause a YAML error
* Adds new exception YAML tag argument in the check_yaml() function
  • Loading branch information
cgrandin committed Jan 6, 2024
1 parent 6b831db commit cd4be9f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions R/check-yaml.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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")))
Expand Down
4 changes: 4 additions & 0 deletions R/tables.R
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand Down
4 changes: 4 additions & 0 deletions man/check_yaml.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cd4be9f

Please sign in to comment.