inline: disallow whitespace after/before emph
This commit is contained in:
		
					parent
					
						
							
								b78b2866a8
							
						
					
				
			
			
				commit
				
					
						d050c504ae
					
				
			
		
					 1 changed files with 15 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -401,6 +401,14 @@ impl<I: Iterator<Item = char> + Clone> Parser<I> {
 | 
			
		|||
                    if matches!(dir, Dir::Open) {
 | 
			
		||||
                        return None;
 | 
			
		||||
                    }
 | 
			
		||||
                    if matches!(dir, Dir::Both)
 | 
			
		||||
                        && self
 | 
			
		||||
                            .events
 | 
			
		||||
                            .back()
 | 
			
		||||
                            .map_or(false, |ev| matches!(ev.kind, EventKind::Whitespace))
 | 
			
		||||
                    {
 | 
			
		||||
                        return None;
 | 
			
		||||
                    }
 | 
			
		||||
                    let (d, e) = self.openers[o];
 | 
			
		||||
                    let e_attr = e;
 | 
			
		||||
                    let e_opener = e + 1;
 | 
			
		||||
| 
						 | 
				
			
			@ -476,6 +484,13 @@ impl<I: Iterator<Item = char> + Clone> Parser<I> {
 | 
			
		|||
                    if matches!(dir, Dir::Close) {
 | 
			
		||||
                        return None;
 | 
			
		||||
                    }
 | 
			
		||||
                    if matches!(dir, Dir::Both)
 | 
			
		||||
                        && self
 | 
			
		||||
                            .peek()
 | 
			
		||||
                            .map_or(true, |t| matches!(t.kind, lex::Kind::Whitespace))
 | 
			
		||||
                    {
 | 
			
		||||
                        return None;
 | 
			
		||||
                    }
 | 
			
		||||
                    self.openers.push((delim, self.events.len()));
 | 
			
		||||
                    // push dummy event in case attributes are encountered after closing delimiter
 | 
			
		||||
                    self.events.push_back(Event {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue