Projekt

Obecné

Profil

Stáhnout (19 KB) Statistiky
| Větev: | Tag: | Revize:
1
ace.define("ace/mode/mediawiki_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
2
"use strict";
3

    
4
var oop = require("../lib/oop");
5
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
6

    
7
var MediaWikiHighlightRules = function() {
8
    this.$rules = {
9
        start: [{
10
            include: "#switch"
11
        }, {
12
            include: "#redirect"
13
        }, {
14
            include: "#variable"
15
        }, {
16
            include: "#comment"
17
        }, {
18
            include: "#entity"
19
        }, {
20
            include: "#emphasis"
21
        }, {
22
            include: "#tag"
23
        }, {
24
            include: "#table"
25
        }, {
26
            include: "#hr"
27
        }, {
28
            include: "#heading"
29
        }, {
30
            include: "#link"
31
        }, {
32
            include: "#list"
33
        }, {
34
            include: "#template"
35
        }],
36
        "#hr": [{
37
            token: "markup.bold",
38
            regex: /^[-]{4,}/
39
        }],
40
        "#switch": [{
41
            token: "constant.language",
42
            regex: /(__NOTOC__|__FORCETOC__|__TOC__|__NOEDITSECTION__|__NEWSECTIONLINK__|__NONEWSECTIONLINK__|__NOWYSIWYG__|__NOGALLERY__|__HIDDENCAT__|__EXPECTUNUSEDCATEGORY__|__NOCONTENTCONVERT__|__NOCC__|__NOTITLECONVERT__|__NOTC__|__START__|__END__|__INDEX__|__NOINDEX__|__STATICREDIRECT__|__NOGLOBAL__|__DISAMBIG__)/
43
        }],
44
        "#redirect": [{
45
            token: [
46
                "keyword.control.redirect",
47
                "meta.keyword.control"
48
            ],
49
            regex: /(^#REDIRECT|^#redirect|^#Redirect)(\s+)/
50
        }],
51
        "#variable": [{
52
            token: "storage.type.variable",
53
            regex: /{{{/,
54
            push: [{
55
                token: "storage.type.variable",
56
                regex: /}}}/,
57
                next: "pop"
58
            }, {
59
                token: [
60
                    "text",
61
                    "variable.other",
62
                    "text",
63
                    "keyword.operator"
64
                ],
65
                regex: /(\s*)(\w+)(\s*)((?:\|)?)/
66
            }, {
67
                defaultToken: "storage.type.variable"
68
            }]
69
        }],
70
        "#entity": [{
71
            token: "constant.character.entity",
72
            regex: /&\w+;/
73
        }],
74
        "#list": [{
75
            token: "markup.bold",
76
            regex: /^[#*;:]+/,
77
            push: [{
78
                token: "markup.list",
79
                regex: /$/,
80
                next: "pop"
81
            }, {
82
                include: "$self"
83
            }, {
84
                defaultToken: "markup.list"
85
            }]
86
        }],
87
        "#template": [{
88
            token: [
89
                "storage.type.function",
90
                "meta.template",
91
                "entity.name.function",
92
                "meta.template"
93
            ],
94
            regex: /({{)(\s*)([#\w: ]+)(\s*)/,
95
            push: [{
96
                token: "storage.type.function",
97
                regex: /}}/,
98
                next: "pop"
99
            }, {
100
                token: [
101
                    "storage",
102
                    "meta.structure.dictionary",
103
                    "support.type.property-name",
104
                    "meta.structure.dictionary",
105
                    "punctuation.separator.dictionary.key-value",
106
                    "meta.structure.dictionary",
107
                    "meta.structure.dictionary.value"
108
                ],
109
                regex: /(\|)(\s*)([a-zA-Z-]*)(\s*)(=)(\s*)([^|}]*)/,
110
                push: [{
111
                    token: "meta.structure.dictionary",
112
                    regex: /(?=}}|[|])/,
113
                    next: "pop"
114
                }, {
115
                    defaultToken: "meta.structure.dictionary"
116
                }]
117
            }, {
118
                token: ["storage", "meta.template.value"],
119
                regex: /(\|)(.*?)/,
120
                push: [{
121
                    token: [],
122
                    regex: /(?=}}|[|])/,
123
                    next: "pop"
124
                }, {
125
                    include: "$self"
126
                }, {
127
                    defaultToken: "meta.template.value"
128
                }]
129
            }, {
130
                defaultToken: "meta.template"
131
            }]
132
        }],
133
        "#link": [{
134
            token: [
135
                "punctuation.definition.tag.begin",
136
                "meta.tag.link.internal",
137
                "entity.name.tag",
138
                "meta.tag.link.internal",
139
                "string.other.link.title",
140
                "meta.tag.link.internal",
141
                "punctuation.definition.tag"
142
            ],
143
            regex: /(\[\[)(\s*)((?:Category|Wikipedia)?)(:?)([^\]\]\|]+)(\s*)((?:\|)*)/,
144
            push: [{
145
                token: "punctuation.definition.tag.end",
146
                regex: /\]\]/,
147
                next: "pop"
148
            }, {
149
                include: "$self"
150
            }, {
151
                defaultToken: "meta.tag.link.internal"
152
            }]
153
        }, {
154
            token: [
155
                "punctuation.definition.tag.begin",
156
                "meta.tag.link.external",
157
                "meta.tag.link.external",
158
                "string.unquoted",
159
                "punctuation.definition.tag.end"
160
            ],
161
            regex: /(\[)(.*?)([\s]+)(.*?)(\])/
162
        }],
