Use escapehtml instead of non-standard escapexml for encoding plaintext to .h

This commit is contained in:
Jonas Berlin 2017-04-13 14:04:12 +03:00
parent c3ae945a4b
commit 8d2734a55e

@ -1553,6 +1553,10 @@ function escapexml(text, xml){
return s.replace(decregex, function(y) { return rencoding[y]; }).replace(charegex,function(s) { return "_x" + ("000"+s.charCodeAt(0).toString(16)).slice(-4) + "_";});
}
function escapexmltag(text){ return escapexml(text).replace(/ /g,"_x0020_"); }
function escapehtml(text){
var s = text + '';
return s.replace(decregex, function(y) { return rencoding[y]; });
}
/* TODO: handle codepages */
var xlml_fixstr = (function() {
@ -5718,7 +5722,7 @@ function parse_si(x, opts) {
if(x.match(/^\s*<(?:\w+:)?t[^>]*>/)) {
z.t = utf8read(unescapexml(x.substr(x.indexOf(">")+1).split(/<\/(?:\w+:)?t>/)[0]));
z.r = utf8read(x);
if(html) z.h = escapexml(z.t);
if(html) z.h = escapehtml(z.t);
}
/* 18.4.4 r CT_RElt (Rich Text Run) */
else if((y = x.match(sirregex))) {
@ -10133,7 +10137,7 @@ return function parse_ws_xml_data(sdata, s, opts, guess, themes, styles) {
case 'str':
p.t = "s";
p.v = (p.v!=null) ? utf8read(p.v) : '';
if(opts.cellHTML) p.h = escapexml(p.v);
if(opts.cellHTML) p.h = escapehtml(p.v);
break;
case 'inlineStr':
cref = d.match(isregex);