typegen: fix callout bug which didn't add newlines
This commit is contained in:
		
							parent
							
								
									cf3ef03c42
								
							
						
					
					
						commit
						2fde54b3bc
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		| 
						 | 
					@ -17,13 +17,13 @@ pub struct GfmQuoteBlocks {
 | 
				
			||||||
impl GfmQuoteBlocks {
 | 
					impl GfmQuoteBlocks {
 | 
				
			||||||
		pub fn new() -> Self {
 | 
							pub fn new() -> Self {
 | 
				
			||||||
				Self {
 | 
									Self {
 | 
				
			||||||
						callout_regex: Regex::new(r#">\s+\[!(?<type>\w+)]\s+(?=\w)"#).unwrap()
 | 
											callout_regex: Regex::new(r#">\s+\[!(?<type>\w+)]\s+"#).unwrap()
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
impl ReformatPass for GfmQuoteBlocks {
 | 
					impl ReformatPass for GfmQuoteBlocks {
 | 
				
			||||||
		fn reformat(&self, _: &Context, text: &mut String) {
 | 
						fn reformat(&self, _: &Context, text: &mut String) {
 | 
				
			||||||
		*text = text.replace("> [!INFO]", "> [!NOTE]");
 | 
							*text = text.replace("> [!INFO]", "> [!NOTE]");
 | 
				
			||||||
		*text = self.callout_regex.replace_all(text, "> [!$type]\n> ").to_string();
 | 
							*text = self.callout_regex.replace_all(text, "> [!$type]\n> ").to_string();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue