Add a bunch of fixes to HTML escaping, and a test case for it

Benjamin Mako Hill || Want to submit a patch?