forked from kenkeiras/org-rw
Avoid adding an empty line when headline has none.
This commit is contained in:
parent
f08d9428d6
commit
46a2c387eb
@ -515,6 +515,9 @@ def tokenize_contents(contents: str):
|
|||||||
|
|
||||||
|
|
||||||
def parse_contents(raw_contents: List[RawLine]):
|
def parse_contents(raw_contents: List[RawLine]):
|
||||||
|
if len(raw_contents) == 0:
|
||||||
|
return []
|
||||||
|
|
||||||
contents_buff = []
|
contents_buff = []
|
||||||
for line in raw_contents:
|
for line in raw_contents:
|
||||||
contents_buff.append(line.line)
|
contents_buff.append(line.line)
|
||||||
@ -695,6 +698,7 @@ class OrgDom:
|
|||||||
last_type = ltype
|
last_type = ltype
|
||||||
structured_lines.append(content)
|
structured_lines.append(content)
|
||||||
|
|
||||||
|
if len(structured_lines) > 0:
|
||||||
yield "".join(structured_lines)
|
yield "".join(structured_lines)
|
||||||
|
|
||||||
for child in headline.children:
|
for child in headline.children:
|
||||||
|
@ -14,9 +14,7 @@ First level content
|
|||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
:ID: 01-simple-second-level-id
|
:ID: 01-simple-second-level-id
|
||||||
:END:
|
:END:
|
||||||
|
Second level content with no indentation or space around
|
||||||
Second level content with no indentation
|
|
||||||
|
|
||||||
*** Third level with no content
|
*** Third level with no content
|
||||||
**** Forth level
|
**** Forth level
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
|
Loading…
Reference in New Issue
Block a user