I did a similar thing using another approach (unpublished) where I use blocking fibers and fiber locals [1] instead of instance variables so you don't have to wrap anything in a `html_slice`-block or keep track of ids. Maybe I should open a PR.
I did this as an experiment for my own web framework [2] but I decided to use Haml for templating instead.