mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
@@ -13,7 +13,8 @@ export function decodeEntities (text) {
|
||||
['amp', '&'],
|
||||
['lt', '<'],
|
||||
['gt', '>'],
|
||||
['#63', '\\?']
|
||||
['#63', '\\?'],
|
||||
['#36', '\\$']
|
||||
]
|
||||
|
||||
for (var i = 0, max = entities.length; i < max; ++i) {
|
||||
@@ -28,7 +29,8 @@ export function encodeEntities (text) {
|
||||
['\'', 'apos'],
|
||||
['<', 'lt'],
|
||||
['>', 'gt'],
|
||||
['\\?', '#63']
|
||||
['\\?', '#63'],
|
||||
['\\$', '#36']
|
||||
]
|
||||
|
||||
entities.forEach((entity) => {
|
||||
|
||||
@@ -12,7 +12,8 @@ test('htmlTextHelper#decodeEntities should return encoded text (string)', t => {
|
||||
['var test = 'test'', 'var test = \'test\''],
|
||||
['<a href='https://boostnote.io'>Boostnote', '<a href=\'https://boostnote.io\'>Boostnote'],
|
||||
['<\\\\?php\n var = 'hoge';', '<\\\\?php\n var = \'hoge\';'],
|
||||
['&', '&']
|
||||
['&', '&'],
|
||||
['a$'', 'a\\$\'']
|
||||
]
|
||||
|
||||
testCases.forEach(testCase => {
|
||||
@@ -27,7 +28,8 @@ test('htmlTextHelper#decodeEntities() should return decoded text (string)', t =>
|
||||
['<a href=', '<a href='],
|
||||
['var test = \'test\'', 'var test = 'test''],
|
||||
['<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 => {
|
||||
|
||||
Reference in New Issue
Block a user