From 40725b201f874449dd7fa61554f6c722cccb77ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Drouet?= Date: Fri, 28 Jul 2023 23:32:29 +0000 Subject: [PATCH] refactor(mrml-core): remove parser macros MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérémie Drouet --- Cargo.lock | 13 - Cargo.toml | 1 - packages/mrml-core/Cargo.toml | 3 +- .../lib/mrml-parse-macros/Cargo.toml | 23 -- .../lib/mrml-parse-macros/src/attributes.rs | 105 -------- .../lib/mrml-parse-macros/src/children.rs | 6 - .../lib/mrml-parse-macros/src/common.rs | 136 ----------- .../lib/mrml-parse-macros/src/element.rs | 231 ------------------ .../lib/mrml-parse-macros/src/lib.rs | 20 -- .../mrml-core/src/mj_accordion/children.rs | 1 - packages/mrml-core/src/mj_body/children.rs | 1 - packages/mrml-core/src/mj_breakpoint/mod.rs | 1 - packages/mrml-core/src/mj_button/parse.rs | 2 - .../mrml-core/src/mj_carousel/children.rs | 1 - packages/mrml-core/src/mj_font/mod.rs | 1 - packages/mrml-core/src/mj_head/children.rs | 1 - packages/mrml-core/src/mj_navbar/children.rs | 1 - packages/mrml-core/src/mj_raw/children.rs | 1 - packages/mrml-core/src/mj_social/children.rs | 1 - 19 files changed, 1 insertion(+), 548 deletions(-) delete mode 100644 packages/mrml-core/lib/mrml-parse-macros/Cargo.toml delete mode 100644 packages/mrml-core/lib/mrml-parse-macros/src/attributes.rs delete mode 100644 packages/mrml-core/lib/mrml-parse-macros/src/children.rs delete mode 100644 packages/mrml-core/lib/mrml-parse-macros/src/common.rs delete mode 100644 packages/mrml-core/lib/mrml-parse-macros/src/element.rs delete mode 100644 packages/mrml-core/lib/mrml-parse-macros/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index c27b0c2c..ccaec532 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1055,7 +1055,6 @@ dependencies = [ "mockito", "mrml-json-macros", "mrml-macros", - "mrml-parse-macros", "mrml-print-macros", "reqwest", "rustc-hash", @@ -1110,18 +1109,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "mrml-parse-macros" -version = "0.1.0" -dependencies = [ - "Inflector", - "darling", - "mrml-common-macros", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "mrml-print-macros" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 773fc750..c12d1734 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,6 @@ members = [ "packages/mrml-core/lib/html-compare", "packages/mrml-core/lib/mrml-json-macros", "packages/mrml-core/lib/mrml-macros", - "packages/mrml-core/lib/mrml-parse-macros", "packages/mrml-core/lib/mrml-print-macros", "packages/mrml-core", "packages/mrml-wasm", diff --git a/packages/mrml-core/Cargo.toml b/packages/mrml-core/Cargo.toml index 7ddecd6a..7249cbf1 100644 --- a/packages/mrml-core/Cargo.toml +++ b/packages/mrml-core/Cargo.toml @@ -18,7 +18,7 @@ travis-ci = { repository = "jdrouet/mrml", branch = "main" } [features] default = ["orderedmap", "json", "parse", "print", "render"] json = ["dep:mrml-json-macros", "dep:serde", "dep:serde_json"] -parse = ["dep:mrml-parse-macros", "dep:xmlparser", "dep:thiserror"] +parse = ["dep:xmlparser", "dep:thiserror"] print = ["dep:mrml-print-macros"] render = ["dep:thiserror"] orderedmap = ["dep:indexmap", "dep:rustc-hash"] @@ -48,7 +48,6 @@ url = { version = "^2", optional = true } # macros mrml-macros = { version = "0.1", path = "./lib/mrml-macros" } mrml-json-macros = { version = "0.1", path = "./lib/mrml-json-macros", optional = true } -mrml-parse-macros = { version = "0.1", path = "./lib/mrml-parse-macros", optional = true } mrml-print-macros = { version = "0.1", path = "./lib/mrml-print-macros", optional = true } [dev-dependencies] diff --git a/packages/mrml-core/lib/mrml-parse-macros/Cargo.toml b/packages/mrml-core/lib/mrml-parse-macros/Cargo.toml deleted file mode 100644 index 3cade421..00000000 --- a/packages/mrml-core/lib/mrml-parse-macros/Cargo.toml +++ /dev/null @@ -1,23 +0,0 @@ -[package] -name = "mrml-parse-macros" -description = "Macros for the parse feature of the MRML crate" -keywords = ["email", "mjml"] -version = "0.1.0" -authors = ["Jérémie Drouet "] -edition = "2021" -license-file = "../../license.md" -repository = "https://github.com/jolimail/mrml-core/" -readme = "../../readme.md" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[lib] -proc-macro = true - -[dependencies] -mrml-common-macros = { version = "0.1", path = "../common-macros" } -darling = "0.14" -Inflector = "0.11" -proc-macro2 = "1.0" -quote = "1.0" -syn = { version = "1.0", features = ["full", "fold"] } diff --git a/packages/mrml-core/lib/mrml-parse-macros/src/attributes.rs b/packages/mrml-core/lib/mrml-parse-macros/src/attributes.rs deleted file mode 100644 index bf69c316..00000000 --- a/packages/mrml-core/lib/mrml-parse-macros/src/attributes.rs +++ /dev/null @@ -1,105 +0,0 @@ -use inflector::cases::kebabcase::to_kebab_case; -use mrml_common_macros::{as_path, get_fields, is_option}; -use proc_macro::TokenStream; -use quote::quote; -use syn::{parse_macro_input, DeriveInput, Field, Ident}; - -fn create_builder_struct_field(field: &Field) -> Option { - if let Some(ref field_ident) = field.ident { - if as_path(field).map(is_option).unwrap_or(false) { - let ty = &field.ty; - Some(quote! { - #field_ident: #ty, - }) - } else { - let ty = &field.ty; - Some(quote! { - #field_ident: Option<#ty>, - }) - } - } else { - None - } -} - -fn create_builder_build_field(field: &Field) -> Option { - if let Some(ref field_ident) = field.ident { - if as_path(field).map(is_option).unwrap_or(false) { - Some(quote! { - #field_ident: self.#field_ident, - }) - } else { - Some(quote! { - #field_ident: self.#field_ident - .ok_or_else(|| crate::prelude::parser::Error::MissingAttribute(stringify!(#field_ident)))?, - }) - } - } else { - None - } -} - -fn create_builder_insert_field(field: &Field) -> Option { - if let Some(ref field_ident) = field.ident { - let attribute = match field_ident.to_string().as_str() { - // TODO make this a macro like #[mrml_parse(rename = "type")] - "kind" => "type".to_string(), - other => to_kebab_case(other), - }; - Some(quote! { - #attribute => { - self.#field_ident = Some(value.to_string()); - } - }) - } else { - None - } -} - -fn create_builder(ast: &DeriveInput) -> proc_macro2::TokenStream { - let ident = &ast.ident; - - let builder_name = format!("{ident}Builder"); - let builder_ident = Ident::new(&builder_name, ident.span()); - - let struct_fields = get_fields(ast) - .iter() - .filter_map(create_builder_struct_field); - - let build_fields = get_fields(ast) - .iter() - .filter_map(create_builder_build_field); - - let insert_fields = get_fields(ast) - .iter() - .filter_map(create_builder_insert_field); - - quote! { - #[derive(Debug, Default)] - struct #builder_ident { - #(#struct_fields)* - } - - impl #builder_ident { - fn build(self) -> Result<#ident, crate::prelude::parser::Error> { - Ok(#ident { - #(#build_fields)* - }) - } - - fn insert<'a>(&mut self, name: xmlparser::StrSpan<'a>, value: xmlparser::StrSpan<'a>) -> Result<(), crate::prelude::parser::Error> { - match name.as_str() { - #(#insert_fields)* - _ => return Err(crate::prelude::parser::Error::UnexpectedAttribute(name.start())), - }; - Ok(()) - } - } - } -} - -pub fn derive(input: TokenStream) -> TokenStream { - let ast: DeriveInput = parse_macro_input!(input as DeriveInput); - - create_builder(&ast).into() -} diff --git a/packages/mrml-core/lib/mrml-parse-macros/src/children.rs b/packages/mrml-core/lib/mrml-parse-macros/src/children.rs deleted file mode 100644 index 938b91c5..00000000 --- a/packages/mrml-core/lib/mrml-parse-macros/src/children.rs +++ /dev/null @@ -1,6 +0,0 @@ -use proc_macro::TokenStream; -use quote::quote; - -pub fn derive(_input: TokenStream) -> TokenStream { - quote! {}.into() -} diff --git a/packages/mrml-core/lib/mrml-parse-macros/src/common.rs b/packages/mrml-core/lib/mrml-parse-macros/src/common.rs deleted file mode 100644 index 5b595db0..00000000 --- a/packages/mrml-core/lib/mrml-parse-macros/src/common.rs +++ /dev/null @@ -1,136 +0,0 @@ -use syn::{ - punctuated::Punctuated, token::Comma, Data, DataStruct, DeriveInput, Field, Fields, - FieldsNamed, GenericArgument, Path, PathArguments, Type, TypePath, -}; - -pub fn is_vec(path: &Path) -> bool { - path.segments - .first() - // TODO make sure that it's a Vec - .map(|s| s.ident == "Vec") - .unwrap_or(false) -} - -fn get_vec_type(path: &Path) -> Type { - let res = &path.segments.first().unwrap().arguments; - let res = if let PathArguments::AngleBracketed(arg) = res { - arg - } else { - panic!("expected path arguments of kind angle bracketed {res:?}"); - }; - let res = res.args.first().unwrap(); - let res = if let GenericArgument::Type(ty) = res { - ty - } else { - panic!("expected generic argument of kind Type {res:?}"); - }; - res.to_owned() -} - -pub fn is_map(path: &Path) -> bool { - path.segments - .first() - // TODO make sure that it's a Vec - .map(|s| s.ident == "Map") - .unwrap_or(false) -} - -pub fn is_option(path: &Path) -> bool { - path.segments - .first() - // TODO make sure that it's a Option - .map(|s| s.ident == "Option") - .unwrap_or(false) -} - -pub fn as_data_struct(ast: &DeriveInput) -> Option<&DataStruct> { - if let Data::Struct(inner) = &(ast.data) { - Some(inner) - } else { - None - } -} - -pub fn as_fields_named(input: &DataStruct) -> Option<&FieldsNamed> { - if let Fields::Named(inner) = &input.fields { - Some(inner) - } else { - None - } -} - -pub fn get_fields(ast: &DeriveInput) -> &Punctuated { - as_data_struct(ast) - .and_then(as_fields_named) - .map(|f| &f.named) - .expect("MrmlParseComponent only supports structs.") -} - -pub fn get_children_field(ast: &DeriveInput) -> Option<&Field> { - get_fields(ast).into_iter().find(|f| { - f.ident - .as_ref() - .map(|id| *id == "children") - .unwrap_or(false) - }) -} - -pub enum ChildrenKind { - String, - List(Type), - None, -} - -pub fn get_children_kind(ast: &DeriveInput) -> ChildrenKind { - if let Some(field) = get_children_field(ast) { - match &field.ty { - Type::Path(TypePath { path, .. }) if path.is_ident("String") => ChildrenKind::String, - Type::Path(TypePath { path, .. }) if is_vec(path) => { - ChildrenKind::List(get_vec_type(path)) - } - _ => panic!("Incompatible type for children field {:?}", field.ident), - } - } else { - ChildrenKind::None - } -} - -pub fn get_attributes_field(ast: &DeriveInput) -> Option<&Field> { - get_fields(ast).into_iter().find(|f| { - f.ident - .as_ref() - .map(|id| *id == "attributes") - .unwrap_or(false) - }) -} - -pub fn as_path(field: &Field) -> Option<&Path> { - match &field.ty { - Type::Path(TypePath { path, .. }) => Some(path), - _ => None, - } -} - -pub fn get_attributes_kind(ast: &DeriveInput) -> AttributesKind { - if let Some(field) = get_attributes_field(ast) { - match &field.ty { - Type::Path(TypePath { path, .. }) if is_map(path) => AttributesKind::Map, - Type::Path(TypePath { path, .. }) => { - if let Some(ident) = path.get_ident() { - AttributesKind::Struct(ident.clone()) - } else { - AttributesKind::None - } - } - _ => AttributesKind::None, - } - } else { - AttributesKind::None - } -} - -pub enum AttributesKind { - Map, - Struct(syn::Ident), - None, -} diff --git a/packages/mrml-core/lib/mrml-parse-macros/src/element.rs b/packages/mrml-core/lib/mrml-parse-macros/src/element.rs deleted file mode 100644 index 86a1d9f1..00000000 --- a/packages/mrml-core/lib/mrml-parse-macros/src/element.rs +++ /dev/null @@ -1,231 +0,0 @@ -use darling::FromDeriveInput; -use mrml_common_macros::{get_attributes_kind, get_children_kind, AttributesKind, ChildrenKind}; -use proc_macro::TokenStream; -use quote::quote; -use syn::{parse_macro_input, DeriveInput, Ident}; - -#[derive(FromDeriveInput)] -#[darling(attributes(mrml_parse), forward_attrs(allow, doc, cfg))] -struct Opts { - child_comment: Option, - child_text: Option, - child_element: Option, -} - -impl Opts { - fn child_comment(&self) -> bool { - self.child_comment.unwrap_or(true) - } - fn child_text(&self) -> bool { - self.child_text.unwrap_or(true) - } - fn child_element(&self) -> bool { - self.child_element.unwrap_or(true) - } -} - -fn create_attribute(ast: &DeriveInput) -> proc_macro2::TokenStream { - match get_attributes_kind(ast) { - AttributesKind::None => quote! {}, - AttributesKind::Map => quote! { - attributes: Map, - }, - AttributesKind::Struct(ident) => { - let ident = Ident::new(&format!("{ident}Builder"), ident.span()); - quote! { - attributes: #ident, - } - } - } -} - -fn create_attribute_new(ast: &DeriveInput) -> proc_macro2::TokenStream { - match get_attributes_kind(ast) { - AttributesKind::None => quote! {}, - AttributesKind::Map => quote! { - attributes: Map::default(), - }, - AttributesKind::Struct(_) => quote! { - attributes: Default::default(), - }, - } -} - -fn create_attribute_build(ast: &DeriveInput) -> proc_macro2::TokenStream { - match get_attributes_kind(ast) { - AttributesKind::None => quote! {}, - AttributesKind::Map => quote! { - attributes: self.attributes, - }, - AttributesKind::Struct(_) => quote! { - attributes: self.attributes.build()?, - }, - } -} - -fn create_parse_attribute(ast: &DeriveInput) -> proc_macro2::TokenStream { - match get_attributes_kind(ast) { - AttributesKind::None => quote! {}, - AttributesKind::Map => quote! { - fn parse_attribute<'a>( - &mut self, - name: xmlparser::StrSpan<'a>, - value: xmlparser::StrSpan<'a>, - ) -> Result<(), crate::prelude::parser::Error> { - self.attributes.insert(name.to_string(), value.to_string()); - Ok(()) - } - }, - AttributesKind::Struct(_) => quote! { - fn parse_attribute<'a>( - &mut self, - name: xmlparser::StrSpan<'a>, - value: xmlparser::StrSpan<'a>, - ) -> Result<(), crate::prelude::parser::Error> { - self.attributes.insert(name, value) - } - }, - } -} - -fn create_children(ast: &DeriveInput) -> proc_macro2::TokenStream { - match get_children_kind(ast) { - ChildrenKind::List(ty) => quote! { - children: Vec<#ty>, - }, - ChildrenKind::String => quote! { - children: String, - }, - _ => quote! {}, - } -} - -fn create_children_new(ast: &DeriveInput) -> proc_macro2::TokenStream { - match get_children_kind(ast) { - ChildrenKind::None => quote! {}, - _ => quote! { - children: Default::default(), - }, - } -} - -fn create_children_build(ast: &DeriveInput) -> proc_macro2::TokenStream { - match get_children_kind(ast) { - ChildrenKind::None => quote! {}, - _ => quote! { - children: self.children, - }, - } -} - -fn create_parse_child_comment(ast: &DeriveInput, opts: &Opts) -> proc_macro2::TokenStream { - match get_children_kind(ast) { - ChildrenKind::List(_) if opts.child_comment() => quote! { - fn parse_child_comment(&mut self, value: xmlparser::StrSpan) -> Result<(), crate::prelude::parser::Error> { - self.children - .push(crate::comment::Comment::from(value.as_str()).into()); - Ok(()) - } - }, - _ => quote! {}, - } -} - -fn create_parse_child_text(ast: &DeriveInput, opts: &Opts) -> proc_macro2::TokenStream { - match get_children_kind(ast) { - ChildrenKind::String if opts.child_text() => quote! { - fn parse_child_text(&mut self, value: xmlparser::StrSpan) -> Result<(), crate::prelude::parser::Error> { - self.children = value.to_string(); - Ok(()) - } - }, - ChildrenKind::List(_) if opts.child_text() => quote! { - fn parse_child_text(&mut self, value: xmlparser::StrSpan) -> Result<(), crate::prelude::parser::Error> { - self.children.push(crate::text::Text::from(value.as_str()).into()); - Ok(()) - } - }, - _ => quote! {}, - } -} - -fn create_parse_child_element(ast: &DeriveInput, opts: &Opts) -> proc_macro2::TokenStream { - match get_children_kind(ast) { - ChildrenKind::List(ty) if opts.child_element() => quote! { - fn parse_child_element<'a>( - &mut self, - tag: xmlparser::StrSpan<'a>, - tokenizer: &mut xmlparser::Tokenizer<'a>, - ) -> Result<(), crate::prelude::parser::Error> { - use crate::prelude::parser::Parsable; - self.children.push(<#ty>::parse(tag, tokenizer, self.opts.clone())?); - Ok(()) - } - }, - _ => quote! {}, - } -} - -pub fn derive(input: TokenStream) -> TokenStream { - let ast: DeriveInput = parse_macro_input!(input as DeriveInput); - let opts = Opts::from_derive_input(&ast).expect("Wrong options"); - - let origin_ident = &ast.ident; - let parser_name = format!("{origin_ident}Parser"); - let parser_ident = Ident::new(&parser_name, origin_ident.span()); - - let attributes = create_attribute(&ast); - let attributes_build = create_attribute_build(&ast); - let attributes_new = create_attribute_new(&ast); - let parse_attribute = create_parse_attribute(&ast); - - let children = create_children(&ast); - let children_build = create_children_build(&ast); - let children_new = create_children_new(&ast); - let parse_child_comment = create_parse_child_comment(&ast, &opts); - let parse_child_element = create_parse_child_element(&ast, &opts); - let parse_child_text = create_parse_child_text(&ast, &opts); - - quote! { - #[derive(Debug)] - struct #parser_ident { - opts: std::rc::Rc, - #attributes - #children - } - - impl #parser_ident { - fn new(opts: std::rc::Rc) -> Self { - Self { - opts, - #attributes_new - #children_new - } - } - } - - impl crate::prelude::parser::Parser for #parser_ident { - type Output = #origin_ident; - - fn build(self) -> Result { - Ok(#origin_ident { - #attributes_build - #children_build - }) - } - - #parse_attribute - #parse_child_comment - #parse_child_element - #parse_child_text - } - - impl crate::prelude::parser::Parsable for #origin_ident { - fn parse(_tag: xmlparser::StrSpan, tokenizer: &mut xmlparser::Tokenizer, opts: std::rc::Rc) -> Result { - use crate::prelude::parser::Parser; - #parser_ident::new(opts).parse(tokenizer)?.build() - } - } - } - .into() -} diff --git a/packages/mrml-core/lib/mrml-parse-macros/src/lib.rs b/packages/mrml-core/lib/mrml-parse-macros/src/lib.rs deleted file mode 100644 index 5d667ea5..00000000 --- a/packages/mrml-core/lib/mrml-parse-macros/src/lib.rs +++ /dev/null @@ -1,20 +0,0 @@ -extern crate proc_macro; - -mod attributes; -mod children; -mod element; - -#[proc_macro_derive(MrmlParseComponent, attributes(mrml_parse))] -pub fn derive(input: proc_macro::TokenStream) -> proc_macro::TokenStream { - crate::element::derive(input) -} - -#[proc_macro_derive(MrmlParseAttributes)] -pub fn derive_attributes(input: proc_macro::TokenStream) -> proc_macro::TokenStream { - crate::attributes::derive(input) -} - -#[proc_macro_derive(MrmlParseChildren)] -pub fn derive_children(input: proc_macro::TokenStream) -> proc_macro::TokenStream { - crate::children::derive(input) -} diff --git a/packages/mrml-core/src/mj_accordion/children.rs b/packages/mrml-core/src/mj_accordion/children.rs index 1ce1a428..d5078069 100644 --- a/packages/mrml-core/src/mj_accordion/children.rs +++ b/packages/mrml-core/src/mj_accordion/children.rs @@ -5,7 +5,6 @@ use crate::mj_accordion_element::MjAccordionElement; #[cfg_attr(feature = "json", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "json", serde(untagged))] #[cfg_attr(feature = "print", derive(mrml_print_macros::MrmlPrintChildren))] -#[cfg_attr(feature = "parse", derive(mrml_parse_macros::MrmlParseChildren))] pub enum MjAccordionChild { Comment(Comment), MjAccordionElement(MjAccordionElement), diff --git a/packages/mrml-core/src/mj_body/children.rs b/packages/mrml-core/src/mj_body/children.rs index e9f45e2f..cb3f66c5 100644 --- a/packages/mrml-core/src/mj_body/children.rs +++ b/packages/mrml-core/src/mj_body/children.rs @@ -30,7 +30,6 @@ use crate::text::Text; #[cfg_attr(feature = "json", derive(serde::Deserialize, serde::Serialize))] #[cfg_attr(feature = "json", serde(untagged))] #[cfg_attr(feature = "print", derive(mrml_print_macros::MrmlPrintChildren))] -#[cfg_attr(feature = "parse", derive(mrml_parse_macros::MrmlParseChildren))] pub enum MjBodyChild { Comment(Comment), MjAccordion(MjAccordion), diff --git a/packages/mrml-core/src/mj_breakpoint/mod.rs b/packages/mrml-core/src/mj_breakpoint/mod.rs index d4dc5529..ffe97b45 100644 --- a/packages/mrml-core/src/mj_breakpoint/mod.rs +++ b/packages/mrml-core/src/mj_breakpoint/mod.rs @@ -10,7 +10,6 @@ pub const NAME: &str = "mj-breakpoint"; #[derive(Debug, Default)] #[cfg_attr(feature = "json", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "print", derive(mrml_print_macros::MrmlPrintAttributes))] -#[cfg_attr(feature = "parse", derive(mrml_parse_macros::MrmlParseAttributes))] pub struct MjBreakpointAttributes { #[cfg_attr(feature = "json", serde(skip_serializing_if = "String::is_empty"))] pub width: String, diff --git a/packages/mrml-core/src/mj_button/parse.rs b/packages/mrml-core/src/mj_button/parse.rs index 7c7ae155..679b7d2e 100644 --- a/packages/mrml-core/src/mj_button/parse.rs +++ b/packages/mrml-core/src/mj_button/parse.rs @@ -5,7 +5,6 @@ use crate::prelude::parser::{AttributesParser, ChildrenParser, ElementParser, Er impl<'a> ElementParser<'a, MjButton> for MrmlParser<'a> { fn parse(&mut self, _tag: StrSpan<'a>) -> Result { - println!("mj-button open"); let attributes = self.parse_attributes()?; let ending = self.assert_element_end()?; if ending.empty { @@ -18,7 +17,6 @@ impl<'a> ElementParser<'a, MjButton> for MrmlParser<'a> { let children = self.parse_children()?; self.assert_element_close()?; - println!("mj-button close"); Ok(MjButton { attributes, diff --git a/packages/mrml-core/src/mj_carousel/children.rs b/packages/mrml-core/src/mj_carousel/children.rs index cc2d8add..d4df4cc2 100644 --- a/packages/mrml-core/src/mj_carousel/children.rs +++ b/packages/mrml-core/src/mj_carousel/children.rs @@ -5,7 +5,6 @@ use crate::mj_carousel_image::MjCarouselImage; #[cfg_attr(feature = "json", derive(serde::Deserialize, serde::Serialize))] #[cfg_attr(feature = "json", serde(untagged))] #[cfg_attr(feature = "print", derive(mrml_print_macros::MrmlPrintChildren))] -#[cfg_attr(feature = "parse", derive(mrml_parse_macros::MrmlParseChildren))] pub enum MjCarouselChild { Comment(Comment), MjCarouselImage(MjCarouselImage), diff --git a/packages/mrml-core/src/mj_font/mod.rs b/packages/mrml-core/src/mj_font/mod.rs index 3f79fc00..17af255a 100644 --- a/packages/mrml-core/src/mj_font/mod.rs +++ b/packages/mrml-core/src/mj_font/mod.rs @@ -10,7 +10,6 @@ pub const NAME: &str = "mj-font"; #[derive(Debug, Default)] #[cfg_attr(feature = "json", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "print", derive(mrml_print_macros::MrmlPrintAttributes))] -#[cfg_attr(feature = "parse", derive(mrml_parse_macros::MrmlParseAttributes))] pub struct MjFontAttributes { name: String, href: String, diff --git a/packages/mrml-core/src/mj_head/children.rs b/packages/mrml-core/src/mj_head/children.rs index c5697ffc..e469100a 100644 --- a/packages/mrml-core/src/mj_head/children.rs +++ b/packages/mrml-core/src/mj_head/children.rs @@ -12,7 +12,6 @@ use crate::mj_title::MjTitle; #[cfg_attr(feature = "json", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "json", serde(untagged))] #[cfg_attr(feature = "print", derive(mrml_print_macros::MrmlPrintChildren))] -#[cfg_attr(feature = "parse", derive(mrml_parse_macros::MrmlParseChildren))] pub enum MjHeadChild { Comment(Comment), MjAttributes(MjAttributes), diff --git a/packages/mrml-core/src/mj_navbar/children.rs b/packages/mrml-core/src/mj_navbar/children.rs index 5f175b95..b9e1d5ec 100644 --- a/packages/mrml-core/src/mj_navbar/children.rs +++ b/packages/mrml-core/src/mj_navbar/children.rs @@ -5,7 +5,6 @@ use crate::mj_navbar_link::MjNavbarLink; #[cfg_attr(feature = "json", derive(serde::Deserialize, serde::Serialize))] #[cfg_attr(feature = "json", serde(untagged))] #[cfg_attr(feature = "print", derive(mrml_print_macros::MrmlPrintChildren))] -#[cfg_attr(feature = "parse", derive(mrml_parse_macros::MrmlParseChildren))] pub enum MjNavbarChild { Comment(Comment), MjNavbarLink(MjNavbarLink), diff --git a/packages/mrml-core/src/mj_raw/children.rs b/packages/mrml-core/src/mj_raw/children.rs index 261023cd..c538e964 100644 --- a/packages/mrml-core/src/mj_raw/children.rs +++ b/packages/mrml-core/src/mj_raw/children.rs @@ -6,7 +6,6 @@ use crate::text::Text; #[cfg_attr(feature = "json", derive(serde::Deserialize, serde::Serialize))] #[cfg_attr(feature = "json", serde(untagged))] #[cfg_attr(feature = "print", derive(mrml_print_macros::MrmlPrintChildren))] -#[cfg_attr(feature = "parse", derive(mrml_parse_macros::MrmlParseChildren))] pub enum MjRawChild { Comment(Comment), Node(Node), diff --git a/packages/mrml-core/src/mj_social/children.rs b/packages/mrml-core/src/mj_social/children.rs index 117687dc..985a23a8 100644 --- a/packages/mrml-core/src/mj_social/children.rs +++ b/packages/mrml-core/src/mj_social/children.rs @@ -5,7 +5,6 @@ use crate::mj_social_element::MjSocialElement; #[cfg_attr(feature = "json", derive(serde::Deserialize, serde::Serialize))] #[cfg_attr(feature = "json", serde(untagged))] #[cfg_attr(feature = "print", derive(mrml_print_macros::MrmlPrintChildren))] -#[cfg_attr(feature = "parse", derive(mrml_parse_macros::MrmlParseChildren))] pub enum MjSocialChild { Comment(Comment), MjSocialElement(MjSocialElement),