From a72bbec760ae1e1109bf56e18a07ecf6bcebae86 Mon Sep 17 00:00:00 2001 From: Seth Fischer Date: Fri, 2 Aug 2024 20:15:03 +1200 Subject: [PATCH] docs: add redirect file to release archive --- src/osr_mechanical/console/release.py | 16 ++++++++++++++++ src/osr_mechanical/templates/docs-redirect.html | 17 +++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 src/osr_mechanical/templates/docs-redirect.html diff --git a/src/osr_mechanical/console/release.py b/src/osr_mechanical/console/release.py index 8313233..d460529 100644 --- a/src/osr_mechanical/console/release.py +++ b/src/osr_mechanical/console/release.py @@ -46,6 +46,7 @@ def build(self) -> None: self.release_directory.mkdir() self.readme(self.release_directory / "README.md") + self.docs_redirect_file(self.release_directory / "docs-redirect.html") self.changelog(self.release_directory / "CHANGELOG.md") self.final_assembly_step(self.release_directory / f"{PROJECT_NAME}.step") self.final_assembly_png(self.release_directory / f"{PROJECT_NAME}.png") @@ -79,6 +80,21 @@ def readme(out_file: Path) -> int: return out_file.write_text(result) + @staticmethod + def docs_redirect_file(out_file: Path) -> int: + """Create docs redirect file.""" + env = Environment( + loader=PackageLoader("osr_mechanical"), + autoescape=select_autoescape(), + ) + + template = env.get_template("docs-redirect.html") + result = template.render( + project_url=PROJECT_URL, + ) + + return out_file.write_text(result) + @staticmethod def changelog(out_file: Path) -> int: """Create changelog.""" diff --git a/src/osr_mechanical/templates/docs-redirect.html b/src/osr_mechanical/templates/docs-redirect.html new file mode 100644 index 0000000..a2c8f48 --- /dev/null +++ b/src/osr_mechanical/templates/docs-redirect.html @@ -0,0 +1,17 @@ + + + + + + + Page redirection + + +

+ If you are not redirected automatically, follow this + link to {{ project_url }}. +

+ +