Fix parsing citations inside paragraphs.
This commit is contained in:
parent
d678391789
commit
7ce9dafd96
@ -1,3 +1,5 @@
|
||||
[cite:@foo]
|
||||
|
||||
[cite/a/b-_/foo:globalprefix;keyprefix @foo keysuffix;globalsuffix]
|
||||
|
||||
text before [cite:@bar] text after
|
||||
|
@ -2,6 +2,7 @@ use nom::branch::alt;
|
||||
use nom::bytes::complete::tag;
|
||||
use nom::bytes::complete::tag_no_case;
|
||||
use nom::character::complete::anychar;
|
||||
use nom::character::complete::space0;
|
||||
use nom::combinator::opt;
|
||||
use nom::combinator::recognize;
|
||||
use nom::combinator::verify;
|
||||
@ -41,6 +42,7 @@ pub fn citation<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str
|
||||
parser_with_context!(global_suffix)(context),
|
||||
)))(remaining)?;
|
||||
let (remaining, _) = tag("]")(remaining)?;
|
||||
let (remaining, _) = space0(remaining)?;
|
||||
let source = get_consumed(input, remaining);
|
||||
Ok((remaining, Citation { source }))
|
||||
}
|
||||
|
@ -29,10 +29,7 @@ pub fn standard_set_object<'r, 's>(
|
||||
not(|i| context.check_exit_matcher(i))(input)?;
|
||||
|
||||
alt((
|
||||
map(
|
||||
parser_with_context!(citation)(context),
|
||||
Object::Citation,
|
||||
),
|
||||
map(parser_with_context!(citation)(context), Object::Citation),
|
||||
map(
|
||||
parser_with_context!(footnote_reference)(context),
|
||||
Object::FootnoteReference,
|
||||
@ -89,6 +86,7 @@ pub fn any_object_except_plain_text<'r, 's>(
|
||||
) -> Res<&'s str, Object<'s>> {
|
||||
// Used for exit matchers so this does not check exit matcher condition.
|
||||
alt((
|
||||
map(parser_with_context!(citation)(context), Object::Citation),
|
||||
map(
|
||||
parser_with_context!(footnote_reference)(context),
|
||||
Object::FootnoteReference,
|
||||
|
Loading…
Reference in New Issue
Block a user