Repository: jdrouet/mrml (language: python)

Issue:
Error when encountering space after closing tag
This tag won't run
```
<mjml>
  <mj-head>
  </mj-head>
  <mj-body>
  </mj-body> <!-- Here -->
</mjml>
```
While this will
```
<mjml>
  <mj-head>
  </mj-head>
  <mj-body>
  </mj-body>
</mjml>
```


Discussion / hints:
I did I miss this issue...? Sorry about that, my Github notifications seem to be screwed...

Fix patch:
diff --git a/packages/mrml-core/src/mjml/parse.rs b/packages/mrml-core/src/mjml/parse.rs
index 8779b056..dbf074b1 100644
--- a/packages/mrml-core/src/mjml/parse.rs
+++ b/packages/mrml-core/src/mjml/parse.rs
@@ -44,6 +44,12 @@ impl<'opts> ParseChildren<MjmlChildren> for MrmlParser<'opts> {
                     cursor.rewind(MrmlToken::ElementClose(close));
                     return Ok(children);
                 }
+                MrmlToken::Text(inner) if inner.text.trim().is_empty() => {
+                    // ignoring empty text
+                }
+                MrmlToken::Comment(_) => {
+                    // ignoring comment on purpose
+                }
                 MrmlToken::ElementStart(start) => match start.local.as_str() {
                     MJ_HEAD => {
                         children.head = Some(self.parse(cursor, start.local)?);


Test patch:
diff --git a/packages/mrml-core/tests/issue-474.rs b/packages/mrml-core/tests/issue-474.rs
new file mode 100644
index 00000000..9c1131fe
--- /dev/null
+++ b/packages/mrml-core/tests/issue-474.rs
@@ -0,0 +1,13 @@
+#![cfg(feature = "parse")]
+
+#[test]
+fn should_preserve_comment() {
+    let template = r#"<mjml>
+    <mj-head>
+    </mj-head>
+    <mj-body>
+    </mj-body> <!-- Here -->
+</mjml>"#;
+
+    let _root = mrml::parse(template).unwrap();
+}