Skip to content

Commit 0d4a740

Browse files
committed
relocate verify_mathjax()
1 parent a1f3a02 commit 0d4a740

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

R/plotly_build.R

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -371,24 +371,6 @@ plotly_build.plotly <- function(p, registerFrames = TRUE) {
371371
# box up 'data_array' attributes where appropriate
372372
p <- verify_attr_spec(p)
373373

374-
375-
verify_mathjax <- function(p) {
376-
hasMathjax <- "mathjax" %in% sapply(p$dependencies, "[[", "name")
377-
if (hasMathjax) return(p)
378-
379-
hasTeX <- any(rapply(p$x, is.TeX))
380-
if (!hasTeX) return(p)
381-
382-
# TODO: it would be much better to add the dependency here, but
383-
# htmlwidgets doesn't currently support adding dependencies at print-time!
384-
warning(
385-
"Detected the use of `TeX()`, but mathjax has not been specified. ",
386-
"Try running `config(.Last.value, mathjax = 'cdn')`",
387-
call. = FALSE
388-
)
389-
p
390-
}
391-
392374
# make sure we're including mathjax (if TeX() is used)
393375
p <- verify_mathjax(p)
394376

R/utils.R

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,23 @@ verify_guides <- function(p) {
830830
p
831831
}
832832

833+
verify_mathjax <- function(p) {
834+
hasMathjax <- "mathjax" %in% sapply(p$dependencies, "[[", "name")
835+
if (hasMathjax) return(p)
836+
837+
hasTeX <- any(rapply(p$x, is.TeX))
838+
if (!hasTeX) return(p)
839+
840+
# TODO: it would be much better to add the dependency here, but
841+
# htmlwidgets doesn't currently support adding dependencies at print-time!
842+
warning(
843+
"Detected the use of `TeX()`, but mathjax has not been specified. ",
844+
"Try running `config(.Last.value, mathjax = 'cdn')`",
845+
call. = FALSE
846+
)
847+
p
848+
}
849+
833850
verify_scattergl_platform <- function(p) {
834851
if (!identical(.Platform$OS.type, "windows")) return(p)
835852
if (!is_rstudio()) return(p)

0 commit comments

Comments
 (0)