From 8eda496eb9ec58cf1bd72df278dc4681b1117f99 Mon Sep 17 00:00:00 2001 From: pajotg <33227855+pajotg@users.noreply.github.com> Date: Tue, 16 Jul 2024 08:33:18 +0200 Subject: [PATCH 1/3] fix: double quotes not being escaped in text block --- package.json | 2 +- src/generators/arduino.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 427e27d..5684b2b 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "dist", "media" ], - "version": "3.1.1", + "version": "3.1.2", "description": "Leaphy custom Blockly blocks and arduino code generator", "name": "@leaphy-robotics/leaphy-blocks" } diff --git a/src/generators/arduino.ts b/src/generators/arduino.ts index 880f763..d662e93 100644 --- a/src/generators/arduino.ts +++ b/src/generators/arduino.ts @@ -385,6 +385,7 @@ export class Arduino extends Blockly.Generator { .replace(/\\/g, "\\\\") .replace(/\n/g, "\\\n") .replace(/\$/g, "\\$") + .replace(/\"/g, "\\\"") .replace(/'/g, "\\'"); return '"' + string + '"'; } From e6875d8e1309b20c473caed9a453fbdc38d53744 Mon Sep 17 00:00:00 2001 From: pajotg <33227855+pajotg@users.noreply.github.com> Date: Tue, 16 Jul 2024 12:54:10 +0200 Subject: [PATCH 2/3] chore: fix no useless escape --- src/generators/arduino.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/generators/arduino.ts b/src/generators/arduino.ts index 48a4176..f4936bb 100644 --- a/src/generators/arduino.ts +++ b/src/generators/arduino.ts @@ -385,7 +385,7 @@ export class Arduino extends Blockly.Generator { .replace(/\\/g, "\\\\") .replace(/\n/g, "\\\n") .replace(/\$/g, "\\$") - .replace(/\"/g, "\\\"") + .replace(/"/g, "\\\"") .replace(/'/g, "\\'"); return '"' + string + '"'; } From 495cd275f68be3fa23a38c69a80014283caf0965 Mon Sep 17 00:00:00 2001 From: pajotg <33227855+pajotg@users.noreply.github.com> Date: Tue, 16 Jul 2024 13:00:44 +0200 Subject: [PATCH 3/3] chore: run prettier --- src/generators/arduino.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/generators/arduino.ts b/src/generators/arduino.ts index f4936bb..88d8899 100644 --- a/src/generators/arduino.ts +++ b/src/generators/arduino.ts @@ -385,7 +385,7 @@ export class Arduino extends Blockly.Generator { .replace(/\\/g, "\\\\") .replace(/\n/g, "\\\n") .replace(/\$/g, "\\$") - .replace(/"/g, "\\\"") + .replace(/"/g, '\\"') .replace(/'/g, "\\'"); return '"' + string + '"'; }