summaryrefslogtreecommitdiff
path: root/modules/comic_generate.py
diff options
context:
space:
mode:
Diffstat (limited to 'modules/comic_generate.py')
-rw-r--r--modules/comic_generate.py8
1 files changed, 6 insertions, 2 deletions
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)