Do not match lesser blocks.
This commit is contained in:
		
							parent
							
								
									6e6ec56d1f
								
							
						
					
					
						commit
						70225a668b
					
				| @ -18,14 +18,22 @@ use nom::character::complete::line_ending; | ||||
| use nom::character::complete::space1; | ||||
| use nom::combinator::eof; | ||||
| use nom::combinator::opt; | ||||
| use nom::combinator::verify; | ||||
| use nom::multi::many_till; | ||||
| use nom::sequence::tuple; | ||||
| 
 | ||||
| #[tracing::instrument(ret, level = "debug")] | ||||
| pub fn greater_block<'r, 's>( | ||||
|     context: Context<'r, 's>, | ||||
|     input: &'s str, | ||||
| ) -> Res<&'s str, GreaterBlock<'s>> { | ||||
|     let (remaining, (_begin, name)) = tuple((tag_no_case("#+begin_"), name))(input)?; | ||||
|     let (remaining, (_begin, name)) = tuple(( | ||||
|         tag_no_case("#+begin_"), | ||||
|         verify(name, |name: &str| match name.to_lowercase().as_str() { | ||||
|             "comment" | "example" | "export" | "src" | "verse" => false, | ||||
|             _ => true, | ||||
|         }), | ||||
|     ))(input)?; | ||||
|     let (remaining, parameters) = opt(tuple((space1, parameters)))(remaining)?; | ||||
|     let (remaining, _nl) = line_ending(remaining)?; | ||||
|     let parser_context = context | ||||
| @ -55,10 +63,12 @@ pub fn greater_block<'r, 's>( | ||||
|     )) | ||||
| } | ||||
| 
 | ||||
| #[tracing::instrument(ret, level = "debug")] | ||||
| fn name<'s>(input: &'s str) -> Res<&'s str, &'s str> { | ||||
|     is_not(" \t\r\n")(input) | ||||
| } | ||||
| 
 | ||||
| #[tracing::instrument(ret, level = "debug")] | ||||
| fn parameters<'s>(input: &'s str) -> Res<&'s str, &'s str> { | ||||
|     is_not("\r\n")(input) | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Tom Alexander
						Tom Alexander