mirror of https://github.com/hamaluik/mkbook
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
471 B
Rust
23 lines
471 B
Rust
use serde::Deserialize;
|
|
|
|
#[derive(Deserialize, Default, Debug)]
|
|
pub struct ParsedFrontMatter {
|
|
pub title: Option<String>,
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
pub struct FrontMatter {
|
|
pub title: String,
|
|
}
|
|
|
|
impl ParsedFrontMatter {
|
|
pub fn into_front(&self, file_name: &str) -> FrontMatter {
|
|
FrontMatter {
|
|
title: match &self.title {
|
|
Some(title) => title.clone(),
|
|
None => file_name.to_owned(),
|
|
},
|
|
}
|
|
}
|
|
}
|