Skip to content

Commit

Permalink
Fixed special doc cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Corey White committed Feb 18, 2025
1 parent 66d42b3 commit 8093092
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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))
11 changes: 10 additions & 1 deletion man/mkdocs/scripts/hook_list_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down

0 comments on commit 8093092

Please sign in to comment.