From 3da2ab066cc5cf2dc9fa94d2b900dfe1c03ba936 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Mart=C3=ADnez=20Portela?= Date: Mon, 28 Mar 2022 00:49:32 +0200 Subject: [PATCH] Add helper to get document from a Headline. --- org_rw/org_rw.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/org_rw/org_rw.py b/org_rw/org_rw.py index e2d3f5a..cf94c02 100644 --- a/org_rw/org_rw.py +++ b/org_rw/org_rw.py @@ -272,6 +272,14 @@ class Headline: # Remove from contents self._remove_element_in_line(start_line + 1) + @property + def doc(self): + par = self.parent + while isinstance(par, Headline): + par = par.parent + return par + + def as_dom(self): everything = ( self.keywords