etherpad-lite/static/js/contentcollector.js

693 lines
18 KiB
JavaScript
Raw Normal View History

/**
* This code is mostly from the old Etherpad. Please help us to comment this code.
* This helps other people to understand this code better and helps them to improve it.
* TL;DR COMMENTS ON THIS FILE ARE HIGHLY APPRECIATED
*/
2011-03-26 14:10:41 +01:00
// THIS FILE IS ALSO AN APPJET MODULE: etherpad.collab.ace.contentcollector
// %APPJET%: import("etherpad.collab.ace.easysync2.Changeset");
// %APPJET%: import("etherpad.admin.plugins");
/**
* Copyright 2009 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS-IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var _MAX_LIST_LEVEL = 8;
2012-01-17 12:43:10 +01:00
var Changeset = require('/Changeset');
var plugins = require('/plugins').plugins;
2012-01-16 05:16:11 +01:00
2011-07-07 19:59:34 +02:00
function sanitizeUnicode(s)
{
2011-03-26 14:10:41 +01:00
return s.replace(/[\uffff\ufffe\ufeff\ufdd0-\ufdef\ud800-\udfff]/g, '?');
}
2011-07-07 19:59:34 +02:00
function makeContentCollector(collectStyles, browser, apool, domInterface, className2Author)
{
2011-03-26 14:10:41 +01:00
browser = browser || {};
var plugins_ = plugins;
2011-03-26 14:10:41 +01:00
var dom = domInterface || {
2011-07-07 19:59:34 +02:00
isNodeText: function(n)
{
2011-03-26 14:10:41 +01:00
return (n.nodeType == 3);
},
2011-07-07 19:59:34 +02:00
nodeTagName: function(n)
{
2011-03-26 14:10:41 +01:00
return n.tagName;
},
2011-07-07 19:59:34 +02:00
nodeValue: function(n)
{
2011-03-26 14:10:41 +01:00
return n.nodeValue;
},
2011-07-07 19:59:34 +02:00
nodeNumChildren: function(n)
{
2011-03-26 14:10:41 +01:00
return n.childNodes.length;
},
2011-07-07 19:59:34 +02:00
nodeChild: function(n, i)
{
2011-03-26 14:10:41 +01:00
return n.childNodes.item(i);
},
2011-07-07 19:59:34 +02:00
nodeProp: function(n, p)
{
2011-03-26 14:10:41 +01:00
return n[p];
},
2011-07-07 19:59:34 +02:00
nodeAttr: function(n, a)
{
2011-03-26 14:10:41 +01:00
return n.getAttribute(a);
},
2011-07-07 19:59:34 +02:00
optNodeInnerHTML: function(n)
{
2011-03-26 14:10:41 +01:00
return n.innerHTML;
}
};
2011-07-07 19:59:34 +02:00
var _blockElems = {
"div": 1,
"p": 1,
"pre": 1,
"li": 1
};
function isBlockElement(n)
{
2011-03-26 14:10:41 +01:00
return !!_blockElems[(dom.nodeTagName(n) || "").toLowerCase()];
}
2011-07-07 19:59:34 +02:00
function textify(str)
{
2011-03-26 14:10:41 +01:00
return sanitizeUnicode(
2011-07-07 19:59:34 +02:00
str.replace(/[\n\r ]/g, ' ').replace(/\xa0/g, ' ').replace(/\t/g, ' '));
2011-03-26 14:10:41 +01:00
}
2011-07-07 19:59:34 +02:00
function getAssoc(node, name)
{
return dom.nodeProp(node, "_magicdom_" + name);
2011-03-26 14:10:41 +01:00
}
2011-07-07 19:59:34 +02:00
var lines = (function()
{
2011-03-26 14:10:41 +01:00
var textArray = [];
var attribsArray = [];
var attribsBuilder = null;
var op = Changeset.newOp('+');
var self = {
2011-07-07 19:59:34 +02:00
length: function()
{
return textArray.length;
},
atColumnZero: function()
{
return textArray[textArray.length - 1] === "";
2011-03-26 14:10:41 +01:00
},
2011-07-07 19:59:34 +02:00
startNew: function()
{
2011-03-26 14:10:41 +01:00
textArray.push("");
self.flush(true);
attribsBuilder = Changeset.smartOpAssembler();
},
2011-07-07 19:59:34 +02:00
textOfLine: function(i)
{
return textArray[i];
},
appendText: function(txt, attrString)
{
textArray[textArray.length - 1] += txt;
2011-03-26 14:10:41 +01:00
//dmesg(txt+" / "+attrString);
op.attribs = attrString;
op.chars = txt.length;
attribsBuilder.append(op);
},
2011-07-07 19:59:34 +02:00
textLines: function()
{
return textArray.slice();
},
attribLines: function()
{
return attribsArray;
},
2011-03-26 14:10:41 +01:00
// call flush only when you're done
2011-07-07 19:59:34 +02:00
flush: function(withNewline)
{
if (attribsBuilder)
{
2011-03-26 14:10:41 +01:00
attribsArray.push(attribsBuilder.toString());
attribsBuilder = null;
}
}
};
self.startNew();
return self;
}());
var cc = {};
2011-07-07 19:59:34 +02:00
function _ensureColumnZero(state)
{
if (!lines.atColumnZero())
{
2011-03-26 14:10:41 +01:00
cc.startNewLine(state);
}
}
var selection, startPoint, endPoint;
2011-07-07 19:59:34 +02:00
var selStart = [-1, -1],
selEnd = [-1, -1];
var blockElems = {
"div": 1,
"p": 1,
"pre": 1
};
function _isEmpty(node, state)
{
2011-03-26 14:10:41 +01:00
// consider clean blank lines pasted in IE to be empty
if (dom.nodeNumChildren(node) == 0) return true;
2011-07-07 19:59:34 +02:00
if (dom.nodeNumChildren(node) == 1 && getAssoc(node, "shouldBeEmpty") && dom.optNodeInnerHTML(node) == " " && !getAssoc(node, "unpasted"))
{
if (state)
{
2011-03-26 14:10:41 +01:00
var child = dom.nodeChild(node, 0);
_reachPoint(child, 0, state);
_reachPoint(child, 1, state);
}
return true;
}
return false;
}
2011-07-07 19:59:34 +02:00
function _pointHere(charsAfter, state)
{
var ln = lines.length() - 1;
2011-03-26 14:10:41 +01:00
var chr = lines.textOfLine(ln).length;
2011-07-07 19:59:34 +02:00
if (chr == 0 && state.listType && state.listType != 'none')
{
2011-03-26 14:10:41 +01:00
chr += 1; // listMarker
}
chr += charsAfter;
return [ln, chr];
}
2011-07-07 19:59:34 +02:00
function _reachBlockPoint(nd, idx, state)
{
if (!dom.isNodeText(nd)) _reachPoint(nd, idx, state);
2011-03-26 14:10:41 +01:00
}
2011-07-07 19:59:34 +02:00
function _reachPoint(nd, idx, state)
{
if (startPoint && nd == startPoint.node && startPoint.index == idx)
{
2011-03-26 14:10:41 +01:00
selStart = _pointHere(0, state);
}
2011-07-07 19:59:34 +02:00
if (endPoint && nd == endPoint.node && endPoint.index == idx)
{
2011-03-26 14:10:41 +01:00
selEnd = _pointHere(0, state);
}
}
2011-07-07 19:59:34 +02:00
cc.incrementFlag = function(state, flagName)
{
state.flags[flagName] = (state.flags[flagName] || 0) + 1;
2011-03-26 14:10:41 +01:00
}
2011-07-07 19:59:34 +02:00
cc.decrementFlag = function(state, flagName)
{
2011-03-26 14:10:41 +01:00
state.flags[flagName]--;
}
2011-07-07 19:59:34 +02:00
cc.incrementAttrib = function(state, attribName)
{
if (!state.attribs[attribName])
{
2011-03-26 14:10:41 +01:00
state.attribs[attribName] = 1;
}
2011-07-07 19:59:34 +02:00
else
{
2011-03-26 14:10:41 +01:00
state.attribs[attribName]++;
}
_recalcAttribString(state);
}
2011-07-07 19:59:34 +02:00
cc.decrementAttrib = function(state, attribName)
{
2011-03-26 14:10:41 +01:00
state.attribs[attribName]--;
_recalcAttribString(state);
}
2011-07-07 19:59:34 +02:00
function _enterList(state, listType)
{
2011-03-26 14:10:41 +01:00
var oldListType = state.listType;
2011-07-07 19:59:34 +02:00
state.listLevel = (state.listLevel || 0) + 1;
if (listType != 'none')
{
state.listNesting = (state.listNesting || 0) + 1;
2011-03-26 14:10:41 +01:00
}
state.listType = listType;
_recalcAttribString(state);
return oldListType;
}
2011-07-07 19:59:34 +02:00
function _exitList(state, oldListType)
{
2011-03-26 14:10:41 +01:00
state.listLevel--;
2011-07-07 19:59:34 +02:00
if (state.listType != 'none')
{
2011-03-26 14:10:41 +01:00
state.listNesting--;
}
state.listType = oldListType;
_recalcAttribString(state);
}
2011-07-07 19:59:34 +02:00
function _enterAuthor(state, author)
{
2011-03-26 14:10:41 +01:00
var oldAuthor = state.author;
2011-07-07 19:59:34 +02:00
state.authorLevel = (state.authorLevel || 0) + 1;
2011-03-26 14:10:41 +01:00
state.author = author;
_recalcAttribString(state);
return oldAuthor;
}
2011-07-07 19:59:34 +02:00
function _exitAuthor(state, oldAuthor)
{
2011-03-26 14:10:41 +01:00
state.authorLevel--;
state.author = oldAuthor;
_recalcAttribString(state);
}
2011-07-07 19:59:34 +02:00
function _recalcAttribString(state)
{
2011-03-26 14:10:41 +01:00
var lst = [];
2011-07-07 19:59:34 +02:00
for (var a in state.attribs)
{
if (state.attribs[a])
{
lst.push([a, 'true']);
2011-03-26 14:10:41 +01:00
}
}
2011-07-07 19:59:34 +02:00
if (state.authorLevel > 0)
{
2011-03-26 14:10:41 +01:00
var authorAttrib = ['author', state.author];
2011-07-07 19:59:34 +02:00
if (apool.putAttrib(authorAttrib, true) >= 0)
{
2011-03-26 14:10:41 +01:00
// require that author already be in pool
// (don't add authors from other documents, etc.)
lst.push(authorAttrib);
}
}
state.attribString = Changeset.makeAttribsString('+', lst, apool);
}
2011-07-07 19:59:34 +02:00
function _produceListMarker(state)
{
lines.appendText('*', Changeset.makeAttribsString('+', [
['list', state.listType],
['insertorder', 'first']
], apool));
2011-03-26 14:10:41 +01:00
}
2011-07-07 19:59:34 +02:00
cc.startNewLine = function(state)
{
if (state)
{
var atBeginningOfLine = lines.textOfLine(lines.length() - 1).length == 0;
if (atBeginningOfLine && state.listType && state.listType != 'none')
{
2011-03-26 14:10:41 +01:00
_produceListMarker(state);
}
}
lines.startNew();
}
2011-07-07 19:59:34 +02:00
cc.notifySelection = function(sel)
{
if (sel)
{
2011-03-26 14:10:41 +01:00
selection = sel;
startPoint = selection.startPoint;
endPoint = selection.endPoint;
}
};
2011-07-07 19:59:34 +02:00
cc.doAttrib = function(state, na)
{
2011-03-26 14:10:41 +01:00
state.localAttribs = (state.localAttribs || []);
state.localAttribs.push(na);
cc.incrementAttrib(state, na);
};
2011-07-07 19:59:34 +02:00
cc.collectContent = function(node, state)
{
if (!state)
{
state = {
flags: { /*name -> nesting counter*/
},
localAttribs: null,
attribs: { /*name -> nesting counter*/
},
attribString: ''
};
2011-03-26 14:10:41 +01:00
}
var localAttribs = state.localAttribs;
state.localAttribs = null;
var isBlock = isBlockElement(node);
var isEmpty = _isEmpty(node, state);
if (isBlock) _ensureColumnZero(state);
2011-07-07 19:59:34 +02:00
var startLine = lines.length() - 1;
2011-03-26 14:10:41 +01:00
_reachBlockPoint(node, 0, state);
2011-07-07 19:59:34 +02:00
if (dom.isNodeText(node))
{
2011-03-26 14:10:41 +01:00
var txt = dom.nodeValue(node);
var rest = '';
var x = 0; // offset into original text
2011-07-07 19:59:34 +02:00
if (txt.length == 0)
{
if (startPoint && node == startPoint.node)
{
2011-03-26 14:10:41 +01:00
selStart = _pointHere(0, state);
}
2011-07-07 19:59:34 +02:00
if (endPoint && node == endPoint.node)
{
2011-03-26 14:10:41 +01:00
selEnd = _pointHere(0, state);
}
}
2011-07-07 19:59:34 +02:00
while (txt.length > 0)
{
2011-03-26 14:10:41 +01:00
var consumed = 0;
2011-07-07 19:59:34 +02:00
if (state.flags.preMode)
{
var firstLine = txt.split('\n', 1)[0];
consumed = firstLine.length + 1;
2011-03-26 14:10:41 +01:00
rest = txt.substring(consumed);
txt = firstLine;
}
2011-07-07 19:59:34 +02:00
else
{ /* will only run this loop body once */
2011-03-26 14:10:41 +01:00
}
2011-07-07 19:59:34 +02:00
if (startPoint && node == startPoint.node && startPoint.index - x <= txt.length)
{
selStart = _pointHere(startPoint.index - x, state);
}
if (endPoint && node == endPoint.node && endPoint.index - x <= txt.length)
{
selEnd = _pointHere(endPoint.index - x, state);
2011-03-26 14:10:41 +01:00
}
var txt2 = txt;
2011-07-07 19:59:34 +02:00
if ((!state.flags.preMode) && /^[\r\n]*$/.exec(txt))
{
2011-03-26 14:10:41 +01:00
// prevents textnodes containing just "\n" from being significant
// in safari when pasting text, now that we convert them to
// spaces instead of removing them, because in other cases
// removing "\n" from pasted HTML will collapse words together.
txt2 = "";
}
2011-07-07 19:59:34 +02:00
var atBeginningOfLine = lines.textOfLine(lines.length() - 1).length == 0;
if (atBeginningOfLine)
{
2011-03-26 14:10:41 +01:00
// newlines in the source mustn't become spaces at beginning of line box
txt2 = txt2.replace(/^\n*/, '');
}
2011-07-07 19:59:34 +02:00
if (atBeginningOfLine && state.listType && state.listType != 'none')
{
2011-03-26 14:10:41 +01:00
_produceListMarker(state);
}
lines.appendText(textify(txt2), state.attribString);
x += consumed;
txt = rest;
2011-07-07 19:59:34 +02:00
if (txt.length > 0)
{
2011-03-26 14:10:41 +01:00
cc.startNewLine(state);
}
}
}
2011-07-07 19:59:34 +02:00
else
{
2011-03-26 14:10:41 +01:00
var tname = (dom.nodeTagName(node) || "").toLowerCase();
2011-07-07 19:59:34 +02:00
if (tname == "br")
{
2011-03-26 14:10:41 +01:00
cc.startNewLine(state);
}
2011-07-07 19:59:34 +02:00
else if (tname == "script" || tname == "style")
{
2011-03-26 14:10:41 +01:00
// ignore
}
2011-07-07 19:59:34 +02:00
else if (!isEmpty)
{
2011-03-26 14:10:41 +01:00
var styl = dom.nodeAttr(node, "style");
var cls = dom.nodeProp(node, "className");
var isPre = (tname == "pre");
2011-07-07 19:59:34 +02:00
if ((!isPre) && browser.safari)
{
2011-03-26 14:10:41 +01:00
isPre = (styl && /\bwhite-space:\s*pre\b/i.exec(styl));
}
if (isPre) cc.incrementFlag(state, 'preMode');
var oldListTypeOrNull = null;
var oldAuthorOrNull = null;
2011-07-07 19:59:34 +02:00
if (collectStyles)
{
plugins_.callHook('collectContentPre', {
cc: cc,
state: state,
tname: tname,
styl: styl,
cls: cls
});
if (tname == "b" || (styl && /\bfont-weight:\s*bold\b/i.exec(styl)) || tname == "strong")
{
cc.doAttrib(state, "bold");
2011-03-26 14:10:41 +01:00
}
2011-07-07 19:59:34 +02:00
if (tname == "i" || (styl && /\bfont-style:\s*italic\b/i.exec(styl)) || tname == "em")
{
cc.doAttrib(state, "italic");
2011-03-26 14:10:41 +01:00
}
2011-07-07 19:59:34 +02:00
if (tname == "u" || (styl && /\btext-decoration:\s*underline\b/i.exec(styl)) || tname == "ins")
{
cc.doAttrib(state, "underline");
2011-03-26 14:10:41 +01:00
}
2011-07-07 19:59:34 +02:00
if (tname == "s" || (styl && /\btext-decoration:\s*line-through\b/i.exec(styl)) || tname == "del")
{
cc.doAttrib(state, "strikethrough");
2011-03-26 14:10:41 +01:00
}
2012-01-15 18:20:20 +01:00
if (tname == "ul" || tname == "ol")
2011-07-07 19:59:34 +02:00
{
2011-03-26 14:10:41 +01:00
var type;
var rr = cls && /(?:^| )list-([a-z]+[12345678])\b/.exec(cls);
2011-07-07 19:59:34 +02:00
type = rr && rr[1] || "bullet" + String(Math.min(_MAX_LIST_LEVEL, (state.listNesting || 0) + 1));
2011-03-26 14:10:41 +01:00
oldListTypeOrNull = (_enterList(state, type) || 'none');
}
2011-07-07 19:59:34 +02:00
else if ((tname == "div" || tname == "p") && cls && cls.match(/(?:^| )ace-line\b/))
{
2011-03-26 14:10:41 +01:00
oldListTypeOrNull = (_enterList(state, type) || 'none');
}
2011-07-07 19:59:34 +02:00
if (className2Author && cls)
{
2011-03-26 14:10:41 +01:00
var classes = cls.match(/\S+/g);
2011-07-07 19:59:34 +02:00
if (classes && classes.length > 0)
{
for (var i = 0; i < classes.length; i++)
{
2011-03-26 14:10:41 +01:00
var c = classes[i];
var a = className2Author(c);
2011-07-07 19:59:34 +02:00
if (a)
{
2011-03-26 14:10:41 +01:00
oldAuthorOrNull = (_enterAuthor(state, a) || 'none');
break;
}
}
}
}
}
var nc = dom.nodeNumChildren(node);
2011-07-07 19:59:34 +02:00
for (var i = 0; i < nc; i++)
{
2011-03-26 14:10:41 +01:00
var c = dom.nodeChild(node, i);
cc.collectContent(c, state);
}
2011-07-07 19:59:34 +02:00
if (collectStyles)
{
plugins_.callHook('collectContentPost', {
cc: cc,
state: state,
tname: tname,
styl: styl,
cls: cls
});
2011-03-26 14:10:41 +01:00
}
if (isPre) cc.decrementFlag(state, 'preMode');
2011-07-07 19:59:34 +02:00
if (state.localAttribs)
{
for (var i = 0; i < state.localAttribs.length; i++)
{
2011-03-26 14:10:41 +01:00
cc.decrementAttrib(state, state.localAttribs[i]);
}
}
2011-07-07 19:59:34 +02:00
if (oldListTypeOrNull)
{
2011-03-26 14:10:41 +01:00
_exitList(state, oldListTypeOrNull);
}
2011-07-07 19:59:34 +02:00
if (oldAuthorOrNull)
{
2011-03-26 14:10:41 +01:00
_exitAuthor(state, oldAuthorOrNull);
}
}
}
2011-07-07 19:59:34 +02:00
if (!browser.msie)
{
2011-03-26 14:10:41 +01:00
_reachBlockPoint(node, 1, state);
}
2011-07-07 19:59:34 +02:00
if (isBlock)
{
if (lines.length() - 1 == startLine)
{
2011-03-26 14:10:41 +01:00
cc.startNewLine(state);
}
2011-07-07 19:59:34 +02:00
else
{
2011-03-26 14:10:41 +01:00
_ensureColumnZero(state);
}
}
2011-07-07 19:59:34 +02:00
if (browser.msie)
{
2011-03-26 14:10:41 +01:00
// in IE, a point immediately after a DIV appears on the next line
_reachBlockPoint(node, 1, state);
}
state.localAttribs = localAttribs;
};
// can pass a falsy value for end of doc
2011-07-07 19:59:34 +02:00
cc.notifyNextNode = function(node)
{
2011-03-26 14:10:41 +01:00
// an "empty block" won't end a line; this addresses an issue in IE with
// typing into a blank line at the end of the document. typed text
// goes into the body, and the empty line div still looks clean.
// it is incorporated as dirty by the rule that a dirty region has
// to end a line.
2011-07-07 19:59:34 +02:00
if ((!node) || (isBlockElement(node) && !_isEmpty(node)))
{
2011-03-26 14:10:41 +01:00
_ensureColumnZero(null);
}
};
// each returns [line, char] or [-1,-1]
2011-07-07 19:59:34 +02:00
var getSelectionStart = function()
{
return selStart;
};
var getSelectionEnd = function()
{
return selEnd;
};
2011-03-26 14:10:41 +01:00
// returns array of strings for lines found, last entry will be "" if
// last line is complete (i.e. if a following span should be on a new line).
// can be called at any point
2011-07-07 19:59:34 +02:00
cc.getLines = function()
{
return lines.textLines();
};
2011-03-26 14:10:41 +01:00
2011-07-07 19:59:34 +02:00
cc.finish = function()
{
2011-03-26 14:10:41 +01:00
lines.flush();
var lineAttribs = lines.attribLines();
var lineStrings = cc.getLines();
lineStrings.length--;
lineAttribs.length--;
var ss = getSelectionStart();
var se = getSelectionEnd();
2011-07-07 19:59:34 +02:00
function fixLongLines()
{
2011-03-26 14:10:41 +01:00
// design mode does not deal with with really long lines!
var lineLimit = 2000; // chars
var buffer = 10; // chars allowed over before wrapping
var linesWrapped = 0;
var numLinesAfter = 0;
2011-07-07 19:59:34 +02:00
for (var i = lineStrings.length - 1; i >= 0; i--)
{
var oldString = lineStrings[i];
var oldAttribString = lineAttribs[i];
if (oldString.length > lineLimit + buffer)
{
var newStrings = [];
var newAttribStrings = [];
while (oldString.length > lineLimit)
{
//var semiloc = oldString.lastIndexOf(';', lineLimit-1);
//var lengthToTake = (semiloc >= 0 ? (semiloc+1) : lineLimit);
lengthToTake = lineLimit;
newStrings.push(oldString.substring(0, lengthToTake));
oldString = oldString.substring(lengthToTake);
newAttribStrings.push(Changeset.subattribution(oldAttribString, 0, lengthToTake));
oldAttribString = Changeset.subattribution(oldAttribString, lengthToTake);
}
if (oldString.length > 0)
{
newStrings.push(oldString);
newAttribStrings.push(oldAttribString);
}
function fixLineNumber(lineChar)
{
if (lineChar[0] < 0) return;
var n = lineChar[0];
var c = lineChar[1];
if (n > i)
{
n += (newStrings.length - 1);
}
else if (n == i)
{
var a = 0;
while (c > newStrings[a].length)
{
c -= newStrings[a].length;
a++;
}
n += a;
}
lineChar[0] = n;
lineChar[1] = c;
}
fixLineNumber(ss);
fixLineNumber(se);
linesWrapped++;
numLinesAfter += newStrings.length;
newStrings.unshift(i, 1);
lineStrings.splice.apply(lineStrings, newStrings);
newAttribStrings.unshift(i, 1);
lineAttribs.splice.apply(lineAttribs, newAttribStrings);
}
2011-03-26 14:10:41 +01:00
}
2011-07-07 19:59:34 +02:00
return {
linesWrapped: linesWrapped,
numLinesAfter: numLinesAfter
};
2011-03-26 14:10:41 +01:00
}
var wrapData = fixLongLines();
2011-07-07 19:59:34 +02:00
return {
selStart: ss,
selEnd: se,
linesWrapped: wrapData.linesWrapped,
numLinesAfter: wrapData.numLinesAfter,
lines: lineStrings,
lineAttribs: lineAttribs
};
2011-03-26 14:10:41 +01:00
}
return cc;
}
exports.sanitizeUnicode = sanitizeUnicode;
exports.makeContentCollector = makeContentCollector;