Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ The used format is based on
[Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.5.46] - 2026-07-23

### 🐛 Bug Fixes

- Resolve missing homepage screenshot and asset paths in MkDocs preparation

## [1.5.45] - 2026-07-23

### 🚀 Features
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

NAME := flatpak-automatic
EPOCH := 1
VERSION := 1.5.45
VERSION := 1.5.46
REL_NUM := 1
DATE := $(shell LC_ALL=C date +"%a %b %d %Y")
AUTHOR := "fedoraBee <9395414+fedoraBee@users.noreply.github.com>"
Expand Down
2 changes: 1 addition & 1 deletion assets/banner.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/status-screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion config/sysconfig/flatpak-automatic
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Please migrate your settings to the new YAML format.
# ==============================================================================

# Version: 1.5.45 | Built for Fedora & Universal RPM Systems
# Version: 1.5.46 | Built for Fedora & Universal RPM Systems
# Built for Fedora & Universal RPM Systems

# --- [ Universal Notifications (Apprise) ] ---
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "flatpak-automatic"
version = "1.5.45"
version = "1.5.46"
authors = [
{ name = "fedoraBee", email = "9395414+fedoraBee@users.noreply.github.com" },
]
Expand Down
131 changes: 62 additions & 69 deletions scripts/maintainer/prepare_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ def prepare_docs(src_dir: str, docs_dir: str) -> None:

src_assets_dir = os.path.join(src_dir, "assets")
if os.path.isdir(src_assets_dir):
valid_extensions = (".svg", ".png", ".jpg", ".jpeg", ".gif", ".webp")
for item in os.listdir(src_assets_dir):
if item.endswith(".svg"):
if item.lower().endswith(valid_extensions):
safe_copy(
os.path.join(src_assets_dir, item), os.path.join(assets_dest, item)
)
Expand All @@ -82,71 +83,6 @@ def prepare_docs(src_dir: str, docs_dir: str) -> None:


def transform_files(docs_dir: str) -> None:
# Banner path replacements based on directory depth
replacements = [
# (pattern, replacement, file_glob)
(r'src="assets/banner.svg"', r'src="assets/banner.svg"', r"^index\.md$"),
(
r'src="assets/banner.svg"',
r'src="../assets/banner.svg"',
r"^(agents|changelog|maintainers|development)\.md$",
),
(
r'src="\.\./assets/banner.svg"',
r'src="../../assets/banner.svg"',
r"^about/.*\.md$",
),
]

# Link translations for index.md
index_path = os.path.join(docs_dir, "index.md")
if os.path.exists(index_path):
with open(index_path, "r") as f:
content = f.read()

# Translate internal links
content = content.replace("(AGENTS.md)", "(agents.md)")
content = content.replace("(docs/development.md)", "(development.md)")
content = content.replace("(docs/testing.md)", "(testing.md)")
content = content.replace(
"(.github/CONTRIBUTING.md)", "(about/contributing.md)"
)
content = content.replace("(CHANGELOG.md)", "(changelog.md)")
content = content.replace("(MAINTAINERS.md)", "(maintainers.md)")
content = content.replace("(.github/SECURITY.md)", "(about/security.md)")
# Specific resource link transformations
content = content.replace(
"- 📝 [Project Documentation](https://fedorabee.github.io/flatpak-automatic/)",
"- 📝 [GitHub Source Code](https://github.com/fedoraBee/flatpak-automatic/)",
)
content = content.replace(
"- 🌐 [Repository](https://fedorabee.github.io/flatpak-automatic/repository/)",
"- 🌐 [Repository](repository.md)",
)

with open(index_path, "w") as f:
f.write(content)

# Link translations for agents.md
agents_path = os.path.join(docs_dir, "agents.md")
if os.path.exists(agents_path):
with open(agents_path, "r") as f:
content = f.read()

# Translate internal links
content = content.replace("(README.md)", "(index.md)")
content = content.replace("(docs/development.md)", "(development.md)")
content = content.replace("(docs/testing.md)", "(testing.md)")
content = content.replace(
"(.github/CONTRIBUTING.md)", "(about/contributing.md)"
)
content = content.replace("(CHANGELOG.md)", "(changelog.md)")
content = content.replace("(MAINTAINERS.md)", "(maintainers.md)")
content = content.replace("(LICENSE)", "(license.md)")

with open(agents_path, "w") as f:
f.write(content)

# Walk through docs and apply replacements
for root, _, files in os.walk(docs_dir):
for f_name in files:
Expand All @@ -160,9 +96,66 @@ def transform_files(docs_dir: str) -> None:
content = f.read()

orig_content = content
for pattern, repl, file_re in replacements:
if re.search(file_re, rel_path):
content = re.sub(pattern, repl, content)

# Determine relative asset path prefix based on MkDocs page depth.
# In MkDocs:
# - index.md is at site root -> 'assets/'
# - Root md files (e.g. agents.md) become site/agents/index.html -> '../assets/'
# - Nested md files (e.g. about/contributing.md) become site/about/contributing/index.html -> '../../assets/'
if rel_path == "index.md":
asset_prefix = "assets/"
else:
parts = rel_path.split(os.sep)
depth = len(parts)
asset_prefix = "../" * depth + "assets/"

# HTML img tag src attribute replacement for assets/
content = re.sub(
r'src="(?:\.\./)*assets/([^"]+)"',
f'src="{asset_prefix}\\1"',
content,
)

# Markdown image syntax replacement for assets/
content = re.sub(
r"!\[([^\]]*)\]\((?:\.\./)*assets/([^)]+)\)",
f"![\\1]({asset_prefix}\\2)",
content,
)

