From e9ccf97a0b2c3353dfeda6b4bf013e09bc1b2849 Mon Sep 17 00:00:00 2001 From: Vitaly Puzrin Date: Wed, 11 Mar 2015 23:00:01 +0300 Subject: [PATCH] Commented out unused `replaceEntities()` --- lib/common/utils.js | 11 +++++++---- test/fixtures/markdown-it/commonmark_extras.txt | 4 ++-- test/utils.js | 4 ++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/common/utils.js b/lib/common/utils.js index f516e85..34ac689 100644 --- a/lib/common/utils.js +++ b/lib/common/utils.js @@ -84,7 +84,9 @@ function replaceEntityPattern(match, name) { if (has(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' ? parseInt(name.slice(2), 16) : @@ -93,14 +95,15 @@ function replaceEntityPattern(match, name) { return fromCodePoint(code); } } + return match; } -function replaceEntities(str) { +/*function replaceEntities(str) { if (str.indexOf('&') < 0) { return str; } return str.replace(ENTITY_RE, replaceEntityPattern); -} +}*/ function unescapeMd(str) { if (str.indexOf('\\') < 0) { return str; } @@ -252,7 +255,7 @@ exports.unescapeMd = unescapeMd; exports.unescapeAll = unescapeAll; exports.isValidEntityCode = isValidEntityCode; exports.fromCodePoint = fromCodePoint; -exports.replaceEntities = replaceEntities; +// exports.replaceEntities = replaceEntities; exports.escapeHtml = escapeHtml; exports.arrayReplaceAt = arrayReplaceAt; exports.isWhiteSpace = isWhiteSpace; diff --git a/test/fixtures/markdown-it/commonmark_extras.txt b/test/fixtures/markdown-it/commonmark_extras.txt index def578e..0b49d8f 100644 --- a/test/fixtures/markdown-it/commonmark_extras.txt +++ b/test/fixtures/markdown-it/commonmark_extras.txt @@ -53,11 +53,11 @@ Escaping entities in links: Checking combination of replaceEntities and unescapeMd: . -~~~ &\&\\& +~~~ &&bad;\&\\& just a funny little fence ~~~ . -
just a funny little fence
+
just a funny little fence
 
. diff --git a/test/utils.js b/test/utils.js index 7da266c..0748008 100644 --- a/test/utils.js +++ b/test/utils.js @@ -27,7 +27,7 @@ describe('Utils', function () { assert.strictEqual(isValidEntityCode(0x7F), false); }); - it('replaceEntities', function () { + /*it('replaceEntities', function () { var replaceEntities = require('../lib/common/utils').replaceEntities; assert.strictEqual(replaceEntities('&'), '&'); @@ -37,7 +37,7 @@ describe('Utils', function () { assert.strictEqual(replaceEntities('&am;'), '&am;'); assert.strictEqual(replaceEntities('�'), '�'); - }); + });*/ it('assign', function () { var assign = require('../lib/common/utils').assign;