Skip to content

Commit 51224f0

Browse files
committed
pkg_file_lua() should have thrown an error if the expected Lua file does not exist, but it didn't because we only checked the existence of the rmarkdown/lua folder, then we used file.path() to construct the paths, which doesn't check for the existence of files
1 parent d58c8fc commit 51224f0

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: rmarkdown
22
Type: Package
33
Title: Dynamic Documents for R
4-
Version: 2.4.2
4+
Version: 2.4.3
55
Authors@R: c(
66
person("JJ", "Allaire", role = "aut", email = "[email protected]"),
77
person("Yihui", "Xie", role = c("aut", "cre"), email = "[email protected]", comment = c(ORCID = "0000-0003-0645-5666")),

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ rmarkdown 2.5
55

66
- `html_document` gains the `anchor_sections` argument, which is `TRUE` by default, so that readers can get links to section headers easily---when you mouse over a section hader, you will see a hash symbol `#` at the end of the header, which contains the anchor link to this header. You can click on this link and get the URL in the addres bar of your web browser, or right-click on it and copy the URL from the context menu. The hash symbol is defined by the CSS rule `a.anchor-section::before {content: '#';}`. You can customize it by overriding this rule (e.g., via the `css` argument of `html_document`) and use any other symbols or icons, e.g., `content: "\02AD8;"` (thanks, @atusy, #1884).
77

8+
- `pkg_file_lua()` should have thrown an error if the expected Lua file does not exist.
9+
810
- Provide `files_dir` as attribute on return from `render()` when `run_pandoc = FALSE`.
911

1012

R/util.R

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,14 @@ pkg_file_arg <- function(..., package = "rmarkdown") {
6363
#' # get a specific filter
6464
#' pkg_file_lua(c("pagebreak.lua", "latex_div.lua"))
6565
pkg_file_lua <- function(filters = NULL, package = "rmarkdown") {
66-
lua_folder <- pkg_file("rmarkdown", "lua", package = package, mustWork = TRUE)
67-
if (is.null(filters)) filters <- list.files(lua_folder, "[.]lua$")
68-
pandoc_path_arg(file.path(lua_folder, filters))
66+
files <- pkg_file(
67+
"rmarkdown", "lua", if (is.null(filters)) '.' else filters,
68+
package = package, mustWork = TRUE
69+
)
70+
if (is.null(filters)) {
71+
files <- list.files(dirname(files), "[.]lua$", full.names = TRUE)
72+
}
73+
pandoc_path_arg(files)
6974
}
7075

7176
#' @rdname rmarkdown_format

0 commit comments

Comments
 (0)