Change empty attribute syntax to use [square brackets]
Closes #59 See #44
This commit is contained in:
parent
ac37a5be46
commit
68feeeff1b
2 changed files with 5 additions and 5 deletions
maud_macros
|
@ -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)?;
|
||||
|
|
|
@ -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>"#,
|
||||
|
|
Loading…
Add table
Reference in a new issue