Skip to content

feat: Word numbering, section headers and footnote size through HTML - #1

Merged
dskripchenko merged 6 commits into
mainfrom
feat/import-fidelity
Oct 19, 2026
Merged

dskripchenko merged 6 commits into
mainfrom
feat/import-fidelity

Conversation

@dskripchenko

Copy link
Copy Markdown
Owner

Import fidelity for printable (stage 3 of its PDF plan), measured on its Word reference corpus.

Fixed

  • Headers/footers were taken from every section's references (a later section's part won); now the first section's parts, first-page ones only with <w:titlePg/>, even ones only with <w:evenAndOddHeaders/>.
  • Lists inside table cells lost their markers (cells were read paragraph by paragraph).

Added

  • Word multilevel numbering through HTML: lists continue across paragraphs (<ol start>), a lower level hangs under its parent's number via a label-less parent item (ListItem::$markerHidden), level patterns (ListNode::$levelText: %1.%2., 4.%1.) become ::marker rules on per-level classes in ImportedDocument::$css; the converter reads them back (Converter::markerStyleOf() keeps them past a CSS inliner) and the writer emits one Word multilevel numbering per list tree.
  • Level indents from the numbering's w:ind (ListNode::$indentLeftTwips), written as list/item margins.
  • Footnote::$sizePt — the note's size from footnotes.xml, as font-size on span.footnote.

Effect in printable (reference corpus, HTML print path): job description numbered 1.1…5.5 exactly as Word, layout 0.420 → 0.462; mortgage form 0.462 → 0.471.

Tests: new SectionHeadersTest, WordNumberingRoundTripTest; suite 398 green, phpstan clean (one unmatched baseline entry removed). Docs: README en/ru/de/zh, CHANGELOG Unreleased.

Note: README still lists footnotes as out of scope — stale since the reader learned them; not touched here.

🤖 Generated with Claude Code

dskripchenko and others added 6 commits October 18, 2026 23:16
…en/odd as Word shows them

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… parent labels, ::marker level patterns

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… reading

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@dskripchenko
dskripchenko merged commit 39ab779 into main Oct 19, 2026
8 checks passed
@dskripchenko dskripchenko mentioned this pull request Oct 19, 2026
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.

1 participant