parent
1ec48a3725
commit
d2bf70da9a
2 changed files with 22 additions and 4 deletions
maud_macros
|
@ -557,10 +557,21 @@ impl<'cx, 'a, 'i> Parser<'cx, 'a, 'i> {
|
|||
},
|
||||
_ => return Err(FatalError),
|
||||
};
|
||||
while let [minus!(), ident!(_, name), ..] = *self.input {
|
||||
self.shift(2);
|
||||
s.push('-');
|
||||
s.push_str(&name.name.as_str());
|
||||
let mut expect_ident = false;
|
||||
loop {
|
||||
expect_ident = match *self.input {
|
||||
[minus!(), ..] => {
|
||||
self.shift(1);
|
||||
s.push('-');
|
||||
true
|
||||
},
|
||||
[ident!(_, name), ..] if expect_ident => {
|
||||
self.shift(1);
|
||||
s.push_str(&name.name.as_str());
|
||||
false
|
||||
},
|
||||
_ => break,
|
||||
};
|
||||
}
|
||||
Ok(s)
|
||||
}
|
||||
|
|
|
@ -130,6 +130,13 @@ fn classes_shorthand() {
|
|||
assert_eq!(s, r#"<p>Hi, <span class="name here">Lyra</span>!</p>"#);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hyphens_in_class_names() {
|
||||
let mut s = String::new();
|
||||
html!(s, p.rocks-these.are--my--rocks "yes").unwrap();
|
||||
assert_eq!(s, r#"<p class="rocks-these are--my--rocks">yes</p>"#);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ids_shorthand() {
|
||||
let mut s = String::new();
|
||||
|
|
Loading…
Add table
Reference in a new issue