Add test case for invalid src block.
This commit is contained in:
parent
cdcaae11c4
commit
6fce666983
3
org_mode_samples/lesser_block/src_with_no_data.org
Normal file
3
org_mode_samples/lesser_block/src_with_no_data.org
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#+begin_src
|
||||||
|
echo "this is a source block."
|
||||||
|
#+end_src
|
@ -212,7 +212,7 @@ pub fn export_block<'r, 's>(
|
|||||||
#[tracing::instrument(ret, level = "debug")]
|
#[tracing::instrument(ret, level = "debug")]
|
||||||
pub fn src_block<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, SrcBlock<'s>> {
|
pub fn src_block<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, SrcBlock<'s>> {
|
||||||
let (remaining, name) = lesser_block_begin("src")(context, input)?;
|
let (remaining, name) = lesser_block_begin("src")(context, input)?;
|
||||||
// TODO: DATA is mandatory and must follow the LANGUAGE SWITCHES ARGUMENTS pattern
|
// https://orgmode.org/worg/org-syntax.html#Blocks claims that data is mandatory and must follow the LANGUAGE SWITCHES ARGUMENTS pattern but testing has shown that no data and incorrect data here will still parse to a src block.
|
||||||
let (remaining, parameters) = opt(tuple((space1, data)))(remaining)?;
|
let (remaining, parameters) = opt(tuple((space1, data)))(remaining)?;
|
||||||
let (remaining, _nl) = line_ending(remaining)?;
|
let (remaining, _nl) = line_ending(remaining)?;
|
||||||
let lesser_block_end_specialized = lesser_block_end("src");
|
let lesser_block_end_specialized = lesser_block_end("src");
|
||||||
|
Loading…
Reference in New Issue
Block a user