diff --git a/org_rw/dom.py b/org_rw/dom.py index dd9c7d7..bc24272 100644 --- a/org_rw/dom.py +++ b/org_rw/dom.py @@ -1,32 +1,23 @@ -class PropertyDrawerNode: +class DrawerNode: def __init__(self): self.children = [] def append(self, child): self.children.append(child) + +class PropertyDrawerNode(DrawerNode): + def __repr__(self): return "".format(len(self.children)) -class LogbookDrawerNode: - def __init__(self): - self.children = [] - - def append(self, child): - self.children.append(child) - +class LogbookDrawerNode(DrawerNode): def __repr__(self): return "".format(len(self.children)) -class ResultsDrawerNode: - def __init__(self): - self.children = [] - - def append(self, child): - self.children.append(child) - +class ResultsDrawerNode(DrawerNode): def __repr__(self): return "".format(len(self.children)) @@ -82,12 +73,16 @@ class ListItem: class BlockNode: + def __init__(self): + self.children = [] + def append(self, child): - raise NotImplementedError() + self.children.append(child) class CodeBlock(BlockNode): def __init__(self, header, subtype): + super().__init__() self.header = header self.lines = None self.subtype = subtype diff --git a/org_rw/org_rw.py b/org_rw/org_rw.py index 01cae02..c6713b9 100644 --- a/org_rw/org_rw.py +++ b/org_rw/org_rw.py @@ -378,7 +378,7 @@ class Headline: elif isinstance(line, Text): if isinstance(current_node, dom.BlockNode): current_node.append(dom.Text(line)) - elif isinstance(current_node, dom.LogbookDrawerNode): + elif isinstance(current_node, dom.DrawerNode): current_node.append(dom.Text(line)) else: if isinstance(current_node, dom.TableNode):