Compare commits
2 Commits
ccebe90ea8
...
dbafafcba5
Author | SHA1 | Date | |
---|---|---|---|
|
dbafafcba5 | ||
|
3be4475ddf |
@ -7,7 +7,6 @@ class DrawerNode:
|
||||
|
||||
|
||||
class PropertyDrawerNode(DrawerNode):
|
||||
|
||||
def __repr__(self):
|
||||
return "<Properties: {}>".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 "<List: {}>".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 "<Code: {}>".format(len(self.lines))
|
||||
|
||||
from .utils import get_raw_contents
|
||||
|
@ -395,9 +395,12 @@ class Headline:
|
||||
or isinstance(current_node, dom.BlockNode)
|
||||
or isinstance(current_node, dom.DrawerNode)
|
||||
):
|
||||
was_node = current_node
|
||||
current_node = dom.ListGroupNode()
|
||||
if current_node is None:
|
||||
if was_node is None:
|
||||
tree.append(current_node)
|
||||
else:
|
||||
was_node.append(current_node)
|
||||
indentation_tree.append(current_node)
|
||||
if not isinstance(current_node, dom.ListGroupNode):
|
||||
if not isinstance(current_node, dom.ListGroupNode):
|
||||
|
Loading…
Reference in New Issue
Block a user