zola/components/rendering/tests/common/mod.rs
Sam Vente dde3531fd9
Make sure that zola serve/build can start from anywhere inside dir tree (#1761)
* 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
2022-03-03 12:35:29 +01:00

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" })
}
}