mirror of
https://github.com/docling-project/docling-core.git
synced 2026-05-17 13:10:44 +00:00
* iunitial attempt at HTML serializer Signed-off-by: Peter Staar <taa@zurich.ibm.com> * first version, to be tested thoroughly Signed-off-by: Peter Staar <taa@zurich.ibm.com> * added the new test Signed-off-by: Peter Staar <taa@zurich.ibm.com> * rewrote carefully the export-to-html into new framework Signed-off-by: Peter Staar <taa@zurich.ibm.com> * fixed the inline list-items Signed-off-by: Peter Staar <taa@zurich.ibm.com> * added the inline code Signed-off-by: Peter Staar <taa@zurich.ibm.com> * migrated the table html code Signed-off-by: Peter Staar <taa@zurich.ibm.com> * updated the picture HTML serializer Signed-off-by: Peter Staar <taa@zurich.ibm.com> * updated the html for Form and KeyValue Signed-off-by: Peter Staar <taa@zurich.ibm.com> * first version of KeyValue serialisation Signed-off-by: Peter Staar <taa@zurich.ibm.com> * fixed the key-value and form-region and added the GraphData serializer Signed-off-by: Peter Staar <taa@zurich.ibm.com> * need to do some mypy work now Signed-off-by: Peter Staar <taa@zurich.ibm.com> * passed the mypy Signed-off-by: Peter Staar <taa@zurich.ibm.com> * added the get_excluded_refs function to obtain proper serialization Signed-off-by: Peter Staar <taa@zurich.ibm.com> * enabled the captions Signed-off-by: Peter Staar <taa@zurich.ibm.com> * removed empty lists Signed-off-by: Peter Staar <taa@zurich.ibm.com> * added initial split view and customised styles Signed-off-by: Peter Staar <taa@zurich.ibm.com> * cleaned up, now waiting for page-indices propagationg Signed-off-by: Peter Staar <taa@zurich.ibm.com> * updated the styles and parameters with split_page Signed-off-by: Peter Staar <taa@zurich.ibm.com> * propagated the parameter split_page_view Signed-off-by: Peter Staar <taa@zurich.ibm.com> * first fully working version Signed-off-by: Peter Staar <taa@zurich.ibm.com> * removed the prints Signed-off-by: Peter Staar <taa@zurich.ibm.com> * fixed the tests Signed-off-by: Peter Staar <taa@zurich.ibm.com> * fixed the tests Signed-off-by: Peter Staar <taa@zurich.ibm.com> * fixed the tests for html export Signed-off-by: Peter Staar <taa@zurich.ibm.com> * removed dead code Signed-off-by: Peter Staar <taa@zurich.ibm.com> * updated the test output Signed-off-by: Peter Staar <taa@zurich.ibm.com> * fixed the tests Signed-off-by: Peter Staar <taa@zurich.ibm.com> * reformatted the code Signed-off-by: Peter Staar <taa@zurich.ibm.com> * rename parameter tag to class_name Signed-off-by: Peter Staar <taa@zurich.ibm.com> * added serializers to table and picture Signed-off-by: Peter Staar <taa@zurich.ibm.com> * removed dead code Signed-off-by: Peter Staar <taa@zurich.ibm.com> * various HTML serialization improvements (#242) Signed-off-by: Panos Vagenas <pva@zurich.ibm.com> * added enum for different output styles Signed-off-by: Peter Staar <taa@zurich.ibm.com> --------- Signed-off-by: Peter Staar <taa@zurich.ibm.com> Signed-off-by: Panos Vagenas <pva@zurich.ibm.com> Co-authored-by: Panos Vagenas <pva@zurich.ibm.com>
204 lines
5.1 KiB
HTML
Vendored
204 lines
5.1 KiB
HTML
Vendored
<!DOCTYPE html>
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Untitled 1</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;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class='page'>
|
|
<ul>
|
|
<li>item of leading list</li>
|
|
</ul>
|
|
<h1>Title of the Document</h1>
|
|
<p>Author 1<br>Affiliation 1</p>
|
|
<p>Author 2<br>Affiliation 2</p>
|
|
<h2>1. Introduction</h2>
|
|
<p>This paper introduces the biggest invention ever made. ...</p>
|
|
<ul>
|
|
<li>list item 1</li>
|
|
<li>list item 2</li>
|
|
<li>list item 3</li>
|
|
<ol>
|
|
<li>list item 3.a</li>
|
|
<li>list item 3.b</li>
|
|
<li>list item 3.c</li>
|
|
<ol>
|
|
<li>list item 3.c.i</li>
|
|
</ol>
|
|
</ol>
|
|
<li>list item 4</li>
|
|
</ul>
|
|
<table><caption>This is the caption of table 1.</caption><tbody><tr><td rowspan="2">Product</td><td colspan="2">Years</td></tr><tr><td>2016</td><td>2017</td></tr><tr><td>Apple</td><td>49823</td><td>695944</td></tr></tbody></table>
|
|
<figure><figcaption>This is the caption of figure 1.</figcaption></figure>
|
|
<figure><figcaption>This is the caption of figure 2.</figcaption></figure>
|
|
<ul>
|
|
<li>item 1 of list</li>
|
|
</ul>
|
|
<ul>
|
|
<li>item 1 of list after empty list</li>
|
|
<li>item 2 of list after empty list</li>
|
|
</ul>
|
|
<ul>
|
|
<li>item 1 of neighboring list</li>
|
|
<li>item 2 of neighboring list</li>
|
|
<ul>
|
|
<li>item 1 of sub list</li>
|
|
<li><span class='inline-group'>Here a code snippet: <code><p>Hello world</p></code> (to be displayed inline)</span></li>
|
|
<li><span class='inline-group'>Here a formula: <math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>E</mi><mo>=</mo><mi>m</mi><msup><mi>c</mi><mn>2</mn></msup></mrow><annotation encoding="TeX">E=mc^2</annotation></math> (to be displayed inline)</span></li>
|
|
</ul>
|
|
</ul>
|
|
<p>Here a code block:</p>
|
|
<pre><code>print("Hello world")</code></pre>
|
|
<p>Here a formula block:</p>
|
|
<div><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mrow><mi>E</mi><mo>=</mo><mi>m</mi><msup><mi>c</mi><mn>2</mn></msup></mrow><annotation encoding="TeX">E=mc^2</annotation></math></div>
|
|
<div class="key-value-region">
|
|
<ul class="key-value-region">
|
|
<li><strong>number</strong>: 1</li>
|
|
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="form-container">
|
|
<ul class="form-container">
|
|
<li><strong>number</strong>: 1</li>
|
|
|
|
</ul>
|
|
</div>
|
|
|
|
<span class='inline-group'>Some formatting chops: <strong>bold</strong> <em>italic</em> <u>underline</u> <del>strikethrough</del> <a href=".">hyperlink</a> & <a href="https://github.com/DS4SD/docling"><del><u><em><strong>everything at the same time.</strong></em></u></del></a></span>
|
|
<ol>
|
|
<li>Item 1 in A</li>
|
|
<li>Item 2 in A</li>
|
|
<li>Item 3 in A</li>
|
|
<ol>
|
|
<li>Item 1 in B</li>
|
|
<li>Item 2 in B</li>
|
|
<ol>
|
|
<li>Item 1 in C</li>
|
|
<li>Item 2 in C</li>
|
|
</ol>
|
|
<li>Item 3 in B</li>
|
|
</ol>
|
|
<li>Item 4 in A</li>
|
|
</ol>
|
|
<p>The end.</p>
|
|
</div>
|
|
</body>
|
|
</html> |