163
        "#comment": [{
164
            token: "punctuation.definition.comment.html",
165
            regex: /<!--/,
166
            push: [{
167
                token: "punctuation.definition.comment.html",
168
                regex: /-->/,
169
                next: "pop"
170
            }, {
171
                defaultToken: "comment.block.html"
172
            }]
173
        }],
174
        "#emphasis": [{
175
            token: [
176
                "punctuation.definition.tag.begin",
177
                "markup.italic.bold",
178
                "punctuation.definition.tag.end"
179
            ],
180
            regex: /(''''')(?!')(.*?)('''''|$)/
181
        }, {
182
            token: [
183
                "punctuation.definition.tag.begin",
184
                "markup.bold",
185
                "punctuation.definition.tag.end"
186
            ],
187
            regex: /(''')(?!')(.*?)('''|$)/
188
        }, {
189
            token: [
190
                "punctuation.definition.tag.begin",
191
                "markup.italic",
192
                "punctuation.definition.tag.end"
193
            ],
194
            regex: /('')(?!')(.*?)(''|$)/
195
        }],
196
        "#heading": [{
197
            token: [
198
                "punctuation.definition.heading",
199
                "entity.name.section",
200
                "punctuation.definition.heading"
201
            ],
202
            regex: /(={1,6})(.+?)(\1)(?!=)/
203
        }],
204
        "#tag": [{
205
            token: [
206
                "punctuation.definition.tag.begin",
207
                "entity.name.tag",
208
                "meta.tag.block.ref",
209
                "punctuation.definition.tag.end"
210
            ],
211
            regex: /(<)(ref)((?:\s+.*?)?)(>)/,
212
            caseInsensitive: true,
213
            push: [{
214
                token: [
215
                    "punctuation.definition.tag.begin",
216
                    "entity.name.tag",
217
                    "meta.tag.block.ref",
218
                    "punctuation.definition.tag.end"
219
                ],
220
                regex: /(<\/)(ref)(\s*)(>)/,
221
                caseInsensitive: true,
222
                next: "pop"
223
            }, {
224
                include: "$self"
225
            }, {
226
                defaultToken: "meta.tag.block.ref"
227
            }]
228
        },
229
        {
230
            token: [
231
                "punctuation.definition.tag.begin",
232
                "entity.name.tag",
233
                "meta.tag.block.nowiki",
234
                "punctuation.definition.tag.end"
235
            ],
236
            regex: /(<)(nowiki)((?:\s+.*?)?)(>)/,
237
            caseInsensitive: true,
238
            push: [{
239
                token: [
240
                    "punctuation.definition.tag.begin",
241
                    "entity.name.tag",
242
                    "meta.tag.block.nowiki",
243
                    "punctuation.definition.tag.end"
244
                ],
245
                regex: /(<\/)(nowiki)(\s*)(>)/,
246
                caseInsensitive: true,
247
                next: "pop"
248
            }, {
249
                defaultToken: "meta.tag.block.nowiki"
250
            }]
251
        }, {
252
            token: [
253
                "punctuation.definition.tag.begin",
254
                "entity.name.tag"
255
            ],
256
            regex: /(<\/?)(noinclude|includeonly|onlyinclude)(?=\W)/,
257
            caseInsensitive: true,
258
            push: [{
259
                token: [
260
                    "invalid.illegal",
261
                    "punctuation.definition.tag.end"
262
                ],
263
                regex: /((?:\/)?)(>)/,
264
                next: "pop"
265
            }, {
266
                include: "#attribute"
267
            }, {
268
                defaultToken: "meta.tag.block.any"
269
            }]
270
        }, {
271
            token: [
272
                "punctuation.definition.tag.begin",
273
                "entity.name.tag"
274
            ],
275
            regex: /(<)(br|wbr|hr|meta|link)(?=\W)/,
276
            caseInsensitive: true,
277
            push: [{
278
                token: "punctuation.definition.tag.end",
279
                regex: /\/?>/,
280
                next: "pop"
281
            }, {
282
                include: "#attribute"
283
            }, {
284
                defaultToken: "meta.tag.other"
285
            }]
286
        }, {
287
            token: [
288
                "punctuation.definition.tag.begin",
289
                "entity.name.tag"
290
            ],
291
            regex: /(<\/?)(div|center|span|h1|h2|h3|h4|h5|h6|bdo|em|strong|cite|dfn|code|samp|kbd|var|abbr|blockquote|q|sub|sup|p|pre|ins|del|ul|ol|li|dl|dd|dt|table|caption|thead|tfoot|tbody|colgroup|col|tr|td|th|a|img|video|source|track|tt|b|i|big|small|strike|s|u|font|ruby|rb|rp|rt|rtc|math|figure|figcaption|bdi|data|time|mark|html)(?=\W)/,
292
            caseInsensitive: true,
293
            push: [{
294
                token: [
295
                    "invalid.illegal",
296
                    "punctuation.definition.tag.end"
297
                ],
298
                regex: /((?:\/)?)(>)/,
299
                next: "pop"
300
            }, {
301
                include: "#attribute"
302
            }, {
303
                defaultToken: "meta.tag.block"
304
            }]
305
        }, {
306
            token: [
307
                "punctuation.definition.tag.begin",
308
                "invalid.illegal"
309
            ],
310
            regex: /(<\/)(br|wbr|hr|meta|link)(?=\W)/,
311
            caseInsensitive: true,
312
            push: [{
313
                token: "punctuation.definition.tag.end",
314
                regex: /\/?>/,
315
                next: "pop"
316
            }, {
317
                include: "#attribute"
318
            }, {
319
                defaultToken: "meta.tag.other"
320
            }]
321
        }],
322
        "#caption": [{
323
            token: [
324
                "meta.tag.block.table-caption",
325
                "punctuation.definition.tag.begin"
326
            ],
327
            regex: /^(\s*)(\|\+)/,
328
            push: [{
329
                token: "meta.tag.block.table-caption",
330
                regex: /$/,
331
                next: "pop"
332
            }, {
333
                defaultToken: "meta.tag.block.table-caption"
334
            }]
335
        }],
336
        "#tr": [{
337
            token: [
338
                "meta.tag.block.tr",
339
                "punctuation.definition.tag.begin",
340
                "meta.tag.block.tr",
341
                "invalid.illegal"
342
            ],
343
            regex: /^(\s*)(\|\-)([\s]*)(.*)/
344
        }],
345
        "#th": [{
346
            token: [
347
                "meta.tag.block.th.heading",
348
                "punctuation.definition.tag.begin",
349
                "meta.tag.block.th.heading",
350
                "punctuation.definition.tag",
351
                "markup.bold"
352
            ],
353
            regex: /^(\s*)(!)(?:(.*?)(\|))?(.*?)(?=!!|$)/,
354
            push: [{
355
                token: "meta.tag.block.th.heading",
356
                regex: /$/,
357
                next: "pop"
358
            }, {
359
                token: [
360
                    "punctuation.definition.tag.begin",
361
                    "meta.tag.block.th.inline",
362
                    "punctuation.definition.tag",
363
                    "markup.bold"
364
                ],
365
                regex: /(!!)(?:(.*?)(\|))?(.*?)(?=!!|$)/
366
            }, {
367
                include: "$self"
368
            }, {
369
                defaultToken: "meta.tag.block.th.heading"
370
            }]
371
        }],
372
        "#td": [{
373
            token: [
374
                "meta.tag.block.td",
375
                "punctuation.definition.tag.begin"
376
            ],
377
            regex: /^(\s*)(\|)/,
378
            push: [{
379
                token: "meta.tag.block.td",
380
                regex: /$/,
381
                next: "pop"
382
            }, {
383
                include: "$self"
384
            }, {
385
                defaultToken: "meta.tag.block.td"
386
            }]
387
        }],
388
        "#table": [{
389
            patterns: [{
390
                name: "meta.tag.block.table",
391
                begin: "^\\s*({\\|)(.*?)$",
392
                end: "^\\s*\\|}",
393
                beginCaptures: {
394
                    1: {
395
                        name: "punctuation.definition.tag.begin"
396
                    },
397
                    2: {
398
                        patterns: [{
399
                            include: "#attribute"
400
                        }]
401
                    },
402
                    3: {
403
                        name: "invalid.illegal"
404
                    }
405
                },
406
                endCaptures: {
407
                    0: {
408
                        name: "punctuation.definition.tag.end"
409
                    }
410
                },
411
                patterns: [{
412
                    include: "#comment"
413
                }, {
414
                    include: "#template"
415
                }, {
416
                    include: "#caption"
417
                }, {
418
                    include: "#tr"
419
                }, {
420
                    include: "#th"
421
                }, {
422
                    include: "#td"
423
                }]
424
            }],
425
            repository: {
426
                caption: {
427
                    name: "meta.tag.block.table-caption",
428
                    begin: "^\\s*(\\|\\+)",
429
                    end: "$",
430
                    beginCaptures: {
431
                        1: {
432
                            name: "punctuation.definition.tag.begin"
433
                        }
434
                    }
435
                },
436
                tr: {
437
                    name: "meta.tag.block.tr",
438
                    match: "^\\s*(\\|\\-)[\\s]*(.*)",
439
                    captures: {
440
                        1: {
441
                            name: "punctuation.definition.tag.begin"
442
                        },
443
                        2: {
444
                            name: "invalid.illegal"
445
                        }
446
                    }
447
                },
448
                th: {
449
                    name: "meta.tag.block.th.heading",
450
                    begin: "^\\s*(!)((.*?)(\\|))?(.*?)(?=(!!)|$)",
451
                    end: "$",
452
                    beginCaptures: {
453
                        1: {
454
                            name: "punctuation.definition.tag.begin"
455
                        },
456
                        3: {
457
                            patterns: [{
458
                                include: "#attribute"
459
                            }]
460
                        },
461
                        4: {
462
                            name: "punctuation.definition.tag"
463
                        },
464
                        5: {
465
                            name: "markup.bold"
466
                        }
467
                    },
468
                    patterns: [{
469
                        name: "meta.tag.block.th.inline",
470
                        match: "(!!)((.*?)(\\|))?(.*?)(?=(!!)|$)",
471
                        captures: {
472
                            1: {
473
                                name: "punctuation.definition.tag.begin"
474
                            },
475
                            3: {
476
                                patterns: [{
477
                                    include: "#attribute"
478
                                }]
479
                            },
480
                            4: {
481
                                name: "punctuation.definition.tag"
482
                            },
483
                            5: {
484
                                name: "markup.bold"
485
                            }
486
                        }
487
                    }, {
488
                        include: "$self"
489
                    }]
490
                },
491
                td: {
492
                    name: "meta.tag.block.td",
493
                    begin: "^\\s*(\\|)",
494
                    end: "$",
495
                    beginCaptures: {
496
                        1: {
497
                            name: "punctuation.definition.tag.begin"
498
                        },
499
                        2: {
500
                            patterns: [{
501
                                include: "#attribute"
502
                            }]
503
                        },
504
                        3: {
505
                            name: "punctuation.definition.tag"
506
                        }
507
                    },
508
                    patterns: [{
509
                        include: "$self"
510
                    }]
511
                }
512
            }
513
        }],
514
        "#attribute": [{
515
            include: "#string"
516
        }, {
517
            token: "entity.other.attribute-name",
518
            regex: /\w+/
519
        }],
520
        "#string": [{
521
            token: "string.quoted.double",
522
            regex: /\"/,
523
            push: [{
524
                token: "string.quoted.double",
525
                regex: /\"/,
526
                next: "pop"
527
            }, {
528
                defaultToken: "string.quoted.double"
529
            }]
530
        }, {
531
            token: "string.quoted.single",
532
            regex: /\'/,
533
            push: [{
534
                token: "string.quoted.single",
535
                regex: /\'/,
536
                next: "pop"
537
            }, {
538
                defaultToken: "string.quoted.single"
539
            }]
540
        }],
541
        "#url": [{
542
            token: "markup.underline.link",
543
            regex: /(?:http(?:s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:\/?#\[\]@!\$&'\(\)\*\+,;=.]+/
544
        }, {
545
            token: "invalid.illegal",
546
            regex: /.*/
547
        }]
548
    };
549
    
550

    
551
    this.normalizeRules();
552
};
553

    
554
MediaWikiHighlightRules.metaData = {
555
    name: "MediaWiki",
556
    scopeName: "text.html.mediawiki",
557
    fileTypes: ["mediawiki", "wiki"]
558
};
559

    
560

    
561
oop.inherits(MediaWikiHighlightRules, TextHighlightRules);
562

    
563
exports.MediaWikiHighlightRules = MediaWikiHighlightRules;
564
});
565

    
566
ace.define("ace/mode/mediawiki",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/mediawiki_highlight_rules"], function(require, exports, module) {
567
"use strict";
568

    
569
var oop = require("../lib/oop");
570
var TextMode = require("./text").Mode;
571
var MediaWikiHighlightRules = require("./mediawiki_highlight_rules").MediaWikiHighlightRules;
572

    
573
var Mode = function() {
574
    this.HighlightRules = MediaWikiHighlightRules;
575
};
576
oop.inherits(Mode, TextMode);
577

    
578
(function() {
579
    this.type = "text";
580
    this.blockComment = {start: "<!--", end: "-->"};
581
    this.$id = "ace/mode/mediawiki";
582
}).call(Mode.prototype);
583

    
584
exports.Mode = Mode;
585
});                (function() {
586
                    ace.require(["ace/mode/mediawiki"], function(m) {
587
                        if (typeof module == "object" && typeof exports == "object" && module) {
588
                            module.exports = m;
589
                        }
590
                    });
591
                })();
592
            
(121-121/244)