If its not a markdown file just return the file name itself, because then it's probably a directory.
This commit is contained in:
@@ -321,7 +321,12 @@ fn render_markdown (content: &tera::Value, args: &HashMap<String, tera::Value>)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn file_stem (content: &tera::Value, args: &HashMap<String, tera::Value>) -> tera::Result<tera::Value> {
|
fn file_stem (content: &tera::Value, args: &HashMap<String, tera::Value>) -> tera::Result<tera::Value> {
|
||||||
Ok(tera::Value::String(Path::new(content.as_str().expect("as_str")).file_stem().expect("file_stem").to_str().expect("to_str").to_owned()))
|
let content_as_str = content.as_str().expect("as_str");
|
||||||
|
if !content_as_str.ends_with(MD_EXTENSION) {
|
||||||
|
Ok(content.clone())
|
||||||
|
} else {
|
||||||
|
Ok(tera::Value::String(Path::new(content_as_str).file_stem().expect("file_stem").to_str().expect("to_str").to_owned()))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PageRenderer {
|
impl PageRenderer {
|
||||||
|
|||||||
Reference in New Issue
Block a user