summaryrefslogtreecommitdiff
path: root/src/node/utils
diff options
context:
space:
mode:
authorLuiza Pagliari <lpagliari@gmail.com>2015-08-24 07:58:45 -0700
committerLuiza Pagliari <lpagliari@gmail.com>2015-08-24 07:58:45 -0700
commit1a5985dc759c33e614eaa53ba9c4d2489c9e3495 (patch)
treec94981e08214ac1825aae71bfaa0c3c4e1d0a50d /src/node/utils
parent7170a6a8cb9d3a8f186ebbe8782c3ab2782b4dee (diff)
downloadetherpad-lite-1a5985dc759c33e614eaa53ba9c4d2489c9e3495.zip
Accepting Arrays on 'exportHtmlAdditionalTags' to handle attributes stored as ['key', 'value'] (and not only ['key', 'true'])
Diffstat (limited to 'src/node/utils')
-rw-r--r--src/node/utils/ExportHtml.js22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/node/utils/ExportHtml.js b/src/node/utils/ExportHtml.js
index 9e1ba124..c5936cf9 100644
--- a/src/node/utils/ExportHtml.js
+++ b/src/node/utils/ExportHtml.js
@@ -19,6 +19,7 @@ var async = require("async");
var Changeset = require("ep_etherpad-lite/static/js/Changeset");
var padManager = require("../db/PadManager");
var ERR = require("async-stacktrace");
+var _ = require('underscore');
var Security = require('ep_etherpad-lite/static/js/security');
var hooks = require('ep_etherpad-lite/static/js/pluginfw/hooks');
var _analyzeLine = require('./ExportHelper')._analyzeLine;
@@ -78,8 +79,15 @@ function getHTMLFromAtext(pad, atext, authorColors)
var props = ['heading1', 'heading2', 'bold', 'italic', 'underline', 'strikethrough'];
hooks.aCallAll("exportHtmlAdditionalTags", pad, function(err, newProps){
+ // newProps can be simply a string (which means it is stored as attribute in the form of ['tag', 'true'])
+ // or it can be a pair of values in an Array (for the case when it is stored as ['tag', 'value']).
+ // The later scenario will generate HTML with tags like <tag:value>
newProps.forEach(function (propName, i){
- tags.push(propName);
+ if (_.isArray(propName)) {
+ tags.push(propName[0] + ":" + propName[1]);
+ } else {
+ tags.push(propName);
+ }
props.push(propName);
});
});
@@ -130,7 +138,12 @@ function getHTMLFromAtext(pad, atext, authorColors)
// 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);
+ var attrib = [propName, true];
+ if (_.isArray(propName)) {
+ // propName can be in the form of ['color', 'red']
+ attrib = propName;
+ }
+ var propTrueNum = apool.putAttrib(attrib, true);
if (propTrueNum >= 0)
{
anumMap[propTrueNum] = i;
@@ -154,6 +167,11 @@ function getHTMLFromAtext(pad, atext, authorColors)
var property = props[i];
+ // we are not insterested on properties in the form of ['color', 'red']
+ if (_.isArray(property)) {
+ return false;
+ }
+
if(property.substr(0,6) === "author"){
return stripDotFromAuthorID(property);
}