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