Avoid adding an empty line when headline has none.

This commit is contained in:
Sergio Martínez Portela 2020-11-26 23:39:35 +01:00
parent f08d9428d6
commit 46a2c387eb
2 changed files with 9 additions and 7 deletions

View File

@ -515,6 +515,9 @@ def tokenize_contents(contents: str):
def parse_contents(raw_contents: List[RawLine]):
if len(raw_contents) == 0:
return []
contents_buff = []
for line in raw_contents:
contents_buff.append(line.line)
@ -695,7 +698,8 @@ class OrgDom:
last_type = ltype
structured_lines.append(content)
yield "".join(structured_lines)
if len(structured_lines) > 0:
yield "".join(structured_lines)
for child in headline.children:
yield from self.dump_headline(child)

View File

@ -11,12 +11,10 @@
First level content
** Second level
:PROPERTIES:
:ID: 01-simple-second-level-id
:END:
Second level content with no indentation
:PROPERTIES:
:ID: 01-simple-second-level-id
:END:
Second level content with no indentation or space around
*** Third level with no content
**** Forth level
:PROPERTIES: