From 1890ba39766ab6146683a43c05ae64077272e3d0 Mon Sep 17 00:00:00 2001 From: John McLear Date: Sat, 24 Jan 2015 05:14:38 +0000 Subject: [PATCH] working, might need polish its pretty late --- src/node/utils/ExportHtml.js | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/src/node/utils/ExportHtml.js b/src/node/utils/ExportHtml.js index 50ff11add..10c2fe5ff 100644 --- a/src/node/utils/ExportHtml.js +++ b/src/node/utils/ExportHtml.js @@ -411,31 +411,26 @@ function getHTMLFromAtext(pad, atext, authorColors) } lists = [] - hooks.aCallAll("asyncLineHTMLForExport", { + var context = { line: line, lineContent: lineContent, apool: apool, attribLine: attribLines[i], text: textLines[i] - }, function(err, newLineContent){ -//new Line Content is an array of each of the responses from aCallAll.. We should return a function to it -console.error(newLineContent); - if(newLineContent.length !== 0){ -console.error("lC", newLineContent[0]); - lineContent = newLineContent[0]; - } - // modified lineContent here + } + + // first context below seems superfluos + hooks.aCallAll("asyncLineHTMLForExport", context, function(err, newLineFunction){ + newLineFunction.forEach(function(fn){ + context.lineContent = fn(context); // note the fn + }); + //new Line Content is an array of each of the responses from aCallAll.. + // We should return a function to it + lineContent = context.lineContent; // modified lineContent here }); // Old hook probably not to be used.. - var lineContentFromHook = hooks.callAllStr("getLineHTMLForExport", - { - line: line, - lineContent: lineContent, - apool: apool, - attribLine: attribLines[i], - text: textLines[i] - }, " ", " ", ""); + var lineContentFromHook = hooks.callAllStr("getLineHTMLForExport", context, " ", " ", ""); if (lineContentFromHook) {