Fix empty content items with final item whitespace cut-off before headlines.
This commit is contained in:
parent
b7442c1e92
commit
a276ba70e0
@ -113,7 +113,9 @@ pub(crate) fn detect_not_plain_list_item_indent<'b, 'g, 'r, 's>(
|
|||||||
alt((space1, line_ending, eof)),
|
alt((space1, line_ending, eof)),
|
||||||
)),
|
)),
|
||||||
)),
|
)),
|
||||||
|(_, (depth, bullet), (_, _))| *depth == 0 && Into::<&str>::into(bullet).starts_with('*'),
|
|(_, (depth, _), ((_, bullet), _))| {
|
||||||
|
*depth == 0 && Into::<&str>::into(bullet).starts_with('*')
|
||||||
|
},
|
||||||
)(input)
|
)(input)
|
||||||
{
|
{
|
||||||
return Ok((input, indent));
|
return Ok((input, indent));
|
||||||
@ -263,10 +265,15 @@ fn plain_list_item<'b, 'g, 'r, 's>(
|
|||||||
let maybe_contentless_item: Res<OrgSource<'_>, ()> =
|
let maybe_contentless_item: Res<OrgSource<'_>, ()> =
|
||||||
detect_contentless_item_contents(&parser_context, remaining);
|
detect_contentless_item_contents(&parser_context, remaining);
|
||||||
if let Ok((_rem, _ws)) = maybe_contentless_item {
|
if let Ok((_rem, _ws)) = maybe_contentless_item {
|
||||||
let (remaining, _trailing_ws) = if context.should_consume_trailing_whitespace() {
|
let (remaining, _trailing_ws) = if tuple((
|
||||||
recognize(alt((recognize(many1(blank_line)), eof)))(remaining)?
|
blank_line,
|
||||||
} else {
|
bind_context!(final_item_whitespace_cutoff, context),
|
||||||
|
))(remaining)
|
||||||
|
.is_ok()
|
||||||
|
{
|
||||||
recognize(alt((blank_line, eof)))(remaining)?
|
recognize(alt((blank_line, eof)))(remaining)?
|
||||||
|
} else {
|
||||||
|
recognize(alt((recognize(many1(blank_line)), eof)))(remaining)?
|
||||||
};
|
};
|
||||||
let source = get_consumed(input, remaining);
|
let source = get_consumed(input, remaining);
|
||||||
return Ok((
|
return Ok((
|
||||||
|
@ -243,6 +243,10 @@ pub(crate) fn org_line_ending(input: OrgSource<'_>) -> Res<OrgSource<'_>, OrgSou
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Match the whitespace at the beginning of a line and give it an indentation level.
|
/// Match the whitespace at the beginning of a line and give it an indentation level.
|
||||||
|
#[cfg_attr(
|
||||||
|
feature = "tracing",
|
||||||
|
tracing::instrument(ret, level = "debug", skip(context))
|
||||||
|
)]
|
||||||
pub(crate) fn indentation_level<'s>(
|
pub(crate) fn indentation_level<'s>(
|
||||||
context: RefContext<'_, '_, '_, 's>,
|
context: RefContext<'_, '_, '_, 's>,
|
||||||
input: OrgSource<'s>,
|
input: OrgSource<'s>,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user