Move handling of contentless item to handle contentless description item.
This commit is contained in:
		
							parent
							
								
									bfc9e7f58d
								
							
						
					
					
						commit
						0fcb3f73f9
					
				| @ -144,29 +144,32 @@ pub fn plain_list_item<'r, 's>( | ||||
|         Into::<&str>::into(bull) != "*" || indent_level > 0 | ||||
|     })(remaining)?; | ||||
| 
 | ||||
|     let maybe_contentless_item: Res<OrgSource<'_>, OrgSource<'_>> = eof(remaining); | ||||
|     let (remaining, maybe_tag) = opt(tuple(( | ||||
|         space1, | ||||
|         parser_with_context!(item_tag)(context), | ||||
|         tag(" ::"), | ||||
|     )))(remaining)?; | ||||
|     let maybe_contentless_item: Res<OrgSource<'_>, OrgSource<'_>> = | ||||
|         peek(recognize(tuple((many0(blank_line), eof))))(remaining); | ||||
|     match maybe_contentless_item { | ||||
|         Ok((rem, _ws)) => { | ||||
|             let source = get_consumed(input, rem); | ||||
|         Ok((_rem, _ws)) => { | ||||
|             let (remaining, _trailing_ws) = opt(blank_line)(remaining)?; | ||||
|             let source = get_consumed(input, remaining); | ||||
|             return Ok(( | ||||
|                 rem, | ||||
|                 remaining, | ||||
|                 PlainListItem { | ||||
|                     source: source.into(), | ||||
|                     indentation: indent_level, | ||||
|                     bullet: bull.into(), | ||||
|                     tag: Vec::new(), | ||||
|                     tag: maybe_tag | ||||
|                         .map(|(_ws, item_tag, _divider)| item_tag) | ||||
|                         .unwrap_or(Vec::new()), | ||||
|                     children: Vec::new(), | ||||
|                 }, | ||||
|             )); | ||||
|         } | ||||
|         Err(_) => {} | ||||
|     }; | ||||
| 
 | ||||
|     let (remaining, maybe_tag) = opt(tuple(( | ||||
|         space1, | ||||
|         parser_with_context!(item_tag)(context), | ||||
|         tag(" ::"), | ||||
|     )))(remaining)?; | ||||
|     let (remaining, _ws) = item_tag_post_gap(context, remaining)?; | ||||
|     let exit_matcher = plain_list_item_end(indent_level); | ||||
|     let parser_context = context | ||||
| @ -184,11 +187,12 @@ pub fn plain_list_item<'r, 's>( | ||||
|     if !children.is_empty() && !context.should_consume_trailing_whitespace() { | ||||
|         let final_item_context = | ||||
|             parser_context.with_additional_node(ContextElement::ConsumeTrailingWhitespace(false)); | ||||
|         let (final_child_start, _original_final_child) = children.pop().expect("if-statement already checked that children was non-empty."); | ||||
|         let (remain, reparsed_final_element) = | ||||
|             include_input(parser_with_context!(element(true))(&final_item_context))( | ||||
|                 final_child_start, | ||||
|             )?; | ||||
|         let (final_child_start, _original_final_child) = children | ||||
|             .pop() | ||||
|             .expect("if-statement already checked that children was non-empty."); | ||||
|         let (remain, reparsed_final_element) = include_input(parser_with_context!(element(true))( | ||||
|             &final_item_context, | ||||
|         ))(final_child_start)?; | ||||
|         remaining = remain; | ||||
|         children.push(reparsed_final_element); | ||||
|     } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Tom Alexander
						Tom Alexander