diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6d373cc..1ec071e 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -3,7 +3,7 @@ stages:
- pages
build:
- image: registry.gitlab.gnome.org/gnome/blueprint-compiler
+ image: registry.gitlab.gnome.org/jwestman/blueprint-compiler
stage: build
script:
- black --check --diff ./ tests
@@ -33,7 +33,7 @@ build:
path: coverage.xml
fuzz:
- image: registry.gitlab.gnome.org/gnome/blueprint-compiler
+ image: registry.gitlab.gnome.org/jwestman/blueprint-compiler
stage: build
script:
- meson _build
diff --git a/MAINTENANCE.md b/MAINTENANCE.md
index 3ab4fa2..220c117 100644
--- a/MAINTENANCE.md
+++ b/MAINTENANCE.md
@@ -8,7 +8,7 @@ in the NEWS file.
3. Make a new commit with just these two changes. Use `Release v{version}` as the commit message. Tag the commit as `v{version}` and push the tag.
4. Create a "Post-release version bump" commit.
5. Go to the Releases page in GitLab and create a new release from the tag.
-6. Announce the release through relevant channels (Mastodon, TWIG, etc.)
+6. Announce the release through relevant channels (Twitter, TWIG, etc.)
## Related projects
diff --git a/blueprint-compiler.doap b/blueprint-compiler.doap
deleted file mode 100644
index f3e4000..0000000
--- a/blueprint-compiler.doap
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
- Blueprint
- A modern language for creating GTK interfaces
- Blueprint is a language and associated tooling for building user interfaces for GTK.
-
- Python
-
-
-
-
-
-
-
- James Westman
-
- jwestman
-
-
-
diff --git a/blueprintcompiler/decompiler.py b/blueprintcompiler/decompiler.py
index 850b6d8..de6c06f 100644
--- a/blueprintcompiler/decompiler.py
+++ b/blueprintcompiler/decompiler.py
@@ -255,11 +255,7 @@ def decompile_element(
ctx._node_stack.append(xml)
ctx.start_block()
-
- try:
- gir = decompiler(*args, **kwargs)
- except TypeError as e:
- raise UnsupportedError(tag=xml.tag)
+ gir = decompiler(*args, **kwargs)
if not decompiler._skip_children:
for child in xml.children:
@@ -270,6 +266,8 @@ def decompile_element(
except UnsupportedError as e:
raise e
+ except TypeError as e:
+ raise UnsupportedError(tag=xml.tag)
def decompile(data: str) -> str:
diff --git a/blueprintcompiler/errors.py b/blueprintcompiler/errors.py
index df1c2e1..1e7297c 100644
--- a/blueprintcompiler/errors.py
+++ b/blueprintcompiler/errors.py
@@ -219,7 +219,7 @@ def report_bug(): # pragma: no cover
f"""{Colors.BOLD}{Colors.RED}***** COMPILER BUG *****
The blueprint-compiler program has crashed. Please report the above stacktrace,
along with the input file(s) if possible, on GitLab:
-{Colors.BOLD}{Colors.BLUE}{Colors.UNDERLINE}https://gitlab.gnome.org/GNOME/blueprint-compiler/-/issues/new?issue
+{Colors.BOLD}{Colors.BLUE}{Colors.UNDERLINE}https://gitlab.gnome.org/jwestman/blueprint-compiler/-/issues/new?issue
{Colors.CLEAR}"""
)
diff --git a/blueprintcompiler/interactive_port.py b/blueprintcompiler/interactive_port.py
index 12dd485..0c37885 100644
--- a/blueprintcompiler/interactive_port.py
+++ b/blueprintcompiler/interactive_port.py
@@ -71,7 +71,7 @@ def decompile_file(in_file, out_file) -> T.Union[str, CouldNotPort]:
print(
f"""{Colors.FAINT}Either the original XML file had an error, or there is a bug in the
porting tool. If you think it's a bug (which is likely), please file an issue on GitLab:
-{Colors.BLUE}{Colors.UNDERLINE}https://gitlab.gnome.org/GNOME/blueprint-compiler/-/issues/new?issue{Colors.CLEAR}\n"""
+{Colors.BLUE}{Colors.UNDERLINE}https://gitlab.gnome.org/jwestman/blueprint-compiler/-/issues/new?issue{Colors.CLEAR}\n"""
)
return CouldNotPort("does not compile")
@@ -136,7 +136,7 @@ def step1():
wrap.write(
f"""[wrap-git]
directory = blueprint-compiler
-url = https://gitlab.gnome.org/GNOME/blueprint-compiler.git
+url = https://gitlab.gnome.org/jwestman/blueprint-compiler.git
revision = {VERSION}
depth = 1
diff --git a/blueprintcompiler/language/adw_breakpoint.py b/blueprintcompiler/language/adw_breakpoint.py
index 3d2c10d..4ad5b24 100644
--- a/blueprintcompiler/language/adw_breakpoint.py
+++ b/blueprintcompiler/language/adw_breakpoint.py
@@ -81,8 +81,8 @@ class AdwBreakpointSetter(AstNode):
return self.tokens["property"]
@property
- def value(self) -> T.Optional[Value]:
- return self.children[Value][0] if len(self.children[Value]) > 0 else None
+ def value(self) -> Value:
+ return self.children[Value][0]
@property
def gir_class(self) -> T.Optional[GirType]:
@@ -106,10 +106,7 @@ class AdwBreakpointSetter(AstNode):
return None
@property
- def document_symbol(self) -> T.Optional[DocumentSymbol]:
- if self.value is None:
- return None
-
+ def document_symbol(self) -> DocumentSymbol:
return DocumentSymbol(
f"{self.object_id}.{self.property_name}",
SymbolKind.Property,
diff --git a/blueprintcompiler/language/expression.py b/blueprintcompiler/language/expression.py
index de6fbf1..e0b4246 100644
--- a/blueprintcompiler/language/expression.py
+++ b/blueprintcompiler/language/expression.py
@@ -302,18 +302,12 @@ expr.children = [
@decompiler("lookup", skip_children=True, cdata=True)
def decompile_lookup(
- ctx: DecompileCtx,
- gir: gir.GirContext,
- cdata: str,
- name: str,
- type: T.Optional[str] = None,
+ ctx: DecompileCtx, gir: gir.GirContext, cdata: str, name: str, type: str
):
if ctx.parent_node is not None and ctx.parent_node.tag == "property":
ctx.print("expr ")
- if type is None:
- type = ""
- elif t := ctx.type_by_cname(type):
+ if t := ctx.type_by_cname(type):
type = decompile.full_name(t)
else:
type = "$" + type
@@ -333,7 +327,7 @@ def decompile_lookup(
if constant == ctx.template_class:
ctx.print("template." + name)
elif constant == "":
- ctx.print(f"item as <{type}>.{name}")
+ ctx.print("item as <" + type + ">." + name)
else:
ctx.print(constant + "." + name)
return
diff --git a/blueprintcompiler/language/gobject_signal.py b/blueprintcompiler/language/gobject_signal.py
index 3b4235f..9c27b97 100644
--- a/blueprintcompiler/language/gobject_signal.py
+++ b/blueprintcompiler/language/gobject_signal.py
@@ -225,14 +225,8 @@ class Signal(AstNode):
@decompiler("signal")
-def decompile_signal(
- ctx: DecompileCtx, gir, name, handler, swapped=None, after="false", object=None
-):
+def decompile_signal(ctx, gir, name, handler, swapped=None, after="false", object=None):
object_name = object or ""
-
- if object_name == ctx.template_class:
- object_name = "template"
-
name = name.replace("_", "-")
line = f"{name} => ${handler}({object_name})"
diff --git a/blueprintcompiler/language/values.py b/blueprintcompiler/language/values.py
index 833a4a3..cb80975 100644
--- a/blueprintcompiler/language/values.py
+++ b/blueprintcompiler/language/values.py
@@ -225,12 +225,12 @@ class Flag(AstNode):
return self.tokens["value"]
@property
- def value(self) -> T.Optional[str]:
+ def value(self) -> T.Optional[int]:
type = self.context[ValueTypeCtx].value_type
if not isinstance(type, Enumeration):
return None
elif member := type.members.get(self.name):
- return member.nick
+ return member.value
else:
return None
diff --git a/blueprintcompiler/outputs/xml/__init__.py b/blueprintcompiler/outputs/xml/__init__.py
index 15850f7..5c03761 100644
--- a/blueprintcompiler/outputs/xml/__init__.py
+++ b/blueprintcompiler/outputs/xml/__init__.py
@@ -308,9 +308,6 @@ class XmlOutput(OutputFormat):
elif isinstance(extension, AdwBreakpointSetters):
for setter in extension.setters:
- if setter.value is None:
- continue
-
attrs = {}
if isinstance(setter.value.child, Translated):
diff --git a/blueprintcompiler/outputs/xml/xml_emitter.py b/blueprintcompiler/outputs/xml/xml_emitter.py
index d34eff4..ea91e03 100644
--- a/blueprintcompiler/outputs/xml/xml_emitter.py
+++ b/blueprintcompiler/outputs/xml/xml_emitter.py
@@ -73,7 +73,6 @@ class XmlEmitter:
self._needs_newline = False
def put_cdata(self, text: str):
- text = text.replace("]]>", "]]]]>")
self.result += f""
self._needs_newline = False
diff --git a/blueprintcompiler/parse_tree.py b/blueprintcompiler/parse_tree.py
index e590539..ae062fb 100644
--- a/blueprintcompiler/parse_tree.py
+++ b/blueprintcompiler/parse_tree.py
@@ -17,7 +17,7 @@
#
# SPDX-License-Identifier: LGPL-3.0-or-later
-"""Utilities for parsing an AST from a token stream."""
+""" Utilities for parsing an AST from a token stream. """
import typing as T
from enum import Enum
diff --git a/docs/collect-sections.py b/docs/collect-sections.py
index a2dd004..e6227e7 100755
--- a/docs/collect-sections.py
+++ b/docs/collect-sections.py
@@ -9,7 +9,7 @@ from pathlib import Path
__all__ = ["get_docs_section"]
-DOCS_ROOT = "https://gnome.pages.gitlab.gnome.org/blueprint-compiler"
+DOCS_ROOT = "https://jwestman.pages.gitlab.gnome.org/blueprint-compiler"
sections: dict[str, "Section"] = {}
@@ -132,8 +132,5 @@ if __name__ == "__main__":
# print the sections to a json file
with open(outfile, "w") as f:
json.dump(
- {name: section.to_json() for name, section in sections.items()},
- f,
- indent=2,
- sort_keys=True,
+ {name: section.to_json() for name, section in sections.items()}, f, indent=2
)
diff --git a/docs/flatpak.rst b/docs/flatpak.rst
index 8081c8d..86112cf 100644
--- a/docs/flatpak.rst
+++ b/docs/flatpak.rst
@@ -16,7 +16,7 @@ a module in your flatpak manifest:
"sources": [
{
"type": "git",
- "url": "https://gitlab.gnome.org/GNOME/blueprint-compiler",
+ "url": "https://gitlab.gnome.org/jwestman/blueprint-compiler",
"tag": "v0.16.0"
}
]
diff --git a/docs/index.rst b/docs/index.rst
index 6cd130f..34b942c 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -26,7 +26,7 @@ Blueprint is a markup language and compiler for GTK 4 user interfaces.
using Gtk 4.0;
- template $MyAppWindow: ApplicationWindow {
+ template MyAppWindow : ApplicationWindow {
default-width: 600;
default-height: 300;
title: _("Hello, Blueprint!");
@@ -35,7 +35,7 @@ Blueprint is a markup language and compiler for GTK 4 user interfaces.
HeaderBar {}
Label {
- label: bind template.main_text;
+ label: bind MyAppWindow.main_text;
}
}
@@ -59,7 +59,7 @@ Features
Links
-----
-- `Source code `_
+- `Source code `_
- `Workbench `_ lets you try, preview and export Blueprint
- `GNOME Builder `_ provides builtin support
- `Vim syntax highlighting plugin by thetek42 `_
diff --git a/docs/reference/extensions.rst b/docs/reference/extensions.rst
index 2fd5dbb..0961d14 100644
--- a/docs/reference/extensions.rst
+++ b/docs/reference/extensions.rst
@@ -10,7 +10,7 @@ Properties are the main way to set values on objects, but they are limited by th
Extensions are a feature of ``Gtk.Buildable``--see `Gtk.Buildable.custom_tag_start() `_ for internal details.
- Because they aren't part of the type system, they aren't present in typelib files like properties and signals are. Therefore, if a library adds a new extension, syntax for it must be added to Blueprint manually. If there's a commonly used extension that isn't supported by Blueprint, please `file an issue `_.
+ Because they aren't part of the type system, they aren't present in typelib files like properties and signals are. Therefore, if a library adds a new extension, syntax for it must be added to Blueprint manually. If there's a commonly used extension that isn't supported by Blueprint, please `file an issue `_.
.. rst-class:: grammar-block
diff --git a/docs/setup.rst b/docs/setup.rst
index 914c753..839f8f6 100644
--- a/docs/setup.rst
+++ b/docs/setup.rst
@@ -8,7 +8,7 @@ Setting up Blueprint on a new or existing project
Using the porting tool
~~~~~~~~~~~~~~~~~~~~~~
-Clone `blueprint-compiler `_
+Clone `blueprint-compiler `_
from source. You can install it using ``meson _build`` and ``ninja -C _build install``,
or you can leave it uninstalled.
@@ -29,7 +29,7 @@ blueprint-compiler works as a meson subproject.
[wrap-git]
directory = blueprint-compiler
- url = https://gitlab.gnome.org/GNOME/blueprint-compiler.git
+ url = https://gitlab.gnome.org/jwestman/blueprint-compiler.git
revision = main
depth = 1
diff --git a/tests/samples/flags.ui b/tests/samples/flags.ui
index 44eb2c4..2f0a26e 100644
--- a/tests/samples/flags.ui
+++ b/tests/samples/flags.ui
@@ -7,7 +7,7 @@ corresponding .blp file and regenerate this file with blueprint-compiler.