Add built local::lib
[catagits/Gitalist.git] / local-lib5 / lib / perl5 / Syntax / Highlight / Engine / Kate / Wikimedia.pm
1 # Copyright (c) 2005 - 2006 Hans Jeuken. All rights reserved.
2 # This program is free software; you can redistribute it and/or
3 # modify it under the same terms as Perl itself.
4
5 # This file was generated from the 'mediawiki.xml' file of the syntax highlight
6 # engine of the kate text editor (http://www.kate-editor.org
7
8 #kate xml version 1.00
9 #kate version 2.4
10 #generated: Sun Feb  3 22:02:06 2008, localtime
11
12 package Syntax::Highlight::Engine::Kate::Wikimedia;
13
14 our $VERSION = '0.06';
15
16 use strict;
17 use warnings;
18 use base('Syntax::Highlight::Engine::Kate::Template');
19
20 sub new {
21    my $proto = shift;
22    my $class = ref($proto) || $proto;
23    my $self = $class->SUPER::new(@_);
24    $self->attributes({
25       'Comment' => 'Comment',
26       'Error' => 'Error',
27       'HTML-Entity' => 'DecVal',
28       'HTML-Tag' => 'Keyword',
29       'Link' => 'Others',
30       'NoWiki' => 'Normal',
31       'Normal' => 'Normal',
32       'Section' => 'Keyword',
33       'URL' => 'Others',
34       'Unformatted' => 'Normal',
35       'Wiki-Tag' => 'DecVal',
36    });
37    $self->contextdata({
38       'Error' => {
39          callback => \&parseError,
40          attribute => 'Error',
41          lineending => '#pop',
42       },
43       'Link' => {
44          callback => \&parseLink,
45          attribute => 'Template',
46       },
47       'NoWiki' => {
48          callback => \&parseNoWiki,
49          attribute => 'NoWiki',
50       },
51       'Pre' => {
52          callback => \&parsePre,
53          attribute => 'NoWiki',
54       },
55       'Table' => {
56          callback => \&parseTable,
57          attribute => 'Normal',
58       },
59       'Template' => {
60          callback => \&parseTemplate,
61          attribute => 'Link',
62       },
63       'URL' => {
64          callback => \&parseURL,
65          attribute => 'Link',
66       },
67       'Unformatted' => {
68          callback => \&parseUnformatted,
69          attribute => 'Unformatted',
70          lineending => '#pop',
71       },
72       'WikiLink' => {
73          callback => \&parseWikiLink,
74          attribute => 'Link',
75       },
76       'comment' => {
77          callback => \&parsecomment,
78          attribute => 'Comment',
79       },
80       'normal' => {
81          callback => \&parsenormal,
82          attribute => 'Normal',
83       },
84    });
85    $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
86    $self->basecontext('normal');
87    $self->keywordscase(0);
88    $self->initialize;
89    bless ($self, $class);
90    return $self;
91 }
92
93 sub language {
94    return 'Wikimedia';
95 }
96
97 sub parseError {
98    my ($self, $text) = @_;
99    return 0;
100 };
101
102 sub parseLink {
103    my ($self, $text) = @_;
104    # attribute => 'Wiki-Tag'
105    # char => '}'
106    # char1 => '}'
107    # context => '#pop'
108    # type => 'Detect2Chars'
109    if ($self->testDetect2Chars($text, '}', '}', 0, 0, 0, undef, 0, '#pop', 'Wiki-Tag')) {
110       return 1
111    }
112    # String => ''[]'
113    # attribute => 'Error'
114    # context => 'Error'
115    # type => 'AnyChar'
116    if ($self->testAnyChar($text, '\'[]', 0, 0, undef, 0, 'Error', 'Error')) {
117       return 1
118    }
119    return 0;
120 };
121
122 sub parseNoWiki {
123    my ($self, $text) = @_;
124    # String => '<!--[^-]*-->'
125    # attribute => 'NoWiki'
126    # type => 'RegExpr'
127    if ($self->testRegExpr($text, '<!--[^-]*-->', 0, 0, 0, undef, 0, '#stay', 'NoWiki')) {
128       return 1
129    }
130    # String => '</nowiki>'
131    # attribute => 'Wiki-Tag'
132    # context => '#pop'
133    # type => 'StringDetect'
134    if ($self->testStringDetect($text, '</nowiki>', 0, 0, 0, undef, 0, '#pop', 'Wiki-Tag')) {
135       return 1
136    }
137    # String => '[<][^>]+[>]'
138    # attribute => 'HTML-Tag'
139    # context => '#stay'
140    # type => 'RegExpr'
141    if ($self->testRegExpr($text, '[<][^>]+[>]', 0, 0, 0, undef, 0, '#stay', 'HTML-Tag')) {
142       return 1
143    }
144    # String => '<pre>'
145    # attribute => 'HTML-Tag'
146    # context => 'Pre'
147    # type => 'StringDetect'
148    if ($self->testStringDetect($text, '<pre>', 0, 0, 0, undef, 0, 'Pre', 'HTML-Tag')) {
149       return 1
150    }
151    return 0;
152 };
153
154 sub parsePre {
155    my ($self, $text) = @_;
156    # String => '</pre>'
157    # attribute => 'Wiki-Tag'
158    # context => '#pop'
159    # type => 'StringDetect'
160    if ($self->testStringDetect($text, '</pre>', 0, 0, 0, undef, 0, '#pop', 'Wiki-Tag')) {
161       return 1
162    }
163    return 0;
164 };
165
166 sub parseTable {
167    my ($self, $text) = @_;
168    # String => '<!--'
169    # attribute => 'Comment'
170    # context => 'comment'
171    # type => 'StringDetect'
172    if ($self->testStringDetect($text, '<!--', 0, 0, 0, undef, 0, 'comment', 'Comment')) {
173       return 1
174    }
175    # String => '([=]{2,2}[^=]+[=]{2,2}|[=]{3,3}[^=]+[=]{3,3}|[=]{4,4}[^=]+[=]{4,4}|[=]{5,5}[^=]+[=]{5,5})'
176    # attribute => 'Section'
177    # column => '0'
178    # context => '#stay'
179    # type => 'RegExpr'
180    if ($self->testRegExpr($text, '([=]{2,2}[^=]+[=]{2,2}|[=]{3,3}[^=]+[=]{3,3}|[=]{4,4}[^=]+[=]{4,4}|[=]{5,5}[^=]+[=]{5,5})', 0, 0, 0, 0, 0, '#stay', 'Section')) {
181       return 1
182    }
183    # String => '[*#;:\s]*[*#:]+'
184    # attribute => 'Wiki-Tag'
185    # column => '0'
186    # context => '#stay'
187    # type => 'RegExpr'
188    if ($self->testRegExpr($text, '[*#;:\\s]*[*#:]+', 0, 0, 0, 0, 0, '#stay', 'Wiki-Tag')) {
189       return 1
190    }
191    # String => '[[](?![[])'
192    # attribute => 'Wiki-Tag'
193    # context => 'URL'
194    # type => 'RegExpr'
195    if ($self->testRegExpr($text, '[[](?![[])', 0, 0, 0, undef, 0, 'URL', 'Wiki-Tag')) {
196       return 1
197    }
198    # String => '(http:|ftp:|mailto:)[\S]*($|[\s])'
199    # attribute => 'URL'
200    # context => '#stay'
201    # type => 'RegExpr'
202    if ($self->testRegExpr($text, '(http:|ftp:|mailto:)[\\S]*($|[\\s])', 0, 0, 0, undef, 0, '#stay', 'URL')) {
203       return 1
204    }
205    # String => '[']{2,}'
206    # attribute => 'Wiki-Tag'
207    # context => '#stay'
208    # type => 'RegExpr'
209    if ($self->testRegExpr($text, '[\']{2,}', 0, 0, 0, undef, 0, '#stay', 'Wiki-Tag')) {
210       return 1
211    }
212    # attribute => 'Wiki-Tag'
213    # char => '|'
214    # char1 => '}'
215    # column => '0'
216    # context => '#pop'
217    # endRegion => 'table'
218    # type => 'Detect2Chars'
219    if ($self->testDetect2Chars($text, '|', '}', 0, 0, 0, 0, 0, '#pop', 'Wiki-Tag')) {
220       return 1
221    }
222    # attribute => 'Wiki-Tag'
223    # char => '|'
224    # context => '#stay'
225    # type => 'DetectChar'
226    if ($self->testDetectChar($text, '|', 0, 0, 0, undef, 0, '#stay', 'Wiki-Tag')) {
227       return 1
228    }
229    # attribute => 'Wiki-Tag'
230    # char => '{'
231    # char1 => '{'
232    # context => 'Template'
233    # type => 'Detect2Chars'
234    if ($self->testDetect2Chars($text, '{', '{', 0, 0, 0, undef, 0, 'Template', 'Wiki-Tag')) {
235       return 1
236    }
237    # attribute => 'Wiki-Tag'
238    # char => '['
239    # char1 => '['
240    # context => 'WikiLink'
241    # type => 'Detect2Chars'
242    if ($self->testDetect2Chars($text, '[', '[', 0, 0, 0, undef, 0, 'WikiLink', 'Wiki-Tag')) {
243       return 1
244    }
245    # attribute => 'HTML-Entity'
246    # char => '&'
247    # char1 => ';'
248    # context => '#stay'
249    # type => 'RangeDetect'
250    if ($self->testRangeDetect($text, '&', ';', 0, 0, undef, 0, '#stay', 'HTML-Entity')) {
251       return 1
252    }
253    # String => '<nowiki>'
254    # attribute => 'Wiki-Tag'
255    # context => 'NoWiki'
256    # type => 'StringDetect'
257    if ($self->testStringDetect($text, '<nowiki>', 0, 0, 0, undef, 0, 'NoWiki', 'Wiki-Tag')) {
258       return 1
259    }
260    # String => '<pre>'
261    # attribute => 'HTML-Tag'
262    # context => 'Pre'
263    # type => 'StringDetect'
264    if ($self->testStringDetect($text, '<pre>', 0, 0, 0, undef, 0, 'Pre', 'HTML-Tag')) {
265       return 1
266    }
267    # String => '[<][^>]+[>]'
268    # attribute => 'HTML-Tag'
269    # context => '#stay'
270    # type => 'RegExpr'
271    if ($self->testRegExpr($text, '[<][^>]+[>]', 0, 0, 0, undef, 0, '#stay', 'HTML-Tag')) {
272       return 1
273    }
274    # String => '[\s]'
275    # column => '0'
276    # context => 'Unformatted'
277    # type => 'RegExpr'
278    if ($self->testRegExpr($text, '[\\s]', 0, 0, 0, 0, 0, 'Unformatted', undef)) {
279       return 1
280    }
281    # String => '[~]{3,4}'
282    # attribute => 'Wiki-Tag'
283    # context => '#stay'
284    # type => 'RegExpr'
285    if ($self->testRegExpr($text, '[~]{3,4}', 0, 0, 0, undef, 0, '#stay', 'Wiki-Tag')) {
286       return 1
287    }
288    # String => '[-]{4,}'
289    # attribute => 'Wiki-Tag'
290    # context => '#stay'
291    # type => 'RegExpr'
292    if ($self->testRegExpr($text, '[-]{4,}', 0, 0, 0, undef, 0, '#stay', 'Wiki-Tag')) {
293       return 1
294    }
295    # attribute => 'Wiki-Tag'
296    # char => '!'
297    # column => '0'
298    # context => '#stay'
299    # type => 'DetectChar'
300    if ($self->testDetectChar($text, '!', 0, 0, 0, 0, 0, '#stay', 'Wiki-Tag')) {
301       return 1
302    }
303    return 0;
304 };
305
306 sub parseTemplate {
307    my ($self, $text) = @_;
308    # attribute => 'Wiki-Tag'
309    # char => '}'
310    # char1 => '}'
311    # context => '#pop'
312    # type => 'Detect2Chars'
313    if ($self->testDetect2Chars($text, '}', '}', 0, 0, 0, undef, 0, '#pop', 'Wiki-Tag')) {
314       return 1
315    }
316    # attribute => 'Error'
317    # char => '''
318    # context => 'Error'
319    # type => 'DetectChar'
320    if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'Error', 'Error')) {
321       return 1
322    }
323    return 0;
324 };
325
326 sub parseURL {
327    my ($self, $text) = @_;
328    # attribute => 'Wiki-Tag'
329    # char => ']'
330    # context => '#pop'
331    # type => 'DetectChar'
332    if ($self->testDetectChar($text, ']', 0, 0, 0, undef, 0, '#pop', 'Wiki-Tag')) {
333       return 1
334    }
335    # attribute => 'Error'
336    # char => '''
337    # context => 'Error'
338    # type => 'DetectChar'
339    if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'Error', 'Error')) {
340       return 1
341    }
342    return 0;
343 };
344
345 sub parseUnformatted {
346    my ($self, $text) = @_;
347    return 0;
348 };
349
350 sub parseWikiLink {
351    my ($self, $text) = @_;
352    # attribute => 'Wiki-Tag'
353    # char => '|'
354    # context => '#stay'
355    # type => 'DetectChar'
356    if ($self->testDetectChar($text, '|', 0, 0, 0, undef, 0, '#stay', 'Wiki-Tag')) {
357       return 1
358    }
359    # attribute => 'Wiki-Tag'
360    # char => ']'
361    # char1 => ']'
362    # context => '#pop'
363    # type => 'Detect2Chars'
364    if ($self->testDetect2Chars($text, ']', ']', 0, 0, 0, undef, 0, '#pop', 'Wiki-Tag')) {
365       return 1
366    }
367    # attribute => 'Error'
368    # char => '''
369    # context => 'Error'
370    # type => 'DetectChar'
371    if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'Error', 'Error')) {
372       return 1
373    }
374    return 0;
375 };
376
377 sub parsecomment {
378    my ($self, $text) = @_;
379    # String => '-->'
380    # attribute => 'Comment'
381    # context => '#pop'
382    # endRegion => 'comment'
383    # type => 'StringDetect'
384    if ($self->testStringDetect($text, '-->', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
385       return 1
386    }
387    return 0;
388 };
389
390 sub parsenormal {
391    my ($self, $text) = @_;
392    # String => '<!--'
393    # attribute => 'Comment'
394    # beginRegion => 'comment'
395    # context => 'comment'
396    # type => 'StringDetect'
397    if ($self->testStringDetect($text, '<!--', 0, 0, 0, undef, 0, 'comment', 'Comment')) {
398       return 1
399    }
400    # String => '([=]{2,2}[^=]+[=]{2,2}|[=]{3,3}[^=]+[=]{3,3}|[=]{4,4}[^=]+[=]{4,4}|[=]{5,5}[^=]+[=]{5,5})'
401    # attribute => 'Section'
402    # column => '0'
403    # type => 'RegExpr'
404    if ($self->testRegExpr($text, '([=]{2,2}[^=]+[=]{2,2}|[=]{3,3}[^=]+[=]{3,3}|[=]{4,4}[^=]+[=]{4,4}|[=]{5,5}[^=]+[=]{5,5})', 0, 0, 0, 0, 0, '#stay', 'Section')) {
405       return 1
406    }
407    # String => '[~]{3,4}'
408    # attribute => 'Wiki-Tag'
409    # context => '#stay'
410    # type => 'RegExpr'
411    if ($self->testRegExpr($text, '[~]{3,4}', 0, 0, 0, undef, 0, '#stay', 'Wiki-Tag')) {
412       return 1
413    }
414    # String => '[*#;:\s]*[*#:]+'
415    # attribute => 'Wiki-Tag'
416    # column => '0'
417    # context => '#stay'
418    # type => 'RegExpr'
419    if ($self->testRegExpr($text, '[*#;:\\s]*[*#:]+', 0, 0, 0, 0, 0, '#stay', 'Wiki-Tag')) {
420       return 1
421    }
422    # String => '[[](?![[])'
423    # attribute => 'Wiki-Tag'
424    # context => 'URL'
425    # type => 'RegExpr'
426    if ($self->testRegExpr($text, '[[](?![[])', 0, 0, 0, undef, 0, 'URL', 'Wiki-Tag')) {
427       return 1
428    }
429    # String => '(http:|ftp:|mailto:)[\S]*($|[\s])'
430    # attribute => 'URL'
431    # context => '#stay'
432    # type => 'RegExpr'
433    if ($self->testRegExpr($text, '(http:|ftp:|mailto:)[\\S]*($|[\\s])', 0, 0, 0, undef, 0, '#stay', 'URL')) {
434       return 1
435    }
436    # String => '[']{2,}'
437    # attribute => 'Wiki-Tag'
438    # context => '#stay'
439    # type => 'RegExpr'
440    if ($self->testRegExpr($text, '[\']{2,}', 0, 0, 0, undef, 0, '#stay', 'Wiki-Tag')) {
441       return 1
442    }
443    # attribute => 'Wiki-Tag'
444    # beginRegion => 'table'
445    # char => '{'
446    # char1 => '|'
447    # column => '0'
448    # context => 'Table'
449    # type => 'Detect2Chars'
450    if ($self->testDetect2Chars($text, '{', '|', 0, 0, 0, 0, 0, 'Table', 'Wiki-Tag')) {
451       return 1
452    }
453    # attribute => 'Wiki-Tag'
454    # char => '{'
455    # char1 => '{'
456    # context => 'Template'
457    # type => 'Detect2Chars'
458    if ($self->testDetect2Chars($text, '{', '{', 0, 0, 0, undef, 0, 'Template', 'Wiki-Tag')) {
459       return 1
460    }
461    # attribute => 'Wiki-Tag'
462    # char => '['
463    # char1 => '['
464    # context => 'WikiLink'
465    # type => 'Detect2Chars'
466    if ($self->testDetect2Chars($text, '[', '[', 0, 0, 0, undef, 0, 'WikiLink', 'Wiki-Tag')) {
467       return 1
468    }
469    # attribute => 'HTML-Entity'
470    # char => '&'
471    # char1 => ';'
472    # context => '#stay'
473    # type => 'RangeDetect'
474    if ($self->testRangeDetect($text, '&', ';', 0, 0, undef, 0, '#stay', 'HTML-Entity')) {
475       return 1
476    }
477    # String => '<nowiki>'
478    # attribute => 'Wiki-Tag'
479    # context => 'NoWiki'
480    # type => 'StringDetect'
481    if ($self->testStringDetect($text, '<nowiki>', 0, 0, 0, undef, 0, 'NoWiki', 'Wiki-Tag')) {
482       return 1
483    }
484    # String => '<pre>'
485    # attribute => 'HTML-Tag'
486    # context => 'Pre'
487    # type => 'StringDetect'
488    if ($self->testStringDetect($text, '<pre>', 0, 0, 0, undef, 0, 'Pre', 'HTML-Tag')) {
489       return 1
490    }
491    # String => '[<][^>]+[>]'
492    # attribute => 'HTML-Tag'
493    # context => '#stay'
494    # type => 'RegExpr'
495    if ($self->testRegExpr($text, '[<][^>]+[>]', 0, 0, 0, undef, 0, '#stay', 'HTML-Tag')) {
496       return 1
497    }
498    # String => '[\s]'
499    # column => '0'
500    # context => 'Unformatted'
501    # type => 'RegExpr'
502    if ($self->testRegExpr($text, '[\\s]', 0, 0, 0, 0, 0, 'Unformatted', undef)) {
503       return 1
504    }
505    return 0;
506 };
507
508
509 1;
510
511 __END__
512
513 =head1 NAME
514
515 Syntax::Highlight::Engine::Kate::Wikimedia - a Plugin for Wikimedia syntax highlighting
516
517 =head1 SYNOPSIS
518
519  require Syntax::Highlight::Engine::Kate::Wikimedia;
520  my $sh = new Syntax::Highlight::Engine::Kate::Wikimedia([
521  ]);
522
523 =head1 DESCRIPTION
524
525 Syntax::Highlight::Engine::Kate::Wikimedia is a  plugin module that provides syntax highlighting
526 for Wikimedia to the Syntax::Haghlight::Engine::Kate highlighting engine.
527
528 This code is generated from the syntax definition files used
529 by the Kate project.
530 It works quite fine, but can use refinement and optimization.
531
532 It inherits Syntax::Higlight::Engine::Kate::Template. See also there.
533
534 =cut
535
536 =head1 AUTHOR
537
538 Hans Jeuken (haje <at> toneel <dot> demon <dot> nl)
539
540 =cut
541
542 =head1 BUGS
543
544 Unknown. If you find any, please contact the author
545
546 =cut
547