INNER CODE UNIT · Python
walk
OWASP/wstg · .github/ebooks/build-link-manifest.py:40
def walk(blocks):
if not blocks:
return
for block in blocks:
if not isinstance(block, dict):
continue
if block.get("t") == "Header":
c = block.get("c", [])
if len(c) >= 3:
content = c[1] # inline content
heading_id = c[2] # attributes [id, classes, kvpairs]
if content and isinstance(heading_id, list) and len(heading_id) > 0:
heading_id = heading_id[0] # extract id string
text_parts = []
def extract_text(items):