Compare commits
3 Commits
71e5bfe4be
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
39d838a284
|
||
|
|
1c369e4b25
|
||
|
|
694052d33d
|
@@ -1,3 +1,4 @@
|
|||||||
|
use std::path::NormalizeError;
|
||||||
use std::str::Utf8Error;
|
use std::str::Utf8Error;
|
||||||
use std::string::FromUtf8Error;
|
use std::string::FromUtf8Error;
|
||||||
|
|
||||||
@@ -16,6 +17,7 @@ pub(crate) enum CustomError {
|
|||||||
DusterRender(#[allow(dead_code)] duster::renderer::RenderError),
|
DusterRender(#[allow(dead_code)] duster::renderer::RenderError),
|
||||||
PathStripPrefix(#[allow(dead_code)] std::path::StripPrefixError),
|
PathStripPrefix(#[allow(dead_code)] std::path::StripPrefixError),
|
||||||
UrlParseError(#[allow(dead_code)] url::ParseError),
|
UrlParseError(#[allow(dead_code)] url::ParseError),
|
||||||
|
NormalizeError(#[allow(dead_code)] NormalizeError),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<std::io::Error> for CustomError {
|
impl From<std::io::Error> for CustomError {
|
||||||
@@ -95,3 +97,9 @@ impl From<url::ParseError> for CustomError {
|
|||||||
CustomError::UrlParseError(value)
|
CustomError::UrlParseError(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<NormalizeError> for CustomError {
|
||||||
|
fn from(value: NormalizeError) -> Self {
|
||||||
|
CustomError::NormalizeError(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -74,7 +74,9 @@ impl LinkTarget {
|
|||||||
// If link type is file and the path ends in .svg then make it an image target
|
// If link type is file and the path ends in .svg then make it an image target
|
||||||
if let LinkType::File = link_type
|
if let LinkType::File = link_type
|
||||||
&& (input.to_ascii_lowercase().ends_with(".svg")
|
&& (input.to_ascii_lowercase().ends_with(".svg")
|
||||||
|| input.to_ascii_lowercase().ends_with(".png"))
|
|| input.to_ascii_lowercase().ends_with(".png")
|
||||||
|
|| input.to_ascii_lowercase().ends_with(".avif")
|
||||||
|
|| input.to_ascii_lowercase().ends_with(".webp"))
|
||||||
{
|
{
|
||||||
let src = Self::get_image_src(&input)?;
|
let src = Self::get_image_src(&input)?;
|
||||||
let alt = Self::get_image_alt(&input)?;
|
let alt = Self::get_image_alt(&input)?;
|
||||||
@@ -151,7 +153,7 @@ impl LinkTarget {
|
|||||||
.unwrap()
|
.unwrap()
|
||||||
.get_current_folder()?
|
.get_current_folder()?
|
||||||
.join(src)
|
.join(src)
|
||||||
.canonicalize()?;
|
.normalize_lexically()?;
|
||||||
let input_root_directory = render_context.config.get_root_directory();
|
let input_root_directory = render_context.config.get_root_directory();
|
||||||
let relative_path_to_file = path_to_file.strip_prefix(input_root_directory)?;
|
let relative_path_to_file = path_to_file.strip_prefix(input_root_directory)?;
|
||||||
let web_path = get_web_path(
|
let web_path = get_web_path(
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#![feature(normalize_lexically)]
|
||||||
use std::process::ExitCode;
|
use std::process::ExitCode;
|
||||||
|
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
|
|||||||
Reference in New Issue
Block a user