Implement the new fields for horizontal rule.

This commit is contained in:
Tom Alexander 2023-12-15 12:50:01 -05:00
parent 60d1ecfa75
commit 2181993246
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
2 changed files with 9 additions and 3 deletions

View File

@ -38,7 +38,7 @@ where
space0, space0,
alt((line_ending, eof)), alt((line_ending, eof)),
)))(remaining)?; )))(remaining)?;
let (remaining, _trailing_ws) = let (remaining, post_blank) =
maybe_consume_trailing_whitespace_if_not_exiting(context, remaining)?; maybe_consume_trailing_whitespace_if_not_exiting(context, remaining)?;
let source = get_consumed(input, remaining); let source = get_consumed(input, remaining);
Ok(( Ok((
@ -49,6 +49,7 @@ where
context.get_global_settings(), context.get_global_settings(),
affiliated_keywords, affiliated_keywords,
), ),
post_blank: post_blank.map(Into::<&str>::into),
}, },
)) ))
} }

View File

@ -155,6 +155,7 @@ pub struct FixedWidthArea<'s> {
pub struct HorizontalRule<'s> { pub struct HorizontalRule<'s> {
pub source: &'s str, pub source: &'s str,
pub affiliated_keywords: AffiliatedKeywords<'s>, pub affiliated_keywords: AffiliatedKeywords<'s>,
pub post_blank: Option<&'s str>,
} }
#[derive(Debug)] #[derive(Debug)]
@ -422,11 +423,15 @@ impl<'s> StandardProperties<'s> for HorizontalRule<'s> {
} }
fn get_contents<'b>(&'b self) -> Option<&'s str> { fn get_contents<'b>(&'b self) -> Option<&'s str> {
todo!() None
} }
fn get_post_blank(&self) -> PostBlank { 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.")
} }
} }