htmv 0.0.39 → 0.0.41

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.
@@ -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,31 +103,37 @@ export function parse(tokens) {
103
103
  }
104
104
  }
105
105
  return nodes;
106
- }
107
- function parseArgs(args) {
108
- let textBuffer = "";
109
- for (let i = 0; i < args.length; i++) {
110
- const letter = args[i];
111
- if (letter === "{") {
112
- clearBuffer();
113
- continue;
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;
114
125
  }
115
- if (letter === "}") {
116
- tokens.push({
117
- type: "interpolation",
118
- value: textBuffer,
119
- });
120
- clearBuffer();
126
+ pushBuffer();
127
+ function clearBuffer() {
128
+ textBuffer = "";
121
129
  }
122
- textBuffer += letter;
123
- }
124
- clearBuffer();
125
- function clearBuffer() {
126
- if (textBuffer.length > 0) {
127
- tokens.push({
128
- type: "text",
129
- text: textBuffer,
130
- });
130
+ function pushBuffer() {
131
+ if (textBuffer.length > 0) {
132
+ nodes.push({
133
+ type: "text",
134
+ text: textBuffer,
135
+ });
136
+ }
131
137
  }
132
138
  }
133
139
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "htmv",
3
3
  "main": "dist/index.js",
4
4
  "type": "module",
5
- "version": "0.0.39",
5
+ "version": "0.0.41",
6
6
  "devDependencies": {
7
7
  "@biomejs/biome": "2.3.3",
8
8
  "@types/bun": "latest"