From 74931d6425887ab757ab2a8035892dea5ca04024 Mon Sep 17 00:00:00 2001 From: Omar Date: Wed, 19 Nov 2025 09:12:29 +0200 Subject: [PATCH] fix: Revert exclusion reason parsing to original logic and improve apostrophe handling --- R/PRISMA_flowdiagram.R | 12 ++++++------ R/utils.R | 5 ++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/R/PRISMA_flowdiagram.R b/R/PRISMA_flowdiagram.R index 94cc2c8..40fb89b 100755 --- a/R/PRISMA_flowdiagram.R +++ b/R/PRISMA_flowdiagram.R @@ -1447,7 +1447,7 @@ PRISMA_data <- function(data) { #nolint ) dbr_excluded <- data.frame( reason = gsub( - ",\\s*\\d+\\s*$", + ",.*$", "", unlist( strsplit( @@ -1464,8 +1464,8 @@ PRISMA_data <- function(data) { #nolint ) ), n = gsub( - "^.*,\\s*(\\d+)\\s*$", - "\\1", + ".*,", + "", unlist( strsplit( as.character( @@ -1493,7 +1493,7 @@ PRISMA_data <- function(data) { #nolint ) other_excluded <- data.frame( reason = gsub( - ",\\s*\\d+\\s*$", + ",.*$", "", unlist( strsplit( @@ -1510,8 +1510,8 @@ PRISMA_data <- function(data) { #nolint ) ), n = gsub( - "^.*,\\s*(\\d+)\\s*$", - "\\1", + ".*,", + "", unlist( strsplit( as.character( diff --git a/R/utils.R b/R/utils.R index 2a0ff59..25aea36 100644 --- a/R/utils.R +++ b/R/utils.R @@ -5,10 +5,9 @@ PRISMA_escape_text_ <- function(text) { #nolint if (is.null(text)) return(text) text <- as.character(text) - # Escape backslashes first, then quotes and apostrophes - text <- gsub("\\", "\\\\", text, fixed = TRUE) + # Escape double quotes and apostrophes for DOT syntax text <- gsub('"', '\\"', text, fixed = TRUE) - text <- gsub("'", "\\'", text, fixed = TRUE) + text <- gsub("'", "'", text, fixed = TRUE) return(text) }