Not sure whats going on.

This commit is contained in:
Tom Alexander
2023-03-27 19:19:51 -04:00
parent 9545990b52
commit 775e703ade
2 changed files with 7 additions and 2 deletions

View File

@@ -14,6 +14,7 @@ use crate::parser::util::exit_matcher_parser;
use crate::parser::util::get_consumed;
use crate::parser::util::regurgitate;
use crate::parser::util::start_of_line;
use crate::parser::util::trailing_whitespace;
use nom::branch::alt;
use nom::bytes::complete::tag;
use nom::character::complete::digit1;
@@ -38,6 +39,7 @@ pub fn plain_list<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s s
}),
exit_matcher,
)(remaining)?;
let (remaining, _trailing_whitespace) = trailing_whitespace(remaining)?;
let source = get_consumed(input, remaining);
children.insert(0, first_item);
Ok((remaining, PlainList { source, children }))
@@ -61,8 +63,10 @@ pub fn plain_list_item<'r, 's>(
let element_matcher = parser_with_context!(element)(&parser_context);
let exit_matcher = parser_with_context!(exit_matcher_parser)(&parser_context);
let (remaining, (bull, _ws)) = tuple((bullet, space0))(remaining)?;
let (remaining, (contents, _exit_contents)) =
many_till(element_matcher, exit_matcher)(remaining)?;
let (remaining, (contents, _exit_contents)) = many_till(element_matcher, |i| {
let with_whitespace_added_back = regurgitate(input, i);
exit_matcher(with_whitespace_added_back)
})(remaining)?;
let remaining = regurgitate(input, remaining);
let source = get_consumed(input, remaining);