Repository: jdrouet/mrml (language: rust)

Issue:
mjml "owa" attribute is causing panic UnexpectedAttribute(16) 
I was running into this error message `Failed to parse template: UnexpectedAttribute(16)` after adding `owa="desktop"` into the MJML template like this: `<mjml lang="en" owa="desktop">`. From this recent [PR](https://github.com/mjmlio/mjml/pull/2245), the attribute should be supported as an optional attribute. Is it possible to support this feature?

Environment: macOS 11.5.2 (20G95) 
Version: mrml v1.2.7

When I run this template on the live sandbox, I'm not facing any error


Discussion / hints:
Thanks for this, I'll try to fix it shortly 😉 

Fix patch:
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 91e5f045..50cf3666 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -5,7 +5,7 @@ stages:
 
 lint-clippy:
   stage: lint
-  image: jdrouet/clippy:alpine
+  image: jdrouet/clippy:latest
   script:
     - cargo clippy -- -D warnings -A clippy::upper-case-acronyms
 
diff --git a/packages/mrml-core/src/mj_column/render.rs b/packages/mrml-core/src/mj_column/render.rs
index 285529a2..3e9e9ec9 100644
--- a/packages/mrml-core/src/mj_column/render.rs
+++ b/packages/mrml-core/src/mj_column/render.rs
@@ -61,7 +61,7 @@ impl<'e, 'h> MJColumnRender<'e, 'h> {
         } else {
             format!("mj-column-px-{}", parsed_width.value())
         };
-        (classname.replace(".", "-"), parsed_width)
+        (classname.replace('.', "-"), parsed_width)
     }
 
     fn get_mobile_width(&self) -> Option<Size> {
diff --git a/packages/mrml-core/src/mj_group/render.rs b/packages/mrml-core/src/mj_group/render.rs
index 57fb3fb2..0c44934b 100644
--- a/packages/mrml-core/src/mj_group/render.rs
+++ b/packages/mrml-core/src/mj_group/render.rs
@@ -58,7 +58,7 @@ impl<'e, 'h> MJGroupRender<'e, 'h> {
         } else {
             format!("mj-column-px-{}", parsed_width.value())
         };
-        (classname.replace(".", "-"), parsed_width)
+        (classname.replace('.', "-"), parsed_width)
     }
 
     fn set_style_root_div(&self, tag: Tag) -> Tag {
diff --git a/packages/mrml-core/src/mj_head/render.rs b/packages/mrml-core/src/mj_head/render.rs
index e00c2932..9df74d9d 100644
--- a/packages/mrml-core/src/mj_head/render.rs
+++ b/packages/mrml-core/src/mj_head/render.rs
@@ -8,7 +8,7 @@ use std::rc::Rc;
 fn google_font(name: &str) -> String {
     format!(
         "https://fonts.googleapis.com/css?family={}:300,400,500,700",
-        name.replace(" ", "+")
+        name.replace(' ', "+")
     )
 }
 
diff --git a/packages/mrml-core/src/mj_section/render.rs b/packages/mrml-core/src/mj_section/render.rs
index 83eb81da..533ec896 100644
--- a/packages/mrml-core/src/mj_section/render.rs
+++ b/packages/mrml-core/src/mj_section/render.rs
@@ -166,7 +166,7 @@ pub trait WithMJSectionBackground<'h>: Render<'h> {
         let vsize = match bg_size.as_deref() {
             Some("cover") | Some("contain") => Some("1,1".to_string()),
             Some("auto") => None,
-            Some(value) => Some(value.replace(" ", ",")),
+            Some(value) => Some(value.replace(' ', ",")),
             None => None,
         };
         let aspect = match bg_size.as_deref() {
diff --git a/packages/mrml-core/src/mjml/parse.rs b/packages/mrml-core/src/mjml/parse.rs
index c0d1aebc..e67f6698 100644
--- a/packages/mrml-core/src/mjml/parse.rs
+++ b/packages/mrml-core/src/mjml/parse.rs
@@ -16,7 +16,7 @@ impl Parser for MJMLParser {
 
     fn parse_attribute<'a>(&mut self, name: StrSpan<'a>, value: StrSpan<'a>) -> Result<(), Error> {
         match name.as_str() {
-            "lang" => self
+            "lang" | "owa" => self
                 .0
                 .attributes
                 .insert(name.to_string(), value.to_string()),
@@ -75,4 +75,11 @@ mod tests {
         let elt = MJML::parse(template).unwrap();
         assert_eq!(elt.attributes.get("lang"), Some(&"fr".to_string()));
     }
+
+    #[test]
+    fn with_owa() {
+        let template = "<mjml owa=\"desktop\"></mjml>";
+        let elt = MJML::parse(template).unwrap();
+        assert_eq!(elt.attributes.get("owa"), Some(&"desktop".to_string()));
+    }
 }


Test patch: