Update to Handlebars 2.0.

Supersedes #5491.

Takes @kpdecker's excellent work upgrading, rebases, and adds a few extra changes.