Merge branch 'main' into contrib
This commit is contained in:
commit
da6905cb6d
|
@ -78,6 +78,8 @@ declare_elements! {
|
|||
content: String,
|
||||
http_equiv: HTTPEquiv,
|
||||
name: Metadata,
|
||||
// non standard, uses https://en.wikipedia.org/wiki/RDFa
|
||||
property: MetadataProperties,
|
||||
} in [MetadataContent];
|
||||
style {
|
||||
type: Mime,
|
||||
|
@ -459,3 +461,16 @@ fn test_data_attributes() {
|
|||
|
||||
assert_eq!("<div data-id=\"1234\">Boo!</div>", frag.to_string());
|
||||
}
|
||||
#[test]
|
||||
fn test_meta_tags() {
|
||||
use crate as axohtml;
|
||||
use crate::{dom::DOMTree, html};
|
||||
|
||||
let frag: DOMTree<String> = html!(<meta property="og:url" content="http://example.com"/>
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
"<meta content=\"http://example.com\" property=\"og:url\"/>",
|
||||
frag.to_string()
|
||||
);
|
||||
}
|
||||
|
|
|
@ -254,6 +254,32 @@ pub enum Metadata {
|
|||
Viewport,
|
||||
}
|
||||
|
||||
#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, IntoStaticStr)]
|
||||
pub enum MetadataProperties {
|
||||
#[strum(to_string = "og:title")]
|
||||
Title,
|
||||
#[strum(to_string = "og:type")]
|
||||
Type,
|
||||
#[strum(to_string = "og:image")]
|
||||
Image,
|
||||
#[strum(to_string = "og:url")]
|
||||
Homepage,
|
||||
#[strum(to_string = "og:audio")]
|
||||
Audio,
|
||||
#[strum(to_string = "og:description")]
|
||||
Description,
|
||||
#[strum(to_string = "og:determiner")]
|
||||
Determiner,
|
||||
#[strum(to_string = "og:locale")]
|
||||
Locale,
|
||||
#[strum(to_string = "og:site_name")]
|
||||
ParentSiteName,
|
||||
#[strum(to_string = "og:video")]
|
||||
Video,
|
||||
#[strum(to_string = "og:locale:alternate")]
|
||||
ExtraLocales,
|
||||
}
|
||||
|
||||
#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, IntoStaticStr)]
|
||||
pub enum OnOff {
|
||||
#[strum(to_string = "on")]
|
||||
|
|
Loading…
Reference in New Issue