End list items when the following line is indented less than or equal to the current item.
This commit is contained in:
@@ -44,7 +44,6 @@ pub fn item<'r, 's>(context: Context<'r, 's>, i: &'s str) -> Res<&'s str, ListIt
|
||||
opt(tuple((space, check_box))),
|
||||
opt(tuple((space, item_tag))),
|
||||
space,
|
||||
// TODO: This context should probably be something involving the item
|
||||
context_many_till(&list_item_context, text_element, item_end),
|
||||
))(remaining)?;
|
||||
|
||||
@@ -113,8 +112,11 @@ fn tag_separator<'s>(i: &'s str) -> Res<&'s str, &'s str> {
|
||||
|
||||
pub fn item_end<'r, 's>(context: Context<'r, 's>, i: &'s str) -> Res<&'s str, &'s str> {
|
||||
let item_matcher = parser_with_context!(item)(&context);
|
||||
let line_indented_matcher = parser_with_context!(line_indented_lte)(&context);
|
||||
alt((
|
||||
paragraph_end,
|
||||
recognize(tuple((line_ending, peek(line_indented_matcher)))),
|
||||
// TODO: Do we still need the item_matcher entry here? If we remove it, then child items should become part of the body of the parent item which would match the description on https://orgmode.org/worg/org-syntax.html
|
||||
recognize(tuple((line_ending, peek(item_matcher)))),
|
||||
))(i)
|
||||
}
|
||||
@@ -125,8 +127,8 @@ fn line_indented_lte<'r, 's>(context: Context<'r, 's>, i: &'s str) -> Res<&'s st
|
||||
)?;
|
||||
|
||||
let matched = recognize(verify(
|
||||
tuple((line_ending::<&str, _>, space0, anychar)),
|
||||
|(_newline, _space0, _anychar)| _space0.len() <= *current_item_indent_level,
|
||||
tuple((space0::<&str, _>, anychar)),
|
||||
|(_space0, _anychar)| _space0.len() <= *current_item_indent_level,
|
||||
))(i)?;
|
||||
|
||||
Ok(matched)
|
||||
|
||||
Reference in New Issue
Block a user