Skip to content

Commit

Permalink
Fix missing metadata and newline for TokenIDE
Browse files Browse the repository at this point in the history
  • Loading branch information
kg583 committed Aug 18, 2024
1 parent 7811d40 commit 91e9b8a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions scripts/tokenide.py
Original file line number Diff line number Diff line change
Expand Up @@ -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", {}))
Expand Down

0 comments on commit 91e9b8a

Please sign in to comment.