From 7308b658153e089456dd1b5ad691ff8db19088cd Mon Sep 17 00:00:00 2001 From: Botond Hende Date: Tue, 23 Dec 2025 15:57:09 +0100 Subject: comic styling --- modules/comic_generate.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'modules') diff --git a/modules/comic_generate.py b/modules/comic_generate.py index 7c55521..9c88d67 100644 --- a/modules/comic_generate.py +++ b/modules/comic_generate.py @@ -59,6 +59,7 @@ def generate(jinja_env: jinja2.Environment, output_root_path: str, local: bool): issues = get_issues(Config.ISSUE_SOURCE_DIR, local) issue_template = jinja_env.get_template("issue.html.j2") + last_render = None for issue in issues: output_dir = os.path.join(output_root_path, "issues", issue.index) @@ -69,10 +70,13 @@ def generate(jinja_env: jinja2.Environment, output_root_path: str, local: bool): "url": f"{Config.COMIC_ROOT_URL}/issues/{issue.index}" } + last_render = issue_template.render(ctx) with open(os.path.join(output_dir, "index.html"), "w") as f: - f.write(issue_template.render(ctx)) + f.write(last_render) shutil.copyfile(os.path.join(issue.path, IMAGE_FILE_NAME), os.path.join(output_dir, IMAGE_FILE_NAME)) - shutil.copytree(Config.COMIC_ASSETS_SOURCE_DIR, output_root_path + Config.ASSETS_IMPORT_PATH) + with open(os.path.join(output_root_path, "index.html"), "w") as f: + f.write(last_render) + shutil.copytree(Config.COMIC_ASSETS_SOURCE_DIR, output_root_path + Config.ASSETS_IMPORT_PATH) -- cgit v1.2.3-70-g09d2