Store template resolved nodes back in nodes object
This commit is contained in:
10
tools/render
10
tools/render
@@ -124,10 +124,10 @@ def main():
|
|||||||
yml_data["filename"] = filename
|
yml_data["filename"] = filename
|
||||||
nodes.append(yml_data)
|
nodes.append(yml_data)
|
||||||
|
|
||||||
final_nodes = []
|
# Quick and dirty way to resolve all the templates using a custom encoder
|
||||||
for node in nodes:
|
nodes = list(
|
||||||
# Quick and dirty way to resolve all the templates using a custom encoder
|
map(lambda node: json.loads(json.dumps(node, cls=node_encoder(node))), nodes)
|
||||||
final_nodes.append(json.loads(json.dumps(node, cls=node_encoder(node))))
|
)
|
||||||
|
|
||||||
with open(ROOT.joinpath("config.yaml")) as fyaml:
|
with open(ROOT.joinpath("config.yaml")) as fyaml:
|
||||||
config = yaml.safe_load(fyaml)
|
config = yaml.safe_load(fyaml)
|
||||||
@@ -136,7 +136,7 @@ def main():
|
|||||||
for template_name in TEMPLATES.list_templates():
|
for template_name in TEMPLATES.list_templates():
|
||||||
template = TEMPLATES.get_template(template_name)
|
template = TEMPLATES.get_template(template_name)
|
||||||
|
|
||||||
rendered = template.render(nodes=final_nodes, config=config)
|
rendered = template.render(nodes=nodes, config=config)
|
||||||
with open(RENDERED.joinpath(template_name), "w") as f:
|
with open(RENDERED.joinpath(template_name), "w") as f:
|
||||||
f.write(rendered)
|
f.write(rendered)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user