Handle spaces after statistics cookies.

This commit is contained in:
Tom Alexander 2023-09-08 18:35:33 -04:00
parent 352c20d1d8
commit 0d7a15bfeb
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
2 changed files with 6 additions and 2 deletions

View File

@ -0,0 +1 @@
* [0/4] foo

View File

@ -4,6 +4,7 @@ use nom::combinator::recognize;
use nom::sequence::tuple;
use super::org_source::OrgSource;
use super::util::get_consumed;
use super::util::maybe_consume_object_trailing_whitespace_if_not_exiting;
use crate::context::parser_with_context;
use crate::context::RefContext;
@ -26,10 +27,11 @@ pub fn percent_statistics_cookie<'b, 'g, 'r, 's>(
context: RefContext<'b, 'g, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, StatisticsCookie<'s>> {
let (remaining, source) =
let (remaining, _) =
recognize(tuple((tag("["), nom::character::complete::u64, tag("%]"))))(input)?;
let (remaining, _trailing_whitespace) =
maybe_consume_object_trailing_whitespace_if_not_exiting(context, remaining)?;
let source = get_consumed(input, remaining);
Ok((
remaining,
StatisticsCookie {
@ -43,7 +45,7 @@ pub fn fraction_statistics_cookie<'b, 'g, 'r, 's>(
context: RefContext<'b, 'g, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, StatisticsCookie<'s>> {
let (remaining, source) = recognize(tuple((
let (remaining, _) = recognize(tuple((
tag("["),
nom::character::complete::u64,
tag("/"),
@ -52,6 +54,7 @@ pub fn fraction_statistics_cookie<'b, 'g, 'r, 's>(
)))(input)?;
let (remaining, _trailing_whitespace) =
maybe_consume_object_trailing_whitespace_if_not_exiting(context, remaining)?;
let source = get_consumed(input, remaining);
Ok((
remaining,
StatisticsCookie {