Conversation
…, so real merged tables stop extracting as plain cells. Co-Authored-By: opencode space-bunny-free <noreply@opencode.ai> Signed-off-by: Yi-111-a <153097222+Yi-111-a@users.noreply.github.com>
Contributor
|
Thanks @Yi-111-a. This is the same fix as #1077, which @Floating-Y opened three hours earlier together with the issue, so I am landing that one and closing this. Your reading of If you would like something that is not taken: the fixtures in |
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.
Why
#1074. In DrawingML,
gridSpan,hMergeandvMergeare attributes ofa:tc(
CT_TableCell);a:tcPr(CT_TableCellProperties) has no such attributes.pptx_xml_to_textread them only froma:tcPr, so a merged table written by anyreal producer was extracted as if every cell were plain:
What changes
pptx_xml_to_textreads the three merge attributes offa:tcin theStarthandler, and the two
a:tcPrhandlers are dropped — they existed only for thatlookup. The shared bit is a small
apply_merge_attrsclosure, so theStartpath and the old duplicated blocks no longer drift.
pptx_tables.rsput the attributes ona:tcinstead ofa:tcPr. They previously exercised the same wrong structure the parserexpected, which is why the existing tests could not catch this.
merged_cell_attributes_on_a_tc_preserve_the_grid_shapespells the markupout directly rather than going through the helpers, so it keeps testing a real
producer's shape (
<a:tc gridSpan="2">) if the helpers change later.a_vertical_merge_continuation_stays_an_empty_cellused a textlesscontinuation cell, so clearing its text was a no-op and it passed whether or
not the
vMergelookup worked. That cell now carries the text PowerPointrepeats, and the assertion pins that it is dropped.
No
a:tcPrfallback is kept: those are nota:tcPrattributes in any version ofthe schema, so reading them there was the bug. Say the word if you would rather
tolerate producers that write them there anyway — it is three lines.
How it was checked
cargo +1.95 test -p utopia-ingest --lib --test pptx_tables --test pptx_order --test pptx_breaks --test office_text_references→ 108 + 12 + 4 + 2 + 4 passed,0 failed. The three merge tests are the discriminating ones: reverting only
parsers.rsfails exactly those three and passes the other nine, and the failureoutput is the
| Summary | COVERED | Total |line quoted above.cargo fmt -p utopia-ingest -- --checkis clean.Two things I did not run, so CI is the gate on them:
cargo clippy --workspace --all-targets -- -D warningsreports twocollapsible_matchfindings inparsers.rs, and both reproduce on unmodifieddev(parsers.rs:313and thea:tarm atparsers.rs:1107there,1110with this change) — neither is in code this PR touches, and it adds no new
findings. I left them alone rather than mixing an unrelated lint cleanup into a
bugfix; note CI pins
stable, so if your stable predates these they may notfire for you.
cargo test --workspace. This change is confined topptx_xml_to_text, so I ranthe ingest tests that cover it, but the full workspace build did not fit the
disk I had (it filled the volume and the linker failed on space). Worth a
look on CI, particularly the
utopia-storesuites that needUTOPIA_DATABASE_URL.Before review
git commit -s)cargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warningsandcargo test --workspacepass(fmt and the ingest tests do; clippy and the full workspace run do not — both
explained above, neither caused by this change)
web/:pnpm buildandpnpm testpass — not applicable, noweb/changecrates/utopia-store/was tested withUTOPIA_DATABASE_URLset — not applicable, no SQL changedev— not applicable, no migrationweb/src/i18n/en.tsandzh.ts— not applicable, no UI stringdocs/decisions/— not applicableDisclosure
Written with opencode (
space-bunny-free). The parser change, the fixturechanges and the tests are all generated; the diagnosis, the DrawingML
CT_TableCellreference, the choice to drop thea:tcPrpath and the decision tostrengthen the
vMergetest are the issue reporter's and mine. It needs a humanread before merge — in particular please sanity-check that dropping the
a:tcPrlookup is what you want rather than a tolerated fallback.