add: rewrite macros.html

This commit is contained in:
trisua 2025-05-31 20:42:11 -04:00
parent bf27c51ad3
commit e9846016e6
4 changed files with 224 additions and 246 deletions

View file

@ -40,7 +40,7 @@ pub const STREAMS_JS: &str = include_str!("./public/js/streams.js");
// html
pub const ROOT: &str = include_str!("./public/html/root.lisp");
pub const MACROS: &str = include_str!("./public/html/macros.html");
pub const MACROS: &str = include_str!("./public/html/macros.lisp");
pub const COMPONENTS: &str = include_str!("./public/html/components.html");
pub const MISC_ERROR: &str = include_str!("./public/html/misc/error.lisp");
@ -239,7 +239,6 @@ pub(crate) async fn replace_in_html(
for cap in icon_without_class.captures_iter(&input.clone()) {
let icon = &cap.get(3).unwrap().as_str().replace("\"", "");
pull_icon(icon, &config.dirs.icons).await;
let reader = ICONS.read().await;
@ -261,14 +260,14 @@ pub(crate) fn lisp_plugins() -> HashMap<String, Box<dyn FnMut(Element) -> Elemen
plugins.insert(
"icon".to_string(),
Box::new(|e: Element| text!(format!("{{{{ icon \"{}\" }}}}", read_param!(e, 0)))) as _,
Box::new(|e: Element| text!(format!("\n{{{{ icon \"{}\" }}}}\n", read_param!(e, 0)))) as _,
);
plugins.insert(
"icon_class".to_string(),
Box::new(|e: Element| {
text!(format!(
"{{{{ icon \"{}\" c({}) }}}}",
"\n{{{{ icon \"{}\" c({}) }}}}\n",
read_param!(e, 0),
read_param!(e, 1)
))
@ -293,7 +292,7 @@ pub(crate) async fn write_assets(config: &Config) -> PathBufD {
let html_path = PathBufD::current().join(&config.dirs.templates);
write_template!(html_path->"root.html"(crate::assets::ROOT) --config=config --lisp plugins);
write_template!(html_path->"macros.html"(crate::assets::MACROS) --config=config);
write_template!(html_path->"macros.html"(crate::assets::MACROS) --config=config --lisp plugins);
write_template!(html_path->"components.html"(crate::assets::COMPONENTS) --config=config);
write_template!(html_path->"misc/error.html"(crate::assets::MISC_ERROR) -d "misc" --config=config --lisp plugins);