(Bug 64017) Fixed longstanding tpl-range overlap detection bug

* Consider this following template range overlap scenario:

  tpl-start-1 --- tpl-start-2 --- tpl-end-1 --- tpl-end-2

  where each of the 4 nodes above are sibling elements at some
  dom level of the document. Clearly, TPL-1 and TPL-2 overlap
  and the two ranges should be merged.

  However, the overlap detection code was using a special
  case check of "prev.end === current.start" which only works
  if tpl-end-1 and tpl-start-2 were the same element but fails
  on the DOM shown above.

  In "normal" transclusion scenarios, these kinds of overlaps
  should not be seen. But, fostering of template content can
  generate DOMs like this.

* The following snippet on enwiki reproduces this bug:
------
{{col-begin}}
{{div col}}
{{col-end}}
------

* This patch also adds a missing initialization of a data struct.
  which occasionally caused failures merging ranges and introduced
  the undefined 'length' error as in Bug 64028.

* This fix eliminates template encapsulation failures on
  enwiki:Dirrty, enwiki:Bangerz, enwiki:Back_to_Black and possibly
  other song-related pages (and possibly other pages as well). I'll
  test all the pages separately and update the bug report.

* This patch also adds a "--trace tplwrap" functionality that emits
  start/end nodes for identified tpl ranges and displays whether
  any of them overlap/nest and get merged.

* Added a simplified test case to parserTests.txt (wt2html fails
  without this patch).

Change-Id: I8c3c78f7437f31ace10bbb0ff213157c94488cbe