Debian Codegraph @

tests/parser/interlanguageLinks.txt

raw
1 # The parsoid-compatible option below is only relevant when we are running
2 # parser tests in integrated mode with Parsoid. This option is ignored
3 # when this test file is run with Parsoid in standalone mode.
4 !! options
5 parsoid-compatible=wt2html,wt2wt
6 version=2
7 !! end
8
9 # This is the standard article assumed to exist.
10 !! article
11 Main Page
12 !! text
13 blah blah
14 !! endarticle
15
16 !!article
17 Foo
18 !!text
19 FOO
20 !!endarticle
21
22 !!article
23 Template:Foo
24 !!text
25 FOO
26 !!endarticle
27
28 !! article
29 ko:
30 !! text
31 Test.
32 !! endarticle
33
34 !! test
35 Interlanguage link
36 !! options
37 ill
38 !! wikitext
39 Blah blah blah
40 [[zh:Chinese]]
41 !! metadata
42 ill=zh:Chinese
43 !! html/php
44 <p>Blah blah blah
45 </p>
46 !! html/parsoid
47 <p>Blah blah blah</p>
48 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
49 !! end
50
51 ## parsoid html2wt will lose the space variations
52 !! test
53 Interlanguage link with spacing
54 !! options
55 parsoid=wt2html,wt2wt,html2html
56 ill
57 !! wikitext
58 Blah blah blah
59 [[ zh : Chinese ]]
60 !! metadata
61 ill=zh:Chinese
62 !! html/php
63 <p>Blah blah blah
64 </p>
65 !! html/parsoid
66 <p>Blah blah blah</p>
67 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
68 !! end
69
70 !! test
71 Double interlanguage link
72 !! options
73 ill
74 !! wikitext
75 Blah blah blah
76 [[es:Spanish]]
77 [[zh:Chinese]]
78 !! metadata
79 ill=es:Spanish
80 ill=zh:Chinese
81 !! html/php
82 <p>Blah blah blah
83 </p>
84 !! html/parsoid
85 <p>Blah blah blah</p>
86 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
87 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
88 !! end
89
90 ## parsoid html2wt will lose the space variations
91 !! test
92 Interlanguage link variations
93 !! options
94 parsoid=wt2html,wt2wt,html2html
95 ill
96 !! wikitext
97 Blah blah blah
98 [[ es :Spanish]]
99 [[ ZH :Chinese]]
100 [[es:Foo_bar]]
101 !! metadata
102 ill=es:Spanish
103 ill=zh:Chinese
104 !! html/php
105 <p>Blah blah blah
106 </p>
107 !! html/parsoid
108 <p>Blah blah blah</p>
109 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
110 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
111 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
112 !! end
113
114 !! test
115 Escaping of interlanguage links (T129218, T156308)
116 !! options
117 ill
118 !! wikitext
119 Blah blah blah
120 [[:es:Spanish]]
121 [[ : zh : Chinese ]]
122 !! metadata
123 !! html/php
124 <p>Blah blah blah
125 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
126 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh&#160;: Chinese </a>
127 </p>
128 !! html/parsoid
129 <p>Blah blah blah
130 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish" class="extiw">es:Spanish</a>
131 <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese" class="extiw"> zh<span typeof="mw:DisplaySpace"> </span>: Chinese </a></p>
132 !! end
133
134 !! test
135 Multiple colons escaping interlanguage links
136 !! options
137 parsoid=wt2html
138 ill
139 !! wikitext
140 [[:es:Spanish]]
141 [[::es:Spanish]]
142 [[:::es:Spanish]]
143 !! metadata
144 !! html/php
145 <p><a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
146 [[::es:Spanish]]
147 [[:::es:Spanish]]
148 </p>
149 !! html/parsoid
150 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish" class="extiw">es:Spanish</a>
151 [[::es:Spanish]]
152 [[:::es:Spanish]]</p>
153 !! end
154
155 ## parsoid html2wt will normalize the space to _
156 !! test
157 Space and question mark encoding in interlanguage links (T95473)
158 !! options
159 parsoid=wt2html,wt2wt,html2html
160 ill
161 !! wikitext
162 Blah blah blah
163 [[es:Foo bar?]]
164 !! metadata
165 ill=es:Foo bar?
166 !! html/php
167 <p>Blah blah blah
168 </p>
169 !! html/parsoid
170 <p>Blah blah blah</p>
171 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
172 !! end
173
174 !! test
175 Interlanguage link, with prefix links
176 !! options
177 language=ln
178 ill
179 !! wikitext
180 Blah blah blah
181 [[zh:Chinese]]
182 !! metadata
183 ill=zh:Chinese
184 !! html/php
185 <p>Blah blah blah
186 </p>
187 !! html/parsoid
188 <p>Blah blah blah</p>
189 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
190 !! end
191
192 !! test
193 Double interlanguage link, with prefix links (T10897)
194 !! options
195 language=ln
196 ill
197 !! wikitext
198 Blah blah blah
199 [[es:Spanish]]
200 [[zh:Chinese]]
201 !! metadata
202 ill=es:Spanish
203 ill=zh:Chinese
204 !! html/php
205 <p>Blah blah blah
206 </p>
207 !! html/parsoid
208 <p>Blah blah blah</p>
209 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
210 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
211 !! end
212
213 ## FIXME: We would need to set up site messages in the TestRunner for the
214 ## title property to be set on the interlanguage link in integrated mode.
215 !! test
216 "Extra" interlanguage links (T34189 / gerrit 111390)
217 !! options
218 ill
219 !! wikitext
220 Blah blah blah
221 [[mul:Article]]
222 !! metadata
223 ill=mul:Article
224 !! html/php
225 <p>Blah blah blah
226 </p>
227 !! html/parsoid+standalone
228 <p>Blah blah blah</p>
229 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
230 !! html/parsoid+integrated
231 <p>Blah blah blah</p>
232 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
233 !! end
234
235 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
236 !! test
237 Language links render as inline links if $wgInterwikiMagic=false
238 !! options
239 parsoid=wt2html,wt2wt,html2html
240 ill
241 !! config
242 wgInterwikiMagic=false
243 !! wikitext
244 Blah blah blah
245 [[zh:Chinese]]
246 !! metadata
247 !! html/php
248 <p>Blah blah blah
249 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese">zh:Chinese</a>
250 </p>
251 !! html/parsoid
252 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese" class="extiw">zh:Chinese</a></p>
253 !! end
254
255 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
256 !! test
257 Language links render as inline links in the Talk namespace
258 !! options
259 title=Talk:Foo
260 parsoid=wt2html,wt2wt,html2html
261 ill
262 !! wikitext
263 Blah blah blah
264 [[zh:Chinese]]
265 !! metadata
266 !! html/php
267 <p>Blah blah blah
268 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese">zh:Chinese</a>
269 </p>
270 !! html/parsoid
271 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese" class="extiw">zh:Chinese</a></p>
272 !! end
273
274 # Note that `ko` isn't a known interlanguage prefix
275 !! test
276 Parsoid: recognize interlanguage links without a target page
277 !! options
278 ill
279 !! wikitext
280 [[es:]]
281
282 [[ko:]]
283 !! metadata
284 ill=es:
285 !! html/php
286 <p><br />
287 <a href="/wiki/Ko:" title="Ko:">ko:</a>
288 </p>
289 !! html/parsoid
290 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
291
292 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
293 !! end
294
295 # Note that `ko` isn't a known interwiki prefix
296 !! test
297 Parsoid: recognize interwiki links without a target page
298 !! options
299 parsoid=wt2html,wt2wt,html2html
300 ill
301 !! wikitext
302 [[:es:]]
303
304 [[:ko:]]
305 !! metadata
306 !! html/php
307 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
308 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
309 </p>
310 !! html/parsoid
311 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/" title="es:" class="extiw">es:</a></p>
312 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
313 !! end
314
315 !! test
316 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
317 !! options
318 ill
319 !! wikitext
320 [[mi:Foo]]
321 !! metadata
322 !! html/php
323 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
324 </p>
325 !! html/parsoid
326 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
327 !! end
328
329 !! test
330 Interlanguage link with preceding local interwiki link (T70085)
331 !! options
332 parsoid=wt2html,wt2wt,html2html
333 ill
334 !! wikitext
335 Blah blah blah
336 [[local:es:Spanish]]
337 !! metadata
338 !! html/php
339 <p>Blah blah blah
340 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
341 </p>
342 !! html/parsoid
343 <p>Blah blah blah
344 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish" class="extiw">local:es:Spanish</a></p>
345 !! end
346
347 !! test
348 Looks like an interlanguage link, but is actually a local interwiki
349 !! options
350 parsoid=wt2html,wt2wt,html2html
351 ill
352 !! wikitext
353 Blah blah blah
354 [[mi:Template:Foo]]
355 !! metadata
356 !! html/php
357 <p>Blah blah blah
358 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
359 </p>
360 !! html/parsoid
361 <p>Blah blah blah
362 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
363 !! end
364
365 # Note that fragments are preserved
366 !! test
367 Interlanguage link with a fragment
368 !! options
369 ill
370 !! wikitext
371 [[zh:Chinese#fragment]]
372 !! metadata
373 ill=zh:Chinese#fragment
374 !! html/php
375 !! html/parsoid
376 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese#fragment" data-parsoid='{"stx":"simple","a":{"href":"http://zh.wikipedia.org/wiki/Chinese#fragment"},"sa":{"href":"zh:Chinese#fragment"}}'/>
377 !! end