in reply to Effective ways to 'write' html.

You may take a look of Perlet Engine. The ideas are simple:

A design like this seems to be very flexible and clean.

And yes, I know that the serialization procedure is slow -- now I rewrite it with XS.

Thank you for your comments.