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",
"handlebars",
"hotwatch",
"http",
"lol_html",
"pulldown-cmark",
"serde",
"serde_yaml",
"tokio",
"url",
"walkdir",
"warp",
]

View file

@ -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 }

View file

@ -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")?;
}