DOM-based WTS refactor

Fully convert the WikitextSerializer to work on the DOM instead of tokens, and
enforce separator constraints throughout.

We are collecting separator newlines and merging separator constraints until
the serializer produces non-empty output. At this point, the separator is
constructed according to the merged constraints and emitted before forwarding
the regular serializer output.

The explicit constraint handling and -merging avoids breaking when serializing
HTML with extra newlines.

TODO:
- Get selser test results back up to old levels.
  Current non-selser status:
  wt2wt: 827 (833 master)
  html2html: 558 (483 master)
  html2wt: 142 (126 master)
- Clean up a bit, in particular getDOMHandler, template content handling and
  leading newline stripping from text content
- Factor out some common handler code
- Handle newlines in text content too
- Fix wt2wt failures for indentend tables using selser

Change-Id: I67463a12fd200f3a9f15c55658d5efda5e334d83