From 9c794646c6be70c582e3c44391805856fc6a1702 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Fri, 20 Dec 2024 15:49:13 +0100 Subject: [PATCH] Rename JekyllPost to HugoPost --- scripts/announce_mod_update.py | 4 ++-- scripts/util.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/announce_mod_update.py b/scripts/announce_mod_update.py index 25e67de..7ebe73a 100644 --- a/scripts/announce_mod_update.py +++ b/scripts/announce_mod_update.py @@ -5,7 +5,7 @@ import util from dataclasses import dataclass from pathlib import Path -from util import JekyllPost +from util import HugoPost @dataclass @@ -36,7 +36,7 @@ def parse_changelog(content: str) -> str: return "\n".join(changelog_lines).strip() -def create_announcement(mod_update: JekyllPost) -> WurstForumDiscussion: +def create_announcement(mod_update: HugoPost) -> WurstForumDiscussion: """Create an announcement from a mod update post.""" # Title title = mod_update.front_matter["title"] diff --git a/scripts/util.py b/scripts/util.py index 5865e79..5488cbd 100644 --- a/scripts/util.py +++ b/scripts/util.py @@ -12,20 +12,20 @@ @dataclass -class JekyllPost: +class HugoPost: front_matter: CommentedMap content: str path: Path -def read_post(path: Path) -> JekyllPost: +def read_post(path: Path) -> HugoPost: """Read front matter and content from a Jekyll/Hugo post.""" content = path.read_text(encoding="utf-8") parts = content.split("---", 2) if len(parts) < 3: raise ValueError(f"Invalid front matter format in {path}") - return JekyllPost(yaml.load(parts[1]), parts[2].strip(), path) + return HugoPost(yaml.load(parts[1]), parts[2].strip(), path) def write_front_matter(path: Path, front_matter: CommentedMap): @@ -41,7 +41,7 @@ def write_front_matter(path: Path, front_matter: CommentedMap): path.write_text(new_content, encoding="utf-8", newline="\n") -def find_mod_update_post(mod: str, version: str) -> JekyllPost: +def find_mod_update_post(mod: str, version: str) -> HugoPost: """Find the mod update post for a specific version.""" posts_folder = Path("content") / mod version_slug = version.replace(".", "-")