From 5a13f45f73e7944b82d74cf1d1c6b7312be1e1df Mon Sep 17 00:00:00 2001 From: KG Date: Wed, 20 Dec 2023 16:24:34 -0500 Subject: [PATCH] Improve child iterator --- scripts/tokenide.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/tokenide.py b/scripts/tokenide.py index a224247..270ba54 100644 --- a/scripts/tokenide.py +++ b/scripts/tokenide.py @@ -28,7 +28,7 @@ class TokenIDESheet: NAMESPACE = "http://merthsoft.com/Tokens" STARTERS = [b'\x2A'] - TERMINATORS = [b'\x04', b'*', b'\x3F'] + TERMINATORS = [b'\x04', b'\x2A', b'\x3F'] def __init__(self, sheet: dict[str] = None): self.sheet = sheet or {"tokens": {}, "meta": []} @@ -111,8 +111,8 @@ def build_page(element: ET.Element, byte: str, dct: dict): for name in dct.get("variants", set()): element.append(ET.Element("Alt", string=name)) - for child in dict(sorted(dct.get("tokens", {}).items())): - build_page(element, child, dct["tokens"][child]) + for child_byte, child_dct in sorted(dct.get("tokens", {}).items()): + build_page(element, child_byte, child_dct) build_page(sheet, "", self.sheet) return sheet