Implement the new fields for fixed width area.
This commit is contained in:
		
							parent
							
								
									f192507cd9
								
							
						
					
					
						commit
						3962db12a8
					
				| @ -139,7 +139,7 @@ fn assert_post_blank<'b, 's, S: StandardProperties<'s> + ?Sized>( | ||||
|         .post_blank | ||||
|         .ok_or("Token should have a post-blank.")?; | ||||
|     if rust_post_blank as usize != emacs_post_blank { | ||||
|         Err(format!("Rust post-blank (in chars) {rust_post_blank} does not match emacs post-blank ({emacs_post_blank})", rust_post_blank = rust_post_blank, emacs_post_blank = emacs_post_blank))?; | ||||
|         Err(format!("Rust post-blank {rust_post_blank} does not match emacs post-blank ({emacs_post_blank})", rust_post_blank = rust_post_blank, emacs_post_blank = emacs_post_blank))?; | ||||
|     } | ||||
| 
 | ||||
|     Ok(()) | ||||
|  | ||||
| @ -41,7 +41,7 @@ where | ||||
|     let (remaining, mut remaining_lines) = | ||||
|         many0(preceded(not(exit_matcher), fixed_width_area_line_matcher))(remaining)?; | ||||
| 
 | ||||
|     let (remaining, _trailing_ws) = | ||||
|     let (remaining, post_blank) = | ||||
|         maybe_consume_trailing_whitespace_if_not_exiting(context, remaining)?; | ||||
|     let source = get_consumed(input, remaining); | ||||
|     let mut value = Vec::with_capacity(remaining_lines.len() + 1); | ||||
| @ -66,6 +66,7 @@ where | ||||
|                 affiliated_keywords, | ||||
|             ), | ||||
|             value, | ||||
|             post_blank: post_blank.map(Into::<&str>::into), | ||||
|         }, | ||||
|     )) | ||||
| } | ||||
|  | ||||
| @ -148,6 +148,7 @@ pub struct FixedWidthArea<'s> { | ||||
|     pub source: &'s str, | ||||
|     pub affiliated_keywords: AffiliatedKeywords<'s>, | ||||
|     pub value: Vec<&'s str>, | ||||
|     pub post_blank: Option<&'s str>, | ||||
| } | ||||
| 
 | ||||
| #[derive(Debug)] | ||||
| @ -403,11 +404,15 @@ impl<'s> StandardProperties<'s> for FixedWidthArea<'s> { | ||||
|     } | ||||
| 
 | ||||
|     fn get_contents<'b>(&'b self) -> Option<&'s str> { | ||||
|         todo!() | ||||
|         None | ||||
|     } | ||||
| 
 | ||||
|     fn get_post_blank(&self) -> PostBlank { | ||||
|         todo!() | ||||
|         self.post_blank | ||||
|             .map(|text| text.lines().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