diff --git a/gtkblueprinttool/ast.py b/gtkblueprinttool/ast.py index d2251f7..67ec208 100644 --- a/gtkblueprinttool/ast.py +++ b/gtkblueprinttool/ast.py @@ -43,7 +43,8 @@ class UI(AstNode): for i in self.children[Import]: try: - gir_ctx.add_namespace(i.gir_namespace) + if i.gir_namespace is not None: + gir_ctx.add_namespace(i.gir_namespace) except CompileError as e: self._gir_errors.append(e) diff --git a/tests/samples/strings.blp b/tests/samples/strings.blp new file mode 100644 index 0000000..6ea0f7d --- /dev/null +++ b/tests/samples/strings.blp @@ -0,0 +1,5 @@ +using Gtk 4.0; + +Label { + label: "Test 1 2 3\n & 4 \"5\" 6"; +} diff --git a/tests/samples/strings.ui b/tests/samples/strings.ui new file mode 100644 index 0000000..6350ddf --- /dev/null +++ b/tests/samples/strings.ui @@ -0,0 +1,8 @@ + + + + + Test 1 2 3 + & 4 "5" 6 + + diff --git a/tests/test_samples.py b/tests/test_samples.py index bdaa92d..08d376e 100644 --- a/tests/test_samples.py +++ b/tests/test_samples.py @@ -62,6 +62,7 @@ class TestSamples(unittest.TestCase): self.assert_sample("menu") self.assert_sample("property") self.assert_sample("signal") + self.assert_sample("strings") self.assert_sample("style") self.assert_sample("template") self.assert_sample("using")