This commit is contained in:
Sam Denty 2021-01-30 18:03:06 +00:00
parent 5987817f22
commit c44b881e69
No known key found for this signature in database
GPG key ID: F3E9308D4A43BC0E
2 changed files with 4 additions and 1 deletions

View file

@ -3,7 +3,7 @@ name = "site_icons"
version = "0.1.0" version = "0.1.0"
authors = ["Sam Denty <sam@samdenty.com>"] authors = ["Sam Denty <sam@samdenty.com>"]
edition = "2018" edition = "2018"
license = "gpl-3.0" license = "GPL-3.0"
homepage = "https://github.com/samdenty/site_icons" homepage = "https://github.com/samdenty/site_icons"
repository = "https://github.com/samdenty/site_icons" repository = "https://github.com/samdenty/site_icons"
documentation = "https://docs.rs/site_icons" documentation = "https://docs.rs/site_icons"

View file

@ -28,6 +28,9 @@ pub fn encode_svg(svg: &str) -> String {
svg.into() svg.into()
}; };
// use single quotes instead of double to avoid encoding.
let encoded = regex!("\"").replace_all(&encoded, "'");
// remove whitespace // remove whitespace
let encoded = regex!(r">\s{1,}</g").replace_all(&encoded, "><"); let encoded = regex!(r">\s{1,}</g").replace_all(&encoded, "><");
let encoded = regex!(r"\s{2,}").replace_all(&encoded, " "); let encoded = regex!(r"\s{2,}").replace_all(&encoded, " ");