1pub mod edits;
2pub mod embedded;
3pub mod forms;
4pub mod interactive;
5pub mod metadata;
6pub mod root;
7pub mod scripting;
8pub mod sections;
9pub mod tables;
10pub mod text;
11pub trait RenderElement {
13 fn write_opening_tag<W: std::fmt::Write>(&self, writer: &mut W) -> std::fmt::Result;
15 fn write_closing_tag<W: std::fmt::Write>(&self, writer: &mut W) -> std::fmt::Result;
17}
18#[derive(Debug, Clone, PartialEq, Default)]
20pub struct DataMap {
21 map: std::collections::HashMap<
22 std::borrow::Cow<'static, str>,
23 std::borrow::Cow<'static, str>,
24 >,
25}
26impl std::ops::Deref for DataMap {
27 type Target = std::collections::HashMap<
28 std::borrow::Cow<'static, str>,
29 std::borrow::Cow<'static, str>,
30 >;
31 fn deref(&self) -> &Self::Target {
32 &self.map
33 }
34}
35impl std::ops::DerefMut for DataMap {
36 fn deref_mut(&mut self) -> &mut Self::Target {
37 &mut self.map
38 }
39}
40impl std::fmt::Display for DataMap {
41 fn fmt(&self, writer: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
42 for (key, value) in self.map.iter() {
43 write!(writer, r#" data-{key}="{value}""#)?;
44 }
45 Ok(())
46 }
47}
48#[derive(Debug, Clone, PartialEq, Default)]
50pub struct GlobalAttributes {
51 pub access_key: std::option::Option<std::borrow::Cow<'static, str>>,
53 pub auto_capitalize: std::option::Option<std::borrow::Cow<'static, str>>,
55 pub autofocus: bool,
57 pub class: std::option::Option<std::borrow::Cow<'static, str>>,
59 pub content_editable: std::option::Option<std::borrow::Cow<'static, str>>,
61 pub direction: std::option::Option<std::borrow::Cow<'static, str>>,
63 pub draggable: bool,
65 pub enter_key_hint: std::option::Option<std::borrow::Cow<'static, str>>,
67 pub export_parts: std::option::Option<std::borrow::Cow<'static, str>>,
69 pub hidden: std::option::Option<std::borrow::Cow<'static, str>>,
71 pub id: std::option::Option<std::borrow::Cow<'static, str>>,
73 pub inert: bool,
75 pub input_mode: std::option::Option<std::borrow::Cow<'static, str>>,
77 pub is_: std::option::Option<std::borrow::Cow<'static, str>>,
79 pub item_id: std::option::Option<std::borrow::Cow<'static, str>>,
81 pub item_prop: std::option::Option<std::borrow::Cow<'static, str>>,
83 pub item_ref: std::option::Option<std::borrow::Cow<'static, str>>,
85 pub item_scope: std::option::Option<std::borrow::Cow<'static, str>>,
87 pub item_type: std::option::Option<std::borrow::Cow<'static, str>>,
89 pub lang: std::option::Option<std::borrow::Cow<'static, str>>,
91 pub nonce: std::option::Option<std::borrow::Cow<'static, str>>,
93 pub part: std::option::Option<std::borrow::Cow<'static, str>>,
95 pub slot: std::option::Option<std::borrow::Cow<'static, str>>,
97 pub spellcheck: std::option::Option<std::borrow::Cow<'static, str>>,
99 pub style: std::option::Option<std::borrow::Cow<'static, str>>,
101 pub tab_index: std::option::Option<i64>,
103 pub title: std::option::Option<std::borrow::Cow<'static, str>>,
105 pub translate: bool,
107}
108impl std::fmt::Display for GlobalAttributes {
109 fn fmt(&self, writer: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
110 if let Some(field) = self.access_key.as_ref() {
111 write!(writer, r#" accesskey="{field}""#)?;
112 }
113 if let Some(field) = self.auto_capitalize.as_ref() {
114 write!(writer, r#" autocapitalize="{field}""#)?;
115 }
116 if self.autofocus {
117 write!(writer, r#" autofocus"#)?;
118 }
119 if let Some(field) = self.class.as_ref() {
120 write!(writer, r#" class="{field}""#)?;
121 }
122 if let Some(field) = self.content_editable.as_ref() {
123 write!(writer, r#" contenteditable="{field}""#)?;
124 }
125 if let Some(field) = self.direction.as_ref() {
126 write!(writer, r#" dir="{field}""#)?;
127 }
128 if self.draggable {
129 write!(writer, r#" draggable"#)?;
130 }
131 if let Some(field) = self.enter_key_hint.as_ref() {
132 write!(writer, r#" enterkeyhint="{field}""#)?;
133 }
134 if let Some(field) = self.export_parts.as_ref() {
135 write!(writer, r#" exportparts="{field}""#)?;
136 }
137 if let Some(field) = self.hidden.as_ref() {
138 write!(writer, r#" hidden="{field}""#)?;
139 }
140 if let Some(field) = self.id.as_ref() {
141 write!(writer, r#" id="{field}""#)?;
142 }
143 if self.inert {
144 write!(writer, r#" inert"#)?;
145 }
146 if let Some(field) = self.input_mode.as_ref() {
147 write!(writer, r#" inputmode="{field}""#)?;
148 }
149 if let Some(field) = self.is_.as_ref() {
150 write!(writer, r#" is="{field}""#)?;
151 }
152 if let Some(field) = self.item_id.as_ref() {
153 write!(writer, r#" itemid="{field}""#)?;
154 }
155 if let Some(field) = self.item_prop.as_ref() {
156 write!(writer, r#" itemprop="{field}""#)?;
157 }
158 if let Some(field) = self.item_ref.as_ref() {
159 write!(writer, r#" itemref="{field}""#)?;
160 }
161 if let Some(field) = self.item_scope.as_ref() {
162 write!(writer, r#" itemscope="{field}""#)?;
163 }
164 if let Some(field) = self.item_type.as_ref() {
165 write!(writer, r#" itemtype="{field}""#)?;
166 }
167 if let Some(field) = self.lang.as_ref() {
168 write!(writer, r#" lang="{field}""#)?;
169 }
170 if let Some(field) = self.nonce.as_ref() {
171 write!(writer, r#" nonce="{field}""#)?;
172 }
173 if let Some(field) = self.part.as_ref() {
174 write!(writer, r#" part="{field}""#)?;
175 }
176 if let Some(field) = self.slot.as_ref() {
177 write!(writer, r#" slot="{field}""#)?;
178 }
179 if let Some(field) = self.spellcheck.as_ref() {
180 write!(writer, r#" spellcheck="{field}""#)?;
181 }
182 if let Some(field) = self.style.as_ref() {
183 write!(writer, r#" style="{field}""#)?;
184 }
185 if let Some(field) = self.tab_index.as_ref() {
186 write!(writer, r#" tabindex="{field}""#)?;
187 }
188 if let Some(field) = self.title.as_ref() {
189 write!(writer, r#" title="{field}""#)?;
190 }
191 if self.translate {
192 write!(writer, r#" translate"#)?;
193 }
194 Ok(())
195 }
196}