feat(html): Support in-line anchor tags in HTML texts (#1659)

* re-implement links for html backend.

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

* fix inline groups in list items. write specific test for find_parent_annotation of _extract_text_and_hyperlink_recursively.

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

* implement hack for images.

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-18 09:57:16 +02:00
committed by GitHub
parent 76c1fbd6e8
commit 9687297262
25 changed files with 21059 additions and 4111 deletions

View File

@@ -0,0 +1,159 @@
{
"schema_name": "DoclingDocument",
"version": "1.5.0",
"name": "hyperlink_05",
"origin": {
"mimetype": "text/html",
"binary_hash": 13325077355174381809,
"filename": "hyperlink_05.html"
},
"furniture": {
"self_ref": "#/furniture",
"children": [],
"content_layer": "furniture",
"name": "_root_",
"label": "unspecified"
},
"body": {
"self_ref": "#/body",
"children": [
{
"$ref": "#/texts/0"
},
{
"$ref": "#/texts/1"
},
{
"$ref": "#/pictures/0"
},
{
"$ref": "#/texts/2"
},
{
"$ref": "#/pictures/1"
},
{
"$ref": "#/texts/3"
},
{
"$ref": "#/pictures/2"
}
],
"content_layer": "body",
"name": "_root_",
"label": "unspecified"
},
"groups": [],
"texts": [
{
"self_ref": "#/texts/0",
"parent": {
"$ref": "#/body"
},
"children": [],
"content_layer": "furniture",
"label": "title",
"prov": [],
"orig": "Image Hyperlink and Caption Example",
"text": "Image Hyperlink and Caption Example"
},
{
"self_ref": "#/texts/1",
"parent": {
"$ref": "#/body"
},
"children": [],
"content_layer": "body",
"label": "caption",
"prov": [],
"orig": "Image Hyperlink.",
"text": "Image Hyperlink.",
"hyperlink": "https://www.example.com/"
},
{
"self_ref": "#/texts/2",
"parent": {
"$ref": "#/body"
},
"children": [],
"content_layer": "body",
"label": "caption",
"prov": [],
"orig": "This is an example caption for the image.",
"text": "This is an example caption for the image."
},
{
"self_ref": "#/texts/3",
"parent": {
"$ref": "#/body"
},
"children": [],
"content_layer": "body",
"label": "caption",
"prov": [],
"orig": "This is an example caption for the image.",
"text": "This is an example caption for the image.",
"hyperlink": "#caption"
}
],
"pictures": [
{
"self_ref": "#/pictures/0",
"parent": {
"$ref": "#/body"
},
"children": [],
"content_layer": "body",
"label": "picture",
"prov": [],
"captions": [
{
"$ref": "#/texts/1"
}
],
"references": [],
"footnotes": [],
"annotations": []
},
{
"self_ref": "#/pictures/1",
"parent": {
"$ref": "#/body"
},
"children": [],
"content_layer": "body",
"label": "picture",
"prov": [],
"captions": [
{
"$ref": "#/texts/2"
}
],
"references": [],
"footnotes": [],
"annotations": []
},
{
"self_ref": "#/pictures/2",
"parent": {
"$ref": "#/body"
},
"children": [],
"content_layer": "body",
"label": "picture",
"prov": [],
"captions": [
{
"$ref": "#/texts/3"
}
],
"references": [],
"footnotes": [],
"annotations": []
}
],
"tables": [],
"key_value_items": [],
"form_items": [],
"pages": {}
}