Properly escape HTML anchors and id attributes.

<ref name="15%"> was causing issues because of the unescaped percent
symbol.  Add a test case including all the TeX special characters to
ensure we've fixed all variants of this bug.

Bug: 68854
Change-Id: Id7678159a906c40c90e49194aa9e331ce27ac1b9