WTS: Fixes to emitSeparator, makeSeparator, escapeWikiText.

* Cleaned up code, improved documentation, and fixed some
  missing cases in emitSeparator.  Added code that tries to
  use a run of IEW and comment nodes to infer DSR for non-elt.
  nodes.  For now, made the application of this conditional
  on rt-testing mode (could possibly consider this making this
  non-conditional after we think through this a bit more -- see
  comment in the precedingSeparatorTxt function).

* Fixed a bug in the single-comment-only line regexp in
  makeSeparator which was causing artificial failures in
  certain test/serialization modes since "<!--a--><!--b-->\n"
  was being stripped out when it should not have been.

  Fixed a bug in the check that strips leading space to
  prevent indent-pres from triggering on serialized wikitext.

  Improved conservative pre-space stripping to recognize
  pre-safe tag contexts.

* Added missing separator verification code when DSR is used
  to emit separators.  This verification is needed to make
  sure that dsr-based separator and html-accumulated separator
  are identical (which they may not be for edited sections).

  The serializer, before this patch, loses edits made to
  separator text which can be verified with the test cases below:

% echo "
a
   
b
" | node parse | sed 's/   / /;' |
  node parse --html2wt --oldtext "
a
   
b
"
% echo "
a
   
b
" | node parse | sed 's/   /      /;' |
  node parse --html2wt --oldtext "
a
   
b
"

  While the above might be considered syntatic diffs, the following
  example shows a semantic diff which is more serious.

% cat /tmp/tst
  
a

  
b

% node parse < /tmp/tst | sed
  's/<pre[^<>]*>//g;s/<\/pre>//g;' | node parse --html2wt --oldtextfile
  /tmp/tst
  
a

  
b


* The previous fixes broke a couple wt2wt tests which led me to
  remove the p-indent-pre hack and in turn fix wikitext escaping code
  to use a onSOL state flag which also simplified the wikitext
  logic a tiny bit.

* Fixes the following snippets (Added to parser tests -- pending merge)
  - <span> 
x</span> 

  - ''' ''x''' ''
  - {|\n|-\n <!--c-->\n|}
  - {|\n|-\n<!--c--> <!--d-->\n|}

* Parser test results:
  - 4 more wt2wt tests pass (and one existing wt2wt test fails)
  - 1 more html2wt test passes
  - 4 new selser tests pass, but 18 old selser tests fail.

  The failing wt2wt test uses tabs for indent-pre which Parsoid
  doesn't currently preserve during parsing which then shows up as
  an edit to the serializer which means the serializer replaces
  the tab with a space.  This accounts for about 13 failing selser
  tests.

  The other 5 failing selser tests are all scenarios where the
  expected output is " " and selser outputs "". I haven't
  investigated what is going on here.

* Eliminates semantic errors from:
  - en:Metropolitan Transportation Authority (New York) bus fleet

Change-Id: I24c5bce2dc9505ee9ff6f9e38836d63ca228b195
Merge "WTS: Fixes to emitSeparator, makeSeparator, escapeWikiText."