Support multiple commas when escaping lines.

This commit is contained in:
Tom Alexander 2023-10-04 16:03:45 -04:00
parent d059afef07
commit da5dcd4c1b
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
2 changed files with 13 additions and 4 deletions

View File

@ -1,6 +1,6 @@
#+begin_example #+begin_example
,* foo ,* foo
,** bar ,,,** bar
,*** baz ,*** baz
lorem lorem
, ipsum , ipsum

View File

@ -476,8 +476,17 @@ fn content_line<'s>(
input: OrgSource<'s>, input: OrgSource<'s>,
) -> Res<OrgSource<'s>, (Option<OrgSource<'s>>, OrgSource<'s>)> { ) -> Res<OrgSource<'s>, (Option<OrgSource<'s>>, OrgSource<'s>)> {
let (remaining, pre_escape_whitespace) = opt(map( let (remaining, pre_escape_whitespace) = opt(map(
tuple((space0, tag(","), peek(alt((tag("#+"), tag("*")))))), tuple((
|(pre_comma, _, _)| pre_comma, recognize(tuple((
space0,
many_till(
tag(","),
peek(tuple((tag(","), alt((tag("#+"), tag("*")))))),
),
))),
tag(","),
)),
|(pre_comma, _)| pre_comma,
))(input)?; ))(input)?;
let (remaining, line_post_escape) = recognize(many_till(anychar, line_ending))(remaining)?; let (remaining, line_post_escape) = recognize(many_till(anychar, line_ending))(remaining)?;
Ok((remaining, (pre_escape_whitespace, line_post_escape))) Ok((remaining, (pre_escape_whitespace, line_post_escape)))