Implement the new fields for table.
Some checks failed
clippy Build clippy has failed
rust-foreign-document-test Build rust-foreign-document-test has failed
rust-build Build rust-build has succeeded
rust-test Build rust-test has failed

This commit is contained in:
Tom Alexander
2023-12-15 17:11:22 -05:00
parent cce9ca87fa
commit 565978225a
3 changed files with 31 additions and 13 deletions

View File

@@ -130,12 +130,15 @@ pub struct Table<'s> {
pub affiliated_keywords: AffiliatedKeywords<'s>,
pub formulas: Vec<Keyword<'s>>,
pub children: Vec<TableRow<'s>>,
pub contents: &'s str,
pub post_blank: Option<&'s str>,
}
#[derive(Debug)]
pub struct TableRow<'s> {
pub source: &'s str,
pub children: Vec<TableCell<'s>>,
pub contents: Option<&'s str>,
}
#[derive(Debug)]
@@ -322,11 +325,15 @@ impl<'s> StandardProperties<'s> for Table<'s> {
}
fn get_contents<'b>(&'b self) -> Option<&'s str> {
todo!()
Some(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.")
}
}
@@ -336,11 +343,11 @@ impl<'s> StandardProperties<'s> for TableRow<'s> {
}
fn get_contents<'b>(&'b self) -> Option<&'s str> {
todo!()
self.contents
}
fn get_post_blank(&self) -> PostBlank {
todo!()
0
}
}

View File

@@ -42,6 +42,7 @@ pub struct Comment<'s> {
pub struct TableCell<'s> {
pub source: &'s str,
pub children: Vec<Object<'s>>,
pub contents: &'s str,
}
#[derive(Debug)]
@@ -257,11 +258,11 @@ impl<'s> StandardProperties<'s> for TableCell<'s> {
}
fn get_contents<'b>(&'b self) -> Option<&'s str> {
todo!()
Some(self.contents)
}
fn get_post_blank(&self) -> PostBlank {
todo!()
0
}
}