exportHTML update

pull/3386/head
ilmar 2017-10-31 22:46:24 +02:00
parent 9f51432175
commit 5469ce85cd
1 changed files with 16 additions and 15 deletions

View File

@ -356,7 +356,15 @@ function getHTMLFromAtext(pad, atext, authorColors)
} }
} }
} }
var context = {
line: line,
lineContent: lineContent,
apool: apool,
attribLine: attribLines[i],
text: textLines[i],
padId: pad.id
}
var lineContentFromHook = hooks.callAll("getLineHTMLForExport", context);
if (whichList >= lists.length)//means we are on a deeper level of indentation than the previous line if (whichList >= lists.length)//means we are on a deeper level of indentation than the previous line
{ {
if(lists.length > 0){ if(lists.length > 0){
@ -373,14 +381,14 @@ function getHTMLFromAtext(pad, atext, authorColors)
if(toOpen > 0){ if(toOpen > 0){
pieces.push(new Array(toOpen + 1).join('<ol>')) pieces.push(new Array(toOpen + 1).join('<ol>'))
} }
pieces.push('<ol class="'+line.listTypeName+'"><li>', lineContent || '<br>'); pieces.push('<ol class="'+line.listTypeName+'"><li>', context.lineContent || '<br>');
} }
else else
{ {
if(toOpen > 0){ if(toOpen > 0){
pieces.push(new Array(toOpen + 1).join('<ul>')) pieces.push(new Array(toOpen + 1).join('<ul>'))
} }
pieces.push('<ul class="'+line.listTypeName+'"><li>', lineContent || '<br>'); pieces.push('<ul class="'+line.listTypeName+'"><li>', context.lineContent || '<br>');
} }
} }
//the following code *seems* dead after my patch. //the following code *seems* dead after my patch.
@ -416,16 +424,16 @@ function getHTMLFromAtext(pad, atext, authorColors)
if(lists[lists.length - 1][1] == "number") if(lists[lists.length - 1][1] == "number")
{ {
pieces.push(new Array(toClose+1).join('</ol>')) pieces.push(new Array(toClose+1).join('</ol>'))
pieces.push('<li>', lineContent || '<br>'); pieces.push('<li>', context.lineContent || '<br>');
} }
else else
{ {
pieces.push(new Array(toClose+1).join('</ul>')) pieces.push(new Array(toClose+1).join('</ul>'))
pieces.push('<li>', lineContent || '<br>'); pieces.push('<li>', context.lineContent || '<br>');
} }
lists = lists.slice(0,whichList+1) lists = lists.slice(0,whichList+1)
} else { } else {
pieces.push('</li><li>', lineContent || '<br>'); pieces.push('</li><li>', context.lineContent || '<br>');
} }
} }
} }
@ -451,16 +459,9 @@ function getHTMLFromAtext(pad, atext, authorColors)
padId: pad.id padId: pad.id
} }
var lineContentFromHook = hooks.callAllStr("getLineHTMLForExport", context, " ", " ", ""); hooks.callAll("getLineHTMLForExport", context);
if (lineContentFromHook) pieces.push(context.lineContent, '<br>');
{
pieces.push(lineContentFromHook, '');
}
else
{
pieces.push(lineContent, '<br>');
}
} }
} }