This repository has been archived by the owner on Feb 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprism.js
943 lines (941 loc) · 43.2 KB
/
prism.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
/* PrismJS 1.15.0
https://prismjs.com/download.html#themes=prism-coy&languages=markup+css+clike+javascript+bash+markup-templating+go+json+nginx+php+sql+python&plugins=line-numbers */
var _self =
"undefined" != typeof window
? window
: "undefined" != typeof WorkerGlobalScope &&
self instanceof WorkerGlobalScope
? self
: {},
Prism = (function() {
var e = /\blang(?:uage)?-([\w-]+)\b/i,
t = 0,
n = (_self.Prism = {
manual: _self.Prism && _self.Prism.manual,
disableWorkerMessageHandler:
_self.Prism && _self.Prism.disableWorkerMessageHandler,
util: {
encode: function(e) {
return e instanceof a
? new a(e.type, n.util.encode(e.content), e.alias)
: "Array" === n.util.type(e)
? e.map(n.util.encode)
: e
.replace(/&/g, "&")
.replace(/</g, "<")
.replace(/\u00a0/g, " ");
},
type: function(e) {
return Object.prototype.toString.call(e).slice(8, -1);
},
objId: function(e) {
return (
e.__id || Object.defineProperty(e, "__id", { value: ++t }), e.__id
);
},
clone: function(e, t) {
var a = n.util.type(e);
switch (((t = t || {}), a)) {
case "Object":
if (t[n.util.objId(e)]) return t[n.util.objId(e)];
var r = {};
t[n.util.objId(e)] = r;
for (var l in e)
e.hasOwnProperty(l) && (r[l] = n.util.clone(e[l], t));
return r;
case "Array":
if (t[n.util.objId(e)]) return t[n.util.objId(e)];
var r = [];
return (
(t[n.util.objId(e)] = r),
e.forEach(function(e, a) {
r[a] = n.util.clone(e, t);
}),
r
);
}
return e;
}
},
languages: {
extend: function(e, t) {
var a = n.util.clone(n.languages[e]);
for (var r in t) a[r] = t[r];
return a;
},
insertBefore: function(e, t, a, r) {
r = r || n.languages;
var l = r[e],
i = {};
for (var o in l)
if (l.hasOwnProperty(o)) {
if (o == t)
for (var s in a) a.hasOwnProperty(s) && (i[s] = a[s]);
a.hasOwnProperty(o) || (i[o] = l[o]);
}
var u = r[e];
return (
(r[e] = i),
n.languages.DFS(n.languages, function(t, n) {
n === u && t != e && (this[t] = i);
}),
i
);
},
DFS: function(e, t, a, r) {
r = r || {};
for (var l in e)
e.hasOwnProperty(l) &&
(t.call(e, l, e[l], a || l),
"Object" !== n.util.type(e[l]) || r[n.util.objId(e[l])]
? "Array" !== n.util.type(e[l]) ||
r[n.util.objId(e[l])] ||
((r[n.util.objId(e[l])] = !0),
n.languages.DFS(e[l], t, l, r))
: ((r[n.util.objId(e[l])] = !0),
n.languages.DFS(e[l], t, null, r)));
}
},
plugins: {},
highlightAll: function(e, t) {
n.highlightAllUnder(document, e, t);
},
highlightAllUnder: function(e, t, a) {
var r = {
callback: a,
selector:
'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
};
n.hooks.run("before-highlightall", r);
for (
var l, i = r.elements || e.querySelectorAll(r.selector), o = 0;
(l = i[o++]);
)
n.highlightElement(l, t === !0, r.callback);
},
highlightElement: function(t, a, r) {
for (var l, i, o = t; o && !e.test(o.className); ) o = o.parentNode;
o &&
((l = (o.className.match(e) || [, ""])[1].toLowerCase()),
(i = n.languages[l])),
(t.className =
t.className.replace(e, "").replace(/\s+/g, " ") +
" language-" +
l),
t.parentNode &&
((o = t.parentNode),
/pre/i.test(o.nodeName) &&
(o.className =
o.className.replace(e, "").replace(/\s+/g, " ") +
" language-" +
l));
var s = t.textContent,
u = { element: t, language: l, grammar: i, code: s };
if ((n.hooks.run("before-sanity-check", u), !u.code || !u.grammar))
return (
u.code &&
(n.hooks.run("before-highlight", u),
(u.element.textContent = u.code),
n.hooks.run("after-highlight", u)),
n.hooks.run("complete", u),
void 0
);
if ((n.hooks.run("before-highlight", u), a && _self.Worker)) {
var g = new Worker(n.filename);
(g.onmessage = function(e) {
(u.highlightedCode = e.data),
n.hooks.run("before-insert", u),
(u.element.innerHTML = u.highlightedCode),
n.hooks.run("after-highlight", u),
n.hooks.run("complete", u),
r && r.call(u.element);
}),
g.postMessage(
JSON.stringify({
language: u.language,
code: u.code,
immediateClose: !0
})
);
} else
(u.highlightedCode = n.highlight(u.code, u.grammar, u.language)),
n.hooks.run("before-insert", u),
(u.element.innerHTML = u.highlightedCode),
n.hooks.run("after-highlight", u),
n.hooks.run("complete", u),
r && r.call(t);
},
highlight: function(e, t, r) {
var l = { code: e, grammar: t, language: r };
return (
n.hooks.run("before-tokenize", l),
(l.tokens = n.tokenize(l.code, l.grammar)),
n.hooks.run("after-tokenize", l),
a.stringify(n.util.encode(l.tokens), l.language)
);
},
matchGrammar: function(e, t, a, r, l, i, o) {
var s = n.Token;
for (var u in a)
if (a.hasOwnProperty(u) && a[u]) {
if (u == o) return;
var g = a[u];
g = "Array" === n.util.type(g) ? g : [g];
for (var c = 0; c < g.length; ++c) {
var h = g[c],
f = h.inside,
d = !!h.lookbehind,
m = !!h.greedy,
p = 0,
y = h.alias;
if (m && !h.pattern.global) {
var v = h.pattern.toString().match(/[imuy]*$/)[0];
h.pattern = RegExp(h.pattern.source, v + "g");
}
h = h.pattern || h;
for (var b = r, k = l; b < t.length; k += t[b].length, ++b) {
var w = t[b];
if (t.length > e.length) return;
if (!(w instanceof s)) {
if (m && b != t.length - 1) {
h.lastIndex = k;
var _ = h.exec(e);
if (!_) break;
for (
var j = _.index + (d ? _[1].length : 0),
P = _.index + _[0].length,
A = b,
x = k,
O = t.length;
O > A && (P > x || (!t[A].type && !t[A - 1].greedy));
++A
)
(x += t[A].length), j >= x && (++b, (k = x));
if (t[b] instanceof s) continue;
(I = A - b), (w = e.slice(k, x)), (_.index -= k);
} else {
h.lastIndex = 0;
var _ = h.exec(w),
I = 1;
}
if (_) {
d && (p = _[1] ? _[1].length : 0);
var j = _.index + p,
_ = _[0].slice(p),
P = j + _.length,
N = w.slice(0, j),
S = w.slice(P),
C = [b, I];
N && (++b, (k += N.length), C.push(N));
var E = new s(u, f ? n.tokenize(_, f) : _, y, _, m);
if (
(C.push(E),
S && C.push(S),
Array.prototype.splice.apply(t, C),
1 != I && n.matchGrammar(e, t, a, b, k, !0, u),
i)
)
break;
} else if (i) break;
}
}
}
}
},
tokenize: function(e, t) {
var a = [e],
r = t.rest;
if (r) {
for (var l in r) t[l] = r[l];
delete t.rest;
}
return n.matchGrammar(e, a, t, 0, 0, !1), a;
},
hooks: {
all: {},
add: function(e, t) {
var a = n.hooks.all;
(a[e] = a[e] || []), a[e].push(t);
},
run: function(e, t) {
var a = n.hooks.all[e];
if (a && a.length) for (var r, l = 0; (r = a[l++]); ) r(t);
}
}
}),
a = (n.Token = function(e, t, n, a, r) {
(this.type = e),
(this.content = t),
(this.alias = n),
(this.length = 0 | (a || "").length),
(this.greedy = !!r);
});
if (
((a.stringify = function(e, t, r) {
if ("string" == typeof e) return e;
if ("Array" === n.util.type(e))
return e
.map(function(n) {
return a.stringify(n, t, e);
})
.join("");
var l = {
type: e.type,
content: a.stringify(e.content, t, r),
tag: "span",
classes: ["token", e.type],
attributes: {},
language: t,
parent: r
};
if (e.alias) {
var i = "Array" === n.util.type(e.alias) ? e.alias : [e.alias];
Array.prototype.push.apply(l.classes, i);
}
n.hooks.run("wrap", l);
var o = Object.keys(l.attributes)
.map(function(e) {
return (
e + '="' + (l.attributes[e] || "").replace(/"/g, """) + '"'
);
})
.join(" ");
return (
"<" +
l.tag +
' class="' +
l.classes.join(" ") +
'"' +
(o ? " " + o : "") +
">" +
l.content +
"</" +
l.tag +
">"
);
}),
!_self.document)
)
return _self.addEventListener
? (n.disableWorkerMessageHandler ||
_self.addEventListener(
"message",
function(e) {
var t = JSON.parse(e.data),
a = t.language,
r = t.code,
l = t.immediateClose;
_self.postMessage(n.highlight(r, n.languages[a], a)),
l && _self.close();
},
!1
),
_self.Prism)
: _self.Prism;
var r =
document.currentScript ||
[].slice.call(document.getElementsByTagName("script")).pop();
return (
r &&
((n.filename = r.src),
n.manual ||
r.hasAttribute("data-manual") ||
("loading" !== document.readyState
? window.requestAnimationFrame
? window.requestAnimationFrame(n.highlightAll)
: window.setTimeout(n.highlightAll, 16)
: document.addEventListener("DOMContentLoaded", n.highlightAll))),
_self.Prism
);
})();
"undefined" != typeof module && module.exports && (module.exports = Prism),
"undefined" != typeof global && (global.Prism = Prism);
(Prism.languages.markup = {
comment: /<!--[\s\S]*?-->/,
prolog: /<\?[\s\S]+?\?>/,
doctype: /<!DOCTYPE[\s\S]+?>/i,
cdata: /<!\[CDATA\[[\s\S]*?]]>/i,
tag: {
pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i,
greedy: !0,
inside: {
tag: {
pattern: /^<\/?[^\s>\/]+/i,
inside: { punctuation: /^<\/?/, namespace: /^[^\s>\/:]+:/ }
},
"attr-value": {
pattern: /=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+)/i,
inside: {
punctuation: [/^=/, { pattern: /(^|[^\\])["']/, lookbehind: !0 }]
}
},
punctuation: /\/?>/,
"attr-name": {
pattern: /[^\s>\/]+/,
inside: { namespace: /^[^\s>\/:]+:/ }
}
}
},
entity: /&#?[\da-z]{1,8};/i
}),
(Prism.languages.markup.tag.inside["attr-value"].inside.entity =
Prism.languages.markup.entity),
Prism.hooks.add("wrap", function(a) {
"entity" === a.type &&
(a.attributes.title = a.content.replace(/&/, "&"));
}),
(Prism.languages.xml = Prism.languages.markup),
(Prism.languages.html = Prism.languages.markup),
(Prism.languages.mathml = Prism.languages.markup),
(Prism.languages.svg = Prism.languages.markup);
(Prism.languages.css = {
comment: /\/\*[\s\S]*?\*\//,
atrule: {
pattern: /@[\w-]+?[\s\S]*?(?:;|(?=\s*\{))/i,
inside: { rule: /@[\w-]+/ }
},
url: /url\((?:(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,
selector: /[^{}\s][^{};]*?(?=\s*\{)/,
string: {
pattern: /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
greedy: !0
},
property: /[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i,
important: /!important\b/i,
function: /[-a-z0-9]+(?=\()/i,
punctuation: /[(){};:,]/
}),
(Prism.languages.css.atrule.inside.rest = Prism.languages.css),
Prism.languages.markup &&
(Prism.languages.insertBefore("markup", "tag", {
style: {
pattern: /(<style[\s\S]*?>)[\s\S]*?(?=<\/style>)/i,
lookbehind: !0,
inside: Prism.languages.css,
alias: "language-css",
greedy: !0
}
}),
Prism.languages.insertBefore(
"inside",
"attr-value",
{
"style-attr": {
pattern: /\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/i,
inside: {
"attr-name": {
pattern: /^\s*style/i,
inside: Prism.languages.markup.tag.inside
},
punctuation: /^\s*=\s*['"]|['"]\s*$/,
"attr-value": { pattern: /.+/i, inside: Prism.languages.css }
},
alias: "language-css"
}
},
Prism.languages.markup.tag
));
Prism.languages.clike = {
comment: [
{ pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/, lookbehind: !0 },
{ pattern: /(^|[^\\:])\/\/.*/, lookbehind: !0, greedy: !0 }
],
string: {
pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
greedy: !0
},
"class-name": {
pattern: /((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[\w.\\]+/i,
lookbehind: !0,
inside: { punctuation: /[.\\]/ }
},
keyword: /\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,
boolean: /\b(?:true|false)\b/,
function: /\w+(?=\()/,
number: /\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i,
operator: /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,
punctuation: /[{}[\];(),.:]/
};
(Prism.languages.javascript = Prism.languages.extend("clike", {
"class-name": [
Prism.languages.clike["class-name"],
{
pattern: /(^|[^$\w\xA0-\uFFFF])[_$A-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\.(?:prototype|constructor))/,
lookbehind: !0
}
],
keyword: [
{ pattern: /((?:^|})\s*)(?:catch|finally)\b/, lookbehind: !0 },
/\b(?:as|async|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|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|var|void|while|with|yield)\b/
],
number: /\b(?:(?:0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+)n?|\d+n|NaN|Infinity)\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee][+-]?\d+)?/,
function: /[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*\(|\.(?:apply|bind|call)\()/,
operator: /-[-=]?|\+[+=]?|!=?=?|<<?=?|>>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/
})),
(Prism.languages.javascript[
"class-name"
][0].pattern = /(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/),
Prism.languages.insertBefore("javascript", "keyword", {
regex: {
pattern: /((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(\[(?:[^\]\\\r\n]|\\.)*]|\\.|[^\/\\\[\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})\]]))/,
lookbehind: !0,
greedy: !0
},
"function-variable": {
pattern: /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\([^()]*\)|[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/i,
alias: "function"
},
parameter: [
{
pattern: /(function(?:\s+[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)?\s*\(\s*)[^\s()][^()]*?(?=\s*\))/,
lookbehind: !0,
inside: Prism.languages.javascript
},
{
pattern: /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=>)/,
inside: Prism.languages.javascript
},
{
pattern: /(\(\s*)[^\s()][^()]*?(?=\s*\)\s*=>)/,
lookbehind: !0,
inside: Prism.languages.javascript
},
{
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|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*\s*)\(\s*)[^\s()][^()]*?(?=\s*\)\s*\{)/,
lookbehind: !0,
inside: Prism.languages.javascript
}
],
constant: /\b[A-Z][A-Z\d_]*\b/
}),
Prism.languages.insertBefore("javascript", "string", {
"template-string": {
pattern: /`(?:\\[\s\S]|\${[^}]+}|[^\\`])*`/,
greedy: !0,
inside: {
interpolation: {
pattern: /\${[^}]+}/,
inside: {
"interpolation-punctuation": {
pattern: /^\${|}$/,
alias: "punctuation"
},
rest: Prism.languages.javascript
}
},
string: /[\s\S]+/
}
}
}),
Prism.languages.markup &&
Prism.languages.insertBefore("markup", "tag", {
script: {
pattern: /(<script[\s\S]*?>)[\s\S]*?(?=<\/script>)/i,
lookbehind: !0,
inside: Prism.languages.javascript,
alias: "language-javascript",
greedy: !0
}
}),
(Prism.languages.js = Prism.languages.javascript);
!(function(e) {
var t = {
variable: [
{
pattern: /\$?\(\([\s\S]+?\)\)/,
inside: {
variable: [
{ pattern: /(^\$\(\([\s\S]+)\)\)/, lookbehind: !0 },
/^\$\(\(/
],
number: /\b0x[\dA-Fa-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee]-?\d+)?/,
operator: /--?|-=|\+\+?|\+=|!=?|~|\*\*?|\*=|\/=?|%=?|<<=?|>>=?|<=?|>=?|==?|&&?|&=|\^=?|\|\|?|\|=|\?|:/,
punctuation: /\(\(?|\)\)?|,|;/
}
},
{
pattern: /\$\([^)]+\)|`[^`]+`/,
greedy: !0,
inside: { variable: /^\$\(|^`|\)$|`$/ }
},
/\$(?:[\w#?*!@]+|\{[^}]+\})/i
]
};
e.languages.bash = {
shebang: {
pattern: /^#!\s*\/bin\/bash|^#!\s*\/bin\/sh/,
alias: "important"
},
comment: { pattern: /(^|[^"{\\])#.*/, lookbehind: !0 },
string: [
{
pattern: /((?:^|[^<])<<\s*)["']?(\w+?)["']?\s*\r?\n(?:[\s\S])*?\r?\n\2/,
lookbehind: !0,
greedy: !0,
inside: t
},
{
pattern: /(["'])(?:\\[\s\S]|\$\([^)]+\)|`[^`]+`|(?!\1)[^\\])*\1/,
greedy: !0,
inside: t
}
],
variable: t.variable,
function: {
pattern: /(^|[\s;|&])(?:alias|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|builtin|bzip2|cal|cat|cd|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|comm|command|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|du|egrep|eject|enable|env|ethtool|eval|exec|expand|expect|export|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|getopts|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|hash|head|help|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|jobs|join|kill|killall|less|link|ln|locate|logname|logout|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|popd|pr|printcap|printenv|printf|ps|pushd|pv|pwd|quota|quotacheck|quotactl|ram|rar|rcp|read|readarray|readonly|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|shift|shopt|shutdown|sleep|slocate|sort|source|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|tail|tar|tee|test|time|timeout|times|top|touch|tr|traceroute|trap|tsort|tty|type|ulimit|umask|umount|unalias|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yes|zip|zypper)(?=$|[\s;|&])/,
lookbehind: !0
},
keyword: {
pattern: /(^|[\s;|&])(?:let|:|\.|if|then|else|elif|fi|for|break|continue|while|in|case|function|select|do|done|until|echo|exit|return|set|declare)(?=$|[\s;|&])/,
lookbehind: !0
},
boolean: {
pattern: /(^|[\s;|&])(?:true|false)(?=$|[\s;|&])/,
lookbehind: !0
},
operator: /&&?|\|\|?|==?|!=?|<<<?|>>|<=?|>=?|=~/,
punctuation: /\$?\(\(?|\)\)?|\.\.|[{}[\];]/
};
var a = t.variable[1].inside;
(a.string = e.languages.bash.string),
(a["function"] = e.languages.bash["function"]),
(a.keyword = e.languages.bash.keyword),
(a["boolean"] = e.languages.bash["boolean"]),
(a.operator = e.languages.bash.operator),
(a.punctuation = e.languages.bash.punctuation),
(e.languages.shell = e.languages.bash);
})(Prism);
(Prism.languages["markup-templating"] = {}),
Object.defineProperties(Prism.languages["markup-templating"], {
buildPlaceholders: {
value: function(e, t, n, a) {
e.language === t &&
((e.tokenStack = []),
(e.code = e.code.replace(n, function(n) {
if ("function" == typeof a && !a(n)) return n;
for (
var r = e.tokenStack.length;
-1 !== e.code.indexOf("___" + t.toUpperCase() + r + "___");
)
++r;
return (e.tokenStack[r] = n), "___" + t.toUpperCase() + r + "___";
})),
(e.grammar = Prism.languages.markup));
}
},
tokenizePlaceholders: {
value: function(e, t) {
if (e.language === t && e.tokenStack) {
e.grammar = Prism.languages[t];
var n = 0,
a = Object.keys(e.tokenStack),
r = function(o) {
if (!(n >= a.length))
for (var i = 0; i < o.length; i++) {
var g = o[i];
if (
"string" == typeof g ||
(g.content && "string" == typeof g.content)
) {
var c = a[n],
s = e.tokenStack[c],
l = "string" == typeof g ? g : g.content,
p = l.indexOf("___" + t.toUpperCase() + c + "___");
if (p > -1) {
++n;
var f,
u = l.substring(0, p),
_ = new Prism.Token(
t,
Prism.tokenize(s, e.grammar, t),
"language-" + t,
s
),
k = l.substring(
p + ("___" + t.toUpperCase() + c + "___").length
);
if (
(u || k
? ((f = [u, _, k].filter(function(e) {
return !!e;
})),
r(f))
: (f = _),
"string" == typeof g
? Array.prototype.splice.apply(o, [i, 1].concat(f))
: (g.content = f),
n >= a.length)
)
break;
}
} else
g.content && "string" != typeof g.content && r(g.content);
}
};
r(e.tokens);
}
}
}
});
(Prism.languages.go = Prism.languages.extend("clike", {
keyword: /\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,
builtin: /\b(?:bool|byte|complex(?:64|128)|error|float(?:32|64)|rune|string|u?int(?:8|16|32|64)?|uintptr|append|cap|close|complex|copy|delete|imag|len|make|new|panic|print(?:ln)?|real|recover)\b/,
boolean: /\b(?:_|iota|nil|true|false)\b/,
operator: /[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,
number: /(?:\b0x[a-f\d]+|(?:\b\d+\.?\d*|\B\.\d+)(?:e[-+]?\d+)?)i?/i,
string: { pattern: /(["'`])(\\[\s\S]|(?!\1)[^\\])*\1/, greedy: !0 }
})),
delete Prism.languages.go["class-name"];
(Prism.languages.json = {
comment: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
property: { pattern: /"(?:\\.|[^\\"\r\n])*"(?=\s*:)/, greedy: !0 },
string: { pattern: /"(?:\\.|[^\\"\r\n])*"(?!\s*:)/, greedy: !0 },
number: /-?\d+\.?\d*(e[+-]?\d+)?/i,
punctuation: /[{}[\],]/,
operator: /:/,
boolean: /\b(?:true|false)\b/,
null: /\bnull\b/
}),
(Prism.languages.jsonp = Prism.languages.json);
(Prism.languages.nginx = Prism.languages.extend("clike", {
comment: { pattern: /(^|[^"{\\])#.*/, lookbehind: !0 },
keyword: /\b(?:CONTENT_|DOCUMENT_|GATEWAY_|HTTP_|HTTPS|if_not_empty|PATH_|QUERY_|REDIRECT_|REMOTE_|REQUEST_|SCGI|SCRIPT_|SERVER_|http|events|accept_mutex|accept_mutex_delay|access_log|add_after_body|add_before_body|add_header|addition_types|aio|alias|allow|ancient_browser|ancient_browser_value|auth|auth_basic|auth_basic_user_file|auth_http|auth_http_header|auth_http_timeout|autoindex|autoindex_exact_size|autoindex_localtime|break|charset|charset_map|charset_types|chunked_transfer_encoding|client_body_buffer_size|client_body_in_file_only|client_body_in_single_buffer|client_body_temp_path|client_body_timeout|client_header_buffer_size|client_header_timeout|client_max_body_size|connection_pool_size|create_full_put_path|daemon|dav_access|dav_methods|debug_connection|debug_points|default_type|deny|devpoll_changes|devpoll_events|directio|directio_alignment|disable_symlinks|empty_gif|env|epoll_events|error_log|error_page|expires|fastcgi_buffer_size|fastcgi_buffers|fastcgi_busy_buffers_size|fastcgi_cache|fastcgi_cache_bypass|fastcgi_cache_key|fastcgi_cache_lock|fastcgi_cache_lock_timeout|fastcgi_cache_methods|fastcgi_cache_min_uses|fastcgi_cache_path|fastcgi_cache_purge|fastcgi_cache_use_stale|fastcgi_cache_valid|fastcgi_connect_timeout|fastcgi_hide_header|fastcgi_ignore_client_abort|fastcgi_ignore_headers|fastcgi_index|fastcgi_intercept_errors|fastcgi_keep_conn|fastcgi_max_temp_file_size|fastcgi_next_upstream|fastcgi_no_cache|fastcgi_param|fastcgi_pass|fastcgi_pass_header|fastcgi_read_timeout|fastcgi_redirect_errors|fastcgi_send_timeout|fastcgi_split_path_info|fastcgi_store|fastcgi_store_access|fastcgi_temp_file_write_size|fastcgi_temp_path|flv|geo|geoip_city|geoip_country|google_perftools_profiles|gzip|gzip_buffers|gzip_comp_level|gzip_disable|gzip_http_version|gzip_min_length|gzip_proxied|gzip_static|gzip_types|gzip_vary|if|if_modified_since|ignore_invalid_headers|image_filter|image_filter_buffer|image_filter_jpeg_quality|image_filter_sharpen|image_filter_transparency|imap_capabilities|imap_client_buffer|include|index|internal|ip_hash|keepalive|keepalive_disable|keepalive_requests|keepalive_timeout|kqueue_changes|kqueue_events|large_client_header_buffers|limit_conn|limit_conn_log_level|limit_conn_zone|limit_except|limit_rate|limit_rate_after|limit_req|limit_req_log_level|limit_req_zone|limit_zone|lingering_close|lingering_time|lingering_timeout|listen|location|lock_file|log_format|log_format_combined|log_not_found|log_subrequest|map|map_hash_bucket_size|map_hash_max_size|master_process|max_ranges|memcached_buffer_size|memcached_connect_timeout|memcached_next_upstream|memcached_pass|memcached_read_timeout|memcached_send_timeout|merge_slashes|min_delete_depth|modern_browser|modern_browser_value|mp4|mp4_buffer_size|mp4_max_buffer_size|msie_padding|msie_refresh|multi_accept|open_file_cache|open_file_cache_errors|open_file_cache_min_uses|open_file_cache_valid|open_log_file_cache|optimize_server_names|override_charset|pcre_jit|perl|perl_modules|perl_require|perl_set|pid|pop3_auth|pop3_capabilities|port_in_redirect|post_action|postpone_output|protocol|proxy|proxy_buffer|proxy_buffer_size|proxy_buffering|proxy_buffers|proxy_busy_buffers_size|proxy_cache|proxy_cache_bypass|proxy_cache_key|proxy_cache_lock|proxy_cache_lock_timeout|proxy_cache_methods|proxy_cache_min_uses|proxy_cache_path|proxy_cache_use_stale|proxy_cache_valid|proxy_connect_timeout|proxy_cookie_domain|proxy_cookie_path|proxy_headers_hash_bucket_size|proxy_headers_hash_max_size|proxy_hide_header|proxy_http_version|proxy_ignore_client_abort|proxy_ignore_headers|proxy_intercept_errors|proxy_max_temp_file_size|proxy_method|proxy_next_upstream|proxy_no_cache|proxy_pass|proxy_pass_error_message|proxy_pass_header|proxy_pass_request_body|proxy_pass_request_headers|proxy_read_timeout|proxy_redirect|proxy_redirect_errors|proxy_send_lowat|proxy_send_timeout|proxy_set_body|proxy_set_header|proxy_ssl_session_reuse|proxy_store|proxy_store_access|proxy_temp_file_write_size|proxy_temp_path|proxy_timeout|proxy_upstream_fail_timeout|proxy_upstream_max_fails|random_index|read_ahead|real_ip_header|recursive_error_pages|request_pool_size|reset_timedout_connection|resolver|resolver_timeout|return|rewrite|root|rtsig_overflow_events|rtsig_overflow_test|rtsig_overflow_threshold|rtsig_signo|satisfy|satisfy_any|secure_link_secret|send_lowat|send_timeout|sendfile|sendfile_max_chunk|server|server_name|server_name_in_redirect|server_names_hash_bucket_size|server_names_hash_max_size|server_tokens|set|set_real_ip_from|smtp_auth|smtp_capabilities|so_keepalive|source_charset|split_clients|ssi|ssi_silent_errors|ssi_types|ssi_value_length|ssl|ssl_certificate|ssl_certificate_key|ssl_ciphers|ssl_client_certificate|ssl_crl|ssl_dhparam|ssl_engine|ssl_prefer_server_ciphers|ssl_protocols|ssl_session_cache|ssl_session_timeout|ssl_verify_client|ssl_verify_depth|starttls|stub_status|sub_filter|sub_filter_once|sub_filter_types|tcp_nodelay|tcp_nopush|timeout|timer_resolution|try_files|types|types_hash_bucket_size|types_hash_max_size|underscores_in_headers|uninitialized_variable_warn|upstream|use|user|userid|userid_domain|userid_expires|userid_name|userid_p3p|userid_path|userid_service|valid_referers|variables_hash_bucket_size|variables_hash_max_size|worker_connections|worker_cpu_affinity|worker_priority|worker_processes|worker_rlimit_core|worker_rlimit_nofile|worker_rlimit_sigpending|working_directory|xclient|xml_entities|xslt_entities|xslt_stylesheet|xslt_types|ssl_session_tickets|ssl_stapling|ssl_stapling_verify|ssl_ecdh_curve|ssl_trusted_certificate|more_set_headers|ssl_early_data)\b/i
})),
Prism.languages.insertBefore("nginx", "keyword", { variable: /\$[a-z_]+/i });
!(function(e) {
(e.languages.php = e.languages.extend("clike", {
keyword: /\b(?:and|or|xor|array|as|break|case|cfunction|class|const|continue|declare|default|die|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|for|foreach|function|include|include_once|global|if|new|return|static|switch|use|require|require_once|var|while|abstract|interface|public|implements|private|protected|parent|throw|null|echo|print|trait|namespace|final|yield|goto|instanceof|finally|try|catch)\b/i,
constant: /\b[A-Z0-9_]{2,}\b/,
comment: { pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/, lookbehind: !0 }
})),
e.languages.insertBefore("php", "string", {
"shell-comment": {
pattern: /(^|[^\\])#.*/,
lookbehind: !0,
alias: "comment"
}
}),
e.languages.insertBefore("php", "keyword", {
delimiter: { pattern: /\?>|<\?(?:php|=)?/i, alias: "important" },
variable: /\$+(?:\w+\b|(?={))/i,
package: {
pattern: /(\\|namespace\s+|use\s+)[\w\\]+/,
lookbehind: !0,
inside: { punctuation: /\\/ }
}
}),
e.languages.insertBefore("php", "operator", {
property: { pattern: /(->)[\w]+/, lookbehind: !0 }
});
var n = {
pattern: /{\$(?:{(?:{[^{}]+}|[^{}]+)}|[^{}])+}|(^|[^\\{])\$+(?:\w+(?:\[.+?]|->\w+)*)/,
lookbehind: !0,
inside: { rest: e.languages.php }
};
e.languages.insertBefore("php", "string", {
"nowdoc-string": {
pattern: /<<<'([^']+)'(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\1;/,
greedy: !0,
alias: "string",
inside: {
delimiter: {
pattern: /^<<<'[^']+'|[a-z_]\w*;$/i,
alias: "symbol",
inside: { punctuation: /^<<<'?|[';]$/ }
}
}
},
"heredoc-string": {
pattern: /<<<(?:"([^"]+)"(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\1;|([a-z_]\w*)(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\2;)/i,
greedy: !0,
alias: "string",
inside: {
delimiter: {
pattern: /^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,
alias: "symbol",
inside: { punctuation: /^<<<"?|[";]$/ }
},
interpolation: n
}
},
"single-quoted-string": {
pattern: /'(?:\\[\s\S]|[^\\'])*'/,
greedy: !0,
alias: "string"
},
"double-quoted-string": {
pattern: /"(?:\\[\s\S]|[^\\"])*"/,
greedy: !0,
alias: "string",
inside: { interpolation: n }
}
}),
delete e.languages.php.string,
e.hooks.add("before-tokenize", function(n) {
if (/(?:<\?php|<\?)/gi.test(n.code)) {
var t = /(?:<\?php|<\?)[\s\S]*?(?:\?>|$)/gi;
e.languages["markup-templating"].buildPlaceholders(n, "php", t);
}
}),
e.hooks.add("after-tokenize", function(n) {
e.languages["markup-templating"].tokenizePlaceholders(n, "php");
});
})(Prism);
Prism.languages.sql = {
comment: {
pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,
lookbehind: !0
},
variable: [
{ pattern: /@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/, greedy: !0 },
/@[\w.$]+/
],
string: {
pattern: /(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,
greedy: !0,
lookbehind: !0
},
function: /\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,
keyword: /\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:_INSERT|COL)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURNS?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,
boolean: /\b(?:TRUE|FALSE|NULL)\b/i,
number: /\b0x[\da-f]+\b|\b\d+\.?\d*|\B\.\d+\b/i,
operator: /[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|IN|LIKE|NOT|OR|IS|DIV|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,
punctuation: /[;[\]()`,.]/
};
(Prism.languages.python = {
comment: { pattern: /(^|[^\\])#.*/, lookbehind: !0 },
"string-interpolation": {
pattern: /(?:f|rf|fr)(?:("""|''')[\s\S]+?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,
greedy: !0,
inside: {
interpolation: {
pattern: /((?:^|[^{])(?:{{)*){(?!{)(?:[^{}]|{(?!{)(?:[^{}]|{(?!{)(?:[^{}])+})+})+}/,
lookbehind: !0,
inside: {
"format-spec": { pattern: /(:)[^:(){}]+(?=}$)/, lookbehind: !0 },
"conversion-option": {
pattern: /![sra](?=[:}]$)/,
alias: "punctuation"
},
rest: null
}
},
string: /[\s\S]+/
}
},
"triple-quoted-string": {
pattern: /(?:[rub]|rb|br)?("""|''')[\s\S]+?\1/i,
greedy: !0,
alias: "string"
},
string: {
pattern: /(?:[rub]|rb|br)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,
greedy: !0
},
function: {
pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,
lookbehind: !0
},
"class-name": { pattern: /(\bclass\s+)\w+/i, lookbehind: !0 },
decorator: {
pattern: /(^\s*)@\w+(?:\.\w+)*/i,
lookbehind: !0,
alias: ["annotation", "punctuation"],
inside: { punctuation: /\./ }
},
keyword: /\b(?:and|as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,
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/,
boolean: /\b(?:True|False|None)\b/,
number: /(?:\b(?=\d)|\B(?=\.))(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/i,
operator: /[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
punctuation: /[{}[\];(),.:]/
}),
(Prism.languages.python[
"string-interpolation"
].inside.interpolation.inside.rest = Prism.languages.python),
(Prism.languages.py = Prism.languages.python);
!(function() {
if ("undefined" != typeof self && self.Prism && self.document) {
var e = "line-numbers",
t = /\n(?!$)/g,
n = function(e) {
var n = r(e),
s = n["white-space"];
if ("pre-wrap" === s || "pre-line" === s) {
var l = e.querySelector("code"),
i = e.querySelector(".line-numbers-rows"),
a = e.querySelector(".line-numbers-sizer"),
o = l.textContent.split(t);
a ||
((a = document.createElement("span")),
(a.className = "line-numbers-sizer"),
l.appendChild(a)),
(a.style.display = "block"),
o.forEach(function(e, t) {
a.textContent = e || "\n";
var n = a.getBoundingClientRect().height;
i.children[t].style.height = n + "px";
}),
(a.textContent = ""),
(a.style.display = "none");
}
},
r = function(e) {
return e
? window.getComputedStyle
? getComputedStyle(e)
: e.currentStyle || null
: null;
};
window.addEventListener("resize", function() {
Array.prototype.forEach.call(document.querySelectorAll("pre." + e), n);
}),
Prism.hooks.add("complete", function(e) {
if (e.code) {
var r = e.element.parentNode,
s = /\s*\bline-numbers\b\s*/;
if (
r &&
/pre/i.test(r.nodeName) &&
(s.test(r.className) || s.test(e.element.className)) &&
!e.element.querySelector(".line-numbers-rows")
) {
s.test(e.element.className) &&
(e.element.className = e.element.className.replace(s, " ")),
s.test(r.className) || (r.className += " line-numbers");
var l,
i = e.code.match(t),
a = i ? i.length + 1 : 1,
o = new Array(a + 1);
(o = o.join("<span></span>")),
(l = document.createElement("span")),
l.setAttribute("aria-hidden", "true"),
(l.className = "line-numbers-rows"),
(l.innerHTML = o),
r.hasAttribute("data-start") &&
(r.style.counterReset =
"linenumber " +
(parseInt(r.getAttribute("data-start"), 10) - 1)),
e.element.appendChild(l),
n(r),
Prism.hooks.run("line-numbers", e);
}
}
}),
Prism.hooks.add("line-numbers", function(e) {
(e.plugins = e.plugins || {}), (e.plugins.lineNumbers = !0);
}),
(Prism.plugins.lineNumbers = {
getLine: function(t, n) {
if ("PRE" === t.tagName && t.classList.contains(e)) {
var r = t.querySelector(".line-numbers-rows"),
s = parseInt(t.getAttribute("data-start"), 10) || 1,
l = s + (r.children.length - 1);
s > n && (n = s), n > l && (n = l);
var i = n - s;
return r.children[i];
}
}
});
}
})();