From 8b4e12ea2eb8ff754792492454be7a48fb2c1ad7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Mart=C3=ADnez=20Portela?= Date: Sun, 9 Feb 2025 16:25:39 +0100 Subject: [PATCH] Add `dom.TableRow.get_raw()` support. --- org_rw/dom.py | 7 +++++++ org_rw/utils.py | 3 +++ 2 files changed, 10 insertions(+) diff --git a/org_rw/dom.py b/org_rw/dom.py index 0b779b5..61e0882 100644 --- a/org_rw/dom.py +++ b/org_rw/dom.py @@ -70,12 +70,19 @@ class TableSeparatorRow: def __init__(self, orig=None): self.orig = orig + def get_raw(self): + return get_raw_contents(self.orig) + class TableRow: def __init__(self, cells, orig=None): self.cells = cells self.orig = orig + def get_raw(self): + return get_raw_contents(self.orig) + + class Text: def __init__(self, content): diff --git a/org_rw/utils.py b/org_rw/utils.py index 5b8b4e5..146a942 100644 --- a/org_rw/utils.py +++ b/org_rw/utils.py @@ -7,6 +7,7 @@ from .org_rw import ( Italic, Line, ListItem, + TableRow, RawLine, Strike, Text, @@ -50,6 +51,8 @@ def get_raw_contents(doc) -> str: return doc.get_raw() if isinstance(doc, ListItem): return dump_contents(doc)[1] + if isinstance(doc, TableRow): + return dump_contents(doc)[1] print("Unhandled type: " + str(doc)) raise NotImplementedError("Unhandled type: " + str(doc))