Skip to content

Commit

Permalink
fix: Hotfix for TableItem.export_to_html args (#76)
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Auer <[email protected]>
  • Loading branch information
cau-git authored Nov 27, 2024
1 parent f93332b commit ae2f131
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions docling_core/types/doc/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import sys
import textwrap
import typing
import warnings
from io import BytesIO
from pathlib import Path
from typing import Any, Dict, Final, List, Literal, Optional, Tuple, Union
Expand Down Expand Up @@ -1008,14 +1009,23 @@ def export_to_markdown(self) -> str:
)
return md_table

def export_to_html(self, doc: "DoclingDocument", add_caption: bool = True) -> str:
def export_to_html(
self, doc: Optional["DoclingDocument"] = None, add_caption: bool = True
) -> str:
"""Export the table as html."""
if doc is None:
warnings.warn(
"The `doc` argument will be mandatory in a future version. "
"It must be provided to include a caption.",
DeprecationWarning,
)

body = ""
nrows = self.data.num_rows
ncols = self.data.num_cols

text = ""
if add_caption and len(self.captions):
if doc is not None and add_caption and len(self.captions):
text = self.caption_text(doc)

if len(self.data.table_cells) == 0:
Expand Down

0 comments on commit ae2f131

Please sign in to comment.