Convert the "applies to" field from spec into a DeclarationMetadata attribute
(applies_to: &str)
| 303 | |
| 304 | /// Convert the "applies to" field from spec into a DeclarationMetadata attribute |
| 305 | fn convert_applies_to(applies_to: &str) -> Option<TokenStream> { |
| 306 | let result = match applies_to.replace('\n', " ").to_lowercase().as_str() { |
| 307 | "n/a" => return None, |
| 308 | "absolutely positioned boxes" => quote! { applies_to = AbsPos }, |
| 309 | "all elements and text" => quote! { applies_to = Elements | Text }, |
| 310 | "all elements and pseudo-elements" => quote! { applies_to = Elements | PseudoElements }, |
| 311 | "all elements." |
| 312 | | "all elements" |
| 313 | | "all enabled elements" |
| 314 | | "all elements (but see prose)" |
| 315 | | "all elements, but not pseudo-elements" |
| 316 | | "all elements, but see prose" => { |
| 317 | quote! { applies_to = Elements } |
| 318 | } |
| 319 | "text" => quote! { applies_to = Text }, |
| 320 | "block containers" | "block-level boxes" | "block-level elements" | "block container elements" => { |
| 321 | quote! { applies_to = Block } |
| 322 | } |
| 323 | "flex containers" => quote! { applies_to = Flex }, |
| 324 | "grid containers" => quote! { applies_to = Grid }, |
| 325 | "floats" => quote! { applies_to = Float }, |
| 326 | _ => quote! { applies_to = Unknown }, |
| 327 | }; |
| 328 | Some(result) |
| 329 | } |
| 330 | |
| 331 | /// Convert the "animation type" field from spec into a DeclarationMetadata attribute |
| 332 | fn convert_animation_type(animation_type: &str) -> Option<TokenStream> { |
no test coverage detected