Added HTML encode functionality

Needed it for something, added code based on the "mustache" project:
https://github.com/janl/mustache.js/blob/32db14a490ae19455d4367c35f412bd0ecdba17c/mustache.js#L43