alphabetical order

This commit is contained in:
Mylloon 2024-01-24 12:40:14 +01:00
parent 978cc48a57
commit 17850ae636
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -60,9 +60,9 @@ pub struct FileMetadataPortfolio {
/// List of available metadata types
pub enum TypeFileMetadata {
Generic,
Blog,
Contact,
Generic,
Portfolio,
}
@ -226,9 +226,6 @@ pub fn get_metadata<'a>(root: &'a AstNode<'a>, mtype: TypeFileMetadata) -> FileM
.find_map(|node| match &node.data.borrow().value {
// Extract metadata from frontmatter
NodeValue::FrontMatter(text) => Some(match mtype {
TypeFileMetadata::Generic => FileMetadata {
..FileMetadata::default()
},
TypeFileMetadata::Blog => FileMetadata {
blog: Some(deserialize_metadata(text)),
..FileMetadata::default()
@ -246,6 +243,9 @@ pub fn get_metadata<'a>(root: &'a AstNode<'a>, mtype: TypeFileMetadata) -> FileM
..FileMetadata::default()
}
}
TypeFileMetadata::Generic => FileMetadata {
..FileMetadata::default()
},
TypeFileMetadata::Portfolio => FileMetadata {
portfolio: Some(deserialize_metadata(text)),
..FileMetadata::default()
@ -256,9 +256,6 @@ pub fn get_metadata<'a>(root: &'a AstNode<'a>, mtype: TypeFileMetadata) -> FileM
Some(data) => data,
// No metadata
None => match mtype {
TypeFileMetadata::Generic => FileMetadata {
..FileMetadata::default()
},
TypeFileMetadata::Blog => FileMetadata {
blog: Some(FileMetadataBlog::default()),
..FileMetadata::default()
@ -267,6 +264,9 @@ pub fn get_metadata<'a>(root: &'a AstNode<'a>, mtype: TypeFileMetadata) -> FileM
contact: Some(FileMetadataContact::default()),
..FileMetadata::default()
},
TypeFileMetadata::Generic => FileMetadata {
..FileMetadata::default()
},
TypeFileMetadata::Portfolio => FileMetadata {
portfolio: Some(FileMetadataPortfolio::default()),
..FileMetadata::default()