diff --git a/lychee-lib/src/collector.rs b/lychee-lib/src/collector.rs index 8daa0d3..d9ff9ae 100644 --- a/lychee-lib/src/collector.rs +++ b/lychee-lib/src/collector.rs @@ -319,7 +319,6 @@ mod tests { website("https://example.com/css/style_relative_url.css"), website("https://example.com/head/home"), website("https://example.com/images/icon.png"), - website("https://example.com/js/script.js"), ]); assert_eq!(links, expected_links); diff --git a/lychee-lib/src/extract/html5ever.rs b/lychee-lib/src/extract/html5ever.rs index 7674618..c7d2a23 100644 --- a/lychee-lib/src/extract/html5ever.rs +++ b/lychee-lib/src/extract/html5ever.rs @@ -228,4 +228,21 @@ mod tests { let uris = extract_html(input, false); assert_eq!(uris, expected); } + + #[test] + fn test_exclude_script_tags() { + let input = r#" + + i'm fine + "#; + let expected = vec![RawUri { + text: "https://example.org".to_string(), + element: Some("a".to_string()), + attribute: Some("href".to_string()), + }]; + let uris = extract_html(input, false); + assert_eq!(uris, expected); + } } diff --git a/lychee-lib/src/extract/html5gum.rs b/lychee-lib/src/extract/html5gum.rs index e641375..624f289 100644 --- a/lychee-lib/src/extract/html5gum.rs +++ b/lychee-lib/src/extract/html5gum.rs @@ -316,4 +316,21 @@ mod tests { let uris = extract_html(input, false); assert_eq!(uris, expected); } + + #[test] + fn test_exclude_script_tags() { + let input = r#" + + i'm fine + "#; + let expected = vec![RawUri { + text: "https://example.org".to_string(), + element: Some("a".to_string()), + attribute: Some("href".to_string()), + }]; + let uris = extract_html(input, false); + assert_eq!(uris, expected); + } } diff --git a/lychee-lib/src/extract/mod.rs b/lychee-lib/src/extract/mod.rs index 1c41666..20f9fe6 100644 --- a/lychee-lib/src/extract/mod.rs +++ b/lychee-lib/src/extract/mod.rs @@ -11,10 +11,13 @@ use plaintext::extract_plaintext; /// Check if the given element is in the list of preformatted ("verbatim") tags. /// /// These will be excluded from link checking by default. +// Including the