line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
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.14'; |
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
472
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
17
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
18
|
1
|
|
|
1
|
|
5
|
use base('Syntax::Highlight::Engine::Kate::Template'); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1216
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub new { |
21
|
1
|
|
|
1
|
0
|
539
|
my $proto = shift; |
22
|
1
|
|
33
|
|
|
7
|
my $class = ref($proto) || $proto; |
23
|
1
|
|
|
|
|
6
|
my $self = $class->SUPER::new(@_); |
24
|
1
|
|
|
|
|
11
|
$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
|
1
|
|
|
|
|
16
|
$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
|
1
|
|
|
|
|
5
|
$self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); |
86
|
1
|
|
|
|
|
4
|
$self->basecontext('normal'); |
87
|
1
|
|
|
|
|
5
|
$self->keywordscase(0); |
88
|
1
|
|
|
|
|
3
|
$self->initialize; |
89
|
1
|
|
|
|
|
2
|
bless ($self, $class); |
90
|
1
|
|
|
|
|
2
|
return $self; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub language { |
94
|
0
|
|
|
0
|
0
|
|
return 'Wikimedia'; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub parseError { |
98
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
99
|
0
|
|
|
|
|
|
return 0; |
100
|
|
|
|
|
|
|
}; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub parseLink { |
103
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
104
|
|
|
|
|
|
|
# attribute => 'Wiki-Tag' |
105
|
|
|
|
|
|
|
# char => '}' |
106
|
|
|
|
|
|
|
# char1 => '}' |
107
|
|
|
|
|
|
|
# context => '#pop' |
108
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
109
|
0
|
0
|
|
|
|
|
if ($self->testDetect2Chars($text, '}', '}', 0, 0, 0, undef, 0, '#pop', 'Wiki-Tag')) { |
110
|
0
|
|
|
|
|
|
return 1 |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
# String => ''[]' |
113
|
|
|
|
|
|
|
# attribute => 'Error' |
114
|
|
|
|
|
|
|
# context => 'Error' |
115
|
|
|
|
|
|
|
# type => 'AnyChar' |
116
|
0
|
0
|
|
|
|
|
if ($self->testAnyChar($text, '\'[]', 0, 0, undef, 0, 'Error', 'Error')) { |
117
|
0
|
|
|
|
|
|
return 1 |
118
|
|
|
|
|
|
|
} |
119
|
0
|
|
|
|
|
|
return 0; |
120
|
|
|
|
|
|
|
}; |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub parseNoWiki { |
123
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
124
|
|
|
|
|
|
|
# String => '' |
125
|
|
|
|
|
|
|
# attribute => 'NoWiki' |
126
|
|
|
|
|
|
|
# type => 'RegExpr' |
127
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '', 0, 0, 0, undef, 0, '#stay', 'NoWiki')) { |
128
|
0
|
|
|
|
|
|
return 1 |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
# String => '' |
131
|
|
|
|
|
|
|
# attribute => 'Wiki-Tag' |
132
|
|
|
|
|
|
|
# context => '#pop' |
133
|
|
|
|
|
|
|
# type => 'StringDetect' |
134
|
0
|
0
|
|
|
|
|
if ($self->testStringDetect($text, '', 0, 0, 0, undef, 0, '#pop', 'Wiki-Tag')) { |
135
|
0
|
|
|
|
|
|
return 1 |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
# String => '[<][^>]+[>]' |
138
|
|
|
|
|
|
|
# attribute => 'HTML-Tag' |
139
|
|
|
|
|
|
|
# context => '#stay' |
140
|
|
|
|
|
|
|
# type => 'RegExpr' |
141
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '[<][^>]+[>]', 0, 0, 0, undef, 0, '#stay', 'HTML-Tag')) { |
142
|
0
|
|
|
|
|
|
return 1 |
143
|
|
|
|
|
|
|
} |
144
|
|
|
|
|
|
|
# String => '' |
145
|
|
|
|
|
|
|
# attribute => 'HTML-Tag' |
146
|
|
|
|
|
|
|
# context => 'Pre' |
147
|
|
|
|
|
|
|
# type => 'StringDetect' |
148
|
0
|
0
|
|
|
|
|
if ($self->testStringDetect($text, '', 0, 0, 0, undef, 0, 'Pre', 'HTML-Tag')) { |
149
|
0
|
|
|
|
|
|
return 1 |
150
|
|
|
|
|
|
|
} |
151
|
0
|
|
|
|
|
|
return 0; |
152
|
|
|
|
|
|
|
}; |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
sub parsePre { |
155
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
156
|
|
|
|
|
|
|
# String => '' |
157
|
|
|
|
|
|
|
# attribute => 'Wiki-Tag' |
158
|
|
|
|
|
|
|
# context => '#pop' |
159
|
|
|
|
|
|
|
# type => 'StringDetect' |
160
|
0
|
0
|
|
|
|
|
if ($self->testStringDetect($text, '', 0, 0, 0, undef, 0, '#pop', 'Wiki-Tag')) { |
161
|
0
|
|
|
|
|
|
return 1 |
162
|
|
|
|
|
|
|
} |
163
|
0
|
|
|
|
|
|
return 0; |
164
|
|
|
|
|
|
|
}; |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
sub parseTable { |
167
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
168
|
|
|
|
|
|
|
# String => '' |
380
|
|
|
|
|
|
|
# attribute => 'Comment' |
381
|
|
|
|
|
|
|
# context => '#pop' |
382
|
|
|
|
|
|
|
# endRegion => 'comment' |
383
|
|
|
|
|
|
|
# type => 'StringDetect' |
384
|
0
|
0
|
|
|
|
|
if ($self->testStringDetect($text, '-->', 0, 0, 0, undef, 0, '#pop', 'Comment')) { |
385
|
0
|
|
|
|
|
|
return 1 |
386
|
|
|
|
|
|
|
} |
387
|
0
|
|
|
|
|
|
return 0; |
388
|
|
|
|
|
|
|
}; |
389
|
|
|
|
|
|
|
|
390
|
|
|
|
|
|
|
sub parsenormal { |
391
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
392
|
|
|
|
|
|
|
# String => ' |