Fix lost content escaping for html safety

During generator refactoring to enable the swift backend, we
incorrectly set a state flag which meant we *never* escaped < > any
more. Apparently it took a while for people to notice.

The fix is to actually correctly set the flag in the _discover_html
function. A unit test is added to ensure that we don't break this
again in the future.

Change-Id: Ifa9d34c45047a257a392c729aaf792f17d8ff453
Closes-Bug: #1367021