Bug fixes to HTML escaping behaviour

FIXED not ignoring [<>] before deciding whether to escape
FIXED would sometimes decide to escape when outside of a closing tag
FIXED nested character escaping when pasting an existing HTML entity