fix(super-converter): tolerate empty style properties on table styles (#3861) - #3864
fix(super-converter): tolerate empty style properties on table styles (#3861)#3864caio-pizzol wants to merge 1 commit into
Conversation
|
I attempted to verify against ECMA-376 via the Status: PASS This is a defensive refactor, not a semantic change to which OOXML gets read. The whole point of the PR is to tolerate empty property containers ( The elements/attributes touched are all standard WordprocessingML and used correctly:
One thing worth calling out as correct: the new code skips a No non-existent attributes/elements, no missing-required regressions (the reads that were mandatory before are still read), and no default-value assumptions were changed. Note: I couldn't run the |
xml-js omits the `elements` key entirely for empty elements, so a valid `<w:rPr/>` on a referenced table style parsed to a node with no children and `_getReferencedTableStyles` threw while dereferencing it. The importer catches per-node, so the table was dropped and documents built mostly from tables imported near-empty. Adds shared xml-node accessors and routes the table style reader through them.
f259bf3 to
1f5e584
Compare
|
Ran the schema lookups the review could not, against the ECMA-376 transitional XSD graph.
So a Also confirmed while here, since the same reasoning underpins the rest of the diff:
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTo customize comments, go to the Qodo configuration screen, or learn more in the docs. Powered by Qodo |
|
This pull request landed on |
|
🎉 This PR is included in superdoc-cli v0.23.1 The release is available on GitHub release |
|
🎉 This PR is included in superdoc-sdk v1.22.1 |
|
🎉 This PR is included in @superdoc-dev/mcp v0.18.1 The release is available on GitHub release |
|
🎉 This PR is included in superdoc v1.46.1 The release is available on GitHub release |
|
🎉 This PR is included in @superdoc-dev/react v1.17.1 The release is available on GitHub release |
|
🎉 This PR is included in vscode-ext v2.18.1 |
Keeps tables in documents whose
word/styles.xmlcarries empty property containers, such as a self-closing<w:rPr/>on Table Grid. Word opens these files; SuperDoc was dropping the tables. Issue #3861 reports LibreOffice and some Word templates as the source.xml-js omits the
elementskey rather than emitting an empty one, so<w:rPr/>,<w:rPr />and<w:rPr></w:rPr>all arrive with no children, and the style reader assumed that key was there. The importer catches per node, so the throw was swallowed and only the table vanished, which is why an affected document looked blank rather than raising an error.w:rPr. Aw:basedOnpointing at a childless style throws first, before execution reaches thew:rPr, and with an identical message, so fixing only the reported line could look like no fix at all.w:typeare skipped rather than keyed underundefined. ECMA-376 marks that attribute required.w:tblPr,w:tcPrandw:trPrwere already safe. The issue lists them as broken, so tests record that they are not.elements: []do not reproduce the parser shape and pass against this bug.Byte-identical across v1.43.2, v1.44.2, v1.45.2 and main.
Fixes #3861