[source-highlight script] Fix bug in HTML-escaping
[rst mode] Fix innerMode and copyState

Issue #2221