Merge branch 'main' of github.com:axodotdev/axohtml into aria-sort
This commit is contained in:
commit
3ea02872c7
|
@ -46,7 +46,7 @@ pub fn global_attrs(span: Span) -> StringyMap<Ident, TokenStream> {
|
||||||
insert("aria_modal", "crate::types::Bool");
|
insert("aria_modal", "crate::types::Bool");
|
||||||
insert("aria_multiline", "crate::types::Bool");
|
insert("aria_multiline", "crate::types::Bool");
|
||||||
insert("aria_multiselectable", "crate::types::Bool");
|
insert("aria_multiselectable", "crate::types::Bool");
|
||||||
insert("aria_orientation", "String"); // TODO Only supports some values https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-orientation
|
insert("aria_orientation", "crate::types::AriaOrientation");
|
||||||
insert("aria_placeholder", "String");
|
insert("aria_placeholder", "String");
|
||||||
insert("aria_pressed", "crate::types::Bool");
|
insert("aria_pressed", "crate::types::Bool");
|
||||||
insert("aria_readonly", "crate::types::Bool");
|
insert("aria_readonly", "crate::types::Bool");
|
||||||
|
|
|
@ -76,7 +76,10 @@ fn extract_data_attrs(attrs: &mut StringyMap<Ident, TokenTree>) -> StringyMap<St
|
||||||
let key_name = key.to_string();
|
let key_name = key.to_string();
|
||||||
if let Some(key_name) = key_name.strip_prefix("data_") {
|
if let Some(key_name) = key_name.strip_prefix("data_") {
|
||||||
let value = attrs.remove(&key).unwrap();
|
let value = attrs.remove(&key).unwrap();
|
||||||
data.insert(key_name.to_string(), value);
|
// makes sure if a data attribute has more than one hyphen
|
||||||
|
// they all get transformed
|
||||||
|
let key = str::replace(key_name, "_", "-");
|
||||||
|
data.insert(key.to_string(), value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data
|
data
|
||||||
|
|
|
@ -31,6 +31,7 @@ macro_rules! marker_trait {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
marker_trait!(HTMLContent);
|
||||||
marker_trait!(MetadataContent);
|
marker_trait!(MetadataContent);
|
||||||
marker_trait!(FlowContent);
|
marker_trait!(FlowContent);
|
||||||
marker_trait!(SectioningContent);
|
marker_trait!(SectioningContent);
|
||||||
|
@ -53,7 +54,7 @@ marker_trait!(TableColumnContent);
|
||||||
declare_elements! {
|
declare_elements! {
|
||||||
html {
|
html {
|
||||||
xmlns: Uri,
|
xmlns: Uri,
|
||||||
} with [head, body];
|
} with [head, body] HTMLContent;
|
||||||
head with [title] MetadataContent;
|
head with [title] MetadataContent;
|
||||||
body with FlowContent;
|
body with FlowContent;
|
||||||
|
|
||||||
|
@ -311,7 +312,7 @@ declare_elements! {
|
||||||
src: Uri,
|
src: Uri,
|
||||||
text: String,
|
text: String,
|
||||||
type: String, // TODO could be an enum
|
type: String, // TODO could be an enum
|
||||||
} in [MetadataContent, FlowContent, PhrasingContent, TableColumnContent] with TextNode;
|
} in [MetadataContent, FlowContent, PhrasingContent, TableColumnContent, HTMLContent] with TextNode;
|
||||||
section in [FlowContent, SectioningContent] with FlowContent;
|
section in [FlowContent, SectioningContent] with FlowContent;
|
||||||
select {
|
select {
|
||||||
autocomplete: String,
|
autocomplete: String,
|
||||||
|
|
|
@ -549,3 +549,11 @@ pub enum AriaSort {
|
||||||
#[strum(to_string = "other")]
|
#[strum(to_string = "other")]
|
||||||
Other,
|
Other,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, IntoStaticStr)]
|
||||||
|
pub enum AriaOrientation {
|
||||||
|
#[strum(to_string = "horizontal")]
|
||||||
|
Horizontal,
|
||||||
|
#[strum(to_string = "vertical")]
|
||||||
|
Vertical,
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue