From 22e41db38cf4157f9c99bf1b95a5cf3a2bea58a1 Mon Sep 17 00:00:00 2001 From: Zoey Date: Sat, 21 Aug 2021 00:47:13 -0700 Subject: [PATCH] Maybe speed up compilation a bit? --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/builder.rs | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4ee7c48..77bd427 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2148,12 +2148,12 @@ dependencies = [ "gray_matter", "handlebars", "hotwatch", - "http", "lol_html", "pulldown-cmark", "serde", "serde_yaml", "tokio", + "url", "walkdir", "warp", ] diff --git a/Cargo.toml b/Cargo.toml index c2a2574..8fab82e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,12 +12,12 @@ grass = "0.10" gray_matter = "0.2" handlebars = "4.1" hotwatch = { version = "0.4", optional = true } -http = "0.2" lol_html = "0.3" pulldown-cmark = { version = "0.8", default-features = false, features = ["simd"] } serde = { version = "1", features = ["derive"] } serde_yaml = "0.8" tokio = { version = "1.10", features = ["macros", "rt-multi-thread"], optional = true } +url = "2.2" walkdir = "2" warp = { version = "0.3", optional = true } diff --git a/src/builder.rs b/src/builder.rs index 2be829b..d349d43 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -1,14 +1,14 @@ //! Module containing the site builder. -use std::{path::PathBuf, str::FromStr}; +use std::path::PathBuf; use anyhow::Context; use gray_matter::{engine::YAML, Matter}; use handlebars::Handlebars; -use http::Uri; use lol_html::{element, html_content::ContentType, HtmlRewriter, Settings}; use pulldown_cmark::{Options, Parser}; use serde::Serialize; +use url::Url; use walkdir::WalkDir; use crate::{util, PageMetadata, Site, ROOT_PATH, SASS_PATH, STATIC_PATH}; @@ -155,8 +155,8 @@ impl<'a> SiteBuilder<'a> { }), element!("a", |el| { if let Some(href) = el.get_attribute("href") { - if let Ok(uri) = Uri::from_str(&href) { - if uri.host().is_some() { + if let Ok(href) = Url::parse(&href) { + if href.host().is_some() { el.set_attribute("rel", "noopener noreferrer")?; el.set_attribute("target", "_blank")?; }