Debian Codegraph @

tests/parser/magicLinks.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 !! test
10 Magic links: internal link to RFC (T2479)
11 !! wikitext
12 [[RFC 123]]
13 !! html/php
14 <p><a href="/index.php?title=RFC_123&amp;action=edit&amp;redlink=1" class="new" title="RFC 123 (page does not exist)">RFC 123</a>
15 </p>
16 !! html/parsoid
17 <p><a rel="mw:WikiLink" href="./RFC_123?action=edit&amp;redlink=1" title="RFC 123" class="new" typeof="mw:LocalizedAttrs" data-parsoid='{"stx":"simple","a":{"href":"./RFC_123"},"sa":{"href":"RFC 123"}}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["RFC 123"]}}'>RFC 123</a></p>
18 !! end
19
20 !! test
21 Magic links: RFC (T2479)
22 !! options
23 cat
24 !! wikitext
25 RFC 822
26 !! metadata
27 cat=Pages_using_RFC_magic_links sort=
28 !! html/php
29 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://datatracker.ietf.org/doc/html/rfc822">RFC 822</a>
30 </p>
31 !! html/parsoid
32 <p><a href="https://datatracker.ietf.org/doc/html/rfc822" rel="mw:ExtLink" class="external mw-magiclink">RFC 822</a></p>
33 !! end
34
35 !! test
36 Magic links: RFC (T67278)
37 !! wikitext
38 This is RFC 822 but thisRFC 822 is not RFC 822linked.
39 !! html/php
40 <p>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="https://datatracker.ietf.org/doc/html/rfc822">RFC 822</a> but thisRFC 822 is not RFC 822linked.
41 </p>
42 !! html/parsoid
43 <p>This is <a href="https://datatracker.ietf.org/doc/html/rfc822" rel="mw:ExtLink" class="external mw-magiclink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
44 !! end
45
46 !! test
47 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
48 !! wikitext
49 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
50 RFC
51 822
52 !! html/php
53 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://datatracker.ietf.org/doc/html/rfc822">RFC 822</a>
54 RFC
55 822
56 </p>
57 !! html/parsoid
58 <p><a href="https://datatracker.ietf.org/doc/html/rfc822" rel="mw:ExtLink" class="external mw-magiclink">RFC <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 822</a>
59 RFC
60 822</p>
61 !! end
62
63 !! test
64 Magic links: ISBN (T3937)
65 !! options
66 cat
67 !! wikitext
68 ISBN 0-306-40615-2
69 !! metadata
70 cat=Pages_using_ISBN_magic_links sort=
71 !! html/php
72 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
73 </p>
74 !! html/parsoid
75 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
76 !! end
77
78 !! test
79 Magic links: ISBN (T67278)
80 !! wikitext
81 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
82 !! html/php
83 <p>This is <a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
84 </p>
85 !! html/parsoid
86 <p>This is <a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p>
87 !! end
88
89 !! test
90 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
91 !! wikitext
92 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
93 ISBN
94 9780316098113
95 ISBN 978
96 0316098113
97 !! html/php
98 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
99 ISBN
100 9780316098113
101 ISBN 978
102 0316098113
103 </p>
104 !! html/parsoid
105 <p><a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 978<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>0<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>316<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span>09811<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>3</a>
106 ISBN
107 9780316098113
108 ISBN 978
109 0316098113</p>
110 !! end
111
112 !! test
113 Magic links: PMID incorrectly converts space to underscore
114 !! wikitext
115 PMID 1234
116 !! html/php
117 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
118 </p>
119 !! html/parsoid
120 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external mw-magiclink">PMID 1234</a></p>
121 !! end
122
123 !! test
124 Magic links: PMID (T67278)
125 !! options
126 cat
127 !! wikitext
128 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
129 !! metadata
130 cat=Pages_using_PMID_magic_links sort=
131 !! html/php
132 <p>This is <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.
133 </p>
134 !! html/parsoid
135 <p>This is <a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external mw-magiclink">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.</p>
136 !! end
137
138 !! test
139 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
140 !! wikitext
141 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
142 PMID
143 1234
144 !! html/php
145 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
146 PMID
147 1234
148 </p>
149 !! html/parsoid
150 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external mw-magiclink">PMID <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 1234</a>
151 PMID
152 1234</p>
153 !! end
154
155 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
156 # since these are ExtLinkText, not MagicLinkText
157 !! test
158 Magic links: use appropriate serialization for "almost" magic links.
159 !! wikitext
160 X[[Special:BookSources/0978739256|foo]]
161
162 X[https://datatracker.ietf.org/doc/html/rfc1234 foo]
163 !! html/php
164 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
165 </p><p>X<a rel="nofollow" class="external text" href="https://datatracker.ietf.org/doc/html/rfc1234">foo</a>
166 </p>
167 !! html/parsoid
168 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
169 <p>X<a rel="mw:ExtLink" href="https://datatracker.ietf.org/doc/html/rfc1234" class="external text">foo</a></p>
170 !! end
171
172 !! test
173 Magic links: All disabled (T47942)
174 !! config
175 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
176 !! options
177 cat
178 !! wikitext
179 ISBN 0-306-40615-2
180 PMID 1234
181 RFC 4321
182 !! metadata
183 !! html
184 <p>ISBN 0-306-40615-2
185 PMID 1234
186 RFC 4321
187 </p>
188 !! end
189
190 !! test
191 Magic links: html2wt of old wikitext when disabled (T47942)
192 !! config
193 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
194 !! options
195 parsoid=html2wt
196 !! html/parsoid
197 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 0-306-40615-2</a>
198 <a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink nofollow" class="external mw-magiclink" data-parsoid='{"stx":"magiclink"}'>PMID 1234</a>
199 <a href="https://datatracker.ietf.org/doc/html/rfc4321" rel="mw:ExtLink nofollow" class="external mw-magiclink" data-parsoid='{"stx":"magiclink"}'>RFC 4321</a></p>
200 !! wikitext
201 [[Special:BookSources/0306406152|ISBN 0-306-40615-2]]
202 [//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract PMID 1234]
203 [https://datatracker.ietf.org/doc/html/rfc4321 RFC 4321]
204 !! end
205
206 # PMID has an interwiki setup (if the pmid-interwiki option is set), but RFC
207 # doesn't. Check that we round-trip correctly from the interwiki format,
208 # whether magic links are enabled or not (and whether the interwiki is
209 # present or not).
210
211 !! test
212 Prefer PMID magic link, no interwiki and magic links enabled (T145590#8608455)
213 !! wikitext
214 PMID 234
215 !! html/php
216 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/234?dopt=Abstract">PMID 234</a>
217 </p>
218 !! html/parsoid
219 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/234?dopt=Abstract" rel="mw:ExtLink" class="external mw-magiclink">PMID 234</a></p>
220 !! end
221
222 !! test
223 Prefer PMID magic link, interwiki and magic links enabled (T145590#8608455)
224 !! options
225 pmid-interwiki
226 !! wikitext
227 PMID 234
228 !! html/php
229 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/234?dopt=Abstract">PMID 234</a>
230 </p>
231 !! html/parsoid
232 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/234?dopt=Abstract" rel="mw:ExtLink" class="external mw-magiclink">PMID 234</a></p>
233 !! end
234
235 !! test
236 Round-trip PMID interwiki, magic links enabled (T145590#8608455)
237 !! options
238 pmid-interwiki
239 !! wikitext
240 [[pmid:234|PMID 234]]
241 !! html/php
242 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/234?dopt=Abstract" class="extiw" title="pmid:234">PMID 234</a>
243 </p>
244 !! html/parsoid
245 <p><a rel="mw:WikiLink/Interwiki" href="//www.ncbi.nlm.nih.gov/pubmed/234?dopt=Abstract" title="pmid:234" class="extiw">PMID 234</a></p>
246 !! end
247
248 !! test
249 Prefer PMID interwiki, magic links disabled (T145590#8608455)
250 !! options
251 pmid-interwiki
252 !! config
253 wgEnableMagicLinks={"PMID":false,"RFC":false}
254 !! wikitext
255 [[pmid:234|PMID 234]]
256
257 [https://datatracker.ietf.org/doc/html/rfc4321 RFC 4321]
258 !! html/php
259 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/234?dopt=Abstract" class="extiw" title="pmid:234">PMID 234</a>
260 </p><p><a rel="nofollow" class="external text" href="https://datatracker.ietf.org/doc/html/rfc4321">RFC 4321</a>
261 </p>
262 !! html/parsoid
263 <p><a rel="mw:WikiLink/Interwiki"
264 href="//www.ncbi.nlm.nih.gov/pubmed/234?dopt=Abstract" title="pmid:234" class="extiw">PMID 234</a></p>
265 <p><a rel="mw:ExtLink" href="https://datatracker.ietf.org/doc/html/rfc4321" class="external text">RFC 4321</a></p>
266 !! end
267
268 !! test
269 Preder PMID extlink if no interwiki, magic links disabled (T145590#8608455)
270 !! options
271 parsoid=html2wt
272 !! config
273 wgEnableMagicLinks={"PMID":false,"RFC":false}
274 !! wikitext
275 [//www.ncbi.nlm.nih.gov/pubmed/234?dopt=Abstract PMID 234]
276 !! html/parsoid
277 <p><a rel="mw:WikiLink/Interwiki"
278 href="//www.ncbi.nlm.nih.gov/pubmed/234?dopt=Abstract" title="pmid:234" class="extiw">PMID 234</a></p>
279 !! end
280
281 !! article
282 Foo
283 !! text
284 FOO
285 !! endarticle
286
287 !! test
288 Magic links inside links (not autolinked)
289 !! wikitext
290 [[Foo|http://example.com]]
291 [[Foo|RFC 1234]]
292 [[Foo|PMID 1234]]
293 [[Foo|ISBN 123456789x]]
294
295 [http://foo.com http://example.com]
296 [http://foo.com RFC 1234]
297 [http://foo.com PMID 1234]
298 [http://foo.com ISBN 123456789x]
299 !! html/php
300 <p><a href="/wiki/Foo" title="Foo">http://example.com</a>
301 <a href="/wiki/Foo" title="Foo">RFC 1234</a>
302 <a href="/wiki/Foo" title="Foo">PMID 1234</a>
303 <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a>
304 </p><p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a>
305 <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a>
306 <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a>
307 <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a>
308 </p>
309 !! html/parsoid
310 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
311 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
312 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
313 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
314
315 <p><a rel="mw:ExtLink" href="http://foo.com" class="external text">http://example.com</a>
316 <a rel="mw:ExtLink" href="http://foo.com" class="external text">RFC 1234</a>
317 <a rel="mw:ExtLink" href="http://foo.com" class="external text">PMID 1234</a>
318 <a rel="mw:ExtLink" href="http://foo.com" class="external text">ISBN 123456789x</a></p>
319 !! end
320
321 !! test
322 WTS of magic word text (T109371)
323 !! options
324 parsoid=html2wt
325 !! html/parsoid
326 <p>RFC 1234</p>
327 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
328 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
329 !! wikitext
330 <nowiki>RFC 1234</nowiki>
331
332 [http://foo.com RFC 1234]
333
334 [[Foo|RFC 1234]]
335 !! end
336
337 !! test
338 T4304: HTML attribute safety (ISBN)
339 !! wikitext
340 <div title="ISBN 1234567890"></div>
341 !! html
342 <div title="&#73;SBN 1234567890"></div>
343 !! end
344
345 !! test
346 T4304: HTML attribute safety (RFC)
347 !! wikitext
348 <div title="RFC 1234"></div>
349 !! html
350 <div title="&#82;FC 1234"></div>
351 !! end
352
353 !! test
354 T4304: HTML attribute safety (PMID)
355 !! wikitext
356 <div title="PMID 1234567890"></div>
357 !! html
358 <div title="&#80;MID 1234567890"></div>
359 !! end
360
361 !! test
362 ISBN code coverage
363 !! wikitext
364 ISBN 978-0-1234-56&#x20;789
365 !! html/php
366 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
367 </p>
368 !! html/parsoid
369 <p><a href="./Special:BookSources/9780123456" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978-0-1234-56</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x20;","srcContent":" "}'> </span>789</p>
370 !! end
371
372 !! test
373 ISBN followed by 5 spaces
374 !! wikitext
375 ISBN
376 !! html
377 <p>ISBN
378 </p>
379 !! end
380
381 !! test
382 Double ISBN
383 !! wikitext
384 ISBN ISBN 1234567890
385 !! html/php
386 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
387 </p>
388 !! html/parsoid
389 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
390 !! end
391
392 # Uppercase X and lowercase x as well
393 !! test
394 ISBN with an X
395 !! wikitext
396 ISBN 3-462-04561-X
397 ISBN 3-462-04561-x
398 ISBN 080442957X
399 ISBN 080442957x
400 ISBN 978080442957X
401 ISBN 978080442957x
402 !! html/php
403 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
404 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
405 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
406 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
407 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
408 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
409 </p>
410 !! html/parsoid
411 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
412 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
413 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
414 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
415 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
416 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
417 !! end
418
419 !! test
420 ISBN with empty prefix (parsoid test)
421 !! wikitext
422 ISBN 1234567890
423 !! html/php
424 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
425 </p>
426 !! html/parsoid
427 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
428 !! end
429
430 !! test
431 T24905: <abbr> followed by ISBN followed by </a>
432 !! wikitext
433 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
434 !! html/php
435 <p><abbr>(fr)</abbr> <a href="/wiki/Special:BookSources/2753300917" class="internal mw-magiclink-isbn">ISBN 2753300917</a> <a rel="nofollow" class="external text" href="http://www.example.com">example.com</a>
436 </p>
437 !! html/parsoid
438 <p><abbr data-parsoid='{"stx":"html"}'>(fr)</abbr> <a href="./Special:BookSources/2753300917" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 2753300917</a> <a rel="mw:ExtLink" href="http://www.example.com" class="external text">example.com</a></p>
439 !! end
440
441 !! test
442 Double RFC
443 !! wikitext
444 RFC RFC 1234
445 !! html/php
446 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="https://datatracker.ietf.org/doc/html/rfc1234">RFC 1234</a>
447 </p>
448 !! html/parsoid
449 <p>RFC <a href="https://datatracker.ietf.org/doc/html/rfc1234" rel="mw:ExtLink" class="external mw-magiclink">RFC 1234</a></p>
450 !! end
451
452 !! test
453 Double RFC with a wiki link
454 !! wikitext
455 RFC [[RFC 1234]]
456 !! html/php
457 <p>RFC <a href="/index.php?title=RFC_1234&amp;action=edit&amp;redlink=1" class="new" title="RFC 1234 (page does not exist)">RFC 1234</a>
458 </p>
459 !! html/parsoid
460 <p>RFC <a rel="mw:WikiLink" href="./RFC_1234?action=edit&amp;redlink=1" title="RFC 1234" class="new" typeof="mw:LocalizedAttrs" data-parsoid='{"stx":"simple","a":{"href":"./RFC_1234"},"sa":{"href":"RFC 1234"}}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["RFC 1234"]}}'>RFC 1234</a></p>
461 !! end
462
463 !! test
464 RFC code coverage
465 !! wikitext
466 RFC 983&#x20;987
467 !! html/php
468 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://datatracker.ietf.org/doc/html/rfc983">RFC 983</a>&#x20;987
469 </p>
470 !! html/parsoid
471 <p><a href="https://datatracker.ietf.org/doc/html/rfc983" rel="mw:ExtLink" class="external mw-magiclink" data-parsoid='{"stx":"magiclink"}'>RFC 983</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x20;","srcContent":" "}'> </span>987</p>
472 !! end
473
474 !! test
475 ISBN with a dummy number
476 !! wikitext
477 ISBN ---
478 !! html
479 <p>ISBN ---
480 </p>
481 !! end
482
483 !! test
484 ISBN with space-delimited number
485 !! wikitext
486 ISBN 92 9017 032 8
487 !! html/php
488 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
489 </p>
490 !! html/parsoid
491 <p><a href="./Special:BookSources/9290170328" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 92 9017 032 8</a></p>
492 !! end
493
494 !! test
495 ISBN with multiple spaces, no number
496 !! wikitext
497 ISBN foo
498 !! html
499 <p>ISBN foo
500 </p>
501 !! end
502
503 !! test
504 ISBN length
505 !! wikitext
506 ISBN 123456789
507
508 ISBN 1234567890
509
510 ISBN 12345678901
511 !! html/php
512 <p>ISBN 123456789
513 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
514 </p><p>ISBN 12345678901
515 </p>
516 !! html/parsoid
517 <p>ISBN 123456789</p>
518
519 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
520
521 <p>ISBN 12345678901</p>
522 !! end
523
524 !! test
525 ISBN with trailing year (T9110)
526 !! wikitext
527 ISBN 1-234-56789-0 - 2006
528
529 ISBN 1 234 56789 0 - 2006
530 !! html/php
531 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
532 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
533 </p>
534 !! html/parsoid
535 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
536
537 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
538 !! end
539
540 !! test
541 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
542 (magic links enabled)
543 !! options
544 parsoid=html2wt
545 !! html/parsoid
546 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567895</a>
547 !! wikitext
548 [[Special:BookSources/1234567890|ISBN 1234567895]]
549 !! end
550
551 !! test
552 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
553 (magic links disabled)
554 !! config
555 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
556 !! options
557 parsoid=html2wt
558 !! html/parsoid
559 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567895</a>
560 !! wikitext
561 [[Special:BookSources/1234567890|ISBN 1234567895]]
562 !! end
563
564 !! test
565 Edited RFC links not serializable as RFC links should serialize as extlinks
566 !! options
567 parsoid=html2wt
568 !! html/parsoid
569 <a href="https://datatracker.ietf.org/doc/html/rfc123" rel="mw:ExtLink">New RFC</a>
570 !! wikitext
571 [https://datatracker.ietf.org/doc/html/rfc123 New RFC]
572 !! end
573
574 !! test
575 Edited PMID links not serializable as PMID links should serialize as extlinks
576 !! options
577 parsoid=html2wt
578 !! html/parsoid
579 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
580 !! wikitext
581 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
582 !! end
583
584 !! test
585 Edited PMID links not serializable as PMID links should serialize as wikilinks if possible
586 !! options
587 parsoid=html2wt
588 pmid-interwiki
589 !! html/parsoid
590 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
591 !! wikitext
592 [[pmid:123|New PMID]]
593 !! end
594