diff --git a/R/build-site.R b/R/build-site.R index b203db9..c6b818e 100644 --- a/R/build-site.R +++ b/R/build-site.R @@ -72,11 +72,6 @@ build_ropensci_docs <- function(path = ".", destination = NULL, install = FALSE, override$navbar <- modifyList(override$navbar, navbar_config) } - math_config <- get_math_rendering(path) - if (!is.null(math_config)) { - override$template$`math-rendering` <- math_config - } - find_and_fix_readme(path, pkgname) # Prevent favicon building @@ -147,35 +142,6 @@ fixup_navbar_config <- function(path) { } -# we need this to keep supporting the old syntax we had set up -# TODO: PR to packages using it so we can remove those lines! -get_math_rendering <- function(path){ - - pkgdown_yml <- pkgdown_config_path(path = path) - - if (is.null(pkgdown_yml)) { - return(NULL) - } - - pkgdown_config <- yaml::read_yaml(pkgdown_yml) - - if (is.null(pkgdown_config)) { - return(NULL) - } - - math_rendering <- pkgdown_config$template$`math-rendering` - if (!is.null(math_rendering)) { - return(math_rendering) - } - - if(isTRUE(pkgdown_config$mathjax) || isTRUE(pkgdown_config$template$params$mathjax)){ - return("mathjax") - } - - return(NULL) - -} - find_and_fix_readme <- function(path, pkg){ # From pkgdown build_home_index() home_files <- file.path(path, c("index.Rmd", "README.Rmd", "index.md", "README.md")) diff --git a/tests/testthat/test-mathjax.R b/tests/testthat/test-mathjax.R deleted file mode 100644 index ed08dd6..0000000 --- a/tests/testthat/test-mathjax.R +++ /dev/null @@ -1,51 +0,0 @@ -test_that("adding mathjax works", { - withr::local_options(usethis.quiet = TRUE) - temp_dir <- withr::local_tempdir() - proj <- usethis::create_package( - file.path(temp_dir, "testPackage"), - rstudio = FALSE, - open = FALSE - ) - usethis::local_project(proj) - usethis::use_readme_md() - usethis::use_pkgdown() - yaml <- yaml::read_yaml("_pkgdown.yml") - yaml$mathjax <- TRUE - yaml::write_yaml(yaml, "_pkgdown.yml") - expect_output({ - suppressMessages( - docs <- build_ropensci_docs( - destination = "docs", - install = FALSE, - examples = FALSE) - ) - }) - homepage <- xml2::read_html(file.path(docs, "index.html"), encoding = "UTF-8") - script <- xml2::xml_find_first(homepage, ".//script[contains(@src,'MathJax')]") - # If not present the class is xml_missing - testthat::expect_s3_class(script, "xml_node") -}) - -test_that("NOT adding mathjax works", { - withr::local_options(usethis.quiet = TRUE) - temp_dir <- withr::local_tempdir() - proj <- usethis::create_package( - file.path(temp_dir, "testPackage"), - rstudio = FALSE, - open = FALSE - ) - usethis::local_project(proj) - usethis::use_readme_md() - usethis::use_pkgdown() - expect_output({ - suppressMessages( - docs <- build_ropensci_docs( - destination = "docs", - install = FALSE, - examples = FALSE) - ) - }) - homepage <- xml2::read_html(file.path(docs, "index.html"), encoding = "UTF-8") - script <- xml2::xml_find_first(homepage, ".//script[contains(@src,'MathJax')]") - testthat::expect_s3_class(script, "xml_missing") -})