From 11dcc47f6d7f09507f143b047be1dbc3941dd0c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Alm=C3=A9n?= <78877636+almenscorner@users.noreply.github.com> Date: Tue, 26 Mar 2024 11:10:12 +0100 Subject: [PATCH] Sort index alphabetically and do not include README, index or prod-as-built --- src/IntuneCD/intunecdlib/documentation_functions.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/IntuneCD/intunecdlib/documentation_functions.py b/src/IntuneCD/intunecdlib/documentation_functions.py index 8c4a4fc6..1011902a 100644 --- a/src/IntuneCD/intunecdlib/documentation_functions.py +++ b/src/IntuneCD/intunecdlib/documentation_functions.py @@ -510,7 +510,10 @@ def get_md_files(configpath): configpathname = configpath.split(slash)[-1] filepath = filepath[filepath.index(configpathname) :] filepath = "/".join(filepath[1:]) - - md_files.append(f"./{filepath}") + ignore_files = ["README", "index", "prod-as-built"] + if filepath.rsplit("/", maxsplit=1)[-1] not in ignore_files: + md_files.append(f"./{filepath}") + # Sort the list alphabetically by file name without extension, case-insensitive + md_files.sort(key=lambda f: os.path.splitext(os.path.basename(f))[0].lower()) return md_files