Repository navigation
fix(odf): keep footnotes out of the text of ODT table cells - #5496
Conversation
A footnote or endnote cited in a table cell was read into the cell text with odfdo's text_recursive, which renders a text:note as "citation. body". The cell "42 EUR" with a footnote became "42 EUR1. Audited figures.", and the body was also added as its own footnote item. Paragraph text already skips the note (docling-project#4375). Leave the note out of the cell text in the same way. Signed-off-by: 67-luck <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
✅ DCO Check Passed Thanks @67-luck, 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 keeps footnote and endnote text out of ODT table cell text. It adds the helper Topic labels added: CI safety: no concern found. A maintainer must still approve CI. 1 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 d88bd0367e. It read the code and did not run it.
I found no defect. All three table-cell paths that read paragraph text (_odf_element_text_lines and the Header/Paragraph checks in _odf_cell_has_rich_content) now use _odf_text_without_notes. The regression test checks both the cell text and the single footnote item. I could not read the odfdo source because .venv has no installed packages. I did not verify the claim that Element.delete keeps tail text. The same call is already used for annotations in docling/backend/opendocument_backend.py.
A maintainer makes the merge decision. This review never approves the pull request.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
A footnote or endnote cited in an ODT table cell was spliced into the cell text. The cell text paths read paragraphs with odfdo's
text_recursive, which renders atext:noteas "citation. body". #4375 fixed this for paragraph text:_odf_text_runsskips the note, and_add_footnotesadds the body as its ownFOOTNOTEitem. Table cells, however, read their text through_odf_element_text_linesand_odf_cell_has_rich_content. So the note body was still glued to the cell text, and the same body was also added as a footnote item.The new helper
_odf_text_without_notesreturnstext_recursivewithout the notes. It deletes them from a clone; odfdo'sElement.deletekeeps the tail text by default. An element without a note goes through the old code unchanged. List items are not changed, because their text already comes from the text runs.Checklist:
Review evidence:
Source: a table cell
<text:p>42 EUR<text:note …><text:note-body><text:p>Audited figures.</text:p></text:note-body></text:note></text:p>.42 EUR1. Audited figures.["Audited figures."]42 EUR["Audited figures."]test_odt_footnote_in_table_cell_is_not_splicedintests/test_backend_opendocument.py. It fails onmainand passes with this change.pytest tests/test_backend_opendocument.py: 102 passed, includingtest_e2e_odf_conversions. No reference data changes.ruff format --checkandruff check(v0.17.2) are clean on the changed files.ty check docling/backend/opendocument_backend.pyreports the same 48 existing diagnostics as onmain.make validate(nomakeon my Windows machine),tach,dprint.I used an AI assistant while working on this. I reproduced the bug, checked the document tree before and after, and ran the tests myself.
🤖 Generated with Claude Code