diff --git a/src/parser/footnote_definition.rs b/src/parser/footnote_definition.rs index e3780060..2cf2d1eb 100644 --- a/src/parser/footnote_definition.rs +++ b/src/parser/footnote_definition.rs @@ -75,6 +75,7 @@ where let parser_context = parser_context.with_additional_node(&contexts[2]); let element_matcher = parser_with_context!(element(true))(&parser_context); let exit_matcher = parser_with_context!(exit_matcher_parser)(&parser_context); + let before_contents = remaining; let (mut remaining, (mut children, _exit_contents)) = many_till(include_input(element_matcher), exit_matcher)(remaining)?; @@ -90,13 +91,16 @@ where } } - let (remaining, _trailing_ws) = + let contents = get_consumed(before_contents, remaining); + let (remaining, post_blank) = maybe_consume_trailing_whitespace_if_not_exiting(context, remaining)?; let source = get_consumed(input, remaining); Ok(( remaining, FootnoteDefinition { source: source.into(), + contents: Some(contents.into()), + post_blank: post_blank.map(Into::<&str>::into), affiliated_keywords: parse_affiliated_keywords( context.get_global_settings(), affiliated_keywords, diff --git a/src/types/greater_element.rs b/src/types/greater_element.rs index 29572b7f..d16806eb 100644 --- a/src/types/greater_element.rs +++ b/src/types/greater_element.rs @@ -82,6 +82,8 @@ pub struct DynamicBlock<'s> { #[derive(Debug)] pub struct FootnoteDefinition<'s> { pub source: &'s str, + pub contents: Option<&'s str>, + pub post_blank: Option<&'s str>, pub affiliated_keywords: AffiliatedKeywords<'s>, pub label: &'s str, pub children: Vec>, @@ -218,11 +220,15 @@ impl<'s> StandardProperties<'s> for FootnoteDefinition<'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.") } }