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| {
_latex_environment_end(context, input, current_name_lower.as_str())
}
}
#[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)?; start_of_line(context, input)?;
let (remaining, _leading_whitespace) = space0(input)?; let (remaining, _leading_whitespace) = space0(input)?;
let (remaining, (_begin, _name, _close_brace, _ws, _line_ending)) = tuple(( let (remaining, (_begin, _name, _close_brace, _ws, _line_ending)) = tuple((
tag_no_case(r#"\end{"#), tag_no_case(r#"\end{"#),
tag_no_case(current_name_lower.as_str()), tag_no_case(current_name_lower),
tag("}"), tag("}"),
space0, space0,
alt((eof, line_ending)), alt((eof, line_ending)),
))(remaining)?; ))(remaining)?;
let source = get_consumed(input, remaining); let source = get_consumed(input, remaining);
Ok((remaining, source)) Ok((remaining, source))
}
} }