Updated onedoc

This commit is contained in:
Benjamyn Love 2023-12-18 19:21:40 +11:00
parent 80522dd162
commit f3b742fe80

View File

@ -8,12 +8,13 @@ environment = jinja2.Environment(loader=jinja2.FileSystemLoader("templates/"))
# Get list of templates and brands
templates = environment.list_templates()
brands = [json.load(brand.open()) for brand in Path("brands/").glob("*.json")]
# guides = [json.load(guide.open()) for guide in Path("guides/").glob("*.json")]
# template = environment.get_template('main.jinja')
# print(template)
for template in templates:
template_name = template.split('.')[0]
# guide = None
# for g in guides:
# if g['template_name'] == template:
@ -22,5 +23,5 @@ for template in templates:
continue
for brand in brands:
rendered_template = environment.get_template(template).render(**brand)
with open(f"out/{template.split('.')[0]}_{brand['file_suffix']}.html", 'w') as f:
with open(f"out/{template_name}_{brand['file_suffix']}.html", 'w') as f:
f.write(rendered_template)