14 lines
381 B
Python
14 lines
381 B
Python
|
from jinja2.environment import Template
|
||
|
|
||
|
|
||
|
def generate(args, deps, output):
|
||
|
env = args["jinja2"]["environment"]
|
||
|
template = env.get_template(deps[0])
|
||
|
with open(output, "w") as out:
|
||
|
out.write(tpl2tex(template, metas=args))
|
||
|
yield f"GENERATE - {deps[0]} to {output}"
|
||
|
|
||
|
|
||
|
def tpl2tex(template: Template, metas: dict = {}) -> str:
|
||
|
return template.render(metas)
|