1#![forbid(unsafe_code)]
2#![no_std]
3#![doc(html_root_url = "https://docs.rs/lignin-schema/0.0.4")]
4#![warn(clippy::pedantic)]
5
6use heck_but_macros::stringify_SHOUTY_SNEK_CASE;
7pub use lignin;
8
9#[cfg(doctest)]
10pub mod readme {
11 doc_comment::doctest!("../README.md");
12}
13
14macro_rules! element {
15 ($name:ident) => {
16 #[inline(always)]
17 #[must_use]
18 pub fn $name<'a>(
19 attributes: &'a [lignin::Attribute<'a>],
20 content: &'a [lignin::Node<'a>],
21 event_bindings: &'a [lignin::EventBinding<'a>],
22 ) -> lignin::Element<'a> {
23 lignin::Element {
24 name: stringify_SHOUTY_SNEK_CASE!($name),
25 attributes,
26 content,
27 event_bindings,
28 }
29 }
30 };
31}
32
33macro_rules! void_element {
34 ($name:ident) => {
35 #[inline(always)]
36 #[must_use]
37 pub fn $name<'a>(
38 attributes: &'a [lignin::Attribute<'a>],
39 _: &'a [lignin::Node<'a>; 0],
40 event_bindings: &'a [lignin::EventBinding<'a>],
41 ) -> lignin::Element<'a> {
42 lignin::Element {
43 name: stringify_SHOUTY_SNEK_CASE!($name),
44 attributes,
45 content: &[],
46 event_bindings,
47 }
48 }
49 };
50}
51
52macro_rules! elements {
53 ($($name:ident),+) => {
54 $(element!($name);)+
55 };
56}
57
58macro_rules! void_elements {
59 ($($name:ident),+) => {
60 $(void_element!($name);)+
61 };
62}
63
64elements!(html);
67elements!(head, style, title);
69void_elements!(base, link, meta);
70elements!(body);
72elements!(
74 address, article, aside, footer, header, h1, h2, h3, h4, h5, h6, hgroup, main, nav, section
75);
76elements!(blockquote, dd, div, dl, dt, figcaption, figure, hr, li, ol, p, pre, ul);
78elements!(
80 a, abbr, b, bdi, bdo, cite, code, data, dfn, em, i, kbd, mark, q, rb, rp, rt, rtc, ruby, s,
81 samp, small, span, strong, sub, sup, time, u, var
82);
83void_elements!(br, wbr);
84elements!(audio, map, video);
86void_elements!(area, img, track);
87elements!(iframe, object, picture);
89void_elements!(embed, param, source);
90elements!(canvas, noscript, script);
92elements!(del, ins);
94elements!(caption, colgroup, table, tbody, td, tfoot, th, thead, tr);
96void_elements!(col);
97elements!(
99 button, datalist, fieldset, form, label, legend, meter, optgroup, option, progress, select,
100 textarea
101);
102void_elements!(input);
103elements!(details, dialog, menu, summary);
105elements!(slot, template);
107
108#[deprecated = "To quote MDN: Warning: \"These are old HTML elements which are deprecated and should not be used. You should never use them in new projects, and should replace them in old projects as soon as you can. They are listed here for informational purposes only.\""]
109pub mod deprecated {
111 use super::stringify_SHOUTY_SNEK_CASE;
112 elements!(
113 acronym, applet, big, blink, center, content, dir, element, font, frameset, listing,
114 marquee, multicol, nobr, noembed, noframes, plaintext, shadow, strike, tt, xmp
115 );
116 void_elements!(
117 basefont, bgsound, command, frame,
118 image, isindex, keygen, menuitem, nextid, spacer
120 );
121}