Repository navigation
fix(pptx): turn line breaks in table cells and notes into newlines - #4844
LindseyZ1205 wants to merge 1 commit into
Conversation
python-pptx gives a line break inside a paragraph (a:br) as a vertical
tab ("\v") in the .text of a text frame. The backend used .text for
table cells and notes, so this control character ended up in the cell
text, in the notes text and in the Markdown export. Replace it with
"\n", the in-paragraph line break of a DoclingDocument (docling-project#1787).
Signed-off-by: LindseyZ1205 <yingzizhang1205@gmail.com>
|
✅ DCO Check Passed Thanks @LindseyZ1205, 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 This PR replaces vertical tab control characters ( Topic labels added: CI safety: no concern found. A maintainer must still approve CI. 3 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 a030639219. It read the code and did not run it.
I checked the line break conversion in PPTX table cells and slide notes, the helper function, and the regression test. The change replaces python-pptx vertical tab characters with newlines without breaking existing exports.
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! |
python-pptx returns a line break inside a paragraph (
a:br) as a vertical tab ("\v") in the.textof a text frame. The backend uses.textfor table cells and for the slide notes, so this control character was in the cell text, in the notes text and in the Markdown export. This change adds a small helper_text_frame_textthat replaces"\v"with"\n", the in-paragraph line break of a DoclingDocument (#1787), and uses it for table cells and notes.Text boxes are read run by run in
_paragraph_fragments, which turns a line break into a space (#1664). I did not change this, so that the existing ground truth stays the same. If you prefer a space in table cells and notes as well, I can change the helper.Issue resolved by this Pull Request:
Resolves #4843
Checklist:
Review evidence:
'line1\x0bline2', the notes had'note a\x0bnote b', and the Markdown table row was| line1\x0bline2 | plain |.'line1\nline2'and the notes text is'note a\nnote b'. The Markdown table row is| line1 line2 | plain |, the same as a text box with a line break.tests/test_backend_pptx*.pypass with the existing ground truth files, includingtest_e2e_pptx_conversions.test_pptx_line_breaks_in_table_cells_and_notesintests/test_backend_pptx.py. It fails onmainand passes with this change.uv run --frozen --extra format-pptx --extra format-docx pytest tests/test_backend_pptx.py tests/test_backend_pptx_charts.py tests/test_backend_pptx_hidden_shapes.py tests/test_backend_pptx_math.py tests/test_backend_pptx_shape_hyperlink.py: 79 passed. Onmain, only the new test fails.uvx prek run --files docling/backend/mspowerpoint_backend.py tests/test_backend_pptx.py: all hooks pass (Ruff, ty, Tach, max lines).