Skip to content

Commit ae2f131

Browse files
authored
fix: Hotfix for TableItem.export_to_html args (#76)
Signed-off-by: Christoph Auer <[email protected]>
1 parent f93332b commit ae2f131

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

docling_core/types/doc/document.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import sys
1111
import textwrap
1212
import typing
13+
import warnings
1314
from io import BytesIO
1415
from pathlib import Path
1516
from typing import Any, Dict, Final, List, Literal, Optional, Tuple, Union
@@ -1008,14 +1009,23 @@ def export_to_markdown(self) -> str:
10081009
)
10091010
return md_table
10101011

1011-
def export_to_html(self, doc: "DoclingDocument", add_caption: bool = True) -> str:
1012+
def export_to_html(
1013+
self, doc: Optional["DoclingDocument"] = None, add_caption: bool = True
1014+
) -> str:
10121015
"""Export the table as html."""
1016+
if doc is None:
1017+
warnings.warn(
1018+
"The `doc` argument will be mandatory in a future version. "
1019+
"It must be provided to include a caption.",
1020+
DeprecationWarning,
1021+
)
1022+
10131023
body = ""
10141024
nrows = self.data.num_rows
10151025
ncols = self.data.num_cols
10161026

10171027
text = ""
1018-
if add_caption and len(self.captions):
1028+
if doc is not None and add_caption and len(self.captions):
10191029
text = self.caption_text(doc)
10201030

10211031
if len(self.data.table_cells) == 0:

0 commit comments

Comments
 (0)