From da86d54b051b1512ac6bfee803895f67b5251922 Mon Sep 17 00:00:00 2001
From: Wim Looman
Date: Sun, 7 Feb 2016 10:59:20 +0100
Subject: [PATCH] Remove div shorthand
---
maud_macros/src/parse.rs | 4 ----
maud_macros/tests/tests.rs | 18 +++++++++---------
2 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/maud_macros/src/parse.rs b/maud_macros/src/parse.rs
index 28149638..c394c017 100644
--- a/maud_macros/src/parse.rs
+++ b/maud_macros/src/parse.rs
@@ -190,10 +190,6 @@ impl<'cx, 'i> Parser<'cx, 'i> {
let name = try!(self.name());
try!(self.element(sp, &name));
},
- // Shorthand div element
- [dot!(), ident!(sp, _), ..] => {
- try!(self.element(sp, "div"));
- },
// Block
[TokenTree::Delimited(_, ref d), ..] if d.delim == DelimToken::Brace => {
self.shift(1);
diff --git a/maud_macros/tests/tests.rs b/maud_macros/tests/tests.rs
index 52123cba..8879bccb 100644
--- a/maud_macros/tests/tests.rs
+++ b/maud_macros/tests/tests.rs
@@ -339,10 +339,10 @@ fn class_shorthand() {
}
#[test]
-fn div_class_shorthand() {
+fn class_shorthand_with_space() {
let mut s = String::new();
- html!(s, p { "Hi, " .name { "Lyra" } "!" }).unwrap();
- assert_eq!(s, "Hi,
Lyra
!
");
+ html!(s, p { "Hi, " span .name { "Lyra" } "!" }).unwrap();
+ assert_eq!(s, "Hi, Lyra!
");
}
#[test]
@@ -353,15 +353,15 @@ fn classes_shorthand() {
}
#[test]
-fn div_classes_shorthand() {
+fn classes_shorthand_with_space() {
let mut s = String::new();
- html!(s, p { "Hi, " .name.here { "Lyra" } "!" }).unwrap();
- assert_eq!(s, "Hi,
Lyra
!");
+ html!(s, p { "Hi, " span .name .here { "Lyra" } "!" }).unwrap();
+ assert_eq!(s, "Hi, Lyra!
");
}
#[test]
-fn div_classes_shorthand_with_attrs() {
+fn classes_shorthand_with_attrs() {
let mut s = String::new();
- html!(s, p { "Hi, " .name.here id="thing" { "Lyra" } "!" }).unwrap();
- assert_eq!(s, "Hi,
Lyra
!");
+ html!(s, p { "Hi, " span.name.here id="thing" { "Lyra" } "!" }).unwrap();
+ assert_eq!(s, "Hi, Lyra!
");
}