efront 4.21.3 → 4.21.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/#/345/233/275/351/231/205/345/214/226.yml +93 -66
- package/coms/basic/parseNumber.js +12 -7
- package/coms/basic/percent.js +28 -0
- package/coms/basic/refilm.js +24 -5
- package/coms/basic/refilm_decode.js +6 -2
- package/coms/basic/refilm_decode_test.js +1 -0
- package/coms/compile/Html_test.js +5 -0
- package/coms/compile/Javascript.js +12 -2
- package/coms/compile/Javascript_test.js +3 -0
- package/coms/compile/Program.js +119 -43
- package/coms/compile/common.js +7 -1
- package/coms/compile/scanner2.js +53 -7
- package/coms/compile/translate.js +1 -1
- package/coms/zimoli/XMLHttpRequest.js +16 -13
- package/docs//345/267/245/345/205/267//345/233/275/351/231/205/345/214/226.xht +4 -0
- package/package.json +1 -1
- package/public/efront.js +1 -1
- package/readme-en.md +3 -5
- package/readme.md +3 -4
package/coms/compile/Program.js
CHANGED
|
@@ -11,7 +11,9 @@ const {
|
|
|
11
11
|
/* 512 */LABEL,
|
|
12
12
|
/*1024 */PROPERTY,
|
|
13
13
|
/*2048 */ELEMENT,
|
|
14
|
+
pickAssignment,
|
|
14
15
|
createString,
|
|
16
|
+
setqueue,
|
|
15
17
|
number_reg,
|
|
16
18
|
digit_reg,
|
|
17
19
|
} = require("./common");
|
|
@@ -53,6 +55,16 @@ var stringsFromRegExp = function (reg) {
|
|
|
53
55
|
var res = combine(...queue).map(a => a.join(""));
|
|
54
56
|
return res;
|
|
55
57
|
}
|
|
58
|
+
|
|
59
|
+
var trimDulp = function (list) {
|
|
60
|
+
var dist = [];
|
|
61
|
+
for (var a of list) {
|
|
62
|
+
if (dist.indexOf(a) >= 0) continue;
|
|
63
|
+
dist.push(a);
|
|
64
|
+
}
|
|
65
|
+
return dist;
|
|
66
|
+
}
|
|
67
|
+
|
|
56
68
|
var spaceDefined = require("../basic/spaces");
|
|
57
69
|
|
|
58
70
|
var powermap = require("./powermap");
|
|
@@ -64,7 +76,7 @@ class Program {
|
|
|
64
76
|
["`", "`", /\\[\s\S]/, ["${", "}"]],
|
|
65
77
|
]
|
|
66
78
|
tags = [
|
|
67
|
-
[["<", "</"], /\/?>/, /\\[\s\S]
|
|
79
|
+
[["<", "</"], /\/?>/, /\\[\s\S]/, "'", '"', "<!--", ["${", "}"]]
|
|
68
80
|
];
|
|
69
81
|
scriptTags = [];
|
|
70
82
|
ignoreTags = ["STYLE", "SCRIPT"];
|
|
@@ -323,10 +335,10 @@ class Program {
|
|
|
323
335
|
var scriptTags = this.scriptTags;
|
|
324
336
|
var ignoreTags = this.ignoreTags;
|
|
325
337
|
var structstrap_reg = this.structstrap_reg;
|
|
338
|
+
var mindpath = this.mindpath;
|
|
326
339
|
var openTag = function () {
|
|
327
340
|
var m1 = text.slice(start, match.index);
|
|
328
341
|
var s = space_exp.exec(m1);
|
|
329
|
-
|
|
330
342
|
if (s) var tag = m1.slice(0, s.index);
|
|
331
343
|
else {
|
|
332
344
|
tag = m1;
|
|
@@ -373,7 +385,10 @@ class Program {
|
|
|
373
385
|
if (scope) queue = scope;
|
|
374
386
|
return true;
|
|
375
387
|
}
|
|
376
|
-
|
|
388
|
+
if (s && !tag) {
|
|
389
|
+
undefTag();
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
377
392
|
queue.inTag = true;
|
|
378
393
|
queue.tag = tag;
|
|
379
394
|
var tagName = tag.toUpperCase();
|
|
@@ -386,7 +401,8 @@ class Program {
|
|
|
386
401
|
}
|
|
387
402
|
if (s) {
|
|
388
403
|
m = m1.slice(s[0].length + s.index);
|
|
389
|
-
|
|
404
|
+
start += s[0].length + s.index;
|
|
405
|
+
push_piece();
|
|
390
406
|
}
|
|
391
407
|
queue.first = null;
|
|
392
408
|
queue.last = null;
|
|
@@ -405,12 +421,60 @@ class Program {
|
|
|
405
421
|
}
|
|
406
422
|
}
|
|
407
423
|
return istype;
|
|
424
|
+
};
|
|
425
|
+
var undefTag = () => {
|
|
426
|
+
var scope = {
|
|
427
|
+
type: STAMP,
|
|
428
|
+
text: queue.entry,
|
|
429
|
+
col: queue.col,
|
|
430
|
+
row: queue.row,
|
|
431
|
+
start: queue.start,
|
|
432
|
+
};
|
|
433
|
+
if (queue[0]) {
|
|
434
|
+
queue.splice(0, queue.length);
|
|
435
|
+
start = index = queue[0].start;
|
|
436
|
+
}
|
|
437
|
+
else {
|
|
438
|
+
queue = parents.pop();
|
|
439
|
+
start = index = scope.start + scope.text.length;
|
|
440
|
+
}
|
|
441
|
+
var last = queue.last;
|
|
442
|
+
if (last.type === PIECE) {
|
|
443
|
+
this.lastIndex = 0;
|
|
444
|
+
var thist = this.type;
|
|
445
|
+
this.type = undefined;
|
|
446
|
+
var res = this.exec(last.text);
|
|
447
|
+
this.type = thist;
|
|
448
|
+
this.lastIndex = index;
|
|
449
|
+
var prev = last.prev;
|
|
450
|
+
if (prev) {
|
|
451
|
+
prev.next = res.first;
|
|
452
|
+
}
|
|
453
|
+
if (res.first) {
|
|
454
|
+
res.first.prev = prev;
|
|
455
|
+
}
|
|
456
|
+
queue.last = res.last;
|
|
457
|
+
queue.splice(queue.length - 1, 1, ...res);
|
|
458
|
+
setqueue(res, queue);
|
|
459
|
+
|
|
460
|
+
}
|
|
461
|
+
queue_push(scope);
|
|
462
|
+
|
|
408
463
|
}
|
|
409
464
|
var closeTag = function () {
|
|
410
465
|
queue.inTag = false;
|
|
466
|
+
if (text.charAt(index) === m) {
|
|
467
|
+
if ((m + m) in powermap) {
|
|
468
|
+
if (!parents[parents.length - 1].tag) {
|
|
469
|
+
undefTag();
|
|
470
|
+
return false;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}
|
|
411
474
|
if (queue.closed) return;
|
|
412
475
|
if (queue.length) queue.attributes = queue.splice(0, queue.length);
|
|
413
476
|
if (/^\//.test(m) || queue.istype) return queue.short = true, queue.closed = true;
|
|
477
|
+
queue.tag_leave = m;
|
|
414
478
|
return false;
|
|
415
479
|
};
|
|
416
480
|
var push_quote = function () {
|
|
@@ -506,10 +570,8 @@ class Program {
|
|
|
506
570
|
start = index = match.index;
|
|
507
571
|
}
|
|
508
572
|
else queue.inTag = false;
|
|
509
|
-
|
|
510
|
-
continue;
|
|
573
|
+
continue loop;
|
|
511
574
|
}
|
|
512
|
-
|
|
513
575
|
if (quote.end.test(m)) {
|
|
514
576
|
end = match.index;
|
|
515
577
|
if (queue.tag) {
|
|
@@ -517,7 +579,6 @@ class Program {
|
|
|
517
579
|
if (!queue.inTag) continue;
|
|
518
580
|
if (closeTag() === false) {
|
|
519
581
|
start = index;
|
|
520
|
-
queue.tag_leave = m;
|
|
521
582
|
continue loop;
|
|
522
583
|
}
|
|
523
584
|
queue.type = ELEMENT;
|
|
@@ -542,7 +603,7 @@ class Program {
|
|
|
542
603
|
scope.entry = m;
|
|
543
604
|
scope.type = QUOTED;
|
|
544
605
|
if (queue.istype) scope.istype = queue.istype;
|
|
545
|
-
scope.start = index;
|
|
606
|
+
scope.start = match.index;
|
|
546
607
|
scope.isExpress = queue.inExpress;
|
|
547
608
|
push_parents(scope);
|
|
548
609
|
queue.inTag = 0;
|
|
@@ -708,7 +769,7 @@ class Program {
|
|
|
708
769
|
}
|
|
709
770
|
queue.inExpress = true;
|
|
710
771
|
queue.end = index;
|
|
711
|
-
queue.text = text.slice(
|
|
772
|
+
queue.text = text.slice(start, index);
|
|
712
773
|
pop_parents();
|
|
713
774
|
continue;
|
|
714
775
|
}
|
|
@@ -746,13 +807,15 @@ class Program {
|
|
|
746
807
|
}
|
|
747
808
|
save(STRAP);
|
|
748
809
|
var last = queue.last;
|
|
749
|
-
|
|
750
|
-
|
|
810
|
+
m = last.text;
|
|
811
|
+
if (last.type === STRAP && structstrap_reg.test(m) && !queue.classed) {
|
|
812
|
+
queue.classed = [m];
|
|
751
813
|
}
|
|
752
814
|
else if (queue.classed) {
|
|
753
|
-
if (last.type === STRAP && funcstrap_reg.test(
|
|
815
|
+
if (last.type === STRAP && funcstrap_reg.test(m)) queue.classed.push(m);
|
|
754
816
|
}
|
|
755
817
|
if (funcstrap_reg.test(m)) {
|
|
818
|
+
last.isExpress = queue.inExpress;
|
|
756
819
|
last.isargl = true;
|
|
757
820
|
}
|
|
758
821
|
else if (type_reg.test(m)) {
|
|
@@ -874,7 +937,7 @@ class Program {
|
|
|
874
937
|
scope.istype = true;
|
|
875
938
|
}
|
|
876
939
|
}
|
|
877
|
-
if (!last ||
|
|
940
|
+
if (!last || last.type !== STRAP && last.isExpress || last.transive) queue.inExpress = true;
|
|
878
941
|
scope.isExpress = queue.inExpress;
|
|
879
942
|
scope.inExpress = true;
|
|
880
943
|
}
|
|
@@ -893,7 +956,16 @@ class Program {
|
|
|
893
956
|
pop_parents();
|
|
894
957
|
continue;
|
|
895
958
|
}
|
|
896
|
-
if (this.scope_leave[m])
|
|
959
|
+
if (this.scope_leave[m]) {
|
|
960
|
+
console.warn(
|
|
961
|
+
i18n`标记不匹配:`, queue.entry, m,
|
|
962
|
+
i18n`\r\n文件位置:`, this.mindpath + ":" + `${row}:${index - colstart}`,
|
|
963
|
+
i18n`\r\n摘要:\r\n`,
|
|
964
|
+
index - queue.start < 200
|
|
965
|
+
? text.slice(queue.start, index)
|
|
966
|
+
: text.slice(queue.start, queue.start + 100) + "..." + text.slice(index - 97, index)
|
|
967
|
+
);
|
|
968
|
+
}
|
|
897
969
|
save(STAMP);
|
|
898
970
|
}
|
|
899
971
|
while (queue.tag && parents.length) {
|
|
@@ -912,16 +984,12 @@ class Program {
|
|
|
912
984
|
if (cache_stamp) push_stamp();
|
|
913
985
|
this.lastIndex = index;
|
|
914
986
|
if (queue !== origin) {
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
createString(origin.slice(0, 30)),
|
|
918
|
-
`\r\n
|
|
919
|
-
`\r\n
|
|
920
|
-
`\r\n
|
|
921
|
-
`\r\n ----- last: ${queue.last ? createString([queue.last]).slice(0, 30) : createString(queue).slice(0, 30)}`,
|
|
922
|
-
`\r\n -- parents: ${parents.map(p => `${p.row}:${p.col}-${p.tag || p.text || p.entry} `).join('-)> ')}`,
|
|
923
|
-
`\r\n ----- snap: ${createString([queue]).slice(-200)}`,
|
|
924
|
-
`\r\n ------ end. `
|
|
987
|
+
var last = queue.last || queue;
|
|
988
|
+
console.warn(
|
|
989
|
+
"代码异常结束", createString(origin.slice(0, 30)),
|
|
990
|
+
`\r\n - 祖先标记: ${parents.slice(1).map(p => `<red2>${p.tag || p.text || ""}${p.entry || ""}</red2><gray>${p.row}:${p.col}</gray>`).join('')}`,
|
|
991
|
+
`\r\n - 内层入口: <yellow>${this.mindpath}</yellow>:${last.row}:${last.col} ${last.text || last.entry}`,
|
|
992
|
+
`\r\n ----- 快照: ${createString(pickAssignment(queue.last || queue))}`,
|
|
925
993
|
);
|
|
926
994
|
while (queue !== origin) {
|
|
927
995
|
queue.error = "代码异常结束";
|
|
@@ -957,24 +1025,6 @@ class Program {
|
|
|
957
1025
|
}
|
|
958
1026
|
});
|
|
959
1027
|
quoteslike.forEach(q => {
|
|
960
|
-
var ts = [];
|
|
961
|
-
var r = q.slice(q[2] ? 2 : 3).concat(q[1]).map(q => {
|
|
962
|
-
if (q instanceof Array) {
|
|
963
|
-
if (q.length > 2) {
|
|
964
|
-
ts.push(...q.slice(0, q.length - 2));
|
|
965
|
-
}
|
|
966
|
-
else if (q.length !== 2) throw new Error(i18n`配置错误!`);
|
|
967
|
-
q = q[q.length - 2];
|
|
968
|
-
}
|
|
969
|
-
if (q instanceof RegExp) {
|
|
970
|
-
return q.source;
|
|
971
|
-
}
|
|
972
|
-
return this.compile(q);
|
|
973
|
-
});
|
|
974
|
-
if (q.tag) r = r.concat(q.tag);
|
|
975
|
-
r = r.concat(ts.map(this.compile));
|
|
976
|
-
r = sortRegster(r).join("|");
|
|
977
|
-
q.reg = new RegExp(r, 'g');
|
|
978
1028
|
q.end = this.createRegExp([q[1]]);
|
|
979
1029
|
if (q.length >= 4) {
|
|
980
1030
|
var entry = q.slice(3);
|
|
@@ -1019,6 +1069,32 @@ class Program {
|
|
|
1019
1069
|
for (var k in this.powermap) if (k.length === 1 && stamps.indexOf(k) < 0) stamps.push(k);
|
|
1020
1070
|
stamps.push.apply(stamps, powers);
|
|
1021
1071
|
this.stamp_reg = new RegExp(`^(${stamps.map(this.compile).join('|')})$`);
|
|
1072
|
+
quoteslike.forEach(q => {
|
|
1073
|
+
var ts = [];
|
|
1074
|
+
var r = q.slice(q[2] ? 2 : 3).concat(q[1]).map(q => {
|
|
1075
|
+
if (q instanceof Array) {
|
|
1076
|
+
if (q.length > 2) {
|
|
1077
|
+
ts.push(...q.slice(0, q.length - 2));
|
|
1078
|
+
}
|
|
1079
|
+
else if (q.length !== 2) throw new Error(i18n`配置错误!`);
|
|
1080
|
+
q = q[q.length - 2];
|
|
1081
|
+
}
|
|
1082
|
+
if (q instanceof RegExp) {
|
|
1083
|
+
return q.source;
|
|
1084
|
+
}
|
|
1085
|
+
return this.compile(q);
|
|
1086
|
+
});
|
|
1087
|
+
if (q.tag) r = r.concat(q.tag, powers.filter(p => {
|
|
1088
|
+
var tagentries = q.tag[0];
|
|
1089
|
+
for (var t of tagentries) {
|
|
1090
|
+
if (p.indexOf(t) >= 0) return true;
|
|
1091
|
+
}
|
|
1092
|
+
return false;
|
|
1093
|
+
}).map(this.compile));
|
|
1094
|
+
r = r.concat(ts.map(this.compile));
|
|
1095
|
+
r = sortRegster(trimDulp(r)).join("|");
|
|
1096
|
+
q.reg = new RegExp(r, 'g');
|
|
1097
|
+
})
|
|
1022
1098
|
}
|
|
1023
1099
|
}
|
|
1024
1100
|
module.exports = Program;
|
package/coms/compile/common.js
CHANGED
|
@@ -1233,7 +1233,13 @@ var getSemicolonBetween = function (prev, next) {
|
|
|
1233
1233
|
if (
|
|
1234
1234
|
(EXPRESS | VALUE | QUOTED) & prev.type
|
|
1235
1235
|
|| prev.type === STAMP && /^(\+\+|\-\-)$/.test(prev.text)
|
|
1236
|
-
|| prev.type === SCOPED && (prev.isExpress || prev.isObject
|
|
1236
|
+
|| prev.type === SCOPED && (prev.isExpress || prev.isObject || prev.entry === '(' && (
|
|
1237
|
+
// 这两种分号不存在时efront的解析器可以识别,v8的识别不了,为了兼容追加分号
|
|
1238
|
+
// do{}while(); return
|
|
1239
|
+
// =function(){}(); return
|
|
1240
|
+
prev.perv?.type === STRAP && prev.prev.text === 'while' || prev.prev?.type === SCOPED
|
|
1241
|
+
)
|
|
1242
|
+
)
|
|
1237
1243
|
) {
|
|
1238
1244
|
if ((EXPRESS | VALUE | QUOTED | LABEL) & next.type) return ";";
|
|
1239
1245
|
if (next.type === STRAP) {
|
package/coms/compile/scanner2.js
CHANGED
|
@@ -203,17 +203,62 @@ class Code extends Array {
|
|
|
203
203
|
|
|
204
204
|
var avoidMap = null;
|
|
205
205
|
var typeMap = Object.create(null);
|
|
206
|
-
function scan() {
|
|
207
|
-
var
|
|
208
|
-
|
|
209
|
-
|
|
206
|
+
function scan(text) {
|
|
207
|
+
var fullpath, type, lastIndex = 0, program;
|
|
208
|
+
for (var cx = 1, dx = arguments.length; cx < dx; cx++) {
|
|
209
|
+
var a = arguments[cx];
|
|
210
|
+
switch (typeof a) {
|
|
211
|
+
case "number":
|
|
212
|
+
lastIndex = a;
|
|
213
|
+
break;
|
|
214
|
+
case "string":
|
|
215
|
+
if (!fullpath) {
|
|
216
|
+
fullpath = a;
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
219
|
+
else if (!type) {
|
|
220
|
+
type = a;
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
case "object":
|
|
224
|
+
case "function":
|
|
225
|
+
type = a;
|
|
226
|
+
break;
|
|
227
|
+
default:
|
|
228
|
+
throw new Error('无效参数: ' + type);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
if (!type) {
|
|
232
|
+
if (/\.[^\.\/\\]+$/i.test(fullpath)) {
|
|
233
|
+
type = /[^\.\/\\]+$/.exec(fullpath)[0].toLowerCase();
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
type = fullpath || 'js';
|
|
237
|
+
}
|
|
238
|
+
}
|
|
210
239
|
if (!program) switch (type) {
|
|
211
240
|
case "html":
|
|
212
|
-
|
|
241
|
+
case "xht":
|
|
242
|
+
case "htm":
|
|
243
|
+
case "jsp":
|
|
244
|
+
case "asp":
|
|
245
|
+
case "php":
|
|
246
|
+
case "hta":
|
|
247
|
+
case "vue":
|
|
248
|
+
type = 'html';
|
|
249
|
+
program = typeMap[type];
|
|
250
|
+
if (!program) program = typeMap[type] = new Html;
|
|
213
251
|
break;
|
|
214
252
|
case "js":
|
|
253
|
+
case "ts":
|
|
254
|
+
case "jsx":
|
|
255
|
+
case "tsx":
|
|
256
|
+
case "mjs":
|
|
257
|
+
case "cjs":
|
|
215
258
|
case "javascript":
|
|
216
|
-
|
|
259
|
+
type = "js";
|
|
260
|
+
program = typeMap[type];
|
|
261
|
+
if (!program) program = typeMap[type] = new Javascript;
|
|
217
262
|
break;
|
|
218
263
|
default:
|
|
219
264
|
if (type instanceof Function) {
|
|
@@ -223,12 +268,13 @@ function scan() {
|
|
|
223
268
|
program = type;
|
|
224
269
|
}
|
|
225
270
|
else {
|
|
226
|
-
console.
|
|
271
|
+
throw new Error(i18n`类型不支持: ${console.format(`<red2>${type}</red2>`)}`);
|
|
227
272
|
}
|
|
228
273
|
break;
|
|
229
274
|
}
|
|
230
275
|
program.Code = Code;
|
|
231
276
|
program.lastIndex = lastIndex;
|
|
277
|
+
program.mindpath = fullpath;
|
|
232
278
|
var res = program.exec(text);
|
|
233
279
|
res.autospace = !program.keepspace;
|
|
234
280
|
Object.defineProperty(res, "program", { value: program, enumerable: false })
|
|
@@ -100,7 +100,7 @@ function translate([imap, supports], code) {
|
|
|
100
100
|
return 0;
|
|
101
101
|
});
|
|
102
102
|
var getm = function (tt, nodup, warn) {
|
|
103
|
-
var mq = /^(\s*)([\s\S]*?)(
|
|
103
|
+
var mq = /^(\s*)([\s\S]*?)([\:\:]?\s*)$/.exec(tt);
|
|
104
104
|
var mq = [mq[1] || '', mq[2], mq[3] || ''];
|
|
105
105
|
var tt = mq[1];
|
|
106
106
|
var wrap = m => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
if (this.XMLHttpRequest) return this.XMLHttpRequest;
|
|
1
|
+
if (this.XMLHttpRequest?.prototype && "onreadystatechange" in this.XMLHttpRequest.prototype) return this.XMLHttpRequest;
|
|
2
2
|
if (this.ActiveXObject) return this.ActiveXObject.bind(null, 'Microsoft.XMLHTTP');
|
|
3
3
|
if (!this.fetch) return;
|
|
4
4
|
var window = this;
|
|
@@ -17,18 +17,21 @@ XMLHttpRequest.prototype.open = function (method, url) {
|
|
|
17
17
|
XMLHttpRequest.prototype.send = function (data) {
|
|
18
18
|
var params = { method: this.method, headers: { referer: document.location.href.replace(/^#[\s\S]*$/g, '') } };
|
|
19
19
|
if (data != null) params.body = data;
|
|
20
|
-
this.fetch(this.url, params)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
var fetched = this.fetch(this.url, params);
|
|
21
|
+
var xhr = this;
|
|
22
|
+
fetched.then(function (d) {
|
|
23
|
+
xhr.fetched = d;
|
|
24
|
+
xhr.readyState = 4;
|
|
25
|
+
xhr.status = d.status;
|
|
24
26
|
return d.text();
|
|
25
27
|
}).then(function (d) {
|
|
26
|
-
|
|
27
|
-
if (
|
|
28
|
-
if (
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (
|
|
32
|
-
if (
|
|
28
|
+
xhr.responseText = d;
|
|
29
|
+
if (xhr.onreadystatechange) xhr.onreadystatechange({ target: xhr });
|
|
30
|
+
if (xhr.onload) xhr.onload({ target: xhr });
|
|
31
|
+
}).catch(function (e) {
|
|
32
|
+
xhr.readyState = 4;
|
|
33
|
+
if (xhr.onreadystatechange) xhr.onreadystatechange({ target: xhr });
|
|
34
|
+
if (xhr.onerror) xhr.onerror({ target: xhr });
|
|
33
35
|
});
|
|
34
|
-
}
|
|
36
|
+
}
|
|
37
|
+
return XMLHttpRequest;
|
|
@@ -616,6 +616,7 @@
|
|
|
616
616
|
已找到的字符串.is_loading = true;
|
|
617
617
|
var addTranslate = function (translate) {
|
|
618
618
|
if (!isHandled(translate)) return;
|
|
619
|
+
translate = translate.replace(/^\s*([\s\S]*?)([:\:]?\s*)$/, '$1');
|
|
619
620
|
var tmap = textMap[translate];
|
|
620
621
|
if (!tmap) tmap = textMap[translate] = Object.create(null), tmap["#count"] = 0;
|
|
621
622
|
if (!tmap[e.path]) tmap[e.path] = [];
|
|
@@ -646,6 +647,9 @@
|
|
|
646
647
|
var data = await readText(e);
|
|
647
648
|
data = parseYML(data);
|
|
648
649
|
loop: for (var d of data) {
|
|
650
|
+
for (var k in d) {
|
|
651
|
+
d[k] = d[k].replace(/^\s*([\s\S]*?)([:\:]?\s*)$/, '$1');
|
|
652
|
+
}
|
|
649
653
|
var liang = 0, fanyi = {};
|
|
650
654
|
for (var { lang: k, id } of supports) {
|
|
651
655
|
if (!d[k]) continue;
|