From a365cbec827ad44e196c62558272e723e3a3b564 Mon Sep 17 00:00:00 2001 From: Botond Hende Date: Tue, 23 Dec 2025 17:39:29 +0100 Subject: comic page, other than buttons, finished --- blog/templates/blog_feed.xml.j2 | 20 ++++++++++++++++++++ blog/templates/feed.xml.j2 | 20 -------------------- comic/assets/css/comic.css | 26 +++++++++++++++++++++++++- comic/assets/images/banner_placeholder.png | Bin 0 -> 13661 bytes comic/templates/comic_feed.xml.j2 | 24 ++++++++++++++++++++++++ comic/templates/issue.html.j2 | 10 ++++++++-- modules/blog_generate.py | 2 +- modules/comic_generate.py | 17 ++++++++++++++++- 8 files changed, 94 insertions(+), 25 deletions(-) create mode 100644 blog/templates/blog_feed.xml.j2 delete mode 100644 blog/templates/feed.xml.j2 create mode 100644 comic/assets/images/banner_placeholder.png create mode 100644 comic/templates/comic_feed.xml.j2 diff --git a/blog/templates/blog_feed.xml.j2 b/blog/templates/blog_feed.xml.j2 new file mode 100644 index 0000000..1133d85 --- /dev/null +++ b/blog/templates/blog_feed.xml.j2 @@ -0,0 +1,20 @@ + + + + @yggdrasil + https://blog.wazul.moe/feed.xml + The chronicle of my works and learnings + en + {{ build_date }} + {% for post in posts %} + + {{ post.title() }} + {{ post.get_link() }} + {{ post.intro }} + {{ post.get_link() }} + contact@wazul.moe + {{ post.get_publish_time_rfc2822() }} + + {% endfor %} + + \ No newline at end of file diff --git a/blog/templates/feed.xml.j2 b/blog/templates/feed.xml.j2 deleted file mode 100644 index 7e51092..0000000 --- a/blog/templates/feed.xml.j2 +++ /dev/null @@ -1,20 +0,0 @@ - - - - @yggdrasil - https://blog.wazul.moe/feed.xml - The chronicle of my works and learnings - en - {{ build_date }} - {% for post in posts %} - - {{ post.title() }} - {{ post.get_link() }} - {{ post.intro }} - {{ post.get_link() }} - contact@wazul.moe - {{ post.get_publish_time_rfc2822() }} - - {% endfor %} - - \ No newline at end of file diff --git a/comic/assets/css/comic.css b/comic/assets/css/comic.css index f571a16..9449cab 100644 --- a/comic/assets/css/comic.css +++ b/comic/assets/css/comic.css @@ -21,6 +21,20 @@ main, footer { margin-top: 0.5rem; } +footer { + padding-top: 1rem !important; + padding-bottom: 1rem !important;; +} + +hr { + width: 30%; + color: #e9d3ff; +} + +img.banner { + width: 100%; +} + img.comic { width: 100%; border: 0.1rem solid black; @@ -31,6 +45,16 @@ p { margin: 0.2rem; } +a { + color: #801396; + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} + p.description { - margin-top: 3rem; + margin-top: 2rem; + margin-bottom: 2rem; } \ No newline at end of file diff --git a/comic/assets/images/banner_placeholder.png b/comic/assets/images/banner_placeholder.png new file mode 100644 index 0000000..64bff87 Binary files /dev/null and b/comic/assets/images/banner_placeholder.png differ diff --git a/comic/templates/comic_feed.xml.j2 b/comic/templates/comic_feed.xml.j2 new file mode 100644 index 0000000..eeb177d --- /dev/null +++ b/comic/templates/comic_feed.xml.j2 @@ -0,0 +1,24 @@ + + + + {{ comic.comic_name }} + https://comic.wazul.moe/feed.xml + Silly comic ideas by Wazul + en + {{ build_date }} + {% for issue in issues %} + + {{ issue.title() }} + {{ issue.get_link() }} + + <img src="{{ issue.get_link() }}/comic.png"/> + <br> + <p>{{ issue.description() }}</p> + + {{ issue.get_link() }} + contact@wazul.moe + {{ issue.get_publish_time_rfc2822() }} + + {% endfor %} + + \ No newline at end of file diff --git a/comic/templates/issue.html.j2 b/comic/templates/issue.html.j2 index 7eca898..70b4745 100644 --- a/comic/templates/issue.html.j2 +++ b/comic/templates/issue.html.j2 @@ -14,12 +14,12 @@
- +

{{ issue.title() }}

- + comic

{{ issue.description() }}

@@ -27,6 +27,12 @@
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)) + -- cgit v1.2.3-70-g09d2