Skip to content

Commit cf36699

Browse files
committed
move the lua folder from resources/ to rmarkdown/ so we can use rmarkdown::pkg_file_lua(): rstudio/rmarkdown#1904
1 parent 6215f07 commit cf36699

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

R/utils.R

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -560,12 +560,9 @@ strip_latex_body = function(x, alt = '\nThe content was intentionally removed.\n
560560
c(x1, x2[sort(i)], '\\end{document}')
561561
}
562562

563-
# bookdown lua filters paths
564-
bookdown_lua_filters = function (filter = NULL) {
565-
lua_folder = bookdown_file("resources", "lua")
566-
if (is.null(filter)) filter = list.files(lua_folder)
567-
filter = xfun::with_ext(filter, "lua")
568-
rmarkdown::pandoc_path_arg(file.path(lua_folder, filter))
563+
# bookdown Lua filters paths
564+
lua_filter = function (filters = NULL) {
565+
rmarkdown::pkg_file_lua(filters, package = 'bookdown')
569566
}
570567

571568
# To pass bookdown meta to pandoc lua filters
@@ -586,7 +583,7 @@ add_custom_environment_args = function(format) {
586583
stop("format should be a rmarkdown output format.")
587584
# prepend the filter
588585
format$pandoc$lua_filters = c(
589-
bookdown_lua_filters("custom-environment"), format$pandoc$lua_filters
586+
lua_filter("custom-environment.lua"), format$pandoc$lua_filters
590587
)
591588
# and add bookdown metadata file for the filter to work
592589
format$pandoc$args = c(bookdown_metadata_file_arg(), format$pandoc$args)

0 commit comments

Comments
 (0)