-
Notifications
You must be signed in to change notification settings - Fork 525
/
Copy pathtest-formats.R
89 lines (82 loc) · 3.11 KB
/
test-formats.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
test_format <- function(name, output_options = NULL, skip = NULL) {
withr::local_options(lifecycle_verbosity = "quiet")
# don't run on CRAN due to complicated dependencies (Pandoc/LaTeX packages)
if (!identical(Sys.getenv("NOT_CRAN"), "true")) return()
# skip if requested
if (!is.null(skip) && isTRUE(skip)) return()
# work in a temp directory
dir <- tempfile()
dir.create(dir)
oldwd <- setwd(dir)
on.exit(setwd(oldwd), add = TRUE)
# create a draft of the format
testdoc <- paste0(name, "_article", ".Rmd")
rmarkdown::draft(
testdoc, pkg_file_template(name),
create_dir = FALSE, edit = FALSE
)
message(
"Rendering the ", name, " format...",
if (!is.null(output_options)) " (with output options)"
)
output_file <- rmarkdown::render(testdoc, output_options = output_options, quiet = TRUE)
assert(paste(name, "format works"), {
file.exists(output_file)
})
}
#--- NOTE to contributors ------------------------------------------------------
# Please order these tests by formats alphabetically.
#-------------------------------------------------------------------------------
test_format("acm")
test_format("acs")
test_format("aea")
test_format("agu")
test_format("ajs", skip = !rmarkdown::pandoc_available("2.7"))
test_format("amq")
test_format("ams", skip = !rmarkdown::pandoc_available("2.10"))
test_format("arxiv")
test_format("asa")
test_format("bioinformatics")
test_format("biometrics")
test_format("copernicus")
test_format("ctex", skip = !xfun::is_linux()) # only on linux due to fonts requirements
test_format("elsevier", skip = !rmarkdown::pandoc_available("2.10"))
test_format("frontiers")
test_format("frontiers", output_options = list(citation_package = "default"), skip = rmarkdown::pandoc_available("3.1.7"))
test_format("glossa")
test_format("ieee")
test_format("ims")
test_format("ims", output_options = list(journal = "aap"))
test_format("informs", skip = !rmarkdown::pandoc_available("2.10"))
test_format("isba", skip = !rmarkdown::pandoc_available("2.10"))
test_format("iop")
test_format("jasa")
test_format("jedm")
test_format("joss")
test_format("joss", output_options = list(journal = "JOSE"))
test_format("jss", skip = !rmarkdown::pandoc_available("2.7"))
test_format("lncs")
test_format("lncs", output_options = list(citation_package = "natbib"))
test_format("lipics")
test_format("mdpi")
test_format("mnras")
test_format("oup_v0")
test_format("oup_v1", skip = !rmarkdown::pandoc_available("2.10"))
test_format("peerj")
test_format("pihph")
test_format("plos")
test_format("pnas")
test_format("rjournal")
test_format("rsos")
test_format("rss")
test_format("sage")
test_format("sim")
test_format("springer", skip = !rmarkdown::pandoc_available("2.11.4"))
test_format("tf", output_options = list(reference_style = "CAD"))
test_format("tf", output_options = list(reference_style = "APA"))
test_format("tf", output_options = list(reference_style = "NLM"))
test_format("tf", output_options = list(reference_style = "TFP"))
test_format("tf", output_options = list(reference_style = "TFQ"))
test_format("tf", output_options = list(reference_style = "TFS"))
test_format("trb")
test_format("wellcomeor")