Hack for metadata in the document

This commit is contained in:
John Doty 2024-09-13 16:53:51 -07:00
parent 265f07fd5a
commit 709ba060b4
2 changed files with 23 additions and 2 deletions

View file

@ -506,7 +506,8 @@ class Harness:
lines.extend(node.format_lines(self.source))
def format_document(self, lines: list[str], doc: wadler.Document, indent: int = 0):
def append(x: str):
def append(x: str, i: int = 0):
i += indent
lines.append((" " * indent) + x)
match doc:
@ -540,6 +541,14 @@ class Harness:
self.format_document(lines, doc.left, indent)
self.format_document(lines, doc.right, indent)
case wadler.Marker():
append("Marker")
append("metadata", 1)
for k, v in doc.meta.items():
append(f"{k}={v}", 2)
append("child", 1)
self.format_document(lines, doc.child, indent + 2)
case None:
pass