fix: keep hyperlink addresses in DOCXToDocument table cells - #12988
Merged
Merged
Conversation
Table cells were serialized from cell.text, which holds only the display text of a hyperlink, so link_format="markdown" or "plain" kept addresses in body paragraphs but dropped them in tables. Cell paragraphs now go through the same link handling as body paragraphs, in both the markdown and csv table formats. link_format="none" output is unchanged. Fixes deepset-ai#12977 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016PQv3cLuiTKPtLNj9i1cma Signed-off-by: Jayanth <jayanthreddy268.jr@gmail.com>
Contributor
|
@Jayanth-reflex is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Author
|
@sjrl , could you please review and auth the workflows |
Contributor
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issues
Proposed Changes:
DOCXToDocumentformats links in body paragraphs through_process_links_in_paragraph(), but tables were built fromcell.text, which python-docx fills with each paragraph's display text only. So withlink_format="markdown"or"plain", a link in a table cell lost its address.A new
_cell_text()helper passes each cell paragraph through_process_links_in_paragraph()and joins them with newlines, the same waycell.textdoes._table_to_markdown()and_table_to_csv()now use it. With the defaultlink_format="none"the output is unchanged, because that path returnsparagraph.text.How did you test it?
test_link_extraction_in_table, covering both table formats (markdown,csv) and both link formats that output addresses (markdown,plain). All 4 cases fail without the fix and pass with it.test_docx_file_to_document.py: 36 passedhatch run fmtand mypy on the changed files: cleanNotes for the reviewer
This PR was fully generated with an AI assistant. I have reviewed the changes and run the relevant tests.
Checklist