Skip to content

fix(odf): keep ODP slide comments out of the body text - #4653

Open
Kylinny wants to merge 1 commit into
docling-project:mainfrom
Kylinny:fix-odp-slide-comments
Open

Kylinny wants to merge 1 commit into
docling-project:mainfrom
Kylinny:fix-odp-slide-comments

Conversation

@Kylinny

@Kylinny Kylinny commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

LibreOffice Impress stores each slide comment as an officeooo:annotation element, the last child of the draw:page. OdpDocumentBackend._walk_slide passed every other non-frame element's children to _walk_textbox_children, so the comment text became slide body text, the author and date were dropped, and the NOTES layer stayed empty.

The fix mirrors the PPTX backend (and the ODT backend since #4436):

  • _walk_slide and _slide_has_visible_title skip officeooo:annotation. Comment text no longer leaks into the slide body text or the Markdown export, and it cannot affect title detection.
  • A new _extract_slide_comments pass runs per slide, inside the page_range filter. As in the PPTX backend, each comment becomes a COMMENT_SECTION group in the NOTES layer, named comment-slide{N}-{M}. The text keeps the [author: Name (initials), time: date]: text form. A comment without author or date keeps only its text. An empty comment is skipped.

Behavior on the repro script from the issue:

before after
body items title 'Q3 results', text 'Revenue grew 4%.', text 'Check this number.' title 'Q3 results', text 'Revenue grew 4%.'
markdown contains Check this number. no comment text
NOTES layer empty COMMENT_SECTION group comment-slide1-1 with [author: Ann Reviewer (AR), time: 2024-01-15T10:00:00]: Check this number.

Issue resolved by this Pull Request:
Resolves #4648

Checklist:

  • Documentation has been updated, if necessary.
  • Examples have been added, if necessary.
  • Tests have been added, if necessary.

Review evidence:

New test_odp_slide_comment_becomes_comment_not_body_text uses the new fixture tests/data/odf/sources/odf_presentation_with_slide_comment.odp (two slides; comments with full metadata, with no author/date, and multi-paragraph). It asserts the Markdown export, the body-layer texts, and the comment groups (names, NOTES layer, exact texts). The test fails on the base commit and passes with the fix. E2E groundtruth (.md/.itxt/.html/.json) is added for the new fixture; no existing groundtruth file changes.

Checks run: tests/test_backend_opendocument.py — 53 passed; ruff check and ruff format --check pass on both changed files.

LibreOffice Impress stores each slide comment as an officeooo:annotation
element, the last child of the draw:page. OdpDocumentBackend._walk_slide
passed every other non-frame element's children to _walk_textbox_children,
so the comment text became slide body text, the author and date were
dropped, and the NOTES layer stayed empty.

Skip officeooo:annotation in _walk_slide (and in _slide_has_visible_title,
so comment text cannot affect title detection), and extract the comments in
a new _extract_slide_comments pass. As in the PPTX backend, each comment
becomes a COMMENT_SECTION group in the NOTES layer, keeping the
'[author: Name (initials), time: date]: text' form.

Add a regression test with a fixture ODP carrying slide comments
(tests/data/odf/sources/odf_presentation_with_slide_comment.odp) and its
e2e groundtruth.

Resolves docling-project#4648

Signed-off-by: Junyi Yao <j.yao@wustl.edu>
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

✅ DCO Check Passed

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

@mergify

mergify Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🔴 1 of 2 protections blocking · waiting on 👀 reviews

Protection Waiting on
🔴 Require two reviewer for test updates 👀 reviews
🟢 Enforce conventional commit —

🔴 Require two reviewer for test updates

Waiting for

  • #approved-reviews-by >= 2
This rule is failing.

When test data is updated, we require two reviewers

  • #approved-reviews-by >= 2

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)(?:\(.+\))?(!)?:

@codecov

codecov Bot commented Oct 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 3.70370% with 26 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
docling/backend/opendocument_backend.py 3.70% 26 Missing ⚠️

📢 Thoughts on this report? Let us know!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ODP slide comments become slide body text

1 participant