Skip to content

Commit

Permalink
Combine multiple format tags
Browse files Browse the repository at this point in the history
Fixes #1015
  • Loading branch information
hadley committed Mar 4, 2020
1 parent 0d67307 commit 7405f1a
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 @@ -3,6 +3,8 @@
* roxygen2 now keeps using Windows (CR LF) line endings for files that
already have CR LF line endings, and uses LF for new files (#989).

* 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 7405f1a

Please sign in to comment.