26 Sep 2015

I'm putting together a small library for generating HTML programmatically a la Seaside, called WaterMint. Here's an example:

| html |
html := WMHtmlCanvas new.
html html with: [ 
    html head with: [ html title: 'WaterMint' ].
    html body with: [ 
        html h1: 'WATERMINT'.
        html div id: 'foo'; class: 'foo'; with: [ html p: 'Foo!' ].
        html div id: 'bar'; with: [ html p: 'Bar!' ].
        html h1: 'BAZ!' ]].
html render.

The output:

<div class="foo" id="foo"><p>Foo!</p></div><div id="bar">

Code is on SmalltalkHub. It is far from complete, of course. I have not written any example to render forms and the library has as yet no facility to deal with Javascript.

Tags: WaterMint