Skip to content

Commit 4ca027c

Browse files
committed
fix: automatically escape single quotes in attributes
fix #329
1 parent 673906d commit 4ca027c

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Type: Package
22
Package: ggiraph
33
Title: Make 'ggplot2' Graphics Interactive
4-
Version: 0.9.3.002
4+
Version: 0.9.3.003
55
Authors@R: c(
66
person("David", "Gohel", , "david.gohel@ardata.fr", role = c("aut", "cre")),
77
person("Panagiotis", "Skintzos", , "sigmapi@posteo.net", role = "aut"),

NEWS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
IT DOES NOT makes ggplot objects pipe-able with `girafe()` (unless you add
77
parenthesis around your ggplot code).
88

9+
## Issues
10+
11+
- single quotes in attribute values (e.g. "Côte d'Ivoire") are now automatically
12+
escaped instead of raising an error (#329).
13+
914
# ggiraph 0.9.2
1015

1116
## Feature

R/tracers.R

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@ set_attr <- function(name, ids, values) {
5353
stopifnot(length(name) == 1)
5454
stopifnot(is.character(values))
5555
stopifnot(is.numeric(ids))
56-
if (any(grepl(pattern = "'", values))) {
57-
abort("Attribute values cannot contain single quote \"'\".", call = NULL)
58-
}
56+
values <- gsub(pattern = "'", replacement = "\u2019", values)
5957

6058
if (length(values) == 1 && length(ids) > 1) {
6159
values <- rep(values, length(ids))

inst/tinytest/test-tracers.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ source("setup.R")
5151

5252
# attributes cannot contain single quotes ----
5353
{
54-
expect_error(dsvg_doc({
54+
expect_silent(dsvg_doc({
5555
plot.new()
5656
ggiraph:::dsvg_tracer_on()
5757
points(c(0.5, .6), c(.4, .3))

0 commit comments

Comments
 (0)