Repository navigation
fix(jats): preserve table footnotes - #4818
Conversation
Signed-off-by: Aryan Rajesh Ganjoo <[email protected]>
|
✅ DCO Check Passed Thanks @AryanRG, all your commits are properly signed off. 🎉 |
Merge Protections🟢 All 2 merge protections satisfied — ready to merge. Show 2 satisfied protections🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
🟢 Require two reviewer for test updatesWhen test data is updated, we require two reviewers
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Signed-off-by: Aryan Rajesh Ganjoo <[email protected]>
AI triage (advisory)Checked commit The JATS backend now keeps CI safety: no concern found. A maintainer must still approve CI. 3 related pull request(s) in the same code
Reference data changes
Assessment: expected. The footnote count rises in two JATS reference files (0 to 6 and 0 to 71), which matches the new table footnote handling. The new The |
There was a problem hiding this comment.
AI first review (advisory): no blocker found
This review covers the full diff at ad7506810f. It read the code and did not run it.
The change keeps table notes visible by using an empty FOOTNOTE wrapper with the note text in child runs. This is a workaround for the table serializer in docling-core 2.100.0. I could not read the installed docling_core source, so I did not check the claim about how its serializers treat referenced footnotes.
A maintainer makes the merge decision. This review never approves the pull request.
|
Resolving the conflict exposed a compatibility problem with released docling-core 2.105.0: it renders referenced footnotes from their own text, so this PR's empty wrappers add empty HTML footnotes and extra Markdown spacing. The note content still appears once. Putting text on the wrappers as well makes it appear twice on 2.105.0; removing the child runs instead loses exports on older supported cores. Which direction would you prefer?
I've kept the merge update local pending that decision. Happy to try another representation if I've missed one. |
|
Hi @AryanRG, thank you for this pull request. It has a merge conflict with git fetch upstream
git rebase upstream/main
# resolve the conflicts, then:
git push --force-with-leaseWe can continue with the review and CI after that. |
|
Thanks @PeterStaar-IBM. The saved merge update exposed the core compatibility problem described above. Before I update the branch, could you confirm whether table-owned inline groups are acceptable, or whether we should fix the core serializer first to retain footnote references and rich content? |
|
@AryanRG on your question: this PR's scope is producing the correct Two changes for your update, because your saved merge predates #3891, which merged today:
|
Resolve the conflicts with #3891 (InlineGroup whitespace contract): - _add_table_footnotes trims the note edges with _trim_segment_edges, which replaces _strip_segments, so the whitespace between runs stays. - _walk_inline_formula keeps the ext-link pass-through for table notes and uses main's paragraph boundary, so the paragraph_breaks option is no longer needed. - Table-note tests expect runs with their source whitespace. - Regenerate the pntd.0008301 and pone.0234687 references with docling-core 2.106.0. - Add jats_backend.py to the max-lines warn list (1547 lines). Signed-off-by: Aryan Rajesh Ganjoo <[email protected]>
Add a regression for `<sup>a</sup>CO<sub>2</sub>e`: the runs follow the source, so no space follows the marker. Describe the referenced FOOTNOTE item and its inline runs as the document representation, not as a serializer workaround. Signed-off-by: Aryan Rajesh Ganjoo <[email protected]>
|
Thanks @vagenas, updated. I merged current The pntd/pone references are regenerated with docling-core 2.106.0 and match |
…tes-4796 Signed-off-by: Panos Vagenas <[email protected]>
|
Hi @AryanRG, thank you for this pull request. It has a merge conflict with git fetch upstream
git rebase upstream/main
# resolve the conflicts, then:
git push --force-with-leaseWe can continue with the review and CI after that. |
Regenerated the JATS reference data on top of the merged code to resolve the conflicts with docling-project#4818. Signed-off-by: SK Arin <[email protected]>
JATS conversion drops direct
table-wrap-foot/fnnotes. This change attaches each nonempty note as oneFOOTNOTEowned and referenced by its table, preserving source order, formatting, hyperlinks, inline formulas and literal citations such as[8]. A note paragraph keeps a word boundary to what precedes it, including the note label, by the same rulemainuses for article-level footnotes.Refs #4796. This covers table notes only; author notes, nested
fn-groupcontainers, baretable-wrap-footparagraphs and xref resolution remain separate work. Existingfn-groupbehavior is unchanged.Representation
Each note is an empty
FOOTNOTEitem under the table, referenced fromTableItem.footnotes. Its content is an inline group of runs, similar to the article-level footnote list items. The runs keep their source whitespace under theInlineGroupcontract from #3891, so<sup>a</sup>CO<sub>2</sub>ehas no space after the marker. Text runs carry theFOOTNOTElabel, so label filtering and chunk metadata classify them as note content; formula runs keepFORMULA.The change does not modify
pyproject.tomloruv.lock.Known serializer limits (docling-core 2.106.0)
The document keeps the complete notes. These are export issues, reported in docling-project/docling-core#973:
<div class="footnote"></div>, and the note content follows as aninline-groupspan outside it.aCO2e(fix: preserve superscripts and subscripts in Markdown export docling-core#802, feat: add opt-in HTML fallback for formatting in Markdown export docling-core#661).Note text appears once in both formats. If only the
FOOTNOTElabel is excluded, the note text runs are removed but an inline formula can remain, because it keeps theFORMULAlabel.Checklist:
Review evidence:
main:tests/test_backend_jats.py,tests/test_backend_jats_table_footnotes.py,tests/test_backend_jats_sub_articles.pyandtests/test_data_gen_flag.py: 120 passed.mainwithout this change, 20 of the 23 table-note tests fail. The 3 that pass check that empty notes and bare paragraphs add no footnotes.tests/test_inline_whitespace_contract.py: 27 passed. One docx equation case fails identically onmainin my environment, which lacks an optional docx math dependency.make validate: passed, including Ruff, the formatter, ty, Tach, module coverage and the max-lines checks.Exactly six existing references change: JSON, Markdown and indented text for
pntd.0008301.nxmlandpone.0234687.nxml. They represent 20 notes across six tables. Outside the table notes, the document items matchmain. The Markdown files only gain lines: the 20 note paragraphs after their tables, plus the empty paragraphs described above.jats_backend.pyis now 1547 lines, so it is added to the[warn]list in.github/max-lines-ignore.Reference-data changes require two approving reviewers under the repository contribution policy.