|
@ -84,7 +84,9 @@ function replaceEntityPattern(match, name) { |
|
|
|
|
|
|
|
|
if (has(entities, name)) { |
|
|
if (has(entities, name)) { |
|
|
return entities[name]; |
|
|
return entities[name]; |
|
|
} else if (name.charCodeAt(0) === 0x23/* # */ && DIGITAL_ENTITY_TEST_RE.test(name)) { |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (name.charCodeAt(0) === 0x23/* # */ && DIGITAL_ENTITY_TEST_RE.test(name)) { |
|
|
code = name[1].toLowerCase() === 'x' ? |
|
|
code = name[1].toLowerCase() === 'x' ? |
|
|
parseInt(name.slice(2), 16) |
|
|
parseInt(name.slice(2), 16) |
|
|
: |
|
|
: |
|
@ -93,14 +95,15 @@ function replaceEntityPattern(match, name) { |
|
|
return fromCodePoint(code); |
|
|
return fromCodePoint(code); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return match; |
|
|
return match; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function replaceEntities(str) { |
|
|
/*function replaceEntities(str) { |
|
|
if (str.indexOf('&') < 0) { return str; } |
|
|
if (str.indexOf('&') < 0) { return str; } |
|
|
|
|
|
|
|
|
return str.replace(ENTITY_RE, replaceEntityPattern); |
|
|
return str.replace(ENTITY_RE, replaceEntityPattern); |
|
|
} |
|
|
}*/ |
|
|
|
|
|
|
|
|
function unescapeMd(str) { |
|
|
function unescapeMd(str) { |
|
|
if (str.indexOf('\\') < 0) { return str; } |
|
|
if (str.indexOf('\\') < 0) { return str; } |
|
@ -252,7 +255,7 @@ exports.unescapeMd = unescapeMd; |
|
|
exports.unescapeAll = unescapeAll; |
|
|
exports.unescapeAll = unescapeAll; |
|
|
exports.isValidEntityCode = isValidEntityCode; |
|
|
exports.isValidEntityCode = isValidEntityCode; |
|
|
exports.fromCodePoint = fromCodePoint; |
|
|
exports.fromCodePoint = fromCodePoint; |
|
|
exports.replaceEntities = replaceEntities; |
|
|
// exports.replaceEntities = replaceEntities;
|
|
|
exports.escapeHtml = escapeHtml; |
|
|
exports.escapeHtml = escapeHtml; |
|
|
exports.arrayReplaceAt = arrayReplaceAt; |
|
|
exports.arrayReplaceAt = arrayReplaceAt; |
|
|
exports.isWhiteSpace = isWhiteSpace; |
|
|
exports.isWhiteSpace = isWhiteSpace; |
|
|