Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support person() object containing multiple emails #1487

Closed
jmbarbone opened this issue Jun 9, 2023 · 1 comment · Fixed by #1529
Closed

Support person() object containing multiple emails #1487

jmbarbone opened this issue Jun 9, 2023 · 1 comment · Fixed by #1529
Labels
bug an unexpected problem or unintended behavior rd ✍️

Comments

@jmbarbone
Copy link
Contributor

jmbarbone commented Jun 9, 2023

I'm hitting an error propagating up through devtools::document().

==> devtools::document(roclets = c('rd', 'collate', 'namespace'))

ℹ Updating package documentation
ℹ Loading package
Error in `map_chr()`:
ℹ In index: 1.
Caused by error:
! Result must be length 1, not 2.
Backtrace:
     ▆
  1. ├─base::suppressPackageStartupMessages(...)
  2. │ └─base::withCallingHandlers(expr, packageStartupMessage = function(c) tryInvokeRestart("muffleMessage"))
  3. ├─devtools::document(roclets = c("rd", "collate", "namespace"))
  4. │ └─roxygen2::roxygenise(pkg$path, roclets)
  5. │   └─base::lapply(blocks, block_set_env, env = env)
  6. │     └─roxygen2 (local) FUN(X[[i]], ...)
  7. │       └─roxygen2:::block_find_object(block, env)
  8. │         ├─roxygen2:::object_defaults(object, block)
  9. │         └─roxygen2:::object_defaults.package(object, block)
 10. │           └─roxygen2:::package_authors(desc$get_field("Authors@R", NULL))
 11. │             └─purrr::map_chr(unclass(authors), author_desc)
 12. │               └─purrr:::map_("character", .x, .f, ..., .progress = .progress)
 13. │                 ├─purrr:::with_indexed_errors(...)
 14. │                 │ └─base::withCallingHandlers(...)
 15. │                 └─purrr:::call_with_cleanup(...)
 16. └─base::.handleSimpleError(...)
 17.   └─purrr (local) h(simpleError(msg, call))
 18.     └─cli::cli_abort(...)
 19.       └─rlang::abort(...)
Execution halted

Exited with status 1.

There's an issue with parsing a person object containing multiple emails

me <- person("me", email = c("one@email.me", "two@email.me"))
print(me)
#> [1] "me <one@email.me, two@email.me>"
# internal returns character(2), which map_chr() is not expecting
roxygen2:::author_desc(unclass(me)[[1]])
#> [1] "me \\email{one@email.me}" "me \\email{two@email.me}"

Created on 2023-06-09 with reprex v2.0.2

paste0() here is recycling:

if (!is.null(x$email)) {
desc <- paste0(desc, " \\email{", x$email, "}")
}

@hadley hadley added bug an unexpected problem or unintended behavior rd ✍️ labels Nov 1, 2023
@hadley
Copy link
Member

hadley commented Nov 1, 2023

Want to do a PR? Looks like it would be a relatively simple fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior rd ✍️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants