Get tracing back into the latex environemtn end parser.

This commit is contained in:
Tom Alexander 2023-04-22 19:12:48 -04:00
parent c0809cce10
commit f70babdcf4
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -60,16 +60,25 @@ fn latex_environment_end(
) -> impl for<'r, 's> Fn(Context<'r, 's>, &'s str) -> Res<&'s str, &'s str> { ) -> impl for<'r, 's> Fn(Context<'r, 's>, &'s str) -> Res<&'s str, &'s str> {
let current_name_lower = current_name.to_lowercase(); let current_name_lower = current_name.to_lowercase();
move |context: Context, input: &str| { move |context: Context, input: &str| {
start_of_line(context, input)?; _latex_environment_end(context, input, current_name_lower.as_str())
let (remaining, _leading_whitespace) = space0(input)?;
let (remaining, (_begin, _name, _close_brace, _ws, _line_ending)) = tuple((
tag_no_case(r#"\end{"#),
tag_no_case(current_name_lower.as_str()),
tag("}"),
space0,
alt((eof, line_ending)),
))(remaining)?;
let source = get_consumed(input, remaining);
Ok((remaining, source))
} }
} }
#[tracing::instrument(ret, level = "debug")]
fn _latex_environment_end<'r, 's, 'x>(
context: Context<'r, 's>,
input: &'s str,
current_name_lower: &'x str,
) -> Res<&'s str, &'s str> {
start_of_line(context, input)?;
let (remaining, _leading_whitespace) = space0(input)?;
let (remaining, (_begin, _name, _close_brace, _ws, _line_ending)) = tuple((
tag_no_case(r#"\end{"#),
tag_no_case(current_name_lower),
tag("}"),
space0,
alt((eof, line_ending)),
))(remaining)?;
let source = get_consumed(input, remaining);
Ok((remaining, source))
}