From cdcaae11c4aae17ec12c7bd93b911cde2851782e Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Fri, 21 Apr 2023 18:11:26 -0400 Subject: [PATCH] Add tests for broken export blocks. --- org_mode_samples/lesser_block/export_with_no_data.org | 3 +++ org_mode_samples/lesser_block/export_with_two_words.org | 3 +++ src/parser/lesser_block.rs | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 org_mode_samples/lesser_block/export_with_no_data.org create mode 100644 org_mode_samples/lesser_block/export_with_two_words.org diff --git a/org_mode_samples/lesser_block/export_with_no_data.org b/org_mode_samples/lesser_block/export_with_no_data.org new file mode 100644 index 0000000..db2940e --- /dev/null +++ b/org_mode_samples/lesser_block/export_with_no_data.org @@ -0,0 +1,3 @@ +#+begin_export +This would be LaTeX code. +#+end_export diff --git a/org_mode_samples/lesser_block/export_with_two_words.org b/org_mode_samples/lesser_block/export_with_two_words.org new file mode 100644 index 0000000..661f739 --- /dev/null +++ b/org_mode_samples/lesser_block/export_with_two_words.org @@ -0,0 +1,3 @@ +#+begin_export latex html +This would be LaTeX code. +#+end_export diff --git a/src/parser/lesser_block.rs b/src/parser/lesser_block.rs index e330840..a7db16a 100644 --- a/src/parser/lesser_block.rs +++ b/src/parser/lesser_block.rs @@ -173,7 +173,7 @@ pub fn export_block<'r, 's>( input: &'s str, ) -> Res<&'s str, ExportBlock<'s>> { let (remaining, name) = lesser_block_begin("export")(context, input)?; - // TODO: Data is mandatory and must be a single word + // https://orgmode.org/worg/org-syntax.html#Blocks claims that export blocks must have a single word for data but testing shows no data and multi-word data still parses as an export block. let (remaining, parameters) = opt(tuple((space1, data)))(remaining)?; let (remaining, _nl) = line_ending(remaining)?; let lesser_block_end_specialized = lesser_block_end("export");