fix(pm-adapter): render bibliography/index/TOA inside documentPartObject (SD-3066)#3566
Open
tupizz wants to merge 1 commit into
Open
fix(pm-adapter): render bibliography/index/TOA inside documentPartObject (SD-3066)#3566tupizz wants to merge 1 commit into
tupizz wants to merge 1 commit into
Conversation
…ect (SD-3066) Word wraps a generated bibliography (and other block fields) in a docPartObject SDT, sometimes via a nested content control. The handler only converted paragraph and tableOfContents children to flow blocks, so the field's entry paragraphs were silently dropped — the heading rendered but the entries did not. - documentPartObject now renders bibliography/index/tableOfAuthorities children via the shared paragraph-container handler, and structuredContentBlock children via their handler. - structuredContentBlock recurses block-field children (transparent wrapper), rendering their paragraphs. Section-counting invariant: findParagraphsWithSectPr recurses bibliography (so the handler advances currentParagraphIndex per entry) but not structuredContentBlock (so the scb path renders without advancing). Both paths were validated against the invariant; the prior code dropped entries AND under-counted, which could drift section breaks. Also extracts the shared handleParagraphContainerNode used by the bibliography, index and tableOfAuthorities handlers (previously three byte-identical copies). Regression tests cover both nesting shapes and the counter behavior. pm-adapter suite passes (302); layout corpus comparison shows no regressions attributable to this change. Linear: SD-3066
There was a problem hiding this comment.
1 issue found across 8 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
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.
Note
📚 Stacked PRs — review bottom-up
documentPartObjectReview order: #3538 → #3565 → #3566. Each PR's base auto-retargets to
mainas the one below it merges.Summary
Word wraps a generated bibliography (and other block fields) in a
docPartObjectSDT, sometimes via a nested content control. The pm-adapter handler only convertedparagraphandtableOfContentschildren to flow blocks, so the field's entry paragraphs were silently dropped — the heading rendered, the entries didn't.Linear: SD-3066
Fix
documentPartObjectnow rendersbibliography/index/tableOfAuthoritieschildren via the sharedhandleParagraphContainerNode, andstructuredContentBlockchildren via their handler.structuredContentBlockrecurses block-field children (transparent wrapper).Section-counting invariant (the real hazard)
findParagraphsWithSectPrrecursesbibliographybut notstructuredContentBlock. So:currentParagraphIndexper entry (matches analysis);The prior code both dropped entries and under-counted, which could drift section breaks. Both paths are validated against the invariant.
Also extracts the shared
handleParagraphContainerNode(previously three byte-identical copies in the bibliography/index/toa handlers).Test plan
pnpm --filter @superdoc/pm-adapter exec vitest run src/sdt src/sections src/internal.test.ts— 302 passverticalAlignschema-evolution + 7 image/table/section docs that contain zero docPartObj/bibliography — provably untouched by this change. No regressions attributable to the fix.bibliography+document.docxnow renders the entries (matches Word)