Skip to content

Commit

Permalink
Tweaks.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.r-project.org/R/trunk@86978 00db46b3-68df-0310-9c12-caf00c1e9a41
  • Loading branch information
hornik committed Aug 5, 2024
1 parent 98cf114 commit 0986e80
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions src/library/utils/R/citation.R
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ person_field_names <-
function(x, i, j)
{
y <- unclass(x)[i]
if(!all(ok <- lengths(y) > 0L)) {
warning(gettext("subscript out of bounds"),
domain = NA)
y <- y[ok]
}
if(missing(j)) {
class(y) <- class(x)
} else {
Expand Down Expand Up @@ -229,7 +234,7 @@ function(x, i, j, value)
{
y <- unclass(x)
if(missing(j))
y[i] <- as.person(value)
y[i] <- if(is.null(value)) NULL else as.person(value)
else {
j <- match.arg(j, person_field_names)
s <- seq_along(x)
Expand All @@ -255,7 +260,7 @@ function(x, i, j, value)
i <- s[[i]]
y <- unclass(x)
if(missing(j))
y[i] <- as.person(value)
y[i] <- if(is.null(value)) NULL else as.person(value)
else {
j <- match.arg(j, person_field_names)
if(j == "role")
Expand All @@ -269,9 +274,12 @@ function(x, i, j, value)
.person_elt_fld_gets <-
function(x, j, v)
{
x[[j]] <- if(.is_not_nonempty_text(v))
NULL
else as.character(v)
x[j] <- list(if(.is_not_nonempty_text(v))
NULL
else as.character(v))
if(all(vapply(x, is.null, NA)))
stop(gettext("must have some non-empty fields"),
domain = NA)
x
}

Expand Down Expand Up @@ -769,7 +777,8 @@ function(x, i, j, drop = TRUE)
i <- s[i]
y <- unclass(x)[i]
if(!all(ok <- lengths(y) > 0L)) {
warning("subscript out of bounds")
warning(gettext("subscript out of bounds"),
domain = NA)
y <- y[ok]
}
if(missing(j)) {
Expand Down Expand Up @@ -813,7 +822,7 @@ function(x, i, j, value)
{
y <- unclass(x)
if(missing(j)) {
y[i] <- as.bibentry(value)
y[i] <- if(is.null(value)) NULL else as.bibentry(value)
} else {
stopifnot(is.character(j),
length(j) == 1L)
Expand All @@ -839,7 +848,7 @@ function(x, i, j, value)
i <- s[[i]]
y <- unclass(x)
if(missing(j)) {
y[i] <- as.bibentry(value)
y[i] <- if(is.null(value)) NULL else as.bibentry(value)
} else {
stopifnot(is.character(j),
length(j) == 1L)
Expand Down

0 comments on commit 0986e80

Please sign in to comment.