Repository navigation
fix(pptx): skip shapes whose text is only whitespace - #5028
PeterStaar-IBM merged 1 commit into
Conversation
A whitespace-only text run counts as a paragraph fragment, so the empty shape check let shapes holding only spaces through and they became blank title or text items. Only count an equation or a fragment with non-blank text. Fixes docling-project#5027 Signed-off-by: sarankumar1325 <120080287+sarankumar1325@users.noreply.github.com>
|
✅ DCO Check Passed Thanks @sarankumar1325, all your commits are properly signed off. 🎉 |
Merge Protections🟢 Merge protection satisfied — ready to merge. Show 1 satisfied protection🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
AI triage (advisory)Checked commit The PR fixes the empty-shape guard in Topic labels added: CI safety: no concern found. A maintainer must still approve CI. 2 related pull request(s) in the same code
The |
There was a problem hiding this comment.
AI first review (advisory): no blocker found
This review covers the full diff at fb8bfc4ded. It read the code and did not run it.
I found nothing that blocks the merge. The new check in docling/backend/mspowerpoint_backend.py:1933 skips a shape only when shape.text is blank and no fragment is a formula or has non-blank text. Equation-only shapes (kept by #4625) and shapes with real text behave as before. The new test covers the reported slide.
A maintainer makes the merge decision. This review never approves the pull request.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Since #4625, the empty-shape check in
MsPowerpointDocumentBackendisnot shape.text.strip() and not any(_paragraph_fragments(...)). A whitespace-only text run still counts as a fragment, so a shape holding only spaces gets through. An empty title placeholder with one space then becomes atitleitem with text" ", and a text box holding spaces becomes a blanktextitem. Before 2.135.0 these shapes were skipped.With this change the check only counts a fragment that is an equation or has non-blank text. Shapes that hold only an equation are still kept (the reason for #4625). Shapes with real text are unchanged.
Issue resolved by this Pull Request:
Resolves #5027
Checklist:
Review evidence:
test_pptx_whitespace_only_shapes_are_skippedintests/test_backend_pptx.pybuilds the issue's slide: a "Title Only" title holding" ", a text box holding" ", and a text box with"Real line". Only("paragraph", "Real line")is emitted. It fails onmain(3 text items) and passes with the change.pytest tests/test_backend_pptx*.py: 94 passed. The 2 failures (test_chart_image_rendering,test_pptx_emf_picture_rasterized_via_libreoffice) need LibreOffice, which my environment doesn't have. They are unrelated to this change.test_backend_pptx_math.py(equation-only shapes) passes, and so does the e2e groundtruth test, so no reference data changed.ruff checkandruff format --checkare clean on the touched files.This fix was prepared with AI assistance; I reviewed the change and ran the checks above.