fix(doctags): accept the paragraph tag when loading DocTags - #716
Open
manticore999 wants to merge 1 commit into
Open
fix(doctags): accept the paragraph tag when loading DocTags#716manticore999 wants to merge 1 commit into
manticore999 wants to merge 1 commit into
Conversation
Contributor
|
✅ DCO Check Passed Thanks @manticore999, all your commits are properly signed off. 🎉 |
Contributor
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/
|
manticore999
force-pushed
the
fix/doctags-paragraph-roundtrip
branch
from
August 10, 2026 16:52
809dae7 to
a24a3fe
Compare
Contributor
Author
|
Updated: widened from Tests are now parametrized over the three labels and fail without the change. |
`export_to_doctags` emits `<paragraph>`, `<handwritten_text>` and `<reference>` for items carrying those labels, but the pattern `load_from_doctags` matches against did not list them. The elements were skipped and their text silently dropped, so export and import disagreed about the format. PARAGRAPH is produced by the PPTX, JATS, USPTO, AsciiDoc and LaTeX backends and REFERENCE by the LaTeX backend, so ordinary documents are affected. For a PowerPoint deck every slide body was lost on a round-trip and only the titles survived. Add the three tags to the pattern and map them onto their labels so the label is preserved as well. Signed-off-by: manticore999 <hamzabadreddine852@gmail.com>
manticore999
force-pushed
the
fix/doctags-paragraph-roundtrip
branch
from
August 10, 2026 17:25
a24a3fe to
d027b01
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Problem
export_to_doctags()emits<paragraph>for items labelledPARAGRAPH, but thetag is missing from the pattern
load_from_doctags()matches against, so thoseelements are skipped and their text is silently dropped. Export and import
disagree about the format.
PARAGRAPHis produced by the PPTX, JATS, USPTO, AsciiDoc and LaTeX backends, sothis affects ordinary documents. For a PowerPoint deck, every slide body is lost
and only the titles survive:
Minimal version, no files needed:
Fix
Add the tag to the parser's pattern and map it to
DocItemLabel.PARAGRAPH, soboth the content and the label survive.
Impact
Measured over the 192 groundtruth
DoclingDocuments in the docling repo,comparing text length before and after a DocTags round-trip:
The six worst cases (patents
ipa20200022300,pftaps057006474,pg06442728,pa20010031492,ipa20180000016, andpowerpoint_malformed_pictures) returned0–3% of their text and now round-trip correctly. The remaining 17 lose text for
unrelated reasons (drawingml, some tables, checkboxes) and are untouched here.
Tests
Two tests in
test/test_doctags_load.py, covering the plain and<loc_...>forms. Both fail without the change and pass with it; the existing doctags tests
are unaffected (12 passed).
Checklist: