Skip to content

Commit

Permalink
build(deps): update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
camshaft committed Oct 17, 2024
1 parent 3ea0e5c commit 5ddb877
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
branches:
- main

schedule:
# run every morning at 10am Pacific Time
- cron: '0 17 * * *'

name: ci

env:
Expand All @@ -15,7 +19,7 @@ env:
RUST_BACKTRACE: 1
# Pin the nightly toolchain to prevent breakage.
# This should be occasionally updated.
RUST_NIGHTLY_TOOLCHAIN: nightly-2023-10-06
RUST_NIGHTLY_TOOLCHAIN: nightly-2024-10-07

jobs:
env:
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ fnv = { version = "1", default-features = false }
glob = "0.3"
lazy_static = "1"
pathdiff = "0.2"
pulldown-cmark = { version = "0.9", default-features = false }
pulldown-cmark = { version = "0.12", default-features = false }
rayon = "1"
regex = "1"
reqwest = { version = "0.11", features = ["blocking", "native-tls"] }
reqwest = { version = "0.12", features = ["blocking", "native-tls"] }
serde = { version = "1", features = ["derive"] }
slug = { version = "0.1" }
structopt = "0.3"
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.65.0
1.81.0
25 changes: 14 additions & 11 deletions src/specification/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ enum Token<'a> {
struct Lex<'a> {
contents: &'a str,
lines: Peekable<LinesIter<'a>>,
cmark: Peekable<pulldown_cmark::OffsetIter<'a, 'a>>,
cmark: Peekable<pulldown_cmark::OffsetIter<'a>>,
next_line: Option<Str<'a>>,
next_token: Option<Token<'a>>,
}
Expand Down Expand Up @@ -69,7 +69,7 @@ impl<'a> Iterator for Lex<'a> {
type Item = Token<'a>;

fn next(&mut self) -> Option<Self::Item> {
use pulldown_cmark::{Event::*, HeadingLevel::*, Tag::*};
use pulldown_cmark::{Event::*, HeadingLevel::*, Tag, TagEnd};

let mut header_buffer = None;
let mut text_buffer: Option<(usize, Range<usize>)> = None;
Expand All @@ -92,20 +92,26 @@ impl<'a> Iterator for Lex<'a> {
}) {
match event {
// start buffering the header contents
Start(Heading(_, _, _)) => {
header_buffer = Some((line.line, line.range()));
Start(Tag::Heading { id, .. }) => {
// convert the fragment to a Str
let fragment = id.and_then(|f| line.substr(&f));
header_buffer = Some((line.line, line.range(), fragment));
}
// we're done parsing the header
End(Heading(level, fragment, _classes)) => {
End(TagEnd::Heading(level)) => {
// consume any lines captured by the header
while self
.lines
.next_if(|line| line.pos < event_range.end)
.is_some()
{}

let fragment = header_buffer
.as_ref()
.and_then(|(_, _, fragment)| *fragment);

// convert the header buffer into a Str
let line = if let Some((line_num, mut buf)) = header_buffer {
let line = if let Some((line_num, mut buf, _)) = header_buffer {
let r = line.range();
buf.start = r.start.min(buf.start);
buf.end = r.end.max(buf.end);
Expand All @@ -114,9 +120,6 @@ impl<'a> Iterator for Lex<'a> {
line
};

// convert the fragment to a Str
let fragment = fragment.and_then(|f| line.substr(f));

// convert the text buffer range to a Str
let name = if let Some((line_num, mut buf)) = text_buffer {
buf.end = line.range().end.max(buf.end);
Expand All @@ -142,12 +145,12 @@ impl<'a> Iterator for Lex<'a> {
});
}
// insert a token break before returning the line
Start(Item) => {
Start(Tag::Item) => {
self.next_line = Some(line);
return Some(Token::Break);
}
// insert a token break after returning the item line
End(Item) => {
End(TagEnd::Item) => {
self.next_token = Some(Token::Break);
}
// buffer the text if we're parsing a header
Expand Down

0 comments on commit 5ddb877

Please sign in to comment.