Skip to content

Commit e4dabf1

Browse files
committed
Deal with embedded codes
1 parent 2b052c0 commit e4dabf1

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

dist/plugins/webson.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,16 @@ EasyCoder.domain.webson = EasyCoder_Webson;
179179
throw Error(`Mismatched braces in ${input}`);
180180
}
181181
const substr = output.substring(p + 1, q);
182-
let repl = `<${substr}>`;
183-
try {
184-
const v = eval(substr);
185-
output = output.replace(repl, v);
186-
} catch (e) {
187-
//output = output.replace(repl, substr);
182+
if (!['b', '/b', 'i', '/i'].includes(substr)) {
183+
let repl = `<${substr}>`;
184+
try {
185+
const v = eval(substr);
186+
output = output.replace(repl, v);
187+
} catch (e) {
188+
output = output.replace(repl, substr);
189+
}
190+
changed = true;
188191
}
189-
changed = true;
190192
}
191193
}
192194
catch (e) {

js/plugins/webson.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,16 @@ EasyCoder.domain.webson = EasyCoder_Webson;
179179
throw Error(`Mismatched braces in ${input}`);
180180
}
181181
const substr = output.substring(p + 1, q);
182-
let repl = `<${substr}>`;
183-
try {
184-
const v = eval(substr);
185-
output = output.replace(repl, v);
186-
} catch (e) {
187-
//output = output.replace(repl, substr);
182+
if (!['b', '/b', 'i', '/i'].includes(substr)) {
183+
let repl = `<${substr}>`;
184+
try {
185+
const v = eval(substr);
186+
output = output.replace(repl, v);
187+
} catch (e) {
188+
output = output.replace(repl, substr);
189+
}
190+
changed = true;
188191
}
189-
changed = true;
190192
}
191193
}
192194
catch (e) {

0 commit comments

Comments
 (0)