From 8093092293078e527faedca0c598b7b97ccad5f5 Mon Sep 17 00:00:00 2001 From: Corey White Date: Tue, 18 Feb 2025 15:31:38 -0500 Subject: [PATCH] Fixed special doc cases --- doc/Makefile | 2 ++ man/mkdocs/scripts/hook_list_scripts.py | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/doc/Makefile b/doc/Makefile index 8a5b6e3de1c..dd2769a1dd6 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -5,6 +5,8 @@ include $(MODULE_TOPDIR)/include/Make/Other.make FILES := $(wildcard *.html) # So far, we disntinguished user and contributor documentation here by # extension. This is no longer possible with Markdown. +# These are currently maunally added to mam/mkdocs/scripts/hook_list_scripts.py +# to generate the correct links to edit on GitHub. MDFILES := grass_database.md projectionintro.md default: $(patsubst %,$(HTMLDIR)/%,$(FILES)) $(patsubst %,$(MDDIR)/source/%,$(MDFILES)) diff --git a/man/mkdocs/scripts/hook_list_scripts.py b/man/mkdocs/scripts/hook_list_scripts.py index d316e9f405a..b535951934a 100644 --- a/man/mkdocs/scripts/hook_list_scripts.py +++ b/man/mkdocs/scripts/hook_list_scripts.py @@ -20,12 +20,21 @@ def github_path(toolname, scripts_tools): "vector", ] - print(f"Searching for: {toolname}") + # Special cases for documentation pages that don't match the pattern matching scheme + special_docs = [ + {"name": "projectionintro", "path": "doc"}, + {"name": "grass_database", "path": "doc"}, + {"name": "databaseintro", "path": "db"}, + ] # Exit early if toolname is empty if not toolname: return None + # Handle special cases + if toolname in [x["name"] for x in special_docs]: + return next((x["path"] for x in special_docs if x["name"] == toolname), None) + # Convert filter() results to a list tool_matches = list(filter(lambda x: toolname in x, scripts_tools))