As a Haml guy, I guess I should chip in. This patch is a great step
forward in terms of template delegation, which was always pretty
awkward (hence the monkeypatching to get caching working).
However, it expects the template handlers to give a compiled Ruby
string that's then rolled into a method by ActionView. Haml does
produce such a string, but it's only dealt with internally, and it
would be awkward to expose it directly for various reasons. What I'm
using in the current monkeypatched code, and what I'd like to continue
making use of, is Haml::Engine#def_method, which takes an object, a
method name, and a list of local variables, and defines a method on
the object with the given name that renders the template with those
locals. It's pretty much identical to the work done by
ActionView::Base#create_template_source, except it doesn't create the
method name and it does evaluate the method definition.
If the source-generation/compilation stuff could be refactored out and
made overridable by the individual template handlers, that would be
ideal.
Otherwise, the main issue is that the Haml source has a non-standard
line offset. If this could be set on a per-handler basis, instead of
in ActionView::Base#compile_template, I could add a source accessor to
Haml::Engine. But I'd rather not.
- Nathan