fx-platform-ui 0.0.13-alpha15 → 0.0.13-alpha17

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.
Files changed (127) hide show
  1. package/lib/fx-platform-ui.mjs +65333 -32078
  2. package/lib/fx-platform-ui.umd.js +113 -69
  3. package/lib/packages/components/area/src/index.vue.d.ts +2 -2
  4. package/lib/packages/components/confirm/index.d.ts +2 -0
  5. package/lib/packages/components/confirm/src/confirm.vue.d.ts +2 -0
  6. package/lib/packages/components/confirm/src/index.d.ts +2 -0
  7. package/lib/style.css +1 -1
  8. package/package.json +1 -1
  9. package/packages/.DS_Store +0 -0
  10. package/packages/component.ts +3 -2
  11. package/packages/components/confirm/index.ts +9 -0
  12. package/packages/components/confirm/src/confirm.vue +75 -0
  13. package/packages/components/confirm/src/index.module.less +61 -0
  14. package/packages/components/confirm/src/index.tsx +91 -0
  15. package/packages/components/confirm/src/plat-confirm-props.ts +40 -0
  16. package/packages/components/editor/src/index.vue +22 -21
  17. package/packages/components/table/src/hook/useTableMethods.tsx +1 -1
  18. package/packages/components/table/src/plat-table-emits.ts +1 -1
  19. package/CHANGELOG.md +0 -46
  20. package/lib/tinymce/CHANGELOG.md +0 -2957
  21. package/lib/tinymce/README.md +0 -71
  22. package/lib/tinymce/bower.json +0 -27
  23. package/lib/tinymce/composer.json +0 -52
  24. package/lib/tinymce/icons/default/icons.js +0 -182
  25. package/lib/tinymce/icons/default/icons.min.js +0 -1
  26. package/lib/tinymce/icons/default/index.js +0 -7
  27. package/lib/tinymce/license.txt +0 -21
  28. package/lib/tinymce/models/dom/index.js +0 -7
  29. package/lib/tinymce/models/dom/model.js +0 -7975
  30. package/lib/tinymce/models/dom/model.min.js +0 -4
  31. package/lib/tinymce/package.json +0 -32
  32. package/lib/tinymce/plugins/advlist/index.js +0 -7
  33. package/lib/tinymce/plugins/advlist/plugin.js +0 -246
  34. package/lib/tinymce/plugins/advlist/plugin.min.js +0 -4
  35. package/lib/tinymce/plugins/anchor/index.js +0 -7
  36. package/lib/tinymce/plugins/anchor/plugin.js +0 -195
  37. package/lib/tinymce/plugins/anchor/plugin.min.js +0 -4
  38. package/lib/tinymce/plugins/autolink/index.js +0 -7
  39. package/lib/tinymce/plugins/autolink/plugin.js +0 -232
  40. package/lib/tinymce/plugins/autolink/plugin.min.js +0 -4
  41. package/lib/tinymce/plugins/autoresize/index.js +0 -7
  42. package/lib/tinymce/plugins/autoresize/plugin.js +0 -156
  43. package/lib/tinymce/plugins/autoresize/plugin.min.js +0 -4
  44. package/lib/tinymce/plugins/autosave/index.js +0 -7
  45. package/lib/tinymce/plugins/autosave/plugin.js +0 -232
  46. package/lib/tinymce/plugins/autosave/plugin.min.js +0 -4
  47. package/lib/tinymce/plugins/charmap/index.js +0 -7
  48. package/lib/tinymce/plugins/charmap/plugin.js +0 -1636
  49. package/lib/tinymce/plugins/charmap/plugin.min.js +0 -4
  50. package/lib/tinymce/plugins/code/index.js +0 -7
  51. package/lib/tinymce/plugins/code/plugin.js +0 -85
  52. package/lib/tinymce/plugins/code/plugin.min.js +0 -4
  53. package/lib/tinymce/plugins/codesample/index.js +0 -7
  54. package/lib/tinymce/plugins/codesample/plugin.js +0 -2451
  55. package/lib/tinymce/plugins/codesample/plugin.min.js +0 -4
  56. package/lib/tinymce/plugins/directionality/index.js +0 -7
  57. package/lib/tinymce/plugins/directionality/plugin.js +0 -384
  58. package/lib/tinymce/plugins/directionality/plugin.min.js +0 -4
  59. package/lib/tinymce/plugins/emoticons/index.js +0 -7
  60. package/lib/tinymce/plugins/emoticons/js/emojiimages.js +0 -1
  61. package/lib/tinymce/plugins/emoticons/js/emojiimages.min.js +0 -3
  62. package/lib/tinymce/plugins/emoticons/js/emojis.js +0 -1
  63. package/lib/tinymce/plugins/emoticons/js/emojis.min.js +0 -2
  64. package/lib/tinymce/plugins/emoticons/plugin.js +0 -577
  65. package/lib/tinymce/plugins/emoticons/plugin.min.js +0 -4
  66. package/lib/tinymce/plugins/fullscreen/index.js +0 -7
  67. package/lib/tinymce/plugins/fullscreen/plugin.js +0 -1190
  68. package/lib/tinymce/plugins/fullscreen/plugin.min.js +0 -4
  69. package/lib/tinymce/plugins/help/index.js +0 -7
  70. package/lib/tinymce/plugins/help/plugin.js +0 -848
  71. package/lib/tinymce/plugins/help/plugin.min.js +0 -4
  72. package/lib/tinymce/plugins/image/index.js +0 -7
  73. package/lib/tinymce/plugins/image/plugin.js +0 -1475
  74. package/lib/tinymce/plugins/image/plugin.min.js +0 -4
  75. package/lib/tinymce/plugins/importcss/index.js +0 -7
  76. package/lib/tinymce/plugins/importcss/plugin.js +0 -342
  77. package/lib/tinymce/plugins/importcss/plugin.min.js +0 -4
  78. package/lib/tinymce/plugins/insertdatetime/index.js +0 -7
  79. package/lib/tinymce/plugins/insertdatetime/plugin.js +0 -176
  80. package/lib/tinymce/plugins/insertdatetime/plugin.min.js +0 -4
  81. package/lib/tinymce/plugins/link/index.js +0 -7
  82. package/lib/tinymce/plugins/link/plugin.js +0 -1190
  83. package/lib/tinymce/plugins/link/plugin.min.js +0 -4
  84. package/lib/tinymce/plugins/lists/index.js +0 -7
  85. package/lib/tinymce/plugins/lists/plugin.js +0 -1820
  86. package/lib/tinymce/plugins/lists/plugin.min.js +0 -4
  87. package/lib/tinymce/plugins/media/index.js +0 -7
  88. package/lib/tinymce/plugins/media/plugin.js +0 -1157
  89. package/lib/tinymce/plugins/media/plugin.min.js +0 -4
  90. package/lib/tinymce/plugins/nonbreaking/index.js +0 -7
  91. package/lib/tinymce/plugins/nonbreaking/plugin.js +0 -111
  92. package/lib/tinymce/plugins/nonbreaking/plugin.min.js +0 -4
  93. package/lib/tinymce/plugins/pagebreak/index.js +0 -7
  94. package/lib/tinymce/plugins/pagebreak/plugin.js +0 -105
  95. package/lib/tinymce/plugins/pagebreak/plugin.min.js +0 -4
  96. package/lib/tinymce/plugins/preview/index.js +0 -7
  97. package/lib/tinymce/plugins/preview/plugin.js +0 -97
  98. package/lib/tinymce/plugins/preview/plugin.min.js +0 -4
  99. package/lib/tinymce/plugins/quickbars/index.js +0 -7
  100. package/lib/tinymce/plugins/quickbars/plugin.js +0 -421
  101. package/lib/tinymce/plugins/quickbars/plugin.min.js +0 -4
  102. package/lib/tinymce/plugins/save/index.js +0 -7
  103. package/lib/tinymce/plugins/save/plugin.js +0 -118
  104. package/lib/tinymce/plugins/save/plugin.min.js +0 -4
  105. package/lib/tinymce/plugins/searchreplace/index.js +0 -7
  106. package/lib/tinymce/plugins/searchreplace/plugin.js +0 -1079
  107. package/lib/tinymce/plugins/searchreplace/plugin.min.js +0 -4
  108. package/lib/tinymce/plugins/table/index.js +0 -7
  109. package/lib/tinymce/plugins/table/plugin.js +0 -3393
  110. package/lib/tinymce/plugins/table/plugin.min.js +0 -4
  111. package/lib/tinymce/plugins/template/index.js +0 -7
  112. package/lib/tinymce/plugins/template/plugin.js +0 -548
  113. package/lib/tinymce/plugins/template/plugin.min.js +0 -4
  114. package/lib/tinymce/plugins/visualblocks/index.js +0 -7
  115. package/lib/tinymce/plugins/visualblocks/plugin.js +0 -98
  116. package/lib/tinymce/plugins/visualblocks/plugin.min.js +0 -4
  117. package/lib/tinymce/plugins/visualchars/index.js +0 -7
  118. package/lib/tinymce/plugins/visualchars/plugin.js +0 -506
  119. package/lib/tinymce/plugins/visualchars/plugin.min.js +0 -4
  120. package/lib/tinymce/plugins/wordcount/index.js +0 -7
  121. package/lib/tinymce/plugins/wordcount/plugin.js +0 -404
  122. package/lib/tinymce/plugins/wordcount/plugin.min.js +0 -4
  123. package/lib/tinymce/themes/silver/index.js +0 -7
  124. package/lib/tinymce/themes/silver/theme.js +0 -26184
  125. package/lib/tinymce/themes/silver/theme.min.js +0 -4
  126. package/lib/tinymce/tinymce.d.ts +0 -2895
  127. package/lib/tinymce/tinymce.js +0 -29400
