Fix no initial title consuming events.
This commit is contained in:
parent
2213312938
commit
81d661c4f1
|
@ -536,6 +536,10 @@ impl<'a> SummaryParser<'a> {
|
|||
// Skip a HTML element such as a comment line.
|
||||
Some(Event::Html(_)) => {}
|
||||
// Otherwise, no title.
|
||||
Some(ev) => {
|
||||
self.back(ev);
|
||||
return None;
|
||||
}
|
||||
_ => return None,
|
||||
}
|
||||
}
|
||||
|
@ -647,6 +651,15 @@ mod tests {
|
|||
assert_eq!(got, should_be);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_initial_title() {
|
||||
let src = "[Link]()";
|
||||
let mut parser = SummaryParser::new(src);
|
||||
|
||||
assert!(parser.parse_title().is_none());
|
||||
assert!(matches!(parser.next_event(), Some(Event::Start(Tag::Paragraph))));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_title_with_styling() {
|
||||
let src = "# My **Awesome** Summary";
|
||||
|
|
Loading…
Reference in New Issue