Debian Codegraph @

tests/testrmd.R

raw
1 # only run this test on CI platforms
2 if (.Platform$OS.type == 'unix' && isTRUE(as.logical(Sys.getenv("CI"))) && rmarkdown::pandoc_available()) {
3
4 # test if Word documents can be rendered with a specified intermediate dir
5 # (https://github.com/rstudio/rmarkdown/issues/1431)
6 system2(rmarkdown::pandoc_exec(), '--print-default-data-file reference.docx', stdout = 'rmd/template.docx')
7 rmarkdown::render('rmd/word.Rmd', intermediates_dir = 'tmp')
8
9 # bib files should be copied to the intermediates dir:
10 # https://github.com/rstudio/rmarkdown/issues/1358
11 rmarkdown::render('rmd/two-bibs.Rmd', intermediates_dir = tempdir())
12
13 # use an absolute output_dir should not trigger a file.rename() warning
14 # (https://github.com/rstudio/rmarkdown/issues/1224)
15 withCallingHandlers(
16 rmarkdown::render(
17 'rmd/output_dir.Rmd', output_dir = file.path(tempdir(), 'output'),
18 intermediates_dir = file.path(tempdir(), 'tmp')
19 ), warning = function(e) {
20 if (identical(deparse(e$call), 'file.rename(from, to)') || grepl('cannot rename file', e$message)) {
21 stop(e)
22 }
23 }
24 )
25
26 # the default LaTeX template should work with multiple authors:
27 # https://github.com/rstudio/rmarkdown/issues/1716
28 rmarkdown::render('rmd/two-authors.Rmd')
29
30 # R code in YAML should be evaluated before YAML is passed to Pandoc:
31 # https://github.com/rstudio/rmarkdown/issues/1709
32 rmarkdown::render('rmd/yaml-r-code.Rmd')
33
34 # raw blocks in header-includes should work:
35 # https://github.com/rstudio/rmarkdown/issues/1729
36 rmarkdown::render('rmd/raw-header.Rmd')
37
38 # anchor_sections should work without Lua error
39 # https://github.com/rstudio/rmarkdown/pull/1964
40 rmarkdown::render("rmd/anchor-sections.Rmd")
41
42 # Finding resource in custom formats
43 # https://github.com/rstudio/rmarkdown/issues/2493
44 rmarkdown::render("rmd/clean-format.Rmd")
45
46 # base64 encoded images should work for PDF output
47 # https://github.com/rstudio/rmarkdown/issues/2604
48 rmarkdown::render("rmd/base64-pdf.Rmd")
49
50 }