5 changed files with 48 additions and 0 deletions
@ -0,0 +1 @@ |
|||
build |
@ -0,0 +1,36 @@ |
|||
"""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() |
Binary file not shown.
@ -0,0 +1,10 @@ |
|||
<!DOCTYPE html> |
|||
<html data-darkreader-mode="dynamic" data-darkreader-scheme="dark" lang="fr-FR"> |
|||
<head> |
|||
<link rel="stylesheet" src="css/main.css" type="text/css" /> |
|||
</head> |
|||
|
|||
<body> |
|||
{{ a }} |
|||
</body> |
|||
</html> |
@ -0,0 +1 @@ |
|||
jinja2 |
Loading…
Reference in new issue