Minor cleanup

This commit is contained in:
Natty 2023-10-04 19:44:27 +02:00
parent 46e0766a36
commit 24d44632e0
Signed by: natty
GPG Key ID: BF6CB659ADEE60EC
1 changed files with 7 additions and 3 deletions

View File

@ -195,6 +195,7 @@ fn space(input: Span) -> IResult<Span, Token> {
struct Context;
impl Context {
#[inline]
const fn partial<'a>(
&self,
func: impl Fn(&Self, Span<'a>) -> IResult<Span<'a>, Token<'a>> + 'static,
@ -278,22 +279,25 @@ impl Context {
}
fn tag_block_math<'a>(&self, input: Span<'a>) -> IResult<Span<'a>, Token<'a>> {
let start = &tag("\\[");
let end = &tag("\\]");
let (input, _) = opt(line_ending)(input)?;
if input.get_column() != 0 {
return fail(input);
}
let (input, _) = tag("\\[")(input)?;
let (input, _) = start(input)?;
let (input, _) = opt(line_ending)(input)?;
let (input, math_span) = recognize(many1_count(tuple((
not(tuple((opt(line_ending), tag("\\]")))),
not(tuple((opt(line_ending), end))),
not_line_ending,
))))(input)?;
let (input, _) = opt(line_ending)(input)?;
let (input, _) = tag("\\]")(input)?;
let (input, _) = end(input)?;
let (input, _) = many0(space)(input)?;
let (input, _) = not(not_line_ending)(input)?;
let (input, _) = opt(line_ending)(input)?;