mirror of
https://github.com/docling-project/docling-core.git
synced 2026-11-18 20:27:00 +00:00
* fix(html-serializer): emit XHTML-compatible metadata attributes HTMLMetaSerializer previously rendered each metadata field as a valueless HTML5 attribute (e.g. `<div data-meta-classification>`). Lenient HTML parsers accept this, but the output is not valid XHTML/XML, so downstream consumers that parse exported HTML as XML — including TEDS table evaluation — fail with `xml.etree.ElementTree.ParseError: not well-formed (invalid token)`. Switch the attribute shape to a standard name=value pair (`data-meta-name="<field>"`), HTML-escape both the field name and the text body (`TabularChartMetaField` is left unescaped because its value is an intentionally embedded HTML table), and update the embedded CSS selectors and serialization ground-truth fixtures accordingly. Adds a regression test that round-trips the output of `export_to_html` through `xml.etree.ElementTree.fromstring`. Fixes #598. Signed-off-by: Brian Wang <20699847+BrianWang1990@users.noreply.github.com> * fix(html-serializer): rebase changes to 'main' and add tests Signed-off-by: Cesar Berrospi Ramis <ceb@zurich.ibm.com> * test(html-serializer): remove redundant CSS rule Remove duplicate CSS rules in 'html_styles.py' and ground-truth files. Signed-off-by: Cesar Berrospi Ramis <ceb@zurich.ibm.com> --------- Signed-off-by: Brian Wang <20699847+BrianWang1990@users.noreply.github.com> Signed-off-by: Cesar Berrospi Ramis <ceb@zurich.ibm.com> Co-authored-by: Brian Wang <20699847+BrianWang1990@users.noreply.github.com> Co-authored-by: Cesar Berrospi Ramis <ceb@zurich.ibm.com>
182 lines
5.4 KiB
HTML
Vendored
182 lines
5.4 KiB
HTML
Vendored
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="UTF-8"/>
|
|
<title>dummy_doc</title>
|
|
<meta name="generator" content="Docling HTML Serializer"/>
|
|
<style>
|
|
html {
|
|
background-color: #f5f5f5;
|
|
font-family: Arial, sans-serif;
|
|
line-height: 1.6;
|
|
}
|
|
body {
|
|
max-width: 800px;
|
|
margin: 0 auto;
|
|
padding: 2rem;
|
|
background-color: white;
|
|
box-shadow: 0 0 10px rgba(0,0,0,0.1);
|
|
}
|
|
h1, h2, h3, h4, h5, h6 {
|
|
color: #333;
|
|
margin-top: 1.5em;
|
|
margin-bottom: 0.5em;
|
|
}
|
|
h1 {
|
|
font-size: 2em;
|
|
border-bottom: 1px solid #eee;
|
|
padding-bottom: 0.3em;
|
|
}
|
|
table {
|
|
border-collapse: collapse;
|
|
margin: 1em 0;
|
|
width: 100%;
|
|
}
|
|
th, td {
|
|
border: 1px solid #ddd;
|
|
padding: 8px;
|
|
text-align: left;
|
|
}
|
|
th {
|
|
background-color: #f2f2f2;
|
|
font-weight: bold;
|
|
}
|
|
figure {
|
|
margin: 1.5em 0;
|
|
text-align: center;
|
|
}
|
|
figcaption {
|
|
color: #666;
|
|
font-style: italic;
|
|
margin-top: 0.5em;
|
|
}
|
|
img {
|
|
max-width: 100%;
|
|
height: auto;
|
|
}
|
|
pre {
|
|
background-color: #f6f8fa;
|
|
border-radius: 3px;
|
|
padding: 1em;
|
|
overflow: auto;
|
|
}
|
|
code {
|
|
font-family: monospace;
|
|
background-color: #f6f8fa;
|
|
padding: 0.2em 0.4em;
|
|
border-radius: 3px;
|
|
}
|
|
pre code {
|
|
background-color: transparent;
|
|
padding: 0;
|
|
}
|
|
.formula {
|
|
text-align: center;
|
|
padding: 0.5em;
|
|
margin: 1em 0;
|
|
background-color: #f9f9f9;
|
|
}
|
|
.formula-not-decoded {
|
|
text-align: center;
|
|
padding: 0.5em;
|
|
margin: 1em 0;
|
|
background: repeating-linear-gradient(
|
|
45deg,
|
|
#f0f0f0,
|
|
#f0f0f0 10px,
|
|
#f9f9f9 10px,
|
|
#f9f9f9 20px
|
|
);
|
|
}
|
|
.page-break {
|
|
page-break-after: always;
|
|
border-top: 1px dashed #ccc;
|
|
margin: 2em 0;
|
|
}
|
|
.key-value-region {
|
|
background-color: #f9f9f9;
|
|
padding: 1em;
|
|
border-radius: 4px;
|
|
margin: 1em 0;
|
|
}
|
|
.key-value-region dt {
|
|
font-weight: bold;
|
|
}
|
|
.key-value-region dd {
|
|
margin-left: 1em;
|
|
margin-bottom: 0.5em;
|
|
}
|
|
.form-container {
|
|
border: 1px solid #ddd;
|
|
padding: 1em;
|
|
border-radius: 4px;
|
|
margin: 1em 0;
|
|
}
|
|
.form-item {
|
|
margin-bottom: 0.5em;
|
|
}
|
|
.image-classification {
|
|
font-size: 0.9em;
|
|
color: #666;
|
|
margin-top: 0.5em;
|
|
}
|
|
details.docling-meta {
|
|
margin: 0.5em 0;
|
|
font-size: 0.9em;
|
|
text-align: left;
|
|
}
|
|
figure details.docling-meta {
|
|
text-align: left;
|
|
}
|
|
details.docling-meta > summary {
|
|
cursor: pointer;
|
|
color: #555;
|
|
font-style: italic;
|
|
padding: 2px 6px;
|
|
}
|
|
.docling-meta-field {
|
|
background-color: #f0f0f0;
|
|
border-left: 3px solid #ccc;
|
|
padding: 6px 10px;
|
|
margin: 4px 0 4px 1em;
|
|
border-radius: 3px;
|
|
text-align: left;
|
|
}
|
|
.docling-meta-field-label {
|
|
font-weight: bold;
|
|
color: #444;
|
|
}
|
|
pre.docling-meta-code {
|
|
background-color: #1e1e1e;
|
|
color: #d4d4d4;
|
|
border-radius: 4px;
|
|
padding: 10px 12px;
|
|
margin: 6px 0;
|
|
overflow-x: auto;
|
|
font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
|
|
font-size: 0.85em;
|
|
line-height: 1.45;
|
|
white-space: pre;
|
|
tab-size: 4;
|
|
}
|
|
pre.docling-meta-code code {
|
|
background: transparent;
|
|
border: none;
|
|
padding: 0;
|
|
color: inherit;
|
|
font-family: inherit;
|
|
font-size: inherit;
|
|
display: block;
|
|
white-space: pre;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class='page'>
|
|
<h1>DocLayNet: A Large Human-Annotated Dataset for Document-Layout Analysis</h1>
|
|
<figure><figcaption><div class="caption">Figure 1: Four examples of complex page layouts across different document categories</div></figcaption><details class="docling-meta"><summary>Meta</summary><div class="docling-meta-field" data-meta-name="description"><span class="docling-meta-field-label">description:</span> <span class="docling-meta-field-value">...</span></div><div class="docling-meta-field" data-meta-name="classification"><span class="docling-meta-field-label">classification:</span> <span class="docling-meta-field-value">Bar chart</span></div><div class="docling-meta-field" data-meta-name="molecule"><span class="docling-meta-field-label">molecule:</span> <span class="docling-meta-field-value">CC1=NNC(C2=CN3C=CN=C3C(CC3=CC(F)=CC(F)=C3)=N2)=N1</span></div><div class="docling-meta-field" data-meta-name="docling_legacy__misc"><span class="docling-meta-field-label">docling_legacy__misc:</span> <span class="docling-meta-field-value">{'myanalysis': {'prediction': 'abc'}, 'something_else': {'text': 'aaa'}}</span></div></details></figure>
|
|
<details class="docling-meta"><summary>Meta</summary><div class="docling-meta-field" data-meta-name="description"><span class="docling-meta-field-label">description:</span> <span class="docling-meta-field-value">A description annotation for this table.</span></div><div class="docling-meta-field" data-meta-name="docling_legacy__misc"><span class="docling-meta-field-label">docling_legacy__misc:</span> <span class="docling-meta-field-value">{'foo': 'bar'}</span></div></details>
|
|
</div>
|
|
</body>
|
|
</html>
|