diff --git a/docling_core/types/experimental/document.py b/docling_core/types/experimental/document.py index 27fb516..520aab5 100644 --- a/docling_core/types/experimental/document.py +++ b/docling_core/types/experimental/document.py @@ -54,7 +54,7 @@ def from_dict_format(cls, data: Any) -> Any: class BaseTableData(BaseModel): # TBD - table_cells: List[TableCell] + table_cells: List[TableCell] = [] num_rows: int = 0 num_cols: int = 0 @@ -184,7 +184,7 @@ class Section(TextItem): class FloatingItem(DocItem): - caption: Optional[RefItem] = None + captions: List[RefItem] = [] references: List[RefItem] = [] footnotes: List[RefItem] = [] image: Optional[ImageRef] = None @@ -306,7 +306,7 @@ def add_table( if prov: tbl_item.prov.append(prov) if caption: - tbl_item.caption = caption.get_ref() + tbl_item.captions.append(caption.get_ref()) self.tables.append(tbl_item) parent.children.append(RefItem(cref=cref)) @@ -333,7 +333,7 @@ def add_figure( if prov: fig_item.prov.append(prov) if caption: - fig_item.caption = caption.get_ref() + fig_item.captions.append(caption.get_ref()) self.figures.append(fig_item) parent.children.append(RefItem(cref=cref)) diff --git a/test/data/experimental/dummy_doc.yaml b/test/data/experimental/dummy_doc.yaml index a3b29f8..d2a6470 100644 --- a/test/data/experimental/dummy_doc.yaml +++ b/test/data/experimental/dummy_doc.yaml @@ -132,8 +132,8 @@ figures: # All figures... label: "figure" parent: $ref: "#/body" - caption: - $ref: "/texts/3" + captions: + - $ref: "/texts/3" data: # BaseFigureData Type classification: "illustration" confidence: 0.78