Kool Templates generate HTML5 markup as a DOM using a simple statically typed template language written in Kotlin.
With Kool Templates its easy to create an entire page or DOM fragment from any function or class.
The DSL is generated from the HTML5 specification so that we can ensure that all the elements and attributes in the HTML specification are reflected in the typesafe DSL. You can still use strings for element and attribute names if you need to stray outside of the HTML5 specification; but for the cases where you want to stay inside HTML5 the DSL catches your typos.
Kool Templates are designed so that they can be used on the client side inside a web browser or used on the server side in a Servlet / JAXRS application. For example there is an example of using Kool Templates in a web browser or in a JVM with JavaFX.
Since Kool Templates are based on the DOM API, you can bind directly to DOM events from inside the template DSL.
For example see the use of the onClick() function on the button in this example)
Also using a Binder to bind expressions to nodes, its easy to allow in-place updates of the DOM using the bind function so that you can easily refresh just the parts of the DOM you need when events occur, such as a button click.
The easiest way to get started is to check out an example:
There are helper functions and an executable main() in the io.kool.html.tokool package which generates Kotlin source code using Kool Templates from a HTML document. So if you have any HTML you wish to generate you can easily turn it into a Kool Template!