Skip to content

Commit

Permalink
Combine multiple format tags (#1049)
Browse files Browse the repository at this point in the history
Fixes #1015
  • Loading branch information
hadley authored Mar 6, 2020
1 parent 4fb892f commit 3d0c7f7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
* roxygen2 now adds hyperlinks to R6 methods in the PDF manual as well,
(#1006).

* Multiple `@format` tags are now combined (#1015).

# roxygen2 7.0.2

* `\example{}` escaping has been improved (again!) so that special escapes
Expand Down
2 changes: 1 addition & 1 deletion R/rd-markdown.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ roxy_tag_rd.roxy_tag_format <- function(x, base_path, env) {
}
#' @export
format.rd_section_format <- function(x, ...) {
format_first(x, ...)
format_collapse(x, ...)
}

#' @export
Expand Down
4 changes: 1 addition & 3 deletions tests/testthat/test-rd-markdown.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ test_that("@format NULL suppresses default usage", {
#' Title
#'
#' @format NULL
#'
x <- list(a = 1, b = 2)")[[1]]

expect_equal(out$get_value("format"), NULL)
Expand All @@ -42,10 +41,9 @@ test_that("@format not escaped", {
out <- roc_proc_text(rd_roclet(), "
#' Title
#' @format %
#'
x <- list(a = 1, b = 2)")[[1]]

expect_equal(out$get_value("format"), "%")
expect_equal(out$get_rd("format"), "\\format{%}")
expect_equal(out$get_rd("format"), "\\format{\n%\n}")
})

0 comments on commit 3d0c7f7

Please sign in to comment.