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