From 61b778ccfc004160a2fa70ffcf6b5e08fdb359a9 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Tue, 3 Feb 2026 10:21:14 +0100 Subject: [PATCH 1/2] Fixes #1746 The previous behaviour, putting ORCID and ROR information into an own set of parentheses, was not changed, e.g. we get H W \\email{h@w.com} (\\href{https://orcid.org/0000-0003-4757-117X}{ORCID}) (extra) It could be argued that there should only be one set of parentheses for comments, but I did not want to mess with this. --- R/object-package.R | 8 +++++++- tests/testthat/test-object-package.R | 8 ++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/R/object-package.R b/R/object-package.R index 3e8247e1..2b6d0ff1 100644 --- a/R/object-package.R +++ b/R/object-package.R @@ -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 = ", "), + ")") } } diff --git a/tests/testthat/test-object-package.R b/tests/testthat/test-object-package.R index c2562a5c..a2192ad0 100644 --- a/tests/testthat/test-object-package.R +++ b/tests/testthat/test-object-package.R @@ -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)" + ) +}) From 4e39b4283c32ee3b9a6a24ca5907a93b0dbc8657 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Tue, 3 Feb 2026 10:30:41 +0100 Subject: [PATCH 2/2] Add NEWS entry --- NEWS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS.md b/NEWS.md index 52fae9b0..98399dc4 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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).