Skip to content

Commit

Permalink
Use local_reproducible_output() in includeRmd (#1431)
Browse files Browse the repository at this point in the history
Fixes #130
  • Loading branch information
hadley authored Sep 26, 2022
1 parent d716e4b commit 20e05ad
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# roxygen2 (development version)

* `@includeRmd` calls `local_reproducible_output()` to make code run in
included `.Rmd`s more consistent with other sources (#1431).

# roxygen2 7.2.1

## Tags
Expand Down
1 change: 1 addition & 0 deletions R/rd-include-rmd.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ roxy_tag_rd.roxy_tag_includeRmd <- function(x, base_path, env) {
)
cat(txt, file = rmd_path)

local_reproducible_output()
tryCatch(
rmarkdown::render(
rmd_path,
Expand Down
15 changes: 15 additions & 0 deletions tests/testthat/test-rd-include-rmd.R
Original file line number Diff line number Diff line change
Expand Up @@ -282,3 +282,18 @@ test_that("useful warnings", {
transform = function(x) gsub("/[a-zA-Z0-9_/]+", "<temp-path>", x)
)
})

test_that("sets width", {
skip_if_not(rmarkdown::pandoc_available("2.17"))

local_options(width = 123)
temp_rd <- withr::local_tempfile(lines = "`r getOption('width')`")

rox <- sprintf("
#' Title
#' @includeRmd %s
#' @name foobar
NULL", temp_rd)
out <- roc_proc_text(rd_roclet(), rox)[[1]]
expect_equal(out$get_value("details"), "80")
})

0 comments on commit 20e05ad

Please sign in to comment.