It actually worked on trailing whitespace ownership test case 2.

This commit is contained in:
Tom Alexander 2023-10-17 15:22:31 -04:00
parent 47408763e5
commit 364ba79517
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
1 changed files with 8 additions and 7 deletions

View File

@ -229,20 +229,20 @@ fn plain_list_item<'b, 'g, 'r, 's>(
let exit_matcher = plain_list_item_end(indent_level);
let final_item_whitespace_cutoff = final_item_whitespace_cutoff(indent_level);
let final_whitespace_context = ContextElement::ExitMatcherNode(ExitMatcherNode {
class: ExitClass::Beta,
exit_matcher: &final_item_whitespace_cutoff,
});
let final_whitespace_context = context.with_additional_node(&final_whitespace_context);
let contexts = [
ContextElement::ConsumeTrailingWhitespace(true),
ContextElement::ExitMatcherNode(ExitMatcherNode {
class: ExitClass::Beta,
exit_matcher: &exit_matcher,
}),
ContextElement::ExitMatcherNode(ExitMatcherNode {
class: ExitClass::Beta,
exit_matcher: &final_item_whitespace_cutoff,
}),
];
let parser_context = context.with_additional_node(&contexts[0]);
let parser_context = final_whitespace_context.with_additional_node(&contexts[0]);
let parser_context = parser_context.with_additional_node(&contexts[1]);
let parser_context = parser_context.with_additional_node(&contexts[2]);
let maybe_contentless_item: Res<OrgSource<'_>, ()> =
detect_contentless_item_contents(&parser_context, remaining);
@ -283,8 +283,9 @@ fn plain_list_item<'b, 'g, 'r, 's>(
bind_context!(exit_matcher_parser, &parser_context),
)(remaining)?;
// We have to use the parser_context here to include the whitespace cut-off
let (remaining, _trailing_ws) =
maybe_consume_trailing_whitespace_if_not_exiting(context, remaining)?;
maybe_consume_trailing_whitespace_if_not_exiting(&final_whitespace_context, remaining)?;
let source = get_consumed(input, remaining);
return Ok((