From 3e3d39122451dd8fd996e5b987a81a5c9aadd4ec Mon Sep 17 00:00:00 2001 From: Griatch Date: Thu, 27 Jun 2024 17:00:51 +0200 Subject: [PATCH] Make doc index page report version/update-time and link to changelog. Resolve #3547 --- docs/pylib/update_dynamic_pages.py | 35 ++++++++++++++++++++++++++++++ docs/source/index.md | 6 ++--- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/docs/pylib/update_dynamic_pages.py b/docs/pylib/update_dynamic_pages.py index bafa945f23..4e3a032d53 100644 --- a/docs/pylib/update_dynamic_pages.py +++ b/docs/pylib/update_dynamic_pages.py @@ -3,8 +3,10 @@ Update dynamically generated doc pages based on github sources. """ +from datetime import datetime from os.path import abspath, dirname from os.path import join as pathjoin +from re import sub as re_sub ROOTDIR = dirname(dirname(dirname(abspath(__file__)))) DOCDIR = pathjoin(ROOTDIR, "docs") @@ -86,12 +88,45 @@ if settings.SERVERNAME == "Evennia": print(" -- Updated Settings-Default.md") +def update_index(): + """ + Read the index.md file and inject the latest version number and updated time. + + """ + indexfile = pathjoin(DOCSRCDIR, "index.md") + versionfile = pathjoin(EVENNIADIR, "VERSION.txt") + + with open(indexfile) as f: + srcdata = f.read() + + # replace the version number + with open(versionfile) as f: + version = f.read().strip() + + pattern = r"Evennia version is \d+\.\d+\.\d+\." + replacement = f"Evennia version is {version}." + + srcdata = re_sub(pattern, replacement, srcdata) + + # replace the last-updated time + now = datetime.now().strftime("%B %d, %Y") + + pattern = r"This manual was last updated [A-Z][a-z]+ \d{1,2}, \d{4}" + replacement = f"This manual was last updated {now}" + + srcdata = re_sub(pattern, replacement, srcdata) + + with open(indexfile, "w") as f: + f.write(srcdata) + + print(" -- Updated index.md") def update_dynamic_pages(): """ Run the various updaters """ + update_index() update_changelog() update_default_settings() update_code_style() diff --git a/docs/source/index.md b/docs/source/index.md index b0beec4e1c..897a181933 100644 --- a/docs/source/index.md +++ b/docs/source/index.md @@ -1,8 +1,8 @@ # Evennia Documentation -This is the manual of [Evennia](https://www.evennia.com), the open source Python `MU*` creation system. Use the Search bar on the left to find or discover interesting articles. +This is the manual of [Evennia](https://www.evennia.com), the open source Python `MU*` creation system. Use the Search bar on the left to find or discover interesting articles. This manual was last updated June 27, 2024, see the [Evennia Changelog](Coding/Changelog.md). Latest released Evennia version is 4.1.1. -- [Introduction](./Evennia-Introduction.md) - what is this Evennia thing? +- [Introduction](./Evennia-Introduction.md) - what is this Evennia thing? - [Evennia in Pictures](./Evennia-In-Pictures.md) - a visual overview of Evennia - [Contributing and Getting help](./Contributing.md) - when you get stuck or want to chip in @@ -10,7 +10,7 @@ This is the manual of [Evennia](https://www.evennia.com), the open source Python - [Installation](Setup/Setup-Overview.md#installation-and-running) - getting started - [Running the Game](Setup/Running-Evennia.md) - how to start, stop and reload Evennia -- [Updating the Server](Setup/Updating-Evennia.md) - how to update Evennia +- [Updating the Server](Setup/Updating-Evennia.md) - how to update Evennia - [Configuration](Setup/Setup-Overview.md#configuration) - how to set up Evennia the way you like it - [Going Online](Setup/Setup-Overview.md#going-online) - bringing your game online