-
Notifications
You must be signed in to change notification settings - Fork 85
/
run_lectures.R
37 lines (33 loc) · 979 Bytes
/
run_lectures.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
library(pagedown)
x = list.files(pattern = ".Rmd$",
path = here::here("lecture_notes"),
full.names = TRUE,
recursive = TRUE)
# x = x[!grepl("Advanced|Bioconductor_intro.Rmd", x)]
sapply(x, function(x) {
out = sub(".Rmd$", ".R", x)
knitr::purl(input = x, output = out)
})
sapply(x, function(xx) {
out_html = sub("Rmd$", "html", xx)
if (!file.exists(out_html) ||
file.info(out_html)$mtime <
file.info(xx)$mtime) {
rmarkdown::render(xx, envir = new.env())
}
out_pdf = sub("Rmd$", "pdf", xx)
if (!file.exists(out_pdf) ||
file.info(out_pdf)$mtime <
file.info(xx)$mtime ||
file.info(out_pdf)$mtime <
file.info(out_html)$mtime) {
pagedown::chrome_print(out_html)
}
xx
})
# xx = sub("Rmd$", "html", x)
# sapply(xx, function(r) {
# xaringan::decktape(r, output = sub("html$", "pdf", r),
# docker = FALSE)
# })
# sapply(xx, pagedown::chrome_print)