Repository navigation
fix(docx): preserve nested list hierarchy across empty spacer paragraphs - #4951
taran-dev4u wants to merge 5 commits into
Conversation
|
✅ DCO Check Passed Thanks @taran-dev4u, all your commits are properly signed off. 🎉 |
Merge Protections🔴 1 of 2 protections blocking · waiting on 👀 reviews
🔴 Require two reviewer for test updatesWaiting for
This rule is failing.When test data is updated, we require two reviewers
Show 1 satisfied protection🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
Signed-off-by: Taran Mamidala <[email protected]>
edd355d to
b80f3e9
Compare
AI triage (advisory)Checked commit The PR keeps nested DOCX list levels when empty spacer paragraphs separate list items. It saves the list state at a spacer and restores it when the same list resumes. It adds a CI safety: no concern found. A maintainer must still approve CI. 2 related pull request(s) in the same code
Reference data changes
Assessment: expected. The PR adds a The |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
DanielNg0729
left a comment
There was a problem hiding this comment.
Hi @taran-dev4u, can you resolve the CI failure? Thanks!
|
The CI re-run completed with all checks passing green. Thanks! |
|
CI is green on b80f3e9. #4993 is closed as a duplicate of this PR. @Jojoussef worked on the same bug, and their test checks one more thing. Please work together on this PR: if you take code or tests from #4993, add a A few small points before merge:
|
Co-authored-by: Youssef Benatti <[email protected]> Signed-off-by: Taran Mamidala <[email protected]>
|
Thanks @dolfim-ibm! Updated with all four points:
|
ceberam
left a comment
There was a problem hiding this comment.
@taran-dev4u we have recently dealt with quite a few PRs fixing issues with nested lists in the DOCX parser and we have tried to collect those edge cases through real docx files in our tests folder. This helps us visualize the edge cases and also understand how they should be serialized in some formats like Markdown, through the ground truth files. Could you please add a simple example with an empty spacer paragraph between list items? I think tests/data/docx/sources/docx_lists.docx could be a good place to add it (you can append it after a page break). The document nested-list-empty-paragraph.docx posted by @neerajsangal-suresteps in the original issue #4947 would be a great example.
Signed-off-by: Taran Mamidala <[email protected]>
|
Thanks @ceberam! Added the nested list with empty spacer paragraphs to ests/data/docx/sources/docx_lists.docx (Test 13, following a page break) matching the example from #4947, regenerated the .md, .itxt, and .json ground truth files, and added a test asserting the parsed hierarchy in ests/test_backend_msword.py. |
Signed-off-by: Taran Mamidala <[email protected]>
|
Thanks @taran-dev4u ! One last question: aren't you testing the same thing in two different test files: |
…cling-project#4947) Signed-off-by: Taran Mamidala <[email protected]>
|
Good catch, thanks! Removed the duplicate test from \ est_backend_msword_spacer.py\ and kept the fixture-based check in \ est_backend_msword.py. |
In a DOCX file, an empty spacer paragraph between list items was resetting \parents\ and numbering state, causing subsequent indented items to be added to the root list group as flat siblings when the group was reused.
ested_lists, and numbering levels via a _CachedListState\ dataclass) when caching across empty spacer paragraphs so resumption restores previous levels.
Issue resolved by this Pull Request:
Resolves #4947
Checklist:
Review evidence:
Tests: Added \ est_nested_list_items_keep_nesting_across_empty_paragraphs\ in \ ests/test_backend_msword_spacer.py. Fails on \main\ and passes with this fix.
Checks run:
uff check\ /
uff format --check\ on modified files: clean
Written with AI assistance; I reviewed the change and ran the checks myself.