Clean up.
This commit is contained in:
@@ -4,7 +4,12 @@ use std::path::Path;
|
|||||||
use image::ImageReader;
|
use image::ImageReader;
|
||||||
use markdown;
|
use markdown;
|
||||||
|
|
||||||
pub fn to_webp(path: &Path) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn to_webp<P>(path: P) -> Result<(), Box<dyn std::error::Error>>
|
||||||
|
where
|
||||||
|
P: AsRef<Path>,
|
||||||
|
{
|
||||||
|
let path = path.as_ref();
|
||||||
|
|
||||||
ImageReader::open(path)?.decode()?.save(format!(
|
ImageReader::open(path)?.decode()?.save(format!(
|
||||||
"{}.webp",
|
"{}.webp",
|
||||||
path.file_stem().unwrap().to_str().unwrap()
|
path.file_stem().unwrap().to_str().unwrap()
|
||||||
@@ -13,7 +18,10 @@ pub fn to_webp(path: &Path) -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn md_to_html(path: &Path) -> Result<String, markdown::message::Message> {
|
pub fn md_to_html<P>(path: P) -> Result<String, markdown::message::Message>
|
||||||
|
where
|
||||||
|
P: AsRef<Path>,
|
||||||
|
{
|
||||||
let mut buf = String::new();
|
let mut buf = String::new();
|
||||||
|
|
||||||
// Loading and Converting post.md to html
|
// Loading and Converting post.md to html
|
||||||
|
|||||||
Reference in New Issue
Block a user