diff --git a/DESCRIPTION b/DESCRIPTION index d43394acc..f04abe255 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: rticles Title: Article Formats for R Markdown -Version: 0.27.7 +Version: 0.27.8 Authors@R: c( person("JJ", "Allaire", , "jj@posit.co", role = "aut"), person("Yihui", "Xie", , "xie@yihui.name", role = "aut", @@ -89,7 +89,7 @@ BugReports: /~https://github.com/rstudio/rticles/issues Imports: knitr (>= 1.30), lifecycle, - rmarkdown (>= 2.14), + rmarkdown (>= 2.25), tinytex (>= 0.30), utils, xfun, diff --git a/R/article.R b/R/article.R index 0e7688af9..56dd424c4 100644 --- a/R/article.R +++ b/R/article.R @@ -507,30 +507,30 @@ springer_article <- function(..., keep_tex = TRUE, citation_package = "natbib", ) pre_knit_fun <- format$pre_knit - format$pre_knit <- function(input, ...) { + format$pre_knit <- function(input, metadata, ...) { if (is.function(pre_knit_fun)) pre_knit_fun(input, ...) # for backward compatibility as we changed the template in # /~https://github.com/rstudio/rticles/pull/494 - options <- rmarkdown::yaml_front_matter(input) new_template_msg <- function(ver) return (c(sprintf("If you are rendering an old Rmd, be advise that the template has changed in version '%s'\n", ver), " and you should check new template or start from a fresh template to get latest resources and new YAML header format.")) - if (is.null(options[["classoptions"]])) { + if (is.null(metadata[["classoptions"]])) { stop("`springer_article()` now requires the 'classoptions' field in YAML front matter. ", new_template_msg("0.25"), call. = FALSE) - } else if ("sn-mathphys" %in% options[["classoptions"]]) { + } else if ("sn-mathphys" %in% metadata[["classoptions"]]) { stop("classoptions `sn-mathphys` detected. `springer_article()` now uses 'sn-mathphys-num' or `sn-mathphys-ay`. ", new_template_msg("0.28"), call. = FALSE) } - if (!is.null(options[["biblio-style"]])) { + if (!is.null(metadata[["biblio-style"]])) { warning("`springer_article()` now ignores the 'biblio-style' field in YAML front matter. ", "Reference style for 'natbib' is now set using the 'classoptions' field.\n", - new_template_msg("0.25")) + new_template_msg("0.25"), + immediate. = TRUE, call. = FALSE) } - if (!is.null(options[["PACS"]])) { + if (!is.null(metadata[["PACS"]])) { warning("`springer_article()` now ignores the 'PACS' field in YAML front matter to use `pacs.jel` and `pacs.msc`. ", - new_template_msg("0.25")) + new_template_msg("0.25"), immediate. = TRUE, call. = FALSE) } - if (!is.null(options[["authors"]][["name"]])) { + if (!is.null(metadata[["authors"]][["name"]])) { stop("`springer_article()` now uses different authors and affiliations fields.\n", new_template_msg("0.25"), call. = FALSE) }