diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..378eac2 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build diff --git a/builder/__main__.py b/builder/__main__.py new file mode 100644 index 0000000..c48af61 --- /dev/null +++ b/builder/__main__.py @@ -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() diff --git a/builder/__pycache__/__main__.cpython-310.pyc b/builder/__pycache__/__main__.cpython-310.pyc new file mode 100644 index 0000000..d66edd5 Binary files /dev/null and b/builder/__pycache__/__main__.cpython-310.pyc differ diff --git a/builder/templates/index.html b/builder/templates/index.html new file mode 100644 index 0000000..cc4df6a --- /dev/null +++ b/builder/templates/index.html @@ -0,0 +1,10 @@ + + + + + + + + {{ a }} + + diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..7f7afbf --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +jinja2