Adapt to breaking changes & revert to pulldown-cmark 0.9

This commit is contained in:
Thomas Zahner 2024-04-24 11:35:56 +02:00
parent 8a44241a06
commit e0b4c73987
4 changed files with 10 additions and 17 deletions

11
Cargo.lock generated
View file

@ -3113,23 +3113,16 @@ dependencies = [
[[package]]
name = "pulldown-cmark"
version = "0.10.2"
version = "0.9.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f0530d13d87d1f549b66a3e8d0c688952abe5994e204ed62615baaf25dc029c"
checksum = "57206b407293d2bcd3af849ce869d52068623f19e1b5ff8e8778e3309439682b"
dependencies = [
"bitflags 2.4.1",
"getopts",
"memchr",
"pulldown-cmark-escape",
"unicase",
]
[[package]]
name = "pulldown-cmark-escape"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5d8f9aa0e3cbcfaf8bf00300004ee3b72f74770f9cbac93f6928771f613276b"
[[package]]
name = "pwned"
version = "0.5.0"

View file

@ -1,7 +1,7 @@
use reqwest::{Error, Url};
use serde::{Deserialize, Serialize};
use std::fmt::Display;
use strum::{Display, EnumIter, EnumString, EnumVariantNames};
use strum::{Display, EnumIter, EnumString, VariantNames};
use crate::color::{color, GREEN, PINK};
@ -23,7 +23,7 @@ impl Display for Suggestion {
}
#[non_exhaustive]
#[derive(Debug, Deserialize, Default, Clone, Display, EnumIter, EnumString, EnumVariantNames)]
#[derive(Debug, Deserialize, Default, Clone, Display, EnumIter, EnumString, VariantNames)]
pub(crate) enum Archive {
#[serde(rename = "wayback")]
#[strum(serialize = "wayback", ascii_case_insensitive)]

View file

@ -33,7 +33,7 @@ once_cell = "1.19.0"
openssl-sys = { version = "0.9.102", optional = true }
path-clean = "1.0.1"
percent-encoding = "2.3.1"
pulldown-cmark = "0.10.2"
pulldown-cmark = "0.9.6"
regex = "1.10.4"
# Use trust-dns to avoid lookup failures on high concurrency
# https://github.com/seanmonstar/reqwest/issues/296

View file

@ -166,7 +166,7 @@ impl LinkExtractor {
/// Extract unparsed URL strings from an HTML string.
pub(crate) fn extract_html(buf: &str, include_verbatim: bool) -> Vec<RawUri> {
let mut input = BufferQueue::new();
let mut input = BufferQueue::default();
input.push_back(StrTendril::from(buf));
let mut tokenizer = Tokenizer::new(
@ -267,9 +267,9 @@ mod tests {
#[test]
fn test_include_nofollow() {
let input = r#"
<a rel="nofollow" href="https://foo.com">do not follow me</a>
<a rel="canonical,nofollow,dns-prefetch" href="https://example.com">do not follow me</a>
<a href="https://example.org">do not follow me</a>
<a rel="nofollow" href="https://foo.com">do not follow me</a>
<a rel="canonical,nofollow,dns-prefetch" href="https://example.com">do not follow me</a>
<a href="https://example.org">do not follow me</a>
"#;
let expected = vec![RawUri {
text: "https://example.org".to_string(),
@ -286,7 +286,7 @@ mod tests {
<script>
var foo = "https://example.com";
</script>
<a href="https://example.org">i'm fine</a>
<a href="https://example.org">i'm fine</a>
"#;
let expected = vec![RawUri {
text: "https://example.org".to_string(),