diff --git a/org_mode_samples/lesser_element/lesser_block/example/switches_with_label.org b/org_mode_samples/lesser_element/lesser_block/example/switches_with_label.org new file mode 100644 index 00000000..e844b0e9 --- /dev/null +++ b/org_mode_samples/lesser_element/lesser_block/example/switches_with_label.org @@ -0,0 +1,3 @@ +#+BEGIN_SRC elisp -n -r -l "((%s))" +foo +#+END_SRC diff --git a/src/parser/lesser_block.rs b/src/parser/lesser_block.rs index 77515e3b..da6c1458 100644 --- a/src/parser/lesser_block.rs +++ b/src/parser/lesser_block.rs @@ -342,9 +342,10 @@ fn example_switches<'s>(input: OrgSource<'s>) -> Res, ExampleSwitc (SwitchState::Normal, "-n") => SwitchState::NewLineNumber, (SwitchState::Normal, "+n") => SwitchState::ContinuedLineNumber, (SwitchState::NewLineNumber, _) => { - let val = word - .parse::() - .expect("TODO: I should be able to return CustomError from nom parsers."); + let val = match word.parse::() { + Ok(val) => val, + Err(_) => 1, + }; if val < 0 { number_lines = Some(SwitchNumberLines::New(0)); } else { @@ -354,9 +355,10 @@ fn example_switches<'s>(input: OrgSource<'s>) -> Res, ExampleSwitc SwitchState::Normal } (SwitchState::ContinuedLineNumber, _) => { - let val = word - .parse::() - .expect("TODO: I should be able to return CustomError from nom parsers."); + let val = match word.parse::() { + Ok(val) => val, + Err(_) => 1, + }; if val < 0 { number_lines = Some(SwitchNumberLines::Continued(0)); } else {