Support non-recursive dump_headline.

This commit is contained in:
Sergio Martínez Portela 2022-06-19 21:46:39 +02:00
parent eb3c789fad
commit 434fb8ab0e

View File

@ -1673,7 +1673,7 @@ class OrgDoc:
yield from headline.get_code_snippets() yield from headline.get_code_snippets()
# Writing # Writing
def dump_headline(self, headline): def dump_headline(self, headline, recursive=True):
tags = "" tags = ""
if len(headline.shallow_tags) > 0: if len(headline.shallow_tags) > 0:
@ -1746,8 +1746,9 @@ class OrgDoc:
content = content[:-1] content = content[:-1]
yield content yield content
for child in headline.children: if recursive:
yield from self.dump_headline(child) for child in headline.children:
yield from self.dump_headline(child, recursive=recursive)
def dump(self): def dump(self):
lines = [] lines = []