From 3905522ff3d98ad1c2499dd1c9800dd392bf126f Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sun, 8 May 2022 12:45:25 +0200 Subject: [PATCH] :rotating_light: adjust warnings for index.md files --- docs/mkdocs/scripts/check_structure.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/mkdocs/scripts/check_structure.py b/docs/mkdocs/scripts/check_structure.py index 92f6ff182..bfec9ed6a 100755 --- a/docs/mkdocs/scripts/check_structure.py +++ b/docs/mkdocs/scripts/check_structure.py @@ -83,7 +83,8 @@ def check_structure(): report('structure/section_order', f'{file}:{lineno+1}', f'section "{current_section}" is in an unexpected order (should be before "{expected_sections[section_idx]}")') section_idx = idx else: - report('structure/unknown_section', f'{file}:{lineno+1}', f'section "{current_section}" is not part of the expected sections') + if 'index.md' not in file: # index.md files may have a different structure + report('structure/unknown_section', f'{file}:{lineno+1}', f'section "{current_section}" is not part of the expected sections') # code example if line == '```cpp' and section_idx == -1: @@ -107,9 +108,10 @@ def check_structure(): previous_line = line - for required_section in required_sections: - if required_section not in existing_sections: - report('structure/missing_section', f'{file}:{lineno+1}', f'required section "{required_section}" was not found') + if 'index.md' not in file: # index.md files may have a different structure + for required_section in required_sections: + if required_section not in existing_sections: + report('structure/missing_section', f'{file}:{lineno+1}', f'required section "{required_section}" was not found') def check_examples():