From 9d8c50f4d57d2a3bca361e8a1c9ce999a71dbec5 Mon Sep 17 00:00:00 2001 From: Sara Vieira Date: Mon, 19 Dec 2022 14:04:06 +0000 Subject: [PATCH 1/3] add proprety in meta tags --- typed-html/src/elements.rs | 14 ++++++++++++++ typed-html/src/types/mod.rs | 26 ++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/typed-html/src/elements.rs b/typed-html/src/elements.rs index a955905..41b7510 100644 --- a/typed-html/src/elements.rs +++ b/typed-html/src/elements.rs @@ -78,6 +78,7 @@ declare_elements! { content: String, http_equiv: HTTPEquiv, name: Metadata, + property: MetadataProperties, } in [MetadataContent]; style { type: Mime, @@ -459,3 +460,16 @@ fn test_data_attributes() { assert_eq!("
Boo!
", frag.to_string()); } +#[test] +fn test_meta_tags() { + use crate as axohtml; + use crate::{dom::DOMTree, html}; + + let frag: DOMTree = html!( + ); + + assert_eq!( + "", + frag.to_string() + ); +} diff --git a/typed-html/src/types/mod.rs b/typed-html/src/types/mod.rs index 0fb5881..f2d81bc 100644 --- a/typed-html/src/types/mod.rs +++ b/typed-html/src/types/mod.rs @@ -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")] From 44984f451c30e887b6adbdb8bc13ce74ee125d58 Mon Sep 17 00:00:00 2001 From: Sara Vieira Date: Mon, 19 Dec 2022 14:06:21 +0000 Subject: [PATCH 2/3] up version --- typed-html/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typed-html/Cargo.toml b/typed-html/Cargo.toml index bd1eb23..a0eaa2a 100644 --- a/typed-html/Cargo.toml +++ b/typed-html/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "axohtml" -version = "0.1.0" +version = "0.1.1" edition = "2021" authors = ["Axo Developer Co ", "Bodil Stokke "] license = "MPL-2.0+" From 5a92c5994c7e440a69d19ba765a3021e3d54593d Mon Sep 17 00:00:00 2001 From: Sara Vieira Date: Mon, 19 Dec 2022 16:11:56 +0000 Subject: [PATCH 3/3] revert bump --- typed-html/Cargo.toml | 2 +- typed-html/src/elements.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/typed-html/Cargo.toml b/typed-html/Cargo.toml index a0eaa2a..bd1eb23 100644 --- a/typed-html/Cargo.toml +++ b/typed-html/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "axohtml" -version = "0.1.1" +version = "0.1.0" edition = "2021" authors = ["Axo Developer Co ", "Bodil Stokke "] license = "MPL-2.0+" diff --git a/typed-html/src/elements.rs b/typed-html/src/elements.rs index 41b7510..f8377df 100644 --- a/typed-html/src/elements.rs +++ b/typed-html/src/elements.rs @@ -78,6 +78,7 @@ declare_elements! { content: String, http_equiv: HTTPEquiv, name: Metadata, + // non standard, uses https://en.wikipedia.org/wiki/RDFa property: MetadataProperties, } in [MetadataContent]; style {