1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-14 02:06:29 +00:00

Merge pull request #633 from asmsuechan/iss-619

Fix a rendering bug
This commit is contained in:
SuenagaRyota
2017-06-12 18:44:40 +09:00
committed by GitHub
2 changed files with 8 additions and 4 deletions

View File

@@ -13,7 +13,8 @@ export function decodeEntities (text) {
['amp', '&'], ['amp', '&'],
['lt', '<'], ['lt', '<'],
['gt', '>'], ['gt', '>'],
['#63', '\\?'] ['#63', '\\?'],
['#36', '\\$']
] ]
for (var i = 0, max = entities.length; i < max; ++i) { for (var i = 0, max = entities.length; i < max; ++i) {
@@ -28,7 +29,8 @@ export function encodeEntities (text) {
['\'', 'apos'], ['\'', 'apos'],
['<', 'lt'], ['<', 'lt'],
['>', 'gt'], ['>', 'gt'],
['\\?', '#63'] ['\\?', '#63'],
['\\$', '#36']
] ]
entities.forEach((entity) => { entities.forEach((entity) => {

View File

@@ -12,7 +12,8 @@ test('htmlTextHelper#decodeEntities should return encoded text (string)', t => {
['var test = &apos;test&apos;', 'var test = \'test\''], ['var test = &apos;test&apos;', 'var test = \'test\''],
['&lt;a href=&apos;https://boostnote.io&apos;&gt;Boostnote', '<a href=\'https://boostnote.io\'>Boostnote'], ['&lt;a href=&apos;https://boostnote.io&apos;&gt;Boostnote', '<a href=\'https://boostnote.io\'>Boostnote'],
['&lt;\\\\?php\n var = &apos;hoge&apos;;', '<\\\\?php\n var = \'hoge\';'], ['&lt;\\\\?php\n var = &apos;hoge&apos;;', '<\\\\?php\n var = \'hoge\';'],
['&amp;', '&'] ['&amp;', '&'],
['a&#36;&apos;', 'a\\$\'']
] ]
testCases.forEach(testCase => { testCases.forEach(testCase => {
@@ -27,7 +28,8 @@ test('htmlTextHelper#decodeEntities() should return decoded text (string)', t =>
['<a href=', '&lt;a href='], ['<a href=', '&lt;a href='],
['var test = \'test\'', 'var test = &apos;test&apos;'], ['var test = \'test\'', 'var test = &apos;test&apos;'],
['<a href=\'https://boostnote.io\'>Boostnote', '&lt;a href=&apos;https://boostnote.io&apos;&gt;Boostnote'], ['<a href=\'https://boostnote.io\'>Boostnote', '&lt;a href=&apos;https://boostnote.io&apos;&gt;Boostnote'],
['<?php\n var = \'hoge\';', '&lt;&#63;php\n var = &apos;hoge&apos;;'] ['<?php\n var = \'hoge\';', '&lt;&#63;php\n var = &apos;hoge&apos;;'],
['a$\'', 'a&#36;&apos;']
] ]
testCases.forEach(testCase => { testCases.forEach(testCase => {