Fix comparing key and mark prefix/suffix as optional.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use nom::branch::alt;
|
||||
use nom::bytes::complete::tag;
|
||||
use nom::character::complete::anychar;
|
||||
use nom::combinator::map;
|
||||
use nom::combinator::not;
|
||||
use nom::combinator::opt;
|
||||
use nom::combinator::recognize;
|
||||
@@ -56,18 +57,22 @@ pub(crate) fn citation_reference_key<'b, 'g, 'r, 's>(
|
||||
context: RefContext<'b, 'g, 'r, 's>,
|
||||
input: OrgSource<'s>,
|
||||
) -> Res<OrgSource<'s>, OrgSource<'s>> {
|
||||
let (remaining, source) = recognize(tuple((
|
||||
tag("@"),
|
||||
many1(verify(
|
||||
preceded(
|
||||
not(parser_with_context!(exit_matcher_parser)(context)),
|
||||
anychar,
|
||||
),
|
||||
|c| {
|
||||
WORD_CONSTITUENT_CHARACTERS.contains(*c) || "-.:?~`'/*@+|(){}<>&_^$#%~".contains(*c)
|
||||
},
|
||||
let (remaining, source) = map(
|
||||
tuple((
|
||||
tag("@"),
|
||||
recognize(many1(verify(
|
||||
preceded(
|
||||
not(parser_with_context!(exit_matcher_parser)(context)),
|
||||
anychar,
|
||||
),
|
||||
|c| {
|
||||
WORD_CONSTITUENT_CHARACTERS.contains(*c)
|
||||
|| "-.:?~`'/*@+|(){}<>&_^$#%~".contains(*c)
|
||||
},
|
||||
))),
|
||||
)),
|
||||
)))(input)?;
|
||||
|(_, key)| key,
|
||||
)(input)?;
|
||||
Ok((remaining, source))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user