Implement the new fields for verbatim and code.

This commit is contained in:
Tom Alexander
2023-12-08 16:04:18 -05:00
parent 8fd9ff3848
commit 9bcba4020d
2 changed files with 22 additions and 10 deletions

View File

@@ -76,12 +76,14 @@ pub struct StrikeThrough<'s> {
pub struct Code<'s> {
pub source: &'s str,
pub contents: &'s str,
pub post_blank: Option<&'s str>,
}
#[derive(Debug)]
pub struct Verbatim<'s> {
pub source: &'s str,
pub contents: &'s str,
pub post_blank: Option<&'s str>,
}
#[derive(Debug)]
@@ -603,11 +605,15 @@ impl<'s> StandardProperties<'s> for Code<'s> {
}
fn get_contents<'b>(&'b self) -> Option<&'s str> {
todo!()
None
}
fn get_post_blank(&self) -> PostBlank {
todo!()
self.post_blank
.map(|post_blank| post_blank.chars().count())
.unwrap_or(0)
.try_into()
.expect("Too much post-blank to fit into a PostBlank.")
}
}
@@ -617,11 +623,15 @@ impl<'s> StandardProperties<'s> for Verbatim<'s> {
}
fn get_contents<'b>(&'b self) -> Option<&'s str> {
todo!()
None
}
fn get_post_blank(&self) -> PostBlank {
todo!()
self.post_blank
.map(|post_blank| post_blank.chars().count())
.unwrap_or(0)
.try_into()
.expect("Too much post-blank to fit into a PostBlank.")
}
}