Skip to content

Commit

Permalink
Fix split_elements for table elements with no elem.table attribute (
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkLindblad authored Dec 6, 2024
1 parent 82b5498 commit 4b69ea9
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/sycamore/sycamore/transforms/split_elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,7 @@ def split_one(elem: Element, tokenizer: Tokenizer, max: int) -> list[Element]:
ment = elem.copy()
elem.text_representation = one
elem.binary_representation = bytes(one, "utf-8")
if elem.type == "table":
if not isinstance(elem, TableElement) or elem.table is None:
raise ValueError("Element must be tableElement/ have table to perform splitting.")
if elem.type == "table" and isinstance(elem, TableElement) and elem.table is not None:
if elem.table.column_headers:
two = ", ".join(elem.table.column_headers) + "\n" + two
if elem.data["properties"].get("title"):
Expand Down

0 comments on commit 4b69ea9

Please sign in to comment.