Skip to content

fix(pptx): skip shapes whose text is only whitespace - #5028

Merged
PeterStaar-IBM merged 1 commit into
docling-project:mainfrom
sarankumar1325:fix/pptx-whitespace-only-shapes
Oct 27, 2026
Merged

PeterStaar-IBM merged 1 commit into
docling-project:mainfrom
sarankumar1325:fix/pptx-whitespace-only-shapes

Conversation

@sarankumar1325

Copy link
Copy Markdown
Contributor

Since #4625, the empty-shape check in MsPowerpointDocumentBackend is not 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 a title item with text " ", and a text box holding spaces becomes a blank text item. 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:

  • Documentation has been updated, if necessary. (n/a)
  • Examples have been added, if necessary. (n/a)
  • Tests have been added, if necessary.

Review evidence:

  • New test test_pptx_whitespace_only_shapes_are_skipped in tests/test_backend_pptx.py builds 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 on main (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 check and ruff format --check are clean on the touched files.
  • I did not run the full test suite, only the PPTX backend tests.

This fix was prepared with AI assistance; I reviewed the change and ran the checks above.

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>
@github-actions

Copy link
Copy Markdown
Contributor

✅ DCO Check Passed

Thanks @sarankumar1325, all your commits are properly signed off. 🎉

@mergify

mergify Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 Merge protection satisfied — ready to merge.

Show 1 satisfied protection

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?(!)?:

@github-actions github-actions Bot added ai:ci-safe AI triage found no CI-safety concern (advisory) bug Something isn't working pptx issue related to pptx backend labels Oct 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

AI triage (advisory)

Checked commit fb8bfc4ded. The analysis read the diff only. It did not run code from this pull request.

The PR fixes the empty-shape guard in MsPowerpointDocumentBackend so that shapes whose text is only whitespace are skipped. It refines the any() check introduced in #4625 to only count a fragment as content when it is an equation or has non-blank text.

Topic labels added: bug, pptx.

CI safety: no concern found. A maintainer must still approve CI.

2 related pull request(s) in the same code
PR State Signal Assessment
#5005 open changes the same code related: PR #5005 touches the same file and the same handle_shape_content function but adds a different feature (shape groups in the document tree). It does not overlap with the whitespace-guard fix.
#4625 merged referenced as #4625 related: PR #4625 is already merged and introduced the _paragraph_fragments helper and the any() guard that this PR corrects. It is the root cause, not a duplicate fix.

The ai:* labels are advisory. They do not approve CI and they do not add tests:full. A new push runs this check again.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-actions github-actions Bot added the ai:review-lgtm AI first review found no blocker or major issue (advisory) label Oct 26, 2026
@codecov

codecov Bot commented Oct 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@PeterStaar-IBM
PeterStaar-IBM merged commit af66cbf into docling-project:main Oct 27, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai:ci-safe AI triage found no CI-safety concern (advisory) ai:review-lgtm AI first review found no blocker or major issue (advisory) bug Something isn't working pptx issue related to pptx backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PPTX: a shape whose text is only whitespace becomes a title or text item with blank text

2 participants