# Link translations for index.md
if rel_path == "index.md":
content = content.replace("(AGENTS.md)", "(agents.md)")
content = content.replace("(docs/development.md)", "(development.md)")
content = content.replace("(docs/testing.md)", "(testing.md)")
content = content.replace(
"(.github/CONTRIBUTING.md)", "(about/contributing.md)"
)
content = content.replace("(CHANGELOG.md)", "(changelog.md)")
content = content.replace("(MAINTAINERS.md)", "(maintainers.md)")
content = content.replace(
"(.github/SECURITY.md)", "(about/security.md)"
)
content = content.replace(
"- 📝 [Project Documentation](https://fedorabee.github.io/flatpak-automatic/)",
"- 📝 [GitHub Source Code](https://github.com/fedoraBee/flatpak-automatic/)",
)
content = content.replace(
"- 🌐 [Repository](https://fedorabee.github.io/flatpak-automatic/repository/)",
"- 🌐 [Repository](repository.md)",
)

# Link translations for agents.md
elif rel_path == "agents.md":
content = content.replace("(README.md)", "(index.md)")
content = content.replace("(docs/development.md)", "(development.md)")
content = content.replace("(docs/testing.md)", "(testing.md)")
content = content.replace(
"(.github/CONTRIBUTING.md)", "(about/contributing.md)"
)
content = content.replace("(CHANGELOG.md)", "(changelog.md)")
content = content.replace("(MAINTAINERS.md)", "(maintainers.md)")
content = content.replace("(LICENSE)", "(license.md)")

# Specific fixes for about/ files
if rel_path.startswith("about/"):
Expand Down
2 changes: 1 addition & 1 deletion src/flatpak-automatic.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# Version: 1.5.45
# Version: 1.5.46
import sys
import os

Expand Down
2 changes: 1 addition & 1 deletion src/flatpak_automatic/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from .updater import FlatpakUpdater

__version__ = "1.5.45"
__version__ = "1.5.46"

from .snapper import SnapperManager
from .config import ConfigManager, StateManager
Expand Down
2 changes: 1 addition & 1 deletion src/flatpak_automatic/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def banner() -> str:
f"{Colors.OKBLUE} | __| |__ _ | |_ _ __ __ _ | |__ \n"
f"{Colors.HEADER} | _|| / _` || ._| '_ \\/ _` || / / \n"
f"{Colors.OKPINK} |_| |_\\__,_|\\__|| .__/\\__,_||_\\_\\\n"
f" AUTOMATIC |_| {Colors.ENDC} {Colors.OKCYAN} v1.5.45{Colors.ENDC}\n"
f" AUTOMATIC |_| {Colors.ENDC} {Colors.OKCYAN} v1.5.46{Colors.ENDC}\n"
)


Expand Down
2 changes: 1 addition & 1 deletion tbump.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[version]
current = "1.5.45"
current = "1.5.46"
# Updated regex to support X.Y.Z and X.Y.Z-rc1 (or -beta, -alpha)
regex = '''
(?P<major>\d+)
Expand Down
68 changes: 68 additions & 0 deletions tests/test_prepare_docs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import os
import sys
from pathlib import Path

sys.path.insert(
0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../scripts/maintainer"))
)

import prepare_docs


def test_prepare_docs_copies_all_image_assets_and_transforms_paths(
tmp_path: Path,
) -> None:
# 1. Setup mock source structure
src_dir = tmp_path / "src"
docs_output_dir = tmp_path / "build_docs"

src_dir.mkdir()
assets_dir = src_dir / "assets"
assets_dir.mkdir()
docs_dir = src_dir / "docs"
docs_dir.mkdir()
github_dir = src_dir / ".github"
github_dir.mkdir()

# Create dummy asset files of various image formats
(assets_dir / "banner.svg").write_text("<svg>banner</svg>")
(assets_dir / "status-screenshot.png").write_bytes(b"\x89PNG\r\n\x1a\n")
(assets_dir / "logo.jpg").write_bytes(b"\xff\xd8\xff")

# Create dummy Markdown files
readme_content = (
'<img src="assets/banner.svg">\n'
'<img src="assets/status-screenshot.png">\n'
"![Logo](assets/logo.jpg)\n"
"[AGENTS.md](AGENTS.md)\n"
)
(src_dir / "README.md").write_text(readme_content)
(src_dir / "AGENTS.md").write_text('<img src="assets/banner.svg">')
(src_dir / "LICENSE").write_text("MIT License")
(docs_dir / "development.md").write_text('<img src="../assets/banner.svg">')
(github_dir / "CONTRIBUTING.md").write_text('<img src="../assets/banner.svg">')

# 2. Run prepare_docs
prepare_docs.prepare_docs(str(src_dir), str(docs_output_dir))

# 3. Assert asset files were copied
out_assets = docs_output_dir / "assets"
assert (out_assets / "banner.svg").exists()
assert (out_assets / "status-screenshot.png").exists()
assert (out_assets / "logo.jpg").exists()

# 4. Assert content transformations
index_md = (docs_output_dir / "index.md").read_text()
assert 'src="assets/banner.svg"' in index_md
assert 'src="assets/status-screenshot.png"' in index_md
assert "![Logo](assets/logo.jpg)" in index_md
assert "(agents.md)" in index_md

agents_md = (docs_output_dir / "agents.md").read_text()
assert 'src="../assets/banner.svg"' in agents_md

dev_md = (docs_output_dir / "development.md").read_text()
assert 'src="../assets/banner.svg"' in dev_md

contrib_md = (docs_output_dir / "about" / "contributing.md").read_text()
assert 'src="../../assets/banner.svg"' in contrib_md
Loading