fixup! block: add MeteredBlock as intermediate struct
This commit is contained in:
		
					parent
					
						
							
								59be7070de
							
						
					
				
			
			
				commit
				
					
						82e1fd74f5
					
				
			
		
					 1 changed files with 10 additions and 12 deletions
				
			
		
							
								
								
									
										22
									
								
								src/block.rs
									
										
									
									
									
								
							
							
						
						
									
										22
									
								
								src/block.rs
									
										
									
									
									
								
							| 
						 | 
					@ -58,9 +58,7 @@ pub enum Leaf {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /// Span is `#` characters.
 | 
					    /// Span is `#` characters.
 | 
				
			||||||
    /// Each inline is a line.
 | 
					    /// Each inline is a line.
 | 
				
			||||||
    Heading {
 | 
					    Heading { has_section: bool },
 | 
				
			||||||
        has_section: bool,
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /// Span is '|'.
 | 
					    /// Span is '|'.
 | 
				
			||||||
    /// Has zero or one inline for the cell contents.
 | 
					    /// Has zero or one inline for the cell contents.
 | 
				
			||||||
| 
						 | 
					@ -189,8 +187,8 @@ impl<'s> TreeParser<'s> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // remove "]:" from footnote / link def
 | 
					            // remove "]:" from footnote / link def
 | 
				
			||||||
            if matches!(kind, Kind::Definition { .. }) {
 | 
					            if matches!(kind, Kind::Definition { .. }) {
 | 
				
			||||||
                assert_eq!(&lines[0].of(self.src).chars().as_str()[0..2], "]:");
 | 
					                assert_eq!(&lines[0].of(self.src)[0..2], "]:");
 | 
				
			||||||
                lines[0] = lines[0].skip(2);
 | 
					                lines[0] = lines[0].skip("]:".len());
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // skip opening and closing fence of code block / div
 | 
					            // skip opening and closing fence of code block / div
 | 
				
			||||||
| 
						 | 
					@ -602,13 +600,13 @@ impl IdentifiedBlock {
 | 
				
			||||||
                    let level = l - chars.as_str().len() - 1;
 | 
					                    let level = l - chars.as_str().len() - 1;
 | 
				
			||||||
                    (Kind::Heading { level }, Span::by_len(indent, level))
 | 
					                    (Kind::Heading { level }, Span::by_len(indent, level))
 | 
				
			||||||
                }),
 | 
					                }),
 | 
				
			||||||
            '>' => chars
 | 
					            '>' => {
 | 
				
			||||||
                .next()
 | 
					                if chars.next().map_or(true, char::is_whitespace) {
 | 
				
			||||||
                .map_or(Some(false), |c| c.is_whitespace().then(|| true))
 | 
					                    Some((Kind::Blockquote, Span::by_len(indent, 1)))
 | 
				
			||||||
                .map(|space_after| {
 | 
					                } else {
 | 
				
			||||||
                    let len = l - chars.as_str().len() - usize::from(space_after);
 | 
					                    None
 | 
				
			||||||
                    (Kind::Blockquote, Span::by_len(indent, len))
 | 
					                }
 | 
				
			||||||
                }),
 | 
					            }
 | 
				
			||||||
            '{' => (attr::valid(line.chars()).0 == lt)
 | 
					            '{' => (attr::valid(line.chars()).0 == lt)
 | 
				
			||||||
                .then(|| (Kind::Atom(Attributes), Span::by_len(indent, l))),
 | 
					                .then(|| (Kind::Atom(Attributes), Span::by_len(indent, l))),
 | 
				
			||||||
            '|' => {
 | 
					            '|' => {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue