feat(html): Support formatting tags in HTML texts (#2111)

* add parsing for formatting tags in HTML backend

Signed-off-by: Roman Kayan BAZG <roman.kayan@bazg.admin.ch>

fix latest tests + wiki_duck result files.

Signed-off-by: Roman Kayan BAZG <roman.kayan@bazg.admin.ch>

* convert _collect_parent_format_tags to staticmethod

Signed-off-by: Roman Kayan BAZG <roman.kayan@bazg.admin.ch>

---------

Signed-off-by: Roman Kayan BAZG <roman.kayan@bazg.admin.ch>
This commit is contained in:
krrome
2025-08-22 10:37:34 +02:00
committed by GitHub
parent e76298c40d
commit 94fcc46aa9
15 changed files with 9420 additions and 4456 deletions

View File

@@ -76,6 +76,23 @@
{
"$ref": "#/texts/13"
},
{
"$ref": "#/texts/16"
},
{
"$ref": "#/texts/19"
}
],
"content_layer": "body",
"name": "ordered list",
"label": "list"
},
{
"self_ref": "#/groups/2",
"parent": {
"$ref": "#/texts/13"
},
"children": [
{
"$ref": "#/texts/14"
},
@@ -84,8 +101,42 @@
}
],
"content_layer": "body",
"name": "ordered list",
"label": "list"
"name": "group",
"label": "inline"
},
{
"self_ref": "#/groups/3",
"parent": {
"$ref": "#/texts/16"
},
"children": [
{
"$ref": "#/texts/17"
},
{
"$ref": "#/texts/18"
}
],
"content_layer": "body",
"name": "group",
"label": "inline"
},
{
"self_ref": "#/groups/4",
"parent": {
"$ref": "#/texts/19"
},
"children": [
{
"$ref": "#/texts/20"
},
{
"$ref": "#/texts/21"
}
],
"content_layer": "body",
"name": "group",
"label": "inline"
}
],
"texts": [
@@ -285,42 +336,147 @@
"parent": {
"$ref": "#/groups/1"
},
"children": [],
"children": [
{
"$ref": "#/groups/2"
}
],
"content_layer": "body",
"label": "list_item",
"prov": [],
"orig": "HTMLDocumentBackend Ignores images",
"text": "HTMLDocumentBackend Ignores images",
"orig": "",
"text": "",
"enumerated": true,
"marker": ""
},
{
"self_ref": "#/texts/14",
"parent": {
"$ref": "#/groups/1"
"$ref": "#/groups/2"
},
"children": [],
"content_layer": "body",
"label": "list_item",
"label": "text",
"prov": [],
"orig": "HTMLDocumentBackendImagesInline Extracts images inline",
"text": "HTMLDocumentBackendImagesInline Extracts images inline",
"enumerated": true,
"marker": ""
"orig": "HTMLDocumentBackend",
"text": "HTMLDocumentBackend",
"formatting": {
"bold": true,
"italic": false,
"underline": false,
"strikethrough": false,
"script": "baseline"
}
},
{
"self_ref": "#/texts/15",
"parent": {
"$ref": "#/groups/1"
"$ref": "#/groups/2"
},
"children": [],
"content_layer": "body",
"label": "text",
"prov": [],
"orig": "Ignores images",
"text": "Ignores images"
},
{
"self_ref": "#/texts/16",
"parent": {
"$ref": "#/groups/1"
},
"children": [
{
"$ref": "#/groups/3"
}
],
"content_layer": "body",
"label": "list_item",
"prov": [],
"orig": "HTMLDocumentBackendImagesReferenced Extracts images as references",
"text": "HTMLDocumentBackendImagesReferenced Extracts images as references",
"orig": "",
"text": "",
"enumerated": true,
"marker": ""
},
{
"self_ref": "#/texts/17",
"parent": {
"$ref": "#/groups/3"
},
"children": [],
"content_layer": "body",
"label": "text",
"prov": [],
"orig": "HTMLDocumentBackendImagesInline",
"text": "HTMLDocumentBackendImagesInline",
"formatting": {
"bold": true,
"italic": false,
"underline": false,
"strikethrough": false,
"script": "baseline"
}
},
{
"self_ref": "#/texts/18",
"parent": {
"$ref": "#/groups/3"
},
"children": [],
"content_layer": "body",
"label": "text",
"prov": [],
"orig": "Extracts images inline",
"text": "Extracts images inline"
},
{
"self_ref": "#/texts/19",
"parent": {
"$ref": "#/groups/1"
},
"children": [
{
"$ref": "#/groups/4"
}
],
"content_layer": "body",
"label": "list_item",
"prov": [],
"orig": "",
"text": "",
"enumerated": true,
"marker": ""
},
{
"self_ref": "#/texts/20",
"parent": {
"$ref": "#/groups/4"
},
"children": [],
"content_layer": "body",
"label": "text",
"prov": [],
"orig": "HTMLDocumentBackendImagesReferenced",
"text": "HTMLDocumentBackendImagesReferenced",
"formatting": {
"bold": true,
"italic": false,
"underline": false,
"strikethrough": false,
"script": "baseline"
}
},
{
"self_ref": "#/texts/21",
"parent": {
"$ref": "#/groups/4"
},
"children": [],
"content_layer": "body",
"label": "text",
"prov": [],
"orig": "Extracts images as references",
"text": "Extracts images as references"
}
],
"pictures": [