You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
540 B
Python

1 year ago
import json
from jinja2 import Template, Environment, FileSystemLoader
1 year ago
import argparse
1 year ago
from common import load_json
1 year ago
ap = argparse.ArgumentParser("")
ap.add_argument("template")
ap.add_argument("output")
args = ap.parse_args()
env = Environment(loader=FileSystemLoader("scripts/templates"))
import jinjafilters
for name, fn in jinjafilters.all.items():
env.filters[name] = fn
1 year ago
1 year ago
data = load_json("merge.json")
template = env.get_template(args.template)
with open(args.output, "w") as fout:
1 year ago
print (template.render(**data), file=fout)