Skip to content

Commit fde03f7

Browse files
committed
Rewrite MakeKeysUnique to avoid duplicate entry checks
1 parent 7fe7d2e commit fde03f7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

R/04InternalFunctions.R

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,12 @@ CreateBibKey <- function(ti, au, yr){
11621162

11631163
#' @keywords internal
11641164
MakeKeysUnique <- function(bib){
1165-
if (length(bib))
1166-
bib$key <- make.unique(names(bib), sep = ":")
1165+
if (length(bib)){
1166+
keys <- make.unique(names(bib), sep = ":")
1167+
bib <- unclass(bib)
1168+
for (i in seq_along(bib))
1169+
attr(bib[[i]], "key") <- keys[i]
1170+
class(bib) <- c("BibEntry", "bibentry")
1171+
}
11671172
bib
11681173
}

0 commit comments

Comments
 (0)