Fix problem with detecting end of plain list item.

The problem is line indented lte does not match because we aren't consuming the whitespace that the plain list would consume.
This commit is contained in:
Tom Alexander 2023-04-14 23:56:55 -04:00
parent be64eb92af
commit 412bdcda28
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -28,6 +28,8 @@ use nom::combinator::recognize;
use nom::combinator::verify;
use nom::multi::many1;
use nom::multi::many_till;
use nom::sequence::preceded;
use nom::sequence::terminated;
use nom::sequence::tuple;
use tracing::span;
@ -180,10 +182,15 @@ pub fn plain_list_item<'r, 's>(
}
Err(_) => {
let (remaining, _ws) = space1(remaining)?;
let (remaining, (mut contents, (final_element, _exit_contents))) =
many_till(
let (remaining, (mut contents, final_element)) = many_till(
with_consume_matcher,
tuple((without_consume_matcher, exit_matcher)),
alt((
terminated(without_consume_matcher, exit_matcher),
preceded(
peek(tuple((with_consume_matcher, exit_matcher))),
without_consume_matcher,
),
)),
)(remaining)?;
contents.push(final_element);
let source = get_consumed(input, remaining);