mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-14 02:06:29 +00:00
@@ -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) => {
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ test('htmlTextHelper#decodeEntities should return encoded text (string)', t => {
|
|||||||
['var test = 'test'', 'var test = \'test\''],
|
['var test = 'test'', 'var test = \'test\''],
|
||||||
['<a href='https://boostnote.io'>Boostnote', '<a href=\'https://boostnote.io\'>Boostnote'],
|
['<a href='https://boostnote.io'>Boostnote', '<a href=\'https://boostnote.io\'>Boostnote'],
|
||||||
['<\\\\?php\n var = 'hoge';', '<\\\\?php\n var = \'hoge\';'],
|
['<\\\\?php\n var = 'hoge';', '<\\\\?php\n var = \'hoge\';'],
|
||||||
['&', '&']
|
['&', '&'],
|
||||||
|
['a$'', 'a\\$\'']
|
||||||
]
|
]
|
||||||
|
|
||||||
testCases.forEach(testCase => {
|
testCases.forEach(testCase => {
|
||||||
@@ -27,7 +28,8 @@ test('htmlTextHelper#decodeEntities() should return decoded text (string)', t =>
|
|||||||
['<a href=', '<a href='],
|
['<a href=', '<a href='],
|
||||||
['var test = \'test\'', 'var test = 'test''],
|
['var test = \'test\'', 'var test = 'test''],
|
||||||
['<a href=\'https://boostnote.io\'>Boostnote', '<a href='https://boostnote.io'>Boostnote'],
|
['<a href=\'https://boostnote.io\'>Boostnote', '<a href='https://boostnote.io'>Boostnote'],
|
||||||
['<?php\n var = \'hoge\';', '<?php\n var = 'hoge';']
|
['<?php\n var = \'hoge\';', '<?php\n var = 'hoge';'],
|
||||||
|
['a$\'', 'a$'']
|
||||||
]
|
]
|
||||||
|
|
||||||
testCases.forEach(testCase => {
|
testCases.forEach(testCase => {
|
||||||
|
|||||||
Reference in New Issue
Block a user