Browse Source

Commented out unused `replaceEntities()`

pull/82/head
Vitaly Puzrin 10 years ago
parent
commit
e9ccf97a0b
  1. 11
      lib/common/utils.js
  2. 4
      test/fixtures/markdown-it/commonmark_extras.txt
  3. 4
      test/utils.js

11
lib/common/utils.js

@ -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;

4
test/fixtures/markdown-it/commonmark_extras.txt

@ -53,11 +53,11 @@ Escaping entities in links:
Checking combination of replaceEntities and unescapeMd: Checking combination of replaceEntities and unescapeMd:
. .
~~~ &amp;\&amp;\\&amp; ~~~ &amp;&bad;\&amp;\\&amp;
just a funny little fence just a funny little fence
~~~ ~~~
. .
<pre><code class="&amp;&amp;amp;\&amp;">just a funny little fence <pre><code class="&amp;&amp;bad;&amp;amp;\&amp;">just a funny little fence
</code></pre> </code></pre>
. .

4
test/utils.js

@ -27,7 +27,7 @@ describe('Utils', function () {
assert.strictEqual(isValidEntityCode(0x7F), false); assert.strictEqual(isValidEntityCode(0x7F), false);
}); });
it('replaceEntities', function () { /*it('replaceEntities', function () {
var replaceEntities = require('../lib/common/utils').replaceEntities; var replaceEntities = require('../lib/common/utils').replaceEntities;
assert.strictEqual(replaceEntities('&amp;'), '&'); assert.strictEqual(replaceEntities('&amp;'), '&');
@ -37,7 +37,7 @@ describe('Utils', function () {
assert.strictEqual(replaceEntities('&am;'), '&am;'); assert.strictEqual(replaceEntities('&am;'), '&am;');
assert.strictEqual(replaceEntities('&#00;'), '&#00;'); assert.strictEqual(replaceEntities('&#00;'), '&#00;');
}); });*/
it('assign', function () { it('assign', function () {
var assign = require('../lib/common/utils').assign; var assign = require('../lib/common/utils').assign;

Loading…
Cancel
Save