Make doc index page report version/update-time and link to changelog. Resolve #3547

This commit is contained in:
Griatch 2024-06-27 17:00:51 +02:00
parent 9c3ba936e4
commit 3e3d391224
2 changed files with 38 additions and 3 deletions

View file

@ -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()

View file

@ -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