Skip to content

Commit ee73d2e

Browse files
committed
Fix newline case
1 parent 333f8bd commit ee73d2e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

scripts/tokenide.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ def to_element(self) -> ET.Element:
101101

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

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

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

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

120120
build_page(sheet, "", self.sheet)
121121
return sheet

0 commit comments

Comments
 (0)