Skip to content

Commit

Permalink
Fix newline case
Browse files Browse the repository at this point in the history
  • Loading branch information
kg583 committed Aug 19, 2024
1 parent 333f8bd commit ee73d2e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/tokenide.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ def to_element(self) -> ET.Element:

sheet.extend(self.sheet["meta"] or [ET.Element("Groups"), ET.Element("Styles")])

def build_page(element: ET.Element, byte: str, dct: dict):
def build_page(element: ET.Element, byte: str, dct: dict, depth: int = 0):
# Special case for newline
if byte == "$3F":
if byte == "$3F" and depth == 1:
element = ET.SubElement(element, "Token", byte=byte, string=r"\n", stringTerminator="true")

elif byte:
Expand All @@ -115,7 +115,7 @@ def build_page(element: ET.Element, byte: str, dct: dict):
element.append(ET.Element("Alt", string=name))

for child_byte, child_dct in sorted(dct.get("tokens", {}).items()):
build_page(element, child_byte, child_dct)
build_page(element, child_byte, child_dct, depth + 1)

build_page(sheet, "", self.sheet)
return sheet
Expand Down

0 comments on commit ee73d2e

Please sign in to comment.