fixup! e18f24b99d70338014ab8e4031fad9a17b167b8f
This commit is contained in:
		
					parent
					
						
							
								5755616870
							
						
					
				
			
			
				commit
				
					
						75b13597da
					
				
			
		
					 2 changed files with 14 additions and 1 deletions
				
			
		
							
								
								
									
										11
									
								
								src/lib.rs
									
										
									
									
									
								
							
							
						
						
									
										11
									
								
								src/lib.rs
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -359,7 +359,16 @@ impl<'s> Iterator for Parser<'s> {
 | 
			
		|||
            tree::EventKind::Enter(block) => {
 | 
			
		||||
                if matches!(block, block::Block::Leaf(l)) {
 | 
			
		||||
                    self.parser = Some(inline::Parser::new());
 | 
			
		||||
                    self.inline_start = ev.span.start();
 | 
			
		||||
                }
 | 
			
		||||
                match block {
 | 
			
		||||
                    block::Block::Leaf(block::Leaf::Paragraph) => self.inline_start = ev.span.end(),
 | 
			
		||||
                    block::Block::Leaf(block::Leaf::CodeBlock { .. }) => {
 | 
			
		||||
                        let lang = self.tree.next().unwrap();
 | 
			
		||||
                        self.inline_start = lang.span.end();
 | 
			
		||||
                        let lang = (!lang.span.is_empty()).then(|| lang.span.of(self.src).trim());
 | 
			
		||||
                        return Event::Start(Container::CodeBlock { lang }, Attributes::none());
 | 
			
		||||
                    }
 | 
			
		||||
                    _ => {}
 | 
			
		||||
                }
 | 
			
		||||
                Event::Start(Container::from_block(self.src, block), Attributes::none())
 | 
			
		||||
            }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -47,6 +47,10 @@ impl Span {
 | 
			
		|||
        Self::new(self.start(), span.end())
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pub fn is_empty(self) -> bool {
 | 
			
		||||
        self.start == self.end
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pub fn start(self) -> usize {
 | 
			
		||||
        self.start.try_into().unwrap()
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue