diff --git a/org_mode_samples/citation/simple.org b/org_mode_samples/citation/simple.org index a48b60c4..9af9473c 100644 --- a/org_mode_samples/citation/simple.org +++ b/org_mode_samples/citation/simple.org @@ -1,3 +1,5 @@ [cite:@foo] [cite/a/b-_/foo:globalprefix;keyprefix @foo keysuffix;globalsuffix] + +text before [cite:@bar] text after diff --git a/src/parser/citation.rs b/src/parser/citation.rs index 19510f1a..fa8a5ee6 100644 --- a/src/parser/citation.rs +++ b/src/parser/citation.rs @@ -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 })) } diff --git a/src/parser/object_parser.rs b/src/parser/object_parser.rs index 2eeebaff..4693ac6a 100644 --- a/src/parser/object_parser.rs +++ b/src/parser/object_parser.rs @@ -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,