Consume trailing whitespace in paragraphs.

This commit is contained in:
Tom Alexander 2023-03-25 11:49:56 -04:00
parent faf2bb401d
commit b65c2f86b5
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -5,6 +5,7 @@ use nom::combinator::eof;
use nom::combinator::map; use nom::combinator::map;
use nom::combinator::not; use nom::combinator::not;
use nom::combinator::recognize; use nom::combinator::recognize;
use nom::multi::many0;
use nom::multi::many1; use nom::multi::many1;
use nom::sequence::tuple; use nom::sequence::tuple;
@ -53,6 +54,9 @@ fn paragraph<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, P
let (remaining, children) = many1(standard_set_object_matcher)(input)?; let (remaining, children) = many1(standard_set_object_matcher)(input)?;
let (remaining, _trailing_whitespace) =
alt((eof, recognize(tuple((line_ending, many0(blank_line))))))(remaining)?;
let source = get_consumed(input, remaining); let source = get_consumed(input, remaining);
Ok((remaining, Paragraph { source, children })) Ok((remaining, Paragraph { source, children }))