ether/etherpad-lite — pull request #2417 by webzwo0i (2014-12-29 16:17:53+00:00)
Title: Fix ExportHtml.js list parsing code

This fixes some problems in the list parsing code in ExportHtml.js
It should fix https://github.com/ether/etherpad-lite/issues/1604 and also ensure that list-items from the previous line close in all cases. Also it add codes to really check how many lists should be opened or closed.
Backend and frontend tests run through, except in chromium:
keeps the indent on enter for the new line
Error: the string "Uncaught Error: wait for condition never became true function (){
return inner$("div span").first().text().indexOf("line 2") === -1;
}" was thrown, throw an Error :)
at Runner.fail (http://localhost:9001/tests/frontend/lib/mocha.js:3786:11)
at Runner.uncaught (http://localhost:9001/tests/frontend/lib/mocha.js:4059:8)
at uncaught (http://localhost:9001/tests/frontend/lib/mocha.js:4089:10)
However, in firefox it works. I tried to bisect this, but actually I can't because even at 1.4.1 the tests fail with chromium 39.0.2171.71. strange...

I must admit that I find this I little bit messy, because I do not really understand the usage of whichList... I think it does not matter one which line we are in the list parser, because it just has to keep track how many opened elements are open and that elements are closed according to what should be achived (new list? new line without any list? decreasing level of lists?). There are special cases like

foo bar

or

foo

- maybe whichList was somehow meant to catch those things?

Should I try to write another test to ensure defined behaviour in case lists are nested in such ways? If I would do that I think it would turn out that the whole whichList-code is not needed and we just should track all currently opened lists of the whole document when we insert lineContents.