pub mod attributes;
pub mod hypertext_elements;
#[cfg(feature = "mathml")]
mod mathml;
pub trait Element {
type Kind: ElementKind;
}
pub trait ElementKind: sealed::Sealed {}
#[derive(Debug, Clone, Copy)]
pub struct Normal;
impl ElementKind for Normal {}
#[derive(Debug, Clone, Copy)]
pub struct Void;
impl ElementKind for Void {}
mod sealed {
use super::{Normal, Void};
pub trait Sealed {}
impl Sealed for Normal {}
impl Sealed for Void {}
}
#[derive(Debug, Clone, Copy)]
pub struct Attribute;
#[derive(Debug, Clone, Copy)]
pub struct AttributeNamespace;
#[derive(Debug, Clone, Copy)]
pub struct AttributeSymbol;
#[macro_export]
macro_rules! define_elements {
{
$(
$(#[$meta:meta])*
$name:ident $(
{
$(
$(#[$attr_meta:meta])*
$attr:ident
)*
}
)?
)*
} => {
$(
$(#[$meta])*
#[expect(
non_camel_case_types,
reason = "camel case types will be interpreted as components"
)]
#[derive(::core::fmt::Debug, ::core::clone::Clone, ::core::marker::Copy)]
pub struct $name;
$(
#[allow(non_upper_case_globals)]
impl $name {
$(
$(#[$attr_meta])*
pub const $attr: $crate::validation::Attribute = $crate::validation::Attribute;
)*
}
)?
impl $crate::validation::Element for $name {
type Kind = $crate::validation::Normal;
}
impl $crate::validation::attributes::GlobalAttributes for $name {}
)*
}
}
#[macro_export]
macro_rules! define_void_elements {
{
$(
$(#[$meta:meta])*
$name:ident $(
{
$(
$(#[$attr_meta:meta])*
$attr:ident
)*
}
)?
)*
} => {
$(
$(#[$meta])*
#[expect(
non_camel_case_types,
reason = "camel case types will be interpreted as components"
)]
#[derive(::core::fmt::Debug, ::core::clone::Clone, ::core::marker::Copy)]
pub struct $name;
$(
#[allow(non_upper_case_globals)]
impl $name {
$(
$(#[$attr_meta])*
pub const $attr: $crate::validation::Attribute = $crate::validation::Attribute;
)*
}
)?
impl $crate::validation::Element for $name {
type Kind = $crate::validation::Void;
}
impl $crate::validation::attributes::GlobalAttributes for $name {}
)*
}
}