diff options
| author | Botond Hende <contact@wazul.moe> | 2026-05-01 12:40:06 +0200 |
|---|---|---|
| committer | Botond Hende <contact@wazul.moe> | 2026-05-01 12:40:06 +0200 |
| commit | db2f67bdd0902048a5d3faa9fe46a71c4aaa4bb3 (patch) | |
| tree | aef73c69bf9e5c34e00e6c7329979b3655c6b069 /modules/main_generate.py | |
| parent | 64a4603ec2ca7b77e7331955f8c9edb4d5ae6b87 (diff) | |
root domain content generation wip
Diffstat (limited to 'modules/main_generate.py')
| -rw-r--r-- | modules/main_generate.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/modules/main_generate.py b/modules/main_generate.py new file mode 100644 index 0000000..7137537 --- /dev/null +++ b/modules/main_generate.py @@ -0,0 +1,28 @@ +import os.path +import shutil +import jinja2 + +from ..config import Config +import os.path +import shutil + +import jinja2 + +from ..config import Config + + +def generate(jinja_env: jinja2.Environment, output_root_path: str, local: bool): + if os.path.exists(output_root_path): + shutil.rmtree(output_root_path) + + os.mkdir(output_root_path) + + jinja_env.globals.update(main={ + "main_url": Config.MAIN_ROOT_URL, + }) + + root_template = jinja_env.get_template("main.html.j2") + with open(os.path.join(output_root_path, "index.html"), "w") as f: + f.write(root_template.render({"url" : Config.MAIN_ROOT_URL, "title": Config.MAIN_NAME})) + + shutil.copytree(Config.CODENAMES_ASSETS_SOURCE_DIR, output_root_path + Config.ASSETS_IMPORT_PATH)
\ No newline at end of file |
