Do not include whitespace at the end of value.

This commit is contained in:
Tom Alexander 2023-10-08 14:48:29 -04:00
parent 1a2f0856da
commit 37bc5ef712
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
4 changed files with 8 additions and 1 deletions

View File

@ -0,0 +1,4 @@
{{{foo(bar baz)}}}
{{{foo(bar
baz)}}}

View File

@ -3082,7 +3082,7 @@ fn compare_org_macro<'b, 's>(
), ),
( (
EmacsField::Required(":value"), EmacsField::Required(":value"),
|r| Some(r.source), |r| Some(r.macro_value),
compare_property_quoted_string compare_property_quoted_string
), ),
( (

View File

@ -26,6 +26,7 @@ pub(crate) fn org_macro<'b, 'g, 'r, 's>(
let (remaining, macro_name) = org_macro_name(context, remaining)?; let (remaining, macro_name) = org_macro_name(context, remaining)?;
let (remaining, macro_args) = opt(parser_with_context!(org_macro_args)(context))(remaining)?; let (remaining, macro_args) = opt(parser_with_context!(org_macro_args)(context))(remaining)?;
let (remaining, _) = tag("}}}")(remaining)?; let (remaining, _) = tag("}}}")(remaining)?;
let macro_value = get_consumed(input, remaining);
let (remaining, _trailing_whitespace) = let (remaining, _trailing_whitespace) =
maybe_consume_object_trailing_whitespace_if_not_exiting(context, remaining)?; maybe_consume_object_trailing_whitespace_if_not_exiting(context, remaining)?;
@ -40,6 +41,7 @@ pub(crate) fn org_macro<'b, 'g, 'r, 's>(
.into_iter() .into_iter()
.map(|arg| arg.into()) .map(|arg| arg.into())
.collect(), .collect(),
macro_value: Into::<&str>::into(macro_value),
}, },
)) ))
} }

View File

@ -150,6 +150,7 @@ pub struct OrgMacro<'s> {
pub source: &'s str, pub source: &'s str,
pub macro_name: &'s str, pub macro_name: &'s str,
pub macro_args: Vec<&'s str>, pub macro_args: Vec<&'s str>,
pub macro_value: &'s str,
} }
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq)]