Skip to content

Commit 9563dfe

Browse files
committed
add html placeholder
Signed-off-by: Michele Dolfi <[email protected]>
1 parent 6e64a13 commit 9563dfe

8 files changed

+92
-0
lines changed

docling_core/types/doc/document.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1393,6 +1393,17 @@ class DoclingDocument(BaseModel):
13931393
math annotation {
13941394
display: none;
13951395
}
1396+
.formula-not-decoded {
1397+
background: repeating-linear-gradient(
1398+
45deg, /* Angle of the stripes */
1399+
LightGray, /* First color */
1400+
LightGray 10px, /* Length of the first color */
1401+
White 10px, /* Second color */
1402+
White 20px /* Length of the second color */
1403+
);
1404+
margin: 0;
1405+
text-align: center;
1406+
}
13961407
</style>
13971408
</head>"""
13981409

@@ -2503,6 +2514,10 @@ def _prepare_tag_content(
25032514

25042515
if text != "":
25052516
html_texts.append(text)
2517+
else:
2518+
html_texts.append(
2519+
'<div class="formula-not-decoded">Formula not decoded</div>'
2520+
)
25062521

25072522
elif isinstance(item, ListItem):
25082523

test/data/doc/2206.01062.yaml.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,17 @@
5656
math annotation {
5757
display: none;
5858
}
59+
.formula-not-decoded {
60+
background: repeating-linear-gradient(
61+
45deg, /* Angle of the stripes */
62+
LightGray, /* First color */
63+
LightGray 10px, /* Length of the first color */
64+
White 10px, /* Second color */
65+
White 20px /* Length of the second color */
66+
);
67+
margin: 0;
68+
text-align: center;
69+
}
5970
</style>
6071
</head>
6172
<h2>DocLayNet: A Large Human-Annotated Dataset for Document-Layout Analysis</h2>

test/data/doc/bad_doc.yaml.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,17 @@
5656
math annotation {
5757
display: none;
5858
}
59+
.formula-not-decoded {
60+
background: repeating-linear-gradient(
61+
45deg, /* Angle of the stripes */
62+
LightGray, /* First color */
63+
LightGray 10px, /* Length of the first color */
64+
White 10px, /* Second color */
65+
White 20px /* Length of the second color */
66+
);
67+
margin: 0;
68+
text-align: center;
69+
}
5970
</style>
6071
</head>
6172
<h1>This is the title</h1>

test/data/doc/constructed_doc.embedded.html.gt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,17 @@
5656
math annotation {
5757
display: none;
5858
}
59+
.formula-not-decoded {
60+
background: repeating-linear-gradient(
61+
45deg, /* Angle of the stripes */
62+
LightGray, /* First color */
63+
LightGray 10px, /* Length of the first color */
64+
White 10px, /* Second color */
65+
White 20px /* Length of the second color */
66+
);
67+
margin: 0;
68+
text-align: center;
69+
}
5970
</style>
6071
</head>
6172
<h1>Title of the Document</h1>

test/data/doc/constructed_doc.placeholder.html.gt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,17 @@
5656
math annotation {
5757
display: none;
5858
}
59+
.formula-not-decoded {
60+
background: repeating-linear-gradient(
61+
45deg, /* Angle of the stripes */
62+
LightGray, /* First color */
63+
LightGray 10px, /* Length of the first color */
64+
White 10px, /* Second color */
65+
White 20px /* Length of the second color */
66+
);
67+
margin: 0;
68+
text-align: center;
69+
}
5970
</style>
6071
</head>
6172
<h1>Title of the Document</h1>

test/data/doc/constructed_doc.referenced.html.gt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,17 @@
5656
math annotation {
5757
display: none;
5858
}
59+
.formula-not-decoded {
60+
background: repeating-linear-gradient(
61+
45deg, /* Angle of the stripes */
62+
LightGray, /* First color */
63+
LightGray 10px, /* Length of the first color */
64+
White 10px, /* Second color */
65+
White 20px /* Length of the second color */
66+
);
67+
margin: 0;
68+
text-align: center;
69+
}
5970
</style>
6071
</head>
6172
<h1>Title of the Document</h1>

test/data/doc/constructed_document.yaml.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,17 @@
5656
math annotation {
5757
display: none;
5858
}
59+
.formula-not-decoded {
60+
background: repeating-linear-gradient(
61+
45deg, /* Angle of the stripes */
62+
LightGray, /* First color */
63+
LightGray 10px, /* Length of the first color */
64+
White 10px, /* Second color */
65+
White 20px /* Length of the second color */
66+
);
67+
margin: 0;
68+
text-align: center;
69+
}
5970
</style>
6071
</head>
6172
<h1>Title of the Document</h1>

test/data/doc/dummy_doc.yaml.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,17 @@
5656
math annotation {
5757
display: none;
5858
}
59+
.formula-not-decoded {
60+
background: repeating-linear-gradient(
61+
45deg, /* Angle of the stripes */
62+
LightGray, /* First color */
63+
LightGray 10px, /* Length of the first color */
64+
White 10px, /* Second color */
65+
White 20px /* Length of the second color */
66+
);
67+
margin: 0;
68+
text-align: center;
69+
}
5970
</style>
6071
</head>
6172
<h1>DocLayNet: A Large Human-Annotated Dataset for Document-Layout Analysis</h1>

0 commit comments

Comments
 (0)