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