SD-3229 - fix: enhance TOC entry processing and bookmark handling#3515
Draft
chittolinag wants to merge 5 commits into
Draft
SD-3229 - fix: enhance TOC entry processing and bookmark handling#3515chittolinag wants to merge 5 commits into
chittolinag wants to merge 5 commits into
Conversation
Contributor
|
Status: PASS The two files in scope don't touch real OOXML elements/attributes — they only wire up a handler for the SuperDoc-internal synthetic node
The No spec violations detected. |
…replaces-entries-with-no-table
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 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.
Issue
Clicking Update table of contents on a mixed-source TOC (one that combines
\tcustom-style mappings with\fTC-field identifiers) destructively rebuilt the entries: auto-numbered heading prefixes disappeared, hyperlink anchors switched from the existing body_Toc…bookmarks to synthetic UUID names, multi-run Section rows collapsed into a single text node, thepageReferencefield downgraded to a plain text run with atocPageNumbermark, the TOC2 left tab stop was dropped, and heading character marks (bold/underline/Times New Roman Bold) leaked into Article rows. In the worst case the rebuild produced the "No table of contents entries found." placeholder when sources weren't being collected at all. (SD-3229)Proposed solution
SWITCH_PATTERNso unquoted switch arguments (\f C) parse with their identifier instead of as a bare flag.w:bookmarkStart/w:bookmarkEndout of the synthesizedsd:tableOfContentsEntryatom so the entry stays valid and the bookmark remains visible to the bookmark map.sd:tableOfContentsEntrytranslator into the v2 importer pipeline so TC fields actually materialize as PMtableOfContentsEntrynodes.collectTocSourcesto honor\tcustom-style mappings, capture the source paragraph's existing_Toc…body bookmark (so the rebuilt entry reuses it), and pick up the rendered list-marker prefix + the body title marks for TC entries.buildTocEntryParagraphsto emit the importer-equivalent shape — multi-run entries, realpageReferencePM node, level-2 left tab stop alongside the right tab stop, and the existing body bookmark as anchor.\o/\u/\t) get plain text and inherit typography from the linked TOC{n} paragraph style; TC-field titles inherit only bold/italic/underline (notextStyle) so the TOC{n} font isn't overridden.toc.updatemodepageNumbersto walkpageReferencesubtrees, andsyncTocBookmarksto skip sources with an existing body anchor so the rebuild doesn't litter the document with duplicate synthetic bookmarks.