fix(docx): Missing list items after numbered header (#2665)

* fix #2250. list items after numbered headers

Signed-off-by: Michele Dolfi <dol@zurich.ibm.com>

* add test for new case

Signed-off-by: Michele Dolfi <dol@zurich.ibm.com>

* chore(docx): remove unnecessary check

Remove 'current_parent is None' check in '_add_list_item' function since it
will always be None.

Signed-off-by: Cesar Berrospi Ramis <ceb@zurich.ibm.com>

---------

Signed-off-by: Michele Dolfi <dol@zurich.ibm.com>
Signed-off-by: Cesar Berrospi Ramis <ceb@zurich.ibm.com>
Co-authored-by: Cesar Berrospi Ramis <ceb@zurich.ibm.com>
This commit is contained in:
Michele Dolfi
2025-11-24 08:49:21 +01:00
committed by GitHub
parent ad97e52851
commit e58055465c
5 changed files with 196 additions and 1 deletions

Binary file not shown.

View File

@@ -0,0 +1,9 @@
item-0 at level 0: unspecified: group _root_
item-1 at level 1: text:
item-2 at level 1: section: group header-0
item-3 at level 2: section: group header-1
item-4 at level 3: section_header: Chính sách bảo hành
item-5 at level 4: section_header: 1 ĐỐI TƯỢNG ÁP DỤNG
item-6 at level 5: list: group list
item-7 at level 6: list_item: Chính sách bảo hành và các điều k
item-8 at level 6: list_item: Pin điện áp cao (sau đây gọi tắt là “

View File

@@ -0,0 +1,173 @@
{
"schema_name": "DoclingDocument",
"version": "1.8.0",
"name": "list_after_num_headers",
"origin": {
"mimetype": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"binary_hash": 8533346410935061397,
"filename": "list_after_num_headers.docx"
},
"furniture": {
"self_ref": "#/furniture",
"children": [],
"content_layer": "furniture",
"name": "_root_",
"label": "unspecified"
},
"body": {
"self_ref": "#/body",
"children": [
{
"$ref": "#/texts/0"
},
{
"$ref": "#/groups/0"
}
],
"content_layer": "body",
"name": "_root_",
"label": "unspecified"
},
"groups": [
{
"self_ref": "#/groups/0",
"parent": {
"$ref": "#/body"
},
"children": [
{
"$ref": "#/groups/1"
}
],
"content_layer": "body",
"name": "header-0",
"label": "section"
},
{
"self_ref": "#/groups/1",
"parent": {
"$ref": "#/groups/0"
},
"children": [
{
"$ref": "#/texts/1"
}
],
"content_layer": "body",
"name": "header-1",
"label": "section"
},
{
"self_ref": "#/groups/2",
"parent": {
"$ref": "#/texts/2"
},
"children": [
{
"$ref": "#/texts/3"
},
{
"$ref": "#/texts/4"
}
],
"content_layer": "body",
"name": "list",
"label": "list"
}
],
"texts": [
{
"self_ref": "#/texts/0",
"parent": {
"$ref": "#/body"
},
"children": [],
"content_layer": "body",
"label": "text",
"prov": [],
"orig": "",
"text": ""
},
{
"self_ref": "#/texts/1",
"parent": {
"$ref": "#/groups/1"
},
"children": [
{
"$ref": "#/texts/2"
}
],
"content_layer": "body",
"label": "section_header",
"prov": [],
"orig": "Chính sách bảo hành",
"text": "Chính sách bảo hành",
"level": 2
},
{
"self_ref": "#/texts/2",
"parent": {
"$ref": "#/texts/1"
},
"children": [
{
"$ref": "#/groups/2"
}
],
"content_layer": "body",
"label": "section_header",
"prov": [],
"orig": "1 ĐỐI TƯỢNG ÁP DỤNG",
"text": "1 ĐỐI TƯỢNG ÁP DỤNG",
"level": 3
},
{
"self_ref": "#/texts/3",
"parent": {
"$ref": "#/groups/2"
},
"children": [],
"content_layer": "body",
"label": "list_item",
"prov": [],
"orig": "Chính sách bảo hành và các điều k",
"text": "Chính sách bảo hành và các điều k",
"formatting": {
"bold": false,
"italic": false,
"underline": false,
"strikethrough": false,
"script": "baseline"
},
"enumerated": false,
"marker": ""
},
{
"self_ref": "#/texts/4",
"parent": {
"$ref": "#/groups/2"
},
"children": [],
"content_layer": "body",
"label": "list_item",
"prov": [],
"orig": "Pin điện áp cao (sau đây gọi tắt là “",
"text": "Pin điện áp cao (sau đây gọi tắt là “",
"formatting": {
"bold": false,
"italic": false,
"underline": false,
"strikethrough": false,
"script": "baseline"
},
"enumerated": false,
"marker": ""
}
],
"pictures": [],
"tables": [],
"key_value_items": [],
"form_items": [],
"pages": {}
}

View File

@@ -0,0 +1,6 @@
### Chính sách bảo hành
#### 1 ĐỐI TƯỢNG ÁP DỤNG
- Chính sách bảo hành và các điều k
- Pin điện áp cao (sau đây gọi tắt là “