|
1 | 1 | use crate::errors::*; |
2 | 2 | use memchr::{self, Memchr}; |
3 | | -use pulldown_cmark::{self, Event, Tag}; |
| 3 | +use pulldown_cmark::{self, Event, HeadingLevel, Tag}; |
4 | 4 | use std::fmt::{self, Display, Formatter}; |
5 | 5 | use std::iter::FromIterator; |
6 | 6 | use std::ops::{Deref, DerefMut}; |
@@ -161,7 +161,7 @@ impl From<Link> for SummaryItem { |
161 | 161 | /// > match the following regex: "[^<>\n[]]+". |
162 | 162 | struct SummaryParser<'a> { |
163 | 163 | src: &'a str, |
164 | | - stream: pulldown_cmark::OffsetIter<'a>, |
| 164 | + stream: pulldown_cmark::OffsetIter<'a, 'a>, |
165 | 165 | offset: usize, |
166 | 166 |
|
167 | 167 | /// We can't actually put an event back into the `OffsetIter` stream, so instead we store it |
@@ -263,7 +263,7 @@ impl<'a> SummaryParser<'a> { |
263 | 263 | loop { |
264 | 264 | match self.next_event() { |
265 | 265 | Some(ev @ Event::Start(Tag::List(..))) |
266 | | - | Some(ev @ Event::Start(Tag::Heading(1))) => { |
| 266 | + | Some(ev @ Event::Start(Tag::Heading(HeadingLevel::H1, ..))) => { |
267 | 267 | if is_prefix { |
268 | 268 | // we've finished prefix chapters and are at the start |
269 | 269 | // of the numbered section. |
@@ -302,10 +302,10 @@ impl<'a> SummaryParser<'a> { |
302 | 302 | break; |
303 | 303 | } |
304 | 304 |
|
305 | | - Some(Event::Start(Tag::Heading(1))) => { |
| 305 | + Some(Event::Start(Tag::Heading(HeadingLevel::H1, ..))) => { |
306 | 306 | debug!("Found a h1 in the SUMMARY"); |
307 | 307 |
|
308 | | - let tags = collect_events!(self.stream, end Tag::Heading(1)); |
| 308 | + let tags = collect_events!(self.stream, end Tag::Heading(HeadingLevel::H1, ..)); |
309 | 309 | Some(stringify_events(tags)) |
310 | 310 | } |
311 | 311 |
|
@@ -375,7 +375,7 @@ impl<'a> SummaryParser<'a> { |
375 | 375 | } |
376 | 376 | // The expectation is that pulldown cmark will terminate a paragraph before a new |
377 | 377 | // heading, so we can always count on this to return without skipping headings. |
378 | | - Some(ev @ Event::Start(Tag::Heading(1))) => { |
| 378 | + Some(ev @ Event::Start(Tag::Heading(HeadingLevel::H1, ..))) => { |
379 | 379 | // we're starting a new part |
380 | 380 | self.back(ev); |
381 | 381 | break; |
@@ -527,10 +527,10 @@ impl<'a> SummaryParser<'a> { |
527 | 527 | fn parse_title(&mut self) -> Option<String> { |
528 | 528 | loop { |
529 | 529 | match self.next_event() { |
530 | | - Some(Event::Start(Tag::Heading(1))) => { |
| 530 | + Some(Event::Start(Tag::Heading(HeadingLevel::H1, ..))) => { |
531 | 531 | debug!("Found a h1 in the SUMMARY"); |
532 | 532 |
|
533 | | - let tags = collect_events!(self.stream, end Tag::Heading(1)); |
| 533 | + let tags = collect_events!(self.stream, end Tag::Heading(HeadingLevel::H1, ..)); |
534 | 534 | return Some(stringify_events(tags)); |
535 | 535 | } |
536 | 536 | // Skip a HTML element such as a comment line. |
|
0 commit comments