Debian Codegraph @

tests/parser/interwikiLinks.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 ### Interwiki links (see maintenance/interwiki.sql)
29
30 !! test
31 Inline interwiki link
32 !! options
33 parsoid=wt2html,wt2wt,html2html
34 !! wikitext
35 [[MeatBall:SoftSecurity]]
36 !! html/php
37 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
38 </p>
39 !! html/parsoid
40 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity" class="extiw">MeatBall:SoftSecurity</a></p>
41 !! end
42
43 !! test
44 Inline interwiki link with empty title (T4372)
45 !! options
46 parsoid=wt2html,wt2wt,html2html
47 !! wikitext
48 [[MeatBall:]]
49 !! html/php
50 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
51 </p>
52 !! html/parsoid
53 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:" class="extiw">MeatBall:</a></p>
54 !! end
55
56 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
57 !! test
58 Interwiki link encoding conversion (T3636)
59 !! options
60 parsoid=wt2html,wt2wt
61 !! wikitext
62 *[[Wikipedia:ro:Olteni&#0355;a]]
63 *[[Wikipedia:ro:Olteni&#355;a]]
64 !! html/php
65 <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li>
66 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li></ul>
67 !! html/parsoid
68 <ul>
69 <li><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/ro:Olteniţa" title="wikipedia:ro:Olteniţa" class="extiw">Wikipedia:ro:Olteniţa</a></li>
70 <li><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/ro:Olteniţa" title="wikipedia:ro:Olteniţa" class="extiw">Wikipedia:ro:Olteniţa</a></li>
71 </ul>
72 !! end
73
74 # Note that fragment is suppressed in metadata
75 !! test
76 Interwiki link with fragment (T4130)
77 !! options
78 iwl
79 !! metadata
80 iwl=meatball:SoftSecurity
81 iwl=meatball:Soft
82 !! wikitext
83 [[MeatBall:SoftSecurity#foo]]
84
85 [[meatball:Soft#Bar]]
86 !! html/php
87 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
88 </p><p><a href="http://www.usemod.com/cgi-bin/mb.pl?Soft#Bar" class="extiw" title="meatball:Soft">meatball:Soft#Bar</a>
89 </p>
90 !! html/parsoid
91 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" title="meatball:SoftSecurity" class="extiw">MeatBall:SoftSecurity#foo</a></p>
92 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Soft#Bar" title="meatball:Soft" class="extiw">meatball:Soft#Bar</a></p>
93 !! end
94
95 ## The non-local interwiki case here continues to be legacy escaped because of the
96 ## default setting of $wgExternalInterwikiFragmentMode
97 !! test
98 Link scenarios with escaped fragments
99 !! options
100 title=[[Main Page]]
101 !! config
102 wgFragmentMode=[ "html5", "legacy" ]
103 !! wikitext
104 [[#Is this great?]]
105 [[Foo#Is this great?]]
106 [[meatball:Foo#Is this great?]]
107 [[:en:Foo#Is this great?]]
108 !! html/php
109 <p><a href="#Is_this_great?">#Is this great?</a>
110 <a href="/wiki/Foo#Is_this_great?" title="Foo">Foo#Is this great?</a>
111 <a href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" class="extiw" title="meatball:Foo">meatball:Foo#Is this great?</a>
112 <a href="//en.wikipedia.org/wiki/Foo#Is_this_great?" class="extiw" title="en:Foo">en:Foo#Is this great?</a>
113 </p>
114 !! html/parsoid
115 <p><a rel="mw:WikiLink" href="./Main_Page#Is_this_great?" class="mw-selflink-fragment" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Is_this_great?"},"sa":{"href":"#Is this great?"}}'>#Is this great?</a>
116 <a rel="mw:WikiLink" href="./Foo#Is_this_great?" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#Is_this_great?"},"sa":{"href":"Foo#Is this great?"}}'>Foo#Is this great?</a>
117 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" title="meatball:Foo" class="extiw" data-parsoid='{"stx":"simple","a":{"href":"http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F"},"sa":{"href":"meatball:Foo#Is this great?"},"isIW":true}'>meatball:Foo#Is this great?</a>
118 <a rel="mw:WikiLink/Interwiki" href="//en.wikipedia.org/wiki/Foo#Is_this_great?" title="en:Foo" class="extiw">en:Foo#Is this great?</a></p>
119 !! end
120
121 !! test
122 Link scenarios with escaped fragments (legacy)
123 !! config
124 wgFragmentMode=[ "legacy" ]
125 !! wikitext
126 [[#Is this great?]]
127 [[Foo#Is this great?]]
128 [[meatball:Foo#Is this great?]]
129 !! html/php
130 <p><a href="#Is_this_great.3F">#Is this great?</a>
131 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
132 <a href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" class="extiw" title="meatball:Foo">meatball:Foo#Is this great?</a>
133 </p>
134 !! end
135
136 # Ideally the wikipedia: prefix here should be proto-relative too
137 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
138 # define the 'en' prefix, and originally the test used 'wikipedia',
139 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
140 # article.
141 !! test
142 Different interwiki prefixes mapping to the same URL
143 !! wikitext
144 [[:en:Foo]]
145
146 [[:en:Foo|Foo]]
147
148 [[wikipedia:Foo]]
149
150 [[:wikipedia:Foo|Foo]]
151
152 [[wikipedia:en:Foo]]
153
154 [[:wikipedia:en:Foo]]
155
156 [[ wikiPEdia :Foo]]
157 !! html/parsoid
158 <p><a rel="mw:WikiLink/Interwiki" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo" class="extiw">en:Foo</a></p>
159
160 <p><a rel="mw:WikiLink/Interwiki" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo" class="extiw">Foo</a></p>
161
162 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo" class="extiw">wikipedia:Foo</a></p>
163
164 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":":wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo" class="extiw">Foo</a></p>
165
166 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":"wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo" class="extiw">wikipedia:en:Foo</a></p>
167
168 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":":wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo" class="extiw">wikipedia:en:Foo</a></p>
169
170 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":" wikiPEdia :Foo"},"isIW":true}' title="wikipedia:Foo" class="extiw"> wikiPEdia :Foo</a></p>
171 !! end
172
173 !! test
174 Interwiki links that cannot be represented in wiki syntax
175 !! wikitext
176 [[meatball:ok]]
177 [[meatball:ok#foo|ok with fragment]]
178 [[meatball:ok_as_well?|ok ending with ? mark]]
179 [http://de.wikipedia.org/wiki/Foo?action=history has query]
180 [http://de.wikipedia.org/wiki/#foo is just fragment]
181
182 !! html/php
183 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
184 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
185 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F" class="extiw" title="meatball:ok as well?">ok ending with&#160;? mark</a>
186 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
187 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
188 </p>
189 !! html/parsoid
190 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok" class="extiw">meatball:ok</a>
191 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok" class="extiw">ok with fragment</a>
192 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F" title="meatball:ok as well?" class="extiw">ok ending with<span typeof="mw:DisplaySpace"> </span>? mark</a>
193 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history" class="external text">has query</a>
194 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo" class="external text">is just fragment</a></p>
195 !! end
196
197 !! test
198 Interwiki links: trail
199 !! wikitext
200 [[wikipedia:Foo|Ba]]r
201 !! html/php
202 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
203 </p>
204 !! html/parsoid
205 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true,"tail":"r"}' title="wikipedia:Foo" class="extiw">Bar</a></p>
206 !! end
207
208 !! test
209 Local interwiki link
210 !! options
211 parsoid=wt2html,wt2wt,html2html
212 !! wikitext
213 [[local:Template:Foo]]
214 !! html/php
215 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
216 </p>
217 !! html/parsoid
218 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
219 !! end
220
221 !! test
222 Local interwiki link: self-link to current page
223 !! options
224 title=[[Main Page]]
225 parsoid=wt2html,wt2wt,html2html
226 !! wikitext
227 [[local:Main Page]]
228 !! html/php
229 <p><a class="mw-selflink selflink">local:Main Page</a>
230 </p>
231 !! html/parsoid
232 <p><a rel="mw:WikiLink" href="./Main_Page" class="mw-selflink selflink">local:Main Page</a></p>
233 !! end
234
235 !! test
236 Local interwiki link: prefix only (T66167)
237 !! options
238 parsoid=wt2html,wt2wt,html2html
239 !! wikitext
240 [[local:]]
241 !! html/php
242 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
243 </p>
244 !! html/parsoid
245 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
246 !! end
247
248 !! test
249 Local interwiki link: with additional interwiki prefix (T63357)
250 !! options
251 parsoid=wt2html,wt2wt,html2html
252 !! wikitext
253 [[local:meatball:Hello]]
254 !! html/php
255 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
256 </p>
257 !! html/parsoid
258 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello" class="extiw">local:meatball:Hello</a></p>
259 !! end
260
261 !! test
262 Multiple local interwiki link prefixes
263 !! wikitext
264 [[local:local:local:local:mi:local:Foo]]
265 !! options
266 parsoid=wt2html,wt2wt,html2html
267 !! html/php
268 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
269 </p>
270 !! html/parsoid
271 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
272 !! end
273
274 !! test
275 Interwiki link that could be a language link, if not for a local interwiki prefix (T292022)
276 !! options
277 parsoid=html2wt
278 !! html/php
279 <p><a href="http://es.wikipedia.org/wiki/Hello" class="extiw" title="es:Hello">local:es:Hello</a>
280 </p>
281 !! html/parsoid
282 <p><a href="./Local:es:Hello" rel="mw:WikiLink">local:es:Hello</a></p>
283 !! wikitext
284 [[:es:Hello|local:es:Hello]]
285 !! end
286
287 !! test
288 Internal link with a namespace matching a local interwiki prefix (T228616)
289 !! options
290 parsoid=html2wt
291 !! html/php
292 <p><a href="/index.php?title=TestWiki:Hello&amp;action=edit&amp;redlink=1" class="new" title="TestWiki:Hello (page does not exist)">Project:Hello</a>
293 </p>
294 !! html/parsoid
295 <p><a href="./Project:Hello" rel="mw:WikiLink">Project:Hello</a></p>
296 !! wikitext
297 [[Project:Hello]]
298 !! end
299
300 !! test
301 Interwiki link with percent encoded target
302 !! wikitext
303 [[:es:Nueva Guip%C3%BAzcoa|Nueva Guipúzcoa]]
304 !! html/php
305 <p><a href="http://es.wikipedia.org/wiki/Nueva_Guip%C3%BAzcoa" class="extiw" title="es:Nueva Guipúzcoa">Nueva Guipúzcoa</a>
306 </p>
307 !! html/parsoid
308 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Nueva%20Guipúzcoa" title="es:Nueva Guipúzcoa" class="extiw" data-parsoid='{"stx":"piped","a":{"href":"http://es.wikipedia.org/wiki/Nueva%20Guipúzcoa"},"sa":{"href":":es:Nueva Guip%C3%BAzcoa"},"isIW":true}'>Nueva Guipúzcoa</a></p>
309 !! end
310
311 !! test
312 Interwiki link with colon escape after prefix
313 !! wikitext
314 [[meatball::Category:Hello]]
315 !! html/php
316 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Category:Hello" class="extiw" title="meatball:Category:Hello">meatball::Category:Hello</a>
317 </p>
318 !! html/parsoid
319 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Category:Hello" title="meatball:Category:Hello" class="extiw" data-parsoid='{"stx":"simple","a":{"href":"http://www.usemod.com/cgi-bin/mb.pl?Category:Hello"},"sa":{"href":"meatball::Category:Hello"},"isIW":true}'>meatball:Category:Hello</a></p>
320 !! end
321
322 !! test
323 Self-links and interwiki
324 !! options
325 title=[[Main Page]]
326 !! wikitext
327 [[local:Main Page]]
328
329 [[meatball:Main Page]]
330
331 [[mi:Main Page]]
332
333 [[local:Main Page#anchor]]
334
335 [[meatball:Main Page#anchor]]
336 !! html/php
337 <p><a class="mw-selflink selflink">local:Main Page</a>
338 </p><p><a href="http://www.usemod.com/cgi-bin/mb.pl?Main_Page" class="extiw" title="meatball:Main Page">meatball:Main Page</a>
339 </p><p><a class="mw-selflink selflink">mi:Main Page</a>
340 </p><p><a class="mw-selflink-fragment" href="#anchor">local:Main Page#anchor</a>
341 </p><p><a href="http://www.usemod.com/cgi-bin/mb.pl?Main_Page#anchor" class="extiw" title="meatball:Main Page">meatball:Main Page#anchor</a>
342 </p>
343 !! html/parsoid
344 <p><a rel="mw:WikiLink" href="./Main_Page" class="mw-selflink selflink" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page"},"sa":{"href":"local:Main Page"}}'>local:Main Page</a></p>
345
346 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Main%20Page" title="meatball:Main Page" class="extiw" data-parsoid='{"stx":"simple","a":{"href":"http://www.usemod.com/cgi-bin/mb.pl?Main%20Page"},"sa":{"href":"meatball:Main Page"},"isIW":true}'>meatball:Main Page</a></p>
347
348 <p><a rel="mw:WikiLink" href="./Main_Page" class="mw-selflink selflink" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page"},"sa":{"href":"mi:Main Page"}}'>mi:Main Page</a></p>
349
350 <p><a rel="mw:WikiLink" href="./Main_Page#anchor" class="mw-selflink-fragment" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#anchor"},"sa":{"href":"local:Main Page#anchor"}}'>local:Main Page#anchor</a></p>
351
352 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Main%20Page#anchor" title="meatball:Main Page" class="extiw" data-parsoid='{"stx":"simple","a":{"href":"http://www.usemod.com/cgi-bin/mb.pl?Main%20Page#anchor"},"sa":{"href":"meatball:Main Page#anchor"},"isIW":true}'>meatball:Main Page#anchor</a></p>
353 !! end
354