INNER CODE UNIT · Python
list_chapters
OWASP/wstg · .github/ebooks/list-chapters.py:101
def list_chapters(root: str, synthetic_dir: str) -> list[str]:
root = os.path.abspath(root)
results: list[str] = []
for dirpath, dirnames, filenames in os.walk(root, topdown=True):
dirnames.sort()
content_files: list[str] = []
nav_readme = False
for filename in sorted(filenames):
if not filename.lower().endswith(".md"):
continue
full_path = os.path.join(dirpath, filename)
if filename.lower() == "readme.md" and is_nav_readme(full_path):
nav_readme = True