-
Notifications
You must be signed in to change notification settings - Fork 136
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
first iteration of the attribute per tag POC #154
Conversation
i want it to have smaller diffs before marking it ready for review. |
Probably line-endings? By the way @pointbazaar, if you're interested in making major changes I'm okay with releasing a 2.0.0 version :) |
|
PR should be ready for review now. |
Attributes that are legal per tag This would be helpful for refining the types. |
Looks good @pointbazaar ! Did you see the I see you're using some |
made those changes. Yes, that with the 'final' was probably just habit. There are some 'final' in the codebase, but definitely not around the places where i modified. |
There is a test failing however,
Maybe it has to do with me being on Linux? |
We should probably copy this to enable CI for all OSes: https://github.com/tipsy/javalin/blob/master/.github/workflows/main.yml |
@pointbazaar I've added a OS/JDK test matrix now, try rebasing your PR. |
…make it more consistent with the rest of the code
I'm not that experienced with git and rebasing, but managed to make this branch contain only the 4 relevant commits, with (hopefully) the desired commit history. If you want, i could squash the commits also. |
That's okay, I can squash the commits from the GitHub UI. I wanted you to rebase to trigger the tests, and they seem to be passing on all OSes and all JDKs :) I'll merge the PR now, thank you ! |
i honestly do not know why it is creating such huge diffs. some of these methods i did not touch at all.
Sometimes i changed like 3 things in a file and it marks the whole file as a diff. if someone could point out what i did wrong,
that would be nice.
Anyways, here's what i have changed:
TagCreator now has html(...), body(...), head(...) methods that return a specialized class respectively.
HtmlTag extends Tag as it cannot be viewed as a ContainerTag instance, which is far too lenient and would allow for anything to be inserted with .with(...)
BodyTag and HeadTag extend ContainerTag, as they can contain almost any tag (except ofc. HtmlTag, BodyTag, HeadTag, but that is not considered in this PR.)
A bunch of tests have been changed to use the new html(...) methods (.with(...) will not work with it anymore)
As the project did not build for me (i'm on OpenJDK 14.0.1) , i also changed the Employee class
When using this code to build up Html, there would now be a clear distinction between methods that return ContainerTag and methods that return HtmlTag.
If this gets accepted, the next step would probably be to make BodyTag and HeadTag and HtmlTag unable to be
used in body(...) and head(...) as that would be invalid html.
All tests are passing.