Maybe speed up compilation a bit?

This commit is contained in:
Zoey 2021-08-21 00:47:13 -07:00
parent 35a9cbcf13
commit 22e41db38c
3 changed files with 6 additions and 6 deletions

2
Cargo.lock generated
View file

@ -2148,12 +2148,12 @@ dependencies = [
"gray_matter", "gray_matter",
"handlebars", "handlebars",
"hotwatch", "hotwatch",
"http",
"lol_html", "lol_html",
"pulldown-cmark", "pulldown-cmark",
"serde", "serde",
"serde_yaml", "serde_yaml",
"tokio", "tokio",
"url",
"walkdir", "walkdir",
"warp", "warp",
] ]

View file

@ -12,12 +12,12 @@ grass = "0.10"
gray_matter = "0.2" gray_matter = "0.2"
handlebars = "4.1" handlebars = "4.1"
hotwatch = { version = "0.4", optional = true } hotwatch = { version = "0.4", optional = true }
http = "0.2"
lol_html = "0.3" lol_html = "0.3"
pulldown-cmark = { version = "0.8", default-features = false, features = ["simd"] } pulldown-cmark = { version = "0.8", default-features = false, features = ["simd"] }
serde = { version = "1", features = ["derive"] } serde = { version = "1", features = ["derive"] }
serde_yaml = "0.8" serde_yaml = "0.8"
tokio = { version = "1.10", features = ["macros", "rt-multi-thread"], optional = true } tokio = { version = "1.10", features = ["macros", "rt-multi-thread"], optional = true }
url = "2.2"
walkdir = "2" walkdir = "2"
warp = { version = "0.3", optional = true } warp = { version = "0.3", optional = true }

View file

@ -1,14 +1,14 @@
//! Module containing the site builder. //! Module containing the site builder.
use std::{path::PathBuf, str::FromStr}; use std::path::PathBuf;
use anyhow::Context; use anyhow::Context;
use gray_matter::{engine::YAML, Matter}; use gray_matter::{engine::YAML, Matter};
use handlebars::Handlebars; use handlebars::Handlebars;
use http::Uri;
use lol_html::{element, html_content::ContentType, HtmlRewriter, Settings}; use lol_html::{element, html_content::ContentType, HtmlRewriter, Settings};
use pulldown_cmark::{Options, Parser}; use pulldown_cmark::{Options, Parser};
use serde::Serialize; use serde::Serialize;
use url::Url;
use walkdir::WalkDir; use walkdir::WalkDir;
use crate::{util, PageMetadata, Site, ROOT_PATH, SASS_PATH, STATIC_PATH}; use crate::{util, PageMetadata, Site, ROOT_PATH, SASS_PATH, STATIC_PATH};
@ -155,8 +155,8 @@ impl<'a> SiteBuilder<'a> {
}), }),
element!("a", |el| { element!("a", |el| {
if let Some(href) = el.get_attribute("href") { if let Some(href) = el.get_attribute("href") {
if let Ok(uri) = Uri::from_str(&href) { if let Ok(href) = Url::parse(&href) {
if uri.host().is_some() { if href.host().is_some() {
el.set_attribute("rel", "noopener noreferrer")?; el.set_attribute("rel", "noopener noreferrer")?;
el.set_attribute("target", "_blank")?; el.set_attribute("target", "_blank")?;
} }