Fix post-blank for headlines containing only whitespace.

This commit is contained in:
Tom Alexander
2023-12-15 17:59:47 -05:00
parent 9690545901
commit c28d8ccea4
2 changed files with 16 additions and 2 deletions

View File

@@ -36,6 +36,7 @@ pub struct Heading<'s> {
pub deadline: Option<Timestamp<'s>>,
pub closed: Option<Timestamp<'s>>,
pub contents: Option<&'s str>,
pub post_blank: Option<&'s str>,
}
#[derive(Debug)]
@@ -105,7 +106,13 @@ impl<'s> StandardProperties<'s> for Heading<'s> {
self.children
.last()
.map(|child| child.get_post_blank())
.unwrap_or(0)
.unwrap_or(
self.post_blank
.map(|text| text.lines().count())
.unwrap_or(0)
.try_into()
.expect("Too much post-blank to fit into a PostBlank."),
)
}
}