malinajs 0.6.52 → 0.6.53
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/compile.js +18 -11
- package/malina.js +19 -12
- package/package.json +1 -1
package/compile.js
CHANGED
|
@@ -829,7 +829,8 @@ function parse() {
|
|
|
829
829
|
} else continue;
|
|
830
830
|
|
|
831
831
|
return {
|
|
832
|
-
value: source.substring(start + 1, index - 1)
|
|
832
|
+
value: source.substring(start + 1, index - 1),
|
|
833
|
+
raw: source.substring(start, index)
|
|
833
834
|
};
|
|
834
835
|
}
|
|
835
836
|
};
|
|
@@ -846,6 +847,16 @@ function parse() {
|
|
|
846
847
|
const go = (parent) => {
|
|
847
848
|
let textNode = null;
|
|
848
849
|
|
|
850
|
+
const addText = v => {
|
|
851
|
+
if(!textNode) {
|
|
852
|
+
textNode = {
|
|
853
|
+
type: 'text',
|
|
854
|
+
value: ''
|
|
855
|
+
};
|
|
856
|
+
}
|
|
857
|
+
textNode.value += v;
|
|
858
|
+
};
|
|
859
|
+
|
|
849
860
|
const flushText = () => {
|
|
850
861
|
if(!textNode) return;
|
|
851
862
|
parent.body.push(textNode);
|
|
@@ -910,10 +921,12 @@ function parse() {
|
|
|
910
921
|
}
|
|
911
922
|
continue;
|
|
912
923
|
} else if(a === '{') {
|
|
913
|
-
if(['#', '/', ':', '@'].indexOf(source[index + 1]) >= 0) {
|
|
914
|
-
flushText();
|
|
924
|
+
if(['#', '/', ':', '@', '*'].indexOf(source[index + 1]) >= 0) {
|
|
915
925
|
let bind = readBinding();
|
|
916
|
-
if(bind.value
|
|
926
|
+
if(bind.value[0] != '*') flushText();
|
|
927
|
+
if(bind.value[0] == '*') {
|
|
928
|
+
addText(bind.raw);
|
|
929
|
+
} else if(bind.value.match(/^@\w+/)) {
|
|
917
930
|
let tag = {
|
|
918
931
|
type: 'systag',
|
|
919
932
|
value: bind.value
|
|
@@ -1005,13 +1018,7 @@ function parse() {
|
|
|
1005
1018
|
}
|
|
1006
1019
|
}
|
|
1007
1020
|
|
|
1008
|
-
|
|
1009
|
-
textNode = {
|
|
1010
|
-
type: 'text',
|
|
1011
|
-
value: ''
|
|
1012
|
-
};
|
|
1013
|
-
}
|
|
1014
|
-
textNode.value += readNext();
|
|
1021
|
+
addText(readNext());
|
|
1015
1022
|
} flushText();
|
|
1016
1023
|
assert(parent.type === 'root', 'File ends to early');
|
|
1017
1024
|
};
|
package/malina.js
CHANGED
|
@@ -830,7 +830,8 @@
|
|
|
830
830
|
} else continue;
|
|
831
831
|
|
|
832
832
|
return {
|
|
833
|
-
value: source.substring(start + 1, index - 1)
|
|
833
|
+
value: source.substring(start + 1, index - 1),
|
|
834
|
+
raw: source.substring(start, index)
|
|
834
835
|
};
|
|
835
836
|
}
|
|
836
837
|
};
|
|
@@ -847,6 +848,16 @@
|
|
|
847
848
|
const go = (parent) => {
|
|
848
849
|
let textNode = null;
|
|
849
850
|
|
|
851
|
+
const addText = v => {
|
|
852
|
+
if(!textNode) {
|
|
853
|
+
textNode = {
|
|
854
|
+
type: 'text',
|
|
855
|
+
value: ''
|
|
856
|
+
};
|
|
857
|
+
}
|
|
858
|
+
textNode.value += v;
|
|
859
|
+
};
|
|
860
|
+
|
|
850
861
|
const flushText = () => {
|
|
851
862
|
if(!textNode) return;
|
|
852
863
|
parent.body.push(textNode);
|
|
@@ -911,10 +922,12 @@
|
|
|
911
922
|
}
|
|
912
923
|
continue;
|
|
913
924
|
} else if(a === '{') {
|
|
914
|
-
if(['#', '/', ':', '@'].indexOf(source[index + 1]) >= 0) {
|
|
915
|
-
flushText();
|
|
925
|
+
if(['#', '/', ':', '@', '*'].indexOf(source[index + 1]) >= 0) {
|
|
916
926
|
let bind = readBinding();
|
|
917
|
-
if(bind.value
|
|
927
|
+
if(bind.value[0] != '*') flushText();
|
|
928
|
+
if(bind.value[0] == '*') {
|
|
929
|
+
addText(bind.raw);
|
|
930
|
+
} else if(bind.value.match(/^@\w+/)) {
|
|
918
931
|
let tag = {
|
|
919
932
|
type: 'systag',
|
|
920
933
|
value: bind.value
|
|
@@ -1006,13 +1019,7 @@
|
|
|
1006
1019
|
}
|
|
1007
1020
|
}
|
|
1008
1021
|
|
|
1009
|
-
|
|
1010
|
-
textNode = {
|
|
1011
|
-
type: 'text',
|
|
1012
|
-
value: ''
|
|
1013
|
-
};
|
|
1014
|
-
}
|
|
1015
|
-
textNode.value += readNext();
|
|
1022
|
+
addText(readNext());
|
|
1016
1023
|
} flushText();
|
|
1017
1024
|
assert(parent.type === 'root', 'File ends to early');
|
|
1018
1025
|
};
|
|
@@ -5891,7 +5898,7 @@
|
|
|
5891
5898
|
return {event, fn};
|
|
5892
5899
|
}
|
|
5893
5900
|
|
|
5894
|
-
const version = '0.6.
|
|
5901
|
+
const version = '0.6.53';
|
|
5895
5902
|
|
|
5896
5903
|
|
|
5897
5904
|
async function compile(source, config = {}) {
|