assload of improvements

making html block detection a lot smarter (completely rewrote)

doing this fixed a number of bugs in the parsing, which the tests were
updated to reflect. tight as a drum now, i think.