LinearDoc: Flattened representation of Inline HTML

Use "linearization" technique to flatten inline content. The resulting
marked-up "linear text" is much easier to substring validly and plaintext
algorithms are readily adapted to it. See:

 http://www.mediawiki.org/wiki/Content_translation/LinearDoc .

lineardoc/LinearDoc.js:
* SAX linearizer
* Doc (linearized document) class, with TextBlocks made of inline TextChunks
* Rich-text segmentation bootstrapped automatically from plaintext segmentation
* Inline styling, references etc are attached to the plaintext
* So language-specific segmenters do not need to deal with '<i>', '[5]' etc.
* Browser-compatible debug dump output (dumpXml)

test/lineardoc/*
* Unit tests

Change-Id: I0b53b87f60494b49ad8b0fb7654dd859f6f97045
Merge "LinearDoc: Flattened representation of Inline HTML"