29 Commits

Author SHA1 Message Date
Justin Starry
478b5b99bb Support dashed custom tag names 2019-07-30 01:30:24 -04:00
Thomas Lacroix
5908d33b2c
html!: allow mixing self-closing and non-sc tags
#### Problem
Self-closing tags are more convenient when there are no children. For
instance, React's JSX allows it.

Before, self-closing tags where considered as open tags in `verify_end`,
causing codes like this to not compile:

```rust
html! {
    <div>
        <div/> // <- considered as open tag
    </div>
}
```

```
error: this open tag has no corresponding close tag
   --> src/lib.rs:264:17
    |
... | <div>
    | ^^^^^
```

#### Solution
Add a new `Peek`-able `HtmlSelfClosingTag`, used in `verify_end`.

However, this fix isn't ideal because it peeks the buffer twice for
non self-closing tags. I did it that way in order to keep the peek
thing. An alternative would be to turn HtmlSelfClosingTag::peek into a
function returning (ident, is_self_closing).

#### Notes
I added a TODO for when proc-macro::Diagnostic gets stabilized, in
order to replace the clunky `eprintln!` with proper diagnostics. I
didn't try to return a Result to get a nice error right now because
this error should be fairly rare so we can just wait IMO.

Fixes: #522
2019-07-26 15:09:18 +02:00
Justin Starry
97818842d7 Improve component trait check 2019-07-21 10:37:42 -04:00
Justin Starry
073d0af65d Update macro doc tests 2019-07-20 23:03:05 -04:00
Justin Starry
da1374540f Refactor props derive 2019-07-20 22:38:50 -04:00
Justin Starry
3fed651b42 Add support for required props 2019-07-20 22:38:50 -04:00
Justin Starry
d8ca45e9dd Bump version to 0.8.0 2019-07-19 10:44:03 -04:00
Justin Starry
4d775730ca Small fixes to yew-macro Cargo.toml 2019-07-19 10:25:07 -04:00
Justin Starry
43e101d201 Update macro docs and set macro version in yew cargo.toml 2019-07-18 08:38:26 -04:00
Justin Starry
af45d91f05 Remove macro-impl crate 2019-07-15 10:06:43 -04:00
Justin Starry
18e045eb51 Rework macro tests and remove yew-shared dependency 2019-07-14 22:47:15 -04:00
Justin Starry
c0bb528f76 Allow using keyword for as tag attribute 2019-07-06 10:30:59 -04:00
Justin Starry
e373df1ca2
Merge branch 'master' into refactor-vcomp 2019-07-05 20:41:26 -04:00
Justin Starry
0f87b5506d Fix test 2019-07-03 09:10:11 -04:00
Justin Starry
8962b77ff5 Support dashed tag labels 2019-07-03 00:13:12 -04:00
Justin Starry
1e1eb6f019 Code cleanup 2019-06-27 15:55:58 -04:00
Justin Starry
5615f53540 Add more test cases and improve error messages 2019-05-28 16:31:04 -04:00
Justin Starry
47f4b5088f Add test for invalid list children 2019-05-28 15:54:16 -04:00
Justin Starry
eccee9c39e Improve error messages 2019-05-28 15:52:45 -04:00
Justin Starry
a12a38f1e5 Code cleanup and small fix for component type parsing 2019-05-28 10:33:05 -04:00
Justin Starry
58c69d3bfb Special handling for href 2019-05-27 23:23:16 -04:00
Justin Starry
4011a7c7e1 Use component transform trait to set props 2019-05-27 23:08:22 -04:00
Justin Starry
1625a81b67 Add tag listener support 2019-05-27 17:35:45 -04:00
Justin Starry
44775c1abd Support special tag attributes 2019-05-27 09:34:22 -04:00
Justin Starry
9a8b0ad06e Disallow type prop for components 2019-05-27 09:01:13 -04:00
Justin Starry
284a680ba2 Implement tag attributes and overhaul prop parsing 2019-05-27 08:51:23 -04:00
Justin Starry
3aca0d8c17 Support component props 2019-05-26 09:44:10 -04:00
Justin Starry
a7291b87a1 Add root component tests 2019-05-25 16:15:56 -04:00
Justin Starry
1605c15f35 Rename macro crates, add proc_macro feature switch, split off shared crate 2019-05-25 16:14:32 -04:00