Implement the new fields for target.
This commit is contained in:
		
							parent
							
								
									33ca43ca40
								
							
						
					
					
						commit
						6b802d36bf
					
				
							
								
								
									
										3
									
								
								org_mode_samples/object/target/simple.org
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								org_mode_samples/object/target/simple.org
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,3 @@ | ||||
| <<FOO>> bar | ||||
| 
 | ||||
| [[FOO][baz]] | ||||
| @ -46,7 +46,7 @@ pub(crate) fn target<'b, 'g, 'r, 's>( | ||||
|         ))); | ||||
|     } | ||||
|     let (remaining, _) = tag(">>")(remaining)?; | ||||
|     let (remaining, _trailing_whitespace) = | ||||
|     let (remaining, post_blank) = | ||||
|         maybe_consume_object_trailing_whitespace_if_not_exiting(context, remaining)?; | ||||
|     let source = get_consumed(input, remaining); | ||||
| 
 | ||||
| @ -55,6 +55,7 @@ pub(crate) fn target<'b, 'g, 'r, 's>( | ||||
|         Target { | ||||
|             source: source.into(), | ||||
|             value: body.into(), | ||||
|             post_blank: post_blank.map(Into::<&str>::into), | ||||
|         }, | ||||
|     )) | ||||
| } | ||||
|  | ||||
| @ -266,6 +266,7 @@ pub struct LineBreak<'s> { | ||||
| pub struct Target<'s> { | ||||
|     pub source: &'s str, | ||||
|     pub value: &'s str, | ||||
|     pub post_blank: Option<&'s str>, | ||||
| } | ||||
| 
 | ||||
| #[derive(Debug)] | ||||
| @ -923,11 +924,15 @@ impl<'s> StandardProperties<'s> for Target<'s> { | ||||
|     } | ||||
| 
 | ||||
|     fn get_contents<'b>(&'b self) -> Option<&'s str> { | ||||
|         todo!() | ||||
|         None | ||||
|     } | ||||
| 
 | ||||
|     fn get_post_blank(&self) -> PostBlank { | ||||
|         todo!() | ||||
|         self.post_blank | ||||
|             .map(|post_blank| post_blank.chars().count()) | ||||
|             .unwrap_or(0) | ||||
|             .try_into() | ||||
|             .expect("Too much post-blank to fit into a PostBlank.") | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Tom Alexander
						Tom Alexander