Repository navigation
fix(jats): keep the section title next to its label in headings - #5244
Conversation
|
✅ DCO Check Passed Thanks @MaiAditya, 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
|
AI triage (advisory)Checked commit This PR preserves both the label and title in JATS section headings. It joins the label and title text with a space in document order. CI safety: no concern found. A maintainer must still approve CI. Reference data changes
Assessment: expected. The updated reference files include the section title next to the section label in JATS headings. The |
There was a problem hiding this comment.
AI first review (advisory): no blocker found
This review covers the full diff at 4087c06af3. It read the code and did not run it.
I found no defect. All four title|label sites now join label and title in document order, and empty parts are skipped. The body <sec>, <ack> and <ref-list> headings use _get_heading_text, and the abstract sites use _get_node_text as before. The body-heading test cases fail on the old header[0] code. In _walk_linear, an empty heading text still creates no heading and does not change self.hlevel.
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! |
There was a problem hiding this comment.
Thanks @MaiAditya ! This is something that had to be fixed. The changes are minimal, precise, and well-tested. Thanks for your contribution 🚀
FYI: I rebase to main and force-pushed since there was a conflict with the test file
Signed-off-by: Aditya Gupta <[email protected]>
4087c06 to
d03c456
Compare
|
Thanks for the review, @ceberam! Mergify needs a second approval here because the PR updates test data. Could you suggest or ping someone who could take a look when they have time? Happy to make any changes they ask for. |
Section headings were built from the first node of
xpath("title|label"). JATS puts<label>before<title>, so a labelled section got only its number (## 1.) and the title was lost. Now the heading joins the label and the title with a space (## 1. Introduction), in document order, and skips empty parts. A section with only a title or only a label gets the same heading as before.The same
title|labelpattern was used in four places, and all four are changed: body<sec>/<ack>headings, ref-list headings, structured abstract sections and the abstract label. The two body sites share a small helper,_get_heading_text. The abstract sites keep_get_node_text, as before.One side effect: body heading text is now stripped, so a whitespace-only
<title>no longer creates a heading" ".Issue resolved by this Pull Request:
Resolves #5243
Checklist:
Review evidence:
test_jats_section_heading_keeps_title_next_to_labelandtest_jats_abstract_section_heading_keeps_title_next_to_labelintests/test_backend_jats.py. They cover a label plus title, a nested section, title only, label only, and a label with an empty<title/>. Onmainthey fail with## 1./### 1..ptag100.xmlis the only committed fixture with labelled sections. I regenerated it withDOCLING_GEN_TEST_DATA=1. Its 11 headings change from## 1.to## 1. Introduction,### 2.1.to### 2.1. Basic formulations: Hamiltonian and invariant, and so on. The.md,.jsonand.itxtfiles only change in those heading texts. No other groundtruth file changed.uv run pytest tests/test_backend_jats.py -q: 109 passedprek run --files <changed files>: all hooks passed or skipped (ruff, ruff format, ty, tach, max-lines, license header)