Browse Source

feat: base builder

Signed-off-by: QuentinN42 <quentin@lieumont.fr>
master
QuentinN42 4 months ago
parent
commit
8a34274ead
Signed by untrusted user: number42 GPG Key ID: 2CD7D563712B3A50
  1. 1
      .gitignore
  2. 36
      builder/__main__.py
  3. BIN
      builder/__pycache__/__main__.cpython-310.pyc
  4. 10
      builder/templates/index.html
  5. 1
      requirements.txt

1
.gitignore

@ -0,0 +1 @@
build

36
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()

BIN
builder/__pycache__/__main__.cpython-310.pyc

Binary file not shown.

10
builder/templates/index.html

@ -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>

1
requirements.txt

@ -0,0 +1 @@
jinja2
Loading…
Cancel
Save