From 3be4475ddf1e49ed51f76b2325c4a35eff60f90f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Mart=C3=ADnez=20Portela?= Date: Thu, 3 Nov 2022 23:01:21 +0100 Subject: [PATCH] Support get_raw_contents of list groups. --- org_rw/dom.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/org_rw/dom.py b/org_rw/dom.py index bc24272..6b3e455 100644 --- a/org_rw/dom.py +++ b/org_rw/dom.py @@ -7,7 +7,6 @@ class DrawerNode: class PropertyDrawerNode(DrawerNode): - def __repr__(self): return "".format(len(self.children)) @@ -38,6 +37,9 @@ class ListGroupNode: def append(self, child): self.children.append(child) + def get_raw(self): + return '\n'.join([c.get_raw() for c in self.children]) + def __repr__(self): return "".format(len(self.children)) @@ -64,6 +66,9 @@ class Text: def __init__(self, content): self.content = content + def get_raw(self): + return ''.join(self.content.get_raw()) + class ListItem: def __init__(self, tag, content, orig=None): @@ -71,6 +76,9 @@ class ListItem: self.content = content self.orig = orig + def get_raw(self): + return get_raw_contents(self.orig) + class BlockNode: def __init__(self): @@ -92,3 +100,5 @@ class CodeBlock(BlockNode): def __repr__(self): return "".format(len(self.lines)) + +from .utils import get_raw_contents