Update minify-html dependency to version 0.4.2 (#1340)
* Update minify-html dependency to version 0.4.2 Fixes https://github.com/getzola/zola/issues/1300. See also https://github.com/wilsonzlin/minify-html/issues/21 * Update minify-html dependency in Cargo.lock * Add test to check pre whitespace isn't collapsed
This commit is contained in:
parent
53456bd052
commit
a65a2d52c7
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -1388,9 +1388,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "minify-html"
|
||||
version = "0.4.1"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "345dcbf4663db7d3a78a6e6b6c279c8bb6c32d6365cd98da977d7f7543b6c167"
|
||||
checksum = "d7af79ea8ac719a1cc299787058518a12018700af7ec7be4b789930526e1a1ab"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"lazy_static",
|
||||
|
|
|
@ -15,7 +15,7 @@ serde_derive = "1"
|
|||
slug = "0.1"
|
||||
percent-encoding = "2"
|
||||
filetime = "0.2.12"
|
||||
minify-html = "0.4"
|
||||
minify-html = "0.4.2"
|
||||
|
||||
errors = { path = "../errors" }
|
||||
|
||||
|
|
|
@ -59,4 +59,35 @@ mod tests {
|
|||
let res = html(input.to_owned()).unwrap();
|
||||
assert_eq!(res, expected);
|
||||
}
|
||||
|
||||
// https://github.com/getzola/zola/issues/1300
|
||||
#[test]
|
||||
fn can_minify_and_preserve_whitespace_in_pre_elements() {
|
||||
let input = r#"
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<pre><code>fn main() {
|
||||
println!("Hello, world!");
|
||||
<span>loop {
|
||||
println!("Hello, world!");
|
||||
}</span>
|
||||
}
|
||||
</code></pre>
|
||||
</body>
|
||||
</html>
|
||||
"#;
|
||||
let expected = r#"<!doctype html><html><head><meta charset=utf-8><body><pre><code>fn main() {
|
||||
println!("Hello, world!");
|
||||
<span>loop {
|
||||
println!("Hello, world!");
|
||||
}</span>
|
||||
}
|
||||
</code></pre>"#;
|
||||
let res = html(input.to_owned()).unwrap();
|
||||
assert_eq!(res, expected);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue