samadhiweb

smalltalk programming for the web



« Previous  |  Next »

WaterMint-HTML

26 September 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:

<html><head><title>WaterMint</title></head><body><h1>WATERMINT</h1>
<div class="foo" id="foo"><p>Foo!</p></div><div id="bar">
<p>Bar!</p></div><h1>BAZ!</h1></body></html>

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.

Blog comments powered by Disqus