Change the behavior of before_render and after_render hooks from #761.

This changes the before_render and after_render hooks so that the callbacks 
given to them each get to modify the template source / the rendered output in
turn, instead of having to modify them in-place. It also changes the
arguments provided to the callbacks - now, they are given the source/output,
the locals hash, and the Tilt template *class*, wheras previously they were
given the source/output and the Tilt template *instance*. The locals hash is
there in case pron case hooks want to pay attention to the locals in some
way. The before_render hook is also run before compiling the template and
caching it, which should prevent weird data mismatches and save some template
compilation effort.