Skip to content
This repository has been archived by the owner on Oct 9, 2022. It is now read-only.

Commit

Permalink
misc improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
sanity committed Dec 20, 2018
1 parent 765d941 commit c18515c
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion gettingstarted.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,37 @@ This simple example already illustrates some important features of Kweb:

* Getting a kwebsite up and running is a breeze, no messing around with servlets, or third party webservers

* Your Kweb code will loosely mirror the structure of your page HTML
* Your Kweb code will loosely mirror the structure of your page HTML

Hello world²
------------

This isn't some templating language, we have the full power of Kotlin at our disposal. Witness the power of the
'for' loop:

.. code-block:: kotlin
import io.kweb.*
import io.kweb.dom.element.*
fun main() {
Kweb(port = 8091) {
doc.body.new {
for (x in 1..5) {
h1().text("Hello World $x!")
}
}
}
}
To produce...

.. code-block:: html

<body>
<h1>Hello World 1!</h1>
<h1>Hello World 2!</h1>
<h1>Hello World 3!</h1>
<h1>Hello World 4!</h1>
<h1>Hello World 5!</h1>
</body>

0 comments on commit c18515c

Please sign in to comment.