1
## Using the following non-exported functions from 'tools':
2
##  * .get_vignette_metadata()
3
##  * vignette_is_tex()
4
##  * find_vignette_product()
5
import_tools <- function(name, mode = "function",
6
                         envir = getNamespace("tools")) {
7 0
  get(name, mode = mode, envir = envir)
8
}
9

10
stop_if_not <- function(...) {
11 1
  res <- list(...)
12 1
  n <- length(res)
13 0
  if (n == 0L) return()
14

15 1
  for (ii in 1L:n) {
16 1
    res_ii <- .subset2(res, ii)
17 1
    if (length(res_ii) != 1L || is.na(res_ii) || !res_ii) {
18 0
        mc <- match.call()
19 0
        call <- deparse(mc[[ii + 1]], width.cutoff = 60L)
20 0
        if (length(call) > 1L) call <- paste(call[1L], "...")
21 0
        stop(sQuote(call), " is not TRUE", call. = FALSE, domain = NA)
22
    }
23
  }
24
}
25

26
escFmtStr <- function(x) {
27 1
  gsub("%", "%%", x,  fixed = TRUE)
28
}
29

Read our documentation on viewing source code .

Loading