diff --git a/src/node/utils/ExportHtml.js b/src/node/utils/ExportHtml.js
index 3e42b88b1..bb29b34d3 100644
--- a/src/node/utils/ExportHtml.js
+++ b/src/node/utils/ExportHtml.js
@@ -332,12 +332,23 @@ function getHTMLFromAtext(pad, atext, authorColors)
pieces.push('')
}
lists.push([line.listLevel, line.listTypeName]);
+
+ // if there is a previous list we need to open x tags, where x is the difference of the levels
+ // if there is no previous list we need to open x tags, where x is the wanted level
+ var toOpen = lists.length > 1 ? line.listLevel - lists[lists.length - 2][0] - 1 : line.listLevel - 1
+
if(line.listTypeName == "number")
{
+ if(toOpen > 0){
+ pieces.push(new Array(toOpen + 1).join('
'))
+ }
pieces.push('- ', lineContent || '
');
}
else
{
+ if(toOpen > 0){
+ pieces.push(new Array(toOpen + 1).join(''))
+ }
pieces.push('- ', lineContent || '
');
}
}
@@ -383,28 +394,19 @@ function getHTMLFromAtext(pad, atext, authorColors)
pieces.push(' - ', lineContent || '
');
}
}
- else//outside any list
+ else//outside any list, need to close line.listLevel of lists
{
if(lists.length > 0){
if(lists[lists.length - 1][1] == "number"){
pieces.push('
');
+ pieces.push(new Array(lists[lists.length - 1][0]).join('
'))
} else {
pieces.push('');
+ pieces.push(new Array(lists[lists.length - 1][0]).join(''))
}
- lists.length--;
- }
- while (lists.length > 0)//if was in a list: close it before
- {
- if(lists[lists.length - 1][1] == "number")
- {
- pieces.push('');
- }
- else
- {
- pieces.push('');
- }
- lists.length--;
}
+ lists = []
+
var lineContentFromHook = hooks.callAllStr("getLineHTMLForExport",
{
line: line,