use html5ever::LocalName;
use crate::model::Role;
pub fn element_to_role(local_name: &LocalName) -> Role {
match local_name.as_ref() {
"div" | "section" | "article" | "nav" | "header" | "footer" | "main" | "address"
| "details" | "summary" | "hgroup" => Role::Container,
"br" => Role::Break,
"hr" => Role::Rule,
"aside" => Role::Sidebar,
"figure" => Role::Figure,
"figcaption" | "caption" => Role::Caption,
"p" => Role::Paragraph,
"pre" => Role::CodeBlock,
"span" | "em" | "i" | "cite" | "var" | "dfn" | "strong" | "b" | "code" | "kbd" | "samp"
| "tt" | "sup" | "sub" | "u" | "ins" | "s" | "strike" | "del" | "small" | "mark"
| "abbr" | "time" | "q" => Role::Inline,
"h1" => Role::Heading(1),
"h2" => Role::Heading(2),
"h3" => Role::Heading(3),
"h4" => Role::Heading(4),
"h5" => Role::Heading(5),
"h6" => Role::Heading(6),
"a" => Role::Link,
"img" => Role::Image,
"ul" => Role::UnorderedList,
"ol" => Role::OrderedList,
"li" => Role::ListItem,
"blockquote" => Role::BlockQuote,
"dl" => Role::DefinitionList,
"dt" => Role::DefinitionTerm,
"dd" => Role::DefinitionDescription,
"table" => Role::Table,
"thead" => Role::TableHead,
"tbody" => Role::TableBody,
"tr" => Role::TableRow,
"td" | "th" => Role::TableCell,
"label" | "legend" | "output" | "data" | "ruby" | "rt" | "rp" | "bdi" | "bdo" | "wbr" => {
Role::Inline
}
_ => Role::Container,
}
}