Implement the new fields for paragraph.

This commit is contained in:
Tom Alexander
2023-10-31 23:06:43 -04:00
parent 92d15c3d91
commit 281c35677b
3 changed files with 22 additions and 11 deletions

View File

@@ -1,4 +1,5 @@
use nom::branch::alt;
use nom::combinator::consumed;
use nom::combinator::eof;
use nom::combinator::recognize;
use nom::combinator::verify;
@@ -45,14 +46,14 @@ where
let standard_set_object_matcher = parser_with_context!(standard_set_object)(&parser_context);
let exit_matcher = parser_with_context!(exit_matcher_parser)(&parser_context);
let (remaining, (children, _exit_contents)) = verify(
let (remaining, (contents, (children, _exit_contents))) = consumed(verify(
many_till(standard_set_object_matcher, exit_matcher),
|(children, _exit_contents)| !children.is_empty(),
)(remaining)?;
))(remaining)?;
// Not checking parent exit matcher because if there are any children matched then we have a valid paragraph.
let (remaining, _trailing_ws) =
let (remaining, post_blank) =
maybe_consume_trailing_whitespace_if_not_exiting(context, remaining)?;
let source = get_consumed(input, remaining);
@@ -60,6 +61,8 @@ where
remaining,
Paragraph {
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,