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

11 months ago
import json
from jinja2 import Template, Environment, FileSystemLoader
11 months ago
import argparse
11 months ago
from common import load_json
11 months 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
11 months ago
11 months ago
data = load_json("merge.json")
template = env.get_template(args.template)
with open(args.output, "w") as fout:
11 months ago
print (template.render(**data), file=fout)