Consume trailing whitespace for links.

This commit is contained in:
Tom Alexander 2023-04-24 16:28:18 -04:00
parent c6403423cf
commit f9d83ee09d
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -3,6 +3,7 @@ use nom::bytes::complete::escaped;
use nom::bytes::complete::tag;
use nom::bytes::complete::take_till1;
use nom::character::complete::one_of;
use nom::character::complete::space0;
use nom::combinator::verify;
use nom::multi::many_till;
@ -37,6 +38,7 @@ pub fn regular_link_without_description<'r, 's>(
let (remaining, _opening_bracket) = tag("[[")(input)?;
let (remaining, _path) = pathreg(context, remaining)?;
let (remaining, _closing_bracket) = tag("]]")(remaining)?;
let (remaining, _trailing_whitespace) = space0(remaining)?;
let source = get_consumed(input, remaining);
Ok((remaining, RegularLink { source }))
}
@ -51,6 +53,7 @@ pub fn regular_link_with_description<'r, 's>(
let (remaining, _closing_bracket) = tag("][")(remaining)?;
let (remaining, _description) = description(context, remaining)?;
let (remaining, _closing_bracket) = tag("]]")(remaining)?;
let (remaining, _trailing_whitespace) = space0(remaining)?;
let source = get_consumed(input, remaining);
Ok((remaining, RegularLink { source }))
}