docling 2.28.1__py3-none-any.whl → 2.28.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -206,9 +206,9 @@ class HTMLDocumentBackend(DeclarativeDocumentBackend):
206
206
  hlevel = int(element.name.replace("h", ""))
207
207
  text = element.text.strip()
208
208
 
209
- if hlevel == 1:
210
- self.content_layer = ContentLayer.BODY
209
+ self.content_layer = ContentLayer.BODY
211
210
 
211
+ if hlevel == 1:
212
212
  for key in self.parents.keys():
213
213
  self.parents[key] = None
214
214
 
@@ -243,7 +243,7 @@ class HTMLDocumentBackend(DeclarativeDocumentBackend):
243
243
  self.parents[hlevel] = doc.add_heading(
244
244
  parent=self.parents[hlevel - 1],
245
245
  text=text,
246
- level=hlevel,
246
+ level=hlevel - 1,
247
247
  content_layer=self.content_layer,
248
248
  )
249
249
 
@@ -212,9 +212,16 @@ class MarkdownDocumentBackend(DeclarativeDocumentBackend):
212
212
  traverse(element)
213
213
  snippet_text = "".join(strings)
214
214
  if len(snippet_text) > 0:
215
- parent_item = doc.add_text(
216
- label=doc_label, parent=parent_item, text=snippet_text
217
- )
215
+ if doc_label == DocItemLabel.SECTION_HEADER:
216
+ parent_item = doc.add_heading(
217
+ text=snippet_text,
218
+ level=element.level - 1,
219
+ parent=parent_item,
220
+ )
221
+ else:
222
+ parent_item = doc.add_text(
223
+ label=doc_label, parent=parent_item, text=snippet_text
224
+ )
218
225
 
219
226
  elif isinstance(element, marko.block.List):
220
227
  has_non_empty_list_items = False
@@ -232,12 +239,15 @@ class MarkdownDocumentBackend(DeclarativeDocumentBackend):
232
239
  label=label, name=f"list", parent=parent_item
233
240
  )
234
241
 
235
- elif isinstance(element, marko.block.ListItem) and len(element.children) > 0:
242
+ elif (
243
+ isinstance(element, marko.block.ListItem)
244
+ and len(element.children) > 0
245
+ and isinstance((first_child := element.children[0]), marko.block.Paragraph)
246
+ ):
236
247
  self._close_table(doc)
237
248
  self._process_inline_text(parent_item, doc)
238
249
  _log.debug(" - List item")
239
250
 
240
- first_child = element.children[0]
241
251
  snippet_text = str(first_child.children[0].children) # type: ignore
242
252
  is_numbered = False
243
253
  if (
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: docling
3
- Version: 2.28.1
3
+ Version: 2.28.2
4
4
  Summary: SDK and CLI for parsing PDF, DOCX, HTML, and more, to a unified document representation for powering downstream workflows such as gen AI applications.
5
5
  Home-page: https://github.com/docling-project/docling
6
6
  License: MIT
@@ -10,10 +10,10 @@ docling/backend/docx/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
10
10
  docling/backend/docx/latex/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  docling/backend/docx/latex/latex_dict.py,sha256=a0UC3VLmG1BLN-hGmEaQamzKbDB10fCz0U8qRU--aBw,6613
12
12
  docling/backend/docx/latex/omml.py,sha256=U-mQXNCI9ObUyHDxv6ItvaHlObIEu77PiXS1Vaaah6U,12012
13
- docling/backend/html_backend.py,sha256=i9a5ucsIuf-sn6M8tmKt9Kg_qWqc5OJxhARb6ZNS3wI,19448
13
+ docling/backend/html_backend.py,sha256=FRtzsXjlvHISLa2jZ8_zpGqBN6uAaXpuPpLcLLNY_k4,19448
14
14
  docling/backend/json/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  docling/backend/json/docling_json_backend.py,sha256=LlFMVoZrrCfVwbDuRbNN4Xg96Lujh4xxrTBt9jGhY9I,1984
16
- docling/backend/md_backend.py,sha256=v230PXShYJo2QaabwUHiBpE-EGScHIerjL78zPaJpZM,16837
16
+ docling/backend/md_backend.py,sha256=lqDiKIBHGsA0u-H1n9oVpPlrcpVT4gYRuNXXcyGlftM,17219
17
17
  docling/backend/msexcel_backend.py,sha256=_ZVZFKRRijpg-Xz10xNxu2m-NpDaYvoiBqEZP6GbrgE,11095
18
18
  docling/backend/mspowerpoint_backend.py,sha256=zXdXr8nGJJbPGTgR5_dqq5WmNL1wDCaK0RqFqtuHPqs,17213
19
19
  docling/backend/msword_backend.py,sha256=Eyv-owZrudGFpD6QCgr3wBBAbhUaH6QSb2ifaLsoAzY,24752
@@ -77,8 +77,8 @@ docling/utils/ocr_utils.py,sha256=F7iOOjqolUcImUzir4qjDQd4QWSO3s6JC4WRn3U7uY4,26
77
77
  docling/utils/profiling.py,sha256=YaMGoB9MMZpagF9mb5ndoHj8Lpb9aIdb7El-Pl7IcFs,1753
78
78
  docling/utils/utils.py,sha256=0ozCk7zUkYzxRVmYoIB2zA1lqjQOuaQzxfGuf1wmKW4,1866
79
79
  docling/utils/visualization.py,sha256=tY2ylE2aiQKkmzlSLnFW-HTfFyqUUMguW18ldd1PLfo,2868
80
- docling-2.28.1.dist-info/LICENSE,sha256=mBb7ErEcM8VS9OhiGHnQ2kk75HwPhr54W1Oiz3965MY,1088
81
- docling-2.28.1.dist-info/METADATA,sha256=z0woiP61dusO0NHyfXzAijbMvAofavUvt0JvBWQfAUI,9982
82
- docling-2.28.1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
83
- docling-2.28.1.dist-info/entry_points.txt,sha256=pIxel-UeVo1S7FhoNG5xgEfPjLZfBLi_N9TsGPtJSLo,144
84
- docling-2.28.1.dist-info/RECORD,,
80
+ docling-2.28.2.dist-info/LICENSE,sha256=mBb7ErEcM8VS9OhiGHnQ2kk75HwPhr54W1Oiz3965MY,1088
81
+ docling-2.28.2.dist-info/METADATA,sha256=ZeYjkP0ZzlpqoseGod2_iuJPW9d4B16JCeSo2b61KIw,9982
82
+ docling-2.28.2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
83
+ docling-2.28.2.dist-info/entry_points.txt,sha256=pIxel-UeVo1S7FhoNG5xgEfPjLZfBLi_N9TsGPtJSLo,144
84
+ docling-2.28.2.dist-info/RECORD,,