Skip to content
Snippets Groups Projects

Repair + added archive ignoring

Merged Michael Bommhardt-Richter requested to merge Bommel-TOC-Headings into preview
All threads resolved!
1 file
+ 6
4
Compare changes
  • Side-by-side
  • Inline
""" #!/usr/bin/env python
#!/usr/bin/env python
 
"""
Check for consistency between TOC and page headings.
Check for consistency between TOC and page headings.
Provide as an command line argument the path to the mkdocs.yml file.
Author: Michael Bommhardt-Richter
Author: Michael Bommhardt-Richter
"""
"""
@@ -12,7 +12,7 @@ from pathlib import Path
@@ -12,7 +12,7 @@ from pathlib import Path
# {path/filename.md: [toc_heading, file_heading], ... }
# {path/filename.md: [toc_heading, file_heading], ... }
TOCData = dict()
TOCData = dict()
whitelist = ["index.md"] # ["archive"]
whitelist = ["index.md","archive/"]
def get_heading_in_file(filename, docs_path):
def get_heading_in_file(filename, docs_path):
@@ -52,11 +52,13 @@ def main():
@@ -52,11 +52,13 @@ def main():
for key, value in TOCData.items():
for key, value in TOCData.items():
if key in whitelist:
if key in whitelist:
continue
continue
 
if whitelist[1] in key:
 
continue
if value[0] == "Overview":
if value[0] == "Overview":
continue
continue
if value[0] != value[1]:
if value[0] != value[1]:
cnt += 1
cnt += 1
print(f"{key:<40}{value[0]:<30} != {value[1]}")
print(f"{key:<40}{value[0]:<50} != {value[1]}")
sys.exit(cnt)
sys.exit(cnt)
else:
else:
print("Error: Could not find mkdocs.yml file.")
print("Error: Could not find mkdocs.yml file.")
Loading