@dogsbay/minja 0.2.0-beta.100
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/LICENSE +21 -0
- package/README.md +623 -0
- package/bin/minja.js +1225 -0
- package/dist/browser.d.ts +12 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +11 -0
- package/dist/browser.js.map +1 -0
- package/dist/cli.d.ts +5 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +98 -0
- package/dist/cli.js.map +1 -0
- package/dist/context.d.ts +47 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +112 -0
- package/dist/context.js.map +1 -0
- package/dist/evaluator.d.ts +20 -0
- package/dist/evaluator.d.ts.map +1 -0
- package/dist/evaluator.js +213 -0
- package/dist/evaluator.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/index.umd.js +1160 -0
- package/dist/index.umd.js.map +7 -0
- package/dist/index.umd.min.js +12 -0
- package/dist/index.umd.min.js.map +7 -0
- package/dist/loader-fetch.d.ts +8 -0
- package/dist/loader-fetch.d.ts.map +1 -0
- package/dist/loader-fetch.js +15 -0
- package/dist/loader-fetch.js.map +1 -0
- package/dist/loader-memory.d.ts +11 -0
- package/dist/loader-memory.d.ts.map +1 -0
- package/dist/loader-memory.js +36 -0
- package/dist/loader-memory.js.map +1 -0
- package/dist/loader.d.ts +73 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +159 -0
- package/dist/loader.js.map +1 -0
- package/dist/parser.d.ts +7 -0
- package/dist/parser.d.ts.map +1 -0
- package/dist/parser.js +609 -0
- package/dist/parser.js.map +1 -0
- package/dist/renderer.d.ts +13 -0
- package/dist/renderer.d.ts.map +1 -0
- package/dist/renderer.js +494 -0
- package/dist/renderer.js.map +1 -0
- package/dist/scan.d.ts +46 -0
- package/dist/scan.d.ts.map +1 -0
- package/dist/scan.js +46 -0
- package/dist/scan.js.map +1 -0
- package/dist/types.d.ts +175 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/package.json +72 -0
package/dist/parser.js
ADDED
|
@@ -0,0 +1,609 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template parser
|
|
3
|
+
* Converts template strings into AST (Abstract Syntax Tree)
|
|
4
|
+
*/
|
|
5
|
+
import { parseExpression } from './evaluator.js';
|
|
6
|
+
/**
|
|
7
|
+
* Statement keywords the parser understands. Openers dispatch below; the
|
|
8
|
+
* end/branch keywords are consumed by their opening tags (stray ones are
|
|
9
|
+
* ignored, matching historical behavior). Anything OUTSIDE this set is an
|
|
10
|
+
* unknown statement and is preserved verbatim in the output — silently
|
|
11
|
+
* deleting author content is never acceptable.
|
|
12
|
+
*/
|
|
13
|
+
const KNOWN_TAG_KEYWORDS = new Set([
|
|
14
|
+
'set',
|
|
15
|
+
'if',
|
|
16
|
+
'include',
|
|
17
|
+
'switch',
|
|
18
|
+
'leveloffset',
|
|
19
|
+
'raw',
|
|
20
|
+
'endif',
|
|
21
|
+
'elif',
|
|
22
|
+
'else',
|
|
23
|
+
'endswitch',
|
|
24
|
+
'case',
|
|
25
|
+
'endleveloffset',
|
|
26
|
+
'endraw',
|
|
27
|
+
]);
|
|
28
|
+
/**
|
|
29
|
+
* Parse a template string into an AST
|
|
30
|
+
* @param template - Template string to parse
|
|
31
|
+
* @returns Parse result with AST and errors
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* Apply a closing tag's LEFT whitespace-control marker to the body it closes.
|
|
35
|
+
*
|
|
36
|
+
* `{%- endif %}` must strip the whitespace before it — including the newline —
|
|
37
|
+
* exactly as `{%-` does on an opening tag. Block bodies are extracted by
|
|
38
|
+
* matching the end tag textually (`/{%-?\s*endif\s*-?%}/`), and the `-?` was
|
|
39
|
+
* matched but never acted on, so the body kept its trailing newline. Combined
|
|
40
|
+
* with the newline that follows the tag, an AsciiDoc conditional written
|
|
41
|
+
* inline in a paragraph —
|
|
42
|
+
*
|
|
43
|
+
* Welcome to the official {{ product_title }}
|
|
44
|
+
* {%- if not openshift_rosa %}
|
|
45
|
+
* {{ product_version }}
|
|
46
|
+
* {%- endif %}
|
|
47
|
+
* documentation, where you can learn…
|
|
48
|
+
*
|
|
49
|
+
* — rendered a BLANK line after the version, splitting one sentence into two
|
|
50
|
+
* paragraphs mid-clause. Jinja2 produces no blank line here.
|
|
51
|
+
*/
|
|
52
|
+
function stripBodyForEndTag(body, endTag) {
|
|
53
|
+
return endTag.startsWith('{%-') ? body.replace(/[ \t]*\n[ \t\n]*$/, '') : body;
|
|
54
|
+
}
|
|
55
|
+
export function parse(template) {
|
|
56
|
+
const errors = [];
|
|
57
|
+
const ast = [];
|
|
58
|
+
let position = 0;
|
|
59
|
+
let line = 1;
|
|
60
|
+
let column = 1;
|
|
61
|
+
/**
|
|
62
|
+
* Create a parse error
|
|
63
|
+
*/
|
|
64
|
+
function createError(message) {
|
|
65
|
+
return { message, position, line, column };
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Advance position tracking
|
|
69
|
+
*/
|
|
70
|
+
function advance(count) {
|
|
71
|
+
for (let i = 0; i < count; i++) {
|
|
72
|
+
if (template[position + i] === '\n') {
|
|
73
|
+
line++;
|
|
74
|
+
column = 1;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
column++;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
position += count;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Find the next occurrence of a string
|
|
84
|
+
*/
|
|
85
|
+
function findNext(str, from = position) {
|
|
86
|
+
return template.indexOf(str, from);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Extract text between current position and a target position
|
|
90
|
+
*/
|
|
91
|
+
function extractTo(target) {
|
|
92
|
+
const text = template.substring(position, target);
|
|
93
|
+
advance(target - position);
|
|
94
|
+
return text;
|
|
95
|
+
}
|
|
96
|
+
while (position < template.length) {
|
|
97
|
+
// Look for template tags
|
|
98
|
+
const varStart = findNext('{{', position);
|
|
99
|
+
const tagStart = findNext('{%', position);
|
|
100
|
+
const commentStart = findNext('{#', position);
|
|
101
|
+
// Find the nearest tag
|
|
102
|
+
const candidates = [
|
|
103
|
+
{ pos: varStart, type: 'var' },
|
|
104
|
+
{ pos: tagStart, type: 'tag' },
|
|
105
|
+
{ pos: commentStart, type: 'comment' },
|
|
106
|
+
].filter((c) => c.pos !== -1);
|
|
107
|
+
if (candidates.length === 0) {
|
|
108
|
+
// No more tags, rest is text
|
|
109
|
+
const text = template.substring(position);
|
|
110
|
+
if (text) {
|
|
111
|
+
ast.push({ type: 'text', value: text });
|
|
112
|
+
}
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
// Sort to find nearest
|
|
116
|
+
candidates.sort((a, b) => a.pos - b.pos);
|
|
117
|
+
const nearest = candidates[0];
|
|
118
|
+
// Add text before tag
|
|
119
|
+
if (nearest.pos > position) {
|
|
120
|
+
ast.push({ type: 'text', value: extractTo(nearest.pos) });
|
|
121
|
+
}
|
|
122
|
+
// Parse the tag
|
|
123
|
+
if (nearest.type === 'var') {
|
|
124
|
+
// Variable: {{ name }}
|
|
125
|
+
advance(2); // Skip {{
|
|
126
|
+
const endPos = findNext('}}', position);
|
|
127
|
+
if (endPos === -1) {
|
|
128
|
+
errors.push(createError('Unclosed variable tag'));
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
const varName = extractTo(endPos).trim();
|
|
132
|
+
advance(2); // Skip }}
|
|
133
|
+
ast.push({ type: 'variable', name: varName });
|
|
134
|
+
}
|
|
135
|
+
else if (nearest.type === 'comment') {
|
|
136
|
+
// Comment: {# ... #}
|
|
137
|
+
// Auto-strip newlines for comments (they produce no output)
|
|
138
|
+
// Only strip if the comment is on its own line
|
|
139
|
+
if (ast.length > 0 && ast[ast.length - 1].type === 'text') {
|
|
140
|
+
const lastNode = ast[ast.length - 1];
|
|
141
|
+
// Only strip if previous text ends with newline (comment is on its own line)
|
|
142
|
+
if (/\n[ \t]*$/.test(lastNode.value)) {
|
|
143
|
+
lastNode.value = lastNode.value.replace(/[ \t]*\n[ \t]*$/, '');
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
advance(2); // Skip {#
|
|
147
|
+
const endPos = findNext('#}', position);
|
|
148
|
+
if (endPos === -1) {
|
|
149
|
+
errors.push(createError('Unclosed comment tag'));
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
const commentText = extractTo(endPos);
|
|
153
|
+
advance(2); // Skip #}
|
|
154
|
+
ast.push({ type: 'comment', value: commentText });
|
|
155
|
+
// Auto-strip following newline if comment is on its own line
|
|
156
|
+
if (position < template.length && template[position] === '\n') {
|
|
157
|
+
advance(1);
|
|
158
|
+
// Also skip any indentation on the next line
|
|
159
|
+
while (position < template.length && /[ \t]/.test(template[position])) {
|
|
160
|
+
advance(1);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
else if (nearest.type === 'tag') {
|
|
165
|
+
// Statement tag: {% ... %}
|
|
166
|
+
const tagStart = position;
|
|
167
|
+
advance(2); // Skip {%
|
|
168
|
+
const endPos = findNext('%}', position);
|
|
169
|
+
if (endPos === -1) {
|
|
170
|
+
errors.push(createError('Unclosed statement tag'));
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
// Peek the keyword BEFORE whitespace-control processing, so raw
|
|
174
|
+
// blocks and unknown tags are handled without side effects.
|
|
175
|
+
const peeked = template.substring(position, endPos).trim();
|
|
176
|
+
const peekKeyword = peeked.replace(/^-\s*/, '').replace(/\s*-$/, '').split(/\s+/)[0] ?? '';
|
|
177
|
+
if (peekKeyword === 'raw') {
|
|
178
|
+
// {% raw %} ... {% endraw %} — Jinja semantics: everything between
|
|
179
|
+
// the markers passes through COMPLETELY unevaluated; the markers
|
|
180
|
+
// themselves produce no output. Whitespace-control markers are
|
|
181
|
+
// honored on both tags.
|
|
182
|
+
const openerLeftStrip = peeked.startsWith('-');
|
|
183
|
+
const openerRightStrip = peeked.endsWith('-');
|
|
184
|
+
if (openerLeftStrip && ast.length > 0 && ast[ast.length - 1].type === 'text') {
|
|
185
|
+
const lastNode = ast[ast.length - 1];
|
|
186
|
+
lastNode.value = lastNode.value.replace(/[ \t]*\n[ \t\n]*$/, '');
|
|
187
|
+
}
|
|
188
|
+
extractTo(endPos);
|
|
189
|
+
advance(2); // Skip %}
|
|
190
|
+
if (openerRightStrip) {
|
|
191
|
+
while (position < template.length && /[ \t\n]/.test(template[position])) {
|
|
192
|
+
advance(1);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
const endrawMatch = /\{%-?\s*endraw\s*-?%\}/.exec(template.substring(position));
|
|
196
|
+
if (!endrawMatch) {
|
|
197
|
+
errors.push(createError('Unclosed raw block'));
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
200
|
+
const endrawAbs = position + endrawMatch.index;
|
|
201
|
+
let content = extractTo(endrawAbs);
|
|
202
|
+
const endrawTag = endrawMatch[0];
|
|
203
|
+
if (endrawTag.startsWith('{%-')) {
|
|
204
|
+
content = content.replace(/[ \t]*\n[ \t\n]*$/, '');
|
|
205
|
+
}
|
|
206
|
+
advance(endrawTag.length);
|
|
207
|
+
if (endrawTag.endsWith('-%}')) {
|
|
208
|
+
while (position < template.length && /[ \t\n]/.test(template[position])) {
|
|
209
|
+
advance(1);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
if (content) {
|
|
213
|
+
ast.push({ type: 'text', value: content });
|
|
214
|
+
}
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
if (!KNOWN_TAG_KEYWORDS.has(peekKeyword)) {
|
|
218
|
+
// Unknown statement: preserve the tag verbatim (it was previously
|
|
219
|
+
// silently dropped). No whitespace control is applied — the bytes
|
|
220
|
+
// pass through exactly as authored.
|
|
221
|
+
extractTo(endPos);
|
|
222
|
+
advance(2); // Skip %}
|
|
223
|
+
ast.push({ type: 'text', value: template.substring(tagStart, endPos + 2) });
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
let statement = extractTo(endPos).trim();
|
|
227
|
+
// Check for whitespace control characters
|
|
228
|
+
const hasLeftStrip = statement.startsWith('-');
|
|
229
|
+
const hasRightStrip = statement.endsWith('-');
|
|
230
|
+
// Strip whitespace control characters from statement
|
|
231
|
+
if (hasLeftStrip) {
|
|
232
|
+
statement = statement.substring(1).trim();
|
|
233
|
+
// Strip trailing whitespace from previous text node
|
|
234
|
+
if (ast.length > 0 && ast[ast.length - 1].type === 'text') {
|
|
235
|
+
const lastNode = ast[ast.length - 1];
|
|
236
|
+
lastNode.value = lastNode.value.replace(/[ \t]*\n[ \t\n]*$/, '');
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
if (hasRightStrip) {
|
|
240
|
+
statement = statement.substring(0, statement.length - 1).trim();
|
|
241
|
+
}
|
|
242
|
+
advance(2); // Skip %}
|
|
243
|
+
// If right strip, consume following whitespace
|
|
244
|
+
if (hasRightStrip) {
|
|
245
|
+
while (position < template.length && /[ \t\n]/.test(template[position])) {
|
|
246
|
+
advance(1);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
// Parse different statement types
|
|
250
|
+
if (statement.startsWith('set ')) {
|
|
251
|
+
// {% set var = value %}
|
|
252
|
+
const setMatch = /^set\s+(\w+)\s*=\s*(.+)$/.exec(statement);
|
|
253
|
+
if (setMatch) {
|
|
254
|
+
try {
|
|
255
|
+
const expr = parseExpression(setMatch[2]);
|
|
256
|
+
ast.push({
|
|
257
|
+
type: 'set',
|
|
258
|
+
name: setMatch[1],
|
|
259
|
+
value: expr,
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
catch (error) {
|
|
263
|
+
errors.push(createError(`Invalid set expression: ${error.message}`));
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
errors.push(createError('Invalid set syntax'));
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
else if (statement.startsWith('if ')) {
|
|
271
|
+
// {% if condition %} ... {% elif %} ... {% else %} ... {% endif %}
|
|
272
|
+
const condition = statement.substring(3).trim();
|
|
273
|
+
try {
|
|
274
|
+
const expr = parseExpression(condition);
|
|
275
|
+
// Find the body and elif/else/endif blocks
|
|
276
|
+
const { trueBranch, elifBranches, elseBranch, parseErrors } = parseIfBlock();
|
|
277
|
+
errors.push(...parseErrors);
|
|
278
|
+
ast.push({
|
|
279
|
+
type: 'if',
|
|
280
|
+
condition: expr,
|
|
281
|
+
trueBranch,
|
|
282
|
+
elifBranches: elifBranches.length > 0 ? elifBranches : undefined,
|
|
283
|
+
elseBranch: elseBranch.length > 0 ? elseBranch : undefined,
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
catch (error) {
|
|
287
|
+
errors.push(createError(`Invalid if expression: ${error.message}`));
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
else if (statement.startsWith('include ')) {
|
|
291
|
+
// {% include "path" %}
|
|
292
|
+
const includeMatch = /^include\s+["']([^"']+)["']/.exec(statement);
|
|
293
|
+
if (includeMatch) {
|
|
294
|
+
ast.push({
|
|
295
|
+
type: 'include',
|
|
296
|
+
path: includeMatch[1],
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
errors.push(createError('Invalid include syntax'));
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
else if (statement.startsWith('switch ')) {
|
|
304
|
+
// {% switch variable %} ... {% case "value" %} ... {% endswitch %}
|
|
305
|
+
const switchExpr = statement.substring(7).trim();
|
|
306
|
+
try {
|
|
307
|
+
const expr = parseExpression(switchExpr);
|
|
308
|
+
const { cases, parseErrors } = parseSwitchBlock();
|
|
309
|
+
errors.push(...parseErrors);
|
|
310
|
+
ast.push({
|
|
311
|
+
type: 'switch',
|
|
312
|
+
expression: expr,
|
|
313
|
+
cases,
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
catch (error) {
|
|
317
|
+
errors.push(createError(`Invalid switch expression: ${error.message}`));
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
else if (statement.startsWith('leveloffset ')) {
|
|
321
|
+
// {% leveloffset +1 %} or {% leveloffset 2 %} or {% leveloffset -1 %}
|
|
322
|
+
const offsetMatch = /^leveloffset\s+([-+]?\d+)$/.exec(statement);
|
|
323
|
+
if (!offsetMatch) {
|
|
324
|
+
errors.push(createError('Invalid leveloffset syntax'));
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
const offsetStr = offsetMatch[1];
|
|
328
|
+
const isRelative = offsetStr.startsWith('+') || offsetStr.startsWith('-');
|
|
329
|
+
const offset = parseInt(offsetStr, 10);
|
|
330
|
+
if (isNaN(offset)) {
|
|
331
|
+
errors.push(createError('Invalid leveloffset value'));
|
|
332
|
+
}
|
|
333
|
+
else {
|
|
334
|
+
// Find matching endleveloffset accounting for nesting
|
|
335
|
+
let depth = 0;
|
|
336
|
+
let searchPos = position;
|
|
337
|
+
let endPos = -1;
|
|
338
|
+
while (searchPos < template.length) {
|
|
339
|
+
const leveloffsetMatch = /{%-?\s*leveloffset\s+[-+]?\d+\s*-?%}/.exec(template.substring(searchPos));
|
|
340
|
+
const endleveloffsetMatch = /{%-?\s*endleveloffset\s*-?%}/.exec(template.substring(searchPos));
|
|
341
|
+
const leveloffsetPos = leveloffsetMatch ? searchPos + leveloffsetMatch.index : Infinity;
|
|
342
|
+
const endleveloffsetPos = endleveloffsetMatch ? searchPos + endleveloffsetMatch.index : Infinity;
|
|
343
|
+
if (leveloffsetPos < endleveloffsetPos) {
|
|
344
|
+
// Found nested leveloffset
|
|
345
|
+
depth++;
|
|
346
|
+
searchPos = leveloffsetPos + (leveloffsetMatch?.[0].length || 0);
|
|
347
|
+
}
|
|
348
|
+
else if (endleveloffsetPos < Infinity) {
|
|
349
|
+
// Found endleveloffset
|
|
350
|
+
if (depth === 0) {
|
|
351
|
+
// This is our matching endleveloffset
|
|
352
|
+
endPos = endleveloffsetPos;
|
|
353
|
+
break;
|
|
354
|
+
}
|
|
355
|
+
else {
|
|
356
|
+
depth--;
|
|
357
|
+
searchPos = endleveloffsetPos + (endleveloffsetMatch?.[0].length || 0);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
else {
|
|
361
|
+
// No more tags found
|
|
362
|
+
break;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
if (endPos === -1) {
|
|
366
|
+
errors.push(createError('Missing endleveloffset'));
|
|
367
|
+
}
|
|
368
|
+
else {
|
|
369
|
+
const bodyTemplate = extractTo(endPos);
|
|
370
|
+
// Find and skip the endleveloffset tag
|
|
371
|
+
const endMatch = /{%-?\s*endleveloffset\s*-?%}/.exec(template.substring(position));
|
|
372
|
+
if (endMatch) {
|
|
373
|
+
advance(endMatch[0].length);
|
|
374
|
+
}
|
|
375
|
+
const bodyResult = parse(bodyTemplate);
|
|
376
|
+
errors.push(...bodyResult.errors);
|
|
377
|
+
ast.push({
|
|
378
|
+
type: 'leveloffset',
|
|
379
|
+
offset,
|
|
380
|
+
isRelative,
|
|
381
|
+
body: bodyResult.ast,
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
// Ignore endif, endswitch, case, endleveloffset, etc. - they're handled by their opening tags
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
return { ast, errors };
|
|
391
|
+
/**
|
|
392
|
+
* Find an end tag like {% endif %}
|
|
393
|
+
*/
|
|
394
|
+
function findEndTag(tagName) {
|
|
395
|
+
// `-?` on BOTH sides: without it this could not match `{%- endif %}`, so an
|
|
396
|
+
// `{% else %}` branch closed with a whitespace-controlled endif failed to
|
|
397
|
+
// parse at all — the page threw "Missing endif after else" and the build
|
|
398
|
+
// preprocessor copied it through UNRENDERED, variables and directives and
|
|
399
|
+
// all. Three OpenShift pages were shipping that way.
|
|
400
|
+
const pattern = new RegExp(`{%-?\\s*${tagName}\\s*-?%}`);
|
|
401
|
+
const match = pattern.exec(template.substring(position));
|
|
402
|
+
if (match) {
|
|
403
|
+
return {
|
|
404
|
+
start: position + match.index,
|
|
405
|
+
length: match[0].length,
|
|
406
|
+
tag: match[0],
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
return null;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Parse an if block with elif and else support
|
|
413
|
+
*/
|
|
414
|
+
function parseIfBlock() {
|
|
415
|
+
const elifBranches = [];
|
|
416
|
+
const parseErrors = [];
|
|
417
|
+
let elseBranch = [];
|
|
418
|
+
// Find the next elif, else, or endif
|
|
419
|
+
let depth = 0;
|
|
420
|
+
let searchPos = position;
|
|
421
|
+
while (searchPos < template.length) {
|
|
422
|
+
const ifMatch = /{%-?\s*if\s+/.exec(template.substring(searchPos));
|
|
423
|
+
const elifMatch = /{%-?\s*elif\s+/.exec(template.substring(searchPos));
|
|
424
|
+
const elseMatch = /{%-?\s*else\s*-?%}/.exec(template.substring(searchPos));
|
|
425
|
+
const endifMatch = /{%-?\s*endif\s*-?%}/.exec(template.substring(searchPos));
|
|
426
|
+
// Find the nearest match
|
|
427
|
+
const matches = [
|
|
428
|
+
{ type: 'if', match: ifMatch, pos: ifMatch ? searchPos + ifMatch.index : Infinity },
|
|
429
|
+
{ type: 'elif', match: elifMatch, pos: elifMatch ? searchPos + elifMatch.index : Infinity },
|
|
430
|
+
{ type: 'else', match: elseMatch, pos: elseMatch ? searchPos + elseMatch.index : Infinity },
|
|
431
|
+
{ type: 'endif', match: endifMatch, pos: endifMatch ? searchPos + endifMatch.index : Infinity },
|
|
432
|
+
].sort((a, b) => a.pos - b.pos);
|
|
433
|
+
const nearest = matches[0];
|
|
434
|
+
if (!nearest.match || nearest.pos === Infinity) {
|
|
435
|
+
parseErrors.push(createError('Missing endif'));
|
|
436
|
+
break;
|
|
437
|
+
}
|
|
438
|
+
if (nearest.type === 'if') {
|
|
439
|
+
depth++;
|
|
440
|
+
searchPos = nearest.pos + nearest.match[0].length;
|
|
441
|
+
}
|
|
442
|
+
else if (nearest.type === 'endif') {
|
|
443
|
+
if (depth === 0) {
|
|
444
|
+
// This is our endif
|
|
445
|
+
const bodyTemplate = stripBodyForEndTag(extractTo(nearest.pos), nearest.match[0]);
|
|
446
|
+
advance(nearest.match[0].length);
|
|
447
|
+
if (nearest.match[0].endsWith('-%}')) {
|
|
448
|
+
while (position < template.length && /[ \t\n]/.test(template[position]))
|
|
449
|
+
advance(1);
|
|
450
|
+
}
|
|
451
|
+
const bodyResult = parse(bodyTemplate);
|
|
452
|
+
parseErrors.push(...bodyResult.errors);
|
|
453
|
+
return {
|
|
454
|
+
trueBranch: bodyResult.ast,
|
|
455
|
+
elifBranches,
|
|
456
|
+
elseBranch,
|
|
457
|
+
parseErrors,
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
else {
|
|
461
|
+
depth--;
|
|
462
|
+
searchPos = nearest.pos + nearest.match[0].length;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
else if (depth === 0 && (nearest.type === 'elif' || nearest.type === 'else')) {
|
|
466
|
+
// Parse the body before elif/else
|
|
467
|
+
const bodyTemplate = stripBodyForEndTag(extractTo(nearest.pos), nearest.match[0]);
|
|
468
|
+
const bodyResult = parse(bodyTemplate);
|
|
469
|
+
if (elifBranches.length === 0 && elseBranch.length === 0) {
|
|
470
|
+
// This is the trueBranch (before first elif/else)
|
|
471
|
+
parseErrors.push(...bodyResult.errors);
|
|
472
|
+
const trueBranch = bodyResult.ast;
|
|
473
|
+
// Now handle elif or else
|
|
474
|
+
if (nearest.type === 'elif') {
|
|
475
|
+
// Extract elif condition
|
|
476
|
+
advance(nearest.match[0].length);
|
|
477
|
+
const condMatch = /^([^%]+)%}/.exec(template.substring(position));
|
|
478
|
+
if (condMatch) {
|
|
479
|
+
const condStr = condMatch[1].trim();
|
|
480
|
+
advance(condMatch[0].length);
|
|
481
|
+
try {
|
|
482
|
+
const elifCondition = parseExpression(condStr);
|
|
483
|
+
const elifResult = parseIfBlock();
|
|
484
|
+
parseErrors.push(...elifResult.parseErrors);
|
|
485
|
+
elifBranches.push({
|
|
486
|
+
condition: elifCondition,
|
|
487
|
+
body: elifResult.trueBranch,
|
|
488
|
+
});
|
|
489
|
+
elifBranches.push(...(elifResult.elifBranches || []));
|
|
490
|
+
elseBranch = elifResult.elseBranch;
|
|
491
|
+
return {
|
|
492
|
+
trueBranch,
|
|
493
|
+
elifBranches,
|
|
494
|
+
elseBranch,
|
|
495
|
+
parseErrors,
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
catch (error) {
|
|
499
|
+
parseErrors.push(createError(`Invalid elif expression: ${error.message}`));
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
else {
|
|
504
|
+
// else
|
|
505
|
+
advance(nearest.match[0].length);
|
|
506
|
+
// Find endif for else block
|
|
507
|
+
const endifMatch = findEndTag('endif');
|
|
508
|
+
if (!endifMatch) {
|
|
509
|
+
parseErrors.push(createError('Missing endif after else'));
|
|
510
|
+
}
|
|
511
|
+
else {
|
|
512
|
+
const elseBodyTemplate = stripBodyForEndTag(extractTo(endifMatch.start), endifMatch.tag);
|
|
513
|
+
advance(endifMatch.length);
|
|
514
|
+
const elseBodyResult = parse(elseBodyTemplate);
|
|
515
|
+
parseErrors.push(...elseBodyResult.errors);
|
|
516
|
+
elseBranch = elseBodyResult.ast;
|
|
517
|
+
}
|
|
518
|
+
return {
|
|
519
|
+
trueBranch,
|
|
520
|
+
elifBranches,
|
|
521
|
+
elseBranch,
|
|
522
|
+
parseErrors,
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
else {
|
|
528
|
+
searchPos = nearest.pos + nearest.match[0].length;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
return {
|
|
532
|
+
trueBranch: [],
|
|
533
|
+
elifBranches,
|
|
534
|
+
elseBranch,
|
|
535
|
+
parseErrors,
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* Parse a switch block with case support
|
|
540
|
+
*/
|
|
541
|
+
function parseSwitchBlock() {
|
|
542
|
+
const cases = [];
|
|
543
|
+
const parseErrors = [];
|
|
544
|
+
while (position < template.length) {
|
|
545
|
+
// Find the next case or endswitch
|
|
546
|
+
const caseMatch = /{%-?\s*case\s+/.exec(template.substring(position));
|
|
547
|
+
const endswitchMatch = /{%-?\s*endswitch\s*-?%}/.exec(template.substring(position));
|
|
548
|
+
// Find which comes first
|
|
549
|
+
const casePos = caseMatch ? position + caseMatch.index : Infinity;
|
|
550
|
+
const endswitchPos = endswitchMatch ? position + endswitchMatch.index : Infinity;
|
|
551
|
+
if (endswitchPos < casePos) {
|
|
552
|
+
// Found endswitch before any case (or no case)
|
|
553
|
+
// Parse any remaining content before endswitch as the last case body
|
|
554
|
+
if (cases.length > 0 && position < endswitchPos) {
|
|
555
|
+
const bodyTemplate = extractTo(endswitchPos);
|
|
556
|
+
const bodyResult = parse(bodyTemplate);
|
|
557
|
+
parseErrors.push(...bodyResult.errors);
|
|
558
|
+
cases[cases.length - 1].body = bodyResult.ast;
|
|
559
|
+
}
|
|
560
|
+
// Skip endswitch
|
|
561
|
+
advance(endswitchPos - position + (endswitchMatch?.[0].length || 0));
|
|
562
|
+
break;
|
|
563
|
+
}
|
|
564
|
+
else if (casePos < Infinity) {
|
|
565
|
+
// Found a case
|
|
566
|
+
// If there's a previous case, parse its body
|
|
567
|
+
if (cases.length > 0 && position < casePos) {
|
|
568
|
+
const bodyTemplate = extractTo(casePos);
|
|
569
|
+
const bodyResult = parse(bodyTemplate);
|
|
570
|
+
parseErrors.push(...bodyResult.errors);
|
|
571
|
+
cases[cases.length - 1].body = bodyResult.ast;
|
|
572
|
+
}
|
|
573
|
+
else if (position < casePos) {
|
|
574
|
+
// Content before first case - skip it
|
|
575
|
+
extractTo(casePos);
|
|
576
|
+
}
|
|
577
|
+
// Parse the case value
|
|
578
|
+
advance(caseMatch[0].length);
|
|
579
|
+
// Extract the case value (until %})
|
|
580
|
+
const valueMatch = /([^%]+)%}/.exec(template.substring(position));
|
|
581
|
+
if (valueMatch) {
|
|
582
|
+
const valueStr = valueMatch[1].trim();
|
|
583
|
+
advance(valueMatch[0].length);
|
|
584
|
+
try {
|
|
585
|
+
const caseValue = parseExpression(valueStr);
|
|
586
|
+
cases.push({
|
|
587
|
+
value: caseValue,
|
|
588
|
+
body: [], // Will be filled in next iteration or at endswitch
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
catch (error) {
|
|
592
|
+
parseErrors.push(createError(`Invalid case value: ${error.message}`));
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
else {
|
|
596
|
+
parseErrors.push(createError('Invalid case syntax'));
|
|
597
|
+
break;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
else {
|
|
601
|
+
// No case or endswitch found
|
|
602
|
+
parseErrors.push(createError('Missing endswitch'));
|
|
603
|
+
break;
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
return { cases, parseErrors };
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
//# sourceMappingURL=parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../src/parser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAEhD;;;;;;GAMG;AACH,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC;IACjC,KAAK;IACL,IAAI;IACJ,SAAS;IACT,QAAQ;IACR,aAAa;IACb,KAAK;IACL,OAAO;IACP,MAAM;IACN,MAAM;IACN,WAAW;IACX,MAAM;IACN,gBAAgB;IAChB,QAAQ;CACT,CAAC,CAAA;AAEF;;;;GAIG;AACH;;;;;;;;;;;;;;;;;;G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U,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;oBAE7B,IAAI,CAAC;wBACH,MAAM,SAAS,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAA;wBAC3C,KAAK,CAAC,IAAI,CAAC;4BACT,KAAK,EAAE,SAAS;4BAChB,IAAI,EAAE,EAAE,EAAE,mDAAmD;yBAC9D,CAAC,CAAA;oBACJ,CAAC;oBAAC,OAAO,KAAK,EAAE,CAAC;wBACf,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,uBAAwB,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;oBAClF,CAAC;gBACH,CAAC;qBAAM,CAAC;oBACN,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC,CAAA;oBACpD,MAAK;gBACP,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,6BAA6B;gBAC7B,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC,CAAA;gBAClD,MAAK;YACP,CAAC;QACH,CAAC;QAED,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,CAAA;IAC/B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template renderer
|
|
3
|
+
* Combines parser, evaluator, and loader to render templates
|
|
4
|
+
*/
|
|
5
|
+
import type { RenderOptions } from './types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Render a template string
|
|
8
|
+
* @param template - Template string to render
|
|
9
|
+
* @param options - Render options
|
|
10
|
+
* @returns Rendered output
|
|
11
|
+
*/
|
|
12
|
+
export declare function render(template: string, options?: RenderOptions): Promise<string>;
|
|
13
|
+
//# sourceMappingURL=renderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../src/renderer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAuB,aAAa,EAAU,MAAM,YAAY,CAAA;AAoG5E;;;;;GAKG;AACH,wBAAsB,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAsC3F"}
|