My static site generator
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

36 lines
736 B

use std::path::PathBuf;
use extract_frontmatter::Extractor;
pub struct DocumentInfo {
pub title: String,
pub content: String,
}
pub enum Page {
Basic { path: PathBuf, meta: DocumentInfo },
Unknown { path: PathBuf },
}
pub fn load_page(path: PathBuf) -> Option<Page> {
if !path.exists() || !path.is_file() {
return None;
}
if let Some(ext) = path.extension() {
if ["md", "gmi"].contains(&ext.to_string_lossy().as_ref()) {
return Some(Page::Basic {
path,
meta: DocumentInfo {
title: String::from("Meow"),
content: String::from(""),
},
});
}
}
Some(Page::Unknown { path })
}
pub fn load_document_info(path: &PathBuf) -> Option<DocumentInfo> {
let mut extractor = Extractor::new(path.re)
}