Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# roxygen2 (development version)

* For person defintions `DESCRIPTION`, the comment argument can now contain an arbitrary number of elements, and the names of these elements are included in the resulting string representation (@jranke, #1746)

# roxygen2 7.3.3

* Package documentation now converts ROR IDs into a useful link (#1698, @maelle).
Expand Down
8 changes: 7 additions & 1 deletion R/object-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,13 @@ author_desc <- function(x) {
}

if (length(x$comment) > 0) {
desc <- paste0(desc, " (", x$comment, ")")
desc <- paste0(desc, " (",
paste(
ifelse(nzchar(names(x$comment)),
paste0(names(x$comment), ": ", x$comment),
x$comment),
collapse = ", "),
")")
}
}

Expand Down
8 changes: 8 additions & 0 deletions tests/testthat/test-object-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,11 @@ test_that("multiple email addresses for a person are acceptable #1487", {
"me \\email{one@email.me, two@email.me}"
)
})

test_that("Arbitrary comments for a person are acceptable #1746", {
me <- person("me", comment = c(acronym = "m", "contributed X"))
expect_equal(
author_desc(unclass(me)[[1]]),
"me (acronym: m, contributed X)"
)
})
Loading