From b8c405e82ed79b72a390badf57d2075c1efa0d04 Mon Sep 17 00:00:00 2001 From: John McLear Date: Mon, 24 Nov 2014 15:29:44 +0000 Subject: [PATCH] just some cruft for reference --- src/node/utils/ImportHtml.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/node/utils/ImportHtml.js b/src/node/utils/ImportHtml.js index 48188dfd0..ea365cfa9 100644 --- a/src/node/utils/ImportHtml.js +++ b/src/node/utils/ImportHtml.js @@ -14,22 +14,31 @@ * limitations under the License. */ -var jsdom = require('jsdom-nocontextifiy').jsdom; +var jsdom = require('jsdom').jsdom; var log4js = require('log4js'); var Changeset = require("ep_etherpad-lite/static/js/Changeset"); var contentcollector = require("ep_etherpad-lite/static/js/contentcollector"); +var cheerio = require('cheerio'); function setPadHTML(pad, html, callback) { var apiLogger = log4js.getLogger("ImportHtml"); + console.error("attempting to jsdom this bitch"); // Parse the incoming HTML with jsdom + try{ var doc = jsdom(html.replace(/>\n+<')); }catch(e){ apiLogger.warn("Error importing, possibly caused by malformed HTML"); var doc = jsdom("
Error during import, possibly malformed HTML
"); } + console.error("doc", doc); + + var cheerio = require('cheerio') + doc = cheerio.load(html); + console.error("doc", doc); + console.warn("doc parse HTML", doc.parseHTML()); apiLogger.debug('html:'); apiLogger.debug(html); @@ -46,6 +55,8 @@ function setPadHTML(pad, html, callback) var result = cc.finish(); + console.error("result", result); + apiLogger.debug('Lines:'); var i; for (i = 0; i < result.lines.length; i += 1)