Skip to content

Commit e9ac91a

Browse files
author
hornik
committed
Quick fix for allowing commas in before/after.
git-svn-id: https://svn.r-project.org/R/trunk@88549 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent a3c9eec commit e9ac91a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/library/tools/R/RdHelpers.R

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ function(x, textual = FALSE)
243243
{
244244
x <- trimws(x)
245245
bib <- R_bibentries()
246-
given <- strsplit(x, ",[[:space:]]*")[[1L]]
246+
given <- strsplit(x, "[^\\],[[:space:]]*")[[1L]]
247247
parts <- strsplit(given, "|", fixed = TRUE)
248248
parts <- parts[lengths(parts) %in% c(1L, 3L)]
249249
## Could complain about the others ...?
@@ -253,8 +253,12 @@ function(x, textual = FALSE)
253253
}
254254
if(any(ind <- (lengths(parts) == 3L))) {
255255
keys[ind] <- vapply(parts, `[`, "", 2L)
256-
after[ind] <- vapply(parts, `[`, "", 3L)
257-
before[ind] <- vapply(parts, `[`, "", 1L)
256+
after[ind] <- gsub("\\,", ",",
257+
vapply(parts, `[`, "", 3L),
258+
fixed = TRUE)
259+
before[ind] <- gsub("\\,", ",",
260+
vapply(parts, `[`, "", 1L),
261+
fixed = TRUE)
258262
}
259263
ind <- keys %in% .bibentry_get_key(bib)
260264
if(!all(ind)) {

0 commit comments

Comments
 (0)