fix(docx-core): keep paragraph sectPr inside diffmatch paragraphs#458
Draft
stevenobiajulu wants to merge 1 commit into
Draft
fix(docx-core): keep paragraph sectPr inside diffmatch paragraphs#458stevenobiajulu wants to merge 1 commit into
stevenobiajulu wants to merge 1 commit into
Conversation
The legacy diffmatch builder identified the last w:sectPr in body text with a regex, so an ILPA paragraph-mark section break could be mistaken for the document-final body sectPr. That lifted only the section-properties element and left the paragraph-property tail behind, producing non-well-formed document.xml in the generated redline artifact. This change only extracts a final top-level body sectPr and leaves paragraph-level section breaks intact. The ILPA typescript_redline.docx fixture is regenerated from the fixed path and the known schema suppression is removed. Fixes: #450
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Fixes the legacy diffmatch section-property extraction so only a final top-level body
w:sectPris treated as the document-final section properties. Paragraph-mark section breaks insidew:pPrnow remain inside their paragraph.The committed
packages/docx-core/src/testing/outputs/typescript_redline.docxfixture was regenerated from the fixed ILPA comparison path, and the #450 emitted-schema known failure was removed.Why
The old regex found the last
w:sectPrnear the end of body XML without proving it was a body child. On the ILPA pair, that lifted a paragraph-level section break out of itsw:pPr, leaving orphaned</w:pPr></w:p>tail markup and producing non-well-formeddocument.xml.Validation
npm exec vitest -- packages/docx-core/src/baselines/diffmatch/xmlParser.test.ts --runnpm exec vitest -- packages/docx-core/src/integration/compare-parity.test.ts --runSDX_WRITE_OUTPUT_FIXTURES=1 npm exec vitest -- packages/docx-core/src/integration/compare-parity.test.ts --runnode scripts/check_emitted_document_schema.mjs --self-test --known-failures coverage/emitted-schema-known-failures.json packages/docx-core/src/testing/outputs/typescript_redline.docxnpm run check:conformance-citationsnpm run build -w @usejunior/docx-core