Support detecting line indentation when checking for contentless plain list items.
This commit is contained in:
parent
4f34ab9089
commit
1a41cfc6c7
@ -9,3 +9,6 @@
|
||||
- big gap ::
|
||||
|
||||
stuff
|
||||
- empty value with blank ::
|
||||
|
||||
stuff
|
||||
|
@ -168,9 +168,20 @@ fn plain_list_item<'b, 'g, 'r, 's>(
|
||||
let (remaining, maybe_tag) =
|
||||
opt(tuple((space1, parser_with_context!(item_tag)(context))))(remaining)?;
|
||||
|
||||
let exit_matcher = plain_list_item_end(indent_level);
|
||||
let contexts = [
|
||||
ContextElement::ConsumeTrailingWhitespace(true),
|
||||
ContextElement::ExitMatcherNode(ExitMatcherNode {
|
||||
class: ExitClass::Beta,
|
||||
exit_matcher: &exit_matcher,
|
||||
}),
|
||||
];
|
||||
let parser_context = context.with_additional_node(&contexts[0]);
|
||||
let parser_context = parser_context.with_additional_node(&contexts[1]);
|
||||
|
||||
let maybe_contentless_item: Res<OrgSource<'_>, ()> = peek(parser_with_context!(
|
||||
detect_contentless_item_contents
|
||||
)(context))(remaining);
|
||||
)(&parser_context))(remaining);
|
||||
match maybe_contentless_item {
|
||||
Ok((_rem, _ws)) => {
|
||||
let (remaining, _trailing_ws) = opt(blank_line)(remaining)?;
|
||||
@ -191,17 +202,7 @@ fn plain_list_item<'b, 'g, 'r, 's>(
|
||||
}
|
||||
Err(_) => {}
|
||||
};
|
||||
let (remaining, _ws) = item_tag_post_gap(context, remaining)?;
|
||||
let exit_matcher = plain_list_item_end(indent_level);
|
||||
let contexts = [
|
||||
ContextElement::ConsumeTrailingWhitespace(true),
|
||||
ContextElement::ExitMatcherNode(ExitMatcherNode {
|
||||
class: ExitClass::Beta,
|
||||
exit_matcher: &exit_matcher,
|
||||
}),
|
||||
];
|
||||
let parser_context = context.with_additional_node(&contexts[0]);
|
||||
let parser_context = parser_context.with_additional_node(&contexts[1]);
|
||||
let (remaining, _ws) = item_tag_post_gap(&parser_context, remaining)?;
|
||||
|
||||
let (mut remaining, (mut children, _exit_contents)) = many_till(
|
||||
include_input(parser_with_context!(element(true))(&parser_context)),
|
||||
|
Loading…
Reference in New Issue
Block a user