From da5dcd4c1b518f64cc4c71b0caa611bb06896771 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Wed, 4 Oct 2023 16:03:45 -0400 Subject: [PATCH] Support multiple commas when escaping lines. --- .../lesser_block/example/escaped_lines.org | 4 ++-- src/parser/lesser_block.rs | 13 +++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/org_mode_samples/lesser_element/lesser_block/example/escaped_lines.org b/org_mode_samples/lesser_element/lesser_block/example/escaped_lines.org index 71dcda3..5a90409 100644 --- a/org_mode_samples/lesser_element/lesser_block/example/escaped_lines.org +++ b/org_mode_samples/lesser_element/lesser_block/example/escaped_lines.org @@ -1,7 +1,7 @@ #+begin_example ,* foo -,** bar -,*** baz +,,,** bar + ,*** baz lorem , ipsum ,#+begin_src dolar diff --git a/src/parser/lesser_block.rs b/src/parser/lesser_block.rs index 5321c9f..32a80c4 100644 --- a/src/parser/lesser_block.rs +++ b/src/parser/lesser_block.rs @@ -476,8 +476,17 @@ fn content_line<'s>( input: OrgSource<'s>, ) -> Res, (Option>, OrgSource<'s>)> { let (remaining, pre_escape_whitespace) = opt(map( - tuple((space0, tag(","), peek(alt((tag("#+"), tag("*")))))), - |(pre_comma, _, _)| pre_comma, + tuple(( + recognize(tuple(( + space0, + many_till( + tag(","), + peek(tuple((tag(","), alt((tag("#+"), tag("*")))))), + ), + ))), + tag(","), + )), + |(pre_comma, _)| pre_comma, ))(input)?; let (remaining, line_post_escape) = recognize(many_till(anychar, line_ending))(remaining)?; Ok((remaining, (pre_escape_whitespace, line_post_escape)))