htmv 0.0.40 → 0.0.42
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/dist/compiler/parser.js +30 -25
- package/package.json +1 -1
package/dist/compiler/parser.js
CHANGED
|
@@ -75,7 +75,7 @@ export function parse(tokens) {
|
|
|
75
75
|
if (nextToken?.type === "arguments") {
|
|
76
76
|
nodes.push({
|
|
77
77
|
type: "text",
|
|
78
|
-
text: `<${tag}`,
|
|
78
|
+
text: `<${tag} `,
|
|
79
79
|
});
|
|
80
80
|
parseArgs(nextToken.value);
|
|
81
81
|
nodes.push({
|
|
@@ -103,33 +103,38 @@ export function parse(tokens) {
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
return nodes;
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
|
|
106
|
+
function parseArgs(_args) {
|
|
107
|
+
const args = _args.join(" ");
|
|
108
|
+
let textBuffer = "";
|
|
109
|
+
for (let i = 0; i < args.length; i++) {
|
|
110
|
+
const letter = args[i];
|
|
111
|
+
if (letter === "{") {
|
|
112
|
+
pushBuffer();
|
|
113
|
+
clearBuffer();
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
if (letter === "}") {
|
|
117
|
+
nodes.push({
|
|
118
|
+
type: "interpolation",
|
|
119
|
+
value: textBuffer,
|
|
120
|
+
});
|
|
121
|
+
clearBuffer();
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
textBuffer += letter;
|
|
125
125
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
clearBuffer();
|
|
129
|
-
function clearBuffer() {
|
|
130
|
-
if (textBuffer.length > 0) {
|
|
126
|
+
pushBuffer();
|
|
127
|
+
function clearBuffer() {
|
|
131
128
|
textBuffer = "";
|
|
132
129
|
}
|
|
130
|
+
function pushBuffer() {
|
|
131
|
+
if (textBuffer.length > 0) {
|
|
132
|
+
nodes.push({
|
|
133
|
+
type: "text",
|
|
134
|
+
text: textBuffer,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
133
138
|
}
|
|
134
139
|
}
|
|
135
140
|
}
|