From 8e2398d7cc073445b0d8232bfb02fc70339a8daa Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Fri, 16 Aug 2024 21:44:58 +0200 Subject: [PATCH] Docs - Force functions to be alphabetically sorted on wiki (#10208) Force functions to be alphabetically sorted on wiki --- docs/tools/document_functions.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/tools/document_functions.py b/docs/tools/document_functions.py index dab567d208..7ed20eade3 100644 --- a/docs/tools/document_functions.py +++ b/docs/tools/document_functions.py @@ -339,6 +339,8 @@ def document_functions(addons_dir, components): return errors +def getFunctionPath(func): + return func.path.casefold() def crawl_dir(addons_dir, directory, debug=False, lint_private=False): components = {} @@ -360,7 +362,11 @@ def crawl_dir(addons_dir, directory, debug=False, lint_private=False): if function.is_public() and not debug: # Add functions to component key (initalise key if necessary) component = os.path.basename(os.path.dirname(root)) - components.setdefault(component, []).append(function) + + # Sort functions alphabetically + functions = components.setdefault(component, []) + functions.append(function) + functions.sort(key=getFunctionPath) function.feedback("Publicly documented") else: