Updated paragraph to handle the new consumption of trailing whitespace.
This commit is contained in:
parent
e417e86bd4
commit
df9265c2af
@ -1,5 +1,6 @@
|
||||
use nom::branch::alt;
|
||||
use nom::combinator::eof;
|
||||
use nom::combinator::opt;
|
||||
use nom::combinator::recognize;
|
||||
use nom::combinator::verify;
|
||||
use nom::multi::many1;
|
||||
@ -11,6 +12,7 @@ use crate::parser::parser_context::ChainBehavior;
|
||||
use crate::parser::parser_context::ContextElement;
|
||||
use crate::parser::parser_context::ExitMatcherNode;
|
||||
use crate::parser::parser_with_context::parser_with_context;
|
||||
use crate::parser::util::element_trailing_whitespace;
|
||||
use crate::parser::util::exit_matcher_parser;
|
||||
use crate::parser::util::start_of_line;
|
||||
|
||||
@ -35,6 +37,17 @@ pub fn paragraph<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s st
|
||||
|(children, _exit_contents)| !children.is_empty(),
|
||||
)(input)?;
|
||||
|
||||
// Check if a parent exit matcher is causing the exit
|
||||
exit_matcher_parser(context, remaining)?;
|
||||
|
||||
let (remaining, _trailing_ws) = if context.should_consume_trailing_whitespace() {
|
||||
opt(parser_with_context!(element_trailing_whitespace)(
|
||||
&parser_context,
|
||||
))(remaining)?
|
||||
} else {
|
||||
(remaining, None)
|
||||
};
|
||||
|
||||
let source = get_consumed(input, remaining);
|
||||
|
||||
Ok((remaining, Paragraph { source, children }))
|
||||
|
Loading…
Reference in New Issue
Block a user