@wdprlib/render 0.1.0
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/index.cjs +4701 -0
- package/dist/index.d.cts +73 -0
- package/dist/index.d.ts +73 -0
- package/dist/index.js +4668 -0
- package/package.json +44 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,4668 @@
|
|
|
1
|
+
// packages/render/src/escape.ts
|
|
2
|
+
function escapeHtml(text) {
|
|
3
|
+
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
4
|
+
}
|
|
5
|
+
function escapeAttr(value) {
|
|
6
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
7
|
+
}
|
|
8
|
+
function escapeStyleContent(css) {
|
|
9
|
+
return css.replace(/<\/style/gi, "<\\/style");
|
|
10
|
+
}
|
|
11
|
+
var SAFE_ATTRIBUTES = new Set([
|
|
12
|
+
"accept",
|
|
13
|
+
"align",
|
|
14
|
+
"alt",
|
|
15
|
+
"autocapitalize",
|
|
16
|
+
"autoplay",
|
|
17
|
+
"background",
|
|
18
|
+
"bgcolor",
|
|
19
|
+
"border",
|
|
20
|
+
"buffered",
|
|
21
|
+
"checked",
|
|
22
|
+
"cite",
|
|
23
|
+
"class",
|
|
24
|
+
"cols",
|
|
25
|
+
"colspan",
|
|
26
|
+
"contenteditable",
|
|
27
|
+
"controls",
|
|
28
|
+
"coords",
|
|
29
|
+
"datetime",
|
|
30
|
+
"decoding",
|
|
31
|
+
"default",
|
|
32
|
+
"dir",
|
|
33
|
+
"dirname",
|
|
34
|
+
"disabled",
|
|
35
|
+
"download",
|
|
36
|
+
"draggable",
|
|
37
|
+
"for",
|
|
38
|
+
"form",
|
|
39
|
+
"headers",
|
|
40
|
+
"height",
|
|
41
|
+
"hidden",
|
|
42
|
+
"high",
|
|
43
|
+
"href",
|
|
44
|
+
"hreflang",
|
|
45
|
+
"id",
|
|
46
|
+
"inputmode",
|
|
47
|
+
"ismap",
|
|
48
|
+
"itemprop",
|
|
49
|
+
"kind",
|
|
50
|
+
"label",
|
|
51
|
+
"lang",
|
|
52
|
+
"list",
|
|
53
|
+
"loop",
|
|
54
|
+
"low",
|
|
55
|
+
"max",
|
|
56
|
+
"maxlength",
|
|
57
|
+
"min",
|
|
58
|
+
"minlength",
|
|
59
|
+
"multiple",
|
|
60
|
+
"muted",
|
|
61
|
+
"name",
|
|
62
|
+
"optimum",
|
|
63
|
+
"pattern",
|
|
64
|
+
"placeholder",
|
|
65
|
+
"poster",
|
|
66
|
+
"preload",
|
|
67
|
+
"readonly",
|
|
68
|
+
"required",
|
|
69
|
+
"reversed",
|
|
70
|
+
"role",
|
|
71
|
+
"rows",
|
|
72
|
+
"rowspan",
|
|
73
|
+
"scope",
|
|
74
|
+
"selected",
|
|
75
|
+
"shape",
|
|
76
|
+
"size",
|
|
77
|
+
"sizes",
|
|
78
|
+
"span",
|
|
79
|
+
"spellcheck",
|
|
80
|
+
"src",
|
|
81
|
+
"srclang",
|
|
82
|
+
"srcset",
|
|
83
|
+
"start",
|
|
84
|
+
"step",
|
|
85
|
+
"style",
|
|
86
|
+
"tabindex",
|
|
87
|
+
"target",
|
|
88
|
+
"title",
|
|
89
|
+
"translate",
|
|
90
|
+
"type",
|
|
91
|
+
"usemap",
|
|
92
|
+
"value",
|
|
93
|
+
"width",
|
|
94
|
+
"wrap"
|
|
95
|
+
]);
|
|
96
|
+
function isSafeAttribute(name) {
|
|
97
|
+
const lower = name.toLowerCase();
|
|
98
|
+
if (lower.startsWith("on"))
|
|
99
|
+
return false;
|
|
100
|
+
if (lower.startsWith("aria-") || lower.startsWith("data-"))
|
|
101
|
+
return true;
|
|
102
|
+
return SAFE_ATTRIBUTES.has(lower);
|
|
103
|
+
}
|
|
104
|
+
function isDangerousUrl(value) {
|
|
105
|
+
const normalized = value.replace(/[\s\u0000-\u001f\u007f-\u009f]/g, "");
|
|
106
|
+
return /^(javascript|data|vbscript):/i.test(normalized);
|
|
107
|
+
}
|
|
108
|
+
var CSS_NAMED_COLORS = new Set([
|
|
109
|
+
"aliceblue",
|
|
110
|
+
"antiquewhite",
|
|
111
|
+
"aqua",
|
|
112
|
+
"aquamarine",
|
|
113
|
+
"azure",
|
|
114
|
+
"beige",
|
|
115
|
+
"bisque",
|
|
116
|
+
"black",
|
|
117
|
+
"blanchedalmond",
|
|
118
|
+
"blue",
|
|
119
|
+
"blueviolet",
|
|
120
|
+
"brown",
|
|
121
|
+
"burlywood",
|
|
122
|
+
"cadetblue",
|
|
123
|
+
"chartreuse",
|
|
124
|
+
"chocolate",
|
|
125
|
+
"coral",
|
|
126
|
+
"cornflowerblue",
|
|
127
|
+
"cornsilk",
|
|
128
|
+
"crimson",
|
|
129
|
+
"cyan",
|
|
130
|
+
"darkblue",
|
|
131
|
+
"darkcyan",
|
|
132
|
+
"darkgoldenrod",
|
|
133
|
+
"darkgray",
|
|
134
|
+
"darkgreen",
|
|
135
|
+
"darkgrey",
|
|
136
|
+
"darkkhaki",
|
|
137
|
+
"darkmagenta",
|
|
138
|
+
"darkolivegreen",
|
|
139
|
+
"darkorange",
|
|
140
|
+
"darkorchid",
|
|
141
|
+
"darkred",
|
|
142
|
+
"darksalmon",
|
|
143
|
+
"darkseagreen",
|
|
144
|
+
"darkslateblue",
|
|
145
|
+
"darkslategray",
|
|
146
|
+
"darkslategrey",
|
|
147
|
+
"darkturquoise",
|
|
148
|
+
"darkviolet",
|
|
149
|
+
"deeppink",
|
|
150
|
+
"deepskyblue",
|
|
151
|
+
"dimgray",
|
|
152
|
+
"dimgrey",
|
|
153
|
+
"dodgerblue",
|
|
154
|
+
"firebrick",
|
|
155
|
+
"floralwhite",
|
|
156
|
+
"forestgreen",
|
|
157
|
+
"fuchsia",
|
|
158
|
+
"gainsboro",
|
|
159
|
+
"ghostwhite",
|
|
160
|
+
"gold",
|
|
161
|
+
"goldenrod",
|
|
162
|
+
"gray",
|
|
163
|
+
"green",
|
|
164
|
+
"greenyellow",
|
|
165
|
+
"grey",
|
|
166
|
+
"honeydew",
|
|
167
|
+
"hotpink",
|
|
168
|
+
"indianred",
|
|
169
|
+
"indigo",
|
|
170
|
+
"ivory",
|
|
171
|
+
"khaki",
|
|
172
|
+
"lavender",
|
|
173
|
+
"lavenderblush",
|
|
174
|
+
"lawngreen",
|
|
175
|
+
"lemonchiffon",
|
|
176
|
+
"lightblue",
|
|
177
|
+
"lightcoral",
|
|
178
|
+
"lightcyan",
|
|
179
|
+
"lightgoldenrodyellow",
|
|
180
|
+
"lightgray",
|
|
181
|
+
"lightgreen",
|
|
182
|
+
"lightgrey",
|
|
183
|
+
"lightpink",
|
|
184
|
+
"lightsalmon",
|
|
185
|
+
"lightseagreen",
|
|
186
|
+
"lightskyblue",
|
|
187
|
+
"lightslategray",
|
|
188
|
+
"lightslategrey",
|
|
189
|
+
"lightsteelblue",
|
|
190
|
+
"lightyellow",
|
|
191
|
+
"lime",
|
|
192
|
+
"limegreen",
|
|
193
|
+
"linen",
|
|
194
|
+
"magenta",
|
|
195
|
+
"maroon",
|
|
196
|
+
"mediumaquamarine",
|
|
197
|
+
"mediumblue",
|
|
198
|
+
"mediumorchid",
|
|
199
|
+
"mediumpurple",
|
|
200
|
+
"mediumseagreen",
|
|
201
|
+
"mediumslateblue",
|
|
202
|
+
"mediumspringgreen",
|
|
203
|
+
"mediumturquoise",
|
|
204
|
+
"mediumvioletred",
|
|
205
|
+
"midnightblue",
|
|
206
|
+
"mintcream",
|
|
207
|
+
"mistyrose",
|
|
208
|
+
"moccasin",
|
|
209
|
+
"navajowhite",
|
|
210
|
+
"navy",
|
|
211
|
+
"oldlace",
|
|
212
|
+
"olive",
|
|
213
|
+
"olivedrab",
|
|
214
|
+
"orange",
|
|
215
|
+
"orangered",
|
|
216
|
+
"orchid",
|
|
217
|
+
"palegoldenrod",
|
|
218
|
+
"palegreen",
|
|
219
|
+
"paleturquoise",
|
|
220
|
+
"palevioletred",
|
|
221
|
+
"papayawhip",
|
|
222
|
+
"peachpuff",
|
|
223
|
+
"peru",
|
|
224
|
+
"pink",
|
|
225
|
+
"plum",
|
|
226
|
+
"powderblue",
|
|
227
|
+
"purple",
|
|
228
|
+
"rebeccapurple",
|
|
229
|
+
"red",
|
|
230
|
+
"rosybrown",
|
|
231
|
+
"royalblue",
|
|
232
|
+
"saddlebrown",
|
|
233
|
+
"salmon",
|
|
234
|
+
"sandybrown",
|
|
235
|
+
"seagreen",
|
|
236
|
+
"seashell",
|
|
237
|
+
"sienna",
|
|
238
|
+
"silver",
|
|
239
|
+
"skyblue",
|
|
240
|
+
"slateblue",
|
|
241
|
+
"slategray",
|
|
242
|
+
"slategrey",
|
|
243
|
+
"snow",
|
|
244
|
+
"springgreen",
|
|
245
|
+
"steelblue",
|
|
246
|
+
"tan",
|
|
247
|
+
"teal",
|
|
248
|
+
"thistle",
|
|
249
|
+
"tomato",
|
|
250
|
+
"turquoise",
|
|
251
|
+
"violet",
|
|
252
|
+
"wheat",
|
|
253
|
+
"white",
|
|
254
|
+
"whitesmoke",
|
|
255
|
+
"yellow",
|
|
256
|
+
"yellowgreen",
|
|
257
|
+
"transparent",
|
|
258
|
+
"currentcolor",
|
|
259
|
+
"inherit",
|
|
260
|
+
"initial",
|
|
261
|
+
"unset"
|
|
262
|
+
]);
|
|
263
|
+
function isValidCssColor(color) {
|
|
264
|
+
const trimmed = color.trim().toLowerCase();
|
|
265
|
+
if (!trimmed)
|
|
266
|
+
return false;
|
|
267
|
+
if (CSS_NAMED_COLORS.has(trimmed))
|
|
268
|
+
return true;
|
|
269
|
+
if (/^#[0-9a-f]{3}([0-9a-f])?$/.test(trimmed) || /^#[0-9a-f]{6}([0-9a-f]{2})?$/.test(trimmed)) {
|
|
270
|
+
return true;
|
|
271
|
+
}
|
|
272
|
+
if (/^rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(,\s*(0|1|0?\.\d+))?\s*\)$/.test(trimmed)) {
|
|
273
|
+
return true;
|
|
274
|
+
}
|
|
275
|
+
if (/^hsla?\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*(,\s*(0|1|0?\.\d+))?\s*\)$/.test(trimmed)) {
|
|
276
|
+
return true;
|
|
277
|
+
}
|
|
278
|
+
return false;
|
|
279
|
+
}
|
|
280
|
+
function sanitizeCssColor(color, fallback = "inherit") {
|
|
281
|
+
return isValidCssColor(color) ? color : fallback;
|
|
282
|
+
}
|
|
283
|
+
function normalizeCssValue(value) {
|
|
284
|
+
let result = value;
|
|
285
|
+
result = result.replace(/\/\*[\s\S]*?\*\//g, "");
|
|
286
|
+
result = result.replace(/\\(?:\r\n|[\n\r\f])/g, "");
|
|
287
|
+
result = result.replace(/\\([0-9a-f]{1,6})\s?/gi, (_, hex) => {
|
|
288
|
+
const code = Number.parseInt(hex, 16);
|
|
289
|
+
return code > 0 && code <= 1114111 ? String.fromCodePoint(code) : "";
|
|
290
|
+
});
|
|
291
|
+
result = result.replace(/\\(.)/g, "$1");
|
|
292
|
+
result = result.replace(/[\s\u0000-\u001f\u007f-\u009f]/g, "");
|
|
293
|
+
return result.toLowerCase();
|
|
294
|
+
}
|
|
295
|
+
function isDangerousCssValue(value) {
|
|
296
|
+
const normalized = normalizeCssValue(value);
|
|
297
|
+
if (normalized.includes("url("))
|
|
298
|
+
return true;
|
|
299
|
+
if (normalized.includes("expression("))
|
|
300
|
+
return true;
|
|
301
|
+
if (normalized.includes("-moz-binding"))
|
|
302
|
+
return true;
|
|
303
|
+
if (normalized.includes("behavior:"))
|
|
304
|
+
return true;
|
|
305
|
+
if (normalized.includes("@import"))
|
|
306
|
+
return true;
|
|
307
|
+
return false;
|
|
308
|
+
}
|
|
309
|
+
function sanitizeStyleValue(style) {
|
|
310
|
+
const endsWithSemicolon = style.trimEnd().endsWith(";");
|
|
311
|
+
const declarations = style.split(";").map((d) => d.trim()).filter(Boolean);
|
|
312
|
+
const safe = [];
|
|
313
|
+
for (const decl of declarations) {
|
|
314
|
+
const colonIdx = decl.indexOf(":");
|
|
315
|
+
if (colonIdx === -1)
|
|
316
|
+
continue;
|
|
317
|
+
const property = decl.slice(0, colonIdx).trim().toLowerCase();
|
|
318
|
+
const value = decl.slice(colonIdx + 1).trim();
|
|
319
|
+
if (isDangerousCssValue(value))
|
|
320
|
+
continue;
|
|
321
|
+
if (property.startsWith("-moz-binding"))
|
|
322
|
+
continue;
|
|
323
|
+
if (property === "behavior")
|
|
324
|
+
continue;
|
|
325
|
+
safe.push(decl);
|
|
326
|
+
}
|
|
327
|
+
if (safe.length === 0)
|
|
328
|
+
return "";
|
|
329
|
+
return endsWithSemicolon ? safe.join(";") + ";" : safe.join(";");
|
|
330
|
+
}
|
|
331
|
+
function isValidEmail(email) {
|
|
332
|
+
return /^[a-zA-Z0-9._+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(email);
|
|
333
|
+
}
|
|
334
|
+
var URL_ATTRIBUTES = new Set([
|
|
335
|
+
"href",
|
|
336
|
+
"src",
|
|
337
|
+
"action",
|
|
338
|
+
"formaction",
|
|
339
|
+
"srcset",
|
|
340
|
+
"poster",
|
|
341
|
+
"background"
|
|
342
|
+
]);
|
|
343
|
+
function sanitizeAttributes(attributes) {
|
|
344
|
+
const result = {};
|
|
345
|
+
for (const [key, value] of Object.entries(attributes)) {
|
|
346
|
+
if (!isSafeAttribute(key))
|
|
347
|
+
continue;
|
|
348
|
+
const lower = key.toLowerCase();
|
|
349
|
+
if (URL_ATTRIBUTES.has(lower) && isDangerousUrl(value))
|
|
350
|
+
continue;
|
|
351
|
+
if (lower === "style") {
|
|
352
|
+
const sanitized = sanitizeStyleValue(value);
|
|
353
|
+
if (sanitized) {
|
|
354
|
+
result[key] = sanitized;
|
|
355
|
+
}
|
|
356
|
+
continue;
|
|
357
|
+
}
|
|
358
|
+
result[key] = value;
|
|
359
|
+
}
|
|
360
|
+
return result;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
// packages/render/src/context.ts
|
|
364
|
+
class RenderContext {
|
|
365
|
+
chunks = [];
|
|
366
|
+
_tocIndex = 0;
|
|
367
|
+
_footnoteIndex = 0;
|
|
368
|
+
_equationIndex = 0;
|
|
369
|
+
_htmlBlockIndex = 0;
|
|
370
|
+
options;
|
|
371
|
+
footnotes;
|
|
372
|
+
styles;
|
|
373
|
+
htmlBlocks;
|
|
374
|
+
tocElements;
|
|
375
|
+
constructor(tree, options = {}) {
|
|
376
|
+
this.options = options;
|
|
377
|
+
this.footnotes = options.footnotes ?? tree.footnotes ?? [];
|
|
378
|
+
this.styles = tree.styles ?? [];
|
|
379
|
+
this.htmlBlocks = tree["html-blocks"] ?? [];
|
|
380
|
+
this.tocElements = tree["table-of-contents"] ?? [];
|
|
381
|
+
}
|
|
382
|
+
push(html) {
|
|
383
|
+
this.chunks.push(html);
|
|
384
|
+
}
|
|
385
|
+
pushEscaped(text) {
|
|
386
|
+
this.chunks.push(escapeHtml(text));
|
|
387
|
+
}
|
|
388
|
+
getOutput() {
|
|
389
|
+
return this.chunks.join("");
|
|
390
|
+
}
|
|
391
|
+
nextTocIndex() {
|
|
392
|
+
return this._tocIndex++;
|
|
393
|
+
}
|
|
394
|
+
nextFootnoteIndex() {
|
|
395
|
+
return this._footnoteIndex++;
|
|
396
|
+
}
|
|
397
|
+
nextEquationIndex() {
|
|
398
|
+
return this._equationIndex++;
|
|
399
|
+
}
|
|
400
|
+
nextHtmlBlockIndex() {
|
|
401
|
+
return this._htmlBlockIndex++;
|
|
402
|
+
}
|
|
403
|
+
get page() {
|
|
404
|
+
return this.options.page;
|
|
405
|
+
}
|
|
406
|
+
resolveImageSource(source) {
|
|
407
|
+
switch (source.type) {
|
|
408
|
+
case "url":
|
|
409
|
+
return source.data;
|
|
410
|
+
case "file1":
|
|
411
|
+
return `/local--files/${source.data.file}`;
|
|
412
|
+
case "file2":
|
|
413
|
+
return `/local--files/${source.data.page}/${source.data.file}`;
|
|
414
|
+
case "file3":
|
|
415
|
+
return `/local--files/${source.data.site}/${source.data.page}/${source.data.file}`;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
resolvePageLink(location) {
|
|
419
|
+
if (typeof location === "string") {
|
|
420
|
+
return location;
|
|
421
|
+
}
|
|
422
|
+
if (location.site) {
|
|
423
|
+
return `https://${location.site}.wikidot.com/${location.page}`;
|
|
424
|
+
}
|
|
425
|
+
return `/${location.page}`;
|
|
426
|
+
}
|
|
427
|
+
renderAttributes(attributes) {
|
|
428
|
+
const safe = sanitizeAttributes(attributes);
|
|
429
|
+
let result = "";
|
|
430
|
+
for (const [key, value] of Object.entries(safe)) {
|
|
431
|
+
if (value !== "") {
|
|
432
|
+
result += ` ${key}="${escapeAttr(value)}"`;
|
|
433
|
+
} else {
|
|
434
|
+
result += ` ${key}=""`;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
return result;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
// packages/render/src/elements/container.ts
|
|
442
|
+
import { isStringContainerType, isHeaderType, isAlignType } from "@wdprlib/ast";
|
|
443
|
+
function renderContainer(ctx, data) {
|
|
444
|
+
const { type, attributes, elements } = data;
|
|
445
|
+
if (isHeaderType(type)) {
|
|
446
|
+
renderHeader(ctx, type.header.level, type.header["has-toc"], attributes, elements);
|
|
447
|
+
return;
|
|
448
|
+
}
|
|
449
|
+
if (isAlignType(type)) {
|
|
450
|
+
ctx.push(`<div style="text-align: ${type.align};">`);
|
|
451
|
+
renderElements(ctx, elements);
|
|
452
|
+
ctx.push("</div>");
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
if (isStringContainerType(type)) {
|
|
456
|
+
renderStringContainer(ctx, type, attributes, elements);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
function renderHeader(ctx, level, hasToc, attributes, elements) {
|
|
460
|
+
const tag = `h${level}`;
|
|
461
|
+
if (hasToc) {
|
|
462
|
+
const tocId = ctx.nextTocIndex();
|
|
463
|
+
ctx.push(`<${tag} id="toc${tocId}"${renderAttrs(attributes)}>`);
|
|
464
|
+
} else {
|
|
465
|
+
ctx.push(`<${tag}${renderAttrs(attributes)}>`);
|
|
466
|
+
}
|
|
467
|
+
ctx.push("<span>");
|
|
468
|
+
renderElements(ctx, elements);
|
|
469
|
+
ctx.push("</span>");
|
|
470
|
+
ctx.push(`</${tag}>`);
|
|
471
|
+
}
|
|
472
|
+
function renderStringContainer(ctx, type, attributes, elements) {
|
|
473
|
+
switch (type) {
|
|
474
|
+
case "paragraph":
|
|
475
|
+
ctx.push(`<p${renderAttrs(attributes)}>`);
|
|
476
|
+
renderElements(ctx, elements);
|
|
477
|
+
ctx.push("</p>");
|
|
478
|
+
break;
|
|
479
|
+
case "bold":
|
|
480
|
+
ctx.push(`<strong${renderAttrs(attributes)}>`);
|
|
481
|
+
renderElements(ctx, elements);
|
|
482
|
+
ctx.push("</strong>");
|
|
483
|
+
break;
|
|
484
|
+
case "italics":
|
|
485
|
+
ctx.push(`<em${renderAttrs(attributes)}>`);
|
|
486
|
+
renderElements(ctx, elements);
|
|
487
|
+
ctx.push("</em>");
|
|
488
|
+
break;
|
|
489
|
+
case "underline":
|
|
490
|
+
ctx.push(`<span style="text-decoration: underline;"${renderAttrs(attributes)}>`);
|
|
491
|
+
renderElements(ctx, elements);
|
|
492
|
+
ctx.push("</span>");
|
|
493
|
+
break;
|
|
494
|
+
case "strikethrough":
|
|
495
|
+
ctx.push(`<span style="text-decoration: line-through;"${renderAttrs(attributes)}>`);
|
|
496
|
+
renderElements(ctx, elements);
|
|
497
|
+
ctx.push("</span>");
|
|
498
|
+
break;
|
|
499
|
+
case "superscript":
|
|
500
|
+
ctx.push(`<sup${renderAttrs(attributes)}>`);
|
|
501
|
+
renderElements(ctx, elements);
|
|
502
|
+
ctx.push("</sup>");
|
|
503
|
+
break;
|
|
504
|
+
case "subscript":
|
|
505
|
+
ctx.push(`<sub${renderAttrs(attributes)}>`);
|
|
506
|
+
renderElements(ctx, elements);
|
|
507
|
+
ctx.push("</sub>");
|
|
508
|
+
break;
|
|
509
|
+
case "monospace":
|
|
510
|
+
ctx.push(`<tt${renderAttrs(attributes)}>`);
|
|
511
|
+
renderElements(ctx, elements);
|
|
512
|
+
ctx.push("</tt>");
|
|
513
|
+
break;
|
|
514
|
+
case "span":
|
|
515
|
+
ctx.push(`<span${renderAttrs(attributes)}>`);
|
|
516
|
+
renderElements(ctx, elements);
|
|
517
|
+
ctx.push("</span>");
|
|
518
|
+
break;
|
|
519
|
+
case "div":
|
|
520
|
+
ctx.push(`<div${renderAttrs(attributes)}>`);
|
|
521
|
+
renderElements(ctx, elements);
|
|
522
|
+
ctx.push("</div>");
|
|
523
|
+
break;
|
|
524
|
+
case "blockquote":
|
|
525
|
+
ctx.push(`<blockquote${renderAttrs(attributes)}>`);
|
|
526
|
+
renderElements(ctx, elements);
|
|
527
|
+
ctx.push("</blockquote>");
|
|
528
|
+
break;
|
|
529
|
+
case "mark":
|
|
530
|
+
ctx.push(`<mark${renderAttrs(attributes)}>`);
|
|
531
|
+
renderElements(ctx, elements);
|
|
532
|
+
ctx.push("</mark>");
|
|
533
|
+
break;
|
|
534
|
+
case "insertion":
|
|
535
|
+
ctx.push(`<ins${renderAttrs(attributes)}>`);
|
|
536
|
+
renderElements(ctx, elements);
|
|
537
|
+
ctx.push("</ins>");
|
|
538
|
+
break;
|
|
539
|
+
case "deletion":
|
|
540
|
+
ctx.push(`<del${renderAttrs(attributes)}>`);
|
|
541
|
+
renderElements(ctx, elements);
|
|
542
|
+
ctx.push("</del>");
|
|
543
|
+
break;
|
|
544
|
+
case "size":
|
|
545
|
+
renderSizeContainer(ctx, attributes, elements);
|
|
546
|
+
break;
|
|
547
|
+
case "hidden":
|
|
548
|
+
ctx.push(`<span style="display: none"${renderAttrs(attributes)}>`);
|
|
549
|
+
renderElements(ctx, elements);
|
|
550
|
+
ctx.push("</span>");
|
|
551
|
+
break;
|
|
552
|
+
case "invisible":
|
|
553
|
+
ctx.push(`<span style="visibility: hidden"${renderAttrs(attributes)}>`);
|
|
554
|
+
renderElements(ctx, elements);
|
|
555
|
+
ctx.push("</span>");
|
|
556
|
+
break;
|
|
557
|
+
case "ruby":
|
|
558
|
+
ctx.push(`<ruby${renderAttrs(attributes)}>`);
|
|
559
|
+
renderElements(ctx, elements);
|
|
560
|
+
ctx.push("</ruby>");
|
|
561
|
+
break;
|
|
562
|
+
case "ruby-text":
|
|
563
|
+
ctx.push(`<rt${renderAttrs(attributes)}>`);
|
|
564
|
+
renderElements(ctx, elements);
|
|
565
|
+
ctx.push("</rt>");
|
|
566
|
+
break;
|
|
567
|
+
case "heading":
|
|
568
|
+
renderElements(ctx, elements);
|
|
569
|
+
break;
|
|
570
|
+
case "collapsible":
|
|
571
|
+
renderElements(ctx, elements);
|
|
572
|
+
break;
|
|
573
|
+
case "definition-list":
|
|
574
|
+
ctx.push("<dl>");
|
|
575
|
+
renderElements(ctx, elements);
|
|
576
|
+
ctx.push("</dl>");
|
|
577
|
+
break;
|
|
578
|
+
case "definition-list-item":
|
|
579
|
+
renderElements(ctx, elements);
|
|
580
|
+
break;
|
|
581
|
+
case "definition-list-key":
|
|
582
|
+
ctx.push("<dt>");
|
|
583
|
+
renderElements(ctx, elements);
|
|
584
|
+
ctx.push("</dt>");
|
|
585
|
+
break;
|
|
586
|
+
case "definition-list-value":
|
|
587
|
+
ctx.push("<dd>");
|
|
588
|
+
renderElements(ctx, elements);
|
|
589
|
+
ctx.push("</dd>");
|
|
590
|
+
break;
|
|
591
|
+
case "table-row":
|
|
592
|
+
ctx.push(`<tr${renderAttrs(attributes)}>`);
|
|
593
|
+
renderElements(ctx, elements);
|
|
594
|
+
ctx.push("</tr>");
|
|
595
|
+
break;
|
|
596
|
+
case "table-cell":
|
|
597
|
+
ctx.push(`<td${renderAttrs(attributes)}>`);
|
|
598
|
+
renderElements(ctx, elements);
|
|
599
|
+
ctx.push("</td>");
|
|
600
|
+
break;
|
|
601
|
+
default:
|
|
602
|
+
renderElements(ctx, elements);
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
function renderSizeContainer(ctx, attributes, elements) {
|
|
606
|
+
const style = attributes.style ?? "";
|
|
607
|
+
const existingAttrs = { ...attributes };
|
|
608
|
+
if (!style.includes("font-size")) {
|
|
609
|
+
ctx.push(`<span${renderAttrs(existingAttrs)}>`);
|
|
610
|
+
} else {
|
|
611
|
+
ctx.push(`<span${renderAttrs(existingAttrs)}>`);
|
|
612
|
+
}
|
|
613
|
+
renderElements(ctx, elements);
|
|
614
|
+
ctx.push("</span>");
|
|
615
|
+
}
|
|
616
|
+
function renderAttrs(attributes) {
|
|
617
|
+
const safe = sanitizeAttributes(attributes);
|
|
618
|
+
let result = "";
|
|
619
|
+
for (const [key, value] of Object.entries(safe)) {
|
|
620
|
+
if (key.startsWith("_"))
|
|
621
|
+
continue;
|
|
622
|
+
if (value !== "") {
|
|
623
|
+
result += ` ${key}="${escapeAttr(value)}"`;
|
|
624
|
+
} else {
|
|
625
|
+
result += ` ${key}=""`;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
return result;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
// packages/render/src/elements/text.ts
|
|
632
|
+
function renderText(ctx, data) {
|
|
633
|
+
ctx.pushEscaped(data);
|
|
634
|
+
}
|
|
635
|
+
function renderRaw(ctx, data) {
|
|
636
|
+
if (data === "")
|
|
637
|
+
return;
|
|
638
|
+
ctx.push(`<span style="white-space: pre-wrap;">`);
|
|
639
|
+
ctx.push(escapeHtml(data));
|
|
640
|
+
ctx.push("</span>");
|
|
641
|
+
}
|
|
642
|
+
function renderEmail(ctx, email) {
|
|
643
|
+
if (!isValidEmail(email)) {
|
|
644
|
+
ctx.pushEscaped(email);
|
|
645
|
+
return;
|
|
646
|
+
}
|
|
647
|
+
ctx.push(`<a href="mailto:${escapeAttr(email)}">${escapeHtml(email)}</a>`);
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
// packages/render/src/elements/link.ts
|
|
651
|
+
function renderLink(ctx, data) {
|
|
652
|
+
let href = ctx.resolvePageLink(data.link);
|
|
653
|
+
if (data.extra) {
|
|
654
|
+
href += data.extra;
|
|
655
|
+
}
|
|
656
|
+
const isAnchorJsVoid = data.type === "anchor" && href === "javascript:;";
|
|
657
|
+
if (!isAnchorJsVoid && isDangerousUrl(href)) {
|
|
658
|
+
href = "#invalid-url";
|
|
659
|
+
}
|
|
660
|
+
const attrs = [`href="${escapeAttr(href)}"`];
|
|
661
|
+
if (data.target) {
|
|
662
|
+
const targetMap = {
|
|
663
|
+
"new-tab": "_blank",
|
|
664
|
+
parent: "_parent",
|
|
665
|
+
top: "_top",
|
|
666
|
+
same: "_self"
|
|
667
|
+
};
|
|
668
|
+
const targetValue = targetMap[data.target] ?? "_blank";
|
|
669
|
+
attrs.push(`target="${targetValue}"`);
|
|
670
|
+
if (targetValue === "_blank") {
|
|
671
|
+
attrs.push(`rel="noopener noreferrer"`);
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
ctx.push(`<a ${attrs.join(" ")}>`);
|
|
675
|
+
renderLinkLabel(ctx, data);
|
|
676
|
+
ctx.push("</a>");
|
|
677
|
+
}
|
|
678
|
+
function renderLinkLabel(ctx, data) {
|
|
679
|
+
if (data.label === "page") {
|
|
680
|
+
if (typeof data.link === "string") {
|
|
681
|
+
ctx.pushEscaped(data.link);
|
|
682
|
+
} else {
|
|
683
|
+
ctx.pushEscaped(data.link.page);
|
|
684
|
+
}
|
|
685
|
+
return;
|
|
686
|
+
}
|
|
687
|
+
if ("text" in data.label) {
|
|
688
|
+
ctx.pushEscaped(data.label.text);
|
|
689
|
+
return;
|
|
690
|
+
}
|
|
691
|
+
if ("url" in data.label) {
|
|
692
|
+
const href = ctx.resolvePageLink(data.link);
|
|
693
|
+
ctx.pushEscaped(data.label.url ?? href);
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
function renderAnchor(ctx, data) {
|
|
697
|
+
const safe = sanitizeAttributes(data.attributes);
|
|
698
|
+
const attrs = [];
|
|
699
|
+
if (safe.href && isDangerousUrl(safe.href)) {
|
|
700
|
+
safe.href = "#invalid-url";
|
|
701
|
+
}
|
|
702
|
+
const href = safe.href ?? "";
|
|
703
|
+
attrs.push(`href="${escapeAttr(href)}"`);
|
|
704
|
+
if (data.target) {
|
|
705
|
+
const targetMap = {
|
|
706
|
+
"new-tab": "_blank",
|
|
707
|
+
parent: "_parent",
|
|
708
|
+
top: "_top",
|
|
709
|
+
same: "_self"
|
|
710
|
+
};
|
|
711
|
+
const targetValue = targetMap[data.target] ?? "_blank";
|
|
712
|
+
attrs.push(`target="${targetValue}"`);
|
|
713
|
+
if (targetValue === "_blank") {
|
|
714
|
+
attrs.push(`rel="noopener noreferrer"`);
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
for (const [key, value] of Object.entries(safe)) {
|
|
718
|
+
if (key === "href" || key === "target")
|
|
719
|
+
continue;
|
|
720
|
+
attrs.push(`${key}="${escapeAttr(value)}"`);
|
|
721
|
+
}
|
|
722
|
+
ctx.push(`<a ${attrs.join(" ")}>`);
|
|
723
|
+
renderElements(ctx, data.elements);
|
|
724
|
+
ctx.push("</a>");
|
|
725
|
+
}
|
|
726
|
+
function renderAnchorName(ctx, name) {
|
|
727
|
+
ctx.push(`<a name="${escapeAttr(name)}"></a>`);
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
// packages/render/src/elements/image.ts
|
|
731
|
+
function renderImage(ctx, data) {
|
|
732
|
+
let src = ctx.resolveImageSource(data.source);
|
|
733
|
+
if (isDangerousUrl(src)) {
|
|
734
|
+
src = "#invalid-url";
|
|
735
|
+
}
|
|
736
|
+
const safeAttrs = sanitizeAttributes(data.attributes);
|
|
737
|
+
const alt = safeAttrs.alt ?? getFilenameFromSource(data.source);
|
|
738
|
+
const className = safeAttrs.class ?? "image";
|
|
739
|
+
const imgAttrs = [`src="${escapeAttr(src)}"`];
|
|
740
|
+
for (const [key, value] of Object.entries(safeAttrs)) {
|
|
741
|
+
if (key === "alt" || key === "class" || key === "src" || key === "srcset")
|
|
742
|
+
continue;
|
|
743
|
+
imgAttrs.push(`${key}="${escapeAttr(value)}"`);
|
|
744
|
+
}
|
|
745
|
+
imgAttrs.push(`alt="${escapeAttr(alt)}"`);
|
|
746
|
+
if (!safeAttrs.class) {
|
|
747
|
+
imgAttrs.push(`class="${escapeAttr(className)}"`);
|
|
748
|
+
} else {
|
|
749
|
+
imgAttrs.push(`class="${escapeAttr(safeAttrs.class)}"`);
|
|
750
|
+
}
|
|
751
|
+
const imgTag = `<img ${imgAttrs.join(" ")} />`;
|
|
752
|
+
let output = imgTag;
|
|
753
|
+
if (data.link) {
|
|
754
|
+
let href = typeof data.link === "string" ? data.link : `/${data.link.page}`;
|
|
755
|
+
if (isDangerousUrl(href)) {
|
|
756
|
+
href = "#invalid-url";
|
|
757
|
+
}
|
|
758
|
+
output = `<a href="${escapeAttr(href)}">${imgTag}</a>`;
|
|
759
|
+
}
|
|
760
|
+
if (data.alignment) {
|
|
761
|
+
const alignClass = getAlignmentClass(data.alignment.align, data.alignment.float);
|
|
762
|
+
ctx.push(`<div class="image-container ${alignClass}">`);
|
|
763
|
+
ctx.push(output);
|
|
764
|
+
ctx.push("</div>");
|
|
765
|
+
} else {
|
|
766
|
+
ctx.push(output);
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
function getAlignmentClass(align, isFloat) {
|
|
770
|
+
if (isFloat) {
|
|
771
|
+
return align === "left" ? "floatleft" : "floatright";
|
|
772
|
+
}
|
|
773
|
+
switch (align) {
|
|
774
|
+
case "left":
|
|
775
|
+
return "alignleft";
|
|
776
|
+
case "right":
|
|
777
|
+
return "alignright";
|
|
778
|
+
case "center":
|
|
779
|
+
return "aligncenter";
|
|
780
|
+
default:
|
|
781
|
+
return `align${align}`;
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
function getFilenameFromSource(source) {
|
|
785
|
+
switch (source.type) {
|
|
786
|
+
case "url": {
|
|
787
|
+
const parts = source.data.split("/");
|
|
788
|
+
return parts[parts.length - 1] ?? source.data;
|
|
789
|
+
}
|
|
790
|
+
case "file1":
|
|
791
|
+
return source.data.file;
|
|
792
|
+
case "file2":
|
|
793
|
+
return source.data.file;
|
|
794
|
+
case "file3":
|
|
795
|
+
return source.data.file;
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
// packages/render/src/elements/list.ts
|
|
800
|
+
function renderList(ctx, data) {
|
|
801
|
+
const tag = data.type === "numbered" ? "ol" : "ul";
|
|
802
|
+
ctx.push(`<${tag}${renderListAttrs(data.attributes)}>`);
|
|
803
|
+
const items = data.items;
|
|
804
|
+
let i = 0;
|
|
805
|
+
while (i < items.length) {
|
|
806
|
+
const item = items[i];
|
|
807
|
+
if (item["item-type"] === "elements") {
|
|
808
|
+
ctx.push(`<li${renderListAttrs(item.attributes)}>`);
|
|
809
|
+
renderElements(ctx, item.elements);
|
|
810
|
+
while (i + 1 < items.length && items[i + 1]["item-type"] === "sub-list") {
|
|
811
|
+
i++;
|
|
812
|
+
const subItem = items[i];
|
|
813
|
+
renderList(ctx, subItem.data);
|
|
814
|
+
}
|
|
815
|
+
ctx.push("</li>");
|
|
816
|
+
} else {
|
|
817
|
+
const subItem = item;
|
|
818
|
+
ctx.push(`<li style="list-style: none; display: inline">`);
|
|
819
|
+
renderList(ctx, subItem.data);
|
|
820
|
+
ctx.push("</li>");
|
|
821
|
+
}
|
|
822
|
+
i++;
|
|
823
|
+
}
|
|
824
|
+
ctx.push(`</${tag}>`);
|
|
825
|
+
}
|
|
826
|
+
function renderListAttrs(attributes) {
|
|
827
|
+
const safe = sanitizeAttributes(attributes);
|
|
828
|
+
let result = "";
|
|
829
|
+
for (const [key, value] of Object.entries(safe)) {
|
|
830
|
+
if (key.startsWith("_"))
|
|
831
|
+
continue;
|
|
832
|
+
result += ` ${key}="${escapeAttr(value)}"`;
|
|
833
|
+
}
|
|
834
|
+
return result;
|
|
835
|
+
}
|
|
836
|
+
function renderDefinitionList(ctx, items) {
|
|
837
|
+
ctx.push("<dl>");
|
|
838
|
+
for (const item of items) {
|
|
839
|
+
ctx.push("<dt>");
|
|
840
|
+
renderElements(ctx, item.key);
|
|
841
|
+
ctx.push("</dt>");
|
|
842
|
+
ctx.push("<dd>");
|
|
843
|
+
renderElements(ctx, item.value);
|
|
844
|
+
ctx.push("</dd>");
|
|
845
|
+
}
|
|
846
|
+
ctx.push("</dl>");
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
// packages/render/src/elements/table.ts
|
|
850
|
+
function renderTable(ctx, data) {
|
|
851
|
+
const isPipeTable = data.attributes._source === "pipe";
|
|
852
|
+
const classAttr = isPipeTable ? ' class="wiki-content-table"' : "";
|
|
853
|
+
ctx.push(`<table${classAttr}${renderTableAttrs(data.attributes)}>`);
|
|
854
|
+
for (const row of data.rows) {
|
|
855
|
+
ctx.push(`<tr${renderTableAttrs(row.attributes)}>`);
|
|
856
|
+
for (const cell of row.cells) {
|
|
857
|
+
const tag = cell.header ? "th" : "td";
|
|
858
|
+
const attrs = [];
|
|
859
|
+
const safeCellAttrs = sanitizeAttributes(cell.attributes);
|
|
860
|
+
if (cell["column-span"] > 1) {
|
|
861
|
+
attrs.push(`colspan="${cell["column-span"]}"`);
|
|
862
|
+
}
|
|
863
|
+
if (safeCellAttrs.rowspan) {
|
|
864
|
+
const rowspan = parseInt(safeCellAttrs.rowspan, 10);
|
|
865
|
+
if (rowspan > 1) {
|
|
866
|
+
attrs.push(`rowspan="${rowspan}"`);
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
if (cell.align) {
|
|
870
|
+
const existingStyle = safeCellAttrs.style ?? "";
|
|
871
|
+
const alignStyle = `text-align: ${cell.align};`;
|
|
872
|
+
if (existingStyle) {
|
|
873
|
+
attrs.push(`style="${escapeAttr(existingStyle + "; " + alignStyle)}"`);
|
|
874
|
+
} else {
|
|
875
|
+
attrs.push(`style="${alignStyle}"`);
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
for (const [key, value] of Object.entries(safeCellAttrs)) {
|
|
879
|
+
if (key === "style" && cell.align)
|
|
880
|
+
continue;
|
|
881
|
+
if (key === "rowspan")
|
|
882
|
+
continue;
|
|
883
|
+
attrs.push(`${key}="${escapeAttr(value)}"`);
|
|
884
|
+
}
|
|
885
|
+
const attrStr = attrs.length > 0 ? " " + attrs.join(" ") : "";
|
|
886
|
+
ctx.push(`<${tag}${attrStr}>`);
|
|
887
|
+
renderElements(ctx, cell.elements);
|
|
888
|
+
ctx.push(`</${tag}>`);
|
|
889
|
+
}
|
|
890
|
+
ctx.push("</tr>");
|
|
891
|
+
}
|
|
892
|
+
ctx.push("</table>");
|
|
893
|
+
}
|
|
894
|
+
function renderTableAttrs(attributes) {
|
|
895
|
+
const safe = sanitizeAttributes(attributes);
|
|
896
|
+
let result = "";
|
|
897
|
+
for (const [key, value] of Object.entries(safe)) {
|
|
898
|
+
if (key.startsWith("_"))
|
|
899
|
+
continue;
|
|
900
|
+
result += ` ${key}="${escapeAttr(value)}"`;
|
|
901
|
+
}
|
|
902
|
+
return result;
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
// packages/render/src/elements/collapsible.ts
|
|
906
|
+
function renderCollapsible(ctx, data) {
|
|
907
|
+
const startOpen = data["start-open"];
|
|
908
|
+
const showTop = data["show-top"];
|
|
909
|
+
const showBottom = data["show-bottom"];
|
|
910
|
+
const showLabel = data["show-text"] ? formatLabelText(data["show-text"]) : formatCollapsibleText("+", "show block");
|
|
911
|
+
const hideLabel = data["hide-text"] ? formatLabelText(data["hide-text"]) : formatCollapsibleText("–", "hide block");
|
|
912
|
+
ctx.push(`<div class="collapsible-block">`);
|
|
913
|
+
const foldedStyle = startOpen ? ` style="display:none"` : "";
|
|
914
|
+
ctx.push(`<div class="collapsible-block-folded"${foldedStyle}>`);
|
|
915
|
+
ctx.push(`<a class="collapsible-block-link" href="javascript:;">${showLabel}</a>`);
|
|
916
|
+
ctx.push("</div>");
|
|
917
|
+
const unfoldedStyle = startOpen ? "" : ` style="display:none"`;
|
|
918
|
+
ctx.push(`<div class="collapsible-block-unfolded"${unfoldedStyle}>`);
|
|
919
|
+
if (showTop || !showTop && !showBottom) {
|
|
920
|
+
ctx.push(`<div class="collapsible-block-unfolded-link">`);
|
|
921
|
+
ctx.push(`<a class="collapsible-block-link" href="javascript:;">${hideLabel}</a>`);
|
|
922
|
+
ctx.push("</div>");
|
|
923
|
+
}
|
|
924
|
+
ctx.push(`<div class="collapsible-block-content">`);
|
|
925
|
+
renderElements(ctx, data.elements);
|
|
926
|
+
ctx.push("</div>");
|
|
927
|
+
if (showBottom) {
|
|
928
|
+
ctx.push(`<div class="collapsible-block-unfolded-link">`);
|
|
929
|
+
ctx.push(`<a class="collapsible-block-link" href="javascript:;">${hideLabel}</a>`);
|
|
930
|
+
ctx.push("</div>");
|
|
931
|
+
}
|
|
932
|
+
ctx.push("</div>");
|
|
933
|
+
ctx.push("</div>");
|
|
934
|
+
}
|
|
935
|
+
function formatCollapsibleText(prefix, text) {
|
|
936
|
+
const encoded = escapeHtml(text).replace(/ /g, " ");
|
|
937
|
+
return `${prefix} ${encoded}`;
|
|
938
|
+
}
|
|
939
|
+
function formatLabelText(text) {
|
|
940
|
+
return escapeHtml(text).replace(/ /g, " ");
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
// packages/render/src/libs/highlighter/engine.ts
|
|
944
|
+
function tokenize(def, input) {
|
|
945
|
+
let str = input.replace(/\r\n/g, `
|
|
946
|
+
`);
|
|
947
|
+
str = str.replace(/^$/gm, " ");
|
|
948
|
+
str = str.replace(/\t/g, " ");
|
|
949
|
+
str = str.replace(/\s+$/, "");
|
|
950
|
+
const len = str.length;
|
|
951
|
+
if (len === 0)
|
|
952
|
+
return [];
|
|
953
|
+
let state = -1;
|
|
954
|
+
let pos = 0;
|
|
955
|
+
let lastinner = def.defClass;
|
|
956
|
+
let lastdelim = def.defClass;
|
|
957
|
+
let endpattern = null;
|
|
958
|
+
const stateStack = [];
|
|
959
|
+
const tokenStack = [];
|
|
960
|
+
const result = [];
|
|
961
|
+
function getToken() {
|
|
962
|
+
if (tokenStack.length > 0) {
|
|
963
|
+
return tokenStack.pop();
|
|
964
|
+
}
|
|
965
|
+
if (pos >= len) {
|
|
966
|
+
return null;
|
|
967
|
+
}
|
|
968
|
+
let endpos = -1;
|
|
969
|
+
let endmatch = "";
|
|
970
|
+
if (state !== -1 && endpattern) {
|
|
971
|
+
endpattern.lastIndex = pos;
|
|
972
|
+
const em = endpattern.exec(str);
|
|
973
|
+
if (em) {
|
|
974
|
+
endpos = em.index;
|
|
975
|
+
endmatch = em[0];
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
const reg = def.regs[state];
|
|
979
|
+
if (reg) {
|
|
980
|
+
reg.lastIndex = pos;
|
|
981
|
+
const m = reg.exec(str);
|
|
982
|
+
if (m) {
|
|
983
|
+
const countsArr = def.counts[state];
|
|
984
|
+
const statesArr = def.states[state];
|
|
985
|
+
const delimArr = def.delim[state];
|
|
986
|
+
const innerArr = def.inner[state];
|
|
987
|
+
let n = 1;
|
|
988
|
+
for (let i = 0;i < countsArr.length; i++) {
|
|
989
|
+
const count = countsArr[i];
|
|
990
|
+
if (n >= m.length)
|
|
991
|
+
break;
|
|
992
|
+
if (m[n] != null && (endpos === -1 || m.index < endpos)) {
|
|
993
|
+
const matchStart = m.index;
|
|
994
|
+
const matchStr = m[n];
|
|
995
|
+
const groupStart = findGroupPosition(str, m, n, matchStart);
|
|
996
|
+
if (statesArr[i] !== -1) {
|
|
997
|
+
tokenStack.push({ class: delimArr[i], content: matchStr });
|
|
998
|
+
} else {
|
|
999
|
+
let inner = innerArr[i];
|
|
1000
|
+
const partDef = def.parts[state]?.[i];
|
|
1001
|
+
if (partDef) {
|
|
1002
|
+
const parts = [];
|
|
1003
|
+
let partpos = groupStart;
|
|
1004
|
+
for (let j = 1;j <= count; j++) {
|
|
1005
|
+
const subIdx = j + n;
|
|
1006
|
+
if (subIdx >= m.length || m[subIdx] == null || m[subIdx] === "")
|
|
1007
|
+
continue;
|
|
1008
|
+
const subStr = m[subIdx];
|
|
1009
|
+
const subStart = str.indexOf(subStr, partpos);
|
|
1010
|
+
if (subStart < 0)
|
|
1011
|
+
continue;
|
|
1012
|
+
if (partDef[j]) {
|
|
1013
|
+
if (subStart > partpos) {
|
|
1014
|
+
parts.unshift({ class: inner, content: str.substring(partpos, subStart) });
|
|
1015
|
+
}
|
|
1016
|
+
parts.unshift({ class: partDef[j], content: subStr });
|
|
1017
|
+
}
|
|
1018
|
+
partpos = subStart + subStr.length;
|
|
1019
|
+
}
|
|
1020
|
+
if (partpos < groupStart + matchStr.length) {
|
|
1021
|
+
parts.unshift({
|
|
1022
|
+
class: inner,
|
|
1023
|
+
content: str.substring(partpos, groupStart + matchStr.length)
|
|
1024
|
+
});
|
|
1025
|
+
}
|
|
1026
|
+
tokenStack.push(...parts);
|
|
1027
|
+
} else {
|
|
1028
|
+
let kwDef = def.keywords[state]?.[i];
|
|
1029
|
+
if (!kwDef || kwDef === -1 || typeof kwDef !== "object" || Object.keys(kwDef).length === 0) {
|
|
1030
|
+
kwDef = def.keywords[-1]?.[i];
|
|
1031
|
+
}
|
|
1032
|
+
if (kwDef && kwDef !== -1 && typeof kwDef === "object") {
|
|
1033
|
+
for (const [group, re] of Object.entries(kwDef)) {
|
|
1034
|
+
if (re.test(matchStr)) {
|
|
1035
|
+
inner = def.kwmap[group] ?? inner;
|
|
1036
|
+
break;
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
tokenStack.push({ class: inner, content: matchStr });
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
if (groupStart > pos) {
|
|
1044
|
+
tokenStack.push({ class: lastinner, content: str.substring(pos, groupStart) });
|
|
1045
|
+
}
|
|
1046
|
+
pos = groupStart + matchStr.length;
|
|
1047
|
+
if (statesArr[i] !== -1) {
|
|
1048
|
+
stateStack.push({ state, lastdelim, lastinner, endpattern });
|
|
1049
|
+
lastinner = innerArr[i];
|
|
1050
|
+
lastdelim = delimArr[i];
|
|
1051
|
+
const prevState = state;
|
|
1052
|
+
state = statesArr[i];
|
|
1053
|
+
const endRe = def.end[state];
|
|
1054
|
+
if (def.subst[prevState]?.[i] && endRe) {
|
|
1055
|
+
let epSource = endRe.source;
|
|
1056
|
+
for (let k = 0;k <= count; k++) {
|
|
1057
|
+
const subIdx = n + k;
|
|
1058
|
+
if (subIdx >= m.length || m[subIdx] == null)
|
|
1059
|
+
break;
|
|
1060
|
+
const quoted = escapeRegex(m[subIdx]);
|
|
1061
|
+
epSource = epSource.replace(`%${k}%`, quoted);
|
|
1062
|
+
epSource = epSource.replace(`%b${k}%`, matchingBrackets(quoted));
|
|
1063
|
+
}
|
|
1064
|
+
endpattern = new RegExp(epSource, endRe.flags);
|
|
1065
|
+
} else {
|
|
1066
|
+
endpattern = endRe ?? null;
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
return tokenStack.pop();
|
|
1070
|
+
}
|
|
1071
|
+
n += count + 1;
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
if (endpos > -1) {
|
|
1076
|
+
tokenStack.push({ class: lastdelim, content: endmatch });
|
|
1077
|
+
if (endpos > pos) {
|
|
1078
|
+
tokenStack.push({ class: lastinner, content: str.substring(pos, endpos) });
|
|
1079
|
+
}
|
|
1080
|
+
const prev = stateStack.pop();
|
|
1081
|
+
state = prev.state;
|
|
1082
|
+
lastdelim = prev.lastdelim;
|
|
1083
|
+
lastinner = prev.lastinner;
|
|
1084
|
+
endpattern = prev.endpattern;
|
|
1085
|
+
pos = endpos + endmatch.length;
|
|
1086
|
+
if (tokenStack.length > 0) {
|
|
1087
|
+
return tokenStack.pop();
|
|
1088
|
+
}
|
|
1089
|
+
return getToken();
|
|
1090
|
+
}
|
|
1091
|
+
const p = pos;
|
|
1092
|
+
pos = len;
|
|
1093
|
+
return { class: lastinner, content: str.substring(p) };
|
|
1094
|
+
}
|
|
1095
|
+
let token;
|
|
1096
|
+
while ((token = getToken()) !== null) {
|
|
1097
|
+
result.push(token);
|
|
1098
|
+
}
|
|
1099
|
+
return result;
|
|
1100
|
+
}
|
|
1101
|
+
function findGroupPosition(str, m, n, matchStart) {
|
|
1102
|
+
const groupStr = m[n];
|
|
1103
|
+
const idx = str.indexOf(groupStr, matchStart);
|
|
1104
|
+
return idx >= 0 ? idx : matchStart;
|
|
1105
|
+
}
|
|
1106
|
+
function renderTokens(tokens) {
|
|
1107
|
+
if (tokens.length === 0)
|
|
1108
|
+
return "";
|
|
1109
|
+
let html = "";
|
|
1110
|
+
let lastClass = "";
|
|
1111
|
+
for (const token of tokens) {
|
|
1112
|
+
if (token.content.length === 0)
|
|
1113
|
+
continue;
|
|
1114
|
+
const escaped = escapeHtml2(token.content);
|
|
1115
|
+
if (token.class !== lastClass) {
|
|
1116
|
+
if (lastClass) {
|
|
1117
|
+
html += "</span>";
|
|
1118
|
+
}
|
|
1119
|
+
html += `<span class="hl-${token.class}">`;
|
|
1120
|
+
lastClass = token.class;
|
|
1121
|
+
}
|
|
1122
|
+
html += escaped;
|
|
1123
|
+
}
|
|
1124
|
+
if (lastClass) {
|
|
1125
|
+
html += "</span>";
|
|
1126
|
+
}
|
|
1127
|
+
return `<div class="hl-main"><pre>${html}</pre></div>`;
|
|
1128
|
+
}
|
|
1129
|
+
function escapeHtml2(str) {
|
|
1130
|
+
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
1131
|
+
}
|
|
1132
|
+
function escapeRegex(str) {
|
|
1133
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1134
|
+
}
|
|
1135
|
+
function matchingBrackets(str) {
|
|
1136
|
+
return str.replace(/[()<>[\]{}]/g, (c) => {
|
|
1137
|
+
const map = {
|
|
1138
|
+
"(": ")",
|
|
1139
|
+
")": "(",
|
|
1140
|
+
"<": ">",
|
|
1141
|
+
">": "<",
|
|
1142
|
+
"[": "]",
|
|
1143
|
+
"]": "[",
|
|
1144
|
+
"{": "}",
|
|
1145
|
+
"}": "{"
|
|
1146
|
+
};
|
|
1147
|
+
return map[c] ?? c;
|
|
1148
|
+
});
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
// packages/render/src/libs/highlighter/languages/css.ts
|
|
1152
|
+
var cssLang = {
|
|
1153
|
+
language: "css",
|
|
1154
|
+
defClass: "code",
|
|
1155
|
+
regs: {
|
|
1156
|
+
[-1]: /((@[a-z\d]+))|((((\.|#)?[a-z]+[a-z\d-]*(?![a-z\d-]))|(\*))(?!\s*:\s*[\s{]))|(:[a-z][a-z\d-]*)|(\[)|(\{)/gi,
|
|
1157
|
+
0: /(\d*\.?\d+(%|em|ex|pc|pt|px|in|mm|cm))|(\d*\.?\d+)|([a-z][a-z\d-]*)|(#([\da-f]{6}|[\da-f]{3})\b)/gi,
|
|
1158
|
+
1: /(')|(")|([\w\-:]+)/gi,
|
|
1159
|
+
2: /([a-z][a-z\d-]*\s*:)|((((\.|#)?[a-z]+[a-z\d-]*(?![a-z\d-]))|(\*))(?!\s*:\s*[\s{]))|(\{)/gi,
|
|
1160
|
+
3: /(\\[\\(\\)\\])/gi,
|
|
1161
|
+
4: /(\\\\|\\"|\\'|\\`)/gi,
|
|
1162
|
+
5: /(\\\\|\\"|\\'|\\`|\\t|\\n|\\r)/gi
|
|
1163
|
+
},
|
|
1164
|
+
counts: {
|
|
1165
|
+
[-1]: [1, 4, 0, 0, 0],
|
|
1166
|
+
0: [1, 0, 0, 1],
|
|
1167
|
+
1: [0, 0, 0],
|
|
1168
|
+
2: [0, 4, 0],
|
|
1169
|
+
3: [0],
|
|
1170
|
+
4: [0],
|
|
1171
|
+
5: [0]
|
|
1172
|
+
},
|
|
1173
|
+
delim: {
|
|
1174
|
+
[-1]: ["", "", "", "brackets", "brackets"],
|
|
1175
|
+
0: ["", "", "", ""],
|
|
1176
|
+
1: ["quotes", "quotes", ""],
|
|
1177
|
+
2: ["reserved", "", "brackets"],
|
|
1178
|
+
3: [""],
|
|
1179
|
+
4: [""],
|
|
1180
|
+
5: [""]
|
|
1181
|
+
},
|
|
1182
|
+
inner: {
|
|
1183
|
+
[-1]: ["var", "identifier", "special", "code", "code"],
|
|
1184
|
+
0: ["number", "number", "code", "var"],
|
|
1185
|
+
1: ["string", "string", "var"],
|
|
1186
|
+
2: ["code", "identifier", "code"],
|
|
1187
|
+
3: ["string"],
|
|
1188
|
+
4: ["special"],
|
|
1189
|
+
5: ["special"]
|
|
1190
|
+
},
|
|
1191
|
+
end: {
|
|
1192
|
+
0: /(?=;|\})/gi,
|
|
1193
|
+
1: /\]/gi,
|
|
1194
|
+
2: /\}/gi,
|
|
1195
|
+
3: /\)/gi,
|
|
1196
|
+
4: /'/gi,
|
|
1197
|
+
5: /"/gi
|
|
1198
|
+
},
|
|
1199
|
+
states: {
|
|
1200
|
+
[-1]: [-1, -1, -1, 1, 2],
|
|
1201
|
+
0: [-1, -1, -1, -1],
|
|
1202
|
+
1: [4, 5, -1],
|
|
1203
|
+
2: [0, -1, 2],
|
|
1204
|
+
3: [-1],
|
|
1205
|
+
4: [-1],
|
|
1206
|
+
5: [-1]
|
|
1207
|
+
},
|
|
1208
|
+
keywords: {
|
|
1209
|
+
[-1]: [{}, {}, {}, -1, -1],
|
|
1210
|
+
0: [
|
|
1211
|
+
{},
|
|
1212
|
+
{},
|
|
1213
|
+
{
|
|
1214
|
+
propertyValue: /^(?:far-left|left|center-left|center-right|center|far-right|right-side|right|behind|leftwards|rightwards|inherit|scroll|fixed|transparent|none|repeat-x|repeat-y|repeat|no-repeat|collapse|separate|auto|top|bottom|both|open-quote|close-quote|no-open-quote|no-close-quote|crosshair|default|pointer|move|e-resize|ne-resize|nw-resize|n-resize|se-resize|sw-resize|s-resize|text|wait|help|ltr|rtl|inline|block|list-item|run-in|compact|marker|table|inline-table|table-row-group|table-header-group|table-footer-group|table-row|table-column-group|table-column|table-cell|table-caption|below|level|above|higher|lower|show|hide|caption|icon|menu|message-box|small-caption|status-bar|normal|wider|narrower|ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded|italic|oblique|small-caps|bold|bolder|lighter|inside|outside|disc|circle|square|decimal|decimal-leading-zero|lower-roman|upper-roman|lower-greek|lower-alpha|lower-latin|upper-alpha|upper-latin|hebrew|armenian|georgian|cjk-ideographic|hiragana|katakana|hiragana-iroha|katakana-iroha|crop|cross|invert|visible|hidden|always|avoid|x-low|low|medium|high|x-high|mix?|repeat?|static|relative|absolute|portrait|landscape|spell-out|once|digits|continuous|code|x-slow|slow|fast|x-fast|faster|slower|justify|underline|overline|line-through|blink|capitalize|uppercase|lowercase|embed|bidi-override|baseline|sub|super|text-top|middle|text-bottom|silent|x-soft|soft|loud|x-loud|pre|nowrap|serif|sans-serif|cursive|fantasy|monospace|empty|string|strict|loose|char|true|false|dotted|dashed|solid|double|groove|ridge|inset|outset|larger|smaller|xx-small|x-small|small|large|x-large|xx-large|all|newspaper|distribute|distribute-all-lines|distribute-center-last|inter-word|inter-ideograph|inter-cluster|kashida|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|keep-all|break-all|break-word|lr-tb|tb-rl|thin|thick|inline-block|w-resize|hand|distribute-letter|distribute-space|whitespace|male|female|child)$/i,
|
|
1215
|
+
namedcolor: /^(?:aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|purple|red|silver|teal|white|yellow|activeborder|activecaption|appworkspace|background|buttonface|buttonhighlight|buttonshadow|buttontext|captiontext|graytext|highlight|highlighttext|inactiveborder|inactivecaption|inactivecaptiontext|infobackground|infotext|menu|menutext|scrollbar|threeddarkshadow|threedface|threedhighlight|threedlightshadow|threedshadow|window|windowframe|windowtext)$/i
|
|
1216
|
+
},
|
|
1217
|
+
{}
|
|
1218
|
+
],
|
|
1219
|
+
1: [-1, -1, {}],
|
|
1220
|
+
2: [-1, {}, -1],
|
|
1221
|
+
3: [{}],
|
|
1222
|
+
4: [{}],
|
|
1223
|
+
5: [{}]
|
|
1224
|
+
},
|
|
1225
|
+
kwmap: {
|
|
1226
|
+
propertyValue: "string",
|
|
1227
|
+
namedcolor: "var"
|
|
1228
|
+
},
|
|
1229
|
+
parts: {
|
|
1230
|
+
0: [{ 1: "string" }, null, null, null],
|
|
1231
|
+
1: [null, null, null],
|
|
1232
|
+
2: [null, null, null],
|
|
1233
|
+
3: [null],
|
|
1234
|
+
4: [null],
|
|
1235
|
+
5: [null]
|
|
1236
|
+
},
|
|
1237
|
+
subst: {
|
|
1238
|
+
[-1]: [false, false, false, false, false],
|
|
1239
|
+
0: [false, false, false, false],
|
|
1240
|
+
1: [false, false, false],
|
|
1241
|
+
2: [false, false, false],
|
|
1242
|
+
3: [false],
|
|
1243
|
+
4: [false],
|
|
1244
|
+
5: [false]
|
|
1245
|
+
}
|
|
1246
|
+
};
|
|
1247
|
+
|
|
1248
|
+
// packages/render/src/libs/highlighter/languages/cpp.ts
|
|
1249
|
+
var cppLang = {
|
|
1250
|
+
language: "cpp",
|
|
1251
|
+
defClass: "code",
|
|
1252
|
+
regs: {
|
|
1253
|
+
[-1]: /(")|(\{)|(\()|(\[)|([a-z_]\w*)|(^[ \t]*#include)|(^[ \t]*#[ \t]*[a-z]+)|(\d*\.?\d+)|(\/\*)|(\/\/.+)/gim,
|
|
1254
|
+
0: /(\\)/gi,
|
|
1255
|
+
1: /(")|(\{)|(\()|(\[)|([a-z_]\w*)|(\b0[xX][\da-f]+)|(\b\d\d*|\b0\b)|(\b0[0-7]+)|(\b(\d*\.\d+)|(\d+\.\d*))|(^[ \t]*#include)|(^[ \t]*#[ \t]*[a-z]+)|(\d*\.?\d+)|(\/\*)|(\/\/.+)/gim,
|
|
1256
|
+
2: /(")|(\{)|(\()|(\[)|([a-z_]\w*)|(\b0[xX][\da-f]+)|(\b\d\d*|\b0\b)|(\b0[0-7]+)|(\b(\d*\.\d+)|(\d+\.\d*))|(^[ \t]*#include)|(^[ \t]*#[ \t]*[a-z]+)|(\d*\.?\d+)|(\/\*)|(\/\/.+)/gim,
|
|
1257
|
+
3: /(")|(\{)|(\()|(\[)|([a-z_]\w*)|(\b0[xX][\da-f]+)|(\b\d\d*|\b0\b)|(\b0[0-7]+)|(\b(\d*\.\d+)|(\d+\.\d*))|(^[ \t]*#include)|(^[ \t]*#[ \t]*[a-z]+)|(\d*\.?\d+)|(\/\*)|(\/\/.+)/gim,
|
|
1258
|
+
4: null,
|
|
1259
|
+
5: /(")|(<)/gi,
|
|
1260
|
+
6: /(")|(\{)|(\()|([a-z_]\w*)|(\b0[xX][\da-f]+)|(\b\d\d*|\b0\b)|(\b0[0-7]+)|(\b(\d*\.\d+)|(\d+\.\d*))|(\/\*)|(\/\/.+)/gi,
|
|
1261
|
+
7: /(\$\w+\s*:.+\$)/gi,
|
|
1262
|
+
8: /(\$\w+\s*:.+\$)/gi
|
|
1263
|
+
},
|
|
1264
|
+
counts: {
|
|
1265
|
+
[-1]: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
1266
|
+
0: [0],
|
|
1267
|
+
1: [0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0],
|
|
1268
|
+
2: [0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0],
|
|
1269
|
+
3: [0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0],
|
|
1270
|
+
4: [],
|
|
1271
|
+
5: [0, 0],
|
|
1272
|
+
6: [0, 0, 0, 0, 0, 0, 0, 2, 0, 0],
|
|
1273
|
+
7: [0],
|
|
1274
|
+
8: [0]
|
|
1275
|
+
},
|
|
1276
|
+
delim: {
|
|
1277
|
+
[-1]: [
|
|
1278
|
+
"quotes",
|
|
1279
|
+
"brackets",
|
|
1280
|
+
"brackets",
|
|
1281
|
+
"brackets",
|
|
1282
|
+
"",
|
|
1283
|
+
"prepro",
|
|
1284
|
+
"prepro",
|
|
1285
|
+
"",
|
|
1286
|
+
"mlcomment",
|
|
1287
|
+
"comment"
|
|
1288
|
+
],
|
|
1289
|
+
0: [""],
|
|
1290
|
+
1: [
|
|
1291
|
+
"quotes",
|
|
1292
|
+
"brackets",
|
|
1293
|
+
"brackets",
|
|
1294
|
+
"brackets",
|
|
1295
|
+
"",
|
|
1296
|
+
"",
|
|
1297
|
+
"",
|
|
1298
|
+
"",
|
|
1299
|
+
"",
|
|
1300
|
+
"prepro",
|
|
1301
|
+
"prepro",
|
|
1302
|
+
"",
|
|
1303
|
+
"mlcomment",
|
|
1304
|
+
"comment"
|
|
1305
|
+
],
|
|
1306
|
+
2: [
|
|
1307
|
+
"quotes",
|
|
1308
|
+
"brackets",
|
|
1309
|
+
"brackets",
|
|
1310
|
+
"brackets",
|
|
1311
|
+
"",
|
|
1312
|
+
"",
|
|
1313
|
+
"",
|
|
1314
|
+
"",
|
|
1315
|
+
"",
|
|
1316
|
+
"prepro",
|
|
1317
|
+
"prepro",
|
|
1318
|
+
"",
|
|
1319
|
+
"mlcomment",
|
|
1320
|
+
"comment"
|
|
1321
|
+
],
|
|
1322
|
+
3: [
|
|
1323
|
+
"quotes",
|
|
1324
|
+
"brackets",
|
|
1325
|
+
"brackets",
|
|
1326
|
+
"brackets",
|
|
1327
|
+
"",
|
|
1328
|
+
"",
|
|
1329
|
+
"",
|
|
1330
|
+
"",
|
|
1331
|
+
"",
|
|
1332
|
+
"prepro",
|
|
1333
|
+
"prepro",
|
|
1334
|
+
"",
|
|
1335
|
+
"mlcomment",
|
|
1336
|
+
"comment"
|
|
1337
|
+
],
|
|
1338
|
+
4: [],
|
|
1339
|
+
5: ["quotes", "quotes"],
|
|
1340
|
+
6: ["quotes", "brackets", "brackets", "", "", "", "", "", "mlcomment", "comment"],
|
|
1341
|
+
7: [""],
|
|
1342
|
+
8: [""]
|
|
1343
|
+
},
|
|
1344
|
+
inner: {
|
|
1345
|
+
[-1]: [
|
|
1346
|
+
"string",
|
|
1347
|
+
"code",
|
|
1348
|
+
"code",
|
|
1349
|
+
"code",
|
|
1350
|
+
"identifier",
|
|
1351
|
+
"prepro",
|
|
1352
|
+
"code",
|
|
1353
|
+
"number",
|
|
1354
|
+
"mlcomment",
|
|
1355
|
+
"comment"
|
|
1356
|
+
],
|
|
1357
|
+
0: ["special"],
|
|
1358
|
+
1: [
|
|
1359
|
+
"string",
|
|
1360
|
+
"code",
|
|
1361
|
+
"code",
|
|
1362
|
+
"code",
|
|
1363
|
+
"identifier",
|
|
1364
|
+
"number",
|
|
1365
|
+
"number",
|
|
1366
|
+
"number",
|
|
1367
|
+
"number",
|
|
1368
|
+
"prepro",
|
|
1369
|
+
"code",
|
|
1370
|
+
"number",
|
|
1371
|
+
"mlcomment",
|
|
1372
|
+
"comment"
|
|
1373
|
+
],
|
|
1374
|
+
2: [
|
|
1375
|
+
"string",
|
|
1376
|
+
"code",
|
|
1377
|
+
"code",
|
|
1378
|
+
"code",
|
|
1379
|
+
"identifier",
|
|
1380
|
+
"number",
|
|
1381
|
+
"number",
|
|
1382
|
+
"number",
|
|
1383
|
+
"number",
|
|
1384
|
+
"prepro",
|
|
1385
|
+
"code",
|
|
1386
|
+
"number",
|
|
1387
|
+
"mlcomment",
|
|
1388
|
+
"comment"
|
|
1389
|
+
],
|
|
1390
|
+
3: [
|
|
1391
|
+
"string",
|
|
1392
|
+
"code",
|
|
1393
|
+
"code",
|
|
1394
|
+
"code",
|
|
1395
|
+
"identifier",
|
|
1396
|
+
"number",
|
|
1397
|
+
"number",
|
|
1398
|
+
"number",
|
|
1399
|
+
"number",
|
|
1400
|
+
"prepro",
|
|
1401
|
+
"code",
|
|
1402
|
+
"number",
|
|
1403
|
+
"mlcomment",
|
|
1404
|
+
"comment"
|
|
1405
|
+
],
|
|
1406
|
+
4: [],
|
|
1407
|
+
5: ["string", "string"],
|
|
1408
|
+
6: [
|
|
1409
|
+
"string",
|
|
1410
|
+
"code",
|
|
1411
|
+
"code",
|
|
1412
|
+
"identifier",
|
|
1413
|
+
"number",
|
|
1414
|
+
"number",
|
|
1415
|
+
"number",
|
|
1416
|
+
"number",
|
|
1417
|
+
"mlcomment",
|
|
1418
|
+
"comment"
|
|
1419
|
+
],
|
|
1420
|
+
7: ["inlinedoc"],
|
|
1421
|
+
8: ["inlinedoc"]
|
|
1422
|
+
},
|
|
1423
|
+
end: {
|
|
1424
|
+
0: /"/gi,
|
|
1425
|
+
1: /\}/gi,
|
|
1426
|
+
2: /\)/gi,
|
|
1427
|
+
3: /\]/gi,
|
|
1428
|
+
4: />/gi,
|
|
1429
|
+
5: /(?<!\\)$/gim,
|
|
1430
|
+
6: /(?<!\\)$/gim,
|
|
1431
|
+
7: /\*\//gi,
|
|
1432
|
+
8: /$/gim
|
|
1433
|
+
},
|
|
1434
|
+
states: {
|
|
1435
|
+
[-1]: [0, 1, 2, 3, -1, 5, 6, -1, 7, 8],
|
|
1436
|
+
0: [-1],
|
|
1437
|
+
1: [0, 1, 2, 3, -1, -1, -1, -1, -1, 5, 6, -1, 7, 8],
|
|
1438
|
+
2: [0, 1, 2, 3, -1, -1, -1, -1, -1, 5, 6, -1, 7, 8],
|
|
1439
|
+
3: [0, 1, 2, 3, -1, -1, -1, -1, -1, 5, 6, -1, 7, 8],
|
|
1440
|
+
4: [],
|
|
1441
|
+
5: [0, 4],
|
|
1442
|
+
6: [0, 1, 2, -1, -1, -1, -1, -1, 7, 8],
|
|
1443
|
+
7: [-1],
|
|
1444
|
+
8: [-1]
|
|
1445
|
+
},
|
|
1446
|
+
keywords: {
|
|
1447
|
+
[-1]: [
|
|
1448
|
+
-1,
|
|
1449
|
+
-1,
|
|
1450
|
+
-1,
|
|
1451
|
+
-1,
|
|
1452
|
+
{
|
|
1453
|
+
reserved: /^(and|and_eq|asm|bitand|bitor|break|case|catch|compl|const_cast|continue|default|delete|do|dynamic_cast|else|for|fortran|friend|goto|if|new|not|not_eq|operator|or|or_eq|private|protected|public|reinterpret_cast|return|sizeof|static_cast|switch|this|throw|try|typeid|using|while|xor|xor_eq|false|true)$/,
|
|
1454
|
+
types: /^(auto|bool|char|class|const|double|enum|explicit|export|extern|float|inline|int|long|mutable|namespace|register|short|signed|static|struct|template|typedef|typename|union|unsigned|virtual|void|volatile|wchar_t)$/,
|
|
1455
|
+
"Common Macros": /^(NULL|TRUE|FALSE|MAX|MIN|__LINE__|__DATA__|__FILE__|__TIME__|__STDC__)$/
|
|
1456
|
+
},
|
|
1457
|
+
-1,
|
|
1458
|
+
-1,
|
|
1459
|
+
{},
|
|
1460
|
+
-1,
|
|
1461
|
+
-1
|
|
1462
|
+
],
|
|
1463
|
+
0: [],
|
|
1464
|
+
1: [
|
|
1465
|
+
-1,
|
|
1466
|
+
-1,
|
|
1467
|
+
-1,
|
|
1468
|
+
-1,
|
|
1469
|
+
{
|
|
1470
|
+
reserved: /^(and|and_eq|asm|bitand|bitor|break|case|catch|compl|const_cast|continue|default|delete|do|dynamic_cast|else|for|fortran|friend|goto|if|new|not|not_eq|operator|or|or_eq|private|protected|public|reinterpret_cast|return|sizeof|static_cast|switch|this|throw|try|typeid|using|while|xor|xor_eq|false|true)$/,
|
|
1471
|
+
types: /^(auto|bool|char|class|const|double|enum|explicit|export|extern|float|inline|int|long|mutable|namespace|register|short|signed|static|struct|template|typedef|typename|union|unsigned|virtual|void|volatile|wchar_t)$/,
|
|
1472
|
+
"Common Macros": /^(NULL|TRUE|FALSE|MAX|MIN|__LINE__|__DATA__|__FILE__|__TIME__|__STDC__)$/
|
|
1473
|
+
},
|
|
1474
|
+
{},
|
|
1475
|
+
{},
|
|
1476
|
+
{},
|
|
1477
|
+
{},
|
|
1478
|
+
-1,
|
|
1479
|
+
-1,
|
|
1480
|
+
{},
|
|
1481
|
+
-1,
|
|
1482
|
+
-1
|
|
1483
|
+
],
|
|
1484
|
+
2: [
|
|
1485
|
+
-1,
|
|
1486
|
+
-1,
|
|
1487
|
+
-1,
|
|
1488
|
+
-1,
|
|
1489
|
+
{
|
|
1490
|
+
reserved: /^(and|and_eq|asm|bitand|bitor|break|case|catch|compl|const_cast|continue|default|delete|do|dynamic_cast|else|for|fortran|friend|goto|if|new|not|not_eq|operator|or|or_eq|private|protected|public|reinterpret_cast|return|sizeof|static_cast|switch|this|throw|try|typeid|using|while|xor|xor_eq|false|true)$/,
|
|
1491
|
+
types: /^(auto|bool|char|class|const|double|enum|explicit|export|extern|float|inline|int|long|mutable|namespace|register|short|signed|static|struct|template|typedef|typename|union|unsigned|virtual|void|volatile|wchar_t)$/,
|
|
1492
|
+
"Common Macros": /^(NULL|TRUE|FALSE|MAX|MIN|__LINE__|__DATA__|__FILE__|__TIME__|__STDC__)$/
|
|
1493
|
+
},
|
|
1494
|
+
{},
|
|
1495
|
+
{},
|
|
1496
|
+
{},
|
|
1497
|
+
{},
|
|
1498
|
+
-1,
|
|
1499
|
+
-1,
|
|
1500
|
+
{},
|
|
1501
|
+
-1,
|
|
1502
|
+
-1
|
|
1503
|
+
],
|
|
1504
|
+
3: [],
|
|
1505
|
+
4: [],
|
|
1506
|
+
5: [],
|
|
1507
|
+
6: [],
|
|
1508
|
+
7: [{}],
|
|
1509
|
+
8: [{}],
|
|
1510
|
+
11: []
|
|
1511
|
+
},
|
|
1512
|
+
kwmap: {
|
|
1513
|
+
reserved: "reserved",
|
|
1514
|
+
types: "types",
|
|
1515
|
+
"Common Macros": "prepro"
|
|
1516
|
+
},
|
|
1517
|
+
parts: {
|
|
1518
|
+
0: [null],
|
|
1519
|
+
1: [null, null, null, null, null, null, null, null, null, null, null, null, null, null],
|
|
1520
|
+
2: [null, null, null, null, null, null, null, null, null, null, null, null, null, null],
|
|
1521
|
+
3: [null, null, null, null, null, null, null, null, null, null, null, null, null, null],
|
|
1522
|
+
4: [],
|
|
1523
|
+
5: [null, null],
|
|
1524
|
+
6: [null, null, null, null, null, null, null, null, null, null],
|
|
1525
|
+
7: [null],
|
|
1526
|
+
8: [null]
|
|
1527
|
+
},
|
|
1528
|
+
subst: {
|
|
1529
|
+
[-1]: [false, false, false, false, false, false, false, false, false, false],
|
|
1530
|
+
0: [false],
|
|
1531
|
+
1: [
|
|
1532
|
+
false,
|
|
1533
|
+
false,
|
|
1534
|
+
false,
|
|
1535
|
+
false,
|
|
1536
|
+
false,
|
|
1537
|
+
false,
|
|
1538
|
+
false,
|
|
1539
|
+
false,
|
|
1540
|
+
false,
|
|
1541
|
+
false,
|
|
1542
|
+
false,
|
|
1543
|
+
false,
|
|
1544
|
+
false,
|
|
1545
|
+
false
|
|
1546
|
+
],
|
|
1547
|
+
2: [
|
|
1548
|
+
false,
|
|
1549
|
+
false,
|
|
1550
|
+
false,
|
|
1551
|
+
false,
|
|
1552
|
+
false,
|
|
1553
|
+
false,
|
|
1554
|
+
false,
|
|
1555
|
+
false,
|
|
1556
|
+
false,
|
|
1557
|
+
false,
|
|
1558
|
+
false,
|
|
1559
|
+
false,
|
|
1560
|
+
false,
|
|
1561
|
+
false
|
|
1562
|
+
],
|
|
1563
|
+
3: [
|
|
1564
|
+
false,
|
|
1565
|
+
false,
|
|
1566
|
+
false,
|
|
1567
|
+
false,
|
|
1568
|
+
false,
|
|
1569
|
+
false,
|
|
1570
|
+
false,
|
|
1571
|
+
false,
|
|
1572
|
+
false,
|
|
1573
|
+
false,
|
|
1574
|
+
false,
|
|
1575
|
+
false,
|
|
1576
|
+
false,
|
|
1577
|
+
false
|
|
1578
|
+
],
|
|
1579
|
+
4: [],
|
|
1580
|
+
5: [false, false],
|
|
1581
|
+
6: [false, false, false, false, false, false, false, false, false, false],
|
|
1582
|
+
7: [false],
|
|
1583
|
+
8: [false]
|
|
1584
|
+
}
|
|
1585
|
+
};
|
|
1586
|
+
|
|
1587
|
+
// packages/render/src/libs/highlighter/languages/diff.ts
|
|
1588
|
+
var diffLang = {
|
|
1589
|
+
language: "diff",
|
|
1590
|
+
defClass: "default",
|
|
1591
|
+
regs: {
|
|
1592
|
+
[-1]: /(^\\\sNo\snewline.+$)|(^---$)|(^(diff\s+-|Only\s+|Index).*$)|(^(---|\+\+\+)\s.+$)|(^\*.*$)|(^\+.*$)|(^!.*$)|(^<\s.*$)|(^>\s.*$)|(^\d+(,\d+)?[acd]\d+(,\d+)?$)|(^-.*$)|(^\+.*$)|(^@@.+@@$)|(^d\d+\s\d+$)|(^a\d+\s\d+$)|(^(\d+)(,\d+)?(a)$)|(^(\d+)(,\d+)?(c)$)|(^(\d+)(,\d+)?(d)$)|(^a(\d+)(\s\d+)?$)|(^c(\d+)(\s\d+)?$)|(^d(\d+)(\s\d+)?$)/gm,
|
|
1593
|
+
0: null,
|
|
1594
|
+
1: null,
|
|
1595
|
+
2: null,
|
|
1596
|
+
3: null,
|
|
1597
|
+
4: null
|
|
1598
|
+
},
|
|
1599
|
+
counts: {
|
|
1600
|
+
[-1]: [0, 0, 1, 1, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 3, 3, 3, 2, 2, 2],
|
|
1601
|
+
0: [],
|
|
1602
|
+
1: [],
|
|
1603
|
+
2: [],
|
|
1604
|
+
3: [],
|
|
1605
|
+
4: []
|
|
1606
|
+
},
|
|
1607
|
+
delim: {
|
|
1608
|
+
[-1]: [
|
|
1609
|
+
"",
|
|
1610
|
+
"",
|
|
1611
|
+
"",
|
|
1612
|
+
"",
|
|
1613
|
+
"",
|
|
1614
|
+
"",
|
|
1615
|
+
"",
|
|
1616
|
+
"",
|
|
1617
|
+
"",
|
|
1618
|
+
"",
|
|
1619
|
+
"",
|
|
1620
|
+
"",
|
|
1621
|
+
"",
|
|
1622
|
+
"",
|
|
1623
|
+
"code",
|
|
1624
|
+
"code",
|
|
1625
|
+
"code",
|
|
1626
|
+
"",
|
|
1627
|
+
"code",
|
|
1628
|
+
"code",
|
|
1629
|
+
""
|
|
1630
|
+
],
|
|
1631
|
+
0: [],
|
|
1632
|
+
1: [],
|
|
1633
|
+
2: [],
|
|
1634
|
+
3: [],
|
|
1635
|
+
4: []
|
|
1636
|
+
},
|
|
1637
|
+
inner: {
|
|
1638
|
+
[-1]: [
|
|
1639
|
+
"special",
|
|
1640
|
+
"code",
|
|
1641
|
+
"var",
|
|
1642
|
+
"reserved",
|
|
1643
|
+
"quotes",
|
|
1644
|
+
"string",
|
|
1645
|
+
"inlinedoc",
|
|
1646
|
+
"quotes",
|
|
1647
|
+
"string",
|
|
1648
|
+
"code",
|
|
1649
|
+
"quotes",
|
|
1650
|
+
"string",
|
|
1651
|
+
"code",
|
|
1652
|
+
"code",
|
|
1653
|
+
"var",
|
|
1654
|
+
"string",
|
|
1655
|
+
"inlinedoc",
|
|
1656
|
+
"code",
|
|
1657
|
+
"string",
|
|
1658
|
+
"inlinedoc",
|
|
1659
|
+
"code"
|
|
1660
|
+
],
|
|
1661
|
+
0: [],
|
|
1662
|
+
1: [],
|
|
1663
|
+
2: [],
|
|
1664
|
+
3: [],
|
|
1665
|
+
4: []
|
|
1666
|
+
},
|
|
1667
|
+
end: {
|
|
1668
|
+
0: /(?=^[ad]\d+\s\d+)/gm,
|
|
1669
|
+
1: /^(\.)$/gm,
|
|
1670
|
+
2: /^(\.)$/gm,
|
|
1671
|
+
3: /^(\.)$/gm,
|
|
1672
|
+
4: /^(\.)$/gm
|
|
1673
|
+
},
|
|
1674
|
+
states: {
|
|
1675
|
+
[-1]: [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, -1, 3, 4, -1],
|
|
1676
|
+
0: [],
|
|
1677
|
+
1: [],
|
|
1678
|
+
2: [],
|
|
1679
|
+
3: [],
|
|
1680
|
+
4: []
|
|
1681
|
+
},
|
|
1682
|
+
keywords: {
|
|
1683
|
+
[-1]: [{}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, -1, -1, -1, {}, -1, -1, {}],
|
|
1684
|
+
0: [],
|
|
1685
|
+
1: [],
|
|
1686
|
+
2: [],
|
|
1687
|
+
3: [],
|
|
1688
|
+
4: [],
|
|
1689
|
+
5: [],
|
|
1690
|
+
6: [],
|
|
1691
|
+
7: [],
|
|
1692
|
+
8: [],
|
|
1693
|
+
9: [],
|
|
1694
|
+
10: [],
|
|
1695
|
+
11: [],
|
|
1696
|
+
12: [],
|
|
1697
|
+
13: [],
|
|
1698
|
+
17: [],
|
|
1699
|
+
20: []
|
|
1700
|
+
},
|
|
1701
|
+
kwmap: {},
|
|
1702
|
+
parts: {
|
|
1703
|
+
0: [],
|
|
1704
|
+
1: [],
|
|
1705
|
+
2: [],
|
|
1706
|
+
3: [],
|
|
1707
|
+
4: []
|
|
1708
|
+
},
|
|
1709
|
+
subst: {
|
|
1710
|
+
[-1]: [
|
|
1711
|
+
false,
|
|
1712
|
+
false,
|
|
1713
|
+
false,
|
|
1714
|
+
false,
|
|
1715
|
+
false,
|
|
1716
|
+
false,
|
|
1717
|
+
false,
|
|
1718
|
+
false,
|
|
1719
|
+
false,
|
|
1720
|
+
false,
|
|
1721
|
+
false,
|
|
1722
|
+
false,
|
|
1723
|
+
false,
|
|
1724
|
+
false,
|
|
1725
|
+
false,
|
|
1726
|
+
false,
|
|
1727
|
+
false,
|
|
1728
|
+
false,
|
|
1729
|
+
false,
|
|
1730
|
+
false,
|
|
1731
|
+
false
|
|
1732
|
+
],
|
|
1733
|
+
0: [],
|
|
1734
|
+
1: [],
|
|
1735
|
+
2: [],
|
|
1736
|
+
3: [],
|
|
1737
|
+
4: []
|
|
1738
|
+
}
|
|
1739
|
+
};
|
|
1740
|
+
|
|
1741
|
+
// packages/render/src/libs/highlighter/languages/dtd.ts
|
|
1742
|
+
var dtdLang = {
|
|
1743
|
+
language: "dtd",
|
|
1744
|
+
defClass: "code",
|
|
1745
|
+
regs: {
|
|
1746
|
+
[-1]: /(<!--)|(<!\[)|((&|%)[\w\-.]+;)/g,
|
|
1747
|
+
0: null,
|
|
1748
|
+
1: /(<!--)|(<)|(#PCDATA\b)|((&|%)[\w\-.]+;)|([a-z][a-z\d\-,:]+)/gi,
|
|
1749
|
+
2: /(<!--)|(\()|(')|(")|((?<=<)!(ENTITY|ATTLIST|ELEMENT|NOTATION)\b)|(\s(#(IMPLIED|REQUIRED|FIXED))|CDATA|ENTITY|NOTATION|NMTOKENS?|PUBLIC|SYSTEM\b)|(#PCDATA\b)|((&|%)[\w\-.]+;)|([a-z][a-z\d\-,:]+)/gi,
|
|
1750
|
+
3: /(\()|((&|%)[\w\-.]+;)|([a-z][a-z\d\-,:]+)/gi,
|
|
1751
|
+
4: /((&|%)[\w\-.]+;)/g,
|
|
1752
|
+
5: /((&|%)[\w\-.]+;)/g
|
|
1753
|
+
},
|
|
1754
|
+
counts: {
|
|
1755
|
+
[-1]: [0, 0, 1],
|
|
1756
|
+
0: [],
|
|
1757
|
+
1: [0, 0, 0, 1, 0],
|
|
1758
|
+
2: [0, 0, 0, 0, 1, 2, 0, 1, 0],
|
|
1759
|
+
3: [0, 1, 0],
|
|
1760
|
+
4: [1],
|
|
1761
|
+
5: [1]
|
|
1762
|
+
},
|
|
1763
|
+
delim: {
|
|
1764
|
+
[-1]: ["comment", "brackets", ""],
|
|
1765
|
+
0: [],
|
|
1766
|
+
1: ["comment", "brackets", "", "", ""],
|
|
1767
|
+
2: ["comment", "brackets", "quotes", "quotes", "", "", "", "", ""],
|
|
1768
|
+
3: ["brackets", "", ""],
|
|
1769
|
+
4: [""],
|
|
1770
|
+
5: [""]
|
|
1771
|
+
},
|
|
1772
|
+
inner: {
|
|
1773
|
+
[-1]: ["comment", "code", "special"],
|
|
1774
|
+
0: [],
|
|
1775
|
+
1: ["comment", "code", "reserved", "special", "identifier"],
|
|
1776
|
+
2: [
|
|
1777
|
+
"comment",
|
|
1778
|
+
"code",
|
|
1779
|
+
"string",
|
|
1780
|
+
"string",
|
|
1781
|
+
"var",
|
|
1782
|
+
"reserved",
|
|
1783
|
+
"reserved",
|
|
1784
|
+
"special",
|
|
1785
|
+
"identifier"
|
|
1786
|
+
],
|
|
1787
|
+
3: ["code", "special", "identifier"],
|
|
1788
|
+
4: ["special"],
|
|
1789
|
+
5: ["special"]
|
|
1790
|
+
},
|
|
1791
|
+
end: {
|
|
1792
|
+
0: /-->/g,
|
|
1793
|
+
1: /\]\]>/g,
|
|
1794
|
+
2: />/g,
|
|
1795
|
+
3: /\)/g,
|
|
1796
|
+
4: /'/g,
|
|
1797
|
+
5: /"/g
|
|
1798
|
+
},
|
|
1799
|
+
states: {
|
|
1800
|
+
[-1]: [0, 1, -1],
|
|
1801
|
+
0: [],
|
|
1802
|
+
1: [0, 2, -1, -1, -1],
|
|
1803
|
+
2: [0, 3, 4, 5, -1, -1, -1, -1, -1],
|
|
1804
|
+
3: [3, -1, -1],
|
|
1805
|
+
4: [-1],
|
|
1806
|
+
5: [-1]
|
|
1807
|
+
},
|
|
1808
|
+
keywords: {
|
|
1809
|
+
[-1]: [-1, -1, {}],
|
|
1810
|
+
0: [],
|
|
1811
|
+
1: [],
|
|
1812
|
+
2: [],
|
|
1813
|
+
3: [-1, {}, {}],
|
|
1814
|
+
4: [{}],
|
|
1815
|
+
5: [{}],
|
|
1816
|
+
6: [],
|
|
1817
|
+
7: [],
|
|
1818
|
+
8: []
|
|
1819
|
+
},
|
|
1820
|
+
kwmap: {},
|
|
1821
|
+
parts: {
|
|
1822
|
+
0: [],
|
|
1823
|
+
1: [null, null, null, null, null],
|
|
1824
|
+
2: [null, null, null, null, null, null, null, null, null],
|
|
1825
|
+
3: [null, null, null],
|
|
1826
|
+
4: [null],
|
|
1827
|
+
5: [null]
|
|
1828
|
+
},
|
|
1829
|
+
subst: {
|
|
1830
|
+
[-1]: [false, false, false],
|
|
1831
|
+
0: [],
|
|
1832
|
+
1: [false, false, false, false, false],
|
|
1833
|
+
2: [false, false, false, false, false, false, false, false, false],
|
|
1834
|
+
3: [false, false, false],
|
|
1835
|
+
4: [false],
|
|
1836
|
+
5: [false]
|
|
1837
|
+
}
|
|
1838
|
+
};
|
|
1839
|
+
|
|
1840
|
+
// packages/render/src/libs/highlighter/languages/html.ts
|
|
1841
|
+
var htmlLang = {
|
|
1842
|
+
language: "html",
|
|
1843
|
+
defClass: "code",
|
|
1844
|
+
regs: {
|
|
1845
|
+
[-1]: /(<!--)|(<[?/]?)|((&)[\w\-.]+;)/gi,
|
|
1846
|
+
0: null,
|
|
1847
|
+
1: /((?<=[</?])[\w\-:]+)|([\w\-:]+)|(")/gi,
|
|
1848
|
+
2: /((&)[\w\-.]+;)/gi
|
|
1849
|
+
},
|
|
1850
|
+
counts: {
|
|
1851
|
+
[-1]: [0, 0, 1],
|
|
1852
|
+
0: [],
|
|
1853
|
+
1: [0, 0, 0],
|
|
1854
|
+
2: [1]
|
|
1855
|
+
},
|
|
1856
|
+
delim: {
|
|
1857
|
+
[-1]: ["comment", "brackets", ""],
|
|
1858
|
+
0: [],
|
|
1859
|
+
1: ["", "", "quotes"],
|
|
1860
|
+
2: [""]
|
|
1861
|
+
},
|
|
1862
|
+
inner: {
|
|
1863
|
+
[-1]: ["comment", "code", "special"],
|
|
1864
|
+
0: [],
|
|
1865
|
+
1: ["reserved", "var", "string"],
|
|
1866
|
+
2: ["special"]
|
|
1867
|
+
},
|
|
1868
|
+
end: {
|
|
1869
|
+
0: /-->/gi,
|
|
1870
|
+
1: /[/?]?>/gi,
|
|
1871
|
+
2: /"/gi
|
|
1872
|
+
},
|
|
1873
|
+
states: {
|
|
1874
|
+
[-1]: [0, 1, -1],
|
|
1875
|
+
0: [],
|
|
1876
|
+
1: [-1, -1, 2],
|
|
1877
|
+
2: [-1]
|
|
1878
|
+
},
|
|
1879
|
+
keywords: {
|
|
1880
|
+
[-1]: [-1, -1, {}],
|
|
1881
|
+
0: [],
|
|
1882
|
+
1: [],
|
|
1883
|
+
2: [{}]
|
|
1884
|
+
},
|
|
1885
|
+
kwmap: {},
|
|
1886
|
+
parts: {
|
|
1887
|
+
0: [],
|
|
1888
|
+
1: [null, null, null],
|
|
1889
|
+
2: [null]
|
|
1890
|
+
},
|
|
1891
|
+
subst: {
|
|
1892
|
+
[-1]: [false, false, false],
|
|
1893
|
+
0: [],
|
|
1894
|
+
1: [false, false, false],
|
|
1895
|
+
2: [false]
|
|
1896
|
+
}
|
|
1897
|
+
};
|
|
1898
|
+
|
|
1899
|
+
// packages/render/src/libs/highlighter/languages/java.ts
|
|
1900
|
+
var javaLang = {
|
|
1901
|
+
language: "java",
|
|
1902
|
+
defClass: "code",
|
|
1903
|
+
regs: {
|
|
1904
|
+
[-1]: /(\{)|(\()|(\[)|(\/\*)|(")|(')|(\/\/)|([a-z_]\w*)|(0[xX][\da-f]+)|(\d\d*|\b0\b)|(0[0-7]+)|((\d*\.\d+)|(\d+\.\d*))|(((\d+|((\d*\.\d+)|(\d+\.\d*)))[eE][+-]?\d+))/gi,
|
|
1905
|
+
0: /(\{)|(\()|(\[)|(\/\*)|(")|(')|(\/\/)|([a-z_]\w*)|(0[xX][\da-f]+)|(\d\d*|\b0\b)|(0[0-7]+)|((\d*\.\d+)|(\d+\.\d*))|(((\d+|((\d*\.\d+)|(\d+\.\d*)))[eE][+-]?\d+))/gi,
|
|
1906
|
+
1: /(\{)|(\()|(\[)|(\/\*)|(")|(')|(\/\/)|([a-z_]\w*)|(0[xX][\da-f]+)|(\d\d*|\b0\b)|(0[0-7]+)|((\d*\.\d+)|(\d+\.\d*))|(((\d+|((\d*\.\d+)|(\d+\.\d*)))[eE][+-]?\d+))/gi,
|
|
1907
|
+
2: /(\{)|(\()|(\[)|(\/\*)|(")|(')|(\/\/)|([a-z_]\w*)|(0[xX][\da-f]+)|(\d\d*|\b0\b)|(0[0-7]+)|((\d*\.\d+)|(\d+\.\d*))|(((\d+|((\d*\.\d+)|(\d+\.\d*)))[eE][+-]?\d+))/gi,
|
|
1908
|
+
3: /(\s@\w+\s)|(((https?|ftp):\/\/[\w?.\-&=/%+]+)|(^|[\s,!?])www\.\w+\.\w+[\w?.&=/%+]*)|(\w+[.\w-]+@(\w+[.\w-])+)|(\bnote:)|(\$\w+\s*:.*\$)/gim,
|
|
1909
|
+
4: /(\\[\\"'`tnr${])/gi,
|
|
1910
|
+
5: /(\\.)/gi,
|
|
1911
|
+
6: /(\s@\w+\s)|(((https?|ftp):\/\/[\w?.\-&=/%+]+)|(^|[\s,!?])www\.\w+\.\w+[\w?.&=/%+]*)|(\w+[.\w-]+@(\w+[.\w-])+)|(\bnote:)|(\$\w+\s*:.*\$)/gim
|
|
1912
|
+
},
|
|
1913
|
+
counts: {
|
|
1914
|
+
[-1]: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 5],
|
|
1915
|
+
0: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 5],
|
|
1916
|
+
1: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 5],
|
|
1917
|
+
2: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 5],
|
|
1918
|
+
3: [0, 3, 1, 0, 0],
|
|
1919
|
+
4: [0],
|
|
1920
|
+
5: [0],
|
|
1921
|
+
6: [0, 3, 1, 0, 0]
|
|
1922
|
+
},
|
|
1923
|
+
delim: {
|
|
1924
|
+
[-1]: [
|
|
1925
|
+
"brackets",
|
|
1926
|
+
"brackets",
|
|
1927
|
+
"brackets",
|
|
1928
|
+
"comment",
|
|
1929
|
+
"quotes",
|
|
1930
|
+
"quotes",
|
|
1931
|
+
"comment",
|
|
1932
|
+
"",
|
|
1933
|
+
"",
|
|
1934
|
+
"",
|
|
1935
|
+
"",
|
|
1936
|
+
"",
|
|
1937
|
+
""
|
|
1938
|
+
],
|
|
1939
|
+
0: [
|
|
1940
|
+
"brackets",
|
|
1941
|
+
"brackets",
|
|
1942
|
+
"brackets",
|
|
1943
|
+
"comment",
|
|
1944
|
+
"quotes",
|
|
1945
|
+
"quotes",
|
|
1946
|
+
"comment",
|
|
1947
|
+
"",
|
|
1948
|
+
"",
|
|
1949
|
+
"",
|
|
1950
|
+
"",
|
|
1951
|
+
"",
|
|
1952
|
+
""
|
|
1953
|
+
],
|
|
1954
|
+
1: [
|
|
1955
|
+
"brackets",
|
|
1956
|
+
"brackets",
|
|
1957
|
+
"brackets",
|
|
1958
|
+
"comment",
|
|
1959
|
+
"quotes",
|
|
1960
|
+
"quotes",
|
|
1961
|
+
"comment",
|
|
1962
|
+
"",
|
|
1963
|
+
"",
|
|
1964
|
+
"",
|
|
1965
|
+
"",
|
|
1966
|
+
"",
|
|
1967
|
+
""
|
|
1968
|
+
],
|
|
1969
|
+
2: [
|
|
1970
|
+
"brackets",
|
|
1971
|
+
"brackets",
|
|
1972
|
+
"brackets",
|
|
1973
|
+
"comment",
|
|
1974
|
+
"quotes",
|
|
1975
|
+
"quotes",
|
|
1976
|
+
"comment",
|
|
1977
|
+
"",
|
|
1978
|
+
"",
|
|
1979
|
+
"",
|
|
1980
|
+
"",
|
|
1981
|
+
"",
|
|
1982
|
+
""
|
|
1983
|
+
],
|
|
1984
|
+
3: ["", "", "", "", ""],
|
|
1985
|
+
4: [""],
|
|
1986
|
+
5: [""],
|
|
1987
|
+
6: ["", "", "", "", ""]
|
|
1988
|
+
},
|
|
1989
|
+
inner: {
|
|
1990
|
+
[-1]: [
|
|
1991
|
+
"code",
|
|
1992
|
+
"code",
|
|
1993
|
+
"code",
|
|
1994
|
+
"comment",
|
|
1995
|
+
"string",
|
|
1996
|
+
"string",
|
|
1997
|
+
"comment",
|
|
1998
|
+
"identifier",
|
|
1999
|
+
"number",
|
|
2000
|
+
"number",
|
|
2001
|
+
"number",
|
|
2002
|
+
"number",
|
|
2003
|
+
"number"
|
|
2004
|
+
],
|
|
2005
|
+
0: [
|
|
2006
|
+
"code",
|
|
2007
|
+
"code",
|
|
2008
|
+
"code",
|
|
2009
|
+
"comment",
|
|
2010
|
+
"string",
|
|
2011
|
+
"string",
|
|
2012
|
+
"comment",
|
|
2013
|
+
"identifier",
|
|
2014
|
+
"number",
|
|
2015
|
+
"number",
|
|
2016
|
+
"number",
|
|
2017
|
+
"number",
|
|
2018
|
+
"number"
|
|
2019
|
+
],
|
|
2020
|
+
1: [
|
|
2021
|
+
"code",
|
|
2022
|
+
"code",
|
|
2023
|
+
"code",
|
|
2024
|
+
"comment",
|
|
2025
|
+
"string",
|
|
2026
|
+
"string",
|
|
2027
|
+
"comment",
|
|
2028
|
+
"identifier",
|
|
2029
|
+
"number",
|
|
2030
|
+
"number",
|
|
2031
|
+
"number",
|
|
2032
|
+
"number",
|
|
2033
|
+
"number"
|
|
2034
|
+
],
|
|
2035
|
+
2: [
|
|
2036
|
+
"code",
|
|
2037
|
+
"code",
|
|
2038
|
+
"code",
|
|
2039
|
+
"comment",
|
|
2040
|
+
"string",
|
|
2041
|
+
"string",
|
|
2042
|
+
"comment",
|
|
2043
|
+
"identifier",
|
|
2044
|
+
"number",
|
|
2045
|
+
"number",
|
|
2046
|
+
"number",
|
|
2047
|
+
"number",
|
|
2048
|
+
"number"
|
|
2049
|
+
],
|
|
2050
|
+
3: ["inlinedoc", "url", "url", "inlinedoc", "inlinedoc"],
|
|
2051
|
+
4: ["special"],
|
|
2052
|
+
5: ["special"],
|
|
2053
|
+
6: ["inlinedoc", "url", "url", "inlinedoc", "inlinedoc"]
|
|
2054
|
+
},
|
|
2055
|
+
end: {
|
|
2056
|
+
0: /\}/gi,
|
|
2057
|
+
1: /\)/gi,
|
|
2058
|
+
2: /\]/gi,
|
|
2059
|
+
3: /\*\//gi,
|
|
2060
|
+
4: /"/gi,
|
|
2061
|
+
5: /'/gi,
|
|
2062
|
+
6: /$/gim
|
|
2063
|
+
},
|
|
2064
|
+
states: {
|
|
2065
|
+
[-1]: [0, 1, 2, 3, 4, 5, 6, -1, -1, -1, -1, -1, -1],
|
|
2066
|
+
0: [0, 1, 2, 3, 4, 5, 6, -1, -1, -1, -1, -1, -1],
|
|
2067
|
+
1: [0, 1, 2, 3, 4, 5, 6, -1, -1, -1, -1, -1, -1],
|
|
2068
|
+
2: [0, 1, 2, 3, 4, 5, 6, -1, -1, -1, -1, -1, -1],
|
|
2069
|
+
3: [-1, -1, -1, -1, -1],
|
|
2070
|
+
4: [-1],
|
|
2071
|
+
5: [-1],
|
|
2072
|
+
6: [-1, -1, -1, -1, -1]
|
|
2073
|
+
},
|
|
2074
|
+
keywords: {
|
|
2075
|
+
[-1]: [
|
|
2076
|
+
-1,
|
|
2077
|
+
-1,
|
|
2078
|
+
-1,
|
|
2079
|
+
-1,
|
|
2080
|
+
-1,
|
|
2081
|
+
-1,
|
|
2082
|
+
-1,
|
|
2083
|
+
{
|
|
2084
|
+
types: /^(boolean|byte|char|const|double|final|float|int|long|short|static|void)$/,
|
|
2085
|
+
reserved: /^(import|package|abstract|break|case|catch|class|continue|default|do|else|extends|false|finally|for|goto|if|implements|instanceof|interface|native|new|null|private|protected|public|return|super|strictfp|switch|synchronized|this|throws|throw|transient|true|try|volatile|while)$/,
|
|
2086
|
+
builtin: /^(AbstractAction|AbstractBorder|AbstractButton|AbstractCellEditor|AbstractCollection|AbstractColorChooserPanel|AbstractDocument|AbstractInterruptibleChannel|AbstractLayoutCache|AbstractList|AbstractListModel|AbstractMap|AbstractMethodError|AbstractPreferences|AbstractSelectableChannel|AbstractSelectionKey|AbstractSelector|AbstractSequentialList|AbstractSet|AbstractSpinnerModel|AbstractTableModel|AbstractUndoableEdit|AbstractWriter|AccessControlContext|AccessControlException|AccessController|AccessException|Accessible|AccessibleAction|AccessibleBundle|AccessibleComponent|AccessibleContext|AccessibleEditableText|AccessibleExtendedComponent|AccessibleExtendedTable|AccessibleHyperlink|AccessibleHypertext|AccessibleIcon|AccessibleKeyBinding|AccessibleObject|AccessibleRelation|AccessibleRelationSet|AccessibleResourceBundle|AccessibleRole|AccessibleSelection|AccessibleState|AccessibleStateSet|AccessibleTable|AccessibleTableModelChange|AccessibleText|AccessibleValue|AccountExpiredException|Acl|AclEntry|AclNotFoundException|Action|ActionEvent|ActionListener|ActionMap|ActionMapUIResource|Activatable|ActivateFailedException|ActivationDesc|ActivationException|ActivationGroup|ActivationGroup_Stub|ActivationGroupDesc|ActivationGroupID|ActivationID|ActivationInstantiator|ActivationMonitor|ActivationSystem|Activator|ActiveEvent|AdapterActivator|AdapterActivatorOperations|AdapterAlreadyExists|AdapterAlreadyExistsHelper|AdapterInactive|AdapterInactiveHelper|AdapterNonExistent|AdapterNonExistentHelper|AddressHelper|Adjustable|AdjustmentEvent|AdjustmentListener|Adler32|AffineTransform|AffineTransformOp|AlgorithmParameterGenerator|AlgorithmParameterGeneratorSpi|AlgorithmParameters|AlgorithmParameterSpec|AlgorithmParametersSpi|AllPermission|AlphaComposite|AlreadyBound|AlreadyBoundException|AlreadyBoundHelper|AlreadyBoundHolder|AlreadyConnectedException|AncestorEvent|AncestorListener|Annotation|Any|AnyHolder|AnySeqHelper|AnySeqHolder|AppConfigurationEntry|Applet|AppletContext|AppletInitializer|AppletStub|ApplicationException|Arc2D|Area|AreaAveragingScaleFilter|ARG_IN|ARG_INOUT|ARG_OUT|ArithmeticException|Array|ArrayIndexOutOfBoundsException|ArrayList|Arrays|ArrayStoreException|AssertionError|AsyncBoxView|AsynchronousCloseException|Attr|Attribute|AttributedCharacterIterator|AttributedString|AttributeException|AttributeInUseException|AttributeList|AttributeListImpl|AttributeModificationException|Attributes|AttributeSet|AttributeSetUtilities|AttributesImpl|AudioClip|AudioFileFormat|AudioFileReader|AudioFileWriter|AudioFormat|AudioInputStream|AudioPermission|AudioSystem|AuthenticationException|AuthenticationNotSupportedException|Authenticator|AuthPermission|Autoscroll|AWTError|AWTEvent|AWTEventListener|AWTEventListenerProxy|AWTEventMulticaster|AWTException|AWTKeyStroke|AWTPermission|BackingStoreException|BAD_CONTEXT|BAD_INV_ORDER|BAD_OPERATION|BAD_PARAM|BAD_POLICY|BAD_POLICY_TYPE|BAD_POLICY_VALUE|BAD_TYPECODE|BadKind|BadLocationException|BadPaddingException|BandCombineOp|BandedSampleModel|BasicArrowButton|BasicAttribute|BasicAttributes|BasicBorders|BasicButtonListener|BasicButtonUI|BasicCheckBoxMenuItemUI|BasicCheckBoxUI|BasicColorChooserUI|BasicComboBoxEditor|BasicComboBoxRenderer|BasicComboBoxUI|BasicComboPopup|BasicDesktopIconUI|BasicDesktopPaneUI|BasicDirectoryModel|BasicEditorPaneUI|BasicFileChooserUI|BasicFormattedTextFieldUI|BasicGraphicsUtils|BasicHTML|BasicIconFactory|BasicInternalFrameTitlePane|BasicInternalFrameUI|BasicLabelUI|BasicListUI|BasicLookAndFeel|BasicMenuBarUI|BasicMenuItemUI|BasicMenuUI|BasicOptionPaneUI|BasicPanelUI|BasicPasswordFieldUI|BasicPermission|BasicPopupMenuSeparatorUI|BasicPopupMenuUI|BasicProgressBarUI|BasicRadioButtonMenuItemUI|BasicRadioButtonUI|BasicRootPaneUI|BasicScrollBarUI|BasicScrollPaneUI|BasicSeparatorUI|BasicSliderUI|BasicSpinnerUI|BasicSplitPaneDivider|BasicSplitPaneUI|BasicStroke|BasicTabbedPaneUI|BasicTableHeaderUI|BasicTableUI|BasicTextAreaUI|BasicTextFieldUI|BasicTextPaneUI|BasicTextUI|BasicToggleButtonUI|BasicToolBarSeparatorUI|BasicToolBarUI|BasicToolTipUI|BasicTreeUI|BasicViewportUI|BatchUpdateException|BeanContext|BeanContextChild|BeanContextChildComponentProxy|BeanContextChildSupport|BeanContextContainerProxy|BeanContextEvent|BeanContextMembershipEvent|BeanContextMembershipListener|BeanContextProxy|BeanContextServiceAvailableEvent|BeanContextServiceProvider|BeanContextServiceProviderBeanInfo|BeanContextServiceRevokedEvent|BeanContextServiceRevokedListener|BeanContextServices|BeanContextServicesListener|BeanContextServicesSupport|BeanContextSupport|BeanDescriptor|BeanInfo|Beans|BevelBorder|Bidi|BigDecimal|BigInteger|BinaryRefAddr|BindException|Binding|BindingHelper|BindingHolder|BindingIterator|BindingIteratorHelper|BindingIteratorHolder|BindingIteratorOperations|BindingIteratorPOA|BindingListHelper|BindingListHolder|BindingType|BindingTypeHelper|BindingTypeHolder|BitSet|Blob|BlockView|Book|Boolean|BooleanControl|BooleanHolder|BooleanSeqHelper|BooleanSeqHolder|Border|BorderFactory|BorderLayout|BorderUIResource|BoundedRangeModel|Bounds|Box|BoxedValueHelper|BoxLayout|BoxView|BreakIterator|Buffer|BufferCapabilities|BufferedImage|BufferedImageFilter|BufferedImageOp|BufferedInputStream|BufferedOutputStream|BufferedReader|BufferedWriter|BufferOverflowException|BufferStrategy|BufferUnderflowException|Button|ButtonGroup|ButtonModel|ButtonUI|Byte|ByteArrayInputStream|ByteArrayOutputStream|ByteBuffer|ByteChannel|ByteHolder|ByteLookupTable|ByteOrder|Calendar|CallableStatement|Callback|CallbackHandler|CancelablePrintJob|CancelledKeyException|CannotProceed|CannotProceedException|CannotProceedHelper|CannotProceedHolder|CannotRedoException|CannotUndoException|Canvas|CardLayout|Caret|CaretEvent|CaretListener|CDATASection|CellEditor|CellEditorListener|CellRendererPane|Certificate|CertificateEncodingException|CertificateException|CertificateExpiredException|CertificateFactory|CertificateFactorySpi|CertificateNotYetValidException|CertificateParsingException|CertPath|CertPathBuilder|CertPathBuilderException|CertPathBuilderResult|CertPathBuilderSpi|CertPathParameters|CertPathValidator|CertPathValidatorException|CertPathValidatorResult|CertPathValidatorSpi|CertSelector|CertStore|CertStoreException|CertStoreParameters|CertStoreSpi|ChangedCharSetException|ChangeEvent|ChangeListener|Channel|ChannelBinding|Channels|Character|CharacterCodingException|CharacterData|CharacterIterator|CharArrayReader|CharArrayWriter|CharBuffer|CharConversionException|CharHolder|CharSeqHelper|CharSeqHolder|CharSequence|Charset|CharsetDecoder|CharsetEncoder|CharsetProvider|Checkbox|CheckboxGroup|CheckboxMenuItem|CheckedInputStream|CheckedOutputStream|Checksum|Choice|ChoiceCallback|ChoiceFormat|Chromaticity|Cipher|CipherInputStream|CipherOutputStream|CipherSpi|Class|ClassCastException|ClassCircularityError|ClassDesc|ClassFormatError|ClassLoader|ClassNotFoundException|ClientRequestInfo|ClientRequestInfoOperations|ClientRequestInterceptor|ClientRequestInterceptorOperations|Clip|Clipboard|ClipboardOwner|Clob|Cloneable|CloneNotSupportedException|ClosedByInterruptException|ClosedChannelException|ClosedSelectorException|CMMException|Codec|CodecFactory|CodecFactoryHelper|CodecFactoryOperations|CodecOperations|CoderMalfunctionError|CoderResult|CodeSets|CodeSource|CodingErrorAction|CollationElementIterator|CollationKey|Collator|Collection|CollectionCertStoreParameters|Collections|Color|ColorChooserComponentFactory|ColorChooserUI|ColorConvertOp|ColorModel|ColorSelectionModel|ColorSpace|ColorSupported|ColorUIResource|ComboBoxEditor|ComboBoxModel|ComboBoxUI|ComboPopup|COMM_FAILURE|Comment|CommunicationException|Comparable|Comparator|Compiler|CompletionStatus|CompletionStatusHelper|Component|ComponentAdapter|ComponentColorModel|ComponentEvent|ComponentIdHelper|ComponentInputMap|ComponentInputMapUIResource|ComponentListener|ComponentOrientation|ComponentSampleModel|ComponentUI|ComponentView|Composite|CompositeContext|CompositeName|CompositeView|CompoundBorder|CompoundControl|CompoundEdit|CompoundName|Compression|ConcurrentModificationException|Configuration|ConfigurationException|ConfirmationCallback|ConnectException|ConnectIOException|Connection|ConnectionEvent|ConnectionEventListener|ConnectionPendingException|ConnectionPoolDataSource|ConsoleHandler|Constructor|Container|ContainerAdapter|ContainerEvent|ContainerListener|ContainerOrderFocusTraversalPolicy|ContentHandler|ContentHandlerFactory|ContentModel|Context|ContextList|ContextNotEmptyException|ContextualRenderedImageFactory|Control|ControlFactory|ControllerEventListener|ConvolveOp|CookieHolder|Copies|CopiesSupported|CRC32|CredentialExpiredException|CRL|CRLException|CRLSelector|CropImageFilter|CSS|CTX_RESTRICT_SCOPE|CubicCurve2D|Currency|Current|CurrentHelper|CurrentHolder|CurrentOperations|Cursor|Customizer|CustomMarshal|CustomValue|DATA_CONVERSION|DatabaseMetaData|DataBuffer|DataBufferByte|DataBufferDouble|DataBufferFloat|DataBufferInt|DataBufferShort|DataBufferUShort|DataFlavor|DataFormatException|DatagramChannel|DatagramPacket|DatagramSocket|DatagramSocketImpl|DatagramSocketImplFactory|DataInput|DataInputStream|DataLine|DataOutput|DataOutputStream|DataSource|DataTruncation|Date|DateFormat|DateFormatSymbols|DateFormatter|DateTimeAtCompleted|DateTimeAtCreation|DateTimeAtProcessing|DateTimeSyntax|DebugGraphics|DecimalFormat|DecimalFormatSymbols|DeclHandler|DefaultBoundedRangeModel|DefaultButtonModel|DefaultCaret|DefaultCellEditor|DefaultColorSelectionModel|DefaultComboBoxModel|DefaultDesktopManager|DefaultEditorKit|DefaultFocusManager|DefaultFocusTraversalPolicy|DefaultFormatter|DefaultFormatterFactory|DefaultHandler|DefaultHighlighter|DefaultKeyboardFocusManager|DefaultListCellRenderer|DefaultListModel|DefaultListSelectionModel|DefaultMenuLayout|DefaultMetalTheme|DefaultMutableTreeNode|DefaultPersistenceDelegate|DefaultSingleSelectionModel|DefaultStyledDocument|DefaultTableCellRenderer|DefaultTableColumnModel|DefaultTableModel|DefaultTextUI|DefaultTreeCellEditor|DefaultTreeCellRenderer|DefaultTreeModel|DefaultTreeSelectionModel|DefinitionKind|DefinitionKindHelper|Deflater|DeflaterOutputStream|Delegate|DelegationPermission|DESedeKeySpec|DesignMode|DESKeySpec|DesktopIconUI|DesktopManager|DesktopPaneUI|Destination|Destroyable|DestroyFailedException|DGC|DHGenParameterSpec|DHKey|DHParameterSpec|DHPrivateKey|DHPrivateKeySpec|DHPublicKey|DHPublicKeySpec|Dialog|Dictionary|DigestException|DigestInputStream|DigestOutputStream|Dimension|Dimension2D|DimensionUIResource|DirContext|DirectColorModel|DirectoryManager|DirObjectFactory|DirStateFactory|DisplayMode|DnDConstants|Doc|DocAttribute|DocAttributeSet|DocFlavor|DocPrintJob|Document|DocumentBuilder|DocumentBuilderFactory|DocumentEvent|DocumentFilter|DocumentFragment|DocumentHandler|DocumentListener|DocumentName|DocumentParser|DocumentType|DomainCombiner|DomainManager|DomainManagerOperations|DOMException|DOMImplementation|DOMLocator|DOMResult|DOMSource|Double|DoubleBuffer|DoubleHolder|DoubleSeqHelper|DoubleSeqHolder|DragGestureEvent|DragGestureListener|DragGestureRecognizer|DragSource|DragSourceAdapter|DragSourceContext|DragSourceDragEvent|DragSourceDropEvent|DragSourceEvent|DragSourceListener|DragSourceMotionListener|Driver|DriverManager|DriverPropertyInfo|DropTarget|DropTargetAdapter|DropTargetContext|DropTargetDragEvent|DropTargetDropEvent|DropTargetEvent|DropTargetListener|DSAKey|DSAKeyPairGenerator|DSAParameterSpec|DSAParams|DSAPrivateKey|DSAPrivateKeySpec|DSAPublicKey|DSAPublicKeySpec|DTD|DTDConstants|DTDHandler|DuplicateName|DuplicateNameHelper|DynamicImplementation|DynAny|DynAnyFactory|DynAnyFactoryHelper|DynAnyFactoryOperations|DynAnyHelper|DynAnyOperations|DynAnySeqHelper|DynArray|DynArrayHelper|DynArrayOperations|DynEnum|DynEnumHelper|DynEnumOperations|DynFixed|DynFixedHelper|DynFixedOperations|DynSequence|DynSequenceHelper|DynSequenceOperations|DynStruct|DynStructHelper|DynStructOperations|DynUnion|DynUnionHelper|DynUnionOperations|DynValue|DynValueBox|DynValueBoxOperations|DynValueCommon|DynValueCommonOperations|DynValueHelper|DynValueOperations|EditorKit|Element|ElementIterator|Ellipse2D|EmptyBorder|EmptyStackException|EncodedKeySpec|Encoder|Encoding|ENCODING_CDR_ENCAPS|EncryptedPrivateKeyInfo|Entity|EntityReference|EntityResolver|EnumControl|Enumeration|EnumSyntax|Environment|EOFException|Error|ErrorHandler|ErrorListener|ErrorManager|EtchedBorder|Event|EventContext|EventDirContext|EventHandler|EventListener|EventListenerList|EventListenerProxy|EventObject|EventQueue|EventSetDescriptor|Exception|ExceptionInInitializerError|ExceptionList|ExceptionListener|ExemptionMechanism|ExemptionMechanismException|ExemptionMechanismSpi|ExpandVetoException|ExportException|Expression|ExtendedRequest|ExtendedResponse|Externalizable|FactoryConfigurationError|FailedLoginException|FeatureDescriptor|Fidelity|Field|FieldNameHelper|FieldPosition|FieldView|File|FileCacheImageInputStream|FileCacheImageOutputStream|FileChannel|FileChooserUI|FileDescriptor|FileDialog|FileFilter|FileHandler|FileImageInputStream|FileImageOutputStream|FileInputStream|FileLock|FileLockInterruptionException|FilenameFilter|FileNameMap|FileNotFoundException|FileOutputStream|FilePermission|FileReader|FileSystemView|FileView|FileWriter|Filter|FilteredImageSource|FilterInputStream|FilterOutputStream|FilterReader|FilterWriter|Finishings|FixedHeightLayoutCache|FixedHolder|FlatteningPathIterator|FlavorException|FlavorMap|FlavorTable|Float|FloatBuffer|FloatControl|FloatHolder|FloatSeqHelper|FloatSeqHolder|FlowLayout|FlowView|FocusAdapter|FocusEvent|FocusListener|FocusManager|FocusTraversalPolicy|Font|FontFormatException|FontMetrics|FontRenderContext|FontUIResource|Format|FormatConversionProvider|FormatMismatch|FormatMismatchHelper|Formatter|FormView|ForwardRequest|ForwardRequestHelper|Frame|FREE_MEM|GapContent|GatheringByteChannel|GeneralPath|GeneralSecurityException|GlyphJustificationInfo|GlyphMetrics|GlyphVector|GlyphView|GradientPaint|GraphicAttribute|Graphics|Graphics2D|GraphicsConfigTemplate|GraphicsConfiguration|GraphicsDevice|GraphicsEnvironment|GrayFilter|GregorianCalendar|GridBagConstraints|GridBagLayout|GridLayout|Group|GSSContext|GSSCredential|GSSException|GSSManager|GSSName|Guard|GuardedObject|GZIPInputStream|GZIPOutputStream|Handler|HandlerBase|HandshakeCompletedEvent|HandshakeCompletedListener|HasControls|HashAttributeSet|HashDocAttributeSet|HashMap|HashPrintJobAttributeSet|HashPrintRequestAttributeSet|HashPrintServiceAttributeSet|HashSet|Hashtable|HeadlessException|HierarchyBoundsAdapter|HierarchyBoundsListener|HierarchyEvent|HierarchyListener|Highlighter|HostnameVerifier|HTML|HTMLDocument|HTMLEditorKit|HTMLFrameHyperlinkEvent|HTMLWriter|HttpsURLConnection|HttpURLConnection|HyperlinkEvent|HyperlinkListener|ICC_ColorSpace|ICC_Profile|ICC_ProfileGray|ICC_ProfileRGB|Icon|IconUIResource|IconView|ID_ASSIGNMENT_POLICY_ID|ID_UNIQUENESS_POLICY_ID|IdAssignmentPolicy|IdAssignmentPolicyOperations|IdAssignmentPolicyValue|IdentifierHelper|Identity|IdentityHashMap|IdentityScope|IDLEntity|IDLType|IDLTypeHelper|IDLTypeOperations|IdUniquenessPolicy|IdUniquenessPolicyOperations|IdUniquenessPolicyValue|IIOByteBuffer|IIOException|IIOImage|IIOInvalidTreeException|IIOMetadata|IIOMetadataController|IIOMetadataFormat|IIOMetadataFormatImpl|IIOMetadataNode|IIOParam|IIOParamController|IIOReadProgressListener|IIOReadUpdateListener|IIOReadWarningListener|IIORegistry|IIOServiceProvider|IIOWriteProgressListener|IIOWriteWarningListener|IllegalAccessError|IllegalAccessException|IllegalArgumentException|IllegalBlockingModeException|IllegalBlockSizeException|IllegalCharsetNameException|IllegalComponentStateException|IllegalMonitorStateException|IllegalPathStateException|IllegalSelectorException|IllegalStateException|IllegalThreadStateException|Image|ImageCapabilities|ImageConsumer|ImageFilter|ImageGraphicAttribute|ImageIcon|ImageInputStream|ImageInputStreamImpl|ImageInputStreamSpi|ImageIO|ImageObserver|ImageOutputStream|ImageOutputStreamImpl|ImageOutputStreamSpi|ImageProducer|ImageReader|ImageReaderSpi|ImageReaderWriterSpi|ImageReadParam|ImageTranscoder|ImageTranscoderSpi|ImageTypeSpecifier|ImageView|ImageWriteParam|ImageWriter|ImageWriterSpi|ImagingOpException|IMP_LIMIT|IMPLICIT_ACTIVATION_POLICY_ID|ImplicitActivationPolicy|ImplicitActivationPolicyOperations|ImplicitActivationPolicyValue|IncompatibleClassChangeError|InconsistentTypeCode|InconsistentTypeCodeHelper|IndexColorModel|IndexedPropertyDescriptor|IndexOutOfBoundsException|IndirectionException|Inet4Address|Inet6Address|InetAddress|InetSocketAddress|Inflater|InflaterInputStream|InheritableThreadLocal|InitialContext|InitialContextFactory|InitialContextFactoryBuilder|InitialDirContext|INITIALIZE|InitialLdapContext|InlineView|InputContext|InputEvent|InputMap|InputMapUIResource|InputMethod|InputMethodContext|InputMethodDescriptor|InputMethodEvent|InputMethodHighlight|InputMethodListener|InputMethodRequests|InputSource|InputStream|InputStreamReader|InputSubset|InputVerifier|Insets|InsetsUIResource|InstantiationError|InstantiationException|Instrument|InsufficientResourcesException|IntBuffer|Integer|IntegerSyntax|Interceptor|InterceptorOperations|INTERNAL|InternalError|InternalFrameAdapter|InternalFrameEvent|InternalFrameFocusTraversalPolicy|InternalFrameListener|InternalFrameUI|InternationalFormatter|InterruptedException|InterruptedIOException|InterruptedNamingException|InterruptibleChannel|INTF_REPOS|IntHolder|IntrospectionException|Introspector|INV_FLAG|INV_IDENT|INV_OBJREF|INV_POLICY|Invalid|INVALID_TRANSACTION|InvalidAddress|InvalidAddressHelper|InvalidAddressHolder|InvalidAlgorithmParameterException|InvalidAttributeIdentifierException|InvalidAttributesException|InvalidAttributeValueException|InvalidClassException|InvalidDnDOperationException|InvalidKeyException|InvalidKeySpecException|InvalidMarkException|InvalidMidiDataException|InvalidName|InvalidNameException|InvalidNameHelper|InvalidNameHolder|InvalidObjectException|InvalidParameterException|InvalidParameterSpecException|InvalidPolicy|InvalidPolicyHelper|InvalidPreferencesFormatException|InvalidSearchControlsException|InvalidSearchFilterException|InvalidSeq|InvalidSlot|InvalidSlotHelper|InvalidTransactionException|InvalidTypeForEncoding|InvalidTypeForEncodingHelper|InvalidValue|InvalidValueHelper|InvocationEvent|InvocationHandler|InvocationTargetException|InvokeHandler|IOException|IOR|IORHelper|IORHolder|IORInfo|IORInfoOperations|IORInterceptor|IORInterceptorOperations|IRObject|IRObjectOperations|IstringHelper|ItemEvent|ItemListener|ItemSelectable|Iterator|IvParameterSpec|JApplet|JarEntry|JarException|JarFile|JarInputStream|JarOutputStream|JarURLConnection|JButton|JCheckBox|JCheckBoxMenuItem|JColorChooser|JComboBox|JComponent|JDesktopPane|JDialog|JEditorPane|JFileChooser|JFormattedTextField|JFrame|JInternalFrame|JLabel|JLayeredPane|JList|JMenu|JMenuBar|JMenuItem|JobAttributes|JobHoldUntil|JobImpressions|JobImpressionsCompleted|JobImpressionsSupported|JobKOctets|JobKOctetsProcessed|JobKOctetsSupported|JobMediaSheets|JobMediaSheetsCompleted|JobMediaSheetsSupported|JobMessageFromOperator|JobName|JobOriginatingUserName|JobPriority|JobPrioritySupported|JobSheets|JobState|JobStateReason|JobStateReasons|JOptionPane|JPanel|JPasswordField|JPEGHuffmanTable|JPEGImageReadParam|JPEGImageWriteParam|JPEGQTable|JPopupMenu|JProgressBar|JRadioButton|JRadioButtonMenuItem|JRootPane|JScrollBar|JScrollPane|JSeparator|JSlider|JSpinner|JSplitPane|JTabbedPane|JTable|JTableHeader|JTextArea|JTextComponent|JTextField|JTextPane|JToggleButton|JToolBar|JToolTip|JTree|JViewport|JWindow|KerberosKey|KerberosPrincipal|KerberosTicket|Kernel|Key|KeyAdapter|KeyAgreement|KeyAgreementSpi|KeyboardFocusManager|KeyEvent|KeyEventDispatcher|KeyEventPostProcessor|KeyException|KeyFactory|KeyFactorySpi|KeyGenerator|KeyGeneratorSpi|KeyListener|KeyManagementException|KeyManager|KeyManagerFactory|KeyManagerFactorySpi|Keymap|KeyPair|KeyPairGenerator|KeyPairGeneratorSpi|KeySpec|KeyStore|KeyStoreException|KeyStoreSpi|KeyStroke|Label|LabelUI|LabelView|LanguageCallback|LastOwnerException|LayeredHighlighter|LayoutFocusTraversalPolicy|LayoutManager|LayoutManager2|LayoutQueue|LDAPCertStoreParameters|LdapContext|LdapReferralException|Lease|Level|LexicalHandler|LIFESPAN_POLICY_ID|LifespanPolicy|LifespanPolicyOperations|LifespanPolicyValue|LimitExceededException|Line|Line2D|LineBorder|LineBreakMeasurer|LineEvent|LineListener|LineMetrics|LineNumberInputStream|LineNumberReader|LineUnavailableException|LinkageError|LinkedHashMap|LinkedHashSet|LinkedList|LinkException|LinkLoopException|LinkRef|List|ListCellRenderer|ListDataEvent|ListDataListener|ListIterator|ListModel|ListResourceBundle|ListSelectionEvent|ListSelectionListener|ListSelectionModel|ListUI|ListView|LoaderHandler|Locale|LocalObject|LocateRegistry|LOCATION_FORWARD|Locator|LocatorImpl|Logger|LoggingPermission|LoginContext|LoginException|LoginModule|LogManager|LogRecord|LogStream|Long|LongBuffer|LongHolder|LongLongSeqHelper|LongLongSeqHolder|LongSeqHelper|LongSeqHolder|LookAndFeel|LookupOp|LookupTable|Mac|MacSpi|MalformedInputException|MalformedLinkException|MalformedURLException|ManagerFactoryParameters|Manifest|Map|MappedByteBuffer|MARSHAL|MarshalException|MarshalledObject|MaskFormatter|Matcher|Math|MatteBorder|Media|MediaName|MediaPrintableArea|MediaSize|MediaSizeName|MediaTracker|MediaTray|Member|MemoryCacheImageInputStream|MemoryCacheImageOutputStream|MemoryHandler|MemoryImageSource|Menu|MenuBar|MenuBarUI|MenuComponent|MenuContainer|MenuDragMouseEvent|MenuDragMouseListener|MenuElement|MenuEvent|MenuItem|MenuItemUI|MenuKeyEvent|MenuKeyListener|MenuListener|MenuSelectionManager|MenuShortcut|MessageDigest|MessageDigestSpi|MessageFormat|MessageProp|MetaEventListener|MetalBorders|MetalButtonUI|MetalCheckBoxIcon|MetalCheckBoxUI|MetalComboBoxButton|MetalComboBoxEditor|MetalComboBoxIcon|MetalComboBoxUI|MetalDesktopIconUI|MetalFileChooserUI|MetalIconFactory|MetalInternalFrameTitlePane|MetalInternalFrameUI|MetalLabelUI|MetalLookAndFeel|MetalPopupMenuSeparatorUI|MetalProgressBarUI|MetalRadioButtonUI|MetalRootPaneUI|MetalScrollBarUI|MetalScrollButton|MetalScrollPaneUI|MetalSeparatorUI|MetalSliderUI|MetalSplitPaneUI|MetalTabbedPaneUI|MetalTextFieldUI|MetalTheme|MetalToggleButtonUI|MetalToolBarUI|MetalToolTipUI|MetalTreeUI|MetaMessage|Method|MethodDescriptor|MidiChannel|MidiDevice|MidiDeviceProvider|MidiEvent|MidiFileFormat|MidiFileReader|MidiFileWriter|MidiMessage|MidiSystem|MidiUnavailableException|MimeTypeParseException|MinimalHTMLWriter|MissingResourceException|Mixer|MixerProvider|ModificationItem|Modifier|MouseAdapter|MouseDragGestureRecognizer|MouseEvent|MouseInputAdapter|MouseInputListener|MouseListener|MouseMotionAdapter|MouseMotionListener|MouseWheelEvent|MouseWheelListener|MultiButtonUI|MulticastSocket|MultiColorChooserUI|MultiComboBoxUI|MultiDesktopIconUI|MultiDesktopPaneUI|MultiDoc|MultiDocPrintJob|MultiDocPrintService|MultiFileChooserUI|MultiInternalFrameUI|MultiLabelUI|MultiListUI|MultiLookAndFeel|MultiMenuBarUI|MultiMenuItemUI|MultiOptionPaneUI|MultiPanelUI|MultiPixelPackedSampleModel|MultipleComponentProfileHelper|MultipleComponentProfileHolder|MultipleDocumentHandling|MultipleMaster|MultiPopupMenuUI|MultiProgressBarUI|MultiRootPaneUI|MultiScrollBarUI|MultiScrollPaneUI|MultiSeparatorUI|MultiSliderUI|MultiSpinnerUI|MultiSplitPaneUI|MultiTabbedPaneUI|MultiTableHeaderUI|MultiTableUI|MultiTextUI|MultiToolBarUI|MultiToolTipUI|MultiTreeUI|MultiViewportUI|MutableAttributeSet|MutableComboBoxModel|MutableTreeNode|Name|NameAlreadyBoundException|NameCallback|NameClassPair|NameComponent|NameComponentHelper|NameComponentHolder|NamedNodeMap|NamedValue|NameDynAnyPair|NameDynAnyPairHelper|NameDynAnyPairSeqHelper|NameHelper|NameHolder|NameNotFoundException|NameParser|NamespaceChangeListener|NamespaceSupport|NameValuePair|NameValuePairHelper|NameValuePairSeqHelper|Naming|NamingContext|NamingContextExt|NamingContextExtHelper|NamingContextExtHolder|NamingContextExtOperations|NamingContextExtPOA|NamingContextHelper|NamingContextHolder|NamingContextOperations|NamingContextPOA|NamingEnumeration|NamingEvent|NamingException|NamingExceptionEvent|NamingListener|NamingManager|NamingSecurityException|NavigationFilter|NegativeArraySizeException|NetPermission|NetworkInterface|NO_IMPLEMENT|NO_MEMORY|NO_PERMISSION|NO_RESOURCES|NO_RESPONSE|NoClassDefFoundError|NoConnectionPendingException|NoContext|NoContextHelper|Node|NodeChangeEvent|NodeChangeListener|NodeList|NoInitialContextException|NoninvertibleTransformException|NonReadableChannelException|NonWritableChannelException|NoPermissionException|NoRouteToHostException|NoServant|NoServantHelper|NoSuchAlgorithmException|NoSuchAttributeException|NoSuchElementException|NoSuchFieldError|NoSuchFieldException|NoSuchMethodError|NoSuchMethodException|NoSuchObjectException|NoSuchPaddingException|NoSuchProviderException|NotActiveException|Notation|NotBoundException|NotContextException|NotEmpty|NotEmptyHelper|NotEmptyHolder|NotFound|NotFoundHelper|NotFoundHolder|NotFoundReason|NotFoundReasonHelper|NotFoundReasonHolder|NotOwnerException|NotSerializableException|NotYetBoundException|NotYetConnectedException|NullCipher|NullPointerException|Number|NumberFormat|NumberFormatException|NumberFormatter|NumberOfDocuments|NumberOfInterveningJobs|NumberUp|NumberUpSupported|NumericShaper|NVList|OBJ_ADAPTER|Object|OBJECT_NOT_EXIST|ObjectAlreadyActive|ObjectAlreadyActiveHelper|ObjectChangeListener|ObjectFactory|ObjectFactoryBuilder|ObjectHelper|ObjectHolder|ObjectIdHelper|ObjectImpl|ObjectInput|ObjectInputStream|ObjectInputValidation|ObjectNotActive|ObjectNotActiveHelper|ObjectOutput|ObjectOutputStream|ObjectStreamClass|ObjectStreamConstants|ObjectStreamException|ObjectStreamField|ObjectView|ObjID|Observable|Observer|OctetSeqHelper|OctetSeqHolder|Oid|OMGVMCID|OpenType|Operation|OperationNotSupportedException|Option|OptionalDataException|OptionPaneUI|ORB|ORBInitializer|ORBInitializerOperations|ORBInitInfo|ORBInitInfoOperations|OrientationRequested|OutOfMemoryError|OutputDeviceAssigned|OutputKeys|OutputStream|OutputStreamWriter|OverlappingFileLockException|OverlayLayout|Owner|Package|PackedColorModel|Pageable|PageAttributes|PageFormat|PageRanges|PagesPerMinute|PagesPerMinuteColor|Paint|PaintContext|PaintEvent|Panel|PanelUI|Paper|ParagraphView|Parameter|ParameterBlock|ParameterDescriptor|ParameterMetaData|ParameterMode|ParameterModeHelper|ParameterModeHolder|ParseException|ParsePosition|Parser|ParserAdapter|ParserConfigurationException|ParserDelegator|ParserFactory|PartialResultException|PasswordAuthentication|PasswordCallback|PasswordView|Patch|PathIterator|Pattern|PatternSyntaxException|PBEKey|PBEKeySpec|PBEParameterSpec|PDLOverrideSupported|Permission|PermissionCollection|Permissions|PERSIST_STORE|PersistenceDelegate|PhantomReference|Pipe|PipedInputStream|PipedOutputStream|PipedReader|PipedWriter|PixelGrabber|PixelInterleavedSampleModel|PKCS8EncodedKeySpec|PKIXBuilderParameters|PKIXCertPathBuilderResult|PKIXCertPathChecker|PKIXCertPathValidatorResult|PKIXParameters|PlainDocument|PlainView|POA|POAHelper|POAManager|POAManagerOperations|POAOperations|Point|Point2D|Policy|PolicyError|PolicyErrorCodeHelper|PolicyErrorHelper|PolicyErrorHolder|PolicyFactory|PolicyFactoryOperations|PolicyHelper|PolicyHolder|PolicyListHelper|PolicyListHolder|PolicyNode|PolicyOperations|PolicyQualifierInfo|PolicyTypeHelper|Polygon|PooledConnection|Popup|PopupFactory|PopupMenu|PopupMenuEvent|PopupMenuListener|PopupMenuUI|Port|PortableRemoteObject|PortableRemoteObjectDelegate|PortUnreachableException|Position|PreferenceChangeEvent|PreferenceChangeListener|Preferences|PreferencesFactory|PreparedStatement|PresentationDirection|Principal|PrincipalHolder|Printable|PrinterAbortException|PrinterException|PrinterGraphics|PrinterInfo|PrinterIOException|PrinterIsAcceptingJobs|PrinterJob|PrinterLocation|PrinterMakeAndModel|PrinterMessageFromOperator|PrinterMoreInfo|PrinterMoreInfoManufacturer|PrinterName|PrinterResolution|PrinterState|PrinterStateReason|PrinterStateReasons|PrinterURI|PrintEvent|PrintException|PrintGraphics|PrintJob|PrintJobAdapter|PrintJobAttribute|PrintJobAttributeEvent|PrintJobAttributeListener|PrintJobAttributeSet|PrintJobEvent|PrintJobListener|PrintQuality|PrintRequestAttribute|PrintRequestAttributeSet|PrintService|PrintServiceAttribute|PrintServiceAttributeEvent|PrintServiceAttributeListener|PrintServiceAttributeSet|PrintServiceLookup|PrintStream|PrintWriter|PRIVATE_MEMBER|PrivateCredentialPermission|PrivateKey|PrivilegedAction|PrivilegedActionException|PrivilegedExceptionAction|Process|ProcessingInstruction|ProfileDataException|ProfileIdHelper|ProgressBarUI|ProgressMonitor|ProgressMonitorInputStream|Properties|PropertyChangeEvent|PropertyChangeListener|PropertyChangeListenerProxy|PropertyChangeSupport|PropertyDescriptor|PropertyEditor|PropertyEditorManager|PropertyEditorSupport|PropertyPermission|PropertyResourceBundle|PropertyVetoException|ProtectionDomain|ProtocolException|Provider|ProviderException|Proxy|PSSParameterSpec|PUBLIC_MEMBER|PublicKey|PushbackInputStream|PushbackReader|QuadCurve2D|QueuedJobCount|Random|RandomAccess|RandomAccessFile|Raster|RasterFormatException|RasterOp|RC2ParameterSpec|RC5ParameterSpec|ReadableByteChannel|Reader|ReadOnlyBufferException|Receiver|Rectangle|Rectangle2D|RectangularShape|Ref|RefAddr|Reference|Referenceable|ReferenceQueue|ReferenceUriSchemesSupported|ReferralException|ReflectPermission|Refreshable|RefreshFailedException|RegisterableService|Registry|RegistryHandler|RemarshalException|Remote|RemoteCall|RemoteException|RemoteObject|RemoteRef|RemoteServer|RemoteStub|RenderableImage|RenderableImageOp|RenderableImageProducer|RenderContext|RenderedImage|RenderedImageFactory|Renderer|RenderingHints|RepaintManager|ReplicateScaleFilter|RepositoryIdHelper|Request|REQUEST_PROCESSING_POLICY_ID|RequestInfo|RequestInfoOperations|RequestingUserName|RequestProcessingPolicy|RequestProcessingPolicyOperations|RequestProcessingPolicyValue|RescaleOp|ResolutionSyntax|Resolver|ResolveResult|ResourceBundle|ResponseHandler|Result|ResultSet|ResultSetMetaData|ReverbType|RGBImageFilter|RMIClassLoader|RMIClassLoaderSpi|RMIClientSocketFactory|RMIFailureHandler|RMISecurityException|RMISecurityManager|RMIServerSocketFactory|RMISocketFactory|Robot|RootPaneContainer|RootPaneUI|RoundRectangle2D|RowMapper|RowSet|RowSetEvent|RowSetInternal|RowSetListener|RowSetMetaData|RowSetReader|RowSetWriter|RSAKey|RSAKeyGenParameterSpec|RSAMultiPrimePrivateCrtKey|RSAMultiPrimePrivateCrtKeySpec|RSAOtherPrimeInfo|RSAPrivateCrtKey|RSAPrivateCrtKeySpec|RSAPrivateKey|RSAPrivateKeySpec|RSAPublicKey|RSAPublicKeySpec|RTFEditorKit|RuleBasedCollator|Runnable|Runtime|RunTime|RuntimeException|RunTimeOperations|RuntimePermission|SampleModel|Savepoint|SAXException|SAXNotRecognizedException|SAXNotSupportedException|SAXParseException|SAXParser|SAXParserFactory|SAXResult|SAXSource|SAXTransformerFactory|ScatteringByteChannel|SchemaViolationException|Scrollable|Scrollbar|ScrollBarUI|ScrollPane|ScrollPaneAdjustable|ScrollPaneConstants|ScrollPaneLayout|ScrollPaneUI|SealedObject|SearchControls|SearchResult|SecretKey|SecretKeyFactory|SecretKeyFactorySpi|SecretKeySpec|SecureClassLoader|SecureRandom|SecureRandomSpi|Security|SecurityException|SecurityManager|SecurityPermission|Segment|SelectableChannel|SelectionKey|Selector|SelectorProvider|SeparatorUI|Sequence|SequenceInputStream|Sequencer|Serializable|SerializablePermission|Servant|SERVANT_RETENTION_POLICY_ID|ServantActivator|ServantActivatorHelper|ServantActivatorOperations|ServantActivatorPOA|ServantAlreadyActive|ServantAlreadyActiveHelper|ServantLocator|ServantLocatorHelper|ServantLocatorOperations|ServantLocatorPOA|ServantManager|ServantManagerOperations|ServantNotActive|ServantNotActiveHelper|ServantObject|ServantRetentionPolicy|ServantRetentionPolicyOperations|ServantRetentionPolicyValue|ServerCloneException|ServerError|ServerException|ServerNotActiveException|ServerRef|ServerRequest|ServerRequestInfo|ServerRequestInfoOperations|ServerRequestInterceptor|ServerRequestInterceptorOperations|ServerRuntimeException|ServerSocket|ServerSocketChannel|ServerSocketFactory|ServiceContext|ServiceContextHelper|ServiceContextHolder|ServiceContextListHelper|ServiceContextListHolder|ServiceDetail|ServiceDetailHelper|ServiceIdHelper|ServiceInformation|ServiceInformationHelper|ServiceInformationHolder|ServicePermission|ServiceRegistry|ServiceUI|ServiceUIFactory|ServiceUnavailableException|Set|SetOfIntegerSyntax|SetOverrideType|SetOverrideTypeHelper|Severity|Shape|ShapeGraphicAttribute|SheetCollate|Short|ShortBuffer|ShortBufferException|ShortHolder|ShortLookupTable|ShortMessage|ShortSeqHelper|ShortSeqHolder|Sides|Signature|SignatureException|SignatureSpi|SignedObject|Signer|SimpleAttributeSet|SimpleBeanInfo|SimpleDateFormat|SimpleDoc|SimpleFormatter|SimpleTimeZone|SinglePixelPackedSampleModel|SingleSelectionModel|Size2DSyntax|SizeLimitExceededException|SizeRequirements|SizeSequence|Skeleton|SkeletonMismatchException|SkeletonNotFoundException|SliderUI|Socket|SocketAddress|SocketChannel|SocketException|SocketFactory|SocketHandler|SocketImpl|SocketImplFactory|SocketOptions|SocketPermission|SocketSecurityException|SocketTimeoutException|SoftBevelBorder|SoftReference|SortedMap|SortedSet|SortingFocusTraversalPolicy|Soundbank|SoundbankReader|SoundbankResource|Source|SourceDataLine|SourceLocator|SpinnerDateModel|SpinnerListModel|SpinnerModel|SpinnerNumberModel|SpinnerUI|SplitPaneUI|Spring|SpringLayout|SQLData|SQLException|SQLInput|SQLOutput|SQLPermission|SQLWarning|SSLContext|SSLContextSpi|SSLException|SSLHandshakeException|SSLKeyException|SSLPeerUnverifiedException|SSLPermission|SSLProtocolException|SSLServerSocket|SSLServerSocketFactory|SSLSession|SSLSessionBindingEvent|SSLSessionBindingListener|SSLSessionContext|SSLSocket|SSLSocketFactory|Stack|StackOverflowError|StackTraceElement|StartTlsRequest|StartTlsResponse|State|StateEdit|StateEditable|StateFactory|Statement|Streamable|StreamableValue|StreamCorruptedException|StreamHandler|StreamPrintService|StreamPrintServiceFactory|StreamResult|StreamSource|StreamTokenizer|StrictMath|String|StringBuffer|StringBufferInputStream|StringCharacterIterator|StringContent|StringHolder|StringIndexOutOfBoundsException|StringNameHelper|StringReader|StringRefAddr|StringSelection|StringSeqHelper|StringSeqHolder|StringTokenizer|StringValueHelper|StringWriter|Stroke|Struct|StructMember|StructMemberHelper|Stub|StubDelegate|StubNotFoundException|Style|StyleConstants|StyleContext|StyledDocument|StyledEditorKit|StyleSheet|Subject|SubjectDomainCombiner|SUCCESSFUL|SupportedValuesAttribute|SwingConstants|SwingPropertyChangeSupport|SwingUtilities|SYNC_WITH_TRANSPORT|SyncFailedException|SyncScopeHelper|Synthesizer|SysexMessage|System|SYSTEM_EXCEPTION|SystemColor|SystemException|SystemFlavorMap|TabableView|TabbedPaneUI|TabExpander|TableCellEditor|TableCellRenderer|TableColumn|TableColumnModel|TableColumnModelEvent|TableColumnModelListener|TableHeaderUI|TableModel|TableModelEvent|TableModelListener|TableUI|TableView|TabSet|TabStop|TAG_ALTERNATE_IIOP_ADDRESS|TAG_CODE_SETS|TAG_INTERNET_IOP|TAG_JAVA_CODEBASE|TAG_MULTIPLE_COMPONENTS|TAG_ORB_TYPE|TAG_POLICIES|TagElement|TaggedComponent|TaggedComponentHelper|TaggedComponentHolder|TaggedProfile|TaggedProfileHelper|TaggedProfileHolder|TargetDataLine|TCKind|Templates|TemplatesHandler|Text|TextAction|TextArea|TextAttribute|TextComponent|TextEvent|TextField|TextHitInfo|TextInputCallback|TextLayout|TextListener|TextMeasurer|TextOutputCallback|TextSyntax|TextUI|TexturePaint|Thread|THREAD_POLICY_ID|ThreadDeath|ThreadGroup|ThreadLocal|ThreadPolicy|ThreadPolicyOperations|ThreadPolicyValue|Throwable|Tie|TileObserver|Time|TimeLimitExceededException|Timer|TimerTask|Timestamp|TimeZone|TitledBorder|ToolBarUI|Toolkit|ToolTipManager|ToolTipUI|TooManyListenersException|Track|TRANSACTION_REQUIRED|TRANSACTION_ROLLEDBACK|TransactionRequiredException|TransactionRolledbackException|TransactionService|Transferable|TransferHandler|TransformAttribute|Transformer|TransformerConfigurationException|TransformerException|TransformerFactory|TransformerFactoryConfigurationError|TransformerHandler|TRANSIENT|Transmitter|Transparency|TRANSPORT_RETRY|TreeCellEditor|TreeCellRenderer|TreeExpansionEvent|TreeExpansionListener|TreeMap|TreeModel|TreeModelEvent|TreeModelListener|TreeNode|TreePath|TreeSelectionEvent|TreeSelectionListener|TreeSelectionModel|TreeSet|TreeUI|TreeWillExpandListener|TrustAnchor|TrustManager|TrustManagerFactory|TrustManagerFactorySpi|TypeCode|TypeCodeHolder|TypeMismatch|TypeMismatchHelper|Types|UID|UIDefaults|UIManager|UIResource|ULongLongSeqHelper|ULongLongSeqHolder|ULongSeqHelper|ULongSeqHolder|UndeclaredThrowableException|UndoableEdit|UndoableEditEvent|UndoableEditListener|UndoableEditSupport|UndoManager|UnexpectedException|UnicastRemoteObject|UnionMember|UnionMemberHelper|UNKNOWN|UnknownEncoding|UnknownEncodingHelper|UnknownError|UnknownException|UnknownGroupException|UnknownHostException|UnknownObjectException|UnknownServiceException|UnknownUserException|UnknownUserExceptionHelper|UnknownUserExceptionHolder|UnmappableCharacterException|UnmarshalException|UnmodifiableSetException|UnrecoverableKeyException|Unreferenced|UnresolvedAddressException|UnresolvedPermission|UnsatisfiedLinkError|UnsolicitedNotification|UnsolicitedNotificationEvent|UnsolicitedNotificationListener|UNSUPPORTED_POLICY|UNSUPPORTED_POLICY_VALUE|UnsupportedAddressTypeException|UnsupportedAudioFileException|UnsupportedCallbackException|UnsupportedCharsetException|UnsupportedClassVersionError|UnsupportedEncodingException|UnsupportedFlavorException|UnsupportedLookAndFeelException|UnsupportedOperationException|URI|URIException|URIResolver|URISyntax|URISyntaxException|URL|URLClassLoader|URLConnection|URLDecoder|URLEncoder|URLStreamHandler|URLStreamHandlerFactory|URLStringHelper|USER_EXCEPTION|UserException|UShortSeqHelper|UShortSeqHolder|UTFDataFormatException|Util|UtilDelegate|Utilities|ValueBase|ValueBaseHelper|ValueBaseHolder|ValueFactory|ValueHandler|ValueMember|ValueMemberHelper|VariableHeightLayoutCache|Vector|VerifyError|VersionSpecHelper|VetoableChangeListener|VetoableChangeListenerProxy|VetoableChangeSupport|View|ViewFactory|ViewportLayout|ViewportUI|VirtualMachineError|Visibility|VisibilityHelper|VM_ABSTRACT|VM_CUSTOM|VM_NONE|VM_TRUNCATABLE|VMID|VoiceStatus|Void|VolatileImage|WCharSeqHelper|WCharSeqHolder|WeakHashMap|WeakReference|Window|WindowAdapter|WindowConstants|WindowEvent|WindowFocusListener|WindowListener|WindowStateListener|WrappedPlainView|WritableByteChannel|WritableRaster|WritableRenderedImage|WriteAbortedException|Writer|WrongAdapter|WrongAdapterHelper|WrongPolicy|WrongPolicyHelper|WrongTransaction|WrongTransactionHelper|WrongTransactionHolder|WStringSeqHelper|WStringSeqHolder|WStringValueHelper|X500Principal|X500PrivateCredential|X509Certificate|X509CertSelector|X509CRL|X509CRLEntry|X509CRLSelector|X509EncodedKeySpec|X509Extension|X509KeyManager|X509TrustManager|XAConnection|XADataSource|XAException|XAResource|Xid|XMLDecoder|XMLEncoder|XMLFilter|XMLFilterImpl|XMLFormatter|XMLReader|XMLReaderAdapter|XMLReaderFactory|ZipEntry|ZipException|ZipFile|ZipInputStream|ZipOutputStream|ZoneView|_BindingIteratorImplBase|_BindingIteratorStub|_DynAnyFactoryStub|_DynAnyStub|_DynArrayStub|_DynEnumStub|_DynFixedStub|_DynSequenceStub|_DynStructStub|_DynUnionStub|_DynValueStub|_IDLTypeStub|_NamingContextExtStub|_NamingContextImplBase|_NamingContextStub|_PolicyStub|_Remote_Stub|_ServantActivatorStub|_ServantLocatorStub)$/
|
|
2087
|
+
},
|
|
2088
|
+
{},
|
|
2089
|
+
{},
|
|
2090
|
+
{},
|
|
2091
|
+
{},
|
|
2092
|
+
{}
|
|
2093
|
+
],
|
|
2094
|
+
0: [],
|
|
2095
|
+
1: [],
|
|
2096
|
+
2: [],
|
|
2097
|
+
3: [],
|
|
2098
|
+
4: [],
|
|
2099
|
+
5: [{}],
|
|
2100
|
+
6: [{}, {}, {}, {}, {}],
|
|
2101
|
+
7: [],
|
|
2102
|
+
8: [],
|
|
2103
|
+
9: [],
|
|
2104
|
+
10: [],
|
|
2105
|
+
11: [],
|
|
2106
|
+
12: []
|
|
2107
|
+
},
|
|
2108
|
+
kwmap: {
|
|
2109
|
+
types: "types",
|
|
2110
|
+
reserved: "reserved",
|
|
2111
|
+
builtin: "builtin"
|
|
2112
|
+
},
|
|
2113
|
+
parts: {
|
|
2114
|
+
0: [null, null, null, null, null, null, null, null, null, null, null, null, null],
|
|
2115
|
+
1: [null, null, null, null, null, null, null, null, null, null, null, null, null],
|
|
2116
|
+
2: [null, null, null, null, null, null, null, null, null, null, null, null, null],
|
|
2117
|
+
3: [null, null, null, null, null],
|
|
2118
|
+
4: [null],
|
|
2119
|
+
5: [null],
|
|
2120
|
+
6: [null, null, null, null, null]
|
|
2121
|
+
},
|
|
2122
|
+
subst: {
|
|
2123
|
+
[-1]: [
|
|
2124
|
+
false,
|
|
2125
|
+
false,
|
|
2126
|
+
false,
|
|
2127
|
+
false,
|
|
2128
|
+
false,
|
|
2129
|
+
false,
|
|
2130
|
+
false,
|
|
2131
|
+
false,
|
|
2132
|
+
false,
|
|
2133
|
+
false,
|
|
2134
|
+
false,
|
|
2135
|
+
false,
|
|
2136
|
+
false
|
|
2137
|
+
],
|
|
2138
|
+
0: [false, false, false, false, false, false, false, false, false, false, false, false, false],
|
|
2139
|
+
1: [false, false, false, false, false, false, false, false, false, false, false, false, false],
|
|
2140
|
+
2: [false, false, false, false, false, false, false, false, false, false, false, false, false],
|
|
2141
|
+
3: [false, false, false, false, false],
|
|
2142
|
+
4: [false],
|
|
2143
|
+
5: [false],
|
|
2144
|
+
6: [false, false, false, false, false]
|
|
2145
|
+
}
|
|
2146
|
+
};
|
|
2147
|
+
|
|
2148
|
+
// packages/render/src/libs/highlighter/languages/javascript.ts
|
|
2149
|
+
var javascriptLang = {
|
|
2150
|
+
language: "javascript",
|
|
2151
|
+
defClass: "code",
|
|
2152
|
+
regs: {
|
|
2153
|
+
[-1]: /(\{)|(\()|(\[)|(\/\*)|(")|(')|(\/\/)|(\/)|([a-z_]\w*)|(\d*\.?\d+)/gi,
|
|
2154
|
+
0: /(\{)|(\()|(\[)|(\/\*)|(")|(')|(\/\/)|(\/)|([a-z_]\w*)|(\d*\.?\d+)/gi,
|
|
2155
|
+
1: /(\{)|(\()|(\[)|(\/\*)|(")|(')|(\/\/)|(\/)|([a-z_]\w*)|(\d*\.?\d+)/gi,
|
|
2156
|
+
2: /(\{)|(\()|(\[)|(\/\*)|(")|(')|(\/\/)|(\/)|([a-z_]\w*)|(\d*\.?\d+)/gi,
|
|
2157
|
+
3: /(((https?|ftp):\/\/[\w?.\-&=/%+]+)|(^|[\s,!?])www\.\w+\.\w+[\w?.&=/%+]*)|(\w+[.\w-]+@(\w+[.\w-])+)|(\b(note|fixme):)|(\$\w+:.+\$)/gim,
|
|
2158
|
+
4: /(\\\\|\\"|\\'|\\`|\\t|\\n|\\r)/gi,
|
|
2159
|
+
5: /(\\\\|\\"|\\'|\\`)/gi,
|
|
2160
|
+
6: /(((https?|ftp):\/\/[\w?.\-&=/%+]+)|(^|[\s,!?])www\.\w+\.\w+[\w?.&=/%+]*)|(\w+[.\w-]+@(\w+[.\w-])+)|(\b(note|fixme):)|(\$\w+:.+\$)/gim,
|
|
2161
|
+
7: /(\\\/)/gi
|
|
2162
|
+
},
|
|
2163
|
+
counts: {
|
|
2164
|
+
[-1]: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
2165
|
+
0: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
2166
|
+
1: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
2167
|
+
2: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
2168
|
+
3: [3, 1, 1, 0],
|
|
2169
|
+
4: [0],
|
|
2170
|
+
5: [0],
|
|
2171
|
+
6: [3, 1, 1, 0],
|
|
2172
|
+
7: [0]
|
|
2173
|
+
},
|
|
2174
|
+
delim: {
|
|
2175
|
+
[-1]: [
|
|
2176
|
+
"brackets",
|
|
2177
|
+
"brackets",
|
|
2178
|
+
"brackets",
|
|
2179
|
+
"comment",
|
|
2180
|
+
"quotes",
|
|
2181
|
+
"quotes",
|
|
2182
|
+
"comment",
|
|
2183
|
+
"quotes",
|
|
2184
|
+
"",
|
|
2185
|
+
""
|
|
2186
|
+
],
|
|
2187
|
+
0: [
|
|
2188
|
+
"brackets",
|
|
2189
|
+
"brackets",
|
|
2190
|
+
"brackets",
|
|
2191
|
+
"comment",
|
|
2192
|
+
"quotes",
|
|
2193
|
+
"quotes",
|
|
2194
|
+
"comment",
|
|
2195
|
+
"quotes",
|
|
2196
|
+
"",
|
|
2197
|
+
""
|
|
2198
|
+
],
|
|
2199
|
+
1: [
|
|
2200
|
+
"brackets",
|
|
2201
|
+
"brackets",
|
|
2202
|
+
"brackets",
|
|
2203
|
+
"comment",
|
|
2204
|
+
"quotes",
|
|
2205
|
+
"quotes",
|
|
2206
|
+
"comment",
|
|
2207
|
+
"quotes",
|
|
2208
|
+
"",
|
|
2209
|
+
""
|
|
2210
|
+
],
|
|
2211
|
+
2: [
|
|
2212
|
+
"brackets",
|
|
2213
|
+
"brackets",
|
|
2214
|
+
"brackets",
|
|
2215
|
+
"comment",
|
|
2216
|
+
"quotes",
|
|
2217
|
+
"quotes",
|
|
2218
|
+
"comment",
|
|
2219
|
+
"quotes",
|
|
2220
|
+
"",
|
|
2221
|
+
""
|
|
2222
|
+
],
|
|
2223
|
+
3: ["", "", "", ""],
|
|
2224
|
+
4: [""],
|
|
2225
|
+
5: [""],
|
|
2226
|
+
6: ["", "", "", ""],
|
|
2227
|
+
7: [""]
|
|
2228
|
+
},
|
|
2229
|
+
inner: {
|
|
2230
|
+
[-1]: [
|
|
2231
|
+
"code",
|
|
2232
|
+
"code",
|
|
2233
|
+
"code",
|
|
2234
|
+
"comment",
|
|
2235
|
+
"string",
|
|
2236
|
+
"string",
|
|
2237
|
+
"comment",
|
|
2238
|
+
"string",
|
|
2239
|
+
"identifier",
|
|
2240
|
+
"number"
|
|
2241
|
+
],
|
|
2242
|
+
0: [
|
|
2243
|
+
"code",
|
|
2244
|
+
"code",
|
|
2245
|
+
"code",
|
|
2246
|
+
"comment",
|
|
2247
|
+
"string",
|
|
2248
|
+
"string",
|
|
2249
|
+
"comment",
|
|
2250
|
+
"string",
|
|
2251
|
+
"identifier",
|
|
2252
|
+
"number"
|
|
2253
|
+
],
|
|
2254
|
+
1: [
|
|
2255
|
+
"code",
|
|
2256
|
+
"code",
|
|
2257
|
+
"code",
|
|
2258
|
+
"comment",
|
|
2259
|
+
"string",
|
|
2260
|
+
"string",
|
|
2261
|
+
"comment",
|
|
2262
|
+
"string",
|
|
2263
|
+
"identifier",
|
|
2264
|
+
"number"
|
|
2265
|
+
],
|
|
2266
|
+
2: [
|
|
2267
|
+
"code",
|
|
2268
|
+
"code",
|
|
2269
|
+
"code",
|
|
2270
|
+
"comment",
|
|
2271
|
+
"string",
|
|
2272
|
+
"string",
|
|
2273
|
+
"comment",
|
|
2274
|
+
"string",
|
|
2275
|
+
"identifier",
|
|
2276
|
+
"number"
|
|
2277
|
+
],
|
|
2278
|
+
3: ["url", "url", "inlinedoc", "inlinedoc"],
|
|
2279
|
+
4: ["special"],
|
|
2280
|
+
5: ["special"],
|
|
2281
|
+
6: ["url", "url", "inlinedoc", "inlinedoc"],
|
|
2282
|
+
7: ["special"]
|
|
2283
|
+
},
|
|
2284
|
+
end: {
|
|
2285
|
+
0: /\}/gi,
|
|
2286
|
+
1: /\)/gi,
|
|
2287
|
+
2: /\]/gi,
|
|
2288
|
+
3: /\*\//gi,
|
|
2289
|
+
4: /"/gi,
|
|
2290
|
+
5: /'/gi,
|
|
2291
|
+
6: /$/gim,
|
|
2292
|
+
7: /\/g?i?/g
|
|
2293
|
+
},
|
|
2294
|
+
states: {
|
|
2295
|
+
[-1]: [0, 1, 2, 3, 4, 5, 6, 7, -1, -1],
|
|
2296
|
+
0: [0, 1, 2, 3, 4, 5, 6, 7, -1, -1],
|
|
2297
|
+
1: [0, 1, 2, 3, 4, 5, 6, 7, -1, -1],
|
|
2298
|
+
2: [0, 1, 2, 3, 4, 5, 6, 7, -1, -1],
|
|
2299
|
+
3: [-1, -1, -1, -1],
|
|
2300
|
+
4: [-1],
|
|
2301
|
+
5: [-1],
|
|
2302
|
+
6: [-1, -1, -1, -1],
|
|
2303
|
+
7: [-1]
|
|
2304
|
+
},
|
|
2305
|
+
keywords: {
|
|
2306
|
+
[-1]: [
|
|
2307
|
+
-1,
|
|
2308
|
+
-1,
|
|
2309
|
+
-1,
|
|
2310
|
+
-1,
|
|
2311
|
+
-1,
|
|
2312
|
+
-1,
|
|
2313
|
+
-1,
|
|
2314
|
+
-1,
|
|
2315
|
+
{
|
|
2316
|
+
builtin: /^(String|Array|RegExp|Function|Math|Number|Date|Image|window|document|navigator|onAbort|onBlur|onChange|onClick|onDblClick|onDragDrop|onError|onFocus|onKeyDown|onKeyPress|onKeyUp|onLoad|onMouseDown|onMouseOver|onMouseOut|onMouseMove|onMouseUp|onMove|onReset|onResize|onSelect|onSubmit|onUnload)$/,
|
|
2317
|
+
reserved: /^(break|continue|do|while|export|for|in|if|else|import|return|label|switch|case|var|with|delete|new|this|typeof|void|abstract|boolean|byte|catch|char|class|const|debugger|default|double|enum|extends|false|final|finally|float|function|implements|goto|instanceof|int|interface|long|native|null|package|private|protected|public|short|static|super|synchronized|throw|throws|transient|true|try|volatile)$/
|
|
2318
|
+
},
|
|
2319
|
+
{}
|
|
2320
|
+
],
|
|
2321
|
+
0: [],
|
|
2322
|
+
1: [],
|
|
2323
|
+
2: [],
|
|
2324
|
+
3: [],
|
|
2325
|
+
4: [{}],
|
|
2326
|
+
5: [{}],
|
|
2327
|
+
6: [{}, {}, {}, {}],
|
|
2328
|
+
7: [{}],
|
|
2329
|
+
8: [],
|
|
2330
|
+
9: []
|
|
2331
|
+
},
|
|
2332
|
+
kwmap: {
|
|
2333
|
+
builtin: "builtin",
|
|
2334
|
+
reserved: "reserved"
|
|
2335
|
+
},
|
|
2336
|
+
parts: {
|
|
2337
|
+
0: [null, null, null, null, null, null, null, null, null, null],
|
|
2338
|
+
1: [null, null, null, null, null, null, null, null, null, null],
|
|
2339
|
+
2: [null, null, null, null, null, null, null, null, null, null],
|
|
2340
|
+
3: [null, null, null, null],
|
|
2341
|
+
4: [null],
|
|
2342
|
+
5: [null],
|
|
2343
|
+
6: [null, null, null, null],
|
|
2344
|
+
7: [null]
|
|
2345
|
+
},
|
|
2346
|
+
subst: {
|
|
2347
|
+
[-1]: [false, false, false, false, false, false, false, false, false, false],
|
|
2348
|
+
0: [false, false, false, false, false, false, false, false, false, false],
|
|
2349
|
+
1: [false, false, false, false, false, false, false, false, false, false],
|
|
2350
|
+
2: [false, false, false, false, false, false, false, false, false, false],
|
|
2351
|
+
3: [false, false, false, false],
|
|
2352
|
+
4: [false],
|
|
2353
|
+
5: [false],
|
|
2354
|
+
6: [false, false, false, false],
|
|
2355
|
+
7: [false]
|
|
2356
|
+
}
|
|
2357
|
+
};
|
|
2358
|
+
|
|
2359
|
+
// packages/render/src/libs/highlighter/languages/php.ts
|
|
2360
|
+
var phpLang = {
|
|
2361
|
+
language: "php",
|
|
2362
|
+
defClass: "code",
|
|
2363
|
+
regs: {
|
|
2364
|
+
[-1]: /(<\?(php|=)?)/gi,
|
|
2365
|
+
0: /(\{)|(\()|(\[)|(\/\*)|(")|(`)|(<<<[\x20\x09]*(\w+)$)|(')|((#|\/\/))|([a-z_]\w*)|(\((array|int|integer|string|bool|boolean|object|float|double)\))|(0[xX][\da-f]+)|(\$[a-z_]\w*)|(\d\d*|\b0\b)|(0[0-7]+)|((\d*\.\d+)|(\d+\.\d*))|(((\d+|((\d*\.\d+)|(\d+\.\d*)))[eE][+-]?\d+))/gim,
|
|
2366
|
+
1: /(\{)|(\()|(\[)|(\/\*)|(")|(`)|(<<<[\x20\x09]*(\w+)$)|(')|((#|\/\/))|([a-z_]\w*)|(\((array|int|integer|string|bool|boolean|object|float|double)\))|(\?>)|(0[xX][\da-f]+)|(\$[a-z_]\w*)|(\d\d*|\b0\b)|(0[0-7]+)|((\d*\.\d+)|(\d+\.\d*))|(((\d+|((\d*\.\d+)|(\d+\.\d*)))[eE][+-]?\d+))/gim,
|
|
2367
|
+
2: /(\{)|(\()|(\[)|(\/\*)|(")|(`)|(<<<[\x20\x09]*(\w+)$)|(')|((#|\/\/))|([a-z_]\w*)|(\((array|int|integer|string|bool|boolean|object|float|double)\))|(0[xX][\da-f]+)|(\$[a-z_]\w*)|(\d\d*|\b0\b)|(0[0-7]+)|((\d*\.\d+)|(\d+\.\d*))|(((\d+|((\d*\.\d+)|(\d+\.\d*)))[eE][+-]?\d+))/gim,
|
|
2368
|
+
3: /(\{)|(\()|(\[)|(\/\*)|(")|(`)|(<<<[\x20\x09]*(\w+)$)|(')|((#|\/\/))|([a-z_]\w*)|(\((array|int|integer|string|bool|boolean|object|float|double)\))|(0[xX][\da-f]+)|(\$[a-z_]\w*)|(\d\d*|\b0\b)|(0[0-7]+)|((\d*\.\d+)|(\d+\.\d*))|(((\d+|((\d*\.\d+)|(\d+\.\d*)))[eE][+-]?\d+))/gim,
|
|
2369
|
+
4: /(\s@\w+\s)|(((https?|ftp):\/\/[\w?.\-&=/%+]+)|(^|[\s,!?])www\.\w+\.\w+[\w?.&=/%+]*)|(\w+[.\w-]+@(\w+[.\w-])+)|(\bnote:)|(\$\w+\s*:.*\$)/gim,
|
|
2370
|
+
5: /(\\[\\"'`tnr${])|(\{\$[a-z_].*\})|(\$[a-z_]\w*)/gi,
|
|
2371
|
+
6: /(\\\\|\\"|\\'|\\`)|(\{\$[a-z_].*\})|(\$[a-z_]\w*)/gi,
|
|
2372
|
+
7: /(\\[\\"'`tnr${])|(\{\$[a-z_].*\})|(\$[a-z_]\w*)/gi,
|
|
2373
|
+
8: /(\\\\|\\"|\\'|\\`)/gi,
|
|
2374
|
+
9: /(\s@\w+\s)|(((https?|ftp):\/\/[\w?.\-&=/%+]+)|(^|[\s,!?])www\.\w+\.\w+[\w?.&=/%+]*)|(\w+[.\w-]+@(\w+[.\w-])+)|(\bnote:)|(\$\w+\s*:.*\$)/gim,
|
|
2375
|
+
10: null
|
|
2376
|
+
},
|
|
2377
|
+
counts: {
|
|
2378
|
+
[-1]: [1],
|
|
2379
|
+
0: [0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 2, 5],
|
|
2380
|
+
1: [0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 2, 5],
|
|
2381
|
+
2: [0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 2, 5],
|
|
2382
|
+
3: [0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 2, 5],
|
|
2383
|
+
4: [0, 3, 1, 0, 0],
|
|
2384
|
+
5: [0, 0, 0],
|
|
2385
|
+
6: [0, 0, 0],
|
|
2386
|
+
7: [0, 0, 0],
|
|
2387
|
+
8: [0],
|
|
2388
|
+
9: [0, 3, 1, 0, 0],
|
|
2389
|
+
10: []
|
|
2390
|
+
},
|
|
2391
|
+
delim: {
|
|
2392
|
+
[-1]: ["inlinetags"],
|
|
2393
|
+
0: [
|
|
2394
|
+
"brackets",
|
|
2395
|
+
"brackets",
|
|
2396
|
+
"brackets",
|
|
2397
|
+
"comment",
|
|
2398
|
+
"quotes",
|
|
2399
|
+
"quotes",
|
|
2400
|
+
"quotes",
|
|
2401
|
+
"quotes",
|
|
2402
|
+
"comment",
|
|
2403
|
+
"",
|
|
2404
|
+
"",
|
|
2405
|
+
"",
|
|
2406
|
+
"",
|
|
2407
|
+
"",
|
|
2408
|
+
"",
|
|
2409
|
+
"",
|
|
2410
|
+
""
|
|
2411
|
+
],
|
|
2412
|
+
1: [
|
|
2413
|
+
"brackets",
|
|
2414
|
+
"brackets",
|
|
2415
|
+
"brackets",
|
|
2416
|
+
"comment",
|
|
2417
|
+
"quotes",
|
|
2418
|
+
"quotes",
|
|
2419
|
+
"quotes",
|
|
2420
|
+
"quotes",
|
|
2421
|
+
"comment",
|
|
2422
|
+
"",
|
|
2423
|
+
"",
|
|
2424
|
+
"inlinetags",
|
|
2425
|
+
"",
|
|
2426
|
+
"",
|
|
2427
|
+
"",
|
|
2428
|
+
"",
|
|
2429
|
+
"",
|
|
2430
|
+
""
|
|
2431
|
+
],
|
|
2432
|
+
2: [
|
|
2433
|
+
"brackets",
|
|
2434
|
+
"brackets",
|
|
2435
|
+
"brackets",
|
|
2436
|
+
"comment",
|
|
2437
|
+
"quotes",
|
|
2438
|
+
"quotes",
|
|
2439
|
+
"quotes",
|
|
2440
|
+
"quotes",
|
|
2441
|
+
"comment",
|
|
2442
|
+
"",
|
|
2443
|
+
"",
|
|
2444
|
+
"",
|
|
2445
|
+
"",
|
|
2446
|
+
"",
|
|
2447
|
+
"",
|
|
2448
|
+
"",
|
|
2449
|
+
""
|
|
2450
|
+
],
|
|
2451
|
+
3: [
|
|
2452
|
+
"brackets",
|
|
2453
|
+
"brackets",
|
|
2454
|
+
"brackets",
|
|
2455
|
+
"comment",
|
|
2456
|
+
"quotes",
|
|
2457
|
+
"quotes",
|
|
2458
|
+
"quotes",
|
|
2459
|
+
"quotes",
|
|
2460
|
+
"comment",
|
|
2461
|
+
"",
|
|
2462
|
+
"",
|
|
2463
|
+
"",
|
|
2464
|
+
"",
|
|
2465
|
+
"",
|
|
2466
|
+
"",
|
|
2467
|
+
"",
|
|
2468
|
+
""
|
|
2469
|
+
],
|
|
2470
|
+
4: ["", "", "", "", ""],
|
|
2471
|
+
5: ["", "", ""],
|
|
2472
|
+
6: ["", "", ""],
|
|
2473
|
+
7: ["", "", ""],
|
|
2474
|
+
8: [""],
|
|
2475
|
+
9: ["", "", "", "", ""],
|
|
2476
|
+
10: []
|
|
2477
|
+
},
|
|
2478
|
+
inner: {
|
|
2479
|
+
[-1]: ["code"],
|
|
2480
|
+
0: [
|
|
2481
|
+
"code",
|
|
2482
|
+
"code",
|
|
2483
|
+
"code",
|
|
2484
|
+
"comment",
|
|
2485
|
+
"string",
|
|
2486
|
+
"string",
|
|
2487
|
+
"string",
|
|
2488
|
+
"string",
|
|
2489
|
+
"comment",
|
|
2490
|
+
"identifier",
|
|
2491
|
+
"reserved",
|
|
2492
|
+
"number",
|
|
2493
|
+
"var",
|
|
2494
|
+
"number",
|
|
2495
|
+
"number",
|
|
2496
|
+
"number",
|
|
2497
|
+
"number"
|
|
2498
|
+
],
|
|
2499
|
+
1: [
|
|
2500
|
+
"code",
|
|
2501
|
+
"code",
|
|
2502
|
+
"code",
|
|
2503
|
+
"comment",
|
|
2504
|
+
"string",
|
|
2505
|
+
"string",
|
|
2506
|
+
"string",
|
|
2507
|
+
"string",
|
|
2508
|
+
"comment",
|
|
2509
|
+
"identifier",
|
|
2510
|
+
"reserved",
|
|
2511
|
+
"default",
|
|
2512
|
+
"number",
|
|
2513
|
+
"var",
|
|
2514
|
+
"number",
|
|
2515
|
+
"number",
|
|
2516
|
+
"number",
|
|
2517
|
+
"number"
|
|
2518
|
+
],
|
|
2519
|
+
2: [
|
|
2520
|
+
"code",
|
|
2521
|
+
"code",
|
|
2522
|
+
"code",
|
|
2523
|
+
"comment",
|
|
2524
|
+
"string",
|
|
2525
|
+
"string",
|
|
2526
|
+
"string",
|
|
2527
|
+
"string",
|
|
2528
|
+
"comment",
|
|
2529
|
+
"identifier",
|
|
2530
|
+
"reserved",
|
|
2531
|
+
"number",
|
|
2532
|
+
"var",
|
|
2533
|
+
"number",
|
|
2534
|
+
"number",
|
|
2535
|
+
"number",
|
|
2536
|
+
"number"
|
|
2537
|
+
],
|
|
2538
|
+
3: [
|
|
2539
|
+
"code",
|
|
2540
|
+
"code",
|
|
2541
|
+
"code",
|
|
2542
|
+
"comment",
|
|
2543
|
+
"string",
|
|
2544
|
+
"string",
|
|
2545
|
+
"string",
|
|
2546
|
+
"string",
|
|
2547
|
+
"comment",
|
|
2548
|
+
"identifier",
|
|
2549
|
+
"reserved",
|
|
2550
|
+
"number",
|
|
2551
|
+
"var",
|
|
2552
|
+
"number",
|
|
2553
|
+
"number",
|
|
2554
|
+
"number",
|
|
2555
|
+
"number"
|
|
2556
|
+
],
|
|
2557
|
+
4: ["inlinedoc", "url", "url", "inlinedoc", "inlinedoc"],
|
|
2558
|
+
5: ["special", "var", "var"],
|
|
2559
|
+
6: ["special", "var", "var"],
|
|
2560
|
+
7: ["special", "var", "var"],
|
|
2561
|
+
8: ["special"],
|
|
2562
|
+
9: ["inlinedoc", "url", "url", "inlinedoc", "inlinedoc"],
|
|
2563
|
+
10: []
|
|
2564
|
+
},
|
|
2565
|
+
end: {
|
|
2566
|
+
0: /\?>/gi,
|
|
2567
|
+
1: /\}/gi,
|
|
2568
|
+
2: /\)/gi,
|
|
2569
|
+
3: /\]/gi,
|
|
2570
|
+
4: /\*\//gi,
|
|
2571
|
+
5: /"/gi,
|
|
2572
|
+
6: /`/gi,
|
|
2573
|
+
7: /^%1%;?$/gim,
|
|
2574
|
+
8: /'/gi,
|
|
2575
|
+
9: /$|(?=\?>)/gim,
|
|
2576
|
+
10: /<\?(php|=)?/gi
|
|
2577
|
+
},
|
|
2578
|
+
states: {
|
|
2579
|
+
[-1]: [0],
|
|
2580
|
+
0: [1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, -1, -1],
|
|
2581
|
+
1: [1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, 10, -1, -1, -1, -1, -1, -1],
|
|
2582
|
+
2: [1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, -1, -1],
|
|
2583
|
+
3: [1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, -1, -1],
|
|
2584
|
+
4: [-1, -1, -1, -1, -1],
|
|
2585
|
+
5: [-1, -1, -1],
|
|
2586
|
+
6: [-1, -1, -1],
|
|
2587
|
+
7: [-1, -1, -1],
|
|
2588
|
+
8: [-1],
|
|
2589
|
+
9: [-1, -1, -1, -1, -1],
|
|
2590
|
+
10: []
|
|
2591
|
+
},
|
|
2592
|
+
keywords: {
|
|
2593
|
+
[-1]: [-1],
|
|
2594
|
+
0: [],
|
|
2595
|
+
1: [],
|
|
2596
|
+
2: [],
|
|
2597
|
+
3: [],
|
|
2598
|
+
4: [],
|
|
2599
|
+
5: [{}, {}, {}],
|
|
2600
|
+
6: [{}, {}, {}],
|
|
2601
|
+
7: [{}, {}, {}],
|
|
2602
|
+
8: [{}],
|
|
2603
|
+
9: [{}, {}, {}, {}, {}],
|
|
2604
|
+
10: [],
|
|
2605
|
+
11: [],
|
|
2606
|
+
12: [],
|
|
2607
|
+
13: [],
|
|
2608
|
+
14: [],
|
|
2609
|
+
15: [],
|
|
2610
|
+
16: [],
|
|
2611
|
+
17: []
|
|
2612
|
+
},
|
|
2613
|
+
kwmap: {
|
|
2614
|
+
constants: "reserved",
|
|
2615
|
+
reserved: "reserved"
|
|
2616
|
+
},
|
|
2617
|
+
parts: {
|
|
2618
|
+
0: [
|
|
2619
|
+
null,
|
|
2620
|
+
null,
|
|
2621
|
+
null,
|
|
2622
|
+
null,
|
|
2623
|
+
null,
|
|
2624
|
+
null,
|
|
2625
|
+
null,
|
|
2626
|
+
null,
|
|
2627
|
+
null,
|
|
2628
|
+
null,
|
|
2629
|
+
null,
|
|
2630
|
+
null,
|
|
2631
|
+
null,
|
|
2632
|
+
null,
|
|
2633
|
+
null,
|
|
2634
|
+
null,
|
|
2635
|
+
null
|
|
2636
|
+
],
|
|
2637
|
+
1: [
|
|
2638
|
+
null,
|
|
2639
|
+
null,
|
|
2640
|
+
null,
|
|
2641
|
+
null,
|
|
2642
|
+
null,
|
|
2643
|
+
null,
|
|
2644
|
+
null,
|
|
2645
|
+
null,
|
|
2646
|
+
null,
|
|
2647
|
+
null,
|
|
2648
|
+
null,
|
|
2649
|
+
null,
|
|
2650
|
+
null,
|
|
2651
|
+
null,
|
|
2652
|
+
null,
|
|
2653
|
+
null,
|
|
2654
|
+
null,
|
|
2655
|
+
null
|
|
2656
|
+
],
|
|
2657
|
+
2: [
|
|
2658
|
+
null,
|
|
2659
|
+
null,
|
|
2660
|
+
null,
|
|
2661
|
+
null,
|
|
2662
|
+
null,
|
|
2663
|
+
null,
|
|
2664
|
+
null,
|
|
2665
|
+
null,
|
|
2666
|
+
null,
|
|
2667
|
+
null,
|
|
2668
|
+
null,
|
|
2669
|
+
null,
|
|
2670
|
+
null,
|
|
2671
|
+
null,
|
|
2672
|
+
null,
|
|
2673
|
+
null,
|
|
2674
|
+
null
|
|
2675
|
+
],
|
|
2676
|
+
3: [
|
|
2677
|
+
null,
|
|
2678
|
+
null,
|
|
2679
|
+
null,
|
|
2680
|
+
null,
|
|
2681
|
+
null,
|
|
2682
|
+
null,
|
|
2683
|
+
null,
|
|
2684
|
+
null,
|
|
2685
|
+
null,
|
|
2686
|
+
null,
|
|
2687
|
+
null,
|
|
2688
|
+
null,
|
|
2689
|
+
null,
|
|
2690
|
+
null,
|
|
2691
|
+
null,
|
|
2692
|
+
null,
|
|
2693
|
+
null
|
|
2694
|
+
],
|
|
2695
|
+
4: [null, null, null, null, null],
|
|
2696
|
+
5: [null, null, null],
|
|
2697
|
+
6: [null, null, null],
|
|
2698
|
+
7: [null, null, null],
|
|
2699
|
+
8: [null],
|
|
2700
|
+
9: [null, null, null, null, null],
|
|
2701
|
+
10: []
|
|
2702
|
+
},
|
|
2703
|
+
subst: {
|
|
2704
|
+
[-1]: [false],
|
|
2705
|
+
0: [
|
|
2706
|
+
false,
|
|
2707
|
+
false,
|
|
2708
|
+
false,
|
|
2709
|
+
false,
|
|
2710
|
+
false,
|
|
2711
|
+
false,
|
|
2712
|
+
true,
|
|
2713
|
+
false,
|
|
2714
|
+
false,
|
|
2715
|
+
false,
|
|
2716
|
+
false,
|
|
2717
|
+
false,
|
|
2718
|
+
false,
|
|
2719
|
+
false,
|
|
2720
|
+
false,
|
|
2721
|
+
false,
|
|
2722
|
+
false
|
|
2723
|
+
],
|
|
2724
|
+
1: [
|
|
2725
|
+
false,
|
|
2726
|
+
false,
|
|
2727
|
+
false,
|
|
2728
|
+
false,
|
|
2729
|
+
false,
|
|
2730
|
+
false,
|
|
2731
|
+
true,
|
|
2732
|
+
false,
|
|
2733
|
+
false,
|
|
2734
|
+
false,
|
|
2735
|
+
false,
|
|
2736
|
+
false,
|
|
2737
|
+
false,
|
|
2738
|
+
false,
|
|
2739
|
+
false,
|
|
2740
|
+
false,
|
|
2741
|
+
false,
|
|
2742
|
+
false
|
|
2743
|
+
],
|
|
2744
|
+
2: [
|
|
2745
|
+
false,
|
|
2746
|
+
false,
|
|
2747
|
+
false,
|
|
2748
|
+
false,
|
|
2749
|
+
false,
|
|
2750
|
+
false,
|
|
2751
|
+
true,
|
|
2752
|
+
false,
|
|
2753
|
+
false,
|
|
2754
|
+
false,
|
|
2755
|
+
false,
|
|
2756
|
+
false,
|
|
2757
|
+
false,
|
|
2758
|
+
false,
|
|
2759
|
+
false,
|
|
2760
|
+
false,
|
|
2761
|
+
false
|
|
2762
|
+
],
|
|
2763
|
+
3: [
|
|
2764
|
+
false,
|
|
2765
|
+
false,
|
|
2766
|
+
false,
|
|
2767
|
+
false,
|
|
2768
|
+
false,
|
|
2769
|
+
false,
|
|
2770
|
+
true,
|
|
2771
|
+
false,
|
|
2772
|
+
false,
|
|
2773
|
+
false,
|
|
2774
|
+
false,
|
|
2775
|
+
false,
|
|
2776
|
+
false,
|
|
2777
|
+
false,
|
|
2778
|
+
false,
|
|
2779
|
+
false,
|
|
2780
|
+
false
|
|
2781
|
+
],
|
|
2782
|
+
4: [false, false, false, false, false],
|
|
2783
|
+
5: [false, false, false],
|
|
2784
|
+
6: [false, false, false],
|
|
2785
|
+
7: [false, false, false],
|
|
2786
|
+
8: [false],
|
|
2787
|
+
9: [false, false, false, false, false],
|
|
2788
|
+
10: []
|
|
2789
|
+
}
|
|
2790
|
+
};
|
|
2791
|
+
|
|
2792
|
+
// packages/render/src/libs/highlighter/languages/python.ts
|
|
2793
|
+
var pythonLang = {
|
|
2794
|
+
language: "python",
|
|
2795
|
+
defClass: "code",
|
|
2796
|
+
regs: {
|
|
2797
|
+
[-1]: /(''')|(""")|(")|(')|(\()|(\[)|([a-z_]\w*(?=\s*\())|([a-z_]\w*)|(((\d+|((\d*\.\d+)|(\d+\.\d*)))[eE][+-]?\d+))|(((\d*\.\d+)|(\d+\.\d*)|(\d+))j)|((\d*\.\d+)|(\d+\.\d*))|(\d+l?|\b0l?\b)|(0[xX][\da-f]+l?)|(0[0-7]+l?)|(#.+)/gi,
|
|
2798
|
+
0: /(\\.)/gi,
|
|
2799
|
+
1: /(\\.)/gi,
|
|
2800
|
+
2: /(\\.)/gi,
|
|
2801
|
+
3: /(\\.)/gi,
|
|
2802
|
+
4: /(''')|(""")|(")|(')|(\()|(\[)|([a-z_]\w*(?=\s*\())|([a-z_]\w*)|(((\d+|((\d*\.\d+)|(\d+\.\d*)))[eE][+-]?\d+))|(((\d*\.\d+)|(\d+\.\d*)|(\d+))j)|((\d*\.\d+)|(\d+\.\d*))|(\d+l?|\b0l?\b)|(0[xX][\da-f]+l?)|(0[0-7]+l?)|(#.+)/gi,
|
|
2803
|
+
5: /(''')|(""")|(")|(')|(\()|(\[)|([a-z_]\w*(?=\s*\())|([a-z_]\w*)|(((\d+|((\d*\.\d+)|(\d+\.\d*)))[eE][+-]?\d+))|(((\d*\.\d+)|(\d+\.\d*)|(\d+))j)|((\d*\.\d+)|(\d+\.\d*))|(\d+l?|\b0l?\b)|(0[xX][\da-f]+l?)|(0[0-7]+l?)|(#.+)/gi
|
|
2804
|
+
},
|
|
2805
|
+
counts: {
|
|
2806
|
+
[-1]: [0, 0, 0, 0, 0, 0, 0, 0, 5, 4, 2, 0, 0, 0, 0],
|
|
2807
|
+
0: [0],
|
|
2808
|
+
1: [0],
|
|
2809
|
+
2: [0],
|
|
2810
|
+
3: [0],
|
|
2811
|
+
4: [0, 0, 0, 0, 0, 0, 0, 0, 5, 4, 2, 0, 0, 0, 0],
|
|
2812
|
+
5: [0, 0, 0, 0, 0, 0, 0, 0, 5, 4, 2, 0, 0, 0, 0]
|
|
2813
|
+
},
|
|
2814
|
+
delim: {
|
|
2815
|
+
[-1]: [
|
|
2816
|
+
"quotes",
|
|
2817
|
+
"quotes",
|
|
2818
|
+
"quotes",
|
|
2819
|
+
"quotes",
|
|
2820
|
+
"brackets",
|
|
2821
|
+
"brackets",
|
|
2822
|
+
"",
|
|
2823
|
+
"",
|
|
2824
|
+
"",
|
|
2825
|
+
"",
|
|
2826
|
+
"",
|
|
2827
|
+
"",
|
|
2828
|
+
"",
|
|
2829
|
+
"",
|
|
2830
|
+
""
|
|
2831
|
+
],
|
|
2832
|
+
0: [""],
|
|
2833
|
+
1: [""],
|
|
2834
|
+
2: [""],
|
|
2835
|
+
3: [""],
|
|
2836
|
+
4: [
|
|
2837
|
+
"quotes",
|
|
2838
|
+
"quotes",
|
|
2839
|
+
"quotes",
|
|
2840
|
+
"quotes",
|
|
2841
|
+
"brackets",
|
|
2842
|
+
"brackets",
|
|
2843
|
+
"",
|
|
2844
|
+
"",
|
|
2845
|
+
"",
|
|
2846
|
+
"",
|
|
2847
|
+
"",
|
|
2848
|
+
"",
|
|
2849
|
+
"",
|
|
2850
|
+
"",
|
|
2851
|
+
""
|
|
2852
|
+
],
|
|
2853
|
+
5: [
|
|
2854
|
+
"quotes",
|
|
2855
|
+
"quotes",
|
|
2856
|
+
"quotes",
|
|
2857
|
+
"quotes",
|
|
2858
|
+
"brackets",
|
|
2859
|
+
"brackets",
|
|
2860
|
+
"",
|
|
2861
|
+
"",
|
|
2862
|
+
"",
|
|
2863
|
+
"",
|
|
2864
|
+
"",
|
|
2865
|
+
"",
|
|
2866
|
+
"",
|
|
2867
|
+
"",
|
|
2868
|
+
""
|
|
2869
|
+
]
|
|
2870
|
+
},
|
|
2871
|
+
inner: {
|
|
2872
|
+
[-1]: [
|
|
2873
|
+
"string",
|
|
2874
|
+
"string",
|
|
2875
|
+
"string",
|
|
2876
|
+
"string",
|
|
2877
|
+
"code",
|
|
2878
|
+
"code",
|
|
2879
|
+
"identifier",
|
|
2880
|
+
"identifier",
|
|
2881
|
+
"number",
|
|
2882
|
+
"number",
|
|
2883
|
+
"number",
|
|
2884
|
+
"number",
|
|
2885
|
+
"number",
|
|
2886
|
+
"number",
|
|
2887
|
+
"comment"
|
|
2888
|
+
],
|
|
2889
|
+
0: ["special"],
|
|
2890
|
+
1: ["special"],
|
|
2891
|
+
2: ["special"],
|
|
2892
|
+
3: ["special"],
|
|
2893
|
+
4: [
|
|
2894
|
+
"string",
|
|
2895
|
+
"string",
|
|
2896
|
+
"string",
|
|
2897
|
+
"string",
|
|
2898
|
+
"code",
|
|
2899
|
+
"code",
|
|
2900
|
+
"identifier",
|
|
2901
|
+
"identifier",
|
|
2902
|
+
"number",
|
|
2903
|
+
"number",
|
|
2904
|
+
"number",
|
|
2905
|
+
"number",
|
|
2906
|
+
"number",
|
|
2907
|
+
"number",
|
|
2908
|
+
"comment"
|
|
2909
|
+
],
|
|
2910
|
+
5: [
|
|
2911
|
+
"string",
|
|
2912
|
+
"string",
|
|
2913
|
+
"string",
|
|
2914
|
+
"string",
|
|
2915
|
+
"code",
|
|
2916
|
+
"code",
|
|
2917
|
+
"identifier",
|
|
2918
|
+
"identifier",
|
|
2919
|
+
"number",
|
|
2920
|
+
"number",
|
|
2921
|
+
"number",
|
|
2922
|
+
"number",
|
|
2923
|
+
"number",
|
|
2924
|
+
"number",
|
|
2925
|
+
"comment"
|
|
2926
|
+
]
|
|
2927
|
+
},
|
|
2928
|
+
end: {
|
|
2929
|
+
0: /'''/gi,
|
|
2930
|
+
1: /"""/gi,
|
|
2931
|
+
2: /"/gi,
|
|
2932
|
+
3: /'/gi,
|
|
2933
|
+
4: /\)/gi,
|
|
2934
|
+
5: /\]/gi
|
|
2935
|
+
},
|
|
2936
|
+
states: {
|
|
2937
|
+
[-1]: [0, 1, 2, 3, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1],
|
|
2938
|
+
0: [-1],
|
|
2939
|
+
1: [-1],
|
|
2940
|
+
2: [-1],
|
|
2941
|
+
3: [-1],
|
|
2942
|
+
4: [0, 1, 2, 3, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1],
|
|
2943
|
+
5: [0, 1, 2, 3, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1]
|
|
2944
|
+
},
|
|
2945
|
+
keywords: {
|
|
2946
|
+
[-1]: [
|
|
2947
|
+
-1,
|
|
2948
|
+
-1,
|
|
2949
|
+
-1,
|
|
2950
|
+
-1,
|
|
2951
|
+
-1,
|
|
2952
|
+
-1,
|
|
2953
|
+
{
|
|
2954
|
+
builtin: /^(__import__|abs|apply|basestring|bool|buffer|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|min|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|round|setattr|slice|staticmethod|sum|super|str|tuple|type|unichr|unicode|vars|xrange|zip)$/
|
|
2955
|
+
},
|
|
2956
|
+
{
|
|
2957
|
+
reserved: /^(and|del|for|is|raise|assert|elif|from|lambda|return|break|else|global|not|try|class|except|if|or|while|continue|exec|import|pass|yield|def|finally|in|print|False|True|None|NotImplemented|Ellipsis|Exception|SystemExit|StopIteration|StandardError|KeyboardInterrupt|ImportError|EnvironmentError|IOError|OSError|WindowsError|EOFError|RuntimeError|NotImplementedError|NameError|UnboundLocalError|AttributeError|SyntaxError|IndentationError|TabError|TypeError|AssertionError|LookupError|IndexError|KeyError|ArithmeticError|OverflowError|ZeroDivisionError|FloatingPointError|ValueError|UnicodeError|UnicodeEncodeError|UnicodeDecodeError|UnicodeTranslateError|ReferenceError|SystemError|MemoryError|Warning|UserWarning|DeprecationWarning|PendingDeprecationWarning|SyntaxWarning|OverflowWarning|RuntimeWarning|FutureWarning)$/
|
|
2958
|
+
},
|
|
2959
|
+
{},
|
|
2960
|
+
{},
|
|
2961
|
+
{},
|
|
2962
|
+
{},
|
|
2963
|
+
{},
|
|
2964
|
+
{},
|
|
2965
|
+
{}
|
|
2966
|
+
],
|
|
2967
|
+
0: [],
|
|
2968
|
+
1: [{}],
|
|
2969
|
+
2: [{}],
|
|
2970
|
+
3: [{}],
|
|
2971
|
+
4: [
|
|
2972
|
+
-1,
|
|
2973
|
+
-1,
|
|
2974
|
+
-1,
|
|
2975
|
+
-1,
|
|
2976
|
+
-1,
|
|
2977
|
+
-1,
|
|
2978
|
+
{
|
|
2979
|
+
builtin: /^(__import__|abs|apply|basestring|bool|buffer|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|min|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|round|setattr|slice|staticmethod|sum|super|str|tuple|type|unichr|unicode|vars|xrange|zip)$/
|
|
2980
|
+
},
|
|
2981
|
+
{
|
|
2982
|
+
reserved: /^(and|del|for|is|raise|assert|elif|from|lambda|return|break|else|global|not|try|class|except|if|or|while|continue|exec|import|pass|yield|def|finally|in|print|False|True|None|NotImplemented|Ellipsis|Exception|SystemExit|StopIteration|StandardError|KeyboardInterrupt|ImportError|EnvironmentError|IOError|OSError|WindowsError|EOFError|RuntimeError|NotImplementedError|NameError|UnboundLocalError|AttributeError|SyntaxError|IndentationError|TabError|TypeError|AssertionError|LookupError|IndexError|KeyError|ArithmeticError|OverflowError|ZeroDivisionError|FloatingPointError|ValueError|UnicodeError|UnicodeEncodeError|UnicodeDecodeError|UnicodeTranslateError|ReferenceError|SystemError|MemoryError|Warning|UserWarning|DeprecationWarning|PendingDeprecationWarning|SyntaxWarning|OverflowWarning|RuntimeWarning|FutureWarning)$/
|
|
2983
|
+
},
|
|
2984
|
+
{},
|
|
2985
|
+
{},
|
|
2986
|
+
{},
|
|
2987
|
+
{},
|
|
2988
|
+
{},
|
|
2989
|
+
{},
|
|
2990
|
+
{}
|
|
2991
|
+
],
|
|
2992
|
+
5: [
|
|
2993
|
+
-1,
|
|
2994
|
+
-1,
|
|
2995
|
+
-1,
|
|
2996
|
+
-1,
|
|
2997
|
+
-1,
|
|
2998
|
+
-1,
|
|
2999
|
+
{
|
|
3000
|
+
builtin: /^(__import__|abs|apply|basestring|bool|buffer|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|min|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|round|setattr|slice|staticmethod|sum|super|str|tuple|type|unichr|unicode|vars|xrange|zip)$/
|
|
3001
|
+
},
|
|
3002
|
+
{
|
|
3003
|
+
reserved: /^(and|del|for|is|raise|assert|elif|from|lambda|return|break|else|global|not|try|class|except|if|or|while|continue|exec|import|pass|yield|def|finally|in|print|False|True|None|NotImplemented|Ellipsis|Exception|SystemExit|StopIteration|StandardError|KeyboardInterrupt|ImportError|EnvironmentError|IOError|OSError|WindowsError|EOFError|RuntimeError|NotImplementedError|NameError|UnboundLocalError|AttributeError|SyntaxError|IndentationError|TabError|TypeError|AssertionError|LookupError|IndexError|KeyError|ArithmeticError|OverflowError|ZeroDivisionError|FloatingPointError|ValueError|UnicodeError|UnicodeEncodeError|UnicodeDecodeError|UnicodeTranslateError|ReferenceError|SystemError|MemoryError|Warning|UserWarning|DeprecationWarning|PendingDeprecationWarning|SyntaxWarning|OverflowWarning|RuntimeWarning|FutureWarning)$/
|
|
3004
|
+
},
|
|
3005
|
+
{},
|
|
3006
|
+
{},
|
|
3007
|
+
{},
|
|
3008
|
+
{},
|
|
3009
|
+
{},
|
|
3010
|
+
{},
|
|
3011
|
+
{}
|
|
3012
|
+
],
|
|
3013
|
+
6: [],
|
|
3014
|
+
7: [],
|
|
3015
|
+
8: [],
|
|
3016
|
+
9: [],
|
|
3017
|
+
10: [],
|
|
3018
|
+
11: [],
|
|
3019
|
+
12: [],
|
|
3020
|
+
13: [],
|
|
3021
|
+
14: []
|
|
3022
|
+
},
|
|
3023
|
+
kwmap: {
|
|
3024
|
+
builtin: "builtin",
|
|
3025
|
+
reserved: "reserved"
|
|
3026
|
+
},
|
|
3027
|
+
parts: {
|
|
3028
|
+
0: [null],
|
|
3029
|
+
1: [null],
|
|
3030
|
+
2: [null],
|
|
3031
|
+
3: [null],
|
|
3032
|
+
4: [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null],
|
|
3033
|
+
5: [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null]
|
|
3034
|
+
},
|
|
3035
|
+
subst: {
|
|
3036
|
+
[-1]: [
|
|
3037
|
+
false,
|
|
3038
|
+
false,
|
|
3039
|
+
false,
|
|
3040
|
+
false,
|
|
3041
|
+
false,
|
|
3042
|
+
false,
|
|
3043
|
+
false,
|
|
3044
|
+
false,
|
|
3045
|
+
false,
|
|
3046
|
+
false,
|
|
3047
|
+
false,
|
|
3048
|
+
false,
|
|
3049
|
+
false,
|
|
3050
|
+
false,
|
|
3051
|
+
false
|
|
3052
|
+
],
|
|
3053
|
+
0: [false],
|
|
3054
|
+
1: [false],
|
|
3055
|
+
2: [false],
|
|
3056
|
+
3: [false],
|
|
3057
|
+
4: [
|
|
3058
|
+
false,
|
|
3059
|
+
false,
|
|
3060
|
+
false,
|
|
3061
|
+
false,
|
|
3062
|
+
false,
|
|
3063
|
+
false,
|
|
3064
|
+
false,
|
|
3065
|
+
false,
|
|
3066
|
+
false,
|
|
3067
|
+
false,
|
|
3068
|
+
false,
|
|
3069
|
+
false,
|
|
3070
|
+
false,
|
|
3071
|
+
false,
|
|
3072
|
+
false
|
|
3073
|
+
],
|
|
3074
|
+
5: [
|
|
3075
|
+
false,
|
|
3076
|
+
false,
|
|
3077
|
+
false,
|
|
3078
|
+
false,
|
|
3079
|
+
false,
|
|
3080
|
+
false,
|
|
3081
|
+
false,
|
|
3082
|
+
false,
|
|
3083
|
+
false,
|
|
3084
|
+
false,
|
|
3085
|
+
false,
|
|
3086
|
+
false,
|
|
3087
|
+
false,
|
|
3088
|
+
false,
|
|
3089
|
+
false
|
|
3090
|
+
]
|
|
3091
|
+
}
|
|
3092
|
+
};
|
|
3093
|
+
|
|
3094
|
+
// packages/render/src/libs/highlighter/languages/ruby.ts
|
|
3095
|
+
var rubyLang = {
|
|
3096
|
+
language: "ruby",
|
|
3097
|
+
defClass: "code",
|
|
3098
|
+
regs: {
|
|
3099
|
+
[-1]: /(^__END__$)|(")|(%[Qx]([!"#$%&'+\-*./:;=?@^`|~{<[(]))|(')|(%[wq]([!"#$%&'+\-*./:;=?@^`|~{<[(]))|(\$(\W|\w+))|(@@?[_a-z][\d_a-z]*)|(\()|(\[)|([a-z_]\w*)|(((\d+|((\d*\.\d+)|(\d+\.\d*)))[eE][+-]?\d+))|((\d*\.\d+)|(\d+\.\d*))|(0[xX][\da-f]+l?)|(\d+l?|\b0l?\b)|(0[0-7]+l?)|(^=begin$)|(#)|(\s*\/)/gim,
|
|
3100
|
+
0: null,
|
|
3101
|
+
1: /(\\.)/gi,
|
|
3102
|
+
2: /(\\.)/gi,
|
|
3103
|
+
3: /(\\.)/gi,
|
|
3104
|
+
4: /(\\.)/gi,
|
|
3105
|
+
5: /(^__END__$)|(")|(%[Qx]([!"#$%&'+\-*./:;=?@^`|~{<[(]))|(')|(%[wq]([!"#$%&'+\-*./:;=?@^`|~{<[(]))|(\$(\W|\w+))|(@@?[_a-z][\d_a-z]*)|(\()|(\[)|([a-z_]\w*)|(((\d+|((\d*\.\d+)|(\d+\.\d*)))[eE][+-]?\d+))|((\d*\.\d+)|(\d+\.\d*))|(0[xX][\da-f]+l?)|(\d+l?|\b0l?\b)|(0[0-7]+l?)|(^=begin$)|(#)|(\s*\/)/gim,
|
|
3106
|
+
6: /(^__END__$)|(")|(%[Qx]([!"#$%&'+\-*./:;=?@^`|~{<[(]))|(')|(%[wq]([!"#$%&'+\-*./:;=?@^`|~{<[(]))|(\$(\W|\w+))|(@@?[_a-z][\d_a-z]*)|(\()|(\[)|([a-z_]\w*)|(((\d+|((\d*\.\d+)|(\d+\.\d*)))[eE][+-]?\d+))|((\d*\.\d+)|(\d+\.\d*))|(0[xX][\da-f]+l?)|(\d+l?|\b0l?\b)|(0[0-7]+l?)|(^=begin$)|(#)|(\s*\/)/gim,
|
|
3107
|
+
7: /(\$\w+\s*:.+\$)/gi,
|
|
3108
|
+
8: /(\$\w+\s*:.+\$)/gi,
|
|
3109
|
+
9: /(\\.)/gi
|
|
3110
|
+
},
|
|
3111
|
+
counts: {
|
|
3112
|
+
[-1]: [0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 5, 2, 0, 0, 0, 0, 0, 0],
|
|
3113
|
+
0: [],
|
|
3114
|
+
1: [0],
|
|
3115
|
+
2: [0],
|
|
3116
|
+
3: [0],
|
|
3117
|
+
4: [0],
|
|
3118
|
+
5: [0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 5, 2, 0, 0, 0, 0, 0, 0],
|
|
3119
|
+
6: [0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 5, 2, 0, 0, 0, 0, 0, 0],
|
|
3120
|
+
7: [0],
|
|
3121
|
+
8: [0],
|
|
3122
|
+
9: [0]
|
|
3123
|
+
},
|
|
3124
|
+
delim: {
|
|
3125
|
+
[-1]: [
|
|
3126
|
+
"reserved",
|
|
3127
|
+
"quotes",
|
|
3128
|
+
"quotes",
|
|
3129
|
+
"quotes",
|
|
3130
|
+
"quotes",
|
|
3131
|
+
"",
|
|
3132
|
+
"",
|
|
3133
|
+
"brackets",
|
|
3134
|
+
"brackets",
|
|
3135
|
+
"",
|
|
3136
|
+
"",
|
|
3137
|
+
"",
|
|
3138
|
+
"",
|
|
3139
|
+
"",
|
|
3140
|
+
"",
|
|
3141
|
+
"comment",
|
|
3142
|
+
"comment",
|
|
3143
|
+
"quotes"
|
|
3144
|
+
],
|
|
3145
|
+
0: [],
|
|
3146
|
+
1: [""],
|
|
3147
|
+
2: [""],
|
|
3148
|
+
3: [""],
|
|
3149
|
+
4: [""],
|
|
3150
|
+
5: [
|
|
3151
|
+
"reserved",
|
|
3152
|
+
"quotes",
|
|
3153
|
+
"quotes",
|
|
3154
|
+
"quotes",
|
|
3155
|
+
"quotes",
|
|
3156
|
+
"",
|
|
3157
|
+
"",
|
|
3158
|
+
"brackets",
|
|
3159
|
+
"brackets",
|
|
3160
|
+
"",
|
|
3161
|
+
"",
|
|
3162
|
+
"",
|
|
3163
|
+
"",
|
|
3164
|
+
"",
|
|
3165
|
+
"",
|
|
3166
|
+
"comment",
|
|
3167
|
+
"comment",
|
|
3168
|
+
"quotes"
|
|
3169
|
+
],
|
|
3170
|
+
6: [
|
|
3171
|
+
"reserved",
|
|
3172
|
+
"quotes",
|
|
3173
|
+
"quotes",
|
|
3174
|
+
"quotes",
|
|
3175
|
+
"quotes",
|
|
3176
|
+
"",
|
|
3177
|
+
"",
|
|
3178
|
+
"brackets",
|
|
3179
|
+
"brackets",
|
|
3180
|
+
"",
|
|
3181
|
+
"",
|
|
3182
|
+
"",
|
|
3183
|
+
"",
|
|
3184
|
+
"",
|
|
3185
|
+
"",
|
|
3186
|
+
"comment",
|
|
3187
|
+
"comment",
|
|
3188
|
+
"quotes"
|
|
3189
|
+
],
|
|
3190
|
+
7: [""],
|
|
3191
|
+
8: [""],
|
|
3192
|
+
9: [""]
|
|
3193
|
+
},
|
|
3194
|
+
inner: {
|
|
3195
|
+
[-1]: [
|
|
3196
|
+
"comment",
|
|
3197
|
+
"string",
|
|
3198
|
+
"string",
|
|
3199
|
+
"string",
|
|
3200
|
+
"string",
|
|
3201
|
+
"var",
|
|
3202
|
+
"var",
|
|
3203
|
+
"code",
|
|
3204
|
+
"code",
|
|
3205
|
+
"identifier",
|
|
3206
|
+
"number",
|
|
3207
|
+
"number",
|
|
3208
|
+
"number",
|
|
3209
|
+
"number",
|
|
3210
|
+
"number",
|
|
3211
|
+
"comment",
|
|
3212
|
+
"comment",
|
|
3213
|
+
"string"
|
|
3214
|
+
],
|
|
3215
|
+
0: [],
|
|
3216
|
+
1: ["special"],
|
|
3217
|
+
2: ["special"],
|
|
3218
|
+
3: ["special"],
|
|
3219
|
+
4: ["special"],
|
|
3220
|
+
5: [
|
|
3221
|
+
"comment",
|
|
3222
|
+
"string",
|
|
3223
|
+
"string",
|
|
3224
|
+
"string",
|
|
3225
|
+
"string",
|
|
3226
|
+
"var",
|
|
3227
|
+
"var",
|
|
3228
|
+
"code",
|
|
3229
|
+
"code",
|
|
3230
|
+
"identifier",
|
|
3231
|
+
"number",
|
|
3232
|
+
"number",
|
|
3233
|
+
"number",
|
|
3234
|
+
"number",
|
|
3235
|
+
"number",
|
|
3236
|
+
"comment",
|
|
3237
|
+
"comment",
|
|
3238
|
+
"string"
|
|
3239
|
+
],
|
|
3240
|
+
6: [
|
|
3241
|
+
"comment",
|
|
3242
|
+
"string",
|
|
3243
|
+
"string",
|
|
3244
|
+
"string",
|
|
3245
|
+
"string",
|
|
3246
|
+
"var",
|
|
3247
|
+
"var",
|
|
3248
|
+
"code",
|
|
3249
|
+
"code",
|
|
3250
|
+
"identifier",
|
|
3251
|
+
"number",
|
|
3252
|
+
"number",
|
|
3253
|
+
"number",
|
|
3254
|
+
"number",
|
|
3255
|
+
"number",
|
|
3256
|
+
"comment",
|
|
3257
|
+
"comment",
|
|
3258
|
+
"string"
|
|
3259
|
+
],
|
|
3260
|
+
7: ["inlinedoc"],
|
|
3261
|
+
8: ["inlinedoc"],
|
|
3262
|
+
9: ["special"]
|
|
3263
|
+
},
|
|
3264
|
+
end: {
|
|
3265
|
+
0: /$/gim,
|
|
3266
|
+
1: /"/gi,
|
|
3267
|
+
2: /%b1%/gi,
|
|
3268
|
+
3: /'/gi,
|
|
3269
|
+
4: /%b1%/gi,
|
|
3270
|
+
5: /\)/gi,
|
|
3271
|
+
6: /\]/gi,
|
|
3272
|
+
7: /^=end$/gim,
|
|
3273
|
+
8: /$/gim,
|
|
3274
|
+
9: /\/[iomx]*/gi
|
|
3275
|
+
},
|
|
3276
|
+
states: {
|
|
3277
|
+
[-1]: [0, 1, 2, 3, 4, -1, -1, 5, 6, -1, -1, -1, -1, -1, -1, 7, 8, 9],
|
|
3278
|
+
0: [],
|
|
3279
|
+
1: [-1],
|
|
3280
|
+
2: [-1],
|
|
3281
|
+
3: [-1],
|
|
3282
|
+
4: [-1],
|
|
3283
|
+
5: [0, 1, 2, 3, 4, -1, -1, 5, 6, -1, -1, -1, -1, -1, -1, 7, 8, 9],
|
|
3284
|
+
6: [0, 1, 2, 3, 4, -1, -1, 5, 6, -1, -1, -1, -1, -1, -1, 7, 8, 9],
|
|
3285
|
+
7: [-1],
|
|
3286
|
+
8: [-1],
|
|
3287
|
+
9: [-1]
|
|
3288
|
+
},
|
|
3289
|
+
keywords: {
|
|
3290
|
+
[-1]: [
|
|
3291
|
+
-1,
|
|
3292
|
+
-1,
|
|
3293
|
+
-1,
|
|
3294
|
+
-1,
|
|
3295
|
+
-1,
|
|
3296
|
+
{},
|
|
3297
|
+
{},
|
|
3298
|
+
-1,
|
|
3299
|
+
-1,
|
|
3300
|
+
{
|
|
3301
|
+
reserved: /^(__FILE__|require|and|def|end|in|or|self|unless|__LINE__|begin|defined?|ensure|module|redo|super|until|BEGIN|break|do|false|next|rescue|then|when|END|case|else|for|nil|retry|true|while|alias|module_function|private|public|protected|attr_reader|attr_writer|attr_accessor|class|elsif|if|not|return|undef|yield)$/
|
|
3302
|
+
},
|
|
3303
|
+
{},
|
|
3304
|
+
{},
|
|
3305
|
+
{},
|
|
3306
|
+
{},
|
|
3307
|
+
{},
|
|
3308
|
+
-1,
|
|
3309
|
+
-1,
|
|
3310
|
+
-1
|
|
3311
|
+
],
|
|
3312
|
+
0: [],
|
|
3313
|
+
1: [{}],
|
|
3314
|
+
2: [{}],
|
|
3315
|
+
3: [{}],
|
|
3316
|
+
4: [{}],
|
|
3317
|
+
5: [],
|
|
3318
|
+
6: [],
|
|
3319
|
+
7: [{}],
|
|
3320
|
+
8: [{}],
|
|
3321
|
+
9: [{}],
|
|
3322
|
+
10: [],
|
|
3323
|
+
11: [],
|
|
3324
|
+
12: [],
|
|
3325
|
+
13: [],
|
|
3326
|
+
14: []
|
|
3327
|
+
},
|
|
3328
|
+
kwmap: {
|
|
3329
|
+
reserved: "reserved"
|
|
3330
|
+
},
|
|
3331
|
+
parts: {
|
|
3332
|
+
0: [],
|
|
3333
|
+
1: [null],
|
|
3334
|
+
2: [null],
|
|
3335
|
+
3: [null],
|
|
3336
|
+
4: [null],
|
|
3337
|
+
5: [
|
|
3338
|
+
null,
|
|
3339
|
+
null,
|
|
3340
|
+
null,
|
|
3341
|
+
null,
|
|
3342
|
+
null,
|
|
3343
|
+
null,
|
|
3344
|
+
null,
|
|
3345
|
+
null,
|
|
3346
|
+
null,
|
|
3347
|
+
null,
|
|
3348
|
+
null,
|
|
3349
|
+
null,
|
|
3350
|
+
null,
|
|
3351
|
+
null,
|
|
3352
|
+
null,
|
|
3353
|
+
null,
|
|
3354
|
+
null,
|
|
3355
|
+
null
|
|
3356
|
+
],
|
|
3357
|
+
6: [
|
|
3358
|
+
null,
|
|
3359
|
+
null,
|
|
3360
|
+
null,
|
|
3361
|
+
null,
|
|
3362
|
+
null,
|
|
3363
|
+
null,
|
|
3364
|
+
null,
|
|
3365
|
+
null,
|
|
3366
|
+
null,
|
|
3367
|
+
null,
|
|
3368
|
+
null,
|
|
3369
|
+
null,
|
|
3370
|
+
null,
|
|
3371
|
+
null,
|
|
3372
|
+
null,
|
|
3373
|
+
null,
|
|
3374
|
+
null,
|
|
3375
|
+
null
|
|
3376
|
+
],
|
|
3377
|
+
7: [null],
|
|
3378
|
+
8: [null],
|
|
3379
|
+
9: [null]
|
|
3380
|
+
},
|
|
3381
|
+
subst: {
|
|
3382
|
+
[-1]: [
|
|
3383
|
+
false,
|
|
3384
|
+
false,
|
|
3385
|
+
true,
|
|
3386
|
+
false,
|
|
3387
|
+
true,
|
|
3388
|
+
false,
|
|
3389
|
+
false,
|
|
3390
|
+
false,
|
|
3391
|
+
false,
|
|
3392
|
+
false,
|
|
3393
|
+
false,
|
|
3394
|
+
false,
|
|
3395
|
+
false,
|
|
3396
|
+
false,
|
|
3397
|
+
false,
|
|
3398
|
+
false,
|
|
3399
|
+
false,
|
|
3400
|
+
false
|
|
3401
|
+
],
|
|
3402
|
+
0: [],
|
|
3403
|
+
1: [false],
|
|
3404
|
+
2: [false],
|
|
3405
|
+
3: [false],
|
|
3406
|
+
4: [false],
|
|
3407
|
+
5: [
|
|
3408
|
+
false,
|
|
3409
|
+
false,
|
|
3410
|
+
true,
|
|
3411
|
+
false,
|
|
3412
|
+
true,
|
|
3413
|
+
false,
|
|
3414
|
+
false,
|
|
3415
|
+
false,
|
|
3416
|
+
false,
|
|
3417
|
+
false,
|
|
3418
|
+
false,
|
|
3419
|
+
false,
|
|
3420
|
+
false,
|
|
3421
|
+
false,
|
|
3422
|
+
false,
|
|
3423
|
+
false,
|
|
3424
|
+
false,
|
|
3425
|
+
false
|
|
3426
|
+
],
|
|
3427
|
+
6: [
|
|
3428
|
+
false,
|
|
3429
|
+
false,
|
|
3430
|
+
true,
|
|
3431
|
+
false,
|
|
3432
|
+
true,
|
|
3433
|
+
false,
|
|
3434
|
+
false,
|
|
3435
|
+
false,
|
|
3436
|
+
false,
|
|
3437
|
+
false,
|
|
3438
|
+
false,
|
|
3439
|
+
false,
|
|
3440
|
+
false,
|
|
3441
|
+
false,
|
|
3442
|
+
false,
|
|
3443
|
+
false,
|
|
3444
|
+
false,
|
|
3445
|
+
false
|
|
3446
|
+
],
|
|
3447
|
+
7: [false],
|
|
3448
|
+
8: [false],
|
|
3449
|
+
9: [false]
|
|
3450
|
+
}
|
|
3451
|
+
};
|
|
3452
|
+
|
|
3453
|
+
// packages/render/src/libs/highlighter/languages/sql.ts
|
|
3454
|
+
var sqlLang = {
|
|
3455
|
+
language: "sql",
|
|
3456
|
+
defClass: "code",
|
|
3457
|
+
regs: {
|
|
3458
|
+
[-1]: /(`)|(\/\*)|((#|--\s).*)|([a-z_]\w*)|(")|(\()|(')|(((\d+|((\d*\.\d+)|(\d+\.\d*)))[eE][+-]?\d+))|((\d*\.\d+)|(\d+\.\d*))|(\d+l?|\b0l?\b)|(0[xX][\da-f]+l?)/gi,
|
|
3459
|
+
0: null,
|
|
3460
|
+
1: null,
|
|
3461
|
+
2: /(\\.)/gi,
|
|
3462
|
+
3: /(`)|(\/\*)|((#|--\s).*)|([a-z_]\w*)|(")|(\()|(')|(((\d+|((\d*\.\d+)|(\d+\.\d*)))[eE][+-]?\d+))|((\d*\.\d+)|(\d+\.\d*))|(\d+l?|\b0l?\b)|(0[xX][\da-f]+l?)/gi,
|
|
3463
|
+
4: /(\\.)/gi
|
|
3464
|
+
},
|
|
3465
|
+
counts: {
|
|
3466
|
+
[-1]: [0, 0, 1, 0, 0, 0, 0, 5, 2, 0, 0],
|
|
3467
|
+
0: [],
|
|
3468
|
+
1: [],
|
|
3469
|
+
2: [0],
|
|
3470
|
+
3: [0, 0, 1, 0, 0, 0, 0, 5, 2, 0, 0],
|
|
3471
|
+
4: [0]
|
|
3472
|
+
},
|
|
3473
|
+
delim: {
|
|
3474
|
+
[-1]: ["quotes", "comment", "", "", "quotes", "brackets", "quotes", "", "", "", ""],
|
|
3475
|
+
0: [],
|
|
3476
|
+
1: [],
|
|
3477
|
+
2: [""],
|
|
3478
|
+
3: ["quotes", "comment", "", "", "quotes", "brackets", "quotes", "", "", "", ""],
|
|
3479
|
+
4: [""]
|
|
3480
|
+
},
|
|
3481
|
+
inner: {
|
|
3482
|
+
[-1]: [
|
|
3483
|
+
"identifier",
|
|
3484
|
+
"comment",
|
|
3485
|
+
"comment",
|
|
3486
|
+
"identifier",
|
|
3487
|
+
"string",
|
|
3488
|
+
"code",
|
|
3489
|
+
"string",
|
|
3490
|
+
"number",
|
|
3491
|
+
"number",
|
|
3492
|
+
"number",
|
|
3493
|
+
"number"
|
|
3494
|
+
],
|
|
3495
|
+
0: [],
|
|
3496
|
+
1: [],
|
|
3497
|
+
2: ["special"],
|
|
3498
|
+
3: [
|
|
3499
|
+
"identifier",
|
|
3500
|
+
"comment",
|
|
3501
|
+
"comment",
|
|
3502
|
+
"identifier",
|
|
3503
|
+
"string",
|
|
3504
|
+
"code",
|
|
3505
|
+
"string",
|
|
3506
|
+
"number",
|
|
3507
|
+
"number",
|
|
3508
|
+
"number",
|
|
3509
|
+
"number"
|
|
3510
|
+
],
|
|
3511
|
+
4: ["special"]
|
|
3512
|
+
},
|
|
3513
|
+
end: {
|
|
3514
|
+
0: /`/gi,
|
|
3515
|
+
1: /\*\//gi,
|
|
3516
|
+
2: /"/gi,
|
|
3517
|
+
3: /\)/gi,
|
|
3518
|
+
4: /'/gi
|
|
3519
|
+
},
|
|
3520
|
+
states: {
|
|
3521
|
+
[-1]: [0, 1, -1, -1, 2, 3, 4, -1, -1, -1, -1],
|
|
3522
|
+
0: [],
|
|
3523
|
+
1: [],
|
|
3524
|
+
2: [-1],
|
|
3525
|
+
3: [0, 1, -1, -1, 2, 3, 4, -1, -1, -1, -1],
|
|
3526
|
+
4: [-1]
|
|
3527
|
+
},
|
|
3528
|
+
keywords: {
|
|
3529
|
+
[-1]: [
|
|
3530
|
+
-1,
|
|
3531
|
+
-1,
|
|
3532
|
+
{},
|
|
3533
|
+
{
|
|
3534
|
+
reserved: /^(absolute|action|add|admin|after|aggregate|alias|all|allocate|alter|and|any|are|array|as|asc|assertion|at|authorization|before|begin|binary|bit|blob|boolean|both|breadth|by|call|cascade|cascaded|case|cast|catalog|char|character|check|class|clob|close|collate|collation|column|commit|completion|connect|connection|constraint|constraints|constructor|continue|corresponding|create|cross|cube|current|current_date|current_path|current_role|current_time|current_timestamp|current_user|cursor|cycle|data|date|day|deallocate|dec|decimal|declare|default|deferrable|deferred|delete|depth|deref|desc|describe|descriptor|destroy|destructor|deterministic|diagnostics|dictionary|disconnect|distinct|domain|double|drop|dynamic|each|else|end|end-exec|equals|escape|every|except|exception|exec|execute|external|false|fetch|first|float|for|foreign|found|free|from|full|function|general|get|global|go|goto|grant|group|grouping|having|host|hour|identity|ignore|immediate|in|indicator|initialize|initially|inner|inout|input|insert|int|integer|intersect|interval|into|is|isolation|iterate|join|key|language|large|last|lateral|leading|left|less|level|like|limit|local|localtime|localtimestamp|locator|map|match|minute|modifies|modify|module|month|names|national|natural|nchar|nclob|new|next|no|none|not|null|numeric|object|of|off|old|on|only|open|operation|option|or|order|ordinality|out|outer|output|pad|parameter|parameters|partial|path|postfix|precision|prefix|preorder|prepare|preserve|primary|prior|privileges|procedure|public|read|reads|real|recursive|ref|references|referencing|relative|restrict|result|return|returns|revoke|right|role|rollback|rollup|routine|row|rows|savepoint|schema|scope|scroll|search|second|section|select|sequence|session|session_user|set|sets|size|smallint|some|space|specific|specifictype|sql|sqlexception|sqlstate|sqlwarning|start|state|statement|static|structure|system_user|table|temporary|terminate|than|then|time|timestamp|timezone_hour|timezone_minute|to|trailing|transaction|translation|treat|trigger|true|under|union|unique|unknown|unnest|update|usage|user|using|value|values|varchar|variable|varying|view|when|whenever|where|with|without|work|write|year|zone)$/i,
|
|
3535
|
+
keyword: /^(abs|ada|asensitive|assignment|asymmetric|atomic|avg|between|bitvar|bit_length|c|called|cardinality|catalog_name|chain|character_length|character_set_catalog|character_set_name|character_set_schema|char_length|checked|class_origin|coalesce|cobol|collation_catalog|collation_name|collation_schema|column_name|command_function|command_function_code|committed|condition_number|connection_name|constraint_catalog|constraint_name|constraint_schema|contains|convert|count|cursor_name|datetime_interval_code|datetime_interval_precision|defined|definer|dispatch|dynamic_function|dynamic_function_code|existing|exists|extract|final|fortran|g|generated|granted|hierarchy|hold|implementation|infix|insensitive|instance|instantiable|invoker|k|key_member|key_type|length|lower|m|max|message_length|message_octet_length|message_text|method|min|mod|more|mumps|name|nullable|nullif|number|octet_length|options|overlaps|overlay|overriding|parameter_mode|parameter_name|parameter_ordinal_position|parameter_specific_catalog|parameter_specific_name|parameter_specific_schema|pascal|pli|position|repeatable|returned_length|returned_octet_length|returned_sqlstate|routine_catalog|routine_name|routine_schema|row_count|scale|schema_name|security|self|sensitive|serializable|server_name|similar|simple|source|specific_name|style|subclass_origin|sublist|substring|sum|symmetric|system|table_name|transactions_committed|transactions_rolled_back|transaction_active|transform|transforms|translate|trigger_catalog|trigger_name|trigger_schema|trim|type|uncommitted|unnamed|upper|user_defined_type_catalog|user_defined_type_name|user_defined_type_schema)$/i
|
|
3536
|
+
},
|
|
3537
|
+
-1,
|
|
3538
|
+
-1,
|
|
3539
|
+
-1,
|
|
3540
|
+
{},
|
|
3541
|
+
{},
|
|
3542
|
+
{},
|
|
3543
|
+
{}
|
|
3544
|
+
],
|
|
3545
|
+
0: [],
|
|
3546
|
+
1: [],
|
|
3547
|
+
2: [],
|
|
3548
|
+
3: [],
|
|
3549
|
+
4: [{}],
|
|
3550
|
+
7: [],
|
|
3551
|
+
8: [],
|
|
3552
|
+
9: [],
|
|
3553
|
+
10: []
|
|
3554
|
+
},
|
|
3555
|
+
kwmap: {
|
|
3556
|
+
reserved: "reserved",
|
|
3557
|
+
keyword: "var"
|
|
3558
|
+
},
|
|
3559
|
+
parts: {
|
|
3560
|
+
0: [],
|
|
3561
|
+
1: [],
|
|
3562
|
+
2: [null],
|
|
3563
|
+
3: [null, null, null, null, null, null, null, null, null, null, null],
|
|
3564
|
+
4: [null]
|
|
3565
|
+
},
|
|
3566
|
+
subst: {
|
|
3567
|
+
[-1]: [false, false, false, false, false, false, false, false, false, false, false],
|
|
3568
|
+
0: [],
|
|
3569
|
+
1: [],
|
|
3570
|
+
2: [false],
|
|
3571
|
+
3: [false, false, false, false, false, false, false, false, false, false, false],
|
|
3572
|
+
4: [false]
|
|
3573
|
+
}
|
|
3574
|
+
};
|
|
3575
|
+
|
|
3576
|
+
// packages/render/src/libs/highlighter/languages/xml.ts
|
|
3577
|
+
var xmlLang = {
|
|
3578
|
+
language: "xml",
|
|
3579
|
+
defClass: "code",
|
|
3580
|
+
regs: {
|
|
3581
|
+
[-1]: /(<!\[CDATA\[)|(<!--)|(<[?/]?)|((&|%)[\w\-.]+;)/gi,
|
|
3582
|
+
0: null,
|
|
3583
|
+
1: null,
|
|
3584
|
+
2: /((?<=[</?])[\w\-:]+)|([\w\-:]+)|(")/gi,
|
|
3585
|
+
3: /((&|%)[\w\-.]+;)/gi
|
|
3586
|
+
},
|
|
3587
|
+
counts: {
|
|
3588
|
+
[-1]: [0, 0, 0, 1],
|
|
3589
|
+
0: [],
|
|
3590
|
+
1: [],
|
|
3591
|
+
2: [0, 0, 0],
|
|
3592
|
+
3: [1]
|
|
3593
|
+
},
|
|
3594
|
+
delim: {
|
|
3595
|
+
[-1]: ["comment", "comment", "brackets", ""],
|
|
3596
|
+
0: [],
|
|
3597
|
+
1: [],
|
|
3598
|
+
2: ["", "", "quotes"],
|
|
3599
|
+
3: [""]
|
|
3600
|
+
},
|
|
3601
|
+
inner: {
|
|
3602
|
+
[-1]: ["comment", "comment", "code", "special"],
|
|
3603
|
+
0: [],
|
|
3604
|
+
1: [],
|
|
3605
|
+
2: ["reserved", "var", "string"],
|
|
3606
|
+
3: ["special"]
|
|
3607
|
+
},
|
|
3608
|
+
end: {
|
|
3609
|
+
0: /\]\]>/gi,
|
|
3610
|
+
1: /-->/gi,
|
|
3611
|
+
2: /[/?]?>/gi,
|
|
3612
|
+
3: /"/gi
|
|
3613
|
+
},
|
|
3614
|
+
states: {
|
|
3615
|
+
[-1]: [0, 1, 2, -1],
|
|
3616
|
+
0: [],
|
|
3617
|
+
1: [],
|
|
3618
|
+
2: [-1, -1, 3],
|
|
3619
|
+
3: [-1]
|
|
3620
|
+
},
|
|
3621
|
+
keywords: {
|
|
3622
|
+
[-1]: [-1, -1, -1, {}],
|
|
3623
|
+
0: [],
|
|
3624
|
+
1: [],
|
|
3625
|
+
2: [{}, {}, -1],
|
|
3626
|
+
3: [{}]
|
|
3627
|
+
},
|
|
3628
|
+
kwmap: {},
|
|
3629
|
+
parts: {
|
|
3630
|
+
0: [],
|
|
3631
|
+
1: [],
|
|
3632
|
+
2: [null, null, null],
|
|
3633
|
+
3: [null]
|
|
3634
|
+
},
|
|
3635
|
+
subst: {
|
|
3636
|
+
[-1]: [false, false, false, false],
|
|
3637
|
+
0: [],
|
|
3638
|
+
1: [],
|
|
3639
|
+
2: [false, false, false],
|
|
3640
|
+
3: [false]
|
|
3641
|
+
}
|
|
3642
|
+
};
|
|
3643
|
+
|
|
3644
|
+
// packages/render/src/libs/highlighter/index.ts
|
|
3645
|
+
var LANGUAGES = {
|
|
3646
|
+
css: cssLang,
|
|
3647
|
+
cpp: cppLang,
|
|
3648
|
+
diff: diffLang,
|
|
3649
|
+
dtd: dtdLang,
|
|
3650
|
+
html: htmlLang,
|
|
3651
|
+
java: javaLang,
|
|
3652
|
+
javascript: javascriptLang,
|
|
3653
|
+
php: phpLang,
|
|
3654
|
+
python: pythonLang,
|
|
3655
|
+
ruby: rubyLang,
|
|
3656
|
+
sql: sqlLang,
|
|
3657
|
+
xml: xmlLang,
|
|
3658
|
+
xhtml: htmlLang
|
|
3659
|
+
};
|
|
3660
|
+
function highlight(code, language) {
|
|
3661
|
+
const def = LANGUAGES[language.toLowerCase()];
|
|
3662
|
+
if (!def)
|
|
3663
|
+
return null;
|
|
3664
|
+
const tokens = tokenize(def, code);
|
|
3665
|
+
return renderTokens(tokens);
|
|
3666
|
+
}
|
|
3667
|
+
|
|
3668
|
+
// packages/render/src/elements/code.ts
|
|
3669
|
+
function renderCode(ctx, data) {
|
|
3670
|
+
ctx.push(`<div class="code">`);
|
|
3671
|
+
if (data.contents === "") {
|
|
3672
|
+
ctx.push("</div>");
|
|
3673
|
+
return;
|
|
3674
|
+
}
|
|
3675
|
+
if (data.language) {
|
|
3676
|
+
const highlighted = highlight(data.contents, data.language);
|
|
3677
|
+
if (highlighted) {
|
|
3678
|
+
ctx.push(highlighted);
|
|
3679
|
+
} else {
|
|
3680
|
+
ctx.push(`<pre><code>${escapeHtml(data.contents)}</code></pre>`);
|
|
3681
|
+
}
|
|
3682
|
+
} else {
|
|
3683
|
+
ctx.push(`<pre><code>${escapeHtml(data.contents)}</code></pre>`);
|
|
3684
|
+
}
|
|
3685
|
+
ctx.push("</div>");
|
|
3686
|
+
}
|
|
3687
|
+
|
|
3688
|
+
// packages/render/src/hash.ts
|
|
3689
|
+
function syncHashSha1(input) {
|
|
3690
|
+
return fnv1aHash(input, 40);
|
|
3691
|
+
}
|
|
3692
|
+
function syncHashMd5(input) {
|
|
3693
|
+
return fnv1aHash(input, 32);
|
|
3694
|
+
}
|
|
3695
|
+
function fnv1aHash(input, hexLen) {
|
|
3696
|
+
let result = "";
|
|
3697
|
+
const rounds = Math.ceil(hexLen / 8);
|
|
3698
|
+
for (let round = 0;round < rounds; round++) {
|
|
3699
|
+
let h = 2166136261 ^ round;
|
|
3700
|
+
for (let i = 0;i < input.length; i++) {
|
|
3701
|
+
h ^= input.charCodeAt(i);
|
|
3702
|
+
h = Math.imul(h, 16777619);
|
|
3703
|
+
}
|
|
3704
|
+
result += (h >>> 0).toString(16).padStart(8, "0");
|
|
3705
|
+
}
|
|
3706
|
+
return result.substring(0, hexLen);
|
|
3707
|
+
}
|
|
3708
|
+
|
|
3709
|
+
// packages/render/src/elements/tab-view.ts
|
|
3710
|
+
function renderTabView(ctx, tabs) {
|
|
3711
|
+
const labelString = tabs.map((t) => t.label).join("");
|
|
3712
|
+
const hash = md5Hash(labelString);
|
|
3713
|
+
const widgetId = `wiki-tabview-${hash}`;
|
|
3714
|
+
ctx.push(`<div id="${widgetId}" class="yui-navset">`);
|
|
3715
|
+
ctx.push(`<ul class="yui-nav">`);
|
|
3716
|
+
for (let i = 0;i < tabs.length; i++) {
|
|
3717
|
+
const tab = tabs[i];
|
|
3718
|
+
const selectedClass = i === 0 ? ` class="selected"` : "";
|
|
3719
|
+
ctx.push(`<li${selectedClass}>`);
|
|
3720
|
+
ctx.push(`<a href="javascript:;"><em>${escapeHtml(tab.label)}</em></a>`);
|
|
3721
|
+
ctx.push("</li>");
|
|
3722
|
+
}
|
|
3723
|
+
ctx.push("</ul>");
|
|
3724
|
+
ctx.push(`<div class="yui-content">`);
|
|
3725
|
+
for (let i = 0;i < tabs.length; i++) {
|
|
3726
|
+
const tab = tabs[i];
|
|
3727
|
+
const displayStyle = i === 0 ? "" : ` style="display: none"`;
|
|
3728
|
+
ctx.push(`<div id="wiki-tab-0-${i}"${displayStyle}>`);
|
|
3729
|
+
renderElements(ctx, tab.elements);
|
|
3730
|
+
ctx.push("</div>");
|
|
3731
|
+
}
|
|
3732
|
+
ctx.push("</div>");
|
|
3733
|
+
ctx.push("</div>");
|
|
3734
|
+
}
|
|
3735
|
+
function md5Hash(input) {
|
|
3736
|
+
return syncHashMd5(input);
|
|
3737
|
+
}
|
|
3738
|
+
|
|
3739
|
+
// packages/render/src/elements/footnote.ts
|
|
3740
|
+
function renderFootnoteRef(ctx, index) {
|
|
3741
|
+
ctx.push(`<sup class="footnoteref">`);
|
|
3742
|
+
ctx.push(`<a id="footnoteref-${index}" href="javascript:;" class="footnoteref">${index}</a>`);
|
|
3743
|
+
ctx.push("</sup>");
|
|
3744
|
+
}
|
|
3745
|
+
function renderFootnoteBlock(ctx, data) {
|
|
3746
|
+
if (data.hide)
|
|
3747
|
+
return;
|
|
3748
|
+
if (ctx.footnotes.length === 0)
|
|
3749
|
+
return;
|
|
3750
|
+
const title = data.title ?? "Footnotes";
|
|
3751
|
+
ctx.push(`<div class="footnotes-footer">`);
|
|
3752
|
+
ctx.push(`<div class="title">${escapeHtml(title)}</div>`);
|
|
3753
|
+
for (let i = 0;i < ctx.footnotes.length; i++) {
|
|
3754
|
+
const index = i + 1;
|
|
3755
|
+
const elements = ctx.footnotes[i] ?? [];
|
|
3756
|
+
ctx.push(`<div class="footnote-footer" id="footnote-${index}">`);
|
|
3757
|
+
ctx.push(`<a href="javascript:;">${index}</a>. `);
|
|
3758
|
+
renderElements(ctx, elements);
|
|
3759
|
+
ctx.push("</div>");
|
|
3760
|
+
}
|
|
3761
|
+
ctx.push("</div>");
|
|
3762
|
+
}
|
|
3763
|
+
|
|
3764
|
+
// packages/render/src/elements/math.ts
|
|
3765
|
+
function renderMath(ctx, data) {
|
|
3766
|
+
const index = ctx.nextEquationIndex() + 1;
|
|
3767
|
+
if (data.name) {
|
|
3768
|
+
ctx.push(`<span class="equation-number">(${index})</span>`);
|
|
3769
|
+
}
|
|
3770
|
+
const id = data.name ? `equation-${data.name}` : `equation-${index}`;
|
|
3771
|
+
ctx.push(`<div class="math-equation" id="${escapeAttr(id)}">`);
|
|
3772
|
+
ctx.push(escapeHtml(data["latex-source"]));
|
|
3773
|
+
ctx.push("</div>");
|
|
3774
|
+
}
|
|
3775
|
+
function renderMathInline(ctx, data) {
|
|
3776
|
+
ctx.push(`<span class="math-inline">$`);
|
|
3777
|
+
ctx.push(escapeHtml(data["latex-source"]));
|
|
3778
|
+
ctx.push("$</span>");
|
|
3779
|
+
}
|
|
3780
|
+
function renderEquationRef(ctx, name) {
|
|
3781
|
+
const id = `equation-${name}`;
|
|
3782
|
+
ctx.push(`<a class="equation-ref" href="#${escapeAttr(id)}">`);
|
|
3783
|
+
ctx.push(escapeHtml(name));
|
|
3784
|
+
ctx.push("</a>");
|
|
3785
|
+
}
|
|
3786
|
+
|
|
3787
|
+
// packages/render/src/elements/module/backlinks.ts
|
|
3788
|
+
function renderBacklinks(ctx, _data) {
|
|
3789
|
+
ctx.push(`<div class="backlinks-module-box">
|
|
3790
|
+
</div>`);
|
|
3791
|
+
}
|
|
3792
|
+
|
|
3793
|
+
// packages/render/src/elements/module/categories.ts
|
|
3794
|
+
function renderCategories(ctx, _data) {
|
|
3795
|
+
ctx.push(`<div class="categories-module-box">`);
|
|
3796
|
+
ctx.push("</div>");
|
|
3797
|
+
}
|
|
3798
|
+
|
|
3799
|
+
// packages/render/src/elements/module/join.ts
|
|
3800
|
+
function renderJoin(ctx, data) {
|
|
3801
|
+
const buttonText = data["button-text"] ?? "Join";
|
|
3802
|
+
const attrs = data.attributes ?? {};
|
|
3803
|
+
const className = attrs.class ?? "join-box";
|
|
3804
|
+
ctx.push(`<div class="${escapeHtml(className)}">`);
|
|
3805
|
+
ctx.push(`<a href="javascript:;">${escapeHtml(buttonText)}</a>`);
|
|
3806
|
+
ctx.push("</div>");
|
|
3807
|
+
}
|
|
3808
|
+
|
|
3809
|
+
// packages/render/src/elements/module/page-tree.ts
|
|
3810
|
+
function renderPageTree(ctx, _data) {
|
|
3811
|
+
ctx.push(`<div class="page-tree-module-box">`);
|
|
3812
|
+
ctx.push("</div>");
|
|
3813
|
+
}
|
|
3814
|
+
|
|
3815
|
+
// packages/render/src/elements/module/rate.ts
|
|
3816
|
+
function renderRate(ctx) {
|
|
3817
|
+
ctx.push(`<div class="page-rate-widget-box">`);
|
|
3818
|
+
ctx.push(`<span class="rate-points">rating: <span class="number prw54353">0</span></span>`);
|
|
3819
|
+
ctx.push(`<span class="rateup btn btn-default"><a title="I like it" href="javascript:;">+</a></span>`);
|
|
3820
|
+
ctx.push(`<span class="ratedown btn btn-default"><a title="I don't like it" href="javascript:;">–</a></span>`);
|
|
3821
|
+
ctx.push(`<span class="cancel btn btn-default"><a title="Cancel my vote" href="javascript:;">x</a></span>`);
|
|
3822
|
+
ctx.push("</div>");
|
|
3823
|
+
}
|
|
3824
|
+
|
|
3825
|
+
// packages/render/src/elements/module/listusers.ts
|
|
3826
|
+
function renderListUsers(ctx, _data) {
|
|
3827
|
+
ctx.push(`<div class="list-users-module-box">`);
|
|
3828
|
+
ctx.push("</div>");
|
|
3829
|
+
}
|
|
3830
|
+
|
|
3831
|
+
// packages/render/src/elements/module/listpages.ts
|
|
3832
|
+
function renderListPages(ctx, _data) {
|
|
3833
|
+
ctx.push(`<div class="list-pages-box">`);
|
|
3834
|
+
ctx.push("</div>");
|
|
3835
|
+
}
|
|
3836
|
+
|
|
3837
|
+
// packages/render/src/elements/module/index.ts
|
|
3838
|
+
function renderModule(ctx, data) {
|
|
3839
|
+
switch (data.module) {
|
|
3840
|
+
case "unknown":
|
|
3841
|
+
ctx.push(`<div class="error-block">[[module <em>${data.name}</em>]] No such module, please <a href="http://www.wikidot.com/doc:modules" target="_blank">check available modules</a> and fix this page.</div>`);
|
|
3842
|
+
break;
|
|
3843
|
+
case "backlinks":
|
|
3844
|
+
renderBacklinks(ctx, data);
|
|
3845
|
+
break;
|
|
3846
|
+
case "categories":
|
|
3847
|
+
renderCategories(ctx, data);
|
|
3848
|
+
break;
|
|
3849
|
+
case "join":
|
|
3850
|
+
renderJoin(ctx, data);
|
|
3851
|
+
break;
|
|
3852
|
+
case "page-tree":
|
|
3853
|
+
renderPageTree(ctx, data);
|
|
3854
|
+
break;
|
|
3855
|
+
case "rate":
|
|
3856
|
+
renderRate(ctx);
|
|
3857
|
+
break;
|
|
3858
|
+
case "list-users":
|
|
3859
|
+
renderListUsers(ctx, data);
|
|
3860
|
+
break;
|
|
3861
|
+
case "list-pages":
|
|
3862
|
+
renderListPages(ctx, data);
|
|
3863
|
+
break;
|
|
3864
|
+
}
|
|
3865
|
+
}
|
|
3866
|
+
|
|
3867
|
+
// packages/render/src/elements/embed.ts
|
|
3868
|
+
function isValidVideoId(id) {
|
|
3869
|
+
return /^[a-zA-Z0-9_-]+$/.test(id);
|
|
3870
|
+
}
|
|
3871
|
+
function isValidGithubUsername(username) {
|
|
3872
|
+
return /^[a-zA-Z0-9]([a-zA-Z0-9-]{0,37}[a-zA-Z0-9])?$/.test(username);
|
|
3873
|
+
}
|
|
3874
|
+
function isValidGistHash(hash) {
|
|
3875
|
+
return /^[a-f0-9]+$/.test(hash);
|
|
3876
|
+
}
|
|
3877
|
+
function isValidGitlabSnippetId(id) {
|
|
3878
|
+
return /^[0-9]+$/.test(id);
|
|
3879
|
+
}
|
|
3880
|
+
function renderEmbed(ctx, data) {
|
|
3881
|
+
switch (data.embed) {
|
|
3882
|
+
case "youtube":
|
|
3883
|
+
renderYoutube(ctx, data.data["video-id"]);
|
|
3884
|
+
break;
|
|
3885
|
+
case "vimeo":
|
|
3886
|
+
renderVimeo(ctx, data.data["video-id"]);
|
|
3887
|
+
break;
|
|
3888
|
+
case "github-gist":
|
|
3889
|
+
renderGithubGist(ctx, data.data.username, data.data.hash);
|
|
3890
|
+
break;
|
|
3891
|
+
case "gitlab-snippet":
|
|
3892
|
+
renderGitlabSnippet(ctx, data.data["snippet-id"]);
|
|
3893
|
+
break;
|
|
3894
|
+
}
|
|
3895
|
+
}
|
|
3896
|
+
function renderYoutube(ctx, videoId) {
|
|
3897
|
+
if (!isValidVideoId(videoId)) {
|
|
3898
|
+
ctx.push(`<!-- Invalid YouTube video ID -->`);
|
|
3899
|
+
return;
|
|
3900
|
+
}
|
|
3901
|
+
ctx.push(`<div class="embed-youtube">`);
|
|
3902
|
+
ctx.push(`<iframe src="https://www.youtube.com/embed/${escapeAttr(videoId)}" ` + `frameborder="0" allowfullscreen></iframe>`);
|
|
3903
|
+
ctx.push("</div>");
|
|
3904
|
+
}
|
|
3905
|
+
function renderVimeo(ctx, videoId) {
|
|
3906
|
+
if (!isValidVideoId(videoId)) {
|
|
3907
|
+
ctx.push(`<!-- Invalid Vimeo video ID -->`);
|
|
3908
|
+
return;
|
|
3909
|
+
}
|
|
3910
|
+
ctx.push(`<div class="embed-vimeo">`);
|
|
3911
|
+
ctx.push(`<iframe src="https://player.vimeo.com/video/${escapeAttr(videoId)}" ` + `frameborder="0" allowfullscreen></iframe>`);
|
|
3912
|
+
ctx.push("</div>");
|
|
3913
|
+
}
|
|
3914
|
+
function renderGithubGist(ctx, username, hash) {
|
|
3915
|
+
if (!isValidGithubUsername(username) || !isValidGistHash(hash)) {
|
|
3916
|
+
ctx.push(`<!-- Invalid GitHub Gist parameters -->`);
|
|
3917
|
+
return;
|
|
3918
|
+
}
|
|
3919
|
+
ctx.push(`<script src="https://gist.github.com/${escapeAttr(username)}/${escapeAttr(hash)}.js"></script>`);
|
|
3920
|
+
}
|
|
3921
|
+
function renderGitlabSnippet(ctx, snippetId) {
|
|
3922
|
+
if (!isValidGitlabSnippetId(snippetId)) {
|
|
3923
|
+
ctx.push(`<!-- Invalid GitLab snippet ID -->`);
|
|
3924
|
+
return;
|
|
3925
|
+
}
|
|
3926
|
+
ctx.push(`<script src="https://gitlab.com/snippets/${escapeAttr(snippetId)}.js"></script>`);
|
|
3927
|
+
}
|
|
3928
|
+
|
|
3929
|
+
// packages/render/src/elements/user.ts
|
|
3930
|
+
function renderUser(ctx, data) {
|
|
3931
|
+
const resolved = ctx.options.resolvers?.user?.(data.name) ?? null;
|
|
3932
|
+
if (resolved === null) {
|
|
3933
|
+
ctx.push(escapeHtml(data.name));
|
|
3934
|
+
return;
|
|
3935
|
+
}
|
|
3936
|
+
const displayName = resolved.name ?? data.name;
|
|
3937
|
+
const hrefAttr = resolved.url ? ` href="${escapeAttr(resolved.url)}"` : "";
|
|
3938
|
+
const showAvatar = data["show-avatar"] && resolved.url && resolved.avatarUrl;
|
|
3939
|
+
if (showAvatar) {
|
|
3940
|
+
ctx.push(`<span class="printuser avatarhover">`);
|
|
3941
|
+
ctx.push(`<a${hrefAttr}>`);
|
|
3942
|
+
ctx.push(`<img class="small" src="${escapeAttr(resolved.avatarUrl)}" alt="${escapeAttr(displayName)}" />`);
|
|
3943
|
+
ctx.push("</a>");
|
|
3944
|
+
ctx.push(`<a${hrefAttr}>`);
|
|
3945
|
+
ctx.push(escapeHtml(displayName));
|
|
3946
|
+
ctx.push("</a>");
|
|
3947
|
+
ctx.push("</span>");
|
|
3948
|
+
} else {
|
|
3949
|
+
ctx.push(`<span class="printuser">`);
|
|
3950
|
+
ctx.push(`<a${hrefAttr}>`);
|
|
3951
|
+
ctx.push(escapeHtml(displayName));
|
|
3952
|
+
ctx.push("</a>");
|
|
3953
|
+
ctx.push("</span>");
|
|
3954
|
+
}
|
|
3955
|
+
}
|
|
3956
|
+
|
|
3957
|
+
// packages/render/src/elements/bibliography.ts
|
|
3958
|
+
function renderBibliographyCite(ctx, data) {
|
|
3959
|
+
if (data.brackets) {
|
|
3960
|
+
ctx.push("[");
|
|
3961
|
+
}
|
|
3962
|
+
ctx.push(`<a class="bibcite" href="javascript:;">`);
|
|
3963
|
+
ctx.push(escapeHtml(data.label));
|
|
3964
|
+
ctx.push("</a>");
|
|
3965
|
+
if (data.brackets) {
|
|
3966
|
+
ctx.push("]");
|
|
3967
|
+
}
|
|
3968
|
+
}
|
|
3969
|
+
function renderBibliographyBlock(ctx, data) {
|
|
3970
|
+
if (data.hide)
|
|
3971
|
+
return;
|
|
3972
|
+
const title = data.title ?? "Bibliography";
|
|
3973
|
+
ctx.push(`<div class="bibitems">`);
|
|
3974
|
+
ctx.push(`<div class="title">${escapeHtml(title)}</div>`);
|
|
3975
|
+
ctx.push("</div>");
|
|
3976
|
+
}
|
|
3977
|
+
|
|
3978
|
+
// packages/render/src/elements/toc.ts
|
|
3979
|
+
function extractLinkText(element) {
|
|
3980
|
+
if (element.element !== "link")
|
|
3981
|
+
return null;
|
|
3982
|
+
const label = element.data.label;
|
|
3983
|
+
let text = "";
|
|
3984
|
+
if (typeof label === "object" && label !== null && "text" in label) {
|
|
3985
|
+
text = label.text;
|
|
3986
|
+
}
|
|
3987
|
+
const href = typeof element.data.link === "string" ? element.data.link : "";
|
|
3988
|
+
return { href, text };
|
|
3989
|
+
}
|
|
3990
|
+
function renderTocEntries(ctx, elements) {
|
|
3991
|
+
for (const element of elements) {
|
|
3992
|
+
if (element.element === "list") {
|
|
3993
|
+
renderTocList(ctx, element.data, 1);
|
|
3994
|
+
}
|
|
3995
|
+
}
|
|
3996
|
+
}
|
|
3997
|
+
function renderTocList(ctx, listData, depth) {
|
|
3998
|
+
for (const item of listData.items) {
|
|
3999
|
+
renderTocItem(ctx, item, depth);
|
|
4000
|
+
}
|
|
4001
|
+
}
|
|
4002
|
+
function renderTocItem(ctx, item, depth) {
|
|
4003
|
+
if (item["item-type"] === "elements") {
|
|
4004
|
+
for (const el of item.elements) {
|
|
4005
|
+
const link = extractLinkText(el);
|
|
4006
|
+
if (link) {
|
|
4007
|
+
ctx.push(`<div style="margin-left: ${depth}em;"><a href="${escapeHtml(link.href)}">${escapeHtml(link.text)}</a></div>`);
|
|
4008
|
+
}
|
|
4009
|
+
}
|
|
4010
|
+
} else if (item["item-type"] === "sub-list") {
|
|
4011
|
+
renderTocList(ctx, item.data, depth + 1);
|
|
4012
|
+
}
|
|
4013
|
+
}
|
|
4014
|
+
function renderTableOfContents(ctx, data) {
|
|
4015
|
+
const isFloat = data.align === "left" || data.align === "right";
|
|
4016
|
+
if (!isFloat) {
|
|
4017
|
+
ctx.push(`<table style="margin:0; padding:0"><tr><td style="margin:0; padding:0">`);
|
|
4018
|
+
}
|
|
4019
|
+
if (isFloat) {
|
|
4020
|
+
const floatClass = data.align === "left" ? "floatleft" : "floatright";
|
|
4021
|
+
ctx.push(`<div id="toc" class="${floatClass}">`);
|
|
4022
|
+
} else {
|
|
4023
|
+
ctx.push(`<div id="toc">`);
|
|
4024
|
+
}
|
|
4025
|
+
ctx.push(`<div id="toc-action-bar"><a href="javascript:;">Fold</a><a style="display: none" href="javascript:;">Unfold</a></div>`);
|
|
4026
|
+
ctx.push(`<div class="title">Table of Contents</div>`);
|
|
4027
|
+
ctx.push(`<div id="toc-list">`);
|
|
4028
|
+
renderTocEntries(ctx, ctx.tocElements);
|
|
4029
|
+
ctx.push("</div>");
|
|
4030
|
+
ctx.push("</div>");
|
|
4031
|
+
if (!isFloat) {
|
|
4032
|
+
ctx.push(`</td></tr></table>`);
|
|
4033
|
+
}
|
|
4034
|
+
}
|
|
4035
|
+
|
|
4036
|
+
// packages/render/src/elements/line-break.ts
|
|
4037
|
+
function renderLineBreaks(ctx, count) {
|
|
4038
|
+
for (let i = 0;i < count; i++) {
|
|
4039
|
+
ctx.push("<br />");
|
|
4040
|
+
}
|
|
4041
|
+
}
|
|
4042
|
+
|
|
4043
|
+
// packages/render/src/elements/clear-float.ts
|
|
4044
|
+
function renderClearFloat(ctx, direction) {
|
|
4045
|
+
ctx.push(`<div style="clear:${direction}; height: 0px; font-size: 1px"></div>`);
|
|
4046
|
+
}
|
|
4047
|
+
|
|
4048
|
+
// packages/render/src/elements/iframe.ts
|
|
4049
|
+
function renderIframe(ctx, data) {
|
|
4050
|
+
const url = isDangerousUrl(data.url) ? "#invalid-url" : data.url;
|
|
4051
|
+
const attrs = [`src="${escapeAttr(url)}"`];
|
|
4052
|
+
const iframeAttrs = ["align", "frameborder", "height", "scrolling", "width", "class", "style"];
|
|
4053
|
+
for (const attr of iframeAttrs) {
|
|
4054
|
+
let value = data.attributes[attr] ?? "";
|
|
4055
|
+
if (attr === "style") {
|
|
4056
|
+
value = sanitizeStyleValue(value);
|
|
4057
|
+
}
|
|
4058
|
+
attrs.push(`${attr}="${escapeAttr(value)}"`);
|
|
4059
|
+
}
|
|
4060
|
+
ctx.push(`<p><iframe ${attrs.join(" ")}></iframe></p>`);
|
|
4061
|
+
}
|
|
4062
|
+
|
|
4063
|
+
// packages/render/src/elements/html.ts
|
|
4064
|
+
function generateDefaultUrl(pageName, contents) {
|
|
4065
|
+
const hash = syncHashSha1(contents);
|
|
4066
|
+
const nonce = BigInt(contents.length) * 1000000000n + BigInt(hash.charCodeAt(0)) * 100000000n;
|
|
4067
|
+
const path = pageName ? `/${pageName}/html/${hash}-${nonce}` : `/html/${hash}-${nonce}`;
|
|
4068
|
+
return path;
|
|
4069
|
+
}
|
|
4070
|
+
function renderHtmlBlock(ctx, data) {
|
|
4071
|
+
const index = ctx.nextHtmlBlockIndex();
|
|
4072
|
+
const pageName = ctx.page?.pageName ?? "";
|
|
4073
|
+
const callbackUrl = ctx.options.resolvers?.htmlBlockUrl?.(index);
|
|
4074
|
+
const src = callbackUrl || generateDefaultUrl(pageName, data.contents);
|
|
4075
|
+
const sandbox = ctx.options.htmlBlockSandbox;
|
|
4076
|
+
const sandboxAttr = sandbox ? ` sandbox="${escapeAttr(sandbox)}"` : "";
|
|
4077
|
+
ctx.push(`<iframe src="${escapeAttr(src)}"${sandboxAttr} allowtransparency="true" frameborder="0" class="html-block-iframe"></iframe>`);
|
|
4078
|
+
}
|
|
4079
|
+
|
|
4080
|
+
// packages/render/src/elements/include.ts
|
|
4081
|
+
function renderInclude(ctx, data) {
|
|
4082
|
+
renderElements(ctx, data.elements);
|
|
4083
|
+
}
|
|
4084
|
+
|
|
4085
|
+
// packages/render/src/elements/iftags.ts
|
|
4086
|
+
function renderIfTags(ctx, data) {
|
|
4087
|
+
renderElements(ctx, data.elements);
|
|
4088
|
+
}
|
|
4089
|
+
|
|
4090
|
+
// packages/render/src/elements/color.ts
|
|
4091
|
+
function renderColor(ctx, data) {
|
|
4092
|
+
const safeColor = sanitizeCssColor(data.color, "inherit");
|
|
4093
|
+
ctx.push(`<span style="color: ${escapeAttr(safeColor)}">`);
|
|
4094
|
+
renderElements(ctx, data.elements);
|
|
4095
|
+
ctx.push("</span>");
|
|
4096
|
+
}
|
|
4097
|
+
|
|
4098
|
+
// packages/render/src/elements/date.ts
|
|
4099
|
+
function renderDate(ctx, data) {
|
|
4100
|
+
const date = new Date(data.value.timestamp * 1000);
|
|
4101
|
+
const formatted = data.format ? formatDate(date, data.format) : date.toLocaleString();
|
|
4102
|
+
if (data.hover) {
|
|
4103
|
+
ctx.push(`<span class="odate">${escapeHtml(formatted)}</span>`);
|
|
4104
|
+
} else {
|
|
4105
|
+
ctx.push(escapeHtml(formatted));
|
|
4106
|
+
}
|
|
4107
|
+
}
|
|
4108
|
+
function formatDate(date, format) {
|
|
4109
|
+
return format.replace(/%Y/g, String(date.getFullYear())).replace(/%m/g, String(date.getMonth() + 1).padStart(2, "0")).replace(/%d/g, String(date.getDate()).padStart(2, "0")).replace(/%H/g, String(date.getHours()).padStart(2, "0")).replace(/%M/g, String(date.getMinutes()).padStart(2, "0")).replace(/%S/g, String(date.getSeconds()).padStart(2, "0"));
|
|
4110
|
+
}
|
|
4111
|
+
|
|
4112
|
+
// packages/render/src/utils/expr-eval.ts
|
|
4113
|
+
var FALSE_VALUES = new Set(["false", "null", "", "0"]);
|
|
4114
|
+
function isTruthy(value) {
|
|
4115
|
+
return !FALSE_VALUES.has(value.toLowerCase().trim());
|
|
4116
|
+
}
|
|
4117
|
+
var MAX_EXPRESSION_LENGTH = 256;
|
|
4118
|
+
function isTruthyNum(n) {
|
|
4119
|
+
return n !== 0 && !Number.isNaN(n);
|
|
4120
|
+
}
|
|
4121
|
+
function evaluateExpression(expr) {
|
|
4122
|
+
try {
|
|
4123
|
+
if (expr.length > MAX_EXPRESSION_LENGTH) {
|
|
4124
|
+
return { success: false, error: "expression too long" };
|
|
4125
|
+
}
|
|
4126
|
+
if (expr.trim() === "") {
|
|
4127
|
+
return { success: false, error: "empty expression" };
|
|
4128
|
+
}
|
|
4129
|
+
const tokens = tokenize2(expr);
|
|
4130
|
+
if (tokens.length <= 1) {
|
|
4131
|
+
return { success: false, error: "empty expression" };
|
|
4132
|
+
}
|
|
4133
|
+
const parser = new ExprParser(tokens);
|
|
4134
|
+
const result = parser.parse();
|
|
4135
|
+
if (!Number.isFinite(result)) {
|
|
4136
|
+
return { success: false, error: "division by zero" };
|
|
4137
|
+
}
|
|
4138
|
+
return { success: true, value: result };
|
|
4139
|
+
} catch (e) {
|
|
4140
|
+
const msg = e instanceof Error ? e.message : "unknown error";
|
|
4141
|
+
return { success: false, error: msg };
|
|
4142
|
+
}
|
|
4143
|
+
}
|
|
4144
|
+
function tokenize2(expr) {
|
|
4145
|
+
const tokens = [];
|
|
4146
|
+
let i = 0;
|
|
4147
|
+
while (i < expr.length) {
|
|
4148
|
+
const ch = expr[i];
|
|
4149
|
+
if (/\s/.test(ch)) {
|
|
4150
|
+
i++;
|
|
4151
|
+
continue;
|
|
4152
|
+
}
|
|
4153
|
+
if (/\d/.test(ch) || ch === "." && /\d/.test(expr[i + 1] ?? "")) {
|
|
4154
|
+
let numStr = "";
|
|
4155
|
+
let hasDot = false;
|
|
4156
|
+
while (i < expr.length) {
|
|
4157
|
+
const c = expr[i];
|
|
4158
|
+
if (c === ".") {
|
|
4159
|
+
if (hasDot)
|
|
4160
|
+
break;
|
|
4161
|
+
hasDot = true;
|
|
4162
|
+
} else if (!/\d/.test(c)) {
|
|
4163
|
+
break;
|
|
4164
|
+
}
|
|
4165
|
+
numStr += c;
|
|
4166
|
+
i++;
|
|
4167
|
+
}
|
|
4168
|
+
const num = parseFloat(numStr);
|
|
4169
|
+
if (!Number.isFinite(num)) {
|
|
4170
|
+
throw new Error("Invalid number");
|
|
4171
|
+
}
|
|
4172
|
+
tokens.push({ kind: "NUMBER", value: num });
|
|
4173
|
+
continue;
|
|
4174
|
+
}
|
|
4175
|
+
if (/[a-zA-Z_]/.test(ch)) {
|
|
4176
|
+
let id = "";
|
|
4177
|
+
while (i < expr.length) {
|
|
4178
|
+
const c = expr[i];
|
|
4179
|
+
if (!/[a-zA-Z0-9_]/.test(c))
|
|
4180
|
+
break;
|
|
4181
|
+
id += c;
|
|
4182
|
+
i++;
|
|
4183
|
+
}
|
|
4184
|
+
tokens.push({ kind: "IDENTIFIER", value: id.toLowerCase() });
|
|
4185
|
+
continue;
|
|
4186
|
+
}
|
|
4187
|
+
if (ch === "<" && expr[i + 1] === "=") {
|
|
4188
|
+
tokens.push({ kind: "LE", value: "<=" });
|
|
4189
|
+
i += 2;
|
|
4190
|
+
continue;
|
|
4191
|
+
}
|
|
4192
|
+
if (ch === ">" && expr[i + 1] === "=") {
|
|
4193
|
+
tokens.push({ kind: "GE", value: ">=" });
|
|
4194
|
+
i += 2;
|
|
4195
|
+
continue;
|
|
4196
|
+
}
|
|
4197
|
+
if (ch === "!" && expr[i + 1] === "=") {
|
|
4198
|
+
tokens.push({ kind: "NE", value: "!=" });
|
|
4199
|
+
i += 2;
|
|
4200
|
+
continue;
|
|
4201
|
+
}
|
|
4202
|
+
if (ch === "<" && expr[i + 1] === ">") {
|
|
4203
|
+
tokens.push({ kind: "NE", value: "<>" });
|
|
4204
|
+
i += 2;
|
|
4205
|
+
continue;
|
|
4206
|
+
}
|
|
4207
|
+
switch (ch) {
|
|
4208
|
+
case "+":
|
|
4209
|
+
tokens.push({ kind: "PLUS", value: "+" });
|
|
4210
|
+
break;
|
|
4211
|
+
case "-":
|
|
4212
|
+
tokens.push({ kind: "MINUS", value: "-" });
|
|
4213
|
+
break;
|
|
4214
|
+
case "*":
|
|
4215
|
+
tokens.push({ kind: "STAR", value: "*" });
|
|
4216
|
+
break;
|
|
4217
|
+
case "/":
|
|
4218
|
+
tokens.push({ kind: "SLASH", value: "/" });
|
|
4219
|
+
break;
|
|
4220
|
+
case "%":
|
|
4221
|
+
tokens.push({ kind: "PERCENT", value: "%" });
|
|
4222
|
+
break;
|
|
4223
|
+
case "^":
|
|
4224
|
+
tokens.push({ kind: "CARET", value: "^" });
|
|
4225
|
+
break;
|
|
4226
|
+
case "(":
|
|
4227
|
+
tokens.push({ kind: "LPAREN", value: "(" });
|
|
4228
|
+
break;
|
|
4229
|
+
case ")":
|
|
4230
|
+
tokens.push({ kind: "RPAREN", value: ")" });
|
|
4231
|
+
break;
|
|
4232
|
+
case ",":
|
|
4233
|
+
tokens.push({ kind: "COMMA", value: "," });
|
|
4234
|
+
break;
|
|
4235
|
+
case "<":
|
|
4236
|
+
tokens.push({ kind: "LT", value: "<" });
|
|
4237
|
+
break;
|
|
4238
|
+
case ">":
|
|
4239
|
+
tokens.push({ kind: "GT", value: ">" });
|
|
4240
|
+
break;
|
|
4241
|
+
case "=":
|
|
4242
|
+
tokens.push({ kind: "EQ", value: "=" });
|
|
4243
|
+
break;
|
|
4244
|
+
default:
|
|
4245
|
+
throw new Error(`Unknown character: ${ch}`);
|
|
4246
|
+
}
|
|
4247
|
+
i++;
|
|
4248
|
+
}
|
|
4249
|
+
tokens.push({ kind: "EOF", value: "" });
|
|
4250
|
+
return tokens;
|
|
4251
|
+
}
|
|
4252
|
+
|
|
4253
|
+
class ExprParser {
|
|
4254
|
+
tokens;
|
|
4255
|
+
pos = 0;
|
|
4256
|
+
constructor(tokens) {
|
|
4257
|
+
this.tokens = tokens;
|
|
4258
|
+
}
|
|
4259
|
+
parse() {
|
|
4260
|
+
const result = this.parseOr();
|
|
4261
|
+
if (this.current().kind !== "EOF") {
|
|
4262
|
+
throw new Error("Unexpected token");
|
|
4263
|
+
}
|
|
4264
|
+
return result;
|
|
4265
|
+
}
|
|
4266
|
+
current() {
|
|
4267
|
+
return this.tokens[this.pos] ?? { kind: "EOF", value: "" };
|
|
4268
|
+
}
|
|
4269
|
+
advance() {
|
|
4270
|
+
const token = this.current();
|
|
4271
|
+
this.pos++;
|
|
4272
|
+
return token;
|
|
4273
|
+
}
|
|
4274
|
+
parseOr() {
|
|
4275
|
+
let left = this.parseAnd();
|
|
4276
|
+
while (this.current().kind === "IDENTIFIER" && this.current().value === "or") {
|
|
4277
|
+
this.advance();
|
|
4278
|
+
const right = this.parseAnd();
|
|
4279
|
+
left = isTruthyNum(left) || isTruthyNum(right) ? 1 : 0;
|
|
4280
|
+
}
|
|
4281
|
+
return left;
|
|
4282
|
+
}
|
|
4283
|
+
parseAnd() {
|
|
4284
|
+
let left = this.parseNot();
|
|
4285
|
+
while (this.current().kind === "IDENTIFIER" && this.current().value === "and") {
|
|
4286
|
+
this.advance();
|
|
4287
|
+
const right = this.parseNot();
|
|
4288
|
+
left = isTruthyNum(left) && isTruthyNum(right) ? 1 : 0;
|
|
4289
|
+
}
|
|
4290
|
+
return left;
|
|
4291
|
+
}
|
|
4292
|
+
parseNot() {
|
|
4293
|
+
if (this.current().kind === "IDENTIFIER" && this.current().value === "not") {
|
|
4294
|
+
this.advance();
|
|
4295
|
+
const value = this.parseNot();
|
|
4296
|
+
return isTruthyNum(value) ? 0 : 1;
|
|
4297
|
+
}
|
|
4298
|
+
return this.parseComparison();
|
|
4299
|
+
}
|
|
4300
|
+
parseComparison() {
|
|
4301
|
+
let left = this.parseAddition();
|
|
4302
|
+
const kind = this.current().kind;
|
|
4303
|
+
if (kind === "LT" || kind === "GT" || kind === "LE" || kind === "GE" || kind === "EQ" || kind === "NE") {
|
|
4304
|
+
this.advance();
|
|
4305
|
+
const right = this.parseAddition();
|
|
4306
|
+
switch (kind) {
|
|
4307
|
+
case "LT":
|
|
4308
|
+
return left < right ? 1 : 0;
|
|
4309
|
+
case "GT":
|
|
4310
|
+
return left > right ? 1 : 0;
|
|
4311
|
+
case "LE":
|
|
4312
|
+
return left <= right ? 1 : 0;
|
|
4313
|
+
case "GE":
|
|
4314
|
+
return left >= right ? 1 : 0;
|
|
4315
|
+
case "EQ":
|
|
4316
|
+
return left === right ? 1 : 0;
|
|
4317
|
+
case "NE":
|
|
4318
|
+
return left !== right ? 1 : 0;
|
|
4319
|
+
}
|
|
4320
|
+
}
|
|
4321
|
+
return left;
|
|
4322
|
+
}
|
|
4323
|
+
parseAddition() {
|
|
4324
|
+
let left = this.parseMultiplication();
|
|
4325
|
+
while (true) {
|
|
4326
|
+
const kind = this.current().kind;
|
|
4327
|
+
if (kind === "PLUS") {
|
|
4328
|
+
this.advance();
|
|
4329
|
+
left = left + this.parseMultiplication();
|
|
4330
|
+
} else if (kind === "MINUS") {
|
|
4331
|
+
this.advance();
|
|
4332
|
+
left = left - this.parseMultiplication();
|
|
4333
|
+
} else {
|
|
4334
|
+
break;
|
|
4335
|
+
}
|
|
4336
|
+
}
|
|
4337
|
+
return left;
|
|
4338
|
+
}
|
|
4339
|
+
parseMultiplication() {
|
|
4340
|
+
let left = this.parsePower();
|
|
4341
|
+
while (true) {
|
|
4342
|
+
const kind = this.current().kind;
|
|
4343
|
+
if (kind === "STAR") {
|
|
4344
|
+
this.advance();
|
|
4345
|
+
left = left * this.parsePower();
|
|
4346
|
+
} else if (kind === "SLASH") {
|
|
4347
|
+
this.advance();
|
|
4348
|
+
left = left / this.parsePower();
|
|
4349
|
+
} else if (kind === "PERCENT") {
|
|
4350
|
+
this.advance();
|
|
4351
|
+
left = left % this.parsePower();
|
|
4352
|
+
} else {
|
|
4353
|
+
break;
|
|
4354
|
+
}
|
|
4355
|
+
}
|
|
4356
|
+
return left;
|
|
4357
|
+
}
|
|
4358
|
+
parsePower() {
|
|
4359
|
+
const left = this.parseUnary();
|
|
4360
|
+
if (this.current().kind === "CARET") {
|
|
4361
|
+
this.advance();
|
|
4362
|
+
const right = this.parsePower();
|
|
4363
|
+
return Math.pow(left, right);
|
|
4364
|
+
}
|
|
4365
|
+
return left;
|
|
4366
|
+
}
|
|
4367
|
+
parseUnary() {
|
|
4368
|
+
const kind = this.current().kind;
|
|
4369
|
+
if (kind === "MINUS") {
|
|
4370
|
+
this.advance();
|
|
4371
|
+
return -this.parseUnary();
|
|
4372
|
+
}
|
|
4373
|
+
if (kind === "PLUS") {
|
|
4374
|
+
this.advance();
|
|
4375
|
+
return this.parseUnary();
|
|
4376
|
+
}
|
|
4377
|
+
return this.parsePrimary();
|
|
4378
|
+
}
|
|
4379
|
+
parsePrimary() {
|
|
4380
|
+
const token = this.current();
|
|
4381
|
+
if (token.kind === "NUMBER") {
|
|
4382
|
+
this.advance();
|
|
4383
|
+
return token.value;
|
|
4384
|
+
}
|
|
4385
|
+
if (token.kind === "LPAREN") {
|
|
4386
|
+
this.advance();
|
|
4387
|
+
const value = this.parseOr();
|
|
4388
|
+
if (this.current().kind !== "RPAREN") {
|
|
4389
|
+
throw new Error("Expected )");
|
|
4390
|
+
}
|
|
4391
|
+
this.advance();
|
|
4392
|
+
return value;
|
|
4393
|
+
}
|
|
4394
|
+
if (token.kind === "IDENTIFIER") {
|
|
4395
|
+
const name = token.value;
|
|
4396
|
+
this.advance();
|
|
4397
|
+
if (this.current().kind === "LPAREN") {
|
|
4398
|
+
return this.parseFunctionCall(name);
|
|
4399
|
+
}
|
|
4400
|
+
throw new Error(`undefined constant "${name}"`);
|
|
4401
|
+
}
|
|
4402
|
+
throw new Error("Expected expression");
|
|
4403
|
+
}
|
|
4404
|
+
parseFunctionCall(name) {
|
|
4405
|
+
if (this.current().kind !== "LPAREN") {
|
|
4406
|
+
throw new Error("Expected (");
|
|
4407
|
+
}
|
|
4408
|
+
this.advance();
|
|
4409
|
+
const args = [];
|
|
4410
|
+
if (this.current().kind !== "RPAREN") {
|
|
4411
|
+
args.push(this.parseOr());
|
|
4412
|
+
while (this.current().kind === "COMMA") {
|
|
4413
|
+
this.advance();
|
|
4414
|
+
args.push(this.parseOr());
|
|
4415
|
+
}
|
|
4416
|
+
}
|
|
4417
|
+
if (this.current().kind !== "RPAREN") {
|
|
4418
|
+
throw new Error("Expected )");
|
|
4419
|
+
}
|
|
4420
|
+
this.advance();
|
|
4421
|
+
return this.callFunction(name, args);
|
|
4422
|
+
}
|
|
4423
|
+
callFunction(name, args) {
|
|
4424
|
+
switch (name) {
|
|
4425
|
+
case "abs":
|
|
4426
|
+
this.checkArgs(name, args, 1);
|
|
4427
|
+
return Math.abs(args[0]);
|
|
4428
|
+
case "min":
|
|
4429
|
+
this.checkArgsMin(name, args, 1);
|
|
4430
|
+
return Math.min(...args);
|
|
4431
|
+
case "max":
|
|
4432
|
+
this.checkArgsMin(name, args, 1);
|
|
4433
|
+
return Math.max(...args);
|
|
4434
|
+
case "floor":
|
|
4435
|
+
this.checkArgs(name, args, 1);
|
|
4436
|
+
return Math.floor(args[0]);
|
|
4437
|
+
case "ceil":
|
|
4438
|
+
this.checkArgs(name, args, 1);
|
|
4439
|
+
return Math.ceil(args[0]);
|
|
4440
|
+
case "round":
|
|
4441
|
+
this.checkArgs(name, args, 1);
|
|
4442
|
+
return Math.round(args[0]);
|
|
4443
|
+
case "sqrt":
|
|
4444
|
+
this.checkArgs(name, args, 1);
|
|
4445
|
+
return Math.sqrt(args[0]);
|
|
4446
|
+
case "sin":
|
|
4447
|
+
this.checkArgs(name, args, 1);
|
|
4448
|
+
return Math.sin(args[0]);
|
|
4449
|
+
case "cos":
|
|
4450
|
+
this.checkArgs(name, args, 1);
|
|
4451
|
+
return Math.cos(args[0]);
|
|
4452
|
+
case "tan":
|
|
4453
|
+
this.checkArgs(name, args, 1);
|
|
4454
|
+
return Math.tan(args[0]);
|
|
4455
|
+
case "ln":
|
|
4456
|
+
this.checkArgs(name, args, 1);
|
|
4457
|
+
return Math.log(args[0]);
|
|
4458
|
+
case "log":
|
|
4459
|
+
this.checkArgs(name, args, 1);
|
|
4460
|
+
return Math.log10(args[0]);
|
|
4461
|
+
case "exp":
|
|
4462
|
+
this.checkArgs(name, args, 1);
|
|
4463
|
+
return Math.exp(args[0]);
|
|
4464
|
+
case "pow":
|
|
4465
|
+
this.checkArgs(name, args, 2);
|
|
4466
|
+
return Math.pow(args[0], args[1]);
|
|
4467
|
+
default:
|
|
4468
|
+
throw new Error(`undefined function "${name}"`);
|
|
4469
|
+
}
|
|
4470
|
+
}
|
|
4471
|
+
checkArgs(name, args, expected) {
|
|
4472
|
+
if (args.length !== expected) {
|
|
4473
|
+
throw new Error(`${name}() expects ${expected} argument(s), got ${args.length}`);
|
|
4474
|
+
}
|
|
4475
|
+
}
|
|
4476
|
+
checkArgsMin(name, args, min) {
|
|
4477
|
+
if (args.length < min) {
|
|
4478
|
+
throw new Error(`${name}() expects at least ${min} argument(s), got ${args.length}`);
|
|
4479
|
+
}
|
|
4480
|
+
}
|
|
4481
|
+
}
|
|
4482
|
+
|
|
4483
|
+
// packages/render/src/elements/expr.ts
|
|
4484
|
+
function renderExpr(ctx, data) {
|
|
4485
|
+
const result = evaluateExpression(data.expression);
|
|
4486
|
+
if (result.success) {
|
|
4487
|
+
ctx.pushEscaped(formatNumber(result.value));
|
|
4488
|
+
} else if (result.error !== "empty expression") {
|
|
4489
|
+
ctx.pushEscaped(`run-time error: ${result.error}`);
|
|
4490
|
+
}
|
|
4491
|
+
}
|
|
4492
|
+
function renderIf(ctx, data) {
|
|
4493
|
+
const elements = isTruthy(data.condition) ? data.then : data.else;
|
|
4494
|
+
renderBranchElements(ctx, elements);
|
|
4495
|
+
}
|
|
4496
|
+
function renderIfExpr(ctx, data) {
|
|
4497
|
+
const result = evaluateExpression(data.expression);
|
|
4498
|
+
const isTrue = result.success && result.value !== 0;
|
|
4499
|
+
const elements = isTrue ? data.then : data.else;
|
|
4500
|
+
renderBranchElements(ctx, elements);
|
|
4501
|
+
}
|
|
4502
|
+
function renderBranchElements(ctx, elements) {
|
|
4503
|
+
let lastIdx = elements.length - 1;
|
|
4504
|
+
while (lastIdx >= 0) {
|
|
4505
|
+
const el = elements[lastIdx];
|
|
4506
|
+
if (el.element === "text" && typeof el.data === "string" && el.data.trim() === "") {
|
|
4507
|
+
lastIdx--;
|
|
4508
|
+
} else {
|
|
4509
|
+
break;
|
|
4510
|
+
}
|
|
4511
|
+
}
|
|
4512
|
+
renderElements(ctx, elements.slice(0, lastIdx + 1));
|
|
4513
|
+
}
|
|
4514
|
+
function formatNumber(n) {
|
|
4515
|
+
if (Number.isInteger(n)) {
|
|
4516
|
+
return String(n);
|
|
4517
|
+
}
|
|
4518
|
+
return n.toFixed(6).replace(/\.?0+$/, "");
|
|
4519
|
+
}
|
|
4520
|
+
|
|
4521
|
+
// packages/render/src/render.ts
|
|
4522
|
+
function renderToHtml(tree, options = {}) {
|
|
4523
|
+
const ctx = new RenderContext(tree, options);
|
|
4524
|
+
renderElements(ctx, tree.elements);
|
|
4525
|
+
if (tree.styles?.length) {
|
|
4526
|
+
for (const style of tree.styles) {
|
|
4527
|
+
ctx.push(`<style>${escapeStyleContent(style)}</style>`);
|
|
4528
|
+
}
|
|
4529
|
+
}
|
|
4530
|
+
return ctx.getOutput();
|
|
4531
|
+
}
|
|
4532
|
+
function renderElements(ctx, elements) {
|
|
4533
|
+
for (const element of elements) {
|
|
4534
|
+
renderElement(ctx, element);
|
|
4535
|
+
}
|
|
4536
|
+
}
|
|
4537
|
+
function renderElement(ctx, element) {
|
|
4538
|
+
switch (element.element) {
|
|
4539
|
+
case "text":
|
|
4540
|
+
ctx.pushEscaped(element.data);
|
|
4541
|
+
break;
|
|
4542
|
+
case "raw":
|
|
4543
|
+
renderRaw(ctx, element.data);
|
|
4544
|
+
break;
|
|
4545
|
+
case "variable":
|
|
4546
|
+
renderText(ctx, element.data);
|
|
4547
|
+
break;
|
|
4548
|
+
case "email":
|
|
4549
|
+
renderEmail(ctx, element.data);
|
|
4550
|
+
break;
|
|
4551
|
+
case "container":
|
|
4552
|
+
renderContainer(ctx, element.data);
|
|
4553
|
+
break;
|
|
4554
|
+
case "link":
|
|
4555
|
+
renderLink(ctx, element.data);
|
|
4556
|
+
break;
|
|
4557
|
+
case "anchor":
|
|
4558
|
+
renderAnchor(ctx, element.data);
|
|
4559
|
+
break;
|
|
4560
|
+
case "anchor-name":
|
|
4561
|
+
renderAnchorName(ctx, element.data);
|
|
4562
|
+
break;
|
|
4563
|
+
case "image":
|
|
4564
|
+
renderImage(ctx, element.data);
|
|
4565
|
+
break;
|
|
4566
|
+
case "list":
|
|
4567
|
+
renderList(ctx, element.data);
|
|
4568
|
+
break;
|
|
4569
|
+
case "definition-list":
|
|
4570
|
+
renderDefinitionList(ctx, element.data);
|
|
4571
|
+
break;
|
|
4572
|
+
case "table":
|
|
4573
|
+
renderTable(ctx, element.data);
|
|
4574
|
+
break;
|
|
4575
|
+
case "collapsible":
|
|
4576
|
+
renderCollapsible(ctx, element.data);
|
|
4577
|
+
break;
|
|
4578
|
+
case "code":
|
|
4579
|
+
renderCode(ctx, element.data);
|
|
4580
|
+
break;
|
|
4581
|
+
case "tab-view":
|
|
4582
|
+
renderTabView(ctx, element.data);
|
|
4583
|
+
break;
|
|
4584
|
+
case "footnote":
|
|
4585
|
+
renderFootnoteRef(ctx, ctx.nextFootnoteIndex() + 1);
|
|
4586
|
+
break;
|
|
4587
|
+
case "footnote-ref":
|
|
4588
|
+
renderFootnoteRef(ctx, element.data);
|
|
4589
|
+
break;
|
|
4590
|
+
case "footnote-block":
|
|
4591
|
+
renderFootnoteBlock(ctx, element.data);
|
|
4592
|
+
break;
|
|
4593
|
+
case "bibliography-cite":
|
|
4594
|
+
renderBibliographyCite(ctx, element.data);
|
|
4595
|
+
break;
|
|
4596
|
+
case "bibliography-block":
|
|
4597
|
+
renderBibliographyBlock(ctx, element.data);
|
|
4598
|
+
break;
|
|
4599
|
+
case "table-of-contents":
|
|
4600
|
+
renderTableOfContents(ctx, element.data);
|
|
4601
|
+
break;
|
|
4602
|
+
case "math":
|
|
4603
|
+
renderMath(ctx, element.data);
|
|
4604
|
+
break;
|
|
4605
|
+
case "math-inline":
|
|
4606
|
+
renderMathInline(ctx, element.data);
|
|
4607
|
+
break;
|
|
4608
|
+
case "module":
|
|
4609
|
+
renderModule(ctx, element.data);
|
|
4610
|
+
break;
|
|
4611
|
+
case "embed":
|
|
4612
|
+
renderEmbed(ctx, element.data);
|
|
4613
|
+
break;
|
|
4614
|
+
case "user":
|
|
4615
|
+
renderUser(ctx, element.data);
|
|
4616
|
+
break;
|
|
4617
|
+
case "date":
|
|
4618
|
+
renderDate(ctx, element.data);
|
|
4619
|
+
break;
|
|
4620
|
+
case "color":
|
|
4621
|
+
renderColor(ctx, element.data);
|
|
4622
|
+
break;
|
|
4623
|
+
case "html":
|
|
4624
|
+
renderHtmlBlock(ctx, element.data);
|
|
4625
|
+
break;
|
|
4626
|
+
case "iframe":
|
|
4627
|
+
renderIframe(ctx, element.data);
|
|
4628
|
+
break;
|
|
4629
|
+
case "include":
|
|
4630
|
+
renderInclude(ctx, element.data);
|
|
4631
|
+
break;
|
|
4632
|
+
case "if-tags":
|
|
4633
|
+
renderIfTags(ctx, element.data);
|
|
4634
|
+
break;
|
|
4635
|
+
case "style":
|
|
4636
|
+
break;
|
|
4637
|
+
case "line-break":
|
|
4638
|
+
ctx.push("<br />");
|
|
4639
|
+
break;
|
|
4640
|
+
case "line-breaks":
|
|
4641
|
+
renderLineBreaks(ctx, element.data);
|
|
4642
|
+
break;
|
|
4643
|
+
case "clear-float":
|
|
4644
|
+
renderClearFloat(ctx, element.data);
|
|
4645
|
+
break;
|
|
4646
|
+
case "horizontal-rule":
|
|
4647
|
+
ctx.push("<hr />");
|
|
4648
|
+
break;
|
|
4649
|
+
case "content-separator":
|
|
4650
|
+
ctx.push(`<div class="content-separator" style="display: none:"></div>`);
|
|
4651
|
+
break;
|
|
4652
|
+
case "expr":
|
|
4653
|
+
renderExpr(ctx, element.data);
|
|
4654
|
+
break;
|
|
4655
|
+
case "if":
|
|
4656
|
+
renderIf(ctx, element.data);
|
|
4657
|
+
break;
|
|
4658
|
+
case "ifexpr":
|
|
4659
|
+
renderIfExpr(ctx, element.data);
|
|
4660
|
+
break;
|
|
4661
|
+
case "equation-reference":
|
|
4662
|
+
renderEquationRef(ctx, element.data);
|
|
4663
|
+
break;
|
|
4664
|
+
}
|
|
4665
|
+
}
|
|
4666
|
+
export {
|
|
4667
|
+
renderToHtml
|
|
4668
|
+
};
|