Skip to content

Commit

Permalink
Merge pull request BoostIO#633 from asmsuechan/iss-619
Browse files Browse the repository at this point in the history
Fix a rendering bug
  • Loading branch information
asmsuechan authored Jun 12, 2017
2 parents 4250d6f + 244a06e commit 17dcd1b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions browser/lib/htmlTextHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ export function decodeEntities (text) {
['amp', '&'],
['lt', '<'],
['gt', '>'],
['#63', '\\?']
['#63', '\\?'],
['#36', '\\$']
]

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

entities.forEach((entity) => {
Expand Down
6 changes: 4 additions & 2 deletions tests/lib/html-text-helper-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ test('htmlTextHelper#decodeEntities should return encoded text (string)', t => {
['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;\\\\?php\n var = &apos;hoge&apos;;', '<\\\\?php\n var = \'hoge\';'],
['&amp;', '&']
['&amp;', '&'],
['a&#36;&apos;', 'a\\$\'']
]

testCases.forEach(testCase => {
Expand All @@ -27,7 +28,8 @@ test('htmlTextHelper#decodeEntities() should return decoded text (string)', t =>
['<a href=', '&lt;a href='],
['var test = \'test\'', 'var test = &apos;test&apos;'],
['<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 => {
Expand Down

0 comments on commit 17dcd1b

Please sign in to comment.