From 7cab7da4bb3149527d25de3970557e171b8cbb15 Mon Sep 17 00:00:00 2001 From: James Westman Date: Thu, 25 Nov 2021 18:27:53 -0600 Subject: [PATCH] Allow \' in strings --- gtkblueprinttool/parse_tree.py | 3 ++- tests/samples/strings.blp | 2 +- tests/samples/strings.ui | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gtkblueprinttool/parse_tree.py b/gtkblueprinttool/parse_tree.py index 551f403..28d6596 100644 --- a/gtkblueprinttool/parse_tree.py +++ b/gtkblueprinttool/parse_tree.py @@ -494,7 +494,8 @@ class UseQuoted(ParseNode): string = (str(token)[1:-1] .replace("\\n", "\n") .replace("\\\"", "\"") - .replace("\\\\", "\\")) + .replace("\\\\", "\\") + .replace("\\'", "\'")) ctx.set_group_val(self.key, string, token) return True diff --git a/tests/samples/strings.blp b/tests/samples/strings.blp index 6ea0f7d..ef237ae 100644 --- a/tests/samples/strings.blp +++ b/tests/samples/strings.blp @@ -1,5 +1,5 @@ using Gtk 4.0; Label { - label: "Test 1 2 3\n & 4 \"5\" 6"; + label: "Test 1 2 3\n & 4 \"5\' 6"; } diff --git a/tests/samples/strings.ui b/tests/samples/strings.ui index 6350ddf..b8ca96a 100644 --- a/tests/samples/strings.ui +++ b/tests/samples/strings.ui @@ -3,6 +3,6 @@ Test 1 2 3 - & 4 "5" 6 + & 4 "5' 6