Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

html attribute for (on label tag) doesn't parse #117

Closed
cschneid opened this issue Jan 29, 2018 · 1 comment
Closed

html attribute for (on label tag) doesn't parse #117

cschneid opened this issue Jan 29, 2018 · 1 comment
Labels

Comments

@cschneid
Copy link

This works:

form action="/signup" method="post" {
    h1 "signup form"
    div {
        label "Email";
        input#email name="email";
    }
    div {
        label "Password";
        input#password type="password" name="password";
    }
    button type="submit";
}

But add for attribute to the labels and it stops compiling.

...
label "Email" for="email";
...

The error message emitted is:

error: proc macro panicked
  --> users_web/src/lib.rs:71:37
   |
71 |       MaudTemplate::new(public_layout(html! {
   |  _____________________________________^
72 | |         form action="/signup" method="post" {
73 | |             h1 "signup form"
74 | |             div {
...  |
83 | |         }
84 | |     }))
   | |_____^
   |
   = help: message: unexpected end of input
@lambda-fairy
Copy link
Owner

Thanks for reporting!

Does this work?

label for="email" "Email";

Element bodies should always go after attributes, as in HTML.

I've been thinking of making the braces mandatory, since I don't think the shorthand syntax has been pulling its weight. Maybe this issue is the kick I need to start working on that 😋

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants