Modifica gestión de páginas para normalizar código

This commit is contained in:
Manuel Cillero 2022-03-01 19:35:02 +01:00
parent 9e65f89d2d
commit db3efa9ef9
7 changed files with 128 additions and 92 deletions

View file

@ -1,18 +1,4 @@
use crate::core::all::THEMES;
pub use maud::{DOCTYPE, Markup, PreEscaped, html};
mod api;
pub use api::Theme;
pub fn register_theme(t: &'static (dyn Theme + 'static)) {
THEMES.write().unwrap().push(t);
}
pub fn find_theme(id: &str) -> Option<&'static (dyn Theme + 'static)> {
let themes = THEMES.write().unwrap();
match themes.iter().find(|t| t.id() == id) {
Some(theme) => Some(*theme),
_ => None,
}
}
pub use api::{Theme, find_theme, register_theme};