Create a website from a json.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

36 lines
709 B

"""Jinja2 generator."""
from jinja2 import Environment, FileSystemLoader # type: ignore
env = Environment(loader=FileSystemLoader('builder/templates'))
def get_arguments() -> dict:
return {"a": "b"}
def render(file: str, args: dict) -> str:
"""Render a template file."""
template = env.get_template(file)
return template.render(args)
def write_output(result, location) -> None:
"""Write output to file."""
with open(location, "w") as f:
f.write(result)
def main():
"""Script entrypoint."""
write_output(
render(
'index.html',
get_arguments()
),
'build/index.html'
)
if __name__ == "__main__":
main()