In Kotlin page, under HTML-Builder
I can see the below code, how can I use it in simple .tk file? how t get started here?
val data = mapOf(1 to "one", 2 to "two")
createHTML().table {
for ((num, string) in data) {
Iterate over data
tr {
Functions to create HTML tags
td { +"$num" }
td { +string }
}
}
}
You’re referring to a DSL written in Kotlin for constructing HTML through the builder. The library can be found here: https://github.com/Kotlin/kotlinx.html
Here's a running example:
And finally here's the corresponding output: