Add support for list items with a line break before their contents.
This commit is contained in:
parent
efa372a9e9
commit
bc5745a95f
@ -47,9 +47,7 @@ pub fn assert_bounds<'s, S: Source<'s>>(
|
|||||||
standard_properties
|
standard_properties
|
||||||
.begin
|
.begin
|
||||||
.ok_or("Token should have a begin.")?,
|
.ok_or("Token should have a begin.")?,
|
||||||
standard_properties
|
standard_properties.end.ok_or("Token should have an end.")?,
|
||||||
.end
|
|
||||||
.ok_or("Token should have a begin.")?,
|
|
||||||
);
|
);
|
||||||
let (rust_begin, rust_end) = get_offsets(source, rust);
|
let (rust_begin, rust_end) = get_offsets(source, rust);
|
||||||
if (rust_begin + 1) != begin || (rust_end + 1) != end {
|
if (rust_begin + 1) != begin || (rust_end + 1) != end {
|
||||||
|
@ -135,8 +135,7 @@ pub fn plain_list_item<'r, 's>(
|
|||||||
})(remaining)?;
|
})(remaining)?;
|
||||||
|
|
||||||
// TODO: This isn't taking into account items that immediately line break and then have contents
|
// TODO: This isn't taking into account items that immediately line break and then have contents
|
||||||
let maybe_contentless_item: Res<OrgSource<'_>, OrgSource<'_>> =
|
let maybe_contentless_item: Res<OrgSource<'_>, OrgSource<'_>> = eof(remaining);
|
||||||
alt((eof, line_ending))(remaining);
|
|
||||||
match maybe_contentless_item {
|
match maybe_contentless_item {
|
||||||
Ok((rem, _ws)) => {
|
Ok((rem, _ws)) => {
|
||||||
let source = get_consumed(input, rem);
|
let source = get_consumed(input, rem);
|
||||||
@ -153,7 +152,7 @@ pub fn plain_list_item<'r, 's>(
|
|||||||
Err(_) => {}
|
Err(_) => {}
|
||||||
};
|
};
|
||||||
|
|
||||||
let (remaining, _ws) = space1(remaining)?;
|
let (remaining, _ws) = alt((space1, line_ending))(remaining)?;
|
||||||
let exit_matcher = plain_list_item_end(indent_level);
|
let exit_matcher = plain_list_item_end(indent_level);
|
||||||
let parser_context = context
|
let parser_context = context
|
||||||
.with_additional_node(ContextElement::ConsumeTrailingWhitespace(true))
|
.with_additional_node(ContextElement::ConsumeTrailingWhitespace(true))
|
||||||
@ -162,12 +161,9 @@ pub fn plain_list_item<'r, 's>(
|
|||||||
exit_matcher: &exit_matcher,
|
exit_matcher: &exit_matcher,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
let (remaining, (children, _exit_contents)) = verify(
|
let (remaining, (children, _exit_contents)) = many_till(
|
||||||
many_till(
|
parser_with_context!(element(true))(&parser_context),
|
||||||
parser_with_context!(element(true))(&parser_context),
|
parser_with_context!(exit_matcher_parser)(&parser_context),
|
||||||
parser_with_context!(exit_matcher_parser)(&parser_context),
|
|
||||||
),
|
|
||||||
|(children, _exit_contents)| !children.is_empty(),
|
|
||||||
)(remaining)?;
|
)(remaining)?;
|
||||||
|
|
||||||
let (remaining, _trailing_ws) =
|
let (remaining, _trailing_ws) =
|
||||||
|
Loading…
Reference in New Issue
Block a user