RwHtmlTokenizer rewritten to be more robust