Docs - Force functions to be alphabetically sorted on wiki (#10208)

Force functions to be alphabetically sorted on wiki
This commit is contained in:
johnb432 2024-08-16 21:44:58 +02:00 committed by GitHub
parent 0164b6259f
commit 8e2398d7cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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