From 2a5639b9e70c68e79ac7c109a566b29f11197819 Mon Sep 17 00:00:00 2001 From: mDuo13 Date: Fri, 13 Oct 2023 11:37:12 -0700 Subject: [PATCH] Soften up filename mismatch warnings --- tool/filter_enforce_filenames.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tool/filter_enforce_filenames.py b/tool/filter_enforce_filenames.py index 508963e83b..3d2fcaa76e 100644 --- a/tool/filter_enforce_filenames.py +++ b/tool/filter_enforce_filenames.py @@ -27,12 +27,14 @@ def idify(utext): utext = re.sub(r'[\s-]+', '-', utext) return utext -def normalized_match(filename, heading, loose=False): +def normalized_match(filename, heading, loose=False, exclude_index=True): """ Return True if the normalized versions of a filename and a heading match, False otherwise. If loose==True, allow some leeway like omitting 'and' and 'the' """ + if exclude_index and filename == "index.md": + return True if filename[-3:] == ".md": filename = filename[:-3] @@ -75,7 +77,7 @@ def compare_nav_and_fs_hierarchy(page, pages, logger): if expected_path != actual_path: path_parts = actual_path.split("/") - if len(path_parts) >= 1 and path_parts[-1] == "index": + if len(path_parts) >= 1 and path_parts[-1] == "index.md": expected_path2 = "/".join(crumbs+["index"]) + ".md" if actual_path == expected_path2: logger.debug("Topic index is fine at {actual_path}")