Implement the new fields for lesser block.
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-11 15:59:56 -05:00
parent 175ff1e6c4
commit 2e7db0f8bd
2 changed files with 66 additions and 28 deletions

View File

@@ -50,6 +50,8 @@ pub struct VerseBlock<'s> {
pub affiliated_keywords: AffiliatedKeywords<'s>,
pub data: Option<&'s str>,
pub children: Vec<Object<'s>>,
pub contents: &'s str,
pub post_blank: Option<&'s str>,
}
#[derive(Debug)]
@@ -57,6 +59,7 @@ pub struct CommentBlock<'s> {
pub source: &'s str,
pub affiliated_keywords: AffiliatedKeywords<'s>,
pub contents: &'s str,
pub post_blank: Option<&'s str>,
}
pub type CharOffsetInLine = u16;
@@ -80,6 +83,7 @@ pub struct ExampleBlock<'s> {
pub use_labels: bool,
pub label_format: Option<&'s str>,
pub value: &'s str,
pub post_blank: Option<&'s str>,
}
#[derive(Debug)]
@@ -89,6 +93,7 @@ pub struct ExportBlock<'s> {
pub export_type: Option<&'s str>,
pub data: Option<&'s str>,
pub value: &'s str,
pub post_blank: Option<&'s str>,
}
#[derive(Debug)]
@@ -104,6 +109,7 @@ pub struct SrcBlock<'s> {
pub use_labels: bool,
pub label_format: Option<&'s str>,
pub value: &'s str,
pub post_blank: Option<&'s str>,
}
#[derive(Debug)]
@@ -258,11 +264,15 @@ impl<'s> StandardProperties<'s> for VerseBlock<'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.")
}
}
impl<'s> StandardProperties<'s> for CommentBlock<'s> {
@@ -271,11 +281,15 @@ impl<'s> StandardProperties<'s> for CommentBlock<'s> {
}
fn get_contents<'b>(&'b self) -> Option<&'s str> {
todo!()
None
}
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.")
}
}
impl<'s> StandardProperties<'s> for ExampleBlock<'s> {
@@ -284,11 +298,15 @@ impl<'s> StandardProperties<'s> for ExampleBlock<'s> {
}
fn get_contents<'b>(&'b self) -> Option<&'s str> {
todo!()
None
}
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.")
}
}
impl<'s> StandardProperties<'s> for ExportBlock<'s> {
@@ -297,11 +315,15 @@ impl<'s> StandardProperties<'s> for ExportBlock<'s> {
}
fn get_contents<'b>(&'b self) -> Option<&'s str> {
todo!()
None
}
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.")
}
}
impl<'s> StandardProperties<'s> for SrcBlock<'s> {
@@ -310,11 +332,15 @@ impl<'s> StandardProperties<'s> for SrcBlock<'s> {
}
fn get_contents<'b>(&'b self) -> Option<&'s str> {
todo!()
None
}
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.")
}
}