15702ac0d7fdb2a50fedf3c7d92d5c50fd2df51f
* Extracted rendering functionality into implementations of HtmlBuilder. - Two HtmlBuilders are implemented, FlatHtml and IndentedHtml. Each offers the equivalent output as ContainerTag.render() and ContainerTag.renderFormatted. - Existing implementations of DomContent/Renderable were updated to support HtmlBuilder where possible. - Attribute was altered to support the use of TagBuilder. - Config was altered to allow instances to be created, which can be passed into factory methods for the HtmlBuilders. Config.defaults() can be used for library defaults, while Config.global() can be used for current static configuration. - Retained compatibility with previous library version as much as possible. See RenderingCompatabilityTest. * Fixing unchecked or unsafe operations * Removing unnecessary @param from javadoc. * Improving casting of HtmlBuilders in implementations of DomContent (tags, text, etc.). * Preventing NPEs when text is null. Co-authored-by: Oliver Becker <ob@obqo.de>
completely separate the generated interfaces from manual ones and completely separate the manual tags from the generated ones. Also wipe the directories for code generation before code generation (#167)
j2html
Java to HTML generator. Enjoy typesafe HTML generation.
The project webpage is j2html.com.
Getting started
Add the maven dependency
<dependency>
<groupId>com.j2html</groupId>
<artifactId>j2html</artifactId>
<version>1.4.0</version>
</dependency>
Or the gradle dependency
compile 'com.j2html:j2html:1.4.0'
Import TagCreator and start building HTML
import static j2html.TagCreator.*;
public class Main {
public static void main(String[] args) {
body(
h1("Hello, World!"),
img().withSrc("/img/hello.png")
).render();
}
}
The above Java will result in the following HTML:
<body>
<h1>Hello, World!</h1>
<img src="/img/hello.png">
</body>
Find more examples at http://j2html.com/examples.html
Description
Languages
Java
96.5%
CSS
1.8%
HTML
1.4%
JavaScript
0.3%