Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions docling/backend/html_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,9 +511,17 @@ def _get_cell_spans(cell: Tag) -> tuple[int, int]:
str(cell.get("colspan", "1")),
str(cell.get("rowspan", "1")),
)

def _extract_num(s: str) -> int:
if s and s[0].isnumeric():
match = re.search(r"\d+", s)
if match:
return int(match.group())
return 1

int_spans: tuple[int, int] = (
int(raw_spans[0]) if raw_spans[0].isnumeric() else 1,
int(raw_spans[1]) if raw_spans[0].isnumeric() else 1,
_extract_num(raw_spans[0]),
_extract_num(raw_spans[1]),
)

return int_spans
Expand Down
Loading