Skip to content

Extractor: stop dropping content, fix tables, add tests + CI - #1

Merged
dstwn merged 1 commit into
masterfrom
improve-extractor
Nov 29, 2026
Merged

dstwn merged 1 commit into
masterfrom
improve-extractor

Conversation

@dstwn

@dstwn dstwn commented Nov 29, 2026

Copy link
Copy Markdown
Owner

What

Fixes content the extractor silently dropped or corrupted, and adds tests.

  • Content controls (w:sdt) were skipped entirely, so their text was lost.
  • Table cells: | and line breaks broke rows; nested table text was lost; merged cells (gridSpan) misaligned columns.
  • Footnotes/endnotes and header/footer were never read although the docs claimed header/footer handling. Now included (once, deduplicated); --no-notes skips them.
  • Headings: also Title and outlineLvl.
  • --section: no longer O(n^2); warns when the section is not found (still falls back to the full document).
  • Non-docx / corrupt input: clean error and exit 1 instead of a traceback; XML size guard.
  • 22 unittest cases (each fix checked by mutation) and a CI workflow.

Behaviour change

Documents with footnotes or header/footer now get extra sections at the end. Use --no-notes for the old output.

Not covered

Tests use small synthetic documents, not real Word files. vMerge, text boxes and comments are not handled specially.


Generated by Claude Code

… cells; tests + CI

- walk w:sdt content controls (text was dropped)
- table cells: escape |, flatten line breaks and nested tables, align gridSpan
- footnotes/endnotes and deduplicated header/footer included (--no-notes to skip)
- heading detection via Title and outlineLvl
- --section: compute once (was O(n^2)), warn when not found
- friendly error + exit 1 for non-docx input, size guard on XML
- 22 unit tests and a CI workflow

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B2TuhyaoLj3duQipFJKR3i
@dstwn
dstwn merged commit 8af74dd into master Nov 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants