fix export of lists with bullets; <li> are closed before the next list starts. also, when closing, ensure that list-items are not nested

pull/2417/head
webzwo0i 2014-12-28 02:31:26 +01:00
parent 53ca26d030
commit d71b11f4b2
1 changed files with 14 additions and 3 deletions

View File

@ -328,6 +328,9 @@ function getHTMLFromAtext(pad, atext, authorColors)
if (whichList >= lists.length)//means we are on a deeper level of indentation than the previous line
{
if(lists.length > 0){
pieces.push('</li>')
}
lists.push([line.listLevel, line.listTypeName]);
if(line.listTypeName == "number")
{
@ -363,7 +366,7 @@ function getHTMLFromAtext(pad, atext, authorColors)
pieces.push('<br><br>');
}
}*/
else//means we are getting closer to the lowest level of indentation
else//means we are getting closer to the lowest level of indentation or are at the same level
{
while (whichList < lists.length - 1)
{
@ -382,15 +385,23 @@ function getHTMLFromAtext(pad, atext, authorColors)
}
else//outside any list
{
if(lists.length > 0){
if(lists[lists.length - 1][1] == "number"){
pieces.push('</li></ol>');
} else {
pieces.push('</li></ul>');
}
lists.length--;
}
while (lists.length > 0)//if was in a list: close it before
{
if(lists[lists.length - 1][1] == "number")
{
pieces.push('</li></ol>');
pieces.push('</ol>');
}
else
{
pieces.push('</li></ul>');
pieces.push('</ul>');
}
lists.length--;
}