Skip to content

Commit

Permalink
Rename JekyllPost to HugoPost
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander01998 committed Dec 20, 2024
1 parent 6e72e4a commit 9c79464
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions scripts/announce_mod_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import util
from dataclasses import dataclass
from pathlib import Path
from util import JekyllPost
from util import HugoPost


@dataclass
Expand Down Expand Up @@ -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"]
Expand Down
8 changes: 4 additions & 4 deletions scripts/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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(".", "-")
Expand Down

0 comments on commit 9c79464

Please sign in to comment.