mirror of
https://github.com/getzola/zola
synced 2025-01-07 09:28:47 +00:00
dde3531fd9
* Make sure that zola serve/build can start from anywhere inside dir tree * make clippy and rustfmt a bit happier * replace unecessary if-else with unwrap_or and display which path could not get canonicalized if it fails at startup * canonicalize config_path to avoid crash when config.toml changes
18 lines
445 B
Rust
18 lines
445 B
Rust
#![allow(dead_code)]
|
|
|
|
pub struct ShortCode {
|
|
pub name: &'static str,
|
|
pub output: &'static str,
|
|
pub is_md: bool,
|
|
}
|
|
|
|
impl ShortCode {
|
|
pub const fn new(name: &'static str, output: &'static str, is_md: bool) -> ShortCode {
|
|
ShortCode { name, output, is_md }
|
|
}
|
|
|
|
/// Return filename for shortcode
|
|
pub fn filename(&self) -> String {
|
|
format!("{}.{}", self.name, if self.is_md { "md" } else { "html" })
|
|
}
|
|
}
|