Implement the new fields for section.

This commit is contained in:
Tom Alexander
2023-10-31 23:16:57 -04:00
parent 70002800c2
commit 03754be71e
2 changed files with 19 additions and 8 deletions

View File

@@ -39,6 +39,8 @@ pub struct Heading<'s> {
#[derive(Debug)]
pub struct Section<'s> {
pub source: &'s str,
pub contents: Option<&'s str>,
pub post_blank: Option<&'s str>,
pub children: Vec<Element<'s>>,
}
@@ -74,11 +76,15 @@ impl<'s> StandardProperties<'s> for Section<'s> {
}
fn get_contents<'b>(&'b self) -> Option<&'s str> {
todo!()
self.contents
}
fn get_post_blank(&self) -> PostBlank {
todo!()
self.post_blank
.map(|text| text.lines().count())
.unwrap_or(0)
.try_into()
.expect("Too much post-blank to fit into a PostBlank.")
}
}