Do not consume trailing whitespace if the parent exit matcher is matching.

This commit is contained in:
Tom Alexander
2023-04-10 13:13:11 -04:00
parent 895ee9f3b6
commit 1ecdd61fed
6 changed files with 29 additions and 9 deletions

View File

@@ -12,7 +12,7 @@ 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::exit_matcher_parser;
use crate::parser::util::maybe_consume_trailing_whitespace;
use crate::parser::util::maybe_consume_trailing_whitespace_if_not_exiting;
use crate::parser::util::start_of_line;
use super::element::non_paragraph_element;
@@ -38,7 +38,8 @@ pub fn paragraph<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s st
// Not checking parent exit matcher because if there are any children matched then we have a valid paragraph.
let (remaining, _trailing_ws) = maybe_consume_trailing_whitespace(context, remaining)?;
let (remaining, _trailing_ws) =
maybe_consume_trailing_whitespace_if_not_exiting(context, remaining)?;
let source = get_consumed(input, remaining);