Change empty attribute syntax to use [square brackets]

Closes 
See 
This commit is contained in:
Chris Wong 2016-11-17 20:39:02 +13:00
parent ac37a5be46
commit 68feeeff1b
2 changed files with 5 additions and 5 deletions
maud_macros

View file

@ -504,7 +504,7 @@ impl<'cx, 'a, 'i> Parser<'cx, 'a, 'i> {
// Empty attribute
self.shift(1);
match *self.input {
[TokenTree::Delimited(_, ref d), ..] if d.delim == DelimToken::Paren => {
[TokenTree::Delimited(_, ref d), ..] if d.delim == DelimToken::Bracket => {
// Toggle the attribute based on a boolean expression
self.shift(1);
let cond = self.with_rust_parser(d.tts.clone(), RustParser::parse_expr)?;

View file

@ -41,10 +41,10 @@ fn attributes() {
fn empty_attributes() {
let rocks = true;
let s = html!({
input checked?(true) /
input checked?(false) /
input checked?(rocks) /
input checked?(!rocks) /
input checked?[true] /
input checked?[false] /
input checked?[rocks] /
input checked?[!rocks] /
}).into_string();
assert_eq!(s, concat!(
r#"<input checked>"#,