Implement a function to get the additional properties on a headline.

This commit is contained in:
Tom Alexander 2023-10-10 15:54:44 -04:00
parent fb412bc2cd
commit b385270d7b
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
2 changed files with 24 additions and 0 deletions

View File

@ -542,6 +542,10 @@ fn new_compare_heading<'b, 's>(
let mut child_status = Vec::new();
let mut message = None;
let additional_property_names = rust
.get_additional_properties()
.map(|node_property| EmacsField::Required(node_property.property_name));
// TODO: This needs to support additional properties from the property drawer
compare_children(

View File

@ -2,6 +2,7 @@ use std::path::PathBuf;
use super::Element;
use super::GetStandardProperties;
use super::NodeProperty;
use super::Object;
use super::StandardProperties;
use super::Timestamp;
@ -90,4 +91,23 @@ impl<'s> Heading<'s> {
.collect();
title_source
}
pub fn get_additional_properties(&self) -> impl Iterator<Item = &NodeProperty<'s>> {
let foo = self
.children
.iter()
.take(1)
.filter_map(|c| match c {
DocumentElement::Section(section) => Some(section),
_ => None,
})
.flat_map(|section| section.children.iter())
.take(1)
.filter_map(|element| match element {
Element::PropertyDrawer(property_drawer) => Some(property_drawer),
_ => None,
})
.flat_map(|property_drawer| property_drawer.children.iter());
foo
}
}