From 91e9b8a3ded5326de00a96432eb9f21d280af19b Mon Sep 17 00:00:00 2001 From: KG Date: Sun, 18 Aug 2024 11:43:16 -0400 Subject: [PATCH] Fix missing metadata and newline for TokenIDE --- scripts/tokenide.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/tokenide.py b/scripts/tokenide.py index 99f85c8..4bcef1e 100644 --- a/scripts/tokenide.py +++ b/scripts/tokenide.py @@ -99,10 +99,14 @@ def to_element(self) -> ET.Element: {"xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance", "xmlns:xsd": "http://www.w3.org/2001/XMLSchema"}) - sheet.extend(self.sheet["meta"]) + sheet.extend(self.sheet["meta"] or [ET.Element("Groups"), ET.Element("Styles")]) def build_page(element: ET.Element, byte: str, dct: dict): - if byte: + # Special case for newline + if byte == "$3F": + element = ET.SubElement(element, "Token", byte=byte, string=r"\n", stringTerminator="true") + + elif byte: element = ET.SubElement(element, "Token", byte=byte, **({"string": dct["string"]} if dct.get("string", None) is not None else {}), **dct.get("attrib", {}))