From 434fb8ab0e23869f5a25194e2667a1ee4757afbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Mart=C3=ADnez=20Portela?= Date: Sun, 19 Jun 2022 21:46:39 +0200 Subject: [PATCH] Support non-recursive `dump_headline`. --- org_rw/org_rw.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/org_rw/org_rw.py b/org_rw/org_rw.py index e616f05..8ee4ddb 100644 --- a/org_rw/org_rw.py +++ b/org_rw/org_rw.py @@ -1673,7 +1673,7 @@ class OrgDoc: yield from headline.get_code_snippets() # Writing - def dump_headline(self, headline): + def dump_headline(self, headline, recursive=True): tags = "" if len(headline.shallow_tags) > 0: @@ -1746,8 +1746,9 @@ class OrgDoc: content = content[:-1] yield content - for child in headline.children: - yield from self.dump_headline(child) + if recursive: + for child in headline.children: + yield from self.dump_headline(child, recursive=recursive) def dump(self): lines = []