Apply a similar optimization to the detect element parser but also unify detection of affiliated keywords.
This commit is contained in:
@@ -53,13 +53,17 @@ use crate::types::PlainListType;
|
||||
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(ret, level = "debug", skip(context))
|
||||
tracing::instrument(ret, level = "debug", skip(context, affiliated_keywords))
|
||||
)]
|
||||
pub(crate) fn detect_plain_list<'b, 'g, 'r, 's>(
|
||||
pub(crate) fn detect_plain_list<'b, 'g, 'r, 's, AK>(
|
||||
affiliated_keywords: AK,
|
||||
remaining: OrgSource<'s>,
|
||||
context: RefContext<'b, 'g, 'r, 's>,
|
||||
input: OrgSource<'s>,
|
||||
) -> Res<OrgSource<'s>, ()> {
|
||||
let (input, _) = many0(parser_with_context!(affiliated_keyword)(context))(input)?;
|
||||
) -> Res<OrgSource<'s>, ()>
|
||||
where
|
||||
AK: IntoIterator<Item = Keyword<'s>>,
|
||||
{
|
||||
if verify(
|
||||
tuple((
|
||||
start_of_line,
|
||||
@@ -70,7 +74,7 @@ pub(crate) fn detect_plain_list<'b, 'g, 'r, 's>(
|
||||
|(_start, (indent_level, _), (_bullet_type, bull), _after_whitespace)| {
|
||||
!Into::<&str>::into(bull).starts_with("*") || *indent_level > 0
|
||||
},
|
||||
)(input)
|
||||
)(remaining)
|
||||
.is_ok()
|
||||
{
|
||||
return Ok((input, ()));
|
||||
|
||||
Reference in New Issue
Block a user