some more docs for attribute export and cleanup empty lines

This commit is contained in:
webzwo0i 2013-12-08 11:34:11 +01:00
parent 70c51d731b
commit a534b1ec22

View file

@ -92,24 +92,24 @@ function getHTMLFromAtext(pad, atext, authorColors)
if(authorColors){ if(authorColors){
css+="<style>\n"; css+="<style>\n";
for (var a in apool.numToAttrib) { for (var a in apool.numToAttrib) {
var attr = apool.numToAttrib[a]; var attr = apool.numToAttrib[a];
//skip non author attributes //skip non author attributes
if(attr[0] === "author" && attr[1] !== ""){ if(attr[0] === "author" && attr[1] !== ""){
//add to props array //add to props array
var propName = "author" + stripDotFromAuthorID(attr[1]); var propName = "author" + stripDotFromAuthorID(attr[1]);
var newLength = props.push(propName); var newLength = props.push(propName);
anumMap[a] = newLength -1; anumMap[a] = newLength -1;
css+="." + propName + " {background-color: " + authorColors[attr[1]]+ "}\n"; css+="." + propName + " {background-color: " + authorColors[attr[1]]+ "}\n";
} else if(attr[0] === "removed") { } else if(attr[0] === "removed") {
var propName = "removed"; var propName = "removed";
var newLength = props.push(propName); var newLength = props.push(propName);
anumMap[a] = newLength -1; anumMap[a] = newLength -1;
css+=".removed {text-decoration: line-through; " + css+=".removed {text-decoration: line-through; " +
"-ms-filter:'progid:DXImageTransform.Microsoft.Alpha(Opacity=80)'; "+ "-ms-filter:'progid:DXImageTransform.Microsoft.Alpha(Opacity=80)'; "+
"filter: alpha(opacity=80); "+ "filter: alpha(opacity=80); "+
@ -154,25 +154,27 @@ function getHTMLFromAtext(pad, atext, authorColors)
function getSpanClassFor(i){ function getSpanClassFor(i){
//return if author colors are disabled //return if author colors are disabled
if (!authorColors) return false; if (!authorColors) return false;
var property = props[i]; var property = props[i];
if(property.substr(0,6) === "author"){ if(property.substr(0,6) === "author"){
return stripDotFromAuthorID(property); return stripDotFromAuthorID(property);
} }
if(property === "removed"){ if(property === "removed"){
return "removed"; return "removed";
} }
return false; return false;
} }
// is called when an attribute is in ENTER or STAY state and saves
// a reference to it so it can be closed in order
function emitOpenTag(i) function emitOpenTag(i)
{ {
openTags.unshift(i); openTags.unshift(i);
var spanClass = getSpanClassFor(i); var spanClass = getSpanClassFor(i);
if(spanClass){ if(spanClass){
assem.append('<span class="'); assem.append('<span class="');
assem.append(spanClass); assem.append(spanClass);
@ -184,11 +186,13 @@ function getHTMLFromAtext(pad, atext, authorColors)
} }
} }
// this closes an open tag and removes its reference from openTags
// it is not directly called but via orderdCloseTags
function emitCloseTag(i) function emitCloseTag(i)
{ {
openTags.shift(); openTags.shift();
var spanClass = getSpanClassFor(i); var spanClass = getSpanClassFor(i);
if(spanClass){ if(spanClass){
assem.append('</span>'); assem.append('</span>');
} else { } else {
@ -339,7 +343,7 @@ function getHTMLFromAtext(pad, atext, authorColors)
propVals[i] = false; propVals[i] = false;
} }
} }
orderdCloseTags(tags2close); orderdCloseTags(tags2close);
} // end processNextChars } // end processNextChars
if (urls) if (urls)
@ -373,7 +377,7 @@ function getHTMLFromAtext(pad, atext, authorColors)
{ {
var line = _analyzeLine(textLines[i], attribLines[i], apool); var line = _analyzeLine(textLines[i], attribLines[i], apool);
var lineContent = getLineHTML(line.text, line.aline); var lineContent = getLineHTML(line.text, line.aline);
if (line.listLevel)//If we are inside a list if (line.listLevel)//If we are inside a list
{ {
// do list stuff // do list stuff