Ryan Malloy 2f39c4ec5b Fix critical xpath API bug breaking chapter/heading detection
python-docx elements don't support xpath() with namespaces kwarg.
The calls silently failed in try/except blocks, causing chapter search
and heading detection to never find matches.

Fixed by replacing xpath(..., namespaces={...}) with:
- findall('.//' + qn('w:t')) for text elements
- find(qn('w:pPr')) + find(qn('w:pStyle')) for style detection
- get(qn('w:val')) for attribute values

Also fixed logic bug where elif prevented short-text fallback from
running when a non-heading style existed on the paragraph.
2026-01-11 05:20:05 -07:00
..