Skip to content

Commit

Permalink
Rewrite config parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
lindhe committed Aug 8, 2023
1 parent ecb23e5 commit 2a860c5
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,30 @@ use html::metadata::Head;
use html::root::builders::BodyBuilder;
use html::root::{Body, Html};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;

/// Metadata about a favicon set.
#[derive(Serialize, Deserialize, Debug)]
pub struct IconsetMetadata {
pub struct FaviconSetMetadata {
pub name: String,
pub attribution: String,
pub license_name: String,
pub license_url: String,
pub url: String,
}

/// A FaviconSet can be for example "OpenMoji", "Noto" or "MaterialDesignIcons".
#[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = "PascalCase")]
pub struct Emojis {
pub open_moji: IconsetMetadata,
pub noto: IconsetMetadata,
#[serde(untagged)]
pub enum FaviconSet {
Set(HashMap<String, FaviconSetMetadata>),
}

#[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = "PascalCase")]
pub struct Icons {
pub material_design_icons: IconsetMetadata,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct Config {
pub emojis: Emojis,
pub icons: Icons,
#[serde(rename_all = "lowercase")]
pub struct MetadataConfig {
emojis: FaviconSet,
icons: FaviconSet,
}

pub fn make_body(
Expand Down

0 comments on commit 2a860c5

Please sign in to comment.