diff --git a/orgize/src/elements/title.rs b/orgize/src/elements/title.rs index 0376b13..444e1e0 100644 --- a/orgize/src/elements/title.rs +++ b/orgize/src/elements/title.rs @@ -16,7 +16,7 @@ use nom::{ }; use crate::config::ParseConfig; -use crate::elements::{Drawer, Planning}; +use crate::elements::{Drawer, Planning, Timestamp}; use crate::parsers::{line, skip_empty_lines, take_one_word}; #[cfg_attr(test, derive(PartialEq))] @@ -106,6 +106,24 @@ impl Title<'_> { )) } + pub fn closed(&self) -> Option<&Timestamp> { + self.planning + .as_ref() + .and_then(|planning| planning.closed.as_ref()) + } + + pub fn scheduled(&self) -> Option<&Timestamp> { + self.planning + .as_ref() + .and_then(|planning| planning.scheduled.as_ref()) + } + + pub fn deadline(&self) -> Option<&Timestamp> { + self.planning + .as_ref() + .and_then(|planning| planning.deadline.as_ref()) + } + pub fn into_owned(self) -> Title<'static> { Title { level: self.level, diff --git a/orgize/src/export/html.rs b/orgize/src/export/html.rs index 8e31721..17a493d 100644 --- a/orgize/src/export/html.rs +++ b/orgize/src/export/html.rs @@ -1,6 +1,5 @@ use std::fmt; use std::io::{Error, Write}; -use std::marker::PhantomData; use jetscii::{bytes, BytesConst};