Skip to content

Commit 74931d6

Browse files
committed
fix: Revert exclusion reason parsing to original logic and improve apostrophe handling
1 parent c0b99d1 commit 74931d6

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

R/PRISMA_flowdiagram.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,7 +1447,7 @@ PRISMA_data <- function(data) { #nolint
14471447
)
14481448
dbr_excluded <- data.frame(
14491449
reason = gsub(
1450-
",\\s*\\d+\\s*$",
1450+
",.*$",
14511451
"",
14521452
unlist(
14531453
strsplit(
@@ -1464,8 +1464,8 @@ PRISMA_data <- function(data) { #nolint
14641464
)
14651465
),
14661466
n = gsub(
1467-
"^.*,\\s*(\\d+)\\s*$",
1468-
"\\1",
1467+
".*,",
1468+
"",
14691469
unlist(
14701470
strsplit(
14711471
as.character(
@@ -1493,7 +1493,7 @@ PRISMA_data <- function(data) { #nolint
14931493
)
14941494
other_excluded <- data.frame(
14951495
reason = gsub(
1496-
",\\s*\\d+\\s*$",
1496+
",.*$",
14971497
"",
14981498
unlist(
14991499
strsplit(
@@ -1510,8 +1510,8 @@ PRISMA_data <- function(data) { #nolint
15101510
)
15111511
),
15121512
n = gsub(
1513-
"^.*,\\s*(\\d+)\\s*$",
1514-
"\\1",
1513+
".*,",
1514+
"",
15151515
unlist(
15161516
strsplit(
15171517
as.character(

R/utils.R

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
PRISMA_escape_text_ <- function(text) { #nolint
66
if (is.null(text)) return(text)
77
text <- as.character(text)
8-
# Escape backslashes first, then quotes and apostrophes
9-
text <- gsub("\\", "\\\\", text, fixed = TRUE)
8+
# Escape double quotes and apostrophes for DOT syntax
109
text <- gsub('"', '\\"', text, fixed = TRUE)
11-
text <- gsub("'", "\\'", text, fixed = TRUE)
10+
text <- gsub("'", "&#39;", text, fixed = TRUE)
1211
return(text)
1312
}
1413

0 commit comments

Comments
 (0)