Handle tabs for plain list descriptions.
This bug probably exists in hundreds of places across the code base. I am going to have to write a "fuzzer" that replaces random whitespace with tabs to find them all.
This commit is contained in:
parent
344ef04453
commit
a8fbf01124
@ -332,7 +332,7 @@ fn item_tag<'b, 'g, 'r, 's>(
|
||||
),
|
||||
|(children, _exit_contents)| !children.is_empty(),
|
||||
)(input)?;
|
||||
let (remaining, _) = tag(" ::")(remaining)?;
|
||||
let (remaining, _) = tuple((one_of(" \t"), tag("::")))(remaining)?;
|
||||
Ok((remaining, children))
|
||||
}
|
||||
|
||||
@ -341,9 +341,10 @@ fn item_tag_end<'b, 'g, 'r, 's>(
|
||||
_context: RefContext<'b, 'g, 'r, 's>,
|
||||
input: OrgSource<'s>,
|
||||
) -> Res<OrgSource<'s>, OrgSource<'s>> {
|
||||
recognize(alt((
|
||||
tag(" :: "),
|
||||
recognize(tuple((tag(" ::"), alt((line_ending, eof))))),
|
||||
recognize(tuple((
|
||||
one_of(" \t"),
|
||||
tag("::"),
|
||||
alt((recognize(one_of(" \t")), line_ending, eof)),
|
||||
)))(input)
|
||||
}
|
||||
|
||||
|
@ -2,13 +2,13 @@ use nom::branch::alt;
|
||||
use nom::character::complete::anychar;
|
||||
use nom::character::complete::line_ending;
|
||||
use nom::character::complete::none_of;
|
||||
use nom::character::complete::one_of;
|
||||
use nom::character::complete::space0;
|
||||
use nom::combinator::eof;
|
||||
use nom::combinator::not;
|
||||
use nom::combinator::opt;
|
||||
use nom::combinator::peek;
|
||||
use nom::combinator::recognize;
|
||||
use nom::combinator::verify;
|
||||
use nom::multi::many0;
|
||||
use nom::multi::many_till;
|
||||
use nom::sequence::tuple;
|
||||
@ -94,9 +94,9 @@ pub fn maybe_consume_object_trailing_whitespace_if_not_exiting<'b, 'g, 'r, 's>(
|
||||
) -> Res<OrgSource<'s>, Option<OrgSource<'s>>> {
|
||||
// We have to check exit matcher after each character because description list tags need to end with a space unconsumed (" ::").
|
||||
let (remaining, _) = many_till(
|
||||
verify(anychar, |c| *c == ' '),
|
||||
one_of(" \t"),
|
||||
alt((
|
||||
peek(recognize(verify(anychar, |c| *c != ' '))),
|
||||
peek(recognize(none_of(" \t"))),
|
||||
parser_with_context!(exit_matcher_parser)(context),
|
||||
)),
|
||||
)(input)?;
|
||||
|
Loading…
Reference in New Issue
Block a user