diff options
| author | Botond Hende <nettingman@gmail.com> | 2025-12-23 17:39:29 +0100 |
|---|---|---|
| committer | Botond Hende <nettingman@gmail.com> | 2025-12-23 17:39:29 +0100 |
| commit | a365cbec827ad44e196c62558272e723e3a3b564 (patch) | |
| tree | 8655728428e2eaffd7c58b5c265c06a46c5d8560 /modules | |
| parent | 7308b658153e089456dd1b5ad691ff8db19088cd (diff) | |
comic page, other than buttons, finished
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/blog_generate.py | 2 | ||||
| -rw-r--r-- | modules/comic_generate.py | 17 |
2 files changed, 17 insertions, 2 deletions
diff --git a/modules/blog_generate.py b/modules/blog_generate.py index 04bd673..904050d 100644 --- a/modules/blog_generate.py +++ b/modules/blog_generate.py @@ -98,7 +98,7 @@ def generate(jinja_env: jinja2.Environment, output_root_path: str, local: bool): with open(os.path.join(output_root_path, "acknowledgement.html"), "w") as f: f.write(acknowledgement_template.render({})) - rss_template = jinja_env.get_template("feed.xml.j2") + rss_template = jinja_env.get_template("blog_feed.xml.j2") ctx = { "build_date": email.utils.format_datetime(datetime.datetime.now(Config.TIMEZONE)), "posts": posts[:5] diff --git a/modules/comic_generate.py b/modules/comic_generate.py index 9c88d67..76705fa 100644 --- a/modules/comic_generate.py +++ b/modules/comic_generate.py @@ -33,6 +33,12 @@ class Issue: def get_publish_time(self) -> str: return self.meta_data[PUBLISH_DATE_KEY] + def get_publish_time_rfc2822(self) -> str: + return email.utils.format_datetime(datetime.datetime.fromisoformat(self.get_publish_time() + " 12:00+02:00")) + + def get_link(self) -> str: + return f"{Config.COMIC_ROOT_URL}/issues/{self.index}" + def get_issues(path: str, local: bool) -> list[Issue]: return_list = [] @@ -55,6 +61,7 @@ def generate(jinja_env: jinja2.Environment, output_root_path: str, local: bool): jinja_env.globals.update(comic={ "comic_name": Config.COMIC_NAME, + "comic_url": Config.COMIC_ROOT_URL, }) issues = get_issues(Config.ISSUE_SOURCE_DIR, local) @@ -67,7 +74,7 @@ def generate(jinja_env: jinja2.Environment, output_root_path: str, local: bool): ctx = { "issue": issue, - "url": f"{Config.COMIC_ROOT_URL}/issues/{issue.index}" + "url": issue.get_link() } last_render = issue_template.render(ctx) @@ -80,3 +87,11 @@ def generate(jinja_env: jinja2.Environment, output_root_path: str, local: bool): f.write(last_render) shutil.copytree(Config.COMIC_ASSETS_SOURCE_DIR, output_root_path + Config.ASSETS_IMPORT_PATH) + rss_template = jinja_env.get_template("comic_feed.xml.j2") + ctx = { + "build_date": email.utils.format_datetime(datetime.datetime.now(Config.TIMEZONE)), + "issues": issues[:5] + } + with open(os.path.join(output_root_path, "feed.xml"), "w") as f: + f.write(rss_template.render(ctx)) + |
