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

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