INNER CODE UNIT · Python
_is_nav_line
OWASP/wstg · .github/ebooks/list-chapters.py:38
def _is_nav_line(line: str) -> bool:
line = line.strip()
if not line or line.startswith("#"):
return True
line = LIST_MARKER_RE.sub("", line)
line = NUMBERING_RE.sub("", line)
line = LINK_RE.sub("", line)
return line.strip() == ""
def is_nav_readme(path: str) -> bool:
with open(path, encoding="utf-8") as f:
lines = f.readlines()
return bool(lines) and all(_is_nav_line(line) for line in lines)
def slugify(text: str) -> str:
text = text.lower()