JATS: content of `<sub-article>` is not converted

Cerrado
#4,792 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Ya se ha fusionado un pull request relacionado.

  • #4826 de @LubabaKhalid — fusionado

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
70/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python
Área
backend

Línea de trabajo

Start with docling/backend/xml/jats_backend.py around JatsDocumentBackend.convert() at lines 292–299, where the issue says only the first //body and //back are walked. Use the provided minimal JATS input to reproduce the missing ALPHA-SUB text and inspect the existing XML backend tests for a place to add a fixture. Done means the sub-article text appears in the converted document and the test covers the main article text as well.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Bug

A follow-up to #3583, split out as one narrow case.

JatsDocumentBackend.convert() walks only the first //body and the first //back (jats_backend.py#L292-L299 at v2.138.0). A <sub-article>'s own body is never reached, so none of its text reaches the document.

Publishers use <sub-article> for published peer-review records, author responses, translated abstracts and decision letters. In two PLOS Computational Biology articles we checked, the review record holds 127 and 109 paragraphs longer than 60 characters, and none of them is in the conversion.

Minimal input (after the prologue):

<front><article-meta><title-group><article-title>Control</article-title></title-group></article-meta></front>
<body><sec><title>S</title><p>ALPHA-MAIN paragraph.</p></sec></body>
<sub-article article-type="author-comment" id="sub1"><body><p>ALPHA-SUB reviewer paragraph.</p></body></sub-article>
</article>

Observed on v2.138.0 (a76ae4b6) and on main (f0d90989), unchanged since 2.131.0: ALPHA-MAIN is in the document; ALPHA-SUB is not, anywhere in export_to_dict().

Is skipping <sub-article> intended? If not, how would you like it represented: for example, as a separate section, or in a different content layer? We're happy to contribute the fixture and a test.

Steps to reproduce

Save the article as article.xml, then:

from docling.document_converter import DocumentConverter
doc = DocumentConverter().convert("article.xml").document
print(doc.export_to_markdown())
print([(t.text, t.hyperlink) for t in doc.texts])

Every article starts with this prologue. The backend needs a DOCTYPE.

<?xml version="1.0"?>
<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Publishing DTD v1.3 20210610//EN" "JATS-journalpublishing1-3.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:mml="http://www.w3.org/1998/Math/MathML" article-type="research-article">
Docling version

v2.138.0 (a76ae4b6) and main (f0d90989), each installed as docling-slim[standard] from git.

Python version

3.14.7

Lenguaje dominante
Python
Estrellas
70.1k
Forks
5.3k
Merge medio
3 d 4 h
PR fusionados (30 d)
212

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de docling-project/docling

Todos los issues de docling-project/docling

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.