AkurAI Build
Menu

Public repository / master

AkurAI-Framework / crates/ui/src/html.rs

Latest change 3aae9f4e85241bcb775c31f5c03094becd3da56a - Pure-Rust UI layer: akurai-ui, akurai-crypto, Tailwind-grade akurai-css by Ólafur Búi Ólafsson

//! One constructor per HTML/SVG tag: `div()`, `button()`, `svg()`, …

use crate::dom::{el, svg_el, El};

macro_rules! tags {
    ($ctor:ident: $($name:ident => $tag:literal),+ $(,)?) => {$(
        #[doc = concat!("`<", $tag, ">`")]
        pub fn $name() -> El {
            $ctor($tag)
        }
    )+};
}

tags!(el:
    a => "a", article => "article", aside => "aside", b => "b", button => "button", code => "code",
    dd => "dd", details => "details", div => "div", dl => "dl", dt => "dt", em => "em",
    fieldset => "fieldset", footer => "footer", form => "form", h1 => "h1", h2 => "h2",
    h3 => "h3", h4 => "h4", header => "header", hr => "hr", img => "img", input => "input",
    label => "label", legend => "legend", li => "li", main => "main", nav => "nav",
    ol => "ol", option => "option", p => "p", section => "section", select => "select",
    pre => "pre", small => "small", span => "span", strong => "strong", summary => "summary",
    table => "table", tbody => "tbody", td => "td", textarea => "textarea", th => "th",
    thead => "thead", time => "time", tr => "tr", ul => "ul",
);

tags!(svg_el:
    svg => "svg", path => "path", circle => "circle", rect => "rect", line => "line",
    polyline => "polyline",
);