diff --git a/src/node/utils/ExportHtml.js b/src/node/utils/ExportHtml.js
index 5179adf6..01920da7 100644
--- a/src/node/utils/ExportHtml.js
+++ b/src/node/utils/ExportHtml.js
@@ -21,7 +21,6 @@ var padManager = require("../db/PadManager");
var ERR = require("async-stacktrace");
var Security = require('ep_etherpad-lite/static/js/security');
var hooks = require('ep_etherpad-lite/static/js/pluginfw/hooks');
-var getPadPlainText = require('./ExportHelper').getPadPlainText;
var _analyzeLine = require('./ExportHelper')._analyzeLine;
var _encodeWhitespace = require('./ExportHelper')._encodeWhitespace;
@@ -79,6 +78,10 @@ function getHTMLFromAtext(pad, atext, authorColors)
var tags = ['h1', 'h2', 'strong', 'em', 'u', 's'];
var props = ['heading1', 'heading2', 'bold', 'italic', 'underline', 'strikethrough'];
+ // holds a map of used styling attributes (*1, *2, etc) in the apool
+ // and maps them to an index in props
+ // *3:2 -> the attribute *3 means strong
+ // *2:5 -> the attribute *2 means s(trikethrough)
var anumMap = {};
var css = "";
@@ -88,24 +91,24 @@ function getHTMLFromAtext(pad, atext, authorColors)
if(authorColors){
css+="";
}
+ // iterates over all props(h1,h2,strong,...), checks if it is used in
+ // this pad, and if yes puts its attrib id->props value into anumMap
props.forEach(function (propName, i)
{
var propTrueNum = apool.putAttrib([propName, true], true);
@@ -128,11 +133,6 @@ function getHTMLFromAtext(pad, atext, authorColors)
function getLineHTML(text, attribs)
{
- var propVals = [false, false, false];
- var ENTER = 1;
- var STAY = 2;
- var LEAVE = 0;
-
// Use order of tags (b/i/u) as order of nesting, for simplicity
// and decent nesting. For example,
// Just bold Bold and italics Just italics
@@ -145,17 +145,17 @@ function getHTMLFromAtext(pad, atext, authorColors)
function getSpanClassFor(i){
//return if author colors are disabled
if (!authorColors) return false;
-
+
var property = props[i];
-
+
if(property.substr(0,6) === "author"){
return stripDotFromAuthorID(property);
}
-
+
if(property === "removed"){
return "removed";
}
-
+
return false;
}
@@ -163,7 +163,7 @@ function getHTMLFromAtext(pad, atext, authorColors)
{
openTags.unshift(i);
var spanClass = getSpanClassFor(i);
-
+
if(spanClass){
assem.append('= 0; i--)
+
+ // close all the tags that are open after the last op
+ while (openTags.length > 0)
{
- if (propVals[i])
- {
- tags2close.push(i);
- propVals[i] = false;
- }
+ emitCloseTag(openTags[0])
}
-
- orderdCloseTags(tags2close);
} // end processNextChars
if (urls)
{
@@ -363,7 +301,7 @@ function getHTMLFromAtext(pad, atext, authorColors)
{
var line = _analyzeLine(textLines[i], attribLines[i], apool);
var lineContent = getLineHTML(line.text, line.aline);
-
+
if (line.listLevel)//If we are inside a list
{
// do list stuff
@@ -573,8 +511,8 @@ function _processSpaces(s){
}
}
// beginning of line is nbsp
- for (var i = 0; i < parts.length; i++){
- var p = parts[i];
+ for (i = 0; i < parts.length; i++){
+ p = parts[i];
if (p == " "){
parts[i] = ' ';
break;
@@ -586,8 +524,8 @@ function _processSpaces(s){
}
else
{
- for (var i = 0; i < parts.length; i++){
- var p = parts[i];
+ for (i = 0; i < parts.length; i++){
+ p = parts[i];
if (p == " "){
parts[i] = ' ';
}