@@ -1,2451 +0,0 @@
1
- /**
2
- * TinyMCE version 6.1.2 (2022-07-29)
3
- */
4
-
5
- (function () {
6
- 'use strict';
7
-
8
- var global$2 = tinymce.util.Tools.resolve('tinymce.PluginManager');
9
-
10
- const isNullable = a => a === null || a === undefined;
11
- const isNonNullable = a => !isNullable(a);
12
-
13
- const constant = value => {
14
- return () => {
15
- return value;
16
- };
17
- };
18
-
19
- class Optional {
20
- constructor(tag, value) {
21
- this.tag = tag;
22
- this.value = value;
23
- }
24
- static some(value) {
25
- return new Optional(true, value);
26
- }
27
- static none() {
28
- return Optional.singletonNone;
29
- }
30
- fold(onNone, onSome) {
31
- if (this.tag) {
32
- return onSome(this.value);
33
- } else {
34
- return onNone();
35
- }
36
- }
37
- isSome() {
38
- return this.tag;
39
- }
40
- isNone() {
41
- return !this.tag;
42
- }
43
- map(mapper) {
44
- if (this.tag) {
45
- return Optional.some(mapper(this.value));
46
- } else {
47
- return Optional.none();
48
- }
49
- }
50
- bind(binder) {
51
- if (this.tag) {
52
- return binder(this.value);
53
- } else {
54
- return Optional.none();
55
- }
56
- }
57
- exists(predicate) {
58
- return this.tag && predicate(this.value);
59
- }
60
- forall(predicate) {
61
- return !this.tag || predicate(this.value);
62
- }
63
- filter(predicate) {
64
- if (!this.tag || predicate(this.value)) {
65
- return this;
66
- } else {
67
- return Optional.none();
68
- }
69
- }
70
- getOr(replacement) {
71
- return this.tag ? this.value : replacement;
72
- }
73
- or(replacement) {
74
- return this.tag ? this : replacement;
75
- }
76
- getOrThunk(thunk) {
77
- return this.tag ? this.value : thunk();
78
- }
79
- orThunk(thunk) {
80
- return this.tag ? this : thunk();
81
- }
82
- getOrDie(message) {
83
- if (!this.tag) {
84
- throw new Error(message !== null && message !== void 0 ? message : 'Called getOrDie on None');
85
- } else {
86
- return this.value;
87
- }
88
- }
89
- static from(value) {
90
- return isNonNullable(value) ? Optional.some(value) : Optional.none();
91
- }
92
- getOrNull() {
93
- return this.tag ? this.value : null;
94
- }
95
- getOrUndefined() {
96
- return this.value;
97
- }
98
- each(worker) {
99
- if (this.tag) {
100
- worker(this.value);
101
- }
102
- }
103
- toArray() {
104
- return this.tag ? [this.value] : [];
105
- }
106
- toString() {
107
- return this.tag ? `some(${ this.value })` : 'none()';
108
- }
109
- }
110
- Optional.singletonNone = new Optional(false);
111
-
112
- const get$1 = (xs, i) => i >= 0 && i < xs.length ? Optional.some(xs[i]) : Optional.none();
113
- const head = xs => get$1(xs, 0);
114
-
115
- const someIf = (b, a) => b ? Optional.some(a) : Optional.none();
116
-
117
- var global$1 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
118
-
119
- const Global = typeof window !== 'undefined' ? window : Function('return this;')();
120
-
121
- const prismjs = function (global, module, exports) {
122
- const oldprism = window.Prism;
123
- window.Prism = { manual: true };
124
- var _self = typeof window !== 'undefined' ? window : typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope ? self : {};
125
- var Prism = function (_self) {
126
- var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i;
127
- var uniqueId = 0;
128
- var plainTextGrammar = {};
129
- var _ = {
130
- manual: _self.Prism && _self.Prism.manual,
131
- disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler,
132
- util: {
133
- encode: function encode(tokens) {
134
- if (tokens instanceof Token) {
135
- return new Token(tokens.type, encode(tokens.content), tokens.alias);
136
- } else if (Array.isArray(tokens)) {
137
- return tokens.map(encode);
138
- } else {
139
- return tokens.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/\u00a0/g, ' ');
140
- }
141
- },
142
- type: function (o) {
143
- return Object.prototype.toString.call(o).slice(8, -1);
144
- },
145
- objId: function (obj) {
146
- if (!obj['__id']) {
147
- Object.defineProperty(obj, '__id', { value: ++uniqueId });
148
- }
149
- return obj['__id'];
150
- },
151
- clone: function deepClone(o, visited) {
152
- visited = visited || {};
153
- var clone;
154
- var id;
155
- switch (_.util.type(o)) {
156
- case 'Object':
157
- id = _.util.objId(o);
158
- if (visited[id]) {
159
- return visited[id];
160
- }
161
- clone = {};
162
- visited[id] = clone;
163
- for (var key in o) {
164
- if (o.hasOwnProperty(key)) {
165
- clone[key] = deepClone(o[key], visited);
166
- }
167
- }
168
- return clone;
169
- case 'Array':
170
- id = _.util.objId(o);
171
- if (visited[id]) {
172
- return visited[id];
173
- }
174
- clone = [];
175
- visited[id] = clone;
176
- o.forEach(function (v, i) {
177
- clone[i] = deepClone(v, visited);
178
- });
179
- return clone;
180
- default:
181
- return o;
182
- }
183
- },
184
- getLanguage: function (element) {
185
- while (element) {
186
- var m = lang.exec(element.className);
187
- if (m) {
188
- return m[1].toLowerCase();
189
- }
190
- element = element.parentElement;
191
- }
192
- return 'none';
193
- },
194
- setLanguage: function (element, language) {
195
- element.className = element.className.replace(RegExp(lang, 'gi'), '');
196
- element.classList.add('language-' + language);
197
- },
198
- currentScript: function () {
199
- if (typeof document === 'undefined') {
200
- return null;
201
- }
202
- if ('currentScript' in document && 1 < 2) {
203
- return document.currentScript;
204
- }
205
- try {
206
- throw new Error();
207
- } catch (err) {
208
- var src = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(err.stack) || [])[1];
209
- if (src) {
210
- var scripts = document.getElementsByTagName('script');
211
- for (var i in scripts) {
212
- if (scripts[i].src == src) {
213
- return scripts[i];
214
- }
215
- }
216
- }
217
- return null;
218
- }
219
- },
220
- isActive: function (element, className, defaultActivation) {
221
- var no = 'no-' + className;
222
- while (element) {
223
- var classList = element.classList;
224
- if (classList.contains(className)) {
225
- return true;
226
- }
227
- if (classList.contains(no)) {
228
- return false;
229
- }
230
- element = element.parentElement;
231
- }
232
- return !!defaultActivation;
233
- }
234
- },
235
- languages: {
236
- plain: plainTextGrammar,
237
- plaintext: plainTextGrammar,
238
- text: plainTextGrammar,
239
- txt: plainTextGrammar,
240
- extend: function (id, redef) {
241
- var lang = _.util.clone(_.languages[id]);
242
- for (var key in redef) {
243
- lang[key] = redef[key];
244
- }
245
- return lang;
246
- },
247
- insertBefore: function (inside, before, insert, root) {
248
- root = root || _.languages;
249
- var grammar = root[inside];
250
- var ret = {};
251
- for (var token in grammar) {
252
- if (grammar.hasOwnProperty(token)) {
253
- if (token == before) {
254
- for (var newToken in insert) {
255
- if (insert.hasOwnProperty(newToken)) {
256
- ret[newToken] = insert[newToken];
257
- }
258
- }
259
- }
260
- if (!insert.hasOwnProperty(token)) {
261
- ret[token] = grammar[token];
262
- }
263
- }
264
- }
265
- var old = root[inside];
266
- root[inside] = ret;
267
- _.languages.DFS(_.languages, function (key, value) {
268
- if (value === old && key != inside) {
269
- this[key] = ret;
270
- }
271
- });
272
- return ret;
273
- },
274
- DFS: function DFS(o, callback, type, visited) {
275
- visited = visited || {};
276
- var objId = _.util.objId;
277
- for (var i in o) {
278
- if (o.hasOwnProperty(i)) {
279
- callback.call(o, i, o[i], type || i);
280
- var property = o[i];
281
- var propertyType = _.util.type(property);
282
- if (propertyType === 'Object' && !visited[objId(property)]) {
283
- visited[objId(property)] = true;
284
- DFS(property, callback, null, visited);
285
- } else if (propertyType === 'Array' && !visited[objId(property)]) {
286
- visited[objId(property)] = true;
287
- DFS(property, callback, i, visited);
288
- }
289
- }
290
- }
291
- }
292
- },
293
- plugins: {},
294
- highlightAll: function (async, callback) {
295
- _.highlightAllUnder(document, async, callback);
296
- },
297
- highlightAllUnder: function (container, async, callback) {
298
- var env = {
299
- callback: callback,
300
- container: container,
301
- selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
302
- };
303
- _.hooks.run('before-highlightall', env);
304
- env.elements = Array.prototype.slice.apply(env.container.querySelectorAll(env.selector));
305
- _.hooks.run('before-all-elements-highlight', env);
306
- for (var i = 0, element; element = env.elements[i++];) {
307
- _.highlightElement(element, async === true, env.callback);
308
- }
309
- },
310
- highlightElement: function (element, async, callback) {
311
- var language = _.util.getLanguage(element);
312
- var grammar = _.languages[language];
313
- _.util.setLanguage(element, language);
314
- var parent = element.parentElement;
315
- if (parent && parent.nodeName.toLowerCase() === 'pre') {
316
- _.util.setLanguage(parent, language);
317
- }
318
- var code = element.textContent;
319
- var env = {
320
- element: element,
321
- language: language,
322
- grammar: grammar,
323
- code: code
324
- };
325
- function insertHighlightedCode(highlightedCode) {
326
- env.highlightedCode = highlightedCode;
327
- _.hooks.run('before-insert', env);
328
- env.element.innerHTML = env.highlightedCode;
329
- _.hooks.run('after-highlight', env);
330
- _.hooks.run('complete', env);
331
- callback && callback.call(env.element);
332
- }
333
- _.hooks.run('before-sanity-check', env);
334
- parent = env.element.parentElement;
335
- if (parent && parent.nodeName.toLowerCase() === 'pre' && !parent.hasAttribute('tabindex')) {
336
- parent.setAttribute('tabindex', '0');
337
- }
338
- if (!env.code) {
339
- _.hooks.run('complete', env);
340
- callback && callback.call(env.element);
341
- return;
342
- }
343
- _.hooks.run('before-highlight', env);
344
- if (!env.grammar) {
345
- insertHighlightedCode(_.util.encode(env.code));
346
- return;
347
- }
348
- if (async && _self.Worker) {
349
- var worker = new Worker(_.filename);
350
- worker.onmessage = function (evt) {
351
- insertHighlightedCode(evt.data);
352
- };
353
- worker.postMessage(JSON.stringify({
354
- language: env.language,
355
- code: env.code,
356
- immediateClose: true
357
- }));
358
- } else {
359
- insertHighlightedCode(_.highlight(env.code, env.grammar, env.language));
360
- }
361
- },
362
- highlight: function (text, grammar, language) {
363
- var env = {
364
- code: text,
365
- grammar: grammar,
366
- language: language
367
- };
368
- _.hooks.run('before-tokenize', env);
369
- if (!env.grammar) {
370
- throw new Error('The language "' + env.language + '" has no grammar.');
371
- }
372
- env.tokens = _.tokenize(env.code, env.grammar);
373
- _.hooks.run('after-tokenize', env);
374
- return Token.stringify(_.util.encode(env.tokens), env.language);
375
- },
376
- tokenize: function (text, grammar) {
377
- var rest = grammar.rest;
378
- if (rest) {
379
- for (var token in rest) {
380
- grammar[token] = rest[token];
381
- }
382
- delete grammar.rest;
383
- }
384
- var tokenList = new LinkedList();
385
- addAfter(tokenList, tokenList.head, text);
386
- matchGrammar(text, tokenList, grammar, tokenList.head, 0);
387
- return toArray(tokenList);
388
- },
389
- hooks: {
390
- all: {},
391
- add: function (name, callback) {
392
- var hooks = _.hooks.all;
393
- hooks[name] = hooks[name] || [];
394
- hooks[name].push(callback);
395
- },
396
- run: function (name, env) {
397
- var callbacks = _.hooks.all[name];
398
- if (!callbacks || !callbacks.length) {
399
- return;
400
- }
401
- for (var i = 0, callback; callback = callbacks[i++];) {
402
- callback(env);
403
- }
404
- }
405
- },
406
- Token: Token
407
- };
408
- _self.Prism = _;
409
- function Token(type, content, alias, matchedStr) {
410
- this.type = type;
411
- this.content = content;
412
- this.alias = alias;
413
- this.length = (matchedStr || '').length | 0;
414
- }
415
- Token.stringify = function stringify(o, language) {
416
- if (typeof o == 'string') {
417
- return o;
418
- }
419
- if (Array.isArray(o)) {
420
- var s = '';
421
- o.forEach(function (e) {
422
- s += stringify(e, language);
423
- });
424
- return s;
425
- }
426
- var env = {
427
- type: o.type,
428
- content: stringify(o.content, language),
429
- tag: 'span',
430
- classes: [
431
- 'token',
432
- o.type
433
- ],
434
- attributes: {},
435
- language: language
436
- };
437
- var aliases = o.alias;
438
- if (aliases) {
439
- if (Array.isArray(aliases)) {
440
- Array.prototype.push.apply(env.classes, aliases);
441
- } else {
442
- env.classes.push(aliases);
443
- }
444
- }
445
- _.hooks.run('wrap', env);
446
- var attributes = '';
447
- for (var name in env.attributes) {
448
- attributes += ' ' + name + '="' + (env.attributes[name] || '').replace(/"/g, '&quot;') + '"';
449
- }
450
- return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + attributes + '>' + env.content + '</' + env.tag + '>';
451
- };
452
- function matchPattern(pattern, pos, text, lookbehind) {
453
- pattern.lastIndex = pos;
454
- var match = pattern.exec(text);
455
- if (match && lookbehind && match[1]) {
456
- var lookbehindLength = match[1].length;
457
- match.index += lookbehindLength;
458
- match[0] = match[0].slice(lookbehindLength);
459
- }
460
- return match;
461
- }
462
- function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
463
- for (var token in grammar) {
464
- if (!grammar.hasOwnProperty(token) || !grammar[token]) {
465
- continue;
466
- }
467
- var patterns = grammar[token];
468
- patterns = Array.isArray(patterns) ? patterns : [patterns];
469
- for (var j = 0; j < patterns.length; ++j) {
470
- if (rematch && rematch.cause == token + ',' + j) {
471
- return;
472
- }
473
- var patternObj = patterns[j];
474
- var inside = patternObj.inside;
475
- var lookbehind = !!patternObj.lookbehind;
476
- var greedy = !!patternObj.greedy;
477
- var alias = patternObj.alias;
478
- if (greedy && !patternObj.pattern.global) {
479
- var flags = patternObj.pattern.toString().match(/[imsuy]*$/)[0];
480
- patternObj.pattern = RegExp(patternObj.pattern.source, flags + 'g');
481
- }
482
- var pattern = patternObj.pattern || patternObj;
483
- for (var currentNode = startNode.next, pos = startPos; currentNode !== tokenList.tail; pos += currentNode.value.length, currentNode = currentNode.next) {
484
- if (rematch && pos >= rematch.reach) {
485
- break;
486
- }
487
- var str = currentNode.value;
488
- if (tokenList.length > text.length) {
489
- return;
490
- }
491
- if (str instanceof Token) {
492
- continue;
493
- }
494
- var removeCount = 1;
495
- var match;
496
- if (greedy) {
497
- match = matchPattern(pattern, pos, text, lookbehind);
498
- if (!match || match.index >= text.length) {
499
- break;
500
- }
501
- var from = match.index;
502
- var to = match.index + match[0].length;
503
- var p = pos;
504
- p += currentNode.value.length;
505
- while (from >= p) {
506
- currentNode = currentNode.next;
507
- p += currentNode.value.length;
508
- }
509
- p -= currentNode.value.length;
510
- pos = p;
511
- if (currentNode.value instanceof Token) {
512
- continue;
513
- }
514
- for (var k = currentNode; k !== tokenList.tail && (p < to || typeof k.value === 'string'); k = k.next) {
515
- removeCount++;
516
- p += k.value.length;
517
- }
518
- removeCount--;
519
- str = text.slice(pos, p);
520
- match.index -= pos;
521
- } else {
522
- match = matchPattern(pattern, 0, str, lookbehind);
523
- if (!match) {
524
- continue;
525
- }
526
- }
527
- var from = match.index;
528
- var matchStr = match[0];
529
- var before = str.slice(0, from);
530
- var after = str.slice(from + matchStr.length);
531
- var reach = pos + str.length;
532
- if (rematch && reach > rematch.reach) {
533
- rematch.reach = reach;
534
- }
535
- var removeFrom = currentNode.prev;
536
- if (before) {
537
- removeFrom = addAfter(tokenList, removeFrom, before);
538
- pos += before.length;
539
- }
540
- removeRange(tokenList, removeFrom, removeCount);
541
- var wrapped = new Token(token, inside ? _.tokenize(matchStr, inside) : matchStr, alias, matchStr);
542
- currentNode = addAfter(tokenList, removeFrom, wrapped);
543
- if (after) {
544
- addAfter(tokenList, currentNode, after);
545
- }
546
- if (removeCount > 1) {
547
- var nestedRematch = {
548
- cause: token + ',' + j,
549
- reach: reach
550
- };
551
- matchGrammar(text, tokenList, grammar, currentNode.prev, pos, nestedRematch);
552
- if (rematch && nestedRematch.reach > rematch.reach) {
553
- rematch.reach = nestedRematch.reach;
554
- }
555
- }
556
- }
557
- }
558
- }
559
- }
560
- function LinkedList() {
561
- var head = {
562
- value: null,
563
- prev: null,
564
- next: null
565
- };
566
- var tail = {
567
- value: null,
568
- prev: head,
569
- next: null
570
- };
571
- head.next = tail;
572
- this.head = head;
573
- this.tail = tail;
574
- this.length = 0;
575
- }
576
- function addAfter(list, node, value) {
577
- var next = node.next;
578
- var newNode = {
579
- value: value,
580
- prev: node,
581
- next: next
582
- };
583
- node.next = newNode;
584
- next.prev = newNode;
585
- list.length++;
586
- return newNode;
587
- }
588
- function removeRange(list, node, count) {
589
- var next = node.next;
590
- for (var i = 0; i < count && next !== list.tail; i++) {
591
- next = next.next;
592
- }
593
- node.next = next;
594
- next.prev = node;
595
- list.length -= i;
596
- }
597
- function toArray(list) {
598
- var array = [];
599
- var node = list.head.next;
600
- while (node !== list.tail) {
601
- array.push(node.value);
602
- node = node.next;
603
- }
604
- return array;
605
- }
606
- if (!_self.document) {
607
- if (!_self.addEventListener) {
608
- return _;
609
- }
610
- if (!_.disableWorkerMessageHandler) {
611
- _self.addEventListener('message', function (evt) {
612
- var message = JSON.parse(evt.data);
613
- var lang = message.language;
614
- var code = message.code;
615
- var immediateClose = message.immediateClose;
616
- _self.postMessage(_.highlight(code, _.languages[lang], lang));
617
- if (immediateClose) {
618
- _self.close();
619
- }
620
- }, false);
621
- }
622
- return _;
623
- }
624
- var script = _.util.currentScript();
625
- if (script) {
626
- _.filename = script.src;
627
- if (script.hasAttribute('data-manual')) {
628
- _.manual = true;
629
- }
630
- }
631
- function highlightAutomaticallyCallback() {
632
- if (!_.manual) {
633
- _.highlightAll();
634
- }
635
- }
636
- if (!_.manual) {
637
- var readyState = document.readyState;
638
- if (readyState === 'loading' || readyState === 'interactive' && script && script.defer) {
639
- document.addEventListener('DOMContentLoaded', highlightAutomaticallyCallback);
640
- } else {
641
- if (window.requestAnimationFrame) {
642
- window.requestAnimationFrame(highlightAutomaticallyCallback);
643
- } else {
644
- window.setTimeout(highlightAutomaticallyCallback, 16);
645
- }
646
- }
647
- }
648
- return _;
649
- }(_self);
650
- if (typeof module !== 'undefined' && module.exports) {
651
- module.exports = Prism;
652
- }
653
- if (typeof global !== 'undefined') {
654
- global.Prism = Prism;
655
- }
656
- Prism.languages.clike = {
657
- 'comment': [
658
- {
659
- pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
660
- lookbehind: true,
661
- greedy: true
662
- },
663
- {
664
- pattern: /(^|[^\\:])\/\/.*/,
665
- lookbehind: true,
666
- greedy: true
667
- }
668
- ],
669
- 'string': {
670
- pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
671
- greedy: true
672
- },
673
- 'class-name': {
674
- pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
675
- lookbehind: true,
676
- inside: { 'punctuation': /[.\\]/ }
677
- },
678
- 'keyword': /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
679
- 'boolean': /\b(?:false|true)\b/,
680
- 'function': /\b\w+(?=\()/,
681
- 'number': /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
682
- 'operator': /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
683
- 'punctuation': /[{}[\];(),.:]/
684
- };
685
- (function (Prism) {
686
- function getPlaceholder(language, index) {
687
- return '___' + language.toUpperCase() + index + '___';
688
- }
689
- Object.defineProperties(Prism.languages['markup-templating'] = {}, {
690
- buildPlaceholders: {
691
- value: function (env, language, placeholderPattern, replaceFilter) {
692
- if (env.language !== language) {
693
- return;
694
- }
695
- var tokenStack = env.tokenStack = [];
696
- env.code = env.code.replace(placeholderPattern, function (match) {
697
- if (typeof replaceFilter === 'function' && !replaceFilter(match)) {
698
- return match;
699
- }
700
- var i = tokenStack.length;
701
- var placeholder;
702
- while (env.code.indexOf(placeholder = getPlaceholder(language, i)) !== -1) {
703
- ++i;
704
- }
705
- tokenStack[i] = match;
706
- return placeholder;
707
- });
708
- env.grammar = Prism.languages.markup;
709
- }
710
- },
711
- tokenizePlaceholders: {
712
- value: function (env, language) {
713
- if (env.language !== language || !env.tokenStack) {
714
- return;
715
- }
716
- env.grammar = Prism.languages[language];
717
- var j = 0;
718
- var keys = Object.keys(env.tokenStack);
719
- function walkTokens(tokens) {
720
- for (var i = 0; i < tokens.length; i++) {
721
- if (j >= keys.length) {
722
- break;
723
- }
724
- var token = tokens[i];
725
- if (typeof token === 'string' || token.content && typeof token.content === 'string') {
726
- var k = keys[j];
727
- var t = env.tokenStack[k];
728
- var s = typeof token === 'string' ? token : token.content;
729
- var placeholder = getPlaceholder(language, k);
730
- var index = s.indexOf(placeholder);
731
- if (index > -1) {
732
- ++j;
733
- var before = s.substring(0, index);
734
- var middle = new Prism.Token(language, Prism.tokenize(t, env.grammar), 'language-' + language, t);
735
- var after = s.substring(index + placeholder.length);
736
- var replacement = [];
737
- if (before) {
738
- replacement.push.apply(replacement, walkTokens([before]));
739
- }
740
- replacement.push(middle);
741
- if (after) {
742
- replacement.push.apply(replacement, walkTokens([after]));
743
- }
744
- if (typeof token === 'string') {
745
- tokens.splice.apply(tokens, [
746
- i,
747
- 1
748
- ].concat(replacement));
749
- } else {
750
- token.content = replacement;
751
- }
752
- }
753
- } else if (token.content) {
754
- walkTokens(token.content);
755
- }
756
- }
757
- return tokens;
758
- }
759
- walkTokens(env.tokens);
760
- }
761
- }
762
- });
763
- }(Prism));
764
- Prism.languages.c = Prism.languages.extend('clike', {
765
- 'comment': {
766
- pattern: /\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,
767
- greedy: true
768
- },
769
- 'string': {
770
- pattern: /"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,
771
- greedy: true
772
- },
773
- 'class-name': {
774
- pattern: /(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,
775
- lookbehind: true
776
- },
777
- 'keyword': /\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,
778
- 'function': /\b[a-z_]\w*(?=\s*\()/i,
779
- 'number': /(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,
780
- 'operator': />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/
781
- });
782
- Prism.languages.insertBefore('c', 'string', {
783
- 'char': {
784
- pattern: /'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,
785
- greedy: true
786
- }
787
- });
788
- Prism.languages.insertBefore('c', 'string', {
789
- 'macro': {
790
- pattern: /(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,
791
- lookbehind: true,
792
- greedy: true,
793
- alias: 'property',
794
- inside: {
795
- 'string': [
796
- {
797
- pattern: /^(#\s*include\s*)<[^>]+>/,
798
- lookbehind: true
799
- },
800
- Prism.languages.c['string']
801
- ],
802
- 'char': Prism.languages.c['char'],
803
- 'comment': Prism.languages.c['comment'],
804
- 'macro-name': [
805
- {
806
- pattern: /(^#\s*define\s+)\w+\b(?!\()/i,
807
- lookbehind: true
808
- },
809
- {
810
- pattern: /(^#\s*define\s+)\w+\b(?=\()/i,
811
- lookbehind: true,
812
- alias: 'function'
813
- }
814
- ],
815
- 'directive': {
816
- pattern: /^(#\s*)[a-z]+/,
817
- lookbehind: true,
818
- alias: 'keyword'
819
- },
820
- 'directive-hash': /^#/,
821
- 'punctuation': /##|\\(?=[\r\n])/,
822
- 'expression': {
823
- pattern: /\S[\s\S]*/,
824
- inside: Prism.languages.c
825
- }
826
- }
827
- }
828
- });
829
- Prism.languages.insertBefore('c', 'function', { 'constant': /\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/ });
830
- delete Prism.languages.c['boolean'];
831
- (function (Prism) {
832
- var keyword = /\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/;
833
- var modName = /\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g, function () {
834
- return keyword.source;
835
- });
836
- Prism.languages.cpp = Prism.languages.extend('c', {
837
- 'class-name': [
838
- {
839
- pattern: RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g, function () {
840
- return keyword.source;
841
- })),
842
- lookbehind: true
843
- },
844
- /\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,
845
- /\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,
846
- /\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/
847
- ],
848
- 'keyword': keyword,
849
- 'number': {
850
- pattern: /(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,
851
- greedy: true
852
- },
853
- 'operator': />>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,
854
- 'boolean': /\b(?:false|true)\b/
855
- });
856
- Prism.languages.insertBefore('cpp', 'string', {
857
- 'module': {
858
- pattern: RegExp(/(\b(?:import|module)\s+)/.source + '(?:' + /"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source + '|' + /<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g, function () {
859
- return modName;
860
- }) + ')'),
861
- lookbehind: true,
862
- greedy: true,
863
- inside: {
864
- 'string': /^[<"][\s\S]+/,
865
- 'operator': /:/,
866
- 'punctuation': /\./
867
- }
868
- },
869
- 'raw-string': {
870
- pattern: /R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,
871
- alias: 'string',
872
- greedy: true
873
- }
874
- });
875
- Prism.languages.insertBefore('cpp', 'keyword', {
876
- 'generic-function': {
877
- pattern: /\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,
878
- inside: {
879
- 'function': /^\w+/,
880
- 'generic': {
881
- pattern: /<[\s\S]+/,
882
- alias: 'class-name',
883
- inside: Prism.languages.cpp
884
- }
885
- }
886
- }
887
- });
888
- Prism.languages.insertBefore('cpp', 'operator', {
889
- 'double-colon': {
890
- pattern: /::/,
891
- alias: 'punctuation'
892
- }
893
- });
894
- Prism.languages.insertBefore('cpp', 'class-name', {
895
- 'base-clause': {
896
- pattern: /(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,
897
- lookbehind: true,
898
- greedy: true,
899
- inside: Prism.languages.extend('cpp', {})
900
- }
901
- });
902
- Prism.languages.insertBefore('inside', 'double-colon', { 'class-name': /\b[a-z_]\w*\b(?!\s*::)/i }, Prism.languages.cpp['base-clause']);
903
- }(Prism));
904
- (function (Prism) {
905
- function replace(pattern, replacements) {
906
- return pattern.replace(/<<(\d+)>>/g, function (m, index) {
907
- return '(?:' + replacements[+index] + ')';
908
- });
909
- }
910
- function re(pattern, replacements, flags) {
911
- return RegExp(replace(pattern, replacements), flags || '');
912
- }
913
- function nested(pattern, depthLog2) {
914
- for (var i = 0; i < depthLog2; i++) {
915
- pattern = pattern.replace(/<<self>>/g, function () {
916
- return '(?:' + pattern + ')';
917
- });
918
- }
919
- return pattern.replace(/<<self>>/g, '[^\\s\\S]');
920
- }
921
- var keywordKinds = {
922
- type: 'bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void',
923
- typeDeclaration: 'class enum interface record struct',
924
- contextual: 'add alias and ascending async await by descending from(?=\\s*(?:\\w|$)) get global group into init(?=\\s*;) join let nameof not notnull on or orderby partial remove select set unmanaged value when where with(?=\\s*{)',
925
- other: 'abstract as base break case catch checked const continue default delegate do else event explicit extern finally fixed for foreach goto if implicit in internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw try typeof unchecked unsafe using virtual volatile while yield'
926
- };
927
- function keywordsToPattern(words) {
928
- return '\\b(?:' + words.trim().replace(/ /g, '|') + ')\\b';
929
- }
930
- var typeDeclarationKeywords = keywordsToPattern(keywordKinds.typeDeclaration);
931
- var keywords = RegExp(keywordsToPattern(keywordKinds.type + ' ' + keywordKinds.typeDeclaration + ' ' + keywordKinds.contextual + ' ' + keywordKinds.other));
932
- var nonTypeKeywords = keywordsToPattern(keywordKinds.typeDeclaration + ' ' + keywordKinds.contextual + ' ' + keywordKinds.other);
933
- var nonContextualKeywords = keywordsToPattern(keywordKinds.type + ' ' + keywordKinds.typeDeclaration + ' ' + keywordKinds.other);
934
- var generic = nested(/<(?:[^<>;=+\-*/%&|^]|<<self>>)*>/.source, 2);
935
- var nestedRound = nested(/\((?:[^()]|<<self>>)*\)/.source, 2);
936
- var name = /@?\b[A-Za-z_]\w*\b/.source;
937
- var genericName = replace(/<<0>>(?:\s*<<1>>)?/.source, [
938
- name,
939
- generic
940
- ]);
941
- var identifier = replace(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source, [
942
- nonTypeKeywords,
943
- genericName
944
- ]);
945
- var array = /\[\s*(?:,\s*)*\]/.source;
946
- var typeExpressionWithoutTuple = replace(/<<0>>(?:\s*(?:\?\s*)?<<1>>)*(?:\s*\?)?/.source, [
947
- identifier,
948
- array
949
- ]);
950
- var tupleElement = replace(/[^,()<>[\];=+\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source, [
951
- generic,
952
- nestedRound,
953
- array
954
- ]);
955
- var tuple = replace(/\(<<0>>+(?:,<<0>>+)+\)/.source, [tupleElement]);
956
- var typeExpression = replace(/(?:<<0>>|<<1>>)(?:\s*(?:\?\s*)?<<2>>)*(?:\s*\?)?/.source, [
957
- tuple,
958
- identifier,
959
- array
960
- ]);
961
- var typeInside = {
962
- 'keyword': keywords,
963
- 'punctuation': /[<>()?,.:[\]]/
964
- };
965
- var character = /'(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'/.source;
966
- var regularString = /"(?:\\.|[^\\"\r\n])*"/.source;
967
- var verbatimString = /@"(?:""|\\[\s\S]|[^\\"])*"(?!")/.source;
968
- Prism.languages.csharp = Prism.languages.extend('clike', {
969
- 'string': [
970
- {
971
- pattern: re(/(^|[^$\\])<<0>>/.source, [verbatimString]),
972
- lookbehind: true,
973
- greedy: true
974
- },
975
- {
976
- pattern: re(/(^|[^@$\\])<<0>>/.source, [regularString]),
977
- lookbehind: true,
978
- greedy: true
979
- }
980
- ],
981
- 'class-name': [
982
- {
983
- pattern: re(/(\busing\s+static\s+)<<0>>(?=\s*;)/.source, [identifier]),
984
- lookbehind: true,
985
- inside: typeInside
986
- },
987
- {
988
- pattern: re(/(\busing\s+<<0>>\s*=\s*)<<1>>(?=\s*;)/.source, [
989
- name,
990
- typeExpression
991
- ]),
992
- lookbehind: true,
993
- inside: typeInside
994
- },
995
- {
996
- pattern: re(/(\busing\s+)<<0>>(?=\s*=)/.source, [name]),
997
- lookbehind: true
998
- },
999
- {
1000
- pattern: re(/(\b<<0>>\s+)<<1>>/.source, [
1001
- typeDeclarationKeywords,
1002
- genericName
1003
- ]),
1004
- lookbehind: true,
1005
- inside: typeInside
1006
- },
1007
- {
1008
- pattern: re(/(\bcatch\s*\(\s*)<<0>>/.source, [identifier]),
1009
- lookbehind: true,
1010
- inside: typeInside
1011
- },
1012
- {
1013
- pattern: re(/(\bwhere\s+)<<0>>/.source, [name]),
1014
- lookbehind: true
1015
- },
1016
- {
1017
- pattern: re(/(\b(?:is(?:\s+not)?|as)\s+)<<0>>/.source, [typeExpressionWithoutTuple]),
1018
- lookbehind: true,
1019
- inside: typeInside
1020
- },
1021
- {
1022
- pattern: re(/\b<<0>>(?=\s+(?!<<1>>|with\s*\{)<<2>>(?:\s*[=,;:{)\]]|\s+(?:in|when)\b))/.source, [
1023
- typeExpression,
1024
- nonContextualKeywords,
1025
- name
1026
- ]),
1027
- inside: typeInside
1028
- }
1029
- ],
1030
- 'keyword': keywords,
1031
- 'number': /(?:\b0(?:x[\da-f_]*[\da-f]|b[01_]*[01])|(?:\B\.\d+(?:_+\d+)*|\b\d+(?:_+\d+)*(?:\.\d+(?:_+\d+)*)?)(?:e[-+]?\d+(?:_+\d+)*)?)(?:[dflmu]|lu|ul)?\b/i,
1032
- 'operator': />>=?|<<=?|[-=]>|([-+&|])\1|~|\?\?=?|[-+*/%&|^!=<>]=?/,
1033
- 'punctuation': /\?\.?|::|[{}[\];(),.:]/
1034
- });
1035
- Prism.languages.insertBefore('csharp', 'number', {
1036
- 'range': {
1037
- pattern: /\.\./,
1038
- alias: 'operator'
1039
- }
1040
- });
1041
- Prism.languages.insertBefore('csharp', 'punctuation', {
1042
- 'named-parameter': {
1043
- pattern: re(/([(,]\s*)<<0>>(?=\s*:)/.source, [name]),
1044
- lookbehind: true,
1045
- alias: 'punctuation'
1046
- }
1047
- });
1048
- Prism.languages.insertBefore('csharp', 'class-name', {
1049
- 'namespace': {
1050
- pattern: re(/(\b(?:namespace|using)\s+)<<0>>(?:\s*\.\s*<<0>>)*(?=\s*[;{])/.source, [name]),
1051
- lookbehind: true,
1052
- inside: { 'punctuation': /\./ }
1053
- },
1054
- 'type-expression': {
1055
- pattern: re(/(\b(?:default|sizeof|typeof)\s*\(\s*(?!\s))(?:[^()\s]|\s(?!\s)|<<0>>)*(?=\s*\))/.source, [nestedRound]),
1056
- lookbehind: true,
1057
- alias: 'class-name',
1058
- inside: typeInside
1059
- },
1060
- 'return-type': {
1061
- pattern: re(/<<0>>(?=\s+(?:<<1>>\s*(?:=>|[({]|\.\s*this\s*\[)|this\s*\[))/.source, [
1062
- typeExpression,
1063
- identifier
1064
- ]),
1065
- inside: typeInside,
1066
- alias: 'class-name'
1067
- },
1068
- 'constructor-invocation': {
1069
- pattern: re(/(\bnew\s+)<<0>>(?=\s*[[({])/.source, [typeExpression]),
1070
- lookbehind: true,
1071
- inside: typeInside,
1072
- alias: 'class-name'
1073
- },
1074
- 'generic-method': {
1075
- pattern: re(/<<0>>\s*<<1>>(?=\s*\()/.source, [
1076
- name,
1077
- generic
1078
- ]),
1079
- inside: {
1080
- 'function': re(/^<<0>>/.source, [name]),
1081
- 'generic': {
1082
- pattern: RegExp(generic),
1083
- alias: 'class-name',
1084
- inside: typeInside
1085
- }
1086
- }
1087
- },
1088
- 'type-list': {
1089
- pattern: re(/\b((?:<<0>>\s+<<1>>|record\s+<<1>>\s*<<5>>|where\s+<<2>>)\s*:\s*)(?:<<3>>|<<4>>|<<1>>\s*<<5>>|<<6>>)(?:\s*,\s*(?:<<3>>|<<4>>|<<6>>))*(?=\s*(?:where|[{;]|=>|$))/.source, [
1090
- typeDeclarationKeywords,
1091
- genericName,
1092
- name,
1093
- typeExpression,
1094
- keywords.source,
1095
- nestedRound,
1096
- /\bnew\s*\(\s*\)/.source
1097
- ]),
1098
- lookbehind: true,
1099
- inside: {
1100
- 'record-arguments': {
1101
- pattern: re(/(^(?!new\s*\()<<0>>\s*)<<1>>/.source, [
1102
- genericName,
1103
- nestedRound
1104
- ]),
1105
- lookbehind: true,
1106
- greedy: true,
1107
- inside: Prism.languages.csharp
1108
- },
1109
- 'keyword': keywords,
1110
- 'class-name': {
1111
- pattern: RegExp(typeExpression),
1112
- greedy: true,
1113
- inside: typeInside
1114
- },
1115
- 'punctuation': /[,()]/
1116
- }
1117
- },
1118
- 'preprocessor': {
1119
- pattern: /(^[\t ]*)#.*/m,
1120
- lookbehind: true,
1121
- alias: 'property',
1122
- inside: {
1123
- 'directive': {
1124
- pattern: /(#)\b(?:define|elif|else|endif|endregion|error|if|line|nullable|pragma|region|undef|warning)\b/,
1125
- lookbehind: true,
1126
- alias: 'keyword'
1127
- }
1128
- }
1129
- }
1130
- });
1131
- var regularStringOrCharacter = regularString + '|' + character;
1132
- var regularStringCharacterOrComment = replace(/\/(?![*/])|\/\/[^\r\n]*[\r\n]|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>/.source, [regularStringOrCharacter]);
1133
- var roundExpression = nested(replace(/[^"'/()]|<<0>>|\(<<self>>*\)/.source, [regularStringCharacterOrComment]), 2);
1134
- var attrTarget = /\b(?:assembly|event|field|method|module|param|property|return|type)\b/.source;
1135
- var attr = replace(/<<0>>(?:\s*\(<<1>>*\))?/.source, [
1136
- identifier,
1137
- roundExpression
1138
- ]);
1139
- Prism.languages.insertBefore('csharp', 'class-name', {
1140
- 'attribute': {
1141
- pattern: re(/((?:^|[^\s\w>)?])\s*\[\s*)(?:<<0>>\s*:\s*)?<<1>>(?:\s*,\s*<<1>>)*(?=\s*\])/.source, [
1142
- attrTarget,
1143
- attr
1144
- ]),
1145
- lookbehind: true,
1146
- greedy: true,
1147
- inside: {
1148
- 'target': {
1149
- pattern: re(/^<<0>>(?=\s*:)/.source, [attrTarget]),
1150
- alias: 'keyword'
1151
- },
1152
- 'attribute-arguments': {
1153
- pattern: re(/\(<<0>>*\)/.source, [roundExpression]),
1154
- inside: Prism.languages.csharp
1155
- },
1156
- 'class-name': {
1157
- pattern: RegExp(identifier),
1158
- inside: { 'punctuation': /\./ }
1159
- },
1160
- 'punctuation': /[:,]/
1161
- }
1162
- }
1163
- });
1164
- var formatString = /:[^}\r\n]+/.source;
1165
- var mInterpolationRound = nested(replace(/[^"'/()]|<<0>>|\(<<self>>*\)/.source, [regularStringCharacterOrComment]), 2);
1166
- var mInterpolation = replace(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source, [
1167
- mInterpolationRound,
1168
- formatString
1169
- ]);
1170
- var sInterpolationRound = nested(replace(/[^"'/()]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>|\(<<self>>*\)/.source, [regularStringOrCharacter]), 2);
1171
- var sInterpolation = replace(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source, [
1172
- sInterpolationRound,
1173
- formatString
1174
- ]);
1175
- function createInterpolationInside(interpolation, interpolationRound) {
1176
- return {
1177
- 'interpolation': {
1178
- pattern: re(/((?:^|[^{])(?:\{\{)*)<<0>>/.source, [interpolation]),
1179
- lookbehind: true,
1180
- inside: {
1181
- 'format-string': {
1182
- pattern: re(/(^\{(?:(?![}:])<<0>>)*)<<1>>(?=\}$)/.source, [
1183
- interpolationRound,
1184
- formatString
1185
- ]),
1186
- lookbehind: true,
1187
- inside: { 'punctuation': /^:/ }
1188
- },
1189
- 'punctuation': /^\{|\}$/,
1190
- 'expression': {
1191
- pattern: /[\s\S]+/,
1192
- alias: 'language-csharp',
1193
- inside: Prism.languages.csharp
1194
- }
1195
- }
1196
- },
1197
- 'string': /[\s\S]+/
1198
- };
1199
- }
1200
- Prism.languages.insertBefore('csharp', 'string', {
1201
- 'interpolation-string': [
1202
- {
1203
- pattern: re(/(^|[^\\])(?:\$@|@\$)"(?:""|\\[\s\S]|\{\{|<<0>>|[^\\{"])*"/.source, [mInterpolation]),
1204
- lookbehind: true,
1205
- greedy: true,
1206
- inside: createInterpolationInside(mInterpolation, mInterpolationRound)
1207
- },
1208
- {
1209
- pattern: re(/(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/.source, [sInterpolation]),
1210
- lookbehind: true,
1211
- greedy: true,
1212
- inside: createInterpolationInside(sInterpolation, sInterpolationRound)
1213
- }
1214
- ],
1215
- 'char': {
1216
- pattern: RegExp(character),
1217
- greedy: true
1218
- }
1219
- });
1220
- Prism.languages.dotnet = Prism.languages.cs = Prism.languages.csharp;
1221
- }(Prism));
1222
- (function (Prism) {
1223
- var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
1224
- Prism.languages.css = {
1225
- 'comment': /\/\*[\s\S]*?\*\//,
1226
- 'atrule': {
1227
- pattern: /@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,
1228
- inside: {
1229
- 'rule': /^@[\w-]+/,
1230
- 'selector-function-argument': {
1231
- pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
1232
- lookbehind: true,
1233
- alias: 'selector'
1234
- },
1235
- 'keyword': {
1236
- pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
1237
- lookbehind: true
1238
- }
1239
- }
1240
- },
1241
- 'url': {
1242
- pattern: RegExp('\\burl\\((?:' + string.source + '|' + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ')\\)', 'i'),
1243
- greedy: true,
1244
- inside: {
1245
- 'function': /^url/i,
1246
- 'punctuation': /^\(|\)$/,
1247
- 'string': {
1248
- pattern: RegExp('^' + string.source + '$'),
1249
- alias: 'url'
1250
- }
1251
- }
1252
- },
1253
- 'selector': {
1254
- pattern: RegExp('(^|[{}\\s])[^{}\\s](?:[^{};"\'\\s]|\\s+(?![\\s{])|' + string.source + ')*(?=\\s*\\{)'),
1255
- lookbehind: true
1256
- },
1257
- 'string': {
1258
- pattern: string,
1259
- greedy: true
1260
- },
1261
- 'property': {
1262
- pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
1263
- lookbehind: true
1264
- },
1265
- 'important': /!important\b/i,
1266
- 'function': {
1267
- pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
1268
- lookbehind: true
1269
- },
1270
- 'punctuation': /[(){};:,]/
1271
- };
1272
- Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
1273
- var markup = Prism.languages.markup;
1274
- if (markup) {
1275
- markup.tag.addInlined('style', 'css');
1276
- markup.tag.addAttribute('style', 'css');
1277
- }
1278
- }(Prism));
1279
- (function (Prism) {
1280
- var keywords = /\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/;
1281
- var classNamePrefix = /(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source;
1282
- var className = {
1283
- pattern: RegExp(/(^|[^\w.])/.source + classNamePrefix + /[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),
1284
- lookbehind: true,
1285
- inside: {
1286
- 'namespace': {
1287
- pattern: /^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,
1288
- inside: { 'punctuation': /\./ }
1289
- },
1290
- 'punctuation': /\./
1291
- }
1292
- };
1293
- Prism.languages.java = Prism.languages.extend('clike', {
1294
- 'string': {
1295
- pattern: /(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,
1296
- lookbehind: true,
1297
- greedy: true
1298
- },
1299
- 'class-name': [
1300
- className,
1301
- {
1302
- pattern: RegExp(/(^|[^\w.])/.source + classNamePrefix + /[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),
1303
- lookbehind: true,
1304
- inside: className.inside
1305
- },
1306
- {
1307
- pattern: RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source + classNamePrefix + /[A-Z]\w*\b/.source),
1308
- lookbehind: true,
1309
- inside: className.inside
1310
- }
1311
- ],
1312
- 'keyword': keywords,
1313
- 'function': [
1314
- Prism.languages.clike.function,
1315
- {
1316
- pattern: /(::\s*)[a-z_]\w*/,
1317
- lookbehind: true
1318
- }
1319
- ],
1320
- 'number': /\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,
1321
- 'operator': {
1322
- pattern: /(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,
1323
- lookbehind: true
1324
- }
1325
- });
1326
- Prism.languages.insertBefore('java', 'string', {
1327
- 'triple-quoted-string': {
1328
- pattern: /"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,
1329
- greedy: true,
1330
- alias: 'string'
1331
- },
1332
- 'char': {
1333
- pattern: /'(?:\\.|[^'\\\r\n]){1,6}'/,
1334
- greedy: true
1335
- }
1336
- });
1337
- Prism.languages.insertBefore('java', 'class-name', {
1338
- 'annotation': {
1339
- pattern: /(^|[^.])@\w+(?:\s*\.\s*\w+)*/,
1340
- lookbehind: true,
1341
- alias: 'punctuation'
1342
- },
1343
- 'generics': {
1344
- pattern: /<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,
1345
- inside: {
1346
- 'class-name': className,
1347
- 'keyword': keywords,
1348
- 'punctuation': /[<>(),.:]/,
1349
- 'operator': /[?&|]/
1350
- }
1351
- },
1352
- 'import': [
1353
- {
1354
- pattern: RegExp(/(\bimport\s+)/.source + classNamePrefix + /(?:[A-Z]\w*|\*)(?=\s*;)/.source),
1355
- lookbehind: true,
1356
- inside: {
1357
- 'namespace': className.inside.namespace,
1358
- 'punctuation': /\./,
1359
- 'operator': /\*/,
1360
- 'class-name': /\w+/
1361
- }
1362
- },
1363
- {
1364
- pattern: RegExp(/(\bimport\s+static\s+)/.source + classNamePrefix + /(?:\w+|\*)(?=\s*;)/.source),
1365
- lookbehind: true,
1366
- alias: 'static',
1367
- inside: {
1368
- 'namespace': className.inside.namespace,
1369
- 'static': /\b\w+$/,
1370
- 'punctuation': /\./,
1371
- 'operator': /\*/,
1372
- 'class-name': /\w+/
1373
- }
1374
- }
1375
- ],
1376
- 'namespace': {
1377
- pattern: RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g, function () {
1378
- return keywords.source;
1379
- })),
1380
- lookbehind: true,
1381
- inside: { 'punctuation': /\./ }
1382
- }
1383
- });
1384
- }(Prism));
1385
- Prism.languages.javascript = Prism.languages.extend('clike', {
1386
- 'class-name': [
1387
- Prism.languages.clike['class-name'],
1388
- {
1389
- pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
1390
- lookbehind: true
1391
- }
1392
- ],
1393
- 'keyword': [
1394
- {
1395
- pattern: /((?:^|\})\s*)catch\b/,
1396
- lookbehind: true
1397
- },
1398
- {
1399
- pattern: /(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,
1400
- lookbehind: true
1401
- }
1402
- ],
1403
- 'function': /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
1404
- 'number': {
1405
- pattern: RegExp(/(^|[^\w$])/.source + '(?:' + (/NaN|Infinity/.source + '|' + /0[bB][01]+(?:_[01]+)*n?/.source + '|' + /0[oO][0-7]+(?:_[0-7]+)*n?/.source + '|' + /0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source + '|' + /\d+(?:_\d+)*n/.source + '|' + /(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source) + ')' + /(?![\w$])/.source),
1406
- lookbehind: true
1407
- },
1408
- 'operator': /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
1409
- });
1410
- Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;
1411
- Prism.languages.insertBefore('javascript', 'keyword', {
1412
- 'regex': {
1413
- pattern: RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source + /\//.source + '(?:' + /(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source + '|' + /(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source + ')' + /(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),
1414
- lookbehind: true,
1415
- greedy: true,
1416
- inside: {
1417
- 'regex-source': {
1418
- pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
1419
- lookbehind: true,
1420
- alias: 'language-regex',
1421
- inside: Prism.languages.regex
1422
- },
1423
- 'regex-delimiter': /^\/|\/$/,
1424
- 'regex-flags': /^[a-z]+$/
1425
- }
1426
- },
1427
- 'function-variable': {
1428
- pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,
1429
- alias: 'function'
1430
- },
1431
- 'parameter': [
1432
- {
1433
- pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
1434
- lookbehind: true,
1435
- inside: Prism.languages.javascript
1436
- },
1437
- {
1438
- pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
1439
- lookbehind: true,
1440
- inside: Prism.languages.javascript
1441
- },
1442
- {
1443
- pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
1444
- lookbehind: true,
1445
- inside: Prism.languages.javascript
1446
- },
1447
- {
1448
- pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,
1449
- lookbehind: true,
1450
- inside: Prism.languages.javascript
1451
- }
1452
- ],
1453
- 'constant': /\b[A-Z](?:[A-Z_]|\dx?)*\b/
1454
- });
1455
- Prism.languages.insertBefore('javascript', 'string', {
1456
- 'hashbang': {
1457
- pattern: /^#!.*/,
1458
- greedy: true,
1459
- alias: 'comment'
1460
- },
1461
- 'template-string': {
1462
- pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
1463
- greedy: true,
1464
- inside: {
1465
- 'template-punctuation': {
1466
- pattern: /^`|`$/,
1467
- alias: 'string'
1468
- },
1469
- 'interpolation': {
1470
- pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
1471
- lookbehind: true,
1472
- inside: {
1473
- 'interpolation-punctuation': {
1474
- pattern: /^\$\{|\}$/,
1475
- alias: 'punctuation'
1476
- },
1477
- rest: Prism.languages.javascript
1478
- }
1479
- },
1480
- 'string': /[\s\S]+/
1481
- }
1482
- },
1483
- 'string-property': {
1484
- pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
1485
- lookbehind: true,
1486
- greedy: true,
1487
- alias: 'property'
1488
- }
1489
- });
1490
- Prism.languages.insertBefore('javascript', 'operator', {
1491
- 'literal-property': {
1492
- pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
1493
- lookbehind: true,
1494
- alias: 'property'
1495
- }
1496
- });
1497
- if (Prism.languages.markup) {
1498
- Prism.languages.markup.tag.addInlined('script', 'javascript');
1499
- Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source, 'javascript');
1500
- }
1501
- Prism.languages.js = Prism.languages.javascript;
1502
- Prism.languages.markup = {
1503
- 'comment': {
1504
- pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
1505
- greedy: true
1506
- },
1507
- 'prolog': {
1508
- pattern: /<\?[\s\S]+?\?>/,
1509
- greedy: true
1510
- },
1511
- 'doctype': {
1512
- pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
1513
- greedy: true,
1514
- inside: {
1515
- 'internal-subset': {
1516
- pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
1517
- lookbehind: true,
1518
- greedy: true,
1519
- inside: null
1520
- },
1521
- 'string': {
1522
- pattern: /"[^"]*"|'[^']*'/,
1523
- greedy: true
1524
- },
1525
- 'punctuation': /^<!|>$|[[\]]/,
1526
- 'doctype-tag': /^DOCTYPE/i,
1527
- 'name': /[^\s<>'"]+/
1528
- }
1529
- },
1530
- 'cdata': {
1531
- pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
1532
- greedy: true
1533
- },
1534
- 'tag': {
1535
- pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
1536
- greedy: true,
1537
- inside: {
1538
- 'tag': {
1539
- pattern: /^<\/?[^\s>\/]+/,
1540
- inside: {
1541
- 'punctuation': /^<\/?/,
1542
- 'namespace': /^[^\s>\/:]+:/
1543
- }
1544
- },
1545
- 'special-attr': [],
1546
- 'attr-value': {
1547
- pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
1548
- inside: {
1549
- 'punctuation': [
1550
- {
1551
- pattern: /^=/,
1552
- alias: 'attr-equals'
1553
- },
1554
- /"|'/
1555
- ]
1556
- }
1557
- },
1558
- 'punctuation': /\/?>/,
1559
- 'attr-name': {
1560
- pattern: /[^\s>\/]+/,
1561
- inside: { 'namespace': /^[^\s>\/:]+:/ }
1562
- }
1563
- }
1564
- },
1565
- 'entity': [
1566
- {
1567
- pattern: /&[\da-z]{1,8};/i,
1568
- alias: 'named-entity'
1569
- },
1570
- /&#x?[\da-f]{1,8};/i
1571
- ]
1572
- };
1573
- Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] = Prism.languages.markup['entity'];
1574
- Prism.languages.markup['doctype'].inside['internal-subset'].inside = Prism.languages.markup;
1575
- Prism.hooks.add('wrap', function (env) {
1576
- if (env.type === 'entity') {
1577
- env.attributes['title'] = env.content.replace(/&amp;/, '&');
1578
- }
1579
- });
1580
- Object.defineProperty(Prism.languages.markup.tag, 'addInlined', {
1581
- value: function addInlined(tagName, lang) {
1582
- var includedCdataInside = {};
1583
- includedCdataInside['language-' + lang] = {
1584
- pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
1585
- lookbehind: true,
1586
- inside: Prism.languages[lang]
1587
- };
1588
- includedCdataInside['cdata'] = /^<!\[CDATA\[|\]\]>$/i;
1589
- var inside = {
1590
- 'included-cdata': {
1591
- pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
1592
- inside: includedCdataInside
1593
- }
1594
- };
1595
- inside['language-' + lang] = {
1596
- pattern: /[\s\S]+/,
1597
- inside: Prism.languages[lang]
1598
- };
1599
- var def = {};
1600
- def[tagName] = {
1601
- pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function () {
1602
- return tagName;
1603
- }), 'i'),
1604
- lookbehind: true,
1605
- greedy: true,
1606
- inside: inside
1607
- };
1608
- Prism.languages.insertBefore('markup', 'cdata', def);
1609
- }
1610
- });
1611
- Object.defineProperty(Prism.languages.markup.tag, 'addAttribute', {
1612
- value: function (attrName, lang) {
1613
- Prism.languages.markup.tag.inside['special-attr'].push({
1614
- pattern: RegExp(/(^|["'\s])/.source + '(?:' + attrName + ')' + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source, 'i'),
1615
- lookbehind: true,
1616
- inside: {
1617
- 'attr-name': /^[^\s=]+/,
1618
- 'attr-value': {
1619
- pattern: /=[\s\S]+/,
1620
- inside: {
1621
- 'value': {
1622
- pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
1623
- lookbehind: true,
1624
- alias: [
1625
- lang,
1626
- 'language-' + lang
1627
- ],
1628
- inside: Prism.languages[lang]
1629
- },
1630
- 'punctuation': [
1631
- {
1632
- pattern: /^=/,
1633
- alias: 'attr-equals'
1634
- },
1635
- /"|'/
1636
- ]
1637
- }
1638
- }
1639
- }
1640
- });
1641
- }
1642
- });
1643
- Prism.languages.html = Prism.languages.markup;
1644
- Prism.languages.mathml = Prism.languages.markup;
1645
- Prism.languages.svg = Prism.languages.markup;
1646
- Prism.languages.xml = Prism.languages.extend('markup', {});
1647
- Prism.languages.ssml = Prism.languages.xml;
1648
- Prism.languages.atom = Prism.languages.xml;
1649
- Prism.languages.rss = Prism.languages.xml;
1650
- (function (Prism) {
1651
- var comment = /\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/;
1652
- var constant = [
1653
- {
1654
- pattern: /\b(?:false|true)\b/i,
1655
- alias: 'boolean'
1656
- },
1657
- {
1658
- pattern: /(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,
1659
- greedy: true,
1660
- lookbehind: true
1661
- },
1662
- {
1663
- pattern: /(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,
1664
- greedy: true,
1665
- lookbehind: true
1666
- },
1667
- /\b(?:null)\b/i,
1668
- /\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/
1669
- ];
1670
- var number = /\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i;
1671
- var operator = /<?=>|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/;
1672
- var punctuation = /[{}\[\](),:;]/;
1673
- Prism.languages.php = {
1674
- 'delimiter': {
1675
- pattern: /\?>$|^<\?(?:php(?=\s)|=)?/i,
1676
- alias: 'important'
1677
- },
1678
- 'comment': comment,
1679
- 'variable': /\$+(?:\w+\b|(?=\{))/,
1680
- 'package': {
1681
- pattern: /(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,
1682
- lookbehind: true,
1683
- inside: { 'punctuation': /\\/ }
1684
- },
1685
- 'class-name-definition': {
1686
- pattern: /(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,
1687
- lookbehind: true,
1688
- alias: 'class-name'
1689
- },
1690
- 'function-definition': {
1691
- pattern: /(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,
1692
- lookbehind: true,
1693
- alias: 'function'
1694
- },
1695
- 'keyword': [
1696
- {
1697
- pattern: /(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i,
1698
- alias: 'type-casting',
1699
- greedy: true,
1700
- lookbehind: true
1701
- },
1702
- {
1703
- pattern: /([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i,
1704
- alias: 'type-hint',
1705
- greedy: true,
1706
- lookbehind: true
1707
- },
1708
- {
1709
- pattern: /(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i,
1710
- alias: 'return-type',
1711
- greedy: true,
1712
- lookbehind: true
1713
- },
1714
- {
1715
- pattern: /\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i,
1716
- alias: 'type-declaration',
1717
- greedy: true
1718
- },
1719
- {
1720
- pattern: /(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i,
1721
- alias: 'type-declaration',
1722
- greedy: true,
1723
- lookbehind: true
1724
- },
1725
- {
1726
- pattern: /\b(?:parent|self|static)(?=\s*::)/i,
1727
- alias: 'static-context',
1728
- greedy: true
1729
- },
1730
- {
1731
- pattern: /(\byield\s+)from\b/i,
1732
- lookbehind: true
1733
- },
1734
- /\bclass\b/i,
1735
- {
1736
- pattern: /((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i,
1737
- lookbehind: true
1738
- }
1739
- ],
1740
- 'argument-name': {
1741
- pattern: /([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,
1742
- lookbehind: true
1743
- },
1744
- 'class-name': [
1745
- {
1746
- pattern: /(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,
1747
- greedy: true,
1748
- lookbehind: true
1749
- },
1750
- {
1751
- pattern: /(\|\s*)\b[a-z_]\w*(?!\\)\b/i,
1752
- greedy: true,
1753
- lookbehind: true
1754
- },
1755
- {
1756
- pattern: /\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,
1757
- greedy: true
1758
- },
1759
- {
1760
- pattern: /(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,
1761
- alias: 'class-name-fully-qualified',
1762
- greedy: true,
1763
- lookbehind: true,
1764
- inside: { 'punctuation': /\\/ }
1765
- },
1766
- {
1767
- pattern: /(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,
1768
- alias: 'class-name-fully-qualified',
1769
- greedy: true,
1770
- inside: { 'punctuation': /\\/ }
1771
- },
1772
- {
1773
- pattern: /(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,
1774
- alias: 'class-name-fully-qualified',
1775
- greedy: true,
1776
- lookbehind: true,
1777
- inside: { 'punctuation': /\\/ }
1778
- },
1779
- {
1780
- pattern: /\b[a-z_]\w*(?=\s*\$)/i,
1781
- alias: 'type-declaration',
1782
- greedy: true
1783
- },
1784
- {
1785
- pattern: /(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,
1786
- alias: [
1787
- 'class-name-fully-qualified',
1788
- 'type-declaration'
1789
- ],
1790
- greedy: true,
1791
- inside: { 'punctuation': /\\/ }
1792
- },
1793
- {
1794
- pattern: /\b[a-z_]\w*(?=\s*::)/i,
1795
- alias: 'static-context',
1796
- greedy: true
1797
- },
1798
- {
1799
- pattern: /(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,
1800
- alias: [
1801
- 'class-name-fully-qualified',
1802
- 'static-context'
1803
- ],
1804
- greedy: true,
1805
- inside: { 'punctuation': /\\/ }
1806
- },
1807
- {
1808
- pattern: /([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,
1809
- alias: 'type-hint',
1810
- greedy: true,
1811
- lookbehind: true
1812
- },
1813
- {
1814
- pattern: /([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,
1815
- alias: [
1816
- 'class-name-fully-qualified',
1817
- 'type-hint'
1818
- ],
1819
- greedy: true,
1820
- lookbehind: true,
1821
- inside: { 'punctuation': /\\/ }
1822
- },
1823
- {
1824
- pattern: /(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,
1825
- alias: 'return-type',
1826
- greedy: true,
1827
- lookbehind: true
1828
- },
1829
- {
1830
- pattern: /(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,
1831
- alias: [
1832
- 'class-name-fully-qualified',
1833
- 'return-type'
1834
- ],
1835
- greedy: true,
1836
- lookbehind: true,
1837
- inside: { 'punctuation': /\\/ }
1838
- }
1839
- ],
1840
- 'constant': constant,
1841
- 'function': {
1842
- pattern: /(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,
1843
- lookbehind: true,
1844
- inside: { 'punctuation': /\\/ }
1845
- },
1846
- 'property': {
1847
- pattern: /(->\s*)\w+/,
1848
- lookbehind: true
1849
- },
1850
- 'number': number,
1851
- 'operator': operator,
1852
- 'punctuation': punctuation
1853
- };
1854
- var string_interpolation = {
1855
- pattern: /\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,
1856
- lookbehind: true,
1857
- inside: Prism.languages.php
1858
- };
1859
- var string = [
1860
- {
1861
- pattern: /<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,
1862
- alias: 'nowdoc-string',
1863
- greedy: true,
1864
- inside: {
1865
- 'delimiter': {
1866
- pattern: /^<<<'[^']+'|[a-z_]\w*;$/i,
1867
- alias: 'symbol',
1868
- inside: { 'punctuation': /^<<<'?|[';]$/ }
1869
- }
1870
- }
1871
- },
1872
- {
1873
- pattern: /<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,
1874
- alias: 'heredoc-string',
1875
- greedy: true,
1876
- inside: {
1877
- 'delimiter': {
1878
- pattern: /^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,
1879
- alias: 'symbol',
1880
- inside: { 'punctuation': /^<<<"?|[";]$/ }
1881
- },
1882
- 'interpolation': string_interpolation
1883
- }
1884
- },
1885
- {
1886
- pattern: /`(?:\\[\s\S]|[^\\`])*`/,
1887
- alias: 'backtick-quoted-string',
1888
- greedy: true
1889
- },
1890
- {
1891
- pattern: /'(?:\\[\s\S]|[^\\'])*'/,
1892
- alias: 'single-quoted-string',
1893
- greedy: true
1894
- },
1895
- {
1896
- pattern: /"(?:\\[\s\S]|[^\\"])*"/,
1897
- alias: 'double-quoted-string',
1898
- greedy: true,
1899
- inside: { 'interpolation': string_interpolation }
1900
- }
1901
- ];
1902
- Prism.languages.insertBefore('php', 'variable', {
1903
- 'string': string,
1904
- 'attribute': {
1905
- pattern: /#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,
1906
- greedy: true,
1907
- inside: {
1908
- 'attribute-content': {
1909
- pattern: /^(#\[)[\s\S]+(?=\]$)/,
1910
- lookbehind: true,
1911
- inside: {
1912
- 'comment': comment,
1913
- 'string': string,
1914
- 'attribute-class-name': [
1915
- {
1916
- pattern: /([^:]|^)\b[a-z_]\w*(?!\\)\b/i,
1917
- alias: 'class-name',
1918
- greedy: true,
1919
- lookbehind: true
1920
- },
1921
- {
1922
- pattern: /([^:]|^)(?:\\?\b[a-z_]\w*)+/i,
1923
- alias: [
1924
- 'class-name',
1925
- 'class-name-fully-qualified'
1926
- ],
1927
- greedy: true,
1928
- lookbehind: true,
1929
- inside: { 'punctuation': /\\/ }
1930
- }
1931
- ],
1932
- 'constant': constant,
1933
- 'number': number,
1934
- 'operator': operator,
1935
- 'punctuation': punctuation
1936
- }
1937
- },
1938
- 'delimiter': {
1939
- pattern: /^#\[|\]$/,
1940
- alias: 'punctuation'
1941
- }
1942
- }
1943
- }
1944
- });
1945
- Prism.hooks.add('before-tokenize', function (env) {
1946
- if (!/<\?/.test(env.code)) {
1947
- return;
1948
- }
1949
- var phpPattern = /<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g;
1950
- Prism.languages['markup-templating'].buildPlaceholders(env, 'php', phpPattern);
1951
- });
1952
- Prism.hooks.add('after-tokenize', function (env) {
1953
- Prism.languages['markup-templating'].tokenizePlaceholders(env, 'php');
1954
- });
1955
- }(Prism));
1956
- Prism.languages.python = {
1957
- 'comment': {
1958
- pattern: /(^|[^\\])#.*/,
1959
- lookbehind: true,
1960
- greedy: true
1961
- },
1962
- 'string-interpolation': {
1963
- pattern: /(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,
1964
- greedy: true,
1965
- inside: {
1966
- 'interpolation': {
1967
- pattern: /((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,
1968
- lookbehind: true,
1969
- inside: {
1970
- 'format-spec': {
1971
- pattern: /(:)[^:(){}]+(?=\}$)/,
1972
- lookbehind: true
1973
- },
1974
- 'conversion-option': {
1975
- pattern: /![sra](?=[:}]$)/,
1976
- alias: 'punctuation'
1977
- },
1978
- rest: null
1979
- }
1980
- },
1981
- 'string': /[\s\S]+/
1982
- }
1983
- },
1984
- 'triple-quoted-string': {
1985
- pattern: /(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,
1986
- greedy: true,
1987
- alias: 'string'
1988
- },
1989
- 'string': {
1990
- pattern: /(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,
1991
- greedy: true
1992
- },
1993
- 'function': {
1994
- pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,
1995
- lookbehind: true
1996
- },
1997
- 'class-name': {
1998
- pattern: /(\bclass\s+)\w+/i,
1999
- lookbehind: true
2000
- },
2001
- 'decorator': {
2002
- pattern: /(^[\t ]*)@\w+(?:\.\w+)*/m,
2003
- lookbehind: true,
2004
- alias: [
2005
- 'annotation',
2006
- 'punctuation'
2007
- ],
2008
- inside: { 'punctuation': /\./ }
2009
- },
2010
- 'keyword': /\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,
2011
- 'builtin': /\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,
2012
- 'boolean': /\b(?:False|None|True)\b/,
2013
- 'number': /\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,
2014
- 'operator': /[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
2015
- 'punctuation': /[{}[\];(),.:]/
2016
- };
2017
- Prism.languages.python['string-interpolation'].inside['interpolation'].inside.rest = Prism.languages.python;
2018
- Prism.languages.py = Prism.languages.python;
2019
- (function (Prism) {
2020
- Prism.languages.ruby = Prism.languages.extend('clike', {
2021
- 'comment': {
2022
- pattern: /#.*|^=begin\s[\s\S]*?^=end/m,
2023
- greedy: true
2024
- },
2025
- 'class-name': {
2026
- pattern: /(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,
2027
- lookbehind: true,
2028
- inside: { 'punctuation': /[.\\]/ }
2029
- },
2030
- 'keyword': /\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,
2031
- 'operator': /\.{2,3}|&\.|===|<?=>|[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,
2032
- 'punctuation': /[(){}[\].,;]/
2033
- });
2034
- Prism.languages.insertBefore('ruby', 'operator', {
2035
- 'double-colon': {
2036
- pattern: /::/,
2037
- alias: 'punctuation'
2038
- }
2039
- });
2040
- var interpolation = {
2041
- pattern: /((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,
2042
- lookbehind: true,
2043
- inside: {
2044
- 'content': {
2045
- pattern: /^(#\{)[\s\S]+(?=\}$)/,
2046
- lookbehind: true,
2047
- inside: Prism.languages.ruby
2048
- },
2049
- 'delimiter': {
2050
- pattern: /^#\{|\}$/,
2051
- alias: 'punctuation'
2052
- }
2053
- }
2054
- };
2055
- delete Prism.languages.ruby.function;
2056
- var percentExpression = '(?:' + [
2057
- /([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,
2058
- /\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,
2059
- /\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,
2060
- /\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,
2061
- /<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source
2062
- ].join('|') + ')';
2063
- var symbolName = /(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;
2064
- Prism.languages.insertBefore('ruby', 'keyword', {
2065
- 'regex-literal': [
2066
- {
2067
- pattern: RegExp(/%r/.source + percentExpression + /[egimnosux]{0,6}/.source),
2068
- greedy: true,
2069
- inside: {
2070
- 'interpolation': interpolation,
2071
- 'regex': /[\s\S]+/
2072
- }
2073
- },
2074
- {
2075
- pattern: /(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,
2076
- lookbehind: true,
2077
- greedy: true,
2078
- inside: {
2079
- 'interpolation': interpolation,
2080
- 'regex': /[\s\S]+/
2081
- }
2082
- }
2083
- ],
2084
- 'variable': /[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,
2085
- 'symbol': [
2086
- {
2087
- pattern: RegExp(/(^|[^:]):/.source + symbolName),
2088
- lookbehind: true,
2089
- greedy: true
2090
- },
2091
- {
2092
- pattern: RegExp(/([\r\n{(,][ \t]*)/.source + symbolName + /(?=:(?!:))/.source),
2093
- lookbehind: true,
2094
- greedy: true
2095
- }
2096
- ],
2097
- 'method-definition': {
2098
- pattern: /(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,
2099
- lookbehind: true,
2100
- inside: {
2101
- 'function': /\b\w+$/,
2102
- 'keyword': /^self\b/,
2103
- 'class-name': /^\w+/,
2104
- 'punctuation': /\./
2105
- }
2106
- }
2107
- });
2108
- Prism.languages.insertBefore('ruby', 'string', {
2109
- 'string-literal': [
2110
- {
2111
- pattern: RegExp(/%[qQiIwWs]?/.source + percentExpression),
2112
- greedy: true,
2113
- inside: {
2114
- 'interpolation': interpolation,
2115
- 'string': /[\s\S]+/
2116
- }
2117
- },
2118
- {
2119
- pattern: /("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,
2120
- greedy: true,
2121
- inside: {
2122
- 'interpolation': interpolation,
2123
- 'string': /[\s\S]+/
2124
- }
2125
- },
2126
- {
2127
- pattern: /<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,
2128
- alias: 'heredoc-string',
2129
- greedy: true,
2130
- inside: {
2131
- 'delimiter': {
2132
- pattern: /^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,
2133
- inside: {
2134
- 'symbol': /\b\w+/,
2135
- 'punctuation': /^<<[-~]?/
2136
- }
2137
- },
2138
- 'interpolation': interpolation,
2139
- 'string': /[\s\S]+/
2140
- }
2141
- },
2142
- {
2143
- pattern: /<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,
2144
- alias: 'heredoc-string',
2145
- greedy: true,
2146
- inside: {
2147
- 'delimiter': {
2148
- pattern: /^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,
2149
- inside: {
2150
- 'symbol': /\b\w+/,
2151
- 'punctuation': /^<<[-~]?'|'$/
2152
- }
2153
- },
2154
- 'string': /[\s\S]+/
2155
- }
2156
- }
2157
- ],
2158
- 'command-literal': [
2159
- {
2160
- pattern: RegExp(/%x/.source + percentExpression),
2161
- greedy: true,
2162
- inside: {
2163
- 'interpolation': interpolation,
2164
- 'command': {
2165
- pattern: /[\s\S]+/,
2166
- alias: 'string'
2167
- }
2168
- }
2169
- },
2170
- {
2171
- pattern: /`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,
2172
- greedy: true,
2173
- inside: {
2174
- 'interpolation': interpolation,
2175
- 'command': {
2176
- pattern: /[\s\S]+/,
2177
- alias: 'string'
2178
- }
2179
- }
2180
- }
2181
- ]
2182
- });
2183
- delete Prism.languages.ruby.string;
2184
- Prism.languages.insertBefore('ruby', 'number', {
2185
- 'builtin': /\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,
2186
- 'constant': /\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/
2187
- });
2188
- Prism.languages.rb = Prism.languages.ruby;
2189
- }(Prism));
2190
- window.Prism = oldprism;
2191
- return Prism;
2192
- }(undefined, undefined);
2193
-
2194
- const option = name => editor => editor.options.get(name);
2195
- const register$2 = editor => {
2196
- const registerOption = editor.options.register;
2197
- registerOption('codesample_languages', { processor: 'object[]' });
2198
- registerOption('codesample_global_prismjs', {
2199
- processor: 'boolean',
2200
- default: false
2201
- });
2202
- };
2203
- const getLanguages$1 = option('codesample_languages');
2204
- const useGlobalPrismJS = option('codesample_global_prismjs');
2205
-
2206
- const get = editor => Global.Prism && useGlobalPrismJS(editor) ? Global.Prism : prismjs;
2207
-
2208
- const isCodeSample = elm => {
2209
- return elm && elm.nodeName === 'PRE' && elm.className.indexOf('language-') !== -1;
2210
- };
2211
-
2212
- const getSelectedCodeSample = editor => {
2213
- const node = editor.selection ? editor.selection.getNode() : null;
2214
- return someIf(isCodeSample(node), node);
2215
- };
2216
- const insertCodeSample = (editor, language, code) => {
2217
- const dom = editor.dom;
2218
- editor.undoManager.transact(() => {
2219
- const node = getSelectedCodeSample(editor);
2220
- code = global$1.DOM.encode(code);
2221
- return node.fold(() => {
2222
- editor.insertContent('<pre id="__new" class="language-' + language + '">' + code + '</pre>');
2223
- const newPre = dom.select('#__new')[0];
2224
- dom.setAttrib(newPre, 'id', null);
2225
- editor.selection.select(newPre);
2226
- }, n => {
2227
- dom.setAttrib(n, 'class', 'language-' + language);
2228
- n.innerHTML = code;
2229
- get(editor).highlightElement(n);
2230
- editor.selection.select(n);
2231
- });
2232
- });
2233
- };
2234
- const getCurrentCode = editor => {
2235
- const node = getSelectedCodeSample(editor);
2236
- return node.fold(constant(''), n => n.textContent);
2237
- };
2238
-
2239
- const getLanguages = editor => {
2240
- const defaultLanguages = [
2241
- {
2242
- text: 'HTML/XML',
2243
- value: 'markup'
2244
- },
2245
- {
2246
- text: 'JavaScript',
2247
- value: 'javascript'
2248
- },
2249
- {
2250
- text: 'CSS',
2251
- value: 'css'
2252
- },
2253
- {
2254
- text: 'PHP',
2255
- value: 'php'
2256
- },
2257
- {
2258
- text: 'Ruby',
2259
- value: 'ruby'
2260
- },
2261
- {
2262
- text: 'Python',
2263
- value: 'python'
2264
- },
2265
- {
2266
- text: 'Java',
2267
- value: 'java'
2268
- },
2269
- {
2270
- text: 'C',
2271
- value: 'c'
2272
- },
2273
- {
2274
- text: 'C#',
2275
- value: 'csharp'
2276
- },
2277
- {
2278
- text: 'C++',
2279
- value: 'cpp'
2280
- }
2281
- ];
2282
- const customLanguages = getLanguages$1(editor);
2283
- return customLanguages ? customLanguages : defaultLanguages;
2284
- };
2285
- const getCurrentLanguage = (editor, fallback) => {
2286
- const node = getSelectedCodeSample(editor);
2287
- return node.fold(() => fallback, n => {
2288
- const matches = n.className.match(/language-(\w+)/);
2289
- return matches ? matches[1] : fallback;
2290
- });
2291
- };
2292
-
2293
- const open = editor => {
2294
- const languages = getLanguages(editor);
2295
- const defaultLanguage = head(languages).fold(constant(''), l => l.value);
2296
- const currentLanguage = getCurrentLanguage(editor, defaultLanguage);
2297
- const currentCode = getCurrentCode(editor);
2298
- editor.windowManager.open({
2299
- title: 'Insert/Edit Code Sample',
2300
- size: 'large',
2301
- body: {
2302
- type: 'panel',
2303
- items: [
2304
- {
2305
- type: 'selectbox',
2306
- name: 'language',
2307
- label: 'Language',
2308
- items: languages
2309
- },
2310
- {
2311
- type: 'textarea',
2312
- name: 'code',
2313
- label: 'Code view'
2314
- }
2315
- ]
2316
- },
2317
- buttons: [
2318
- {
2319
- type: 'cancel',
2320
- name: 'cancel',
2321
- text: 'Cancel'
2322
- },
2323
- {
2324
- type: 'submit',
2325
- name: 'save',
2326
- text: 'Save',
2327
- primary: true
2328
- }
2329
- ],
2330
- initialData: {
2331
- language: currentLanguage,
2332
- code: currentCode
2333
- },
2334
- onSubmit: api => {
2335
- const data = api.getData();
2336
- insertCodeSample(editor, data.language, data.code);
2337
- api.close();
2338
- }
2339
- });
2340
- };
2341
-
2342
- const register$1 = editor => {
2343
- editor.addCommand('codesample', () => {
2344
- const node = editor.selection.getNode();
2345
- if (editor.selection.isCollapsed() || isCodeSample(node)) {
2346
- open(editor);
2347
- } else {
2348
- editor.formatter.toggle('code');
2349
- }
2350
- });
2351
- };
2352
-
2353
- const blank = r => s => s.replace(r, '');
2354
- const trim = blank(/^\s+|\s+$/g);
2355
-
2356
- var global = tinymce.util.Tools.resolve('tinymce.util.Tools');
2357
-
2358
- const setup = editor => {
2359
- editor.on('PreProcess', e => {
2360
- const dom = editor.dom;
2361
- const pres = dom.select('pre[contenteditable=false]', e.node);
2362
- global.each(global.grep(pres, isCodeSample), elm => {
2363
- const code = elm.textContent;
2364
- dom.setAttrib(elm, 'class', trim(dom.getAttrib(elm, 'class')));
2365
- dom.setAttrib(elm, 'contentEditable', null);
2366
- dom.setAttrib(elm, 'data-mce-highlighted', null);
2367
- let child;
2368
- while (child = elm.firstChild) {
2369
- elm.removeChild(child);
2370
- }
2371
- const codeElm = dom.add(elm, 'code');
2372
- codeElm.textContent = code;
2373
- });
2374
- });
2375
- editor.on('SetContent', () => {
2376
- const dom = editor.dom;
2377
- const unprocessedCodeSamples = global.grep(dom.select('pre'), elm => {
2378
- return isCodeSample(elm) && dom.getAttrib(elm, 'data-mce-highlighted') !== 'true';
2379
- });
2380
- if (unprocessedCodeSamples.length) {
2381
- editor.undoManager.transact(() => {
2382
- global.each(unprocessedCodeSamples, elm => {
2383
- var _a;
2384
- global.each(dom.select('br', elm), elm => {
2385
- dom.replace(editor.getDoc().createTextNode('\n'), elm);
2386
- });
2387
- elm.innerHTML = dom.encode((_a = elm.textContent) !== null && _a !== void 0 ? _a : '');
2388
- get(editor).highlightElement(elm);
2389
- dom.setAttrib(elm, 'data-mce-highlighted', true);
2390
- elm.className = trim(elm.className);
2391
- });
2392
- });
2393
- }
2394
- });
2395
- editor.on('PreInit', () => {
2396
- editor.parser.addNodeFilter('pre', nodes => {
2397
- var _a;
2398
- for (let i = 0, l = nodes.length; i < l; i++) {
2399
- const node = nodes[i];
2400
- const isCodeSample = ((_a = node.attr('class')) !== null && _a !== void 0 ? _a : '').indexOf('language-') !== -1;
2401
- if (isCodeSample) {
2402
- node.attr('contenteditable', 'false');
2403
- node.attr('data-mce-highlighted', 'false');
2404
- }
2405
- }
2406
- });
2407
- });
2408
- };
2409
-
2410
- const isCodeSampleSelection = editor => {
2411
- const node = editor.selection.getStart();
2412
- return editor.dom.is(node, 'pre[class*="language-"]');
2413
- };
2414
- const register = editor => {
2415
- const onAction = () => editor.execCommand('codesample');
2416
- editor.ui.registry.addToggleButton('codesample', {
2417
- icon: 'code-sample',
2418
- tooltip: 'Insert/edit code sample',
2419
- onAction,
2420
- onSetup: api => {
2421
- const nodeChangeHandler = () => {
2422
- api.setActive(isCodeSampleSelection(editor));
2423
- };
2424
- editor.on('NodeChange', nodeChangeHandler);
2425
- return () => editor.off('NodeChange', nodeChangeHandler);
2426
- }
2427
- });
2428
- editor.ui.registry.addMenuItem('codesample', {
2429
- text: 'Code sample...',
2430
- icon: 'code-sample',
2431
- onAction
2432
- });
2433
- };
2434
-
2435
- var Plugin = () => {
2436
- global$2.add('codesample', editor => {
2437
- register$2(editor);
2438
- setup(editor);
2439
- register(editor);
2440
- register$1(editor);
2441
- editor.on('dblclick', ev => {
2442
- if (isCodeSample(ev.target)) {
2443
- open(editor);
2444
- }
2445
- });
2446
- });
2447
- };
2448
-
2449
- Plugin();
2450
-
2451
- })();