imagestack/tools/angestoepselt_typst/typst/main.py
2025-06-04 22:02:58 +02:00

27 lines
487 B
Python
Executable file

#!/bin/env python3
import json
import typst
data_string = """{
"id": "03711",
"distribution": "Debian",
"version": "12",
"cpu": "i7 4352",
"memory": "16GB",
"disk": "8tb"
}
"""
data = data_string
print(data)
j = json.loads(data)
print(f"JSON:{j} {type(j)}")
d = {"computer": json.dumps(j)}
print(f"data:{d} {type(d)}")
res = typst.compile(input="../src/main.typ", sys_inputs=d)
with open("demofile.pdf", "wb") as f:
f.write(res)