sunflower 0.3 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -1
- data/lib/sunflower/commontasks.rb +265 -250
- data/lib/sunflower/core.rb +288 -287
- data/lib/sunflower/listmaker.rb +160 -152
- data/scripts/ZDBOT.rb +61 -61
- data/scripts/aktualizacjapilkarzy.rb +339 -339
- data/scripts/changeimage.rb +41 -41
- data/scripts/fix-bold-in-headers.rb +41 -53
- data/scripts/fix-double-pipes.rb +30 -49
- data/scripts/fix-langs.rb +42 -42
- data/scripts/fix-multiple-same-refs.rb +101 -101
- data/scripts/fix-some-entities.rb +36 -43
- data/scripts/fix-unicode-control-chars.rb +30 -51
- data/scripts/insight.rb +132 -132
- data/scripts/lekkoatl-portal.rb +50 -50
- data/scripts/make-id2team-list.rb +31 -31
- data/scripts/recat.rb +27 -32
- data/scripts/wanted.rb +72 -72
- metadata +40 -62
data/README
CHANGED
@@ -1,251 +1,266 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
# extends Page with some methods letting easily perform common tasks
|
3
|
-
|
4
|
-
class Page
|
5
|
-
def execute commands
|
6
|
-
# executes methods on self
|
7
|
-
# "commands" is array of arrays
|
8
|
-
# page.execute([
|
9
|
-
# [:replace, 'something', 'whatever'],
|
10
|
-
# [:append, 'some things']
|
11
|
-
# ])
|
12
|
-
# equals to
|
13
|
-
# page.replace('something', 'whatever')
|
14
|
-
# page.append('some things')
|
15
|
-
|
16
|
-
# allowed modifiers:
|
17
|
-
# r, required
|
18
|
-
# oi:module, only-if:module
|
19
|
-
# !oi:module, only-if-not:module
|
20
|
-
# s:append to summary, summary:append to summary
|
21
|
-
originalText = self.text.dup
|
22
|
-
|
23
|
-
commands.each do |cmd|
|
24
|
-
f=cmd.shift
|
25
|
-
if f.class==Array
|
26
|
-
methodName=f.shift
|
27
|
-
modifiers=f.map{|i|
|
28
|
-
i+=':' if !i.include? ':'
|
29
|
-
i=i.split(':',-1)
|
30
|
-
i[0]=i[0].downcase.gsub(/[^a-z!]/,'')
|
31
|
-
|
32
|
-
i[0]='r' if i[0]=='required'
|
33
|
-
i[0]='oi' if i[0]=='onlyif'
|
34
|
-
i[0]='!oi' if i[0]=='onlyifnot'
|
35
|
-
i[0]='s' if i[0]=='summary'
|
36
|
-
|
37
|
-
type=i.shift
|
38
|
-
i=i.join(':')
|
39
|
-
|
40
|
-
[type,i]
|
41
|
-
}
|
42
|
-
modifiers=Hash[*(modifiers.flatten)]
|
43
|
-
else
|
44
|
-
methodName=f
|
45
|
-
modifiers={}
|
46
|
-
end
|
47
|
-
|
48
|
-
if modifiers['oi']
|
49
|
-
if !@modulesExecd.index(modifiers['oi'].strip)
|
50
|
-
next #skip this command
|
51
|
-
end
|
52
|
-
end
|
53
|
-
if modifiers['!oi']
|
54
|
-
if @modulesExecd.index(modifiers['oi'].strip)
|
55
|
-
next #skip this command
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
oldText=self.text
|
60
|
-
self.method(methodName).call(*cmd)
|
61
|
-
newText=self.text
|
62
|
-
|
63
|
-
@modulesExecd<<methodName if oldText!=newText
|
64
|
-
|
65
|
-
if modifiers['s'] && oldText!=newText
|
66
|
-
@summaryAppend<<modifiers['s'].strip
|
67
|
-
end
|
68
|
-
|
69
|
-
if modifiers['r'] && oldText==newText
|
70
|
-
self.text = originalText
|
71
|
-
break #reset text and stop executing commands
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
def replace from, to, once=false
|
79
|
-
# replaces "from" with "to" in page text
|
80
|
-
# "from" may be regex
|
81
|
-
self.text = self.text.send( (once ? 'sub' : 'gsub'), from, to )
|
82
|
-
end
|
83
|
-
def gsub from, to
|
84
|
-
self.replace from, to
|
85
|
-
end
|
86
|
-
def sub from, to
|
87
|
-
self.replace from, to, true
|
88
|
-
end
|
89
|
-
|
90
|
-
def append txt, newlines=2
|
91
|
-
# appends newlines and text
|
92
|
-
# by default - 2 newlines
|
93
|
-
self.text = self.text.rstrip + ("\n"*newlines) + txt
|
94
|
-
end
|
95
|
-
|
96
|
-
def prepend txt, newlines=2
|
97
|
-
# prepends text and newlines
|
98
|
-
# by default - 2 newlines
|
99
|
-
self.text = txt + ("\n"*newlines) + self.text.lstrip
|
100
|
-
end
|
101
|
-
|
102
|
-
def code_cleanup
|
103
|
-
# simple, safe code cleanup
|
104
|
-
# use Sunflower.always_do_code_cleanup=true to do it automatically just before saving page
|
105
|
-
# based on Nux's cleaner: http://pl.wikipedia.org/wiki/Wikipedysta:Nux/wp_sk.js
|
106
|
-
str=self.text.gsub(/\r\n/,"\n")
|
107
|
-
|
108
|
-
str.gsub!(/\{\{\s*([^|{}]+ |uni|)stub2?(\|[^{}]+)?\}\}/i){
|
109
|
-
if $1=='sekcja '
|
110
|
-
'{{sekcja stub}}'
|
111
|
-
else
|
112
|
-
'{{stub}}'
|
113
|
-
end
|
114
|
-
}
|
115
|
-
str.gsub!(/\{\{\{(?:poprzednik|następca|pop|nast|lata|info|lang)\|(.+?)\}\}\}/i,'\1')
|
116
|
-
str.gsub!(/(={1,5})\s*Przypisy\s*\1\s*<references\s?\/>/){
|
117
|
-
if $1=='=' || $1=='=='
|
118
|
-
'{{Przypisy}}'
|
119
|
-
else
|
120
|
-
'{{Przypisy|stopień= '+$1+'}}'
|
121
|
-
end
|
122
|
-
}
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
str.gsub!(
|
141
|
-
|
142
|
-
|
143
|
-
str.gsub!(
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
str.gsub!(
|
149
|
-
str.gsub!(
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
str.gsub!(
|
155
|
-
str.gsub!(
|
156
|
-
|
157
|
-
|
158
|
-
str.gsub!(
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
str.gsub!(
|
164
|
-
str.gsub!(
|
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
|
-
str
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
1
|
+
# coding: utf-8
|
2
|
+
# extends Page with some methods letting easily perform common tasks
|
3
|
+
|
4
|
+
class Page
|
5
|
+
def execute commands
|
6
|
+
# executes methods on self
|
7
|
+
# "commands" is array of arrays
|
8
|
+
# page.execute([
|
9
|
+
# [:replace, 'something', 'whatever'],
|
10
|
+
# [:append, 'some things']
|
11
|
+
# ])
|
12
|
+
# equals to
|
13
|
+
# page.replace('something', 'whatever')
|
14
|
+
# page.append('some things')
|
15
|
+
|
16
|
+
# allowed modifiers:
|
17
|
+
# r, required
|
18
|
+
# oi:module, only-if:module
|
19
|
+
# !oi:module, only-if-not:module
|
20
|
+
# s:append to summary, summary:append to summary
|
21
|
+
originalText = self.text.dup
|
22
|
+
|
23
|
+
commands.each do |cmd|
|
24
|
+
f=cmd.shift
|
25
|
+
if f.class==Array
|
26
|
+
methodName=f.shift
|
27
|
+
modifiers=f.map{|i|
|
28
|
+
i+=':' if !i.include? ':'
|
29
|
+
i=i.split(':',-1)
|
30
|
+
i[0]=i[0].downcase.gsub(/[^a-z!]/,'')
|
31
|
+
|
32
|
+
i[0]='r' if i[0]=='required'
|
33
|
+
i[0]='oi' if i[0]=='onlyif'
|
34
|
+
i[0]='!oi' if i[0]=='onlyifnot'
|
35
|
+
i[0]='s' if i[0]=='summary'
|
36
|
+
|
37
|
+
type=i.shift
|
38
|
+
i=i.join(':')
|
39
|
+
|
40
|
+
[type,i]
|
41
|
+
}
|
42
|
+
modifiers=Hash[*(modifiers.flatten)]
|
43
|
+
else
|
44
|
+
methodName=f
|
45
|
+
modifiers={}
|
46
|
+
end
|
47
|
+
|
48
|
+
if modifiers['oi']
|
49
|
+
if !@modulesExecd.index(modifiers['oi'].strip)
|
50
|
+
next #skip this command
|
51
|
+
end
|
52
|
+
end
|
53
|
+
if modifiers['!oi']
|
54
|
+
if @modulesExecd.index(modifiers['oi'].strip)
|
55
|
+
next #skip this command
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
oldText=self.text
|
60
|
+
self.method(methodName).call(*cmd)
|
61
|
+
newText=self.text
|
62
|
+
|
63
|
+
@modulesExecd<<methodName if oldText!=newText
|
64
|
+
|
65
|
+
if modifiers['s'] && oldText!=newText
|
66
|
+
@summaryAppend<<modifiers['s'].strip
|
67
|
+
end
|
68
|
+
|
69
|
+
if modifiers['r'] && oldText==newText
|
70
|
+
self.text = originalText
|
71
|
+
break #reset text and stop executing commands
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
def replace from, to, once=false
|
79
|
+
# replaces "from" with "to" in page text
|
80
|
+
# "from" may be regex
|
81
|
+
self.text = self.text.send( (once ? 'sub' : 'gsub'), from, to )
|
82
|
+
end
|
83
|
+
def gsub from, to
|
84
|
+
self.replace from, to
|
85
|
+
end
|
86
|
+
def sub from, to
|
87
|
+
self.replace from, to, true
|
88
|
+
end
|
89
|
+
|
90
|
+
def append txt, newlines=2
|
91
|
+
# appends newlines and text
|
92
|
+
# by default - 2 newlines
|
93
|
+
self.text = self.text.rstrip + ("\n"*newlines) + txt
|
94
|
+
end
|
95
|
+
|
96
|
+
def prepend txt, newlines=2
|
97
|
+
# prepends text and newlines
|
98
|
+
# by default - 2 newlines
|
99
|
+
self.text = txt + ("\n"*newlines) + self.text.lstrip
|
100
|
+
end
|
101
|
+
|
102
|
+
def code_cleanup
|
103
|
+
# simple, safe code cleanup
|
104
|
+
# use Sunflower.always_do_code_cleanup=true to do it automatically just before saving page
|
105
|
+
# based on Nux's cleaner: http://pl.wikipedia.org/wiki/Wikipedysta:Nux/wp_sk.js
|
106
|
+
str=self.text.gsub(/\r\n/,"\n")
|
107
|
+
|
108
|
+
str.gsub!(/\{\{\s*([^|{}]+ |uni|)stub2?(\|[^{}]+)?\}\}/i){
|
109
|
+
if $1=='sekcja '
|
110
|
+
'{{sekcja stub}}'
|
111
|
+
else
|
112
|
+
'{{stub}}'
|
113
|
+
end
|
114
|
+
}
|
115
|
+
str.gsub!(/\{\{\{(?:poprzednik|następca|pop|nast|lata|info|lang)\|(.+?)\}\}\}/i,'\1')
|
116
|
+
str.gsub!(/(={1,5})\s*Przypisy\s*\1\s*<references\s?\/>/i){
|
117
|
+
if $1=='=' || $1=='=='
|
118
|
+
'{{Przypisy}}'
|
119
|
+
else
|
120
|
+
'{{Przypisy|stopień= '+$1+'}}'
|
121
|
+
end
|
122
|
+
}
|
123
|
+
|
124
|
+
str.gsub!(/\[\[([^\|#\]]*)([^\|\]]*)(\||\]\])/){
|
125
|
+
name, anchor, _end = $1, $2, $3
|
126
|
+
|
127
|
+
begin
|
128
|
+
name=CGI.unescape(name)
|
129
|
+
anchor=CGI.unescape((anchor||'').gsub(/\.([0-9A-F]{2})/,'%\1'))
|
130
|
+
a='[['+name+anchor+(_end||'')
|
131
|
+
a=a.gsub '_', ' '
|
132
|
+
rescue
|
133
|
+
a=('[['+name+(anchor||'')+(_end||'')).gsub '_', ' '
|
134
|
+
end
|
135
|
+
|
136
|
+
a
|
137
|
+
}
|
138
|
+
|
139
|
+
# sklejanie skrótów linkowych
|
140
|
+
str.gsub!(/m\.? ?\[\[n\.? ?p\.? ?m\.?\]\]/, 'm [[n.p.m.]]');
|
141
|
+
|
142
|
+
# korekty dat - niepotrzebny przecinek
|
143
|
+
str.gsub!(/(\[\[[0-9]+ (stycznia|lutego|marca|kwietnia|maja|czerwca|lipca|sierpnia|września|października|listopada|grudnia)\]\]), (\[\[[0-9]{4}\]\])/i, '\1 \3');
|
144
|
+
|
145
|
+
# linkowanie do wieków
|
146
|
+
str.gsub!(/\[\[([XVI]{1,5}) [wW]\.?\]\]/, '[[\1 wiek|\1 w.]]');
|
147
|
+
str.gsub!(/\[\[([XVI]{1,5}) [wW]\.?\|/, '[[\1 wiek|');
|
148
|
+
str.gsub!(/\[\[(III|II|IV|VIII|VII|VI|IX|XIII|XII|XI|XIV|XV|XVIII|XVII|XVI|XIX|XXI|XX)\]\]/, '[[\1 wiek|\1]]');
|
149
|
+
str.gsub!(/\[\[(III|II|IV|VIII|VII|VI|IX|XIII|XII|XI|XIV|XV|XVIII|XVII|XVI|XIX|XXI|XX)\|/, '[[\1 wiek|');
|
150
|
+
|
151
|
+
# rozwijanie typowych linków
|
152
|
+
str.gsub!(/\[\[ang\.\]\]/, '[[język angielski|ang.]]');
|
153
|
+
str.gsub!(/\[\[cz\.\]\]/, '[[język czeski|cz.]]');
|
154
|
+
str.gsub!(/\[\[fr\.\]\]/, '[[język francuski|fr.]]');
|
155
|
+
str.gsub!(/\[\[łac\.\]\]/, '[[łacina|łac.]]');
|
156
|
+
str.gsub!(/\[\[niem\.\]\]/, '[[język niemiecki|niem.]]');
|
157
|
+
str.gsub!(/\[\[pol\.\]\]/, '[[język polski|pol.]]');
|
158
|
+
str.gsub!(/\[\[pl\.\]\]/, '[[język polski|pol.]]');
|
159
|
+
str.gsub!(/\[\[ros\.\]\]/, '[[język rosyjski|ros.]]');
|
160
|
+
str.gsub!(/\[\[(((G|g)iga|(M|m)ega|(K|k)ilo)herc|[GMk]Hz)\|/, '[[herc|');
|
161
|
+
|
162
|
+
# unifikacja nagłówkowa
|
163
|
+
str.gsub!(/[ \n\t]*\n'''? *(Zobacz|Patrz) (też|także):* *'''?[ \n\t]*/i, "\n\n== Zobacz też ==\n");
|
164
|
+
str.gsub!(/[ \n\t]*\n(=+) *(Zobacz|Patrz) (też|także):* *=+[ \n\t]*/i, "\n\n\\1 Zobacz też \\1\n");
|
165
|
+
str.gsub!(/[ \n\t]*\n'''? *((Zewnętrzn[ey] )?(Linki?|Łącza|Stron[ay]|Zobacz w (internecie|sieci))( zewn[eę]trzn[aey])?):* *'''?[ \n\t]*/i, "\n\n== Linki zewnętrzne ==\n");
|
166
|
+
str.gsub!(/[ \n\t]*\n(=+) *((Zewnętrzn[ey] )?(Linki?|Łącza|Stron[ay]|Zobacz w (internecie|sieci))( zewn[eę]trzn[aey])?):* *=+[ \n\t]*/i, "\n\n\\1 Linki zewnętrzne \\1\n");
|
167
|
+
|
168
|
+
# nagłówki
|
169
|
+
str.gsub!(/(^|\n)(=+) *([^=\n]*[^ :=\n])[ :]*=/, '\1\2 \3 ='); # =a= > = a =, =a:= > = a =
|
170
|
+
str.gsub!(/(^|\n)(=+[^=\n]+=+)[\n]{2,}/, "\\1\\2\n"); # jeden \n
|
171
|
+
|
172
|
+
# listy ze spacjami
|
173
|
+
str.gsub!(/(\n[#*:;]+)([^ \t\n#*:;{])/, '\1 \2');
|
174
|
+
|
175
|
+
# poprawa nazw przestrzeni i drobne okoliczne
|
176
|
+
str.gsub!(/\[\[(:?) *(image|grafika|file|plik) *: *([^ ])/i){'[['+$1+'Plik:'+$3.upcase}
|
177
|
+
str.gsub!(/\[\[(:?) *(category|kategoria) *: *([^ ])/i){'[['+$1+'Kategoria:'+$3.upcase}
|
178
|
+
str.gsub!(/\[\[ *(:?) *(template|szablon) *: *([^ ])/i){'[['+'Szablon:'+$3.upcase}
|
179
|
+
str.gsub!(/\[\[ *(:?) *(special|specjalna) *: *([^ ])/i){'[['+'Specjalna:'+$3.upcase}
|
180
|
+
|
181
|
+
3.times { str.gsub!('{{stub}}{{stub}}', '{{stub}}') }
|
182
|
+
|
183
|
+
self.text = str
|
184
|
+
end
|
185
|
+
|
186
|
+
def friendly_infobox
|
187
|
+
# cleans up infoboxes
|
188
|
+
# might make mistakes! use at your own risk!
|
189
|
+
def makeFriendly(nazwa,zaw)
|
190
|
+
zaw.gsub!(/<!--.+?-->/,'')
|
191
|
+
nazwa=nazwa.gsub('_',' ').strip
|
192
|
+
|
193
|
+
#escapowanie parametrów
|
194
|
+
zaw.gsub!(/<<<(#+)>>>/,"<<<#\\1>>>")
|
195
|
+
#wewnętrzne szablony
|
196
|
+
while zaw=~/\{\{[^}]+\|[^}]+\}\}/
|
197
|
+
zaw.gsub!($&,$&.gsub(/\|/,'<<<#>>>'))
|
198
|
+
end
|
199
|
+
#wewnętrzne linki
|
200
|
+
while zaw=~/\[\[[^\]]+\|[^\]]+\]\]/
|
201
|
+
zaw.gsub!($&,$&.gsub(/\|/,'<<<#>>>'))
|
202
|
+
end
|
203
|
+
|
204
|
+
zaw.sub!(/\A\s*\|\s*/,'') #usunięcie pierwszego pipe'a
|
205
|
+
lines=zaw.split('|')
|
206
|
+
|
207
|
+
# te tablice przechowują odpowiednio nazwy i wartości kolejnych parametrów
|
208
|
+
names=[]
|
209
|
+
values=[]
|
210
|
+
|
211
|
+
for line in lines
|
212
|
+
line.gsub!(/<<<#>>>/,'|')
|
213
|
+
line.gsub!(/<<<#(#+)>>>/,"<<<\\1>>>") #odescapowanie
|
214
|
+
|
215
|
+
line=~/\A\s*(.+?)\s*=\s*([\s\S]*?)\s*\Z/
|
216
|
+
if $&==nil
|
217
|
+
next
|
218
|
+
end
|
219
|
+
name=$1.strip
|
220
|
+
value=$2.strip
|
221
|
+
|
222
|
+
names<<name
|
223
|
+
values<<value
|
224
|
+
end
|
225
|
+
|
226
|
+
zaw=''
|
227
|
+
names.each_index{|i|
|
228
|
+
zaw+=' | '+names[i]+' = '+values[i]+"\n"
|
229
|
+
}
|
230
|
+
|
231
|
+
# grupowane koordynaty
|
232
|
+
zaw.gsub!(/\s*\| minut/, ' | minut')
|
233
|
+
zaw.gsub!(/\s*\| sekund/, ' | sekund')
|
234
|
+
|
235
|
+
return '{{'+nazwa[0,1].upcase+nazwa[1,999]+"\n"+zaw+'}}'+"\n"
|
236
|
+
end
|
237
|
+
|
238
|
+
nstr=''
|
239
|
+
while str!=''
|
240
|
+
str=~/(\s*)\{\{([^|}]+[ _]infobo[^|}]+|[wW]ładca)((?:[^{}]|[^{}][{}][^{}]|\{\{(?:[^{}]|[^{}][{}][^{}]|\{\{[^{}]+\}\})+\}\})+)\}\}(?:\s*)/
|
241
|
+
|
242
|
+
spaces=($1!='' ? "\n" : '')
|
243
|
+
before=($`==nil ? '' : $`)
|
244
|
+
name=$2
|
245
|
+
inner=$3
|
246
|
+
match=$&
|
247
|
+
if match!=nil
|
248
|
+
result=makeFriendly(name,inner)
|
249
|
+
nstr+=before+spaces+result
|
250
|
+
else
|
251
|
+
nstr+=str
|
252
|
+
break
|
253
|
+
end
|
254
|
+
|
255
|
+
str=str.sub(before+match,'')
|
256
|
+
end
|
257
|
+
|
258
|
+
self.text = nstr
|
259
|
+
end
|
260
|
+
|
261
|
+
def change_category from, to
|
262
|
+
from=from.sub(/\A\s*([cC]ategory|[kK]ategoria):/, '').strip
|
263
|
+
to=to.sub(/\A\s*([cC]ategory|[kK]ategoria):/, '').strip
|
264
|
+
self.text = self.text.gsub(/\[\[ *(?:[cC]ategory|[kK]ategoria) *: *#{Regexp.escape from} *(\|[^\]]+ *|)\]\]/){'[[Kategoria:'+to+$1.rstrip+']]'}
|
265
|
+
end
|
251
266
|
end
|