From 0d0b9863c3595cc195385d7f4e604be809b22cad Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Mon, 9 Oct 2023 19:25:00 -0400 Subject: [PATCH] Populate inline babel call fields. --- src/parser/inline_babel_call.rs | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/parser/inline_babel_call.rs b/src/parser/inline_babel_call.rs index d1d3f6b..001333f 100644 --- a/src/parser/inline_babel_call.rs +++ b/src/parser/inline_babel_call.rs @@ -34,10 +34,11 @@ pub(crate) fn inline_babel_call<'b, 'g, 'r, 's>( input: OrgSource<'s>, ) -> Res, InlineBabelCall<'s>> { let (remaining, _) = tag_no_case("call_")(input)?; - let (remaining, _name) = name(context, remaining)?; - let (remaining, _header1) = opt(parser_with_context!(header)(context))(remaining)?; - let (remaining, _argument) = argument(context, remaining)?; - let (remaining, _header2) = opt(parser_with_context!(header)(context))(remaining)?; + let (remaining, name) = name(context, remaining)?; + let (remaining, inside_header) = opt(parser_with_context!(header)(context))(remaining)?; + let (remaining, arguments) = argument(context, remaining)?; + let (remaining, end_header) = opt(parser_with_context!(header)(context))(remaining)?; + let value = get_consumed(input, remaining); let (remaining, _trailing_whitespace) = maybe_consume_object_trailing_whitespace_if_not_exiting(context, remaining)?; let source = get_consumed(input, remaining); @@ -45,11 +46,15 @@ pub(crate) fn inline_babel_call<'b, 'g, 'r, 's>( remaining, InlineBabelCall { source: source.into(), - value: todo!(), - call: todo!(), - inside_header: todo!(), - arguments: todo!(), - end_header: todo!(), + value: value.into(), + call: name.into(), + inside_header: inside_header.map(Into::<&str>::into), + arguments: if arguments.len() > 0 { + Some(arguments.into()) + } else { + None + }, + end_header: end_header.map(Into::<&str>::into), }, )) }