Add dom.TableRow.get_raw() support.
Some checks failed
Testing / pytest (push) Successful in 36s
Testing / mypy (push) Failing after 1m17s
Testing / style-formatting (push) Failing after 41s
Testing / style-sorted-imports (push) Failing after 25s
Testing / stability-extra-test (push) Successful in 31s

This commit is contained in:
Sergio Martínez Portela 2025-02-09 16:25:39 +01:00
parent df178d08d8
commit e07964af55
2 changed files with 10 additions and 0 deletions

View File

@ -70,12 +70,19 @@ class TableSeparatorRow:
def __init__(self, orig=None): def __init__(self, orig=None):
self.orig = orig self.orig = orig
def get_raw(self):
return get_raw_contents(self.orig)
class TableRow: class TableRow:
def __init__(self, cells, orig=None): def __init__(self, cells, orig=None):
self.cells = cells self.cells = cells
self.orig = orig self.orig = orig
def get_raw(self):
return get_raw_contents(self.orig)
class Text: class Text:
def __init__(self, content): def __init__(self, content):

View File

@ -7,6 +7,7 @@ from .org_rw import (
Italic, Italic,
Line, Line,
ListItem, ListItem,
TableRow,
RawLine, RawLine,
Strike, Strike,
Text, Text,
@ -50,6 +51,8 @@ def get_raw_contents(doc) -> str:
return doc.get_raw() return doc.get_raw()
if isinstance(doc, ListItem): if isinstance(doc, ListItem):
return dump_contents(doc)[1] return dump_contents(doc)[1]
if isinstance(doc, TableRow):
return dump_contents(doc)[1]
print("Unhandled type: " + str(doc)) print("Unhandled type: " + str(doc))
raise NotImplementedError("Unhandled type: " + str(doc)) raise NotImplementedError("Unhandled type: " + str(doc))