Compare plain list item bullets.
This commit is contained in:
@@ -54,12 +54,12 @@ pub(crate) fn detect_plain_list<'b, 'g, 'r, 's>(
|
||||
if verify(
|
||||
tuple((
|
||||
start_of_line,
|
||||
space0,
|
||||
parser_with_context!(indentation_level)(context),
|
||||
parser_with_context!(bullet)(context),
|
||||
alt((space1, line_ending, eof)),
|
||||
)),
|
||||
|(_start, indent, (_bullet_type, bull), _after_whitespace)| {
|
||||
Into::<&str>::into(bull) != "*" || indent.len() > 0
|
||||
|(_start, (indent_level, _), (_bullet_type, bull), _after_whitespace)| {
|
||||
!Into::<&str>::into(bull).starts_with("*") || *indent_level > 0
|
||||
},
|
||||
)(input)
|
||||
.is_ok()
|
||||
@@ -163,7 +163,7 @@ fn plain_list_item<'b, 'g, 'r, 's>(
|
||||
let (remaining, (indent_level, _leading_whitespace)) = indentation_level(context, input)?;
|
||||
let (remaining, (bullet_type, bull)) = verify(
|
||||
parser_with_context!(bullet)(context),
|
||||
|(_bullet_type, bull)| Into::<&str>::into(bull) != "*" || indent_level > 0,
|
||||
|(_bullet_type, bull)| !Into::<&str>::into(bull).starts_with("*") || indent_level > 0,
|
||||
)(remaining)?;
|
||||
|
||||
let (remaining, _maybe_counter_set) =
|
||||
@@ -279,18 +279,23 @@ fn bullet<'b, 'g, 'r, 's>(
|
||||
context: RefContext<'b, 'g, 'r, 's>,
|
||||
input: OrgSource<'s>,
|
||||
) -> Res<OrgSource<'s>, (BulletType, OrgSource<'s>)> {
|
||||
alt((
|
||||
map(tag("*"), |bull| (BulletType::Unordered, bull)),
|
||||
map(tag("-"), |bull| (BulletType::Unordered, bull)),
|
||||
map(tag("+"), |bull| (BulletType::Unordered, bull)),
|
||||
map(
|
||||
recognize(tuple((
|
||||
parser_with_context!(counter)(context),
|
||||
alt((tag("."), tag(")"))),
|
||||
))),
|
||||
|bull| (BulletType::Ordered, bull),
|
||||
),
|
||||
))(input)
|
||||
let (remaining, ((bullet_type, _without_space), peek_trailing_space)) = tuple((
|
||||
alt((
|
||||
map(tag("*"), |bull| (BulletType::Unordered, bull)),
|
||||
map(tag("-"), |bull| (BulletType::Unordered, bull)),
|
||||
map(tag("+"), |bull| (BulletType::Unordered, bull)),
|
||||
map(
|
||||
recognize(tuple((
|
||||
parser_with_context!(counter)(context),
|
||||
alt((tag("."), tag(")"))),
|
||||
))),
|
||||
|bull| (BulletType::Ordered, bull),
|
||||
),
|
||||
)),
|
||||
peek(space0),
|
||||
))(input)?;
|
||||
let with_space = input.get_until_end_of(peek_trailing_space);
|
||||
Ok((remaining, (bullet_type, with_space)))
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||
|
||||
Reference in New Issue
Block a user