Add support for planning before property drawer when calculating additional properties for headlines.

This commit is contained in:
Tom Alexander 2023-10-16 13:35:03 -04:00
parent d2d0e9e5dd
commit 3eff85059a
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
2 changed files with 13 additions and 2 deletions

View File

@ -0,0 +1,7 @@
** Foo
DEADLINE: <2023-10-16 Mon>
:PROPERTIES:
:foo: *a*
:Bar: *b*
:BAZ: *c*
:END:

View File

@ -101,11 +101,15 @@ impl<'s> Heading<'s> {
_ => None, _ => None,
}) })
.flat_map(|section| section.children.iter()) .flat_map(|section| section.children.iter())
.take(1) .take_while(|element| match element {
.filter_map(|element| match element { Element::Planning(_) | Element::PropertyDrawer(_) => true,
_ => false,
})
.find_map(|element| match element {
Element::PropertyDrawer(property_drawer) => Some(property_drawer), Element::PropertyDrawer(property_drawer) => Some(property_drawer),
_ => None, _ => None,
}) })
.into_iter()
.flat_map(|property_drawer| property_drawer.children.iter()) .flat_map(|property_drawer| property_drawer.children.iter())
} }
} }