2023-08-27 20:17:16 -05:00
|
|
|
use tera::Tera;
|
|
|
|
|
|
|
|
pub mod markdown;
|
|
|
|
pub mod page_gen;
|
2024-04-12 10:46:54 -05:00
|
|
|
pub mod syntax;
|
2023-08-27 20:17:16 -05:00
|
|
|
|
|
|
|
pub trait TemplateRenderer {
|
|
|
|
fn render_template(&self, tera: &Tera) -> anyhow::Result<String>;
|
|
|
|
}
|
2023-09-20 16:56:12 -05:00
|
|
|
|
|
|
|
|
|
|
|
pub fn iter_dir<F>(path: &std::path::PathBuf, phandler: &F) -> anyhow::Result<()>
|
|
|
|
where
|
|
|
|
F: Fn(&std::fs::DirEntry) -> anyhow::Result<()>,
|
|
|
|
{
|
|
|
|
for item in std::fs::read_dir(path)? {
|
|
|
|
let entry = item?;
|
|
|
|
if entry.file_type()?.is_dir() {
|
|
|
|
iter_dir(&entry.path(), phandler)?;
|
|
|
|
} else {
|
|
|
|
phandler(&entry)?;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Ok(())
|
|
|
|
}
|