@@ -507,30 +507,30 @@ springer_article <- function(..., keep_tex = TRUE, citation_package = "natbib",
507507 )
508508
509509 pre_knit_fun <- format $ pre_knit
510- format $ pre_knit <- function (input , ... ) {
510+ format $ pre_knit <- function (input , metadata , ... ) {
511511 if (is.function(pre_knit_fun )) pre_knit_fun(input , ... )
512512 # for backward compatibility as we changed the template in
513513 # https://github.com/rstudio/rticles/pull/494
514- options <- rmarkdown :: yaml_front_matter(input )
515514 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 ),
516515 " and you should check new template or start from a fresh template to get latest resources and new YAML header format." ))
517- if (is.null(options [[" classoptions" ]])) {
516+ if (is.null(metadata [[" classoptions" ]])) {
518517 stop(" `springer_article()` now requires the 'classoptions' field in YAML front matter. " ,
519518 new_template_msg(" 0.25" ), call. = FALSE )
520- } else if (" sn-mathphys" %in% options [[" classoptions" ]]) {
519+ } else if (" sn-mathphys" %in% metadata [[" classoptions" ]]) {
521520 stop(" classoptions `sn-mathphys` detected. `springer_article()` now uses 'sn-mathphys-num' or `sn-mathphys-ay`. " ,
522521 new_template_msg(" 0.28" ), call. = FALSE )
523522 }
524- if (! is.null(options [[" biblio-style" ]])) {
523+ if (! is.null(metadata [[" biblio-style" ]])) {
525524 warning(" `springer_article()` now ignores the 'biblio-style' field in YAML front matter. " ,
526525 " Reference style for 'natbib' is now set using the 'classoptions' field.\n " ,
527- new_template_msg(" 0.25" ))
526+ new_template_msg(" 0.25" ),
527+ immediate. = TRUE , call. = FALSE )
528528 }
529- if (! is.null(options [[" PACS" ]])) {
529+ if (! is.null(metadata [[" PACS" ]])) {
530530 warning(" `springer_article()` now ignores the 'PACS' field in YAML front matter to use `pacs.jel` and `pacs.msc`. " ,
531- new_template_msg(" 0.25" ))
531+ new_template_msg(" 0.25" ), immediate. = TRUE , call. = FALSE )
532532 }
533- if (! is.null(options [[" authors" ]][[" name" ]])) {
533+ if (! is.null(metadata [[" authors" ]][[" name" ]])) {
534534 stop(" `springer_article()` now uses different authors and affiliations fields.\n " ,
535535 new_template_msg(" 0.25" ), call. = FALSE )
536536 }
0 commit comments