Merge "Fix Uzbek converter"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-only test (not run by PHP parser)
25 # php php-only test (not run by the parsoid parser)
26 # showtitle make the first line the title
27 # comment run through Linker::formatComment() instead of main parser
28 # local format section links in edit comment text as local links
29 # notoc disable table of contents
30 #
31 # You can also set the following parser properties via test options:
32 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
33 # wgLinkHolderBatchSize, wgRawHtml
34 #
35 # For testing purposes, temporary articles can created:
36 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
37 # where '/' denotes a newline.
38
39 # This is the standard article assumed to exist.
40 !! article
41 Main Page
42 !! text
43 blah blah
44 !! endarticle
45
46 !!article
47 Template:Foo
48 !!text
49 FOO
50 !!endarticle
51
52 !! article
53 Template:Blank
54 !! text
55 !! endarticle
56
57 !! article
58 Template:pipe
59 !! text
60 |
61 !! endarticle
62
63 !!article
64 MediaWiki:bad image list
65 !!text
66 * [[File:Bad.jpg]] except [[Nasty page]]
67 !!endarticle
68
69 !! article
70 Template:inner list
71 !! text
72 * item 1
73 !! endarticle
74
75 !! article
76 Template:tbl-start
77 !! text
78 {|
79 !! endarticle
80
81 !! article
82 Template:tbl-end
83 !! text
84 |}
85 !! endarticle
86
87 !! article
88 Template:!
89 !! text
90 |
91 !! endarticle
92
93 !! article
94 Template:echo
95 !! text
96 {{{1}}}
97 !! endarticle
98
99 !! article
100 Template:echo_with_span
101 !! text
102 <span>{{{1}}}</span>
103 !! endarticle
104
105 !! article
106 Template:echo_with_div
107 !! text
108 <div>{{{1}}}</div>
109 !! endarticle
110
111 !! article
112 Template:attr_str
113 !! text
114 {{{1}}}="{{{2}}}"
115 !! endarticle
116
117 !! article
118 Template:table_attribs
119 !! text
120 <noinclude>
121 |</noinclude>style="color: red"| Foo
122 !! endarticle
123
124 !! article
125 Template:table_cells
126 !! text
127 {{table_attribs}} || Bar || Baz
128 !! endarticle
129
130 !! article
131 Template:image_attribs
132 !! text
133 <noinclude>
134 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
135 !! endarticle
136
137 !! article
138 A?b
139 !! text
140 Weirdo titles!
141 !! endarticle
142
143 !!article
144 Template:Bullet
145 !!text
146 * Bar
147 !!endarticle
148
149 !!article
150 Template:OpenTable
151 !!text
152 {|
153 !!endarticle
154
155 ###
156 ### Basic tests
157 ###
158 !! test
159 Blank input
160 !! input
161 !! result
162 !! end
163
164
165 !! test
166 Simple paragraph
167 !! input
168 This is a simple paragraph.
169 !! result
170 <p>This is a simple paragraph.
171 </p>
172 !! end
173
174 !! test
175 Paragraphs with extra newline spacing
176 !! input
177 foo
178
179 bar
180
181
182 baz
183
184
185
186 booz
187 !! result
188 <p>foo
189 </p><p>bar
190 </p><p><br />
191 baz
192 </p><p><br />
193 </p><p>booz
194 </p>
195 !! end
196
197 !! test
198 Paragraphs with newline spacing with comment lines in between
199 !! input
200 ----
201 a
202 <!--foo-->
203 b
204 ----
205 a
206 <!--foo--><!--More than 1 comment, still stripped-->
207 b
208 ----
209 a
210 <!--foo--> <!----> <!-- bar -->
211 b
212 ----
213 a
214 <!--foo-->
215
216 b
217 ----
218 a
219
220 <!--foo-->
221 b
222 ----
223 a
224 <!--foo-->
225
226
227 b
228 ----
229 a
230
231
232 <!--foo-->
233 b
234 ----
235 !! result
236 <hr />
237 <p>a
238 b
239 </p>
240 <hr />
241 <p>a
242 b
243 </p>
244 <hr />
245 <p>a
246 b
247 </p>
248 <hr />
249 <p>a
250 </p><p>b
251 </p>
252 <hr />
253 <p>a
254 </p><p>b
255 </p>
256 <hr />
257 <p>a
258 </p><p><br />
259 b
260 </p>
261 <hr />
262 <p>a
263 </p><p><br />
264 b
265 </p>
266 <hr />
267
268 !! end
269
270 !! test
271 Paragraphs with newline spacing with non-empty white-space lines in between
272 !! input
273 ----
274 a
275
276 b
277 ----
278 a
279
280
281 b
282 ----
283 !! result
284 <hr />
285 <p>a
286 </p><p>b
287 </p>
288 <hr />
289 <p>a
290 </p><p><br />
291 b
292 </p>
293 <hr />
294
295 !! end
296
297 !! test
298 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
299 !! input
300 ----
301 a
302 <!--foo-->
303 b
304 ----
305 a
306 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
307 b
308 ----
309 a
310
311 <!--foo-->
312 <!--bar-->
313 b
314 ----
315 a
316
317 <!--foo-->
318 <!--bar-->
319
320 b
321 ----
322 !! result
323 <hr />
324 <p>a
325 b
326 </p>
327 <hr />
328 <p>a
329 b
330 </p>
331 <hr />
332 <p>a
333 </p><p>b
334 </p>
335 <hr />
336 <p>a
337 </p><p><br />
338 b
339 </p>
340 <hr />
341
342 !! end
343
344 !! test
345 Extra newlines: More paragraphs with indented comment
346 !! input
347 a
348
349 <!--boo-->
350
351 b
352 !!result
353 <p>a
354 </p><p><br />
355 b
356 </p>
357 !!end
358
359 !! test
360 Extra newlines followed by heading
361 !! input
362 a
363
364
365
366 =b=
367 [[a]]
368
369
370 =b=
371 !! result
372 <p>a
373 </p><p><br />
374 </p>
375 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
376 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
377 </p><p><br />
378 </p>
379 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
380
381 !! end
382
383 !! test
384 Extra newlines between heading and content are swallowed
385 !! input
386 =b=
387
388
389
390 [[a]]
391 !! result
392 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
393 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
394 </p>
395 !! end
396
397 !! test
398 Parsing an URL
399 !! input
400 http://fr.wikipedia.org/wiki/🍺
401 <!-- EasterEgg we love beer, better be able be able to link to it -->
402 !! result
403 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
404 </p>
405 !! end
406
407 !! test
408 Simple list
409 !! input
410 * Item 1
411 * Item 2
412 !! result
413 <ul>
414 <li> Item 1
415 </li>
416 <li> Item 2
417 </li>
418 </ul>
419
420 !! end
421
422 !! test
423 Italics and bold
424 !! input
425 * plain
426 * plain''italic''plain
427 * plain''italic''plain''italic''plain
428 * plain'''bold'''plain
429 * plain'''bold'''plain'''bold'''plain
430 * plain''italic''plain'''bold'''plain
431 * plain'''bold'''plain''italic''plain
432 * plain''italic'''bold-italic'''italic''plain
433 * plain'''bold''bold-italic''bold'''plain
434 * plain'''''bold-italic'''italic''plain
435 * plain'''''bold-italic''bold'''plain
436 * plain''italic'''bold-italic'''''plain
437 * plain'''bold''bold-italic'''''plain
438 * plain l'''italic''plain
439 * plain l''''bold''' plain
440 !! result
441 <ul>
442 <li> plain
443 </li>
444 <li> plain<i>italic</i>plain
445 </li>
446 <li> plain<i>italic</i>plain<i>italic</i>plain
447 </li>
448 <li> plain<b>bold</b>plain
449 </li>
450 <li> plain<b>bold</b>plain<b>bold</b>plain
451 </li>
452 <li> plain<i>italic</i>plain<b>bold</b>plain
453 </li>
454 <li> plain<b>bold</b>plain<i>italic</i>plain
455 </li>
456 <li> plain<i>italic<b>bold-italic</b>italic</i>plain
457 </li>
458 <li> plain<b>bold<i>bold-italic</i>bold</b>plain
459 </li>
460 <li> plain<i><b>bold-italic</b>italic</i>plain
461 </li>
462 <li> plain<b><i>bold-italic</i>bold</b>plain
463 </li>
464 <li> plain<i>italic<b>bold-italic</b></i>plain
465 </li>
466 <li> plain<b>bold<i>bold-italic</i></b>plain
467 </li>
468 <li> plain l'<i>italic</i>plain
469 </li>
470 <li> plain l'<b>bold</b> plain
471 </li>
472 </ul>
473
474 !! end
475
476 # this example taken from the [[simple:Moon]] article (bug 47326)
477 !! test
478 Italics and possessives (1)
479 !! input
480 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
481 !! result
482 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
483 </p>
484 !! end
485
486 # this example taken from [[en:Flaming Pie]] (bug 49926)
487 !! test
488 Italics and possessives (2)
489 !! input
490 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
491 !! result
492 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
493 </p>
494 !! end
495
496 # this example taken from [[en:Dictionary]] (bug 49926)
497 !! test
498 Italics and possessives (3)
499 !! input
500 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
501 !! result
502 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
503 </p>
504 !! end
505
506
507 ###
508 ### 2-quote opening sequence tests
509 ###
510 !! test
511 Italics and bold: 2-quote opening sequence: (2,2)
512 !! input
513 ''foo''
514 !! result
515 <p><i>foo</i>
516 </p>
517 !!end
518
519
520 !! test
521 Italics and bold: 2-quote opening sequence: (2,3)
522 !! input
523 ''foo'''
524 !! result
525 <p><i>foo'</i>
526 </p>
527 !!end
528
529
530 !! test
531 Italics and bold: 2-quote opening sequence: (2,4)
532 !! input
533 ''foo''''
534 !! result
535 <p><i>foo''</i>
536 </p>
537 !!end
538
539
540 !! test
541 Italics and bold: 2-quote opening sequence: (2,5) (php)
542 !! options
543 php
544 !! input
545 ''foo'''''
546 !! result
547 <p><i>foo</i>
548 </p>
549 !!end
550 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
551 !! test
552 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
553 !! options
554 parsoid
555 !! input
556 ''foo'''''
557 !! result
558 <p><i>foo</i><b></b>
559 </p>
560 !!end
561
562
563 ###
564 ### 3-quote opening sequence tests
565 ###
566
567 !! test
568 Italics and bold: 3-quote opening sequence: (3,2)
569 !! input
570 '''foo''
571 !! result
572 <p>'<i>foo</i>
573 </p>
574 !!end
575
576
577 !! test
578 Italics and bold: 3-quote opening sequence: (3,3)
579 !! input
580 '''foo'''
581 !! result
582 <p><b>foo</b>
583 </p>
584 !!end
585
586
587 !! test
588 Italics and bold: 3-quote opening sequence: (3,4)
589 !! input
590 '''foo''''
591 !! result
592 <p><b>foo'</b>
593 </p>
594 !!end
595
596
597 !! test
598 Italics and bold: 3-quote opening sequence: (3,5) (php)
599 !! options
600 php
601 !! input
602 '''foo'''''
603 !! result
604 <p><b>foo</b>
605 </p>
606 !!end
607 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
608 !! test
609 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
610 !! options
611 parsoid
612 !! input
613 '''foo'''''
614 !! result
615 <p><b>foo</b><i></i>
616 </p>
617 !!end
618
619
620 ###
621 ### 4-quote opening sequence tests
622 ###
623
624 !! test
625 Italics and bold: 4-quote opening sequence: (4,2)
626 !! input
627 ''''foo''
628 !! result
629 <p>''<i>foo</i>
630 </p>
631 !!end
632
633
634 !! test
635 Italics and bold: 4-quote opening sequence: (4,3)
636 !! input
637 ''''foo'''
638 !! result
639 <p>'<b>foo</b>
640 </p>
641 !!end
642
643
644 !! test
645 Italics and bold: 4-quote opening sequence: (4,4)
646 !! input
647 ''''foo''''
648 !! result
649 <p>'<b>foo'</b>
650 </p>
651 !!end
652
653
654 !! test
655 Italics and bold: 4-quote opening sequence: (4,5) (php)
656 !! options
657 php
658 !! input
659 ''''foo'''''
660 !! result
661 <p>'<b>foo</b>
662 </p>
663 !!end
664 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
665 !! test
666 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
667 !! options
668 parsoid
669 !! input
670 ''''foo'''''
671 !! result
672 <p>'<b>foo</b><i></i>
673 </p>
674 !!end
675
676
677 ###
678 ### 5-quote opening sequence tests
679 ###
680
681 !! test
682 Italics and bold: 5-quote opening sequence: (5,2)
683 !! options
684 !! input
685 '''''foo''
686 !! result
687 <p><b><i>foo</i></b>
688 </p>
689 !!end
690
691
692 !! test
693 Italics and bold: 5-quote opening sequence: (5,3)
694 !! input
695 '''''foo'''
696 !! result
697 <p><i><b>foo</b></i>
698 </p>
699 !!end
700
701
702 !! test
703 Italics and bold: 5-quote opening sequence: (5,4)
704 !! input
705 '''''foo''''
706 !! result
707 <p><i><b>foo'</b></i>
708 </p>
709 !!end
710
711
712 !! test
713 Italics and bold: 5-quote opening sequence: (5,5)
714 !! input
715 '''''foo'''''
716 !! result
717 <p><i><b>foo</b></i>
718 </p>
719 !!end
720
721 ###
722 ### multiple quote sequences in a line
723 ###
724 !! test
725 Italics and bold: multiple quote sequences: (2,4,2)
726 !! input
727 ''foo''''bar''
728 !! result
729 <p><i>foo'<b>bar</b></i>
730 </p>
731 !!end
732
733
734 !! test
735 Italics and bold: multiple quote sequences: (2,4,3)
736 !! input
737 ''foo''''bar'''
738 !! result
739 <p><i>foo'<b>bar</b></i>
740 </p>
741 !!end
742
743
744 !! test
745 Italics and bold: multiple quote sequences: (2,4,4)
746 !! input
747 ''foo''''bar''''
748 !! result
749 <p><i>foo'<b>bar'</b></i>
750 </p>
751 !!end
752
753
754 !! test
755 Italics and bold: multiple quote sequences: (3,4,2) (php)
756 !! options
757 php
758 !! input
759 '''foo''''bar''
760 !! result
761 <p><b>foo'</b>bar
762 </p>
763 !!end
764 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
765 !! test
766 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
767 !! options
768 parsoid
769 !! input
770 '''foo''''bar''
771 !! result
772 <p><b>foo'</b>bar<i></i>
773 </p>
774 !!end
775
776
777 !! test
778 Italics and bold: multiple quote sequences: (3,4,3) (php)
779 !! options
780 php
781 !! input
782 '''foo''''bar'''
783 !! result
784 <p><b>foo'</b>bar
785 </p>
786 !!end
787 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
788 !! test
789 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
790 !! options
791 parsoid
792 !! input
793 '''foo''''bar'''
794 !! result
795 <p><b>foo'</b>bar<b></b>
796 </p>
797 !!end
798
799 ###
800 ### other quote tests
801 ###
802 !! test
803 Italics and bold: other quote tests: (2,3,5)
804 !! input
805 ''this is about '''foo's family'''''
806 !! result
807 <p><i>this is about <b>foo's family</b></i>
808 </p>
809 !!end
810
811
812 !! test
813 Italics and bold: other quote tests: (2,(3,3),2)
814 !! input
815 ''this is about '''foo's''' family''
816 !! result
817 <p><i>this is about <b>foo's</b> family</i>
818 </p>
819 !!end
820
821
822 !! test
823 Italics and bold: other quote tests: (3,2,3,2)
824 !! input
825 '''this is about ''foo'''s family''
826 !! result
827 <p><b>this is about <i>foo</i></b><i>s family</i>
828 </p>
829 !!end
830
831
832 !! test
833 Italics and bold: other quote tests: (3,2,3,3)
834 !! options
835 !! input
836 '''this is about ''foo'''s family'''
837 !! result
838 <p>'<i>this is about </i>foo<b>s family</b>
839 </p>
840 !!end
841
842
843 !! test
844 Italics and bold: other quote tests: (3,(2,2),3)
845 !! input
846 '''this is about ''foo's'' family'''
847 !! result
848 <p><b>this is about <i>foo's</i> family</b>
849 </p>
850 !!end
851
852
853 !! test
854 Italicized possessive
855 !! input
856 The ''[[Main Page]]'''s talk page.
857 !! result
858 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
859 </p>
860 !! end
861
862 !! test
863 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
864 (Requires tidy for PHP parser output to be fixed up)
865 !! options
866 parsoid=wt2html,wt2wt
867 !! input
868 {|
869 !''a!!''b
870 |''a||''b
871 |}
872 !! result
873 <table>
874 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
875 <td><i>a</i></td><td><i>b</i></td></tr>
876 </tbody></table>
877 !! end
878
879 ###
880 ### Non-html5 tags
881 ###
882
883 !! test
884 Non-html5 tags should be accepted
885 !! input
886 <center>''foo''</center>
887 <big>''foo''</big>
888 <font>''foo''</font>
889 <strike>''foo''</strike>
890 <tt>''foo''</tt>
891 !! result
892 <center><i>foo</i></center>
893 <p><big><i>foo</i></big>
894 <font><i>foo</i></font>
895 <strike><i>foo</i></strike>
896 <tt><i>foo</i></tt>
897 </p>
898 !! end
899
900 !! test
901 <wbr> is valid wikitext (bug 52468)
902 !! input
903 <wbr>
904 !! result
905 <p><wbr />
906 </p>
907 !! end
908
909 # <strike> is HTML4, <s> is HTML4/5.
910 !! test
911 <s> or <strike> for strikethrough
912 !! input
913 <strike>strike</strike>
914
915 <s>s</s>
916 !! result
917 <p><strike>strike</strike>
918 </p><p><s>s</s>
919 </p>
920 !! end
921
922 !! test
923 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
924 !! input
925 <b→> doesn't work! </b→>
926
927 <bä> doesn't work! </bä>
928
929 <boo> works fine </boo>
930
931 <s.foo>s.foo</s.foo>
932
933 <sub-ID#1>
934 !! result
935 <p>&lt;b→&gt; doesn't work! &lt;/b→&gt;
936 </p><p>&lt;bä&gt; doesn't work! &lt;/bä&gt;
937 </p><p>&lt;boo&gt; works fine &lt;/boo&gt;
938 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
939 </p><p>&lt;sub-ID#1&gt;
940 </p>
941 !! end
942
943 !! test
944 Isolated close tags should be treated as literal text (bug 52760)
945 !! input
946 </b>
947
948 <s.foo>s</s>
949 !! result
950 <p>&lt;/b&gt;
951 </p><p>&lt;s.foo&gt;s&lt;/s&gt;
952 </p>
953 !! end
954
955 ###
956 ### Special characters
957 ###
958
959 !! test
960 Bare pipe character (bug 52363)
961 !! input
962 |
963 !! result
964 <p>|
965 </p>
966 !! end
967
968 !! test
969 Bare pipe character from a template (bug 52363)
970 !! input
971 {{pipe}}
972 !! result
973 <p>|
974 </p>
975 !! end
976
977 ###
978 ### <nowiki> test cases
979 ###
980
981 !! test
982 <nowiki> unordered list
983 !! input
984 <nowiki>* This is not an unordered list item.</nowiki>
985 !! result
986 <p>* This is not an unordered list item.
987 </p>
988 !! end
989
990 !! test
991 <nowiki> spacing
992 !! input
993 <nowiki>Lorem ipsum dolor
994
995 sed abit.
996 sed nullum.
997
998 :and a colon
999 </nowiki>
1000 !! result
1001 <p>Lorem ipsum dolor
1002
1003 sed abit.
1004 sed nullum.
1005
1006 :and a colon
1007
1008 </p>
1009 !! end
1010
1011 !! test
1012 nowiki 3
1013 !! input
1014 :There is not nowiki.
1015 :There is <nowiki>nowiki</nowiki>.
1016
1017 #There is not nowiki.
1018 #There is <nowiki>nowiki</nowiki>.
1019
1020 *There is not nowiki.
1021 *There is <nowiki>nowiki</nowiki>.
1022 !! result
1023 <dl>
1024 <dd>There is not nowiki.
1025 </dd>
1026 <dd>There is nowiki.
1027 </dd>
1028 </dl>
1029 <ol>
1030 <li>There is not nowiki.
1031 </li>
1032 <li>There is nowiki.
1033 </li>
1034 </ol>
1035 <ul>
1036 <li>There is not nowiki.
1037 </li>
1038 <li>There is nowiki.
1039 </li>
1040 </ul>
1041
1042 !! end
1043
1044 !! test
1045 Entities inside <nowiki>
1046 !! input
1047 <nowiki>&lt;</nowiki>
1048 !! result
1049 <p>&lt;
1050 </p>
1051 !! end
1052
1053 !! test
1054 Entities inside template parameters
1055 !! options
1056 parsoid
1057 !! input
1058 {{echo|&ndash;}}
1059 !! result
1060 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span>
1061 </p>
1062 !! end
1063
1064 ###
1065 ### Comments
1066 ###
1067 !! test
1068 Comments and Indent-Pre
1069 !! input
1070 <!-- comment 1 --> asdf
1071
1072 <!-- comment 1 --> asdf
1073 <!-- comment 2 -->
1074
1075 <!-- comment 1 --> asdf
1076 <!-- comment 2 -->xyz
1077
1078 <!-- comment 1 --> asdf
1079 <!-- comment 2 --> xyz
1080 !! result
1081 <pre>asdf
1082 </pre>
1083 <pre>asdf
1084 </pre>
1085 <pre>asdf
1086 </pre>
1087 <p>xyz
1088 </p>
1089 <pre>asdf
1090 xyz
1091 </pre>
1092 !! end
1093
1094 !! test
1095 Comment test 2a
1096 !! input
1097 asdf
1098 <!-- comment 1 -->
1099 jkl
1100 !! result
1101 <p>asdf
1102 jkl
1103 </p>
1104 !! end
1105
1106 !! test
1107 Comment test 2b
1108 !! input
1109 asdf
1110 <!-- comment 1 -->
1111
1112 jkl
1113 !! result
1114 <p>asdf
1115 </p><p>jkl
1116 </p>
1117 !! end
1118
1119 !! test
1120 Comment test 3
1121 !! input
1122 asdf
1123 <!-- comment 1 -->
1124 <!-- comment 2 -->
1125 jkl
1126 !! result
1127 <p>asdf
1128 jkl
1129 </p>
1130 !! end
1131
1132 !! test
1133 Comment test 4
1134 !! input
1135 asdf<!-- comment 1 -->jkl
1136 !! result
1137 <p>asdfjkl
1138 </p>
1139 !! end
1140
1141 !! test
1142 Comment spacing
1143 !! input
1144 a
1145 <!-- foo --> b <!-- bar -->
1146 c
1147 !! result
1148 <p>a
1149 </p>
1150 <pre> b
1151 </pre>
1152 <p>c
1153 </p>
1154 !! end
1155
1156 !! test
1157 Comment whitespace
1158 !! input
1159 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1160 !! result
1161
1162 !! end
1163
1164 !! test
1165 Comment semantics and delimiters
1166 !! input
1167 <!-- --><!----><!-----><!------>
1168 !! result
1169
1170 !! end
1171
1172 !! test
1173 Comment semantics and delimiters, redux
1174 !! input
1175 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1176 -- foo -- funky huh? ... -->
1177 !! result
1178
1179 !! end
1180
1181 !! test
1182 Comment semantics and delimiters: directors cut
1183 !! input
1184 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1185 everything starting with < followed by !-- until the first -- and > we see,
1186 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1187 -->-->
1188 !! result
1189 <p>--&gt;
1190 </p>
1191 !! end
1192
1193 !! test
1194 Comment semantics: nesting
1195 !! input
1196 <!--<!-- no, we're not going to do anything fancy here -->-->
1197 !! result
1198 <p>--&gt;
1199 </p>
1200 !! end
1201
1202 !! test
1203 Comment semantics: unclosed comment at end
1204 !! input
1205 <!--This comment will run out to the end of the document
1206 !! result
1207
1208 !! end
1209
1210 !! test
1211 Comment in template title
1212 !! input
1213 {{f<!---->oo}}
1214 !! result
1215 <p>FOO
1216 </p>
1217 !! end
1218
1219 !! test
1220 Comment on its own line post-expand
1221 !! input
1222 a
1223 {{blank}}<!---->
1224 b
1225 !! result
1226 <p>a
1227 </p><p>b
1228 </p>
1229 !! end
1230
1231 !! test
1232 Comment on its own line post-expand with non-significant whitespace
1233 !! input
1234 a
1235 {{blank}} <!---->
1236 b
1237 !! result
1238 <p>a
1239 </p><p>b
1240 </p>
1241 !! end
1242
1243 ###
1244 ### paragraph wrapping tests
1245 ###
1246 !! test
1247 No block tags
1248 !! input
1249 a
1250
1251 b
1252 !! result
1253 <p>a
1254 </p><p>b
1255 </p>
1256 !! end
1257
1258 !! test
1259 Block tag on one line (<div>)
1260 !! input
1261 a <div>foo</div>
1262
1263 b
1264 !! result
1265 a <div>foo</div>
1266 <p>b
1267 </p>
1268 !! end
1269
1270 !! test
1271 Block tag on one line (<blockquote>)
1272 !! input
1273 a <blockquote>foo</blockquote>
1274
1275 b
1276 !! result
1277 a <blockquote>foo</blockquote>
1278 <p>b
1279 </p>
1280 !! end
1281
1282 !! test
1283 Block tag on both lines (<div>)
1284 !! input
1285 a <div>foo</div>
1286
1287 b <div>foo</div>
1288 !! result
1289 a <div>foo</div>
1290 b <div>foo</div>
1291
1292 !! end
1293
1294 !! test
1295 Block tag on both lines (<blockquote>)
1296 !! input
1297 a <blockquote>foo</blockquote>
1298
1299 b <blockquote>foo</blockquote>
1300 !! result
1301 a <blockquote>foo</blockquote>
1302 b <blockquote>foo</blockquote>
1303
1304 !! end
1305
1306 !! test
1307 Multiple lines without block tags
1308 !! input
1309 <div>foo</div> a
1310 b
1311 c
1312 d<!--foo--> e
1313 x <div>foo</div> z
1314 !! result
1315 <div>foo</div> a
1316 <p>b
1317 c
1318 d e
1319 </p>
1320 x <div>foo</div> z
1321
1322 !! end
1323
1324 !! test
1325 Empty lines between lines with block tags
1326 !! input
1327 <div></div>
1328
1329
1330 <div></div>a
1331
1332 b
1333 <div>a</div>b
1334
1335 <div>b</div>d
1336
1337
1338 <div>e</div>
1339 !! result
1340 <div></div>
1341 <p><br />
1342 </p>
1343 <div></div>a
1344 <p>b
1345 </p>
1346 <div>a</div>b
1347 <div>b</div>d
1348 <p><br />
1349 </p>
1350 <div>e</div>
1351
1352 !! end
1353
1354 ## PHP parser emits output which is broken
1355 !! test
1356 Unclosed HTML p-tags should be handled properly
1357 !! options
1358 parsoid
1359 !! input
1360 <div><p>foo</div>
1361 a
1362
1363 b
1364 !! result
1365 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1366 <p>a</p>
1367 <p>b</p>
1368 !! end
1369
1370 ###
1371 ### Preformatted text
1372 ###
1373 !! test
1374 Preformatted text
1375 !! input
1376 This is some
1377 Preformatted text
1378 With ''italic''
1379 And '''bold'''
1380 And a [[Main Page|link]]
1381 !! result
1382 <pre>This is some
1383 Preformatted text
1384 With <i>italic</i>
1385 And <b>bold</b>
1386 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1387 </pre>
1388 !! end
1389
1390 !! test
1391 Tabs don't trigger preformatted text
1392 !! input
1393 This is not
1394 preformatted text.
1395 This is preformatted text.
1396 So is this.
1397 !! result
1398 <p> This is not
1399 preformatted text.
1400 </p>
1401 <pre>This is preformatted text.
1402 So is this.
1403 </pre>
1404 !! end
1405
1406 !! test
1407 Ident preformatting with inline content
1408 !! input
1409 a
1410 ''b''
1411 !! result
1412 <pre>a
1413 <i>b</i>
1414 </pre>
1415 !! end
1416
1417 !! test
1418 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1419 !! input
1420 <pre><nowiki>
1421 <b>
1422 <cite>
1423 <em>
1424 </nowiki></pre>
1425 !! result
1426 <pre>
1427 &lt;b&gt;
1428 &lt;cite&gt;
1429 &lt;em&gt;
1430 </pre>
1431
1432 !! end
1433
1434 !! test
1435 Regression with preformatted in <center>
1436 !! input
1437 <center>
1438 Blah
1439 </center>
1440 !! result
1441 <center>
1442 <pre>Blah
1443 </pre>
1444 </center>
1445
1446 !! end
1447
1448 !! test
1449 Bug 52763: Preformatted in <blockquote>
1450 !! input
1451 <blockquote>
1452 Blah
1453 {|
1454 |
1455 indented cell (no pre-wrapping!)
1456 |}
1457 </blockquote>
1458 !! result
1459 <blockquote>
1460 <p> Blah
1461 </p>
1462 <table>
1463 <tr>
1464 <td>
1465 <p> indented cell (no pre-wrapping!)
1466 </p>
1467 </td></tr></table>
1468 </blockquote>
1469
1470 !! end
1471
1472 !! test
1473 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1474 !! input
1475 <blockquote>
1476 Foo
1477
1478 Bar
1479 </blockquote>
1480 !! result
1481 <blockquote>
1482 <p>Foo
1483 </p><p>Bar
1484 </p>
1485 </blockquote>
1486
1487 !! end
1488
1489 !! test
1490 Bug 15491: <ins>/<del> in blockquote
1491 !! input
1492 <blockquote>
1493 Foo <del>bar</del> <ins>baz</ins> quux
1494 </blockquote>
1495 !! result
1496 <blockquote>
1497 <p>Foo <del>bar</del> <ins>baz</ins> quux
1498 </p>
1499 </blockquote>
1500
1501 !! end
1502
1503 # Note that the p-wrapping is newline sensitive, which could be
1504 # considered a bug: tidy will wrap only the 'Foo' in the example
1505 # below in a <p> tag. (see comment 23-25 of bug #6200)
1506 !! test
1507 Bug 15491: <ins>/<del> in blockquote (2)
1508 !! input
1509 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1510 </blockquote>
1511 !! result
1512 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1513 </blockquote>
1514
1515 !! end
1516
1517 !! test
1518 <pre> with attributes (bug 3202)
1519 !! input
1520 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1521 !! result
1522 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1523
1524 !! end
1525
1526 !! test
1527 <pre> with width attribute (bug 3202)
1528 !! input
1529 <pre width="8">Narrow screen goodies</pre>
1530 !! result
1531 <pre width="8">Narrow screen goodies</pre>
1532
1533 !! end
1534
1535 !! test
1536 <pre> with forbidden attribute (bug 3202)
1537 !! input
1538 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1539 !! result
1540 <pre width="8">Narrow screen goodies</pre>
1541
1542 !! end
1543
1544 !! test
1545 Entities inside <pre>
1546 !! input
1547 <pre>&lt;</pre>
1548 !! result
1549 <pre>&lt;</pre>
1550
1551 !! end
1552
1553 !! test
1554 <pre> with forbidden attribute values (bug 3202)
1555 !! input
1556 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1557 !! result
1558 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1559
1560 !! end
1561
1562 !! test
1563 <nowiki> inside <pre> (bug 13238)
1564 !! input
1565 <pre>
1566 <nowiki>
1567 </pre>
1568 <pre>
1569 <nowiki></nowiki>
1570 </pre>
1571 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1572 !! result
1573 <pre>
1574 &lt;nowiki&gt;
1575 </pre>
1576 <pre>
1577
1578 </pre>
1579 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1580
1581 !! end
1582
1583 !! test
1584 <nowiki> and <pre> preference (first one wins)
1585 !! input
1586 <pre>
1587 <nowiki>
1588 </pre>
1589 </nowiki>
1590 </pre>
1591
1592 <nowiki>
1593 <pre>
1594 <nowiki>
1595 </pre>
1596 </nowiki>
1597 </pre>
1598
1599 !! result
1600 <pre>
1601 &lt;nowiki&gt;
1602 </pre>
1603 <p>&lt;/nowiki&gt;
1604 &lt;/pre&gt;
1605 </p><p>
1606 &lt;pre&gt;
1607 &lt;nowiki&gt;
1608 &lt;/pre&gt;
1609
1610 &lt;/pre&gt;
1611 </p>
1612 !! end
1613
1614 !! test
1615 </pre> inside nowiki
1616 !! input
1617 <nowiki></pre></nowiki>
1618 !! result
1619 <p>&lt;/pre&gt;
1620 </p>
1621 !! end
1622
1623 !! test
1624 Empty pre; pre inside other HTML tags (bug 54946)
1625 !! input
1626 a
1627
1628 <div><pre>
1629 foo
1630 </pre></div>
1631 <pre></pre>
1632 !! result
1633 <p>a
1634 </p>
1635 <div><pre>
1636 foo
1637 </pre></div>
1638 <pre></pre>
1639
1640 !! end
1641
1642 !! test
1643 HTML pre followed by indent-pre
1644 !! input
1645 <pre>foo</pre>
1646 bar
1647 !! result
1648 <pre>foo</pre>
1649 <pre>bar
1650 </pre>
1651 !! end
1652
1653 !!test
1654 Block tag pre
1655 !!options
1656 parsoid
1657 !!input
1658 <p><pre>foo</pre></p>
1659 !!result
1660 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
1661 !!end
1662
1663 !!test
1664 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1665 !!input
1666 {{echo|}}
1667 !!result
1668
1669 !!end
1670
1671 !!test
1672 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1673 !!input
1674 {{echo|
1675 foo}}
1676 !!result
1677 <p>foo
1678 </p>
1679 !!end
1680
1681 !! test
1682 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1683 !! input
1684 {{echo|a
1685 b}}
1686 !!result
1687 <pre>a
1688 </pre>
1689 <p>b
1690 </p>
1691 !!end
1692
1693 !! test
1694 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1695 !! input
1696 {{echo|a
1697 b
1698 c
1699 d
1700 e
1701 }}
1702 !!result
1703 <pre>a
1704 </pre>
1705 <p>b
1706 c
1707 </p>
1708 <pre>d
1709 </pre>
1710 <p>e
1711 </p>
1712 !!end
1713
1714 !!test
1715 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1716 !!input
1717 {{echo| foo}}
1718
1719 {{echo| foo}}{{echo| bar}}
1720
1721 {{echo| foo}}
1722 {{echo| bar}}
1723
1724 {{echo|<!--cmt--> foo}}
1725
1726 <!--cmt-->{{echo| foo}}
1727
1728 {{echo|{{echo| }}bar}}
1729 !!result
1730 <pre>foo
1731 </pre>
1732 <pre>foo bar
1733 </pre>
1734 <pre>foo
1735 bar
1736 </pre>
1737 <pre>foo
1738 </pre>
1739 <pre>foo
1740 </pre>
1741 <pre>bar
1742 </pre>
1743 !!end
1744
1745 !! test
1746 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1747 !! input
1748 {{echo| }}a
1749
1750 {{echo|
1751 }}a
1752
1753 {{echo|
1754 b}}
1755
1756 {{echo|a
1757 }}b
1758
1759 {{echo|a
1760 }} b
1761 !!result
1762 <pre>a
1763 </pre>
1764 <p><br />
1765 </p>
1766 <pre>a
1767 </pre>
1768 <p><br />
1769 </p>
1770 <pre>b
1771 </pre>
1772 <p>a
1773 </p>
1774 <pre>b
1775 </pre>
1776 <p>a
1777 </p>
1778 <pre>b
1779 </pre>
1780 !!end
1781
1782 !! test
1783 Things that look like <pre> tags aren't treated as such
1784 !! input
1785 Barack Obama <President> of the United States
1786 !! result
1787 <p>Barack Obama &lt;President&gt; of the United States
1788 </p>
1789 !! end
1790
1791 !! test
1792 Parsoid: handle pre with space after attribute
1793 !! options
1794 parsoid=wt2html
1795 !! input
1796 <pre style="width:50%;" >{{echo|foo}}</pre>
1797 !! result
1798 <pre style="width:50%;">{{echo|foo}}</pre>
1799 !! end
1800
1801 # TODO / maybe: fix wt2wt for this
1802 !! test
1803 Parsoid: Don't paragraph-wrap fosterable content
1804 !! options
1805 parsoid=wt2html
1806 !! input
1807 {|
1808 <td></td>
1809 <td></td>
1810
1811
1812
1813 |}
1814 !! result
1815 <table>
1816
1817 <tbody>
1818 <tr>
1819 <td></td>
1820
1821 <td></td></tr>
1822
1823
1824
1825 </tbody></table>
1826 !! end
1827
1828 !! test
1829 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
1830 !! options
1831 parsoid=wt2html
1832 !! input
1833 {|
1834 <td>
1835 <td>
1836 </td>
1837
1838
1839
1840 |}
1841 !! result
1842 <table>
1843
1844 <tbody>
1845 <tr>
1846 <td></td>
1847
1848 <td>
1849 </td></tr>
1850
1851
1852
1853 </tbody></table>
1854 !! end
1855
1856
1857 #--------------------------------------------------------------------
1858 # Transclusion parameter whitespace stripping tests
1859 # Behavior is different for positional and named parameters
1860 #--------------------------------------------------------------------
1861 !! test
1862 Templates: Strip leading and trailing whitespace from named-param values
1863 !! input
1864 {{echo|1= a }}
1865
1866 {{echo|1= {{echo|b}} }}
1867
1868 {{echo| 1 =
1869 c }}
1870
1871 {{echo| 1 =
1872 * d
1873 }}
1874 !! result
1875 <p>a
1876 </p><p>b
1877 </p><p>c
1878 </p>
1879 <ul>
1880 <li> d
1881 </li>
1882 </ul>
1883
1884 !! end
1885
1886 !! test
1887 Templates: Don't strip whitespace from positional-param values
1888 !! input
1889 {{echo|a }}
1890
1891 {{echo|{{echo|b}} }}
1892
1893 {{echo| c
1894 }}
1895
1896 {{echo| {{echo|d}}
1897 }}
1898
1899 {{echo|
1900 e}}
1901
1902 {{echo|
1903 * f}}
1904
1905 {{echo|
1906 }}g
1907 !! result
1908 <p>a
1909 </p><p>b
1910 </p>
1911 <pre>c
1912 </pre>
1913 <p><br />
1914 </p>
1915 <pre>d
1916 </pre>
1917 <p><br />
1918 </p>
1919 <pre>e
1920 </pre>
1921 <p><br />
1922 </p>
1923 <ul>
1924 <li> f
1925 </li>
1926 </ul>
1927 <p><br />
1928 </p>
1929 <pre>g
1930 </pre>
1931 !! end
1932
1933 !! test
1934 Templates: Handle empty comment-and-ws-only lines correctly
1935 !! input
1936 {{echo|foo
1937 <!--should be ignored-->
1938 <!--should be ignored as well-->
1939 bar}}
1940 !! result
1941 <p>foo
1942 bar
1943 </p>
1944 !! end
1945
1946 #--------------------------------------------------------------------
1947 # Transclusion parameter escaping tests
1948 #--------------------------------------------------------------------
1949 !! test
1950 Templates: Parsoid parameter escaping test 1
1951 !! options
1952 parsoid
1953 !! input
1954 {{echo|[foo]|{{echo|[bar]}}}}
1955 !! result
1956 <p about="#mwt1" typeof="mw:Transclusion"
1957 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
1958 !! end
1959
1960 !! test
1961 Parsoid: Pipes in external links in template parameter
1962 !! options
1963 parsoid
1964 !! input
1965 {{echo|[{{echo|http://example.com}} link]}}
1966 !! result
1967 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
1968 !! end
1969
1970 !! test
1971 Parsoid: pipe in transclusion parameter
1972 !! options
1973 parsoid
1974 !! input
1975 {{echo|http://foo.com/a&#124;b}}
1976 !! result
1977 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1978 typeof="mw:Transclusion"
1979 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a|b</a></p>
1980 !! end
1981
1982 !! test
1983 Parsoid: Pipe in external link target and content in template parameter
1984 !! options
1985 parsoid=html2wt,wt2wt
1986 !! input
1987 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
1988 !! result
1989 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1990 typeof="mw:Transclusion"
1991 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
1992 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
1993 !! end
1994
1995 !! test
1996 Templates: Don't escape already nowiki-escaped text in template parameters
1997 !! options
1998 parsoid=html2wt,wt2wt
1999 !! input
2000 {{echo|foo<nowiki>|</nowiki>bar}}
2001 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2002 {{echo|<nowiki></nowiki>}}
2003 !! result
2004 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
2005 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
2006 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
2007 </p>
2008 !! end
2009
2010 ## Bug 52824
2011 !! test
2012 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2013 !! options
2014 parsoid=html2wt,wt2wt
2015 !! input
2016 {{echo|{{echo|1=bar}}}}
2017 !! result
2018 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
2019 !! end
2020
2021 ## Bug 56733
2022 !! test
2023 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2024 !! options
2025 parsoid
2026 !! input
2027 {{echo|a : b}}
2028 !! result
2029 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
2030 !! end
2031
2032 ###
2033 ### Parsoid-centric tests for testing RT edge cases for pre
2034 ###
2035
2036 !!test
2037 1a. Indent-Pre and Comments
2038 !!input
2039 a
2040 <!--a-->
2041 c
2042 !!result
2043 <pre>a
2044 </pre>
2045 <p>c
2046 </p>
2047 !!end
2048
2049 !!test
2050 1b. Indent-Pre and Comments
2051 !!input
2052 a
2053 <!--a-->
2054 c
2055 !!result
2056 <pre>a
2057 </pre>
2058 <p>c
2059 </p>
2060 !!end
2061
2062 !!test
2063 1c. Indent-Pre and Comments
2064 !!input
2065 <!--a--> a
2066
2067 <!--a--> a
2068 !!result
2069 <pre> a
2070 </pre>
2071 <pre> a
2072 </pre>
2073 !!end
2074
2075 !!test
2076 1d. Indent-Pre and Comments
2077 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2078 !!input
2079 <!--a--> a
2080
2081 <!--b-->b
2082 !!result
2083 <pre>a
2084 </pre>
2085 <pre>b
2086 </pre>
2087 !!end
2088
2089 !!test
2090 2a. Indent-Pre and tables
2091 !!input
2092 {|
2093 |-
2094 !h1!!h2
2095 |foo||bar
2096 |}
2097 !!result
2098 <table>
2099
2100 <tr>
2101 <th>h1</th>
2102 <th>h2
2103 </th>
2104 <td>foo</td>
2105 <td>bar
2106 </td></tr></table>
2107
2108 !!end
2109
2110 !!test
2111 2b. Indent-Pre and tables
2112 !!input
2113 {|
2114 |-
2115 |foo
2116 |}
2117 !!result
2118 <table>
2119
2120 <tr>
2121 <td>foo
2122 </td></tr></table>
2123
2124 !!end
2125
2126 !!test
2127 2c. Indent-Pre and tables (bug 42252)
2128 !!input
2129 {|
2130 |+ foo
2131 ! | bar
2132 |}
2133 !!result
2134 <table>
2135 <caption> foo
2136 </caption>
2137 <tr>
2138 <th> bar
2139 </th></tr></table>
2140
2141 !!end
2142
2143 !!test
2144 3a. Indent-Pre and block tags (single-line html)
2145 !!input
2146 a <p> foo </p>
2147 b <div> foo </div>
2148 c <blockquote> foo </blockquote>
2149 <span> foo </span>
2150 !!result
2151 a <p> foo </p>
2152 b <div> foo </div>
2153 c <blockquote> foo </blockquote>
2154 <pre><span> foo </span>
2155 </pre>
2156 !!end
2157
2158 !!test
2159 3b. Indent-Pre and block tags (multi-line html)
2160 !!input
2161 a <span>foo</span>
2162 b <div> foo </div>
2163 !!result
2164 <pre>a <span>foo</span>
2165 </pre>
2166 b <div> foo </div>
2167
2168 !!end
2169
2170 !!test
2171 3c. Indent-Pre and block tags (pre-content on separate line)
2172 !!input
2173 <p>
2174 foo
2175 </p>
2176
2177 <div>
2178 foo
2179 </div>
2180
2181 <center>
2182 foo
2183 </center>
2184
2185 <blockquote>
2186 foo
2187 </blockquote>
2188
2189 <blockquote>
2190 <pre>
2191 foo
2192 </pre>
2193 </blockquote>
2194
2195 <table><tr><td>
2196 foo
2197 </td></tr></table>
2198
2199 <ul><li>
2200 foo
2201 </li></ul>
2202
2203 !!result
2204 <p>
2205 foo
2206 </p>
2207 <div>
2208 <pre>foo
2209 </pre>
2210 </div>
2211 <center>
2212 <pre>foo
2213 </pre>
2214 </center>
2215 <blockquote>
2216 <p> foo
2217 </p>
2218 </blockquote>
2219 <blockquote>
2220 <pre>
2221 foo
2222 </pre>
2223 </blockquote>
2224 <table><tr><td>
2225 <pre>foo
2226 </pre>
2227 </td></tr></table>
2228 <ul><li>
2229 foo
2230 </li></ul>
2231
2232 !!end
2233
2234 !!test
2235 4. Indent-Pre and extension tags
2236 !!input
2237 a <gallery>
2238 File:foobar.jpg
2239 </gallery>
2240 !!result
2241 a <ul class="gallery mw-gallery-traditional">
2242 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2243 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
2244 <div class="gallerytext">
2245 </div>
2246 </div></li>
2247 </ul>
2248
2249 !!end
2250
2251 !! test
2252 Leading pipes outside of tables
2253 !! options
2254 parsoid
2255 !! input
2256 | foo
2257 !! result
2258 <p>| foo</p>
2259 !! end
2260
2261 !! test
2262 Leading pipes outside of tables 2
2263 !! options
2264 parsoid
2265 !! input
2266 a
2267 | foo
2268 b
2269 !! result
2270 <p>a
2271 | foo
2272 b</p>
2273 !! end
2274
2275 !! test
2276 Leading pipes outside of tables 3
2277 !! options
2278 parsoid
2279 !! input
2280 a
2281 | class="foo bar" | baz
2282 b
2283 !! result
2284 <p>a
2285 | class="foo bar" | baz
2286 b</p>
2287 !! end
2288
2289 !!test
2290 Render paragraphs when indent-pre is suppressed in blocklevels
2291 !!input
2292 <blockquote>
2293 foo
2294
2295 bar
2296 </blockquote>
2297 !! result
2298 <blockquote>
2299 <p> foo
2300 </p><p> bar
2301 </p>
2302 </blockquote>
2303
2304 !!end
2305
2306 !!test
2307 4. Multiple spaces at start-of-line
2308 !!input
2309 <p> foo </p>
2310 foo
2311 {|
2312 |foo
2313 |}
2314 !!result
2315 <p> foo </p>
2316 <pre> foo
2317 </pre>
2318 <table>
2319 <tr>
2320 <td>foo
2321 </td></tr></table>
2322
2323 !!end
2324
2325 ## NOTE: the leading white-space chars on empty line are significant
2326 !! test
2327 5a. White-space in indent-pre
2328 !! input
2329 a<br />
2330
2331 b
2332 !! result
2333 <pre>a<br />
2334
2335 b
2336 </pre>
2337 !! end
2338
2339 ## NOTE: the leading white-space chars on empty line are significant
2340 !! test
2341 5b. White-space in indent-pre
2342 !! input
2343 a
2344
2345 b
2346
2347
2348 c
2349 !! result
2350 <pre>a
2351
2352 b
2353
2354
2355 c
2356 </pre>
2357 !! end
2358
2359 !! test
2360 5c. White-space in indent-pre
2361 !! input
2362 ''a''
2363 ''b''
2364 ''c''
2365 !! result
2366 <pre><i>a</i>
2367 <i>b</i>
2368 <i>c</i>
2369 </pre>
2370 !! end
2371
2372 !! test
2373 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2374 !! input
2375 a
2376
2377 <!-- continue -->
2378 b
2379
2380 c
2381
2382 d
2383 !! result
2384 <pre>a
2385
2386 b
2387 </pre>
2388 <pre>c
2389
2390 </pre>
2391 <p>d
2392 </p>
2393 !! end
2394
2395 !! test
2396 7a. Indent-pre and category links
2397 !! options
2398 parsoid=wt2html,wt2wt
2399 !! input
2400 [[Category:foo]] <!-- No pre-wrapping -->
2401 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2402 !! result
2403 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
2404 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span>
2405 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
2406 !! end
2407
2408 !! test
2409 7b. Indent-pre and category links
2410 !! options
2411 parsoid=wt2html,wt2wt
2412 !! input
2413 [[Category:foo]] a
2414 [[Category:foo]] {{echo|b}}
2415 !! result
2416 <pre>
2417 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
2418
2419 <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
2420 !! end
2421
2422 ###
2423 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2424 ###
2425
2426 !!test
2427 HTML-pre: 1. embedded newlines
2428 !!input
2429 <pre>foo</pre>
2430
2431 <pre>
2432 foo
2433 </pre>
2434
2435 <pre>
2436
2437 foo
2438 </pre>
2439
2440 <pre>
2441
2442
2443 foo
2444 </pre>
2445 !!result
2446 <pre>foo</pre>
2447 <pre>
2448 foo
2449 </pre>
2450 <pre>
2451
2452 foo
2453 </pre>
2454 <pre>
2455
2456
2457 foo
2458 </pre>
2459
2460 !!end
2461
2462 !!test
2463 HTML-pre: 2: indented text
2464 !!input
2465 <pre>
2466 foo
2467 </pre>
2468 !!result
2469 <pre>
2470 foo
2471 </pre>
2472
2473 !!end
2474
2475 !!test
2476 HTML-pre: 3: other wikitext
2477 !!input
2478 <pre>
2479 * foo
2480 # bar
2481 = no-h =
2482 '' no-italic ''
2483 [[ NoLink ]]
2484 </pre>
2485 !!result
2486 <pre>
2487 * foo
2488 # bar
2489 = no-h =
2490 '' no-italic ''
2491 [[ NoLink ]]
2492 </pre>
2493
2494 !!end
2495
2496 ###
2497 ### Definition lists
2498 ###
2499 !! test
2500 Simple definition
2501 !! input
2502 ; name : Definition
2503 !! result
2504 <dl>
2505 <dt> name&#160;</dt>
2506 <dd> Definition
2507 </dd>
2508 </dl>
2509
2510 !! end
2511
2512 !! test
2513 Definition list for indentation only
2514 !! input
2515 : Indented text
2516 !! result
2517 <dl>
2518 <dd> Indented text
2519 </dd>
2520 </dl>
2521
2522 !! end
2523
2524 !! test
2525 Definition list with no space
2526 !! input
2527 ;name:Definition
2528 !! result
2529 <dl>
2530 <dt>name</dt>
2531 <dd>Definition
2532 </dd>
2533 </dl>
2534
2535 !!end
2536
2537 !! test
2538 Definition list with URL link
2539 !! input
2540 ; http://example.com/ : definition
2541 !! result
2542 <dl>
2543 <dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
2544 <dd> definition
2545 </dd>
2546 </dl>
2547
2548 !! end
2549
2550 !! test
2551 Definition list with bracketed URL link
2552 !! input
2553 ;[http://www.example.com/ Example]:Something about it
2554 !! result
2555 <dl>
2556 <dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
2557 <dd>Something about it
2558 </dd>
2559 </dl>
2560
2561 !! end
2562
2563 !! test
2564 Definition list with wikilink containing colon
2565 !! input
2566 ; [[Help:FAQ]]: The least-read page on Wikipedia
2567 !! result
2568 <dl>
2569 <dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
2570 <dd> The least-read page on Wikipedia
2571 </dd>
2572 </dl>
2573
2574 !! end
2575
2576 # At Brion's and JeLuF's insistence... :)
2577 !! test
2578 Definition list with news link containing colon
2579 !! input
2580 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
2581 !! result
2582 <dl>
2583 <dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
2584 <dd> This isn't even a real newsgroup!
2585 </dd>
2586 </dl>
2587
2588 !! end
2589
2590 !! test
2591 Malformed definition list with colon
2592 !! input
2593 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2594 !! result
2595 <dl>
2596 <dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop
2597 </dt>
2598 </dl>
2599
2600 !! end
2601
2602 !! test
2603 Definition lists: colon in external link text
2604 !! input
2605 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2606 !! result
2607 <dl>
2608 <dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
2609 <dd> OK, I made that up
2610 </dd>
2611 </dl>
2612
2613 !! end
2614
2615 !! test
2616 Definition lists: colon in HTML attribute
2617 !! input
2618 ;<b style="display: inline">bold</b>
2619 !! result
2620 <dl>
2621 <dt><b style="display: inline">bold</b>
2622 </dt>
2623 </dl>
2624
2625 !! end
2626
2627 !! test
2628 Definition lists: self-closed tag
2629 !! input
2630 ;one<br/>two : two-line fun
2631 !! result
2632 <dl>
2633 <dt>one<br />two&#160;</dt>
2634 <dd> two-line fun
2635 </dd>
2636 </dl>
2637
2638 !! end
2639
2640 !! test
2641 Bug 11748: Literal closing tags
2642 !! input
2643 <dl>
2644 <dt>test 1</dt>
2645 <dd>test test test test test</dd>
2646 <dt>test 2</dt>
2647 <dd>test test test test test</dd>
2648 </dl>
2649 !! result
2650 <dl>
2651 <dt>test 1</dt>
2652 <dd>test test test test test</dd>
2653 <dt>test 2</dt>
2654 <dd>test test test test test</dd>
2655 </dl>
2656
2657 !! end
2658
2659 !! test
2660 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2661 !! input
2662 <ul><li>
2663 ; term : description
2664 * unordered
2665 </li></ul>
2666 !! result
2667 <ul><li>
2668 <dl>
2669 <dt> term&#160;</dt>
2670 <dd> description
2671 </dd>
2672 </dl>
2673 <ul>
2674 <li> unordered
2675 </li>
2676 </ul>
2677 </li></ul>
2678
2679 !! end
2680
2681 !! test
2682
2683 Definition list with empty definition and following paragraph
2684 !! input
2685 ; term:
2686 Paragraph text
2687 !! result
2688 <dl>
2689 <dt> term</dt>
2690 <dd>
2691 </dd>
2692 </dl>
2693 <p>Paragraph text
2694 </p>
2695 !! end
2696
2697 !! test
2698 Nested definition lists using html syntax
2699 !! input
2700 <dl><dd>
2701 <dl>
2702 <dd>Foo</dd>
2703 </dl>
2704 </dd></dl>
2705 !! result
2706 <dl><dd>
2707 <dl>
2708 <dd>Foo</dd>
2709 </dl>
2710 </dd></dl>
2711
2712 !! end
2713
2714 !! test
2715 Definition Lists: No nesting: Multiple dd's
2716 !! input
2717 ;x
2718 :a
2719 :b
2720 !! result
2721 <dl>
2722 <dt>x
2723 </dt>
2724 <dd>a
2725 </dd>
2726 <dd>b
2727 </dd>
2728 </dl>
2729
2730 !! end
2731
2732 !! test
2733 Definition Lists: Indentation: Regular
2734 !! input
2735 :i1
2736 ::i2
2737 :::i3
2738 !! result
2739 <dl>
2740 <dd>i1
2741 <dl>
2742 <dd>i2
2743 <dl>
2744 <dd>i3
2745 </dd>
2746 </dl>
2747 </dd>
2748 </dl>
2749 </dd>
2750 </dl>
2751
2752 !! end
2753
2754 !! test
2755 Definition Lists: Indentation: Missing 1st level
2756 !! input
2757 ::i2
2758 :::i3
2759 !! result
2760 <dl>
2761 <dd><dl>
2762 <dd>i2
2763 <dl>
2764 <dd>i3
2765 </dd>
2766 </dl>
2767 </dd>
2768 </dl>
2769 </dd>
2770 </dl>
2771
2772 !! end
2773
2774 !! test
2775 Definition Lists: Indentation: Multi-level indent
2776 !! input
2777 :::i3
2778 !! result
2779 <dl>
2780 <dd><dl>
2781 <dd><dl>
2782 <dd>i3
2783 </dd>
2784 </dl>
2785 </dd>
2786 </dl>
2787 </dd>
2788 </dl>
2789
2790 !! end
2791
2792 !! test
2793 Definition Lists: Hacky use to indent tables
2794 !! input
2795 ::{|
2796 |foo
2797 |bar
2798 |}
2799 this text
2800 should be left alone
2801 !! result
2802 <dl><dd><dl><dd><table>
2803 <tr>
2804 <td>foo
2805 </td>
2806 <td>bar
2807 </td></tr></table></dd></dl></dd></dl>
2808 <p>this text
2809 should be left alone
2810 </p>
2811 !! end
2812
2813 # Bug 52473
2814 !! test
2815 Definition Lists: Hacky use to indent tables (WS-insensitive)
2816 !! options
2817 parsoid
2818 !! input
2819 : {|
2820 |a
2821 |}
2822 !! result
2823 <dl>
2824 <dd> <table><tr><td>a</td></tr></table> </dd>
2825 </dl>
2826 !! end
2827 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2828 ## as an empty dt item. It also ignores all but the last ";" when followed
2829 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2830 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2831 ## ";"s.
2832 ##
2833 ## Ex: ";;t2 ::d2" is transformed into:
2834 ##
2835 ## <dl>
2836 ## <dt>t2 </dt>
2837 ## <dd>
2838 ## <dl>
2839 ## <dt></dt>
2840 ## <dd>d2</dd>
2841 ## </dl>
2842 ## </dd>
2843 ## </dl>
2844 ##
2845 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2846 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2847 ##
2848 ## <dl>
2849 ## <dt>
2850 ## <dl>
2851 ## <dt>t2 </dt>
2852 ## <dd>:d2</dd>
2853 ## </dl>
2854 ## </dt>
2855 ## </dl>
2856 ##
2857 ## All Parsoid only definition list tests have this difference.
2858 ##
2859 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2860 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2861
2862 !! test
2863 Table / list interaction: indented table with lists in table contents
2864 !! input
2865 :{|
2866 |-
2867 | a
2868 * b
2869 |-
2870 | c
2871 * d
2872 |}
2873 !! result
2874 <dl><dd><table>
2875
2876 <tr>
2877 <td> a
2878 <ul>
2879 <li> b
2880 </li>
2881 </ul>
2882 </td></tr>
2883 <tr>
2884 <td> c
2885 <ul>
2886 <li> d
2887 </li>
2888 </ul>
2889 </td></tr></table></dd></dl>
2890
2891 !! end
2892
2893 !!test
2894 Table / list interaction: lists nested in tables nested in indented lists
2895 !!input
2896 :{|
2897 |
2898 :a
2899 :b
2900 |
2901 *c
2902 *d
2903 |}
2904
2905 *e
2906 *f
2907 !!result
2908 <dl><dd><table>
2909 <tr>
2910 <td>
2911 <dl>
2912 <dd>a
2913 </dd>
2914 <dd>b
2915 </dd>
2916 </dl>
2917 </td>
2918 <td>
2919 <ul>
2920 <li>c
2921 </li>
2922 <li>d
2923 </li>
2924 </ul>
2925 </td></tr></table></dd></dl>
2926 <ul>
2927 <li>e
2928 </li>
2929 <li>f
2930 </li>
2931 </ul>
2932
2933 !!end
2934
2935 !! test
2936 Definition Lists: Nesting: Multi-level (Parsoid only)
2937 !! options
2938 parsoid
2939 !! input
2940 ;t1 :d1
2941 ;;t2 ::d2
2942 ;;;t3 :::d3
2943 !! result
2944 <dl>
2945 <dt>t1 </dt>
2946 <dd>d1</dd>
2947 <dt>
2948 <dl>
2949 <dt>t2 </dt>
2950 <dd>:d2</dd>
2951 <dt>
2952 <dl>
2953 <dt>t3 </dt>
2954 <dd>::d3</dd>
2955 </dl>
2956 </dt>
2957 </dl>
2958 </dt>
2959 </dl>
2960
2961
2962 !! end
2963
2964
2965 !! test
2966 Definition Lists: Nesting: Test 2 (Parsoid only)
2967 !! options
2968 parsoid
2969 !! input
2970 ;t1
2971 ::d2
2972 !! result
2973 <dl>
2974 <dt>t1</dt>
2975 <dd>
2976 <dl>
2977 <dd>d2</dd>
2978 </dl>
2979 </dd>
2980 </dl>
2981
2982 !! end
2983
2984
2985 !! test
2986 Definition Lists: Nesting: Test 3 (Parsoid only)
2987 !! options
2988 parsoid
2989 !! input
2990 :;t1
2991 ::::d2
2992 !! result
2993 <dl>
2994 <dd>
2995 <dl>
2996 <dt>t1</dt>
2997 <dd>
2998 <dl>
2999 <dd>
3000 <dl>
3001 <dd>d2</dd>
3002 </dl>
3003 </dd>
3004 </dl>
3005 </dd>
3006 </dl>
3007 </dd>
3008 </dl>
3009
3010 !! end
3011
3012
3013 !! test
3014 Definition Lists: Nesting: Test 4
3015 !! input
3016 ::;t3
3017 :::d3
3018 !! result
3019 <dl>
3020 <dd><dl>
3021 <dd><dl>
3022 <dt>t3
3023 </dt>
3024 <dd>d3
3025 </dd>
3026 </dl>
3027 </dd>
3028 </dl>
3029 </dd>
3030 </dl>
3031
3032 !! end
3033
3034
3035 ## The Parsoid team believes the following three test exposes a
3036 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3037 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3038 !! test
3039 Definition Lists: Mixed Lists: Test 1 (php)
3040 !! options
3041 php
3042 !! input
3043 :;* foo
3044 ::* bar
3045 :; baz
3046 !! result
3047 <dl>
3048 <dd><dl>
3049 <dt><ul>
3050 <li> foo
3051 </li>
3052 <li> bar
3053 </li>
3054 </ul>
3055 </dt>
3056 </dl>
3057 <dl>
3058 <dt> baz
3059 </dt>
3060 </dl>
3061 </dd>
3062 </dl>
3063
3064 !! end
3065 !! test
3066 Definition Lists: Mixed Lists: Test 1 (parsoid)
3067 !! options
3068 parsoid
3069 !! input
3070 :;* foo
3071 ::* bar
3072 :; baz
3073 !! result
3074 <dl>
3075 <dd><dl>
3076 <dt><ul>
3077 <li> foo
3078 </li>
3079 </ul></dt>
3080 <dd><ul>
3081 <li> bar
3082 </li>
3083 </ul></dd>
3084 <dt> baz</dt>
3085 </dl></dd>
3086 </dl>
3087 !! end
3088
3089 !! test
3090 Definition Lists: Mixed Lists: Test 2
3091 !! input
3092 *: d1
3093 *: d2
3094 !! result
3095 <ul>
3096 <li><dl>
3097 <dd> d1
3098 </dd>
3099 <dd> d2
3100 </dd>
3101 </dl>
3102 </li>
3103 </ul>
3104
3105 !! end
3106
3107
3108 !! test
3109 Definition Lists: Mixed Lists: Test 3
3110 !! input
3111 *::: d1
3112 *::: d2
3113 !! result
3114 <ul>
3115 <li><dl>
3116 <dd><dl>
3117 <dd><dl>
3118 <dd> d1
3119 </dd>
3120 <dd> d2
3121 </dd>
3122 </dl>
3123 </dd>
3124 </dl>
3125 </dd>
3126 </dl>
3127 </li>
3128 </ul>
3129
3130 !! end
3131
3132
3133 !! test
3134 Definition Lists: Mixed Lists: Test 4
3135 !! input
3136 *;d1 :d2
3137 *;d3 :d4
3138 !! result
3139 <ul>
3140 <li><dl>
3141 <dt>d1&#160;</dt>
3142 <dd>d2
3143 </dd>
3144 <dt>d3&#160;</dt>
3145 <dd>d4
3146 </dd>
3147 </dl>
3148 </li>
3149 </ul>
3150
3151 !! end
3152
3153
3154 !! test
3155 Definition Lists: Mixed Lists: Test 5
3156 !! input
3157 *:d1
3158 *:: d2
3159 !! result
3160 <ul>
3161 <li><dl>
3162 <dd>d1
3163 <dl>
3164 <dd> d2
3165 </dd>
3166 </dl>
3167 </dd>
3168 </dl>
3169 </li>
3170 </ul>
3171
3172 !! end
3173
3174
3175 !! test
3176 Definition Lists: Mixed Lists: Test 6
3177 !! input
3178 #*:d1
3179 #*::: d3
3180 !! result
3181 <ol>
3182 <li><ul>
3183 <li><dl>
3184 <dd>d1
3185 <dl>
3186 <dd><dl>
3187 <dd> d3
3188 </dd>
3189 </dl>
3190 </dd>
3191 </dl>
3192 </dd>
3193 </dl>
3194 </li>
3195 </ul>
3196 </li>
3197 </ol>
3198
3199 !! end
3200
3201
3202 !! test
3203 Definition Lists: Mixed Lists: Test 7
3204 !! input
3205 :* d1
3206 :* d2
3207 !! result
3208 <dl>
3209 <dd><ul>
3210 <li> d1
3211 </li>
3212 <li> d2
3213 </li>
3214 </ul>
3215 </dd>
3216 </dl>
3217
3218 !! end
3219
3220
3221 !! test
3222 Definition Lists: Mixed Lists: Test 8
3223 !! input
3224 :* d1
3225 ::* d2
3226 !! result
3227 <dl>
3228 <dd><ul>
3229 <li> d1
3230 </li>
3231 </ul>
3232 <dl>
3233 <dd><ul>
3234 <li> d2
3235 </li>
3236 </ul>
3237 </dd>
3238 </dl>
3239 </dd>
3240 </dl>
3241
3242 !! end
3243
3244
3245 !! test
3246 Definition Lists: Mixed Lists: Test 9
3247 !! input
3248 *;foo :bar
3249 !! result
3250 <ul>
3251 <li><dl>
3252 <dt>foo&#160;</dt>
3253 <dd>bar
3254 </dd>
3255 </dl>
3256 </li>
3257 </ul>
3258
3259 !! end
3260
3261
3262 !! test
3263 Definition Lists: Mixed Lists: Test 10
3264 !! input
3265 *#;foo :bar
3266 !! result
3267 <ul>
3268 <li><ol>
3269 <li><dl>
3270 <dt>foo&#160;</dt>
3271 <dd>bar
3272 </dd>
3273 </dl>
3274 </li>
3275 </ol>
3276 </li>
3277 </ul>
3278
3279 !! end
3280
3281 # The Parsoid team disagrees with the PHP parser's seemingly-random
3282 # rules regarding dd/dt on the next two tests. Parsoid is more
3283 # consistent, and recognizes the shared nesting and keeps the
3284 # still-open tags around until the nesting is complete.
3285
3286 !! test
3287 Definition Lists: Mixed Lists: Test 11 (php)
3288 !! options
3289 php
3290 !! input
3291 *#*#;*;;foo :bar
3292 *#*#;boo :baz
3293 !! result
3294 <ul>
3295 <li><ol>
3296 <li><ul>
3297 <li><ol>
3298 <li><dl>
3299 <dt>foo&#160;</dt>
3300 <dd><ul>
3301 <li><dl>
3302 <dt><dl>
3303 <dt>bar
3304 </dt>
3305 </dl>
3306 </dd>
3307 </dl>
3308 </li>
3309 </ul>
3310 </dd>
3311 </dl>
3312 <dl>
3313 <dt>boo&#160;</dt>
3314 <dd>baz
3315 </dd>
3316 </dl>
3317 </li>
3318 </ol>
3319 </li>
3320 </ul>
3321 </li>
3322 </ol>
3323 </li>
3324 </ul>
3325
3326 !! end
3327 !! test
3328 Definition Lists: Mixed Lists: Test 11 (parsoid)
3329 !! options
3330 parsoid
3331 !! input
3332 *#*#;*;;foo :bar
3333 *#*#;boo :baz
3334 !! result
3335 <ul>
3336 <li>
3337 <ol>
3338 <li>
3339 <ul>
3340 <li>
3341 <ol>
3342 <li>
3343 <dl>
3344 <dt>
3345 <ul>
3346 <li>
3347 <dl>
3348 <dt>
3349 <dl>
3350 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3351 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3352 </dl></dt>
3353 </dl></li>
3354 </ul></dt>
3355 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3356 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3357 </dl></li>
3358 </ol></li>
3359 </ul></li>
3360 </ol></li>
3361 </ul>
3362 !! end
3363
3364
3365 !! test
3366 Definition Lists: Weird Ones: Test 1 (php)
3367 !! options
3368 php
3369 !! input
3370 *#;*::;; foo : bar (who uses this?)
3371 !! result
3372 <ul>
3373 <li><ol>
3374 <li><dl>
3375 <dt> foo&#160;</dt>
3376 <dd><ul>
3377 <li><dl>
3378 <dd><dl>
3379 <dd><dl>
3380 <dt><dl>
3381 <dt> bar (who uses this?)
3382 </dt>
3383 </dl>
3384 </dd>
3385 </dl>
3386 </dd>
3387 </dl>
3388 </dd>
3389 </dl>
3390 </li>
3391 </ul>
3392 </dd>
3393 </dl>
3394 </li>
3395 </ol>
3396 </li>
3397 </ul>
3398
3399 !! end
3400 !! test
3401 Definition Lists: Weird Ones: Test 1 (parsoid)
3402 !! options
3403 parsoid
3404 !! input
3405 *#;*::;; foo : bar (who uses this?)
3406 !! result
3407 <ul>
3408 <li>
3409 <ol>
3410 <li>
3411 <dl>
3412 <dt>
3413 <ul>
3414 <li>
3415 <dl>
3416 <dd>
3417 <dl>
3418 <dd>
3419 <dl>
3420 <dt>
3421 <dl>
3422 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3423 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3424 </dl></dt>
3425 </dl></dd>
3426 </dl></dd>
3427 </dl></li>
3428 </ul></dt>
3429 </dl></li>
3430 </ol></li>
3431 </ul>
3432 !! end
3433
3434 ###
3435 ### External links
3436 ###
3437 !! test
3438 External links: non-bracketed
3439 !! input
3440 Non-bracketed: http://example.com
3441 !! result
3442 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3443 </p>
3444 !! end
3445
3446 !! test
3447 External links: numbered
3448 !! input
3449 Numbered: [http://example.com]
3450 Numbered: [http://example.net]
3451 Numbered: [http://example.com]
3452 !! result
3453 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
3454 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
3455 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
3456 </p>
3457 !!end
3458
3459 !! test
3460 External links: specified text
3461 !! input
3462 Specified text: [http://example.com link]
3463 !! result
3464 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
3465 </p>
3466 !!end
3467
3468 !! test
3469 External links: trail
3470 !! input
3471 Linktrails should not work for external links: [http://example.com link]s
3472 !! result
3473 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
3474 </p>
3475 !! end
3476
3477 !! test
3478 External links: dollar sign in URL
3479 !! input
3480 http://example.com/1$2345
3481 !! result
3482 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
3483 </p>
3484 !! end
3485
3486 !! test
3487 External links: dollar sign in URL (named)
3488 !! input
3489 [http://example.com/1$2345]
3490 !! result
3491 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
3492 </p>
3493 !!end
3494
3495 !! test
3496 External links: open square bracket forbidden in URL (bug 4377)
3497 !! input
3498 http://example.com/1[2345
3499 !! result
3500 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
3501 </p>
3502 !! end
3503
3504 !! test
3505 External links: open square bracket forbidden in URL (named) (bug 4377)
3506 !! input
3507 [http://example.com/1[2345]
3508 !! result
3509 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3510 </p>
3511 !!end
3512
3513 !! test
3514 External links: nowiki in URL link text (bug 6230)
3515 !!input
3516 [http://example.com/ <nowiki>''example site''</nowiki>]
3517 !! result
3518 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
3519 </p>
3520 !! end
3521
3522 !! test
3523 External links: newline forbidden in text (bug 6230 regression check)
3524 !! input
3525 [http://example.com/ first
3526 second]
3527 !! result
3528 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
3529 second]
3530 </p>
3531 !!end
3532
3533 !! test
3534 External links: Pipe char between url and text
3535 !! input
3536 [http://example.com | link]
3537 !! result
3538 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
3539 </p>
3540 !!end
3541
3542 !! test
3543 External links: protocol-relative URL in brackets
3544 !! input
3545 [//example.com/ Test]
3546 !! result
3547 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
3548 </p>
3549 !! end
3550
3551 !! test
3552 External links: protocol-relative URL in brackets without text
3553 !! input
3554 [//example.com]
3555 !! result
3556 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
3557 </p>
3558 !! end
3559
3560 !! test
3561 External links: protocol-relative URL in free text is left alone
3562 !! input
3563 //example.com/Foo
3564 !! result
3565 <p>//example.com/Foo
3566 </p>
3567 !!end
3568
3569 !! test
3570 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
3571 !! input
3572 foo//example.com/Foo
3573 !! result
3574 <p>foo//example.com/Foo
3575 </p>
3576 !! end
3577
3578 !! test
3579 External image
3580 !! input
3581 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3582 !! result
3583 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3584 </p>
3585 !! end
3586
3587 !! test
3588 External image from https
3589 !! input
3590 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3591 !! result
3592 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3593 </p>
3594 !! end
3595
3596 !! test
3597 External image (when not allowed)
3598 !! options
3599 wgAllowExternalImages=0
3600 !! input
3601 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3602 !! result
3603 <p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
3604 </p>
3605 !! end
3606
3607 !! test
3608 Link to non-http image, no img tag
3609 !! input
3610 Link to non-http image, no img tag: ftp://example.com/test.jpg
3611 !! result
3612 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
3613 </p>
3614 !! end
3615
3616 !! test
3617 External links: terminating separator
3618 !! input
3619 Terminating separator: http://example.com/thing,
3620 !! result
3621 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
3622 </p>
3623 !! end
3624
3625 !! test
3626 External links: intervening separator
3627 !! input
3628 Intervening separator: http://example.com/1,2,3
3629 !! result
3630 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
3631 </p>
3632 !! end
3633
3634 !! test
3635 External links: old bug with URL in query
3636 !! input
3637 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
3638 !! result
3639 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
3640 </p>
3641 !! end
3642
3643 !! test
3644 External links: old URL-in-URL bug, mixed protocols
3645 !! input
3646 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
3647 !! result
3648 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
3649 </p>
3650 !!end
3651
3652 !! test
3653 External links: URL in text
3654 !! input
3655 URL in text: [http://example.com http://example.com]
3656 !! result
3657 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3658 </p>
3659 !! end
3660
3661 !! test
3662 External links: Clickable images
3663 !! input
3664 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
3665 !! result
3666 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
3667 </p>
3668 !!end
3669
3670 !! test
3671 External links: raw ampersand
3672 !! input
3673 Old &amp; use: http://x&y
3674 !! result
3675 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3676 </p>
3677 !! end
3678
3679 !! test
3680 External links: encoded ampersand
3681 !! input
3682 Old &amp; use: http://x&amp;y
3683 !! result
3684 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3685 </p>
3686 !! end
3687
3688 !! test
3689 External links: encoded equals (bug 6102)
3690 !! input
3691 http://example.com/?foo&#61;bar
3692 !! result
3693 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
3694 </p>
3695 !! end
3696
3697 !! test
3698 External links: [raw ampersand]
3699 !! input
3700 Old &amp; use: [http://x&y]
3701 !! result
3702 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3703 </p>
3704 !! end
3705
3706 !! test
3707 External links: [encoded ampersand]
3708 !! input
3709 Old &amp; use: [http://x&amp;y]
3710 !! result
3711 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3712 </p>
3713 !! end
3714
3715 !! test
3716 External links: [encoded equals] (bug 6102)
3717 !! input
3718 [http://example.com/?foo&#61;bar]
3719 !! result
3720 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3721 </p>
3722 !! end
3723
3724 !! test
3725 External links: [IDN ignored character reference in hostname; strip it right off]
3726 !! input
3727 [http://e&zwnj;xample.com/]
3728 !! result
3729 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
3730 </p>
3731 !! end
3732
3733 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
3734 # Where an external link could easily circumvent the sanitization of the text of
3735 # a link like this (where an IDN-ignore character is in the URL somewhere), this
3736 # test demands a higher standard. That's a bit strange.
3737 #
3738 # Example:
3739 #
3740 # http://e‌xample.com -> [http://example.com|http://example.com]
3741 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
3742 #
3743 # The first example is sanitized, but the second is not. Any security benefits
3744 # from this production are trivial to circumvent. Either remove this test and
3745 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
3746 # the test accordingly.
3747 #
3748 # All our love,
3749 # The Parsoid team.
3750 !! test
3751 External links: IDN ignored character reference in hostname; strip it right off
3752 !! input
3753 http://e&zwnj;xample.com/
3754 !! result
3755 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
3756 </p>
3757 !! end
3758
3759 !! test
3760 External links: www.jpeg.org (bug 554)
3761 !! input
3762 http://www.jpeg.org
3763 !!result
3764 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
3765 </p>
3766 !! end
3767
3768 !! test
3769 External links: URL within URL (original bug 2)
3770 !! input
3771 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
3772 !! result
3773 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
3774 </p>
3775 !! end
3776
3777 !! test
3778 BUG 361: URL inside bracketed URL
3779 !! input
3780 [http://www.example.com/foo http://www.example.com/bar]
3781 !! result
3782 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
3783 </p>
3784 !! end
3785
3786 !! test
3787 BUG 361: URL within URL, not bracketed
3788 !! input
3789 http://www.example.com/foo?=http://www.example.com/bar
3790 !! result
3791 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
3792 </p>
3793 !! end
3794
3795 !! test
3796 BUG 289: ">"-token in URL-tail
3797 !! input
3798 http://www.example.com/<hello>
3799 !! result
3800 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
3801 </p>
3802 !!end
3803
3804 !! test
3805 BUG 289: literal ">"-token in URL-tail
3806 !! input
3807 http://www.example.com/<b>html</b>
3808 !! result
3809 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
3810 </p>
3811 !!end
3812
3813 !! test
3814 BUG 289: ">"-token in bracketed URL
3815 !! input
3816 [http://www.example.com/<hello> stuff]
3817 !! result
3818 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
3819 </p>
3820 !!end
3821
3822 !! test
3823 BUG 289: literal ">"-token in bracketed URL
3824 !! input
3825 [http://www.example.com/<b>html</b> stuff]
3826 !! result
3827 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
3828 </p>
3829 !!end
3830
3831 !! test
3832 BUG 289: literal double quote at end of URL
3833 !! input
3834 http://www.example.com/"hello"
3835 !! result
3836 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
3837 </p>
3838 !!end
3839
3840 !! test
3841 BUG 289: literal double quote in bracketed URL
3842 !! input
3843 [http://www.example.com/"hello" stuff]
3844 !! result
3845 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
3846 </p>
3847 !!end
3848
3849 !! test
3850 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
3851 !! input
3852 [http://www.example.com test]
3853 !! result
3854 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3855 </p>
3856 !! end
3857
3858 !! test
3859 External links: link text with spaces
3860 !! input
3861 [http://www.example.com a b c]
3862 [http://www.example.com ''a'' ''b'']
3863 !! result
3864 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3865 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3866 </p>
3867 !! end
3868
3869 !! test
3870 External links: wiki links within external link (Bug 3695)
3871 !! options
3872 php
3873 !! input
3874 [http://example.com [[wikilink]] embedded in ext link]
3875 !! result
3876 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
3877 </p>
3878 !! end
3879
3880 !! test
3881 Parsoid: External links: wiki links within external link (Bug 3695)
3882 !! options
3883 parsoid
3884 !! input
3885 [http://example.com [[wikilink]] embedded in ext link]
3886 !! result
3887 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink">wikilink</a><span> embedded in ext link</span></p>
3888 !! end
3889
3890 !! test
3891 BUG 787: Links with one slash after the url protocol are invalid
3892 !! input
3893 http:/example.com
3894
3895 [http:/example.com title]
3896 !! result
3897 <p>http:/example.com
3898 </p><p>[http:/example.com title]
3899 </p>
3900 !! end
3901
3902 !! test
3903 Bracketed external links with template-generated invalid target
3904 !! input
3905 [{{echo|http:/example.com}} title]
3906 !! result
3907 <p>[http:/example.com title]
3908 </p>
3909 !! end
3910
3911 !! test
3912 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3913 !! input
3914 ''[http://example.com text'']
3915 [http://example.com '''text]'''
3916 ''Something [http://example.com in italic'']
3917 ''Something [http://example.com mixed''''', even bold]'''
3918 '''''Now [http://example.com both''''']
3919 !! result
3920 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3921 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3922 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3923 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3924 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3925 </p>
3926 !! end
3927
3928
3929 !! test
3930 Bug 4781: %26 in URL
3931 !! input
3932 http://www.example.com/?title=AT%26T
3933 !! result
3934 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3935 </p>
3936 !! end
3937
3938 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3939 # % is actually legal in HTML5. Any change in output would need testing though.
3940 !! test
3941 Bug 4781, 5267: %25 in URL
3942 !! input
3943 http://www.example.com/?title=100%25_Bran
3944 !! result
3945 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
3946 </p>
3947 !! end
3948
3949 !! test
3950 Bug 4781, 5267: %28, %29 in URL
3951 !! input
3952 http://www.example.com/?title=Ben-Hur_%281959_film%29
3953 !! result
3954 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
3955 </p>
3956 !! end
3957
3958
3959 !! test
3960 Bug 4781: %26 in autonumber URL
3961 !! input
3962 [http://www.example.com/?title=AT%26T]
3963 !! result
3964 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3965 </p>
3966 !! end
3967
3968 !! test
3969 Bug 4781, 5267: %26 in autonumber URL
3970 !! input
3971 [http://www.example.com/?title=100%25_Bran]
3972 !! result
3973 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3974 </p>
3975 !! end
3976
3977 !! test
3978 Bug 4781, 5267: %28, %29 in autonumber URL
3979 !! input
3980 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3981 !! result
3982 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3983 </p>
3984 !! end
3985
3986
3987 !! test
3988 Bug 4781: %26 in bracketed URL
3989 !! input
3990 [http://www.example.com/?title=AT%26T link]
3991 !! result
3992 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3993 </p>
3994 !! end
3995
3996 !! test
3997 Bug 4781, 5267: %26 in bracketed URL
3998 !! input
3999 [http://www.example.com/?title=100%25_Bran link]
4000 !! result
4001 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4002 </p>
4003 !! end
4004
4005 !! test
4006 Bug 4781, 5267: %28, %29 in bracketed URL
4007 !! input
4008 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4009 !! result
4010 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4011 </p>
4012 !! end
4013
4014 !! test
4015 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4016 !! input
4017 Some [http://example.com/ pretty ''italics'' and stuff]!
4018 !! result
4019 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
4020 </p>
4021 !! end
4022
4023 !! test
4024 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
4025 !! input
4026 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
4027 !! result
4028 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
4029 </p>
4030 !! end
4031
4032 !! test
4033 External link containing double-single-quotes with no space separating the url from text in italics
4034 !! options
4035 php
4036 !! input
4037 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
4038 !! result
4039 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
4040 </p>
4041 !! end
4042
4043 !! test
4044 Parsoid:External link containing double-single-quotes with no space separating the url from text in italics
4045 !! options
4046 parsoid
4047 !! input
4048 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
4049 !! result
4050 <p><a rel="mw:ExtLink" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" href="./Museo_Picasso_(París)">Museo Picasso</a><span>.</span></p>
4051 !! end
4052
4053 !! test
4054 External link with comments in link text
4055 !! input
4056 [http://www.google.com Google <!-- comment -->]
4057 !! result
4058 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
4059 </p>
4060 !! end
4061
4062 !! test
4063 URL-encoding in URL functions (single parameter)
4064 !! input
4065 {{localurl:Some page|amp=&}}
4066 !! result
4067 <p>/index.php?title=Some_page&amp;amp=&amp;
4068 </p>
4069 !! end
4070
4071 !! test
4072 URL-encoding in URL functions (multiple parameters)
4073 !! input
4074 {{localurl:Some page|q=?&amp=&}}
4075 !! result
4076 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
4077 </p>
4078 !! end
4079
4080 !! test
4081 Brackets in urls
4082 !! input
4083 http://example.com/index.php?foozoid%5B%5D=bar
4084
4085 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
4086 !! result
4087 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
4088 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
4089 </p>
4090 !! end
4091
4092 !! test
4093 IPv6 urls (bug 21261)
4094 !! options
4095 disabled
4096 !! input
4097 http://[2404:130:0:1000::187:2]/index.php
4098 !! result
4099 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
4100 </p>
4101 !! end
4102
4103 !! test
4104 Non-extlinks in brackets
4105 !! input
4106 [foo]
4107 [foo bar]
4108 [foo ''bar'']
4109 [fool's] errand
4110 [fool's errand]
4111 [{{echo|foo}}]
4112 [{{echo|foo}} bar]
4113 [{{echo|foo}} ''bar'']
4114 [{{echo|foo}}l's] errand
4115 [{{echo|foo}}l's errand]
4116 [url={{echo|foo}}]
4117 [url=http://example.com]
4118 !! result
4119 <p>[foo]
4120 [foo bar]
4121 [foo <i>bar</i>]
4122 [fool's] errand
4123 [fool's errand]
4124 [foo]
4125 [foo bar]
4126 [foo <i>bar</i>]
4127 [fool's] errand
4128 [fool's errand]
4129 [url=foo]
4130 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4131 </p>
4132 !! end
4133
4134 !! test
4135 Parsoid: Percent encoding in external links
4136 !! options
4137 parsoid
4138 !! input
4139 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4140 !! result
4141 <p><a rel="mw:ExtLink"
4142 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4143 !! end
4144
4145 !! test
4146 Parsoid: use url link syntax for links where the content is equal the link
4147 target
4148 !! options
4149 parsoid
4150 !! input
4151 http://example.com
4152 !! result
4153 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4154 !! end
4155
4156 !! test
4157 Parenthesis in external links, especially URL links
4158 !! options
4159 php
4160 !! input
4161 http://example.com)
4162
4163 http://example.com/test)
4164
4165 http://example.com/(test)
4166
4167 http://example.com/((test)
4168
4169 (http://example.com/(test))
4170
4171 (http://example.com/(test)))))
4172
4173 http://example.com/a)b
4174
4175 [http://example.com) foo]
4176 !! result
4177 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4178 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
4179 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
4180 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
4181 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
4182 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
4183 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
4184 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
4185 </p>
4186 !! end
4187
4188 !! test
4189 Parenthesis in external links, especially URL links (Parsoid)
4190 !! options
4191 parsoid
4192 !! input
4193 http://example.com)
4194
4195 http://example.com/test)
4196
4197 http://example.com/(test)
4198
4199 http://example.com/((test)
4200
4201 (http://example.com/(test))
4202
4203 (http://example.com/(test)))))
4204
4205 http://example.com/a)b
4206
4207 [http://example.com) foo]
4208 !! result
4209 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
4210 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
4211 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
4212 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
4213 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
4214 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
4215 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
4216 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
4217 !! end
4218
4219 !! test
4220 Parenthesis in external links, w/ transclusion or comment
4221 !! options
4222 parsoid
4223 !! input
4224 (http://example.com/{{echo|hi}})
4225
4226 (http://example.com<!-- hi -->)
4227 !! result
4228 <p>(<a data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;hi&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[20,31,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]]}\">hi&lt;/span>"}]]}' typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}'>http://example.com/hi</a>)</p>
4229
4230 <p>(<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com&lt;!-- hi -->"}}'>http://example.com</a>)</p>
4231 !! end
4232
4233 ###
4234 ### Quotes
4235 ###
4236
4237 !! test
4238 Quotes
4239 !! input
4240 Normal text. '''Bold text.''' Normal text. ''Italic text.''
4241
4242 Normal text. '''''Bold italic text.''''' Normal text.
4243 !!result
4244 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
4245 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
4246 </p>
4247 !! end
4248
4249
4250 !! test
4251 Unclosed and unmatched quotes (php)
4252 !! options
4253 php
4254 !! input
4255 '''''Bold italic text '''with bold deactivated''' in between.'''''
4256
4257 '''''Bold italic text ''with italic deactivated'' in between.'''''
4258
4259 '''Bold text..
4260
4261 ..spanning two paragraphs (should not work).'''
4262
4263 '''Bold tag left open
4264
4265 ''Italic tag left open
4266
4267 Normal text.
4268
4269 <!-- Unmatching number of opening, closing tags: -->
4270 '''This year''''s election ''should'' beat '''last year''''s.
4271
4272 ''Tom'''s car is bigger than ''Susan'''s.
4273
4274 Plain ''italic'''s plain
4275 !! result
4276 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4277 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4278 </p><p><b>Bold text..</b>
4279 </p><p>..spanning two paragraphs (should not work).
4280 </p><p><b>Bold tag left open</b>
4281 </p><p><i>Italic tag left open</i>
4282 </p><p>Normal text.
4283 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4284 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4285 </p><p>Plain <i>italic'</i>s plain
4286 </p>
4287 !! end
4288 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
4289 # parser strips. The wikitext contains just the first half of the bold
4290 # quote pair.
4291 !! test
4292 Unclosed and unmatched quotes (parsoid)
4293 !! options
4294 parsoid
4295 !! input
4296 '''''Bold italic text '''with bold deactivated''' in between.'''''
4297
4298 '''''Bold italic text ''with italic deactivated'' in between.'''''
4299
4300 '''Bold text..
4301
4302 ..spanning two paragraphs (should not work).'''
4303
4304 '''Bold tag left open
4305
4306 ''Italic tag left open
4307
4308 Normal text.
4309
4310 <!-- Unmatching number of opening, closing tags: -->
4311 '''This year''''s election ''should'' beat '''last year''''s.
4312
4313 ''Tom'''s car is bigger than ''Susan'''s.
4314
4315 Plain ''italic'''s plain
4316 !! result
4317 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4318 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4319 </p><p><b>Bold text..</b>
4320 </p><p>..spanning two paragraphs (should not work).<b></b>
4321 </p><p><b>Bold tag left open</b>
4322 </p><p><i>Italic tag left open</i>
4323 </p><p>Normal text.
4324 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4325 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4326 </p><p>Plain <i>italic'</i>s plain
4327 </p>
4328 !! end
4329
4330 ###
4331 ### Tables
4332 ###
4333 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
4334 ###
4335
4336 # This should not produce <table></table> as <table><tr><td></td></tr></table>
4337 # is the bare minimum required by the spec, see:
4338 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
4339 !! test
4340 A table with no data. (php)
4341 !! options
4342 php
4343 !! input
4344 {||}
4345 !! result
4346
4347 !! end
4348
4349 # Parsoid team replies: empty table tags are legal in HTML5
4350 !! test
4351 A table with no data. (parsoid)
4352 !! options
4353 parsoid=wt2html
4354 !! input
4355 {||}
4356 !! result
4357 <table></table>
4358
4359 !! end
4360
4361 !! test
4362 A table with stray table end tags on start tag line (wt2html)
4363 !! options
4364 parsoid=wt2html
4365 !! input
4366 {|style="color: red;"|}
4367
4368 {|style="color: red;" |}
4369 |foo
4370 |}
4371
4372 {|style="color: red;"|} id="foo"
4373 |foo
4374 |}
4375
4376 {|style="color: red;" |} id="foo"
4377 |foo
4378 |}
4379 !! result
4380 <table style="color: red;"></table>
4381
4382 <table style="color: red;">
4383 <tbody><tr>
4384 <td>foo</td>
4385 </tr></tbody>
4386 </table>
4387
4388 <table style="color: red;" id="foo">
4389 <tbody><tr>
4390 <td>foo</td>
4391 </tr></tbody>
4392 </table>
4393
4394 <table style="color: red;" id="foo">
4395 <tbody><tr>
4396 <td>foo</td>
4397 </tr></tbody>
4398 </table>
4399
4400 !! end
4401
4402 !! test
4403 A table with no data (take 2) (parsoid)
4404 !! options
4405 parsoid
4406 !! input
4407 {|
4408 |}
4409 !! result
4410 <table></table>
4411 !! end
4412
4413 # A table with nothing but a caption is invalid XHTML, we might want to render
4414 # this as <p>caption</p>
4415 !! test
4416 A table with nothing but a caption (php)
4417 !! options
4418 php
4419 !! input
4420 {|
4421 |+ caption
4422 |}
4423 !! result
4424 <table>
4425 <caption> caption
4426 </caption><tr><td></td></tr></table>
4427
4428 !! end
4429 # Parsoid team replies: table with only a caption is legal in HTML5
4430 !! test
4431 A table with nothing but a caption (parsoid)
4432 !! options
4433 parsoid
4434 !! input
4435 {|
4436 |+ caption
4437 |}
4438 !! result
4439 <table><caption> caption</caption></table>
4440 !! end
4441
4442 !! test
4443 A table with caption with default-spaced attributes and a table row
4444 !! input
4445 {|
4446 |+ style="color: red;" | caption1
4447 |-
4448 | foo
4449 |}
4450 !! result
4451 <table>
4452 <caption style="color: red;"> caption1
4453 </caption>
4454 <tr>
4455 <td> foo
4456 </td></tr></table>
4457
4458 !! end
4459
4460 !! test
4461 A table with captions with non-default spaced attributes and a table row
4462 !! input
4463 {|
4464 |+style="color: red;"|caption2
4465 |+ style="color: red;"| caption3
4466 |-
4467 | foo
4468 |}
4469 !! result
4470 <table>
4471 <caption style="color: red;">caption2
4472 </caption>
4473 <caption style="color: red;"> caption3
4474 </caption>
4475 <tr>
4476 <td> foo
4477 </td></tr></table>
4478
4479 !! end
4480
4481 !! test
4482 Table td-cell syntax variations
4483 !! input
4484 {|
4485 | foo bar foo | baz
4486 | foo bar foo || baz
4487 | style='color:red;' | baz
4488 | style='color:red;' || baz
4489 |}
4490 !! result
4491 <table>
4492 <tr>
4493 <td> baz
4494 </td>
4495 <td> foo bar foo </td>
4496 <td> baz
4497 </td>
4498 <td style="color:red;"> baz
4499 </td>
4500 <td> style='color:red;' </td>
4501 <td> baz
4502 </td></tr></table>
4503
4504 !! end
4505
4506 !! test
4507 Simple table
4508 !! input
4509 {|
4510 | 1 || 2
4511 |-
4512 | 3 || 4
4513 |}
4514 !! result
4515 <table>
4516 <tr>
4517 <td> 1 </td>
4518 <td> 2
4519 </td></tr>
4520 <tr>
4521 <td> 3 </td>
4522 <td> 4
4523 </td></tr></table>
4524
4525 !! end
4526
4527 !! test
4528 Simple table but with multiple dashes for row wikitext
4529 !! input
4530 {|
4531 | foo
4532 |-----
4533 | bar
4534 |}
4535 !! result
4536 <table>
4537 <tr>
4538 <td> foo
4539 </td></tr>
4540 <tr>
4541 <td> bar
4542 </td></tr></table>
4543
4544 !! end
4545 !! test
4546 Multiplication table
4547 !! input
4548 {| border="1" cellpadding="2"
4549 |+Multiplication table
4550 |-
4551 ! &times; !! 1 !! 2 !! 3
4552 |-
4553 ! 1
4554 | 1 || 2 || 3
4555 |-
4556 ! 2
4557 | 2 || 4 || 6
4558 |-
4559 ! 3
4560 | 3 || 6 || 9
4561 |-
4562 ! 4
4563 | 4 || 8 || 12
4564 |-
4565 ! 5
4566 | 5 || 10 || 15
4567 |}
4568 !! result
4569 <table border="1" cellpadding="2">
4570 <caption>Multiplication table
4571 </caption>
4572 <tr>
4573 <th> &#215; </th>
4574 <th> 1 </th>
4575 <th> 2 </th>
4576 <th> 3
4577 </th></tr>
4578 <tr>
4579 <th> 1
4580 </th>
4581 <td> 1 </td>
4582 <td> 2 </td>
4583 <td> 3
4584 </td></tr>
4585 <tr>
4586 <th> 2
4587 </th>
4588 <td> 2 </td>
4589 <td> 4 </td>
4590 <td> 6
4591 </td></tr>
4592 <tr>
4593 <th> 3
4594 </th>
4595 <td> 3 </td>
4596 <td> 6 </td>
4597 <td> 9
4598 </td></tr>
4599 <tr>
4600 <th> 4
4601 </th>
4602 <td> 4 </td>
4603 <td> 8 </td>
4604 <td> 12
4605 </td></tr>
4606 <tr>
4607 <th> 5
4608 </th>
4609 <td> 5 </td>
4610 <td> 10 </td>
4611 <td> 15
4612 </td></tr></table>
4613
4614 !! end
4615
4616 !! test
4617 Accept "||" in table headings
4618 !! input
4619 {|
4620 !h1 || h2
4621 |}
4622 !! result
4623 <table>
4624 <tr>
4625 <th>h1 </th>
4626 <th> h2
4627 </th></tr></table>
4628
4629 !! end
4630
4631 !! test
4632 Accept "||" in indented table headings
4633 !! input
4634 :{|
4635 !h1 || h2
4636 |}
4637 !! result
4638 <dl><dd><table>
4639 <tr>
4640 <th>h1 </th>
4641 <th> h2
4642 </th></tr></table></dd></dl>
4643
4644 !! end
4645
4646 !! test
4647 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
4648 !! input
4649 {|
4650 !| h1
4651 || a
4652 |}
4653 !! result
4654 <table>
4655 <tr>
4656 <th> h1
4657 </th>
4658 <td> a
4659 </td></tr></table>
4660
4661 !! end
4662
4663 !!test
4664 Accept "| !" at start of line in tables (ignore !-attribute)
4665 !!input
4666 {|
4667 |-
4668 | !style="color:red" | bar
4669 |}
4670 !!result
4671 <table>
4672
4673 <tr>
4674 <td> bar
4675 </td></tr></table>
4676
4677 !!end
4678
4679 !!test
4680 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
4681 !!input
4682 {|
4683 |-
4684 |style='color:red;'|+1
4685 |style='color:blue;'|-1
4686 |-
4687 | 1 || 2 || 3
4688 | 1 ||+2 ||-3
4689 |-
4690 | +1
4691 | -1
4692 |}
4693 !!result
4694 <table>
4695
4696 <tr>
4697 <td style="color:red;">+1
4698 </td>
4699 <td style="color:blue;">-1
4700 </td></tr>
4701 <tr>
4702 <td> 1 </td>
4703 <td> 2 </td>
4704 <td> 3
4705 </td>
4706 <td> 1 </td>
4707 <td>+2 </td>
4708 <td>-3
4709 </td></tr>
4710 <tr>
4711 <td> +1
4712 </td>
4713 <td> -1
4714 </td></tr></table>
4715
4716 !!end
4717
4718 !! test
4719 Table rowspan
4720 !! input
4721 {| border=1
4722 | Cell 1, row 1
4723 |rowspan=2| Cell 2, row 1 (and 2)
4724 | Cell 3, row 1
4725 |-
4726 | Cell 1, row 2
4727 | Cell 3, row 2
4728 |}
4729 !! result
4730 <table border="1">
4731 <tr>
4732 <td> Cell 1, row 1
4733 </td>
4734 <td rowspan="2"> Cell 2, row 1 (and 2)
4735 </td>
4736 <td> Cell 3, row 1
4737 </td></tr>
4738 <tr>
4739 <td> Cell 1, row 2
4740 </td>
4741 <td> Cell 3, row 2
4742 </td></tr></table>
4743
4744 !! end
4745
4746 !! test
4747 Nested table
4748 !! input
4749 {| border=1
4750 | &alpha;
4751 |
4752 {| bgcolor=#ABCDEF border=2
4753 |nested
4754 |-
4755 |table
4756 |}
4757 |the original table again
4758 |}
4759 !! result
4760 <table border="1">
4761 <tr>
4762 <td> &#945;
4763 </td>
4764 <td>
4765 <table bgcolor="#ABCDEF" border="2">
4766 <tr>
4767 <td>nested
4768 </td></tr>
4769 <tr>
4770 <td>table
4771 </td></tr></table>
4772 </td>
4773 <td>the original table again
4774 </td></tr></table>
4775
4776 !! end
4777
4778 !! test
4779 Invalid attributes in table cell (bug 1830)
4780 !! input
4781 {|
4782 |Cell:|broken
4783 |}
4784 !! result
4785 <table>
4786 <tr>
4787 <td>broken
4788 </td></tr></table>
4789
4790 !! end
4791
4792
4793 !! test
4794 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
4795 !! input
4796 {|
4797 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
4798 !! result
4799 <table>
4800 <tr>
4801 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
4802 <td>]" onmouseover="alert(document.cookie)"&gt;test
4803 </td>
4804 </tr>
4805 </table>
4806
4807 !! end
4808
4809
4810 !! test
4811 Indented table markup mixed with indented pre content (proposed in bug 6200)
4812 !! input
4813 <table>
4814 <tr>
4815 <td>
4816 Text that should be rendered preformatted
4817 </td>
4818 </tr>
4819 </table>
4820 !! result
4821 <table>
4822 <tr>
4823 <td>
4824 <pre>Text that should be rendered preformatted
4825 </pre>
4826 </td>
4827 </tr>
4828 </table>
4829
4830 !! end
4831
4832 !! test
4833 Template-generated table cell attributes and cell content
4834 !! input
4835 {|
4836 |{{table_attribs}}
4837 | {{table_attribs}}
4838 |}
4839 !! result
4840 <table>
4841 <tr>
4842 <td style="color: red"> Foo
4843 </td>
4844 <td style="color: red"> Foo
4845 </td></tr></table>
4846
4847 !! end
4848
4849 !! test
4850 Template-generated table cell attributes and cell content (2)
4851 !! input
4852 {|
4853 |align=center {{table_attribs}}
4854 |}
4855 !! result
4856 <table>
4857 <tr>
4858 <td align="center" style="color: red"> Foo
4859 </td></tr></table>
4860
4861 !! end
4862
4863 !! test
4864 Template-generated table cell attributes and cell content (3)
4865 !! input
4866 {|
4867 |align=center {{table_cells}}
4868 |}
4869 !! result
4870 <table>
4871 <tr>
4872 <td align="center" style="color: red"> Foo </td>
4873 <td> Bar </td>
4874 <td> Baz
4875 </td></tr></table>
4876
4877 !! end
4878
4879 !! test
4880 Table with row followed by newlines and table heading
4881 !! input
4882 {|
4883 |-
4884
4885 ! foo
4886 |}
4887 !! result
4888 <table>
4889
4890
4891 <tr>
4892 <th> foo
4893 </th></tr></table>
4894
4895 !! end
4896
4897 !! test
4898 Table with empty line following the start tag
4899 !! input
4900 {|
4901
4902 |-
4903 | foo
4904 |}
4905 !! result
4906 <table>
4907
4908
4909 <tr>
4910 <td> foo
4911 </td></tr></table>
4912
4913 !! end
4914
4915 # FIXME: Preserve the attribute properly (with an empty string as value) in
4916 # the PHP parser. Parsoid implements the behavior below.
4917 !! test
4918 Table attributes with empty value
4919 !! options
4920 parsoid
4921 !! input
4922 {|
4923 | style=| hello
4924 |}
4925 !! result
4926 <table>
4927 <tbody>
4928 <tr>
4929 <td style=""> hello
4930 </td></tr></tbody></table>
4931
4932 !! end
4933
4934 !! test
4935 Wikitext table with a lot of comments
4936 !! input
4937 {|
4938 <!-- c0 -->
4939 | foo
4940 <!-- c1 -->
4941 |- <!-- c2 -->
4942 <!-- c3 -->
4943 |<!-- c4 -->
4944 <!-- c5 -->
4945 |}
4946 !! result
4947 <table>
4948 <tr>
4949 <td> foo
4950 </td></tr>
4951 <tr>
4952 <td>
4953 </td></tr></table>
4954
4955 !! end
4956
4957 !! test
4958 Wikitext table with double-line table cell
4959 !! input
4960 {|
4961 |a
4962 b
4963 |}
4964 !! result
4965 <table>
4966 <tr>
4967 <td>a
4968 <p>b
4969 </p>
4970 </td></tr></table>
4971
4972 !! end
4973
4974 !! test
4975 Table cell with a single comment
4976 !! input
4977 {|
4978 | <!-- c1 -->
4979 | a
4980 |}
4981 !! result
4982 <table>
4983 <tr>
4984 <td>
4985 </td>
4986 <td> a
4987 </td></tr></table>
4988
4989 !! end
4990
4991 # The expected HTML structure in this test is debatable. The PHP parser does
4992 # not parse this kind of table at all. The main focus for Parsoid is on
4993 # round-tripping, so this output is ok for now. TODO: revisit!
4994 !! test
4995 Wikitext table with html-syntax row (Parsoid)
4996 !! options
4997 parsoid
4998 !! input
4999 {|
5000 |-
5001 <td>foo</td>
5002 |}
5003 !! result
5004 <table>
5005 <tbody>
5006 <tr>
5007 <td>foo</td></tr></tbody></table>
5008 !! end
5009
5010 !! test
5011 Implicit <td> after a |-
5012 (PHP parser relies on Tidy to add the missing <td> tags)
5013 !! options
5014 parsoid=wt2html,wt2wt
5015 !! input
5016 {|
5017 |-
5018 a
5019 |}
5020 !! result
5021 <table>
5022 <tr><td>a</td></tr>
5023 </table>
5024 !! end
5025
5026 !! test
5027 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
5028 (PHP parser relies on Tidy to add the missing <td> tags)
5029 !! options
5030 parsoid=wt2html,wt2wt
5031 !! input
5032 {|
5033 |-
5034 |
5035 a
5036 |-
5037 b
5038 |}
5039 !! result
5040 <table>
5041 <tbody>
5042 <tr><td><pre>a</pre></td></tr>
5043 <tr><td> b</td></tr>
5044 </tbody>
5045 </table>
5046 !! end
5047
5048 !! test
5049 Lists should be recognized in an implicit <td> context
5050 (PHP parser relies on Tidy to add the missing <td> tags)
5051 !! options
5052 parsoid=wt2html,wt2wt
5053 !! input
5054 {|
5055 |-
5056 *a
5057 |}
5058 !! result
5059 <table>
5060 <tr>
5061 <td><ul>
5062 <li>a</li>
5063 </ul></td>
5064 </tr>
5065 </table>
5066 !! end
5067
5068 !! test
5069 Parsoid: Round-trip tables directly followed by content (bug 51219)
5070 !! options
5071 parsoid=wt2html,wt2wt
5072 !! input
5073 {|
5074 |foo
5075 |} bar
5076
5077 {|
5078 |baz
5079 |}<b>quux</b>
5080 !! result
5081 <table><tbody>
5082 <tr>
5083 <td>foo</td></tr></tbody></table> bar
5084 <table>
5085 <tbody>
5086 <tr>
5087 <td>baz</td></tr></tbody></table><b>quux</b>
5088 !! end
5089
5090 !! test
5091 Parsoid: Default to a newline after tables in new content (bug 51219)
5092 !! options
5093 parsoid=html2wt
5094 !! input
5095 {|
5096 |foo
5097 |}
5098 <nowiki> </nowiki>bar
5099 {|
5100 |baz
5101 |}
5102 '''quux'''
5103 !! result
5104 <table><tbody>
5105 <tr><td>foo</td></tr></tbody></table> bar
5106 <table><tbody>
5107 <tr><td>baz</td></tr></tbody></table><b>quux</b>
5108 !! end
5109
5110 !! test
5111 Parsoid: newline inducing block nodes don't suppress <nowiki>
5112 !! options
5113 parsoid=html2wt
5114 !! input
5115 <nowiki> </nowiki>a
5116
5117 = foo =
5118 !! result
5119 a<h1>foo</h1>
5120 !! end
5121
5122 ###
5123 ### Internal links
5124 ###
5125 !! test
5126 Plain link, capitalized
5127 !! input
5128 [[Main Page]]
5129 !! result
5130 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5131 </p>
5132 !! end
5133
5134 !! test
5135 Plain link, uncapitalized
5136 !! input
5137 [[main Page]]
5138 !! result
5139 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
5140 </p>
5141 !! end
5142
5143 !! test
5144 Piped link
5145 !! input
5146 [[Main Page|The Main Page]]
5147 !! result
5148 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5149 </p>
5150 !! end
5151
5152 !! test
5153 Piped link with comment in link text
5154 !! input
5155 [[Main Page|The Main<!--front--> Page]]
5156 !! result
5157 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5158 </p>
5159 !! end
5160
5161 !! test
5162 Broken link
5163 !! input
5164 [[Zigzagzogzagzig]]
5165 !! result
5166 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
5167 </p>
5168 !! end
5169
5170 !! test
5171 Broken link with fragment
5172 !! input
5173 [[Zigzagzogzagzig#zug]]
5174 !! result
5175 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
5176 </p>
5177 !! end
5178
5179 !! test
5180 Special page link with fragment
5181 !! input
5182 [[Special:Version#anchor]]
5183 !! result
5184 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
5185 </p>
5186 !! end
5187
5188 !! test
5189 Nonexistent special page link with fragment
5190 !! input
5191 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
5192 !! result
5193 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
5194 </p>
5195 !! end
5196
5197 !! test
5198 Link with prefix
5199 !! input
5200 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
5201 !! result
5202 <p>xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5203 </p>
5204 !! end
5205
5206 !! test
5207 Link with suffix
5208 !! input
5209 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
5210 !! result
5211 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>!!!
5212 </p>
5213 !! end
5214
5215 !! article
5216 prefixed article
5217 !! text
5218 Some text
5219 !! endarticle
5220
5221 !! test
5222 Bug 43661: Piped links with identical prefixes
5223 !! input
5224 [[prefixed article|prefixed articles with spaces]]
5225
5226 [[prefixed article|prefixed articlesaoeu]]
5227
5228 [[Main Page|Main Page test]]
5229 !! result
5230 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
5231 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
5232 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
5233 </p>
5234 !! end
5235
5236
5237 !! test
5238 Link with HTML entity in suffix / tail
5239 !! input
5240 [[Main Page]]&quot;, [[Main Page]]&#97;
5241 !! result
5242 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>&quot;, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>&#97;
5243 </p>
5244 !! end
5245
5246 !! test
5247 Link with 3 brackets
5248 !! input
5249 [[[Main Page]]]
5250 !! result
5251 <p>[[[Main Page]]]
5252 </p>
5253 !! end
5254
5255 !! test
5256 Link with 4 brackets
5257 !! input
5258 [[[[Main Page]]]]
5259 !! result
5260 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
5261 </p>
5262 !! end
5263
5264 !! test
5265 Piped link with 3 brackets
5266 !! input
5267 [[[main page|the main page]]]
5268 !! result
5269 <p>[[[main page|the main page]]]
5270 </p>
5271 !! end
5272
5273 !! test
5274 Piped link with extlink-like text
5275 !! input
5276 [[Main Page|[bar]]]
5277 [[Main Page|This is a [bar]]]
5278 !! result
5279 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
5280 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
5281 </p>
5282 !! end
5283
5284 !! test
5285 Link with multiple pipes
5286 !! input
5287 [[Main Page|The|Main|Page]]
5288 !! result
5289 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
5290 </p>
5291 !! end
5292
5293 !! test
5294 Link to namespaces
5295 !! input
5296 [[Talk:Parser testing]], [[Meta:Disclaimers]]
5297 !! result
5298 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit&amp;redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a>
5299 </p>
5300 !! end
5301
5302 !! article
5303 MemoryAlpha:AlphaTest
5304 !! text
5305 This is an article in the MemoryAlpha namespace
5306 (which shadows the memoryalpha interwiki link).
5307 !! endarticle
5308
5309 !! test
5310 Namespace takes precedence over interwiki link (bug 51680)
5311 !! input
5312 [[MemoryAlpha:AlphaTest]]
5313 !! result
5314 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5315 </p>
5316 !! end
5317
5318 # The previous test doesn't work correctly in html2*, due to not recognizing the
5319 # link as an internal one. This one checks for the correct behavior.
5320 !! test
5321 Link to namespace preferred over interwiki with correct rel attribute
5322 !! options
5323 parsoid=html2wt,html2html
5324 !! input
5325 [[MemoryAlpha:AlphaTest]]
5326 !! result
5327 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5328 </p>
5329 !! end
5330
5331 !! test
5332 Piped link to namespace
5333 !! input
5334 [[Meta:Disclaimers|The disclaimers]]
5335 !! result
5336 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">The disclaimers</a>
5337 </p>
5338 !! end
5339
5340 !! test
5341 Link containing }
5342 !! input
5343 [[Usually caused by a typo (oops}]]
5344 !! result
5345 <p>[[Usually caused by a typo (oops}]]
5346 </p>
5347 !! end
5348
5349 !! test
5350 Link containing % (not as a hex sequence)
5351 !! input
5352 [[7% Solution]]
5353 !! result
5354 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a>
5355 </p>
5356 !! end
5357
5358 !! test
5359 Link containing % as a single hex sequence interpreted to char
5360 !! input
5361 [[7%25 Solution]]
5362 !! result
5363 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a>
5364 </p>
5365 !!end
5366
5367 !! test
5368 Link containing % as a double hex sequence interpreted to hex sequence
5369 !! input
5370 [[7%2525 Solution]]
5371 !! result
5372 <p>[[7%2525 Solution]]
5373 </p>
5374 !!end
5375
5376 !! test
5377 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
5378 Example for such a section: == < ==
5379 !! input
5380 [[%23%3c]][[%23%3e]]
5381 !! result
5382 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
5383 </p>
5384 !! end
5385
5386 !! test
5387 Link containing "<#" and ">#" as a hex sequences
5388 !! input
5389 [[%3c%23]][[%3e%23]]
5390 !! result
5391 <p>[[%3c%23]][[%3e%23]]
5392 </p>
5393 !! end
5394
5395 !! test
5396 Link containing an equals sign
5397 !! input
5398 [[Special:BookSources/isbn=4-00-026157-6]]
5399 !! result
5400 <p><a href="/wiki/Special:BookSources/isbn%3D4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a>
5401 </p>
5402 !! end
5403
5404 !! article
5405 Foo~bar
5406 !! text
5407 Just a test of an article title containing a tilde.
5408 !! endarticle
5409
5410 # note that links containing signatures, like [[Foo~~~~]], are
5411 # massaged by the pre-save transform (PST) and so the tildes are never
5412 # seen by the parser.
5413 !! test
5414 Link containing a tilde
5415 !! input
5416 [[Foo~bar]]
5417 !! result
5418 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
5419 </p>
5420 !! end
5421
5422 !! test
5423 Link containing double-single-quotes '' (bug 4598)
5424 !! input
5425 [[Lista d''e paise d''o munno]]
5426 !! result
5427 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a>
5428 </p>
5429 !! end
5430
5431 !! test
5432 Link containing double-single-quotes '' in text (bug 4598 sanity check)
5433 !! input
5434 Some [[Link|pretty ''italics'' and stuff]]!
5435 !! result
5436 <p>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!
5437 </p>
5438 !! end
5439
5440 !! test
5441 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
5442 !! input
5443 ''Some [[Link|pretty ''italics'' and stuff]]!
5444 !! result
5445 <p><i>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i>
5446 </p>
5447 !! end
5448
5449 !! test
5450 Link with double quotes in title part (literal) and alternate part (interpreted)
5451 !! input
5452 [[File:Denys Savchenko ''Pentecoste''.jpg]]
5453
5454 [[''Pentecoste'']]
5455
5456 [[''Pentecoste''|Pentecoste]]
5457
5458 [[''Pentecoste''|''Pentecoste'']]
5459 !! result
5460 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
5461 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
5462 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
5463 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
5464 </p>
5465 !! end
5466
5467 !! test
5468 Broken image links with HTML captions (bug 39700)
5469 !! input
5470 [[File:Nonexistent|<script></script>]]
5471 [[File:Nonexistent|100px|<script></script>]]
5472 [[File:Nonexistent|&lt;]]
5473 [[File:Nonexistent|a<i>b</i>c]]
5474 !! result
5475 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5476 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5477 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
5478 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
5479 </p>
5480 !! end
5481
5482 !! test
5483 Plain link to URL
5484 !! input
5485 [[http://www.example.com]]
5486 !! result
5487 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
5488 </p>
5489 !! end
5490
5491 !! test
5492 Plain link to URL with link text
5493 !! input
5494 [[http://www.example.com Link text]]
5495 !! result
5496 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
5497 </p>
5498 !! end
5499
5500 !! test
5501 Plain link to protocol-relative URL
5502 !! input
5503 [[//www.example.com]]
5504 !! result
5505 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
5506 </p>
5507 !! end
5508
5509 !! test
5510 Plain link to protocol-relative URL with link text
5511 !! input
5512 [[//www.example.com Link text]]
5513 !! result
5514 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
5515 </p>
5516 !! end
5517
5518 !! test
5519 Plain link to page with question mark in title
5520 !! input
5521 [[A?b]]
5522
5523 [[A?b|Baz]]
5524 !! result
5525 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
5526 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
5527 </p>
5528 !! end
5529
5530
5531 # I'm fairly sure the expected result here is wrong.
5532 # We want these to be URL links, not pseudo-pages with URLs for titles....
5533 # However the current output is also pretty screwy.
5534 #
5535 # ----
5536 # I'm changing it to match the current output--it arguably makes more
5537 # sense in the light of the test above. Old expected result was:
5538 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
5539 #</p>
5540 # But I think this test is bordering on "garbage in, garbage out" anyway.
5541 # -- wtm
5542 !! test
5543 Piped link to URL
5544 !! input
5545 Piped link to URL: [[http://www.example.com|an example URL]]
5546 !! result
5547 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
5548 </p>
5549 !! end
5550
5551 !! test
5552 BUG 2: [[page|http://url/]] should link to page, not http://url/
5553 !! input
5554 [[Main Page|http://url/]]
5555 !! result
5556 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
5557 </p>
5558 !! end
5559
5560 !! test
5561 BUG 337: Escaped self-links should be bold
5562 !! options
5563 title=[[Bug462]]
5564 !! input
5565 [[Bu&#103;462]] [[Bug462]]
5566 !! result
5567 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
5568 </p>
5569 !! end
5570
5571 !! test
5572 Self-link to section should not be bold
5573 !! options
5574 title=[[Main Page]]
5575 !! input
5576 [[Main Page#section]]
5577 !! result
5578 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
5579 </p>
5580 !! end
5581
5582 !! article
5583 00
5584 !! text
5585 This is 00.
5586 !! endarticle
5587
5588 !!test
5589 Self-link to numeric title
5590 !!options
5591 title=[[0]]
5592 !!input
5593 [[0]]
5594 !!result
5595 <p><strong class="selflink">0</strong>
5596 </p>
5597 !!end
5598
5599 !!test
5600 Link to numeric-equivalent title
5601 !!options
5602 title=[[0]]
5603 !!input
5604 [[00]]
5605 !!result
5606 <p><a href="/wiki/00" title="00">00</a>
5607 </p>
5608 !!end
5609
5610 !! test
5611 <nowiki> inside a link
5612 !! input
5613 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
5614 !! result
5615 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
5616 </p>
5617 !! end
5618
5619 !! test
5620 Non-breaking spaces in title
5621 !! input
5622 [[&nbsp; Main &nbsp; Page &nbsp;]]
5623 !! result
5624 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
5625 </p>
5626 !!end
5627
5628 !! test
5629 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
5630 !! options
5631 language=ca
5632 !! input
5633 '''[[Main Page]]'''
5634 !! result
5635 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
5636 </p>
5637 !! end
5638
5639 !! test
5640 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
5641 !! options
5642 language=ca
5643 !! input
5644 ''[[Main Page]]''
5645 !! result
5646 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
5647 </p>
5648 !! end
5649
5650 !! test
5651 Internal link with en linktrail: no apostrophes (bug 27473)
5652 !! options
5653 language=en
5654 !! input
5655 [[Something]]'nice
5656 !! result
5657 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
5658 </p>
5659 !! end
5660
5661 !! test
5662 Internal link with ca linktrail with apostrophes (bug 27473)
5663 !! options
5664 language=ca
5665 !! input
5666 [[Something]]'nice
5667 !! result
5668 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
5669 </p>
5670 !! end
5671
5672 !! test
5673 Internal link with kaa linktrail with apostrophes (bug 27473)
5674 !! options
5675 language=kaa
5676 !! input
5677 [[Something]]'nice
5678 !! result
5679 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag'an)">Something'nice</a>
5680 </p>
5681 !! end
5682
5683 !! test
5684 1. Interaction of linktrail and template encapsulation
5685 !! options
5686 parsoid
5687 !! input
5688 {{echo|[[Foo]]}}l
5689 !! result
5690 <p><a rel="mw:WikiLink" href="Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo]]"}},"i":0}},"l"]}'>Fool</a></p>
5691 !! end
5692
5693 !! test
5694 2. Interaction of linktrail and template encapsulation
5695 !! options
5696 parsoid
5697 !! input
5698 {{echo|Some [[Fool]]}}s
5699 !! result
5700 <p data-parsoid='{}'><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]"}},"i":0}},"s"]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>Some </span><a rel="mw:WikiLink" href="./Fool" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p>
5701 !! end
5702
5703 !! test
5704 3. Interaction of linktrail and template encapsulation
5705 !! options
5706 parsoid
5707 !! input
5708 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
5709 !! result
5710 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]s are &#39;&#39;&#39;bold and foolish&#39;&#39;&#39;"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>Some <a rel="mw:WikiLink" href="./Fool" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b data-parsoid="{}">bold and foolish</b></p>
5711 !! end
5712
5713 !! article
5714 Söfnuður
5715 !! text
5716 Test.
5717 !! endarticle
5718
5719 !! test
5720 Internal link with is link prefix
5721 !! options
5722 language=is
5723 !! input
5724 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
5725 !! result
5726 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
5727 </p>
5728 !! end
5729
5730 !! article
5731 Mótmælendatrú
5732 !! text
5733 Test.
5734 !! endarticle
5735
5736 !! test
5737 Internal link with is link trail and link prefix
5738 !! options
5739 language=is
5740 !! input
5741 [[mótmælendatrú|xxx]]ar
5742 [[mótmælendatrú]]ar
5743 mótmælenda[[söfnuður]]
5744 mótmælenda[[söfnuður|söfnuðir]]
5745 mótmælenda[[söfnuður|söfnuðir]]xxx
5746 !! result
5747 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
5748 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
5749 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
5750 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
5751 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
5752 </p>
5753 !! end
5754
5755 !! test
5756 Parsoid link trail escaping
5757 !! options
5758 parsoid=html2wt,html2html
5759 !! input
5760 [[apple]]<nowiki/>s
5761 !! result
5762 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
5763 !! end
5764
5765 !! test
5766 Parsoid link prefix escaping
5767 !! options
5768 language=is
5769 parsoid=html2wt,html2html
5770 !! input
5771 Aðrir mótmælenda<nowiki/>[[söfnuður]]
5772 !! result
5773 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
5774 !! end
5775
5776 !! test
5777 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
5778 !! input
5779 [[Foo| bar]]
5780
5781 [[Foo| ''bar'']]
5782
5783 [http://wp.org foo]
5784
5785 [http://wp.org ''foo'']
5786 !! result
5787 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
5788 </p><p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> <i>bar</i></a>
5789 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
5790 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
5791 </p>
5792 !! end
5793
5794 !! test
5795 Parsoid: Scoped parsing should handle mixed transclusions and plain text
5796 !! options
5797 parsoid
5798 !! input
5799 [[Foo|{{echo|a}} b {{echo|c}}]]
5800 !! result
5801 <p><a rel="mw:WikiLink" href="Foo"><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span> b <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c"}},"i":0}}]}'>c</span></a></p>
5802 !! end
5803
5804 ###
5805 ### Interwiki links (see maintenance/interwiki.sql)
5806 ###
5807
5808 !! test
5809 Inline interwiki link
5810 !! input
5811 [[MeatBall:SoftSecurity]]
5812 !! result
5813 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
5814 </p>
5815 !! end
5816
5817 !! test
5818 Inline interwiki link with empty title (bug 2372)
5819 !! input
5820 [[MeatBall:]]
5821 !! result
5822 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
5823 </p>
5824 !! end
5825
5826 !! test
5827 Interwiki link encoding conversion (bug 1636)
5828 !! input
5829 *[[Wikipedia:ro:Olteni&#0355;a]]
5830 *[[Wikipedia:ro:Olteni&#355;a]]
5831 !! result
5832 <ul>
5833 <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>
5834 </li>
5835 <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>
5836 </li>
5837 </ul>
5838
5839 !! end
5840
5841 !! test
5842 Interwiki link with fragment (bug 2130)
5843 !! input
5844 [[MeatBall:SoftSecurity#foo]]
5845 !! result
5846 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
5847 </p>
5848 !! end
5849
5850 # Ideally the wikipedia: prefix here should be proto-relative too
5851 !! test
5852 Different interwiki prefixes mapping to the same URL
5853 !! options
5854 parsoid
5855 !! input
5856 [[wikipedia:Foo]]
5857
5858 [[:en:Foo]]
5859 !! result
5860 <p><a rel="mw:ExtLink" 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}'>wikipedia:Foo</a></p>
5861
5862 <p><a rel="mw:ExtLink" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}'>en:Foo</a></p>
5863 !! end
5864
5865 !! test
5866 Interwiki links that cannot be represented in wiki syntax
5867 !! options
5868 parsoid
5869 !! input
5870 [[meatball:ok]]
5871 [[meatball:ok#foo|ok with fragment]]
5872 [[meatball:ok_as_well?|ok ending with ? mark]]
5873 [http://de.wikipedia.org/wiki/Foo?action=history has query]
5874 [http://de.wikipedia.org/wiki/#foo is just fragment]
5875
5876 !! result
5877 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok">meatball:ok</a>
5878 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo">ok with fragment</a>
5879 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F">ok ending with ? mark</a>
5880 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
5881 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
5882 !! end
5883
5884 !! test
5885 Interwiki links: trail
5886 !! options
5887 parsoid
5888 !! input
5889 [[wikipedia:Foo|Ba]]r
5890 !! result
5891 <p data-parsoid='{}'><a rel="mw:ExtLink" 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"}'>Bar</a></p>
5892 !! end
5893
5894 ###
5895 ### Interlanguage links
5896 ### Language links (so that searching for '### language' matches..)
5897 ###
5898
5899 !! test
5900 Interlanguage link
5901 !! input
5902 Blah blah blah
5903 [[zh:Chinese]]
5904 !!result
5905 <p>Blah blah blah
5906 </p>
5907 !! end
5908
5909 !! test
5910 Double interlanguage link
5911 !! input
5912 Blah blah blah
5913 [[es:Spanish]]
5914 [[zh:Chinese]]
5915 !!result
5916 <p>Blah blah blah
5917 </p>
5918 !! end
5919
5920 !! test
5921 Interlanguage link, with prefix links
5922 !! options
5923 language=ln
5924 !! input
5925 Blah blah blah
5926 [[zh:Chinese]]
5927 !!result
5928 <p>Blah blah blah
5929 </p>
5930 !! end
5931
5932 !! test
5933 Double interlanguage link, with prefix links (bug 8897)
5934 !! options
5935 language=ln
5936 !! input
5937 Blah blah blah
5938 [[es:Spanish]]
5939 [[zh:Chinese]]
5940 !!result
5941 <p>Blah blah blah
5942 </p>
5943 !! end
5944
5945 !! test
5946 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
5947 !! options
5948 language=ln
5949 !! input
5950 [[WW&nbsp;II]]
5951 !!result
5952 <p><a href="/index.php?title=WW_II&amp;action=edit&amp;redlink=1" class="new" title="WW II (lonkásá ezalí tɛ̂)">WW&#160;II</a>
5953 </p>
5954 !! end
5955
5956 !! test
5957 Parsoid bug 53221: Wikilinks should be properly entity-escaped
5958 !! options
5959 parsoid=html2wt
5960 !! input
5961 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
5962
5963 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
5964 !!result
5965 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
5966 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
5967 !! end
5968
5969 !! test
5970 Parsoid: handle constructor well
5971 !! options
5972 parsoid
5973 !! input
5974 [[constructor]]
5975
5976 [[constructor:foo]]
5977 !! result
5978 <p><a rel="mw:WikiLink" href="./Constructor" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Constructor&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor&quot;}}">constructor</a></p>
5979
5980 <p><a rel="mw:WikiLink" href="./Foo" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Foo&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor:foo&quot;}}">constructor:foo</a></p>
5981 !! end
5982
5983 !! test
5984 Parsoid: recognize interlanguage links without a target page
5985 !! options
5986 parsoid
5987 !! input
5988 [[ko:]]
5989 !! result
5990 <p>
5991 <link rel="mw:PageProp/Language" href="http://ko.wikipedia.org/wiki/"></p>
5992 !! end
5993
5994 !! test
5995 Parsoid: recognize interwiki links without a target page
5996 !! options
5997 parsoid
5998 !! input
5999 [[:ko:]]
6000 !! result
6001 <p><a rel="mw:ExtLink" href="//ko.wikipedia.org/wiki/">ko:</a></p>
6002 !! end
6003
6004 !! test
6005 Parsoid: Bug #45209, handle interwiki links pointing to the current wiki as plain wiki links
6006 !! options
6007 parsoid
6008 !! input
6009 [[en:Foo]]
6010 !! result
6011 <p><a rel="mw:WikiLink" href="./Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"en:Foo"}}'>Foo</a></p>
6012 !! end
6013
6014 ###
6015 ### Redirects, Parsoid-only
6016 ###
6017 !! test
6018 1. Simple redirect to page
6019 !! options
6020 parsoid
6021 !! input
6022 #REDIRECT [[Main Page]]
6023 !! result
6024 <link rel="mw:PageProp/redirect" href="./Main_Page">
6025 !! end
6026
6027 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
6028 !! test
6029 2. Other redirect variants
6030 !! options
6031 parsoid=wt2html,wt2wt
6032 !! input
6033 #REDIRECT [[Main_Page]]
6034 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
6035 !! result
6036 <link rel="mw:PageProp/redirect" href="./Main_Page">
6037 <link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
6038 !! end
6039
6040 !! test
6041 Optional colon in #REDIRECT
6042 !! options
6043 # the colon is archaic syntax. we support it for wt2html, but we
6044 # don't care that it roundtrips back to the modern syntax.
6045 parsoid=wt2html,html2html
6046 !! input
6047 #REDIRECT:[[Main Page]]
6048 !! result
6049 <link rel="mw:PageProp/redirect" href="./Main_Page">
6050 !! end
6051
6052 !! test
6053 Whitespace in #REDIRECT with optional colon
6054 !! options
6055 # the colon and gratuitous whitespace is archaic syntax. we support
6056 # it for wt2html, but we don't care that it roundtrips back to the
6057 # modern syntax (without extra whitespace)
6058 parsoid=wt2html,html2html
6059 !! input
6060
6061 #REDIRECT
6062 :
6063 [[Main Page]]
6064 !! result
6065 <link rel="mw:PageProp/redirect" href="./Main_Page">
6066 !! end
6067
6068 !! test
6069 Piped link in #REDIRECT
6070 !! options
6071 # content after piped link is ignored. we support this syntax,
6072 # but don't care that the piped link is lost when we roundtrip this.
6073 parsoid=wt2html
6074 !! input
6075 #REDIRECT [[Main Page|bar]]
6076 !! result
6077 <link rel="mw:PageProp/redirect" href="./Main_Page">
6078 !! end
6079
6080 !! test
6081 Redirect to category
6082 !! options
6083 parsoid=wt2html
6084 !! input
6085 #REDIRECT [[Category:Foo]]
6086 !! result
6087 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
6088 !! end
6089
6090 !! test
6091 Redirect to category with URL encoding
6092 !! options
6093 parsoid=wt2html
6094 !! input
6095 #REDIRECT [[Category%3AFoo]]
6096 !! result
6097 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
6098 !! end
6099
6100 !! test
6101 Redirect to category page
6102 !! options
6103 parsoid=wt2html,html2html
6104 !! input
6105 #REDIRECT [[:Category:Foo]]
6106 !! result
6107 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
6108 !! end
6109
6110 !! test
6111 Redirect to image page (1)
6112 !! options
6113 parsoid
6114 !! input
6115 #REDIRECT [[File:Wiki.png]]
6116 !! result
6117 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
6118 !! end
6119
6120 !! test
6121 Redirect to image page (2)
6122 !! options
6123 parsoid
6124 !! input
6125 #REDIRECT [[Image:Wiki.png]]
6126 !! result
6127 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
6128 !! end
6129
6130 !! test
6131 Redirect to language
6132 !! options
6133 parsoid
6134 !! input
6135 #REDIRECT [[en:File:Wiki.png]]
6136 !! result
6137 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
6138 !! end
6139
6140 !! test
6141 Redirect to interwiki
6142 !! options
6143 parsoid
6144 !! input
6145 #REDIRECT [[meatball:File:Wiki.png]]
6146 !! result
6147 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
6148 !! end
6149
6150 !! test
6151 Non-English #REDIRECT
6152 !! options
6153 parsoid
6154 language=is
6155 !! input
6156 #TILVÍSUN [[Main Page]]
6157 !! result
6158 <link rel="mw:PageProp/redirect" href="./Main_Page">
6159 !! end
6160
6161 !! test
6162 New redirect
6163 !! options
6164 parsoid=html2wt
6165 !! input
6166 Foo
6167 #REDIRECT [[Foo]]
6168 !! result
6169 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
6170 !! end
6171
6172 ##
6173 ## XHTML tidiness
6174 ###
6175
6176 !! test
6177 <br> to <br />
6178 !! input
6179 1<br>2<br />3
6180 !! result
6181 <p>1<br />2<br />3
6182 </p>
6183 !! end
6184
6185 !! test
6186 Broken br tag sanitization
6187 !! options
6188 php
6189 !! input
6190 </br>
6191 !! result
6192 <p>&lt;/br&gt;
6193 </p>
6194 !! end
6195
6196 # TODO: Fix html2html mode (bug 51055)!
6197 !! test
6198 Parsoid: Broken br tag recognition
6199 !! options
6200 parsoid=wt2html
6201 !! input
6202 </br>
6203 !! result
6204 <p><br></p>
6205 !! end
6206
6207 !! test
6208 Incorrecly removing closing slashes from correctly formed XHTML
6209 !! input
6210 <br style="clear:both;" />
6211 !! result
6212 <p><br style="clear:both;" />
6213 </p>
6214 !! end
6215
6216 !! test
6217 Failing to transform badly formed HTML into correct XHTML
6218 !! input
6219 <br style="clear: left;">
6220 <br style="clear: right;">
6221 <br style="clear: both;">
6222 !! result
6223 <p><br style="clear: left;" />
6224 <br style="clear: right;" />
6225 <br style="clear: both;" />
6226 </p>
6227 !!end
6228
6229 !! test
6230 Handling html with a div self-closing tag
6231 !! input
6232 <div title />
6233 <div title/>
6234 <div title/ >
6235 <div title=bar />
6236 <div title=bar/>
6237 <div title=bar/ >
6238 !! result
6239 <p>&lt;div title /&gt;
6240 &lt;div title/&gt;
6241 </p>
6242 <div>
6243 <p>&lt;div title=bar /&gt;
6244 &lt;div title=bar/&gt;
6245 </p>
6246 <div title="bar/"></div>
6247 </div>
6248
6249 !! end
6250
6251 !! test
6252 Handling html with a br self-closing tag
6253 !! input
6254 <br title />
6255 <br title/>
6256 <br title/ >
6257 <br title=bar />
6258 <br title=bar/>
6259 <br title=bar/ >
6260 !! result
6261 <p><br title="title" />
6262 <br title="title" />
6263 <br />
6264 <br title="bar" />
6265 <br title="bar" />
6266 <br title="bar/" />
6267 </p>
6268 !! end
6269
6270 !! test
6271 Horizontal ruler (should it add that extra space?)
6272 !! input
6273 <hr>
6274 <hr >
6275 foo <hr
6276 > bar
6277 !! result
6278 <hr />
6279 <hr />
6280 foo <hr /> bar
6281
6282 !! end
6283
6284 !! test
6285 Horizontal ruler -- 4+ dashes render hr
6286 !! input
6287 ----
6288 !! result
6289 <hr />
6290
6291 !! end
6292
6293 !! test
6294 Horizontal ruler -- eats additional dashes on the same line
6295 !! input
6296 ---------
6297 !! result
6298 <hr />
6299
6300 !! end
6301
6302 !! test
6303 Horizontal ruler -- does not collapse dashes on consecutive lines
6304 !! input
6305 ----
6306 ----
6307 !! result
6308 <hr />
6309 <hr />
6310
6311 !! end
6312
6313 !! test
6314 Horizontal ruler -- <4 dashes render as plain text
6315 !! input
6316 ---
6317 !! result
6318 <p>---
6319 </p>
6320 !! end
6321
6322 !! test
6323 Horizontal ruler -- Supports content following dashes on same line
6324 !! input
6325 ---- Foo
6326 !! result
6327 <hr /> Foo
6328
6329 !! end
6330
6331 ###
6332 ### Block-level elements
6333 ###
6334 !! test
6335 Common list
6336 !! input
6337 *Common list
6338 * item 2
6339 *item 3
6340 !! result
6341 <ul>
6342 <li>Common list
6343 </li>
6344 <li> item 2
6345 </li>
6346 <li>item 3
6347 </li>
6348 </ul>
6349
6350 !! end
6351
6352 !! test
6353 Numbered list
6354 !! input
6355 #Numbered list
6356 #item 2
6357 # item 3
6358 !! result
6359 <ol>
6360 <li>Numbered list
6361 </li>
6362 <li>item 2
6363 </li>
6364 <li> item 3
6365 </li>
6366 </ol>
6367
6368 !! end
6369
6370 !! test
6371 Mixed list
6372 !! input
6373 *Mixed list
6374 *# with numbers
6375 ** and bullets
6376 *# and numbers
6377 *bullets again
6378 **bullet level 2
6379 ***bullet level 3
6380 ***#Number on level 4
6381 **bullet level 2
6382 **#Number on level 3
6383 **#Number on level 3
6384 *#number level 2
6385 *Level 1
6386 *** Level 3
6387 #** Level 3, but ordered
6388 !! result
6389 <ul>
6390 <li>Mixed list
6391 <ol>
6392 <li> with numbers
6393 </li>
6394 </ol>
6395 <ul>
6396 <li> and bullets
6397 </li>
6398 </ul>
6399 <ol>
6400 <li> and numbers
6401 </li>
6402 </ol>
6403 </li>
6404 <li>bullets again
6405 <ul>
6406 <li>bullet level 2
6407 <ul>
6408 <li>bullet level 3
6409 <ol>
6410 <li>Number on level 4
6411 </li>
6412 </ol>
6413 </li>
6414 </ul>
6415 </li>
6416 <li>bullet level 2
6417 <ol>
6418 <li>Number on level 3
6419 </li>
6420 <li>Number on level 3
6421 </li>
6422 </ol>
6423 </li>
6424 </ul>
6425 <ol>
6426 <li>number level 2
6427 </li>
6428 </ol>
6429 </li>
6430 <li>Level 1
6431 <ul>
6432 <li><ul>
6433 <li> Level 3
6434 </li>
6435 </ul>
6436 </li>
6437 </ul>
6438 </li>
6439 </ul>
6440 <ol>
6441 <li><ul>
6442 <li><ul>
6443 <li> Level 3, but ordered
6444 </li>
6445 </ul>
6446 </li>
6447 </ul>
6448 </li>
6449 </ol>
6450
6451 !! end
6452
6453 !! test
6454 Nested lists 1
6455 !! input
6456 *foo
6457 **bar
6458 !! result
6459 <ul>
6460 <li>foo
6461 <ul>
6462 <li>bar
6463 </li>
6464 </ul>
6465 </li>
6466 </ul>
6467
6468 !! end
6469
6470 !! test
6471 Nested lists 2
6472 !! input
6473 **foo
6474 *bar
6475 !! result
6476 <ul>
6477 <li><ul>
6478 <li>foo
6479 </li>
6480 </ul>
6481 </li>
6482 <li>bar
6483 </li>
6484 </ul>
6485
6486 !! end
6487
6488 !! test
6489 Nested lists 3 (first element empty)
6490 !! input
6491 *
6492 **bar
6493 !! result
6494 <ul>
6495 <li>
6496 <ul>
6497 <li>bar
6498 </li>
6499 </ul>
6500 </li>
6501 </ul>
6502
6503 !! end
6504
6505 !! test
6506 Nested lists 4 (first element empty)
6507 !! input
6508 **
6509 *bar
6510 !! result
6511 <ul>
6512 <li><ul>
6513 <li>
6514 </li>
6515 </ul>
6516 </li>
6517 <li>bar
6518 </li>
6519 </ul>
6520
6521 !! end
6522
6523 !! test
6524 Nested lists 5 (both elements empty)
6525 !! input
6526 **
6527 *
6528 !! result
6529 <ul>
6530 <li><ul>
6531 <li>
6532 </li>
6533 </ul>
6534 </li>
6535 <li>
6536 </li>
6537 </ul>
6538
6539 !! end
6540
6541 !! test
6542 Nested lists 6 (both elements empty)
6543 !! input
6544 *
6545 **
6546 !! result
6547 <ul>
6548 <li>
6549 <ul>
6550 <li>
6551 </li>
6552 </ul>
6553 </li>
6554 </ul>
6555
6556 !! end
6557
6558 !! test
6559 Nested lists 7 (skip initial nesting levels)
6560 !! input
6561 *** foo
6562 !! result
6563 <ul>
6564 <li><ul>
6565 <li><ul>
6566 <li> foo
6567 </li>
6568 </ul>
6569 </li>
6570 </ul>
6571 </li>
6572 </ul>
6573
6574 !! end
6575
6576 !! test
6577 Nested lists 8 (multiple nesting transitions)
6578 !! input
6579 * foo
6580 *** bar
6581 ** baz
6582 * boo
6583 !! result
6584 <ul>
6585 <li> foo
6586 <ul>
6587 <li><ul>
6588 <li> bar
6589 </li>
6590 </ul>
6591 </li>
6592 <li> baz
6593 </li>
6594 </ul>
6595 </li>
6596 <li> boo
6597 </li>
6598 </ul>
6599
6600 !! end
6601
6602 !! test
6603 1. Lists with start-of-line-transparent tokens before bullets: Comments
6604 !! input
6605 *foo
6606 *<!--cmt-->bar
6607 <!--cmt-->*baz
6608 !! result
6609 <ul>
6610 <li>foo
6611 </li>
6612 <li>bar
6613 </li>
6614 <li>baz
6615 </li>
6616 </ul>
6617
6618 !! end
6619
6620 !! test
6621 2. Lists with start-of-line-transparent tokens before bullets: Template close
6622 !! input
6623 *foo {{echo|bar
6624 }}*baz
6625 !! result
6626 <ul>
6627 <li>foo bar
6628 </li>
6629 <li>baz
6630 </li>
6631 </ul>
6632
6633 !! end
6634
6635 !! test
6636 List items are not parsed correctly following a <pre> block (bug 785)
6637 !! input
6638 * <pre>foo</pre>
6639 * <pre>bar</pre>
6640 * zar
6641 !! result
6642 <ul>
6643 <li> <pre>foo</pre>
6644 </li>
6645 <li> <pre>bar</pre>
6646 </li>
6647 <li> zar
6648 </li>
6649 </ul>
6650
6651 !! end
6652
6653 !! test
6654 List items from template
6655 !! input
6656
6657 {{inner list}}
6658 * item 2
6659
6660 * item 0
6661 {{inner list}}
6662 * item 2
6663
6664 * item 0
6665 * notSOL{{inner list}}
6666 * item 2
6667 !! result
6668 <ul>
6669 <li> item 1
6670 </li>
6671 <li> item 2
6672 </li>
6673 </ul>
6674 <ul>
6675 <li> item 0
6676 </li>
6677 <li> item 1
6678 </li>
6679 <li> item 2
6680 </li>
6681 </ul>
6682 <ul>
6683 <li> item 0
6684 </li>
6685 <li> notSOL
6686 </li>
6687 <li> item 1
6688 </li>
6689 <li> item 2
6690 </li>
6691 </ul>
6692
6693 !! end
6694
6695 !! test
6696 List interrupted by empty line or heading
6697 !! input
6698 * foo
6699
6700 ** bar
6701 == A heading ==
6702 * Another list item
6703 !! result
6704 <ul>
6705 <li> foo
6706 </li>
6707 </ul>
6708 <ul>
6709 <li><ul>
6710 <li> bar
6711 </li>
6712 </ul>
6713 </li>
6714 </ul>
6715 <h2><span class="mw-headline" id="A_heading">A heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
6716 <ul>
6717 <li> Another list item
6718 </li>
6719 </ul>
6720
6721 !!end
6722
6723 !!test
6724 Multiple list tags generated by templates
6725 !!input
6726 {{echo|<li>}}a
6727 {{echo|<li>}}b
6728 {{echo|<li>}}c
6729 !!result
6730 <li>a
6731 <li>b
6732 <li>c</li>
6733 </li>
6734 </li>
6735
6736 !!end
6737
6738 !!test
6739 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
6740 !!input
6741 *a
6742 <!--This line will NOT split the list-->
6743 *b
6744 <!--This line will NOT split the list either-->
6745 *c
6746 <!--foo--> <!----> <!--This line NOT split the list either-->
6747 *d
6748 !!result
6749 <ul>
6750 <li>a
6751 </li>
6752 <li>b
6753 </li>
6754 <li>c
6755 </li>
6756 <li>d
6757 </li>
6758 </ul>
6759
6760 !!end
6761
6762 !!test
6763 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
6764 !!input
6765 *a
6766 <!--This line will NOT split the list-->
6767 *b
6768 <!--This line will NOT split the list either-->
6769 *c
6770 <!--foo--> <!----> <!--This line NOT split the list
6771 either-->
6772 *d
6773 !!result
6774 <ul>
6775 <li>a
6776 </li>
6777 <li>b
6778 </li>
6779 <li>c
6780 </li>
6781 <li>d
6782 </li>
6783 </ul>
6784
6785 !!end
6786
6787 !!test
6788 Test the li-hack
6789 (Cannot test this with PHP parser since it relies on Tidy for the hack)
6790 !!options
6791 parsoid=wt2html,wt2wt
6792 !!input
6793 * foo
6794 * <li>li-hack
6795 * {{echo|<li>templated li-hack}}
6796 * <!--foo--> <li> unsupported li-hack with preceding comments
6797
6798 <ul>
6799 <li><li>not a li-hack
6800 </li>
6801 </ul>
6802 !!result
6803 <ul>
6804 <li> foo</li>
6805 <li>li-hack</li>
6806 <li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<li>templated li-hack"}}}}]}'>templated li-hack</li>
6807 <li> <!--foo--> </li>
6808 <li> li-hack with preceding comments</li>
6809 </ul>
6810
6811 <ul>
6812 <li></li>
6813 <li>not a li-hack
6814 </li>
6815 </ul>
6816 !!end
6817
6818 !! test
6819 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
6820 !! options
6821 parsoid
6822 !! input
6823 # foo
6824 ## bar
6825 * foo
6826 ** bar
6827 : foo
6828 :: bar
6829 !! result
6830 <ol>
6831 <li> foo<ol>
6832 <li> bar</li>
6833 </ol></li>
6834 </ol><ul>
6835 <li> foo<ul>
6836 <li> bar</li>
6837 </ul></li>
6838 </ul><dl>
6839 <dd> foo<dl>
6840 <dd> bar</dd>
6841 </dl></dd>
6842 </dl>
6843 !! end
6844
6845 !! test
6846 Parsoid: Test of whitespace serialization with Templated bullets
6847 !! options
6848 parsoid
6849 !! input
6850 * {{bullet}}
6851 !! result
6852 <ul>
6853 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
6854 </ul>
6855 !! end
6856
6857 # ------------------------------------------------------------------------
6858 # The next set of tests are about Parsoid's ability to handle badly nested
6859 # tags (parse, minimize scope of fixup, and roundtrip back)
6860 # ------------------------------------------------------------------------
6861
6862 !! test
6863 Unbalanced closing block tags break a list
6864 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6865 !! options
6866 parsoid
6867 !! input
6868 <div>
6869 *a</div><div>
6870 *b</div>
6871 !! result
6872 <div>
6873 <ul>
6874 <li>a
6875 </li>
6876 </ul></div><div>
6877 <ul>
6878 <li>b
6879 </li>
6880 </ul></div>
6881 !! end
6882
6883 !! test
6884 Unbalanced closing non-block tags don't break a list
6885 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6886 !! options
6887 parsoid
6888 !! input
6889 <span>
6890 *a</span><span>
6891 *b</span>
6892 !! result
6893 <p><span></span>
6894 </p>
6895 <ul>
6896 <li>a<span></span>
6897 </li>
6898 <li>b
6899 </li>
6900 </ul>
6901 !! end
6902
6903 !! test
6904 Unclosed formatting tags that straddle lists are closed and reopened
6905 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6906 !! options
6907 parsoid
6908 !! input
6909 # <s> a
6910 # b </s>
6911 !! result
6912 <ol>
6913 <li> <s> a </s>
6914 </li>
6915 <li> <s> b </s>
6916 </li>
6917 </ol>
6918 !! end
6919
6920 !!test
6921 List embedded in a non-block tag
6922 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
6923 !! options
6924 parsoid
6925 !!input
6926 <small>
6927 * foo
6928 </small>
6929 !!result
6930 <p><small></small></p>
6931 <small>
6932 <ul>
6933 <li> foo</li>
6934 </ul>
6935 </small>
6936 <p><small></small></p>
6937 !!end
6938
6939 !! test
6940 Table with missing opening <tr> tag
6941 !! options
6942 parsoid=wt2html,wt2wt
6943 !! input
6944 <table>
6945 <td>foo</td>
6946 </tr>
6947 </table>
6948 !! result
6949 <table>
6950 <tr>
6951 <td>foo</td>
6952 </tr>
6953 </table>
6954 !! end
6955
6956 ###
6957 ### Magic Words
6958 ###
6959
6960 # Note that the current date is hard-coded as
6961 # 1970-01-01T00:02:03Z (a Thursday)
6962 # when running parser tests. The timezone is also fixed to GMT, so
6963 # local date will be identical to current date.
6964
6965 !! test
6966 Magic Word: {{CURRENTDAY}}
6967 !! input
6968 {{CURRENTDAY}}
6969 !! result
6970 <p>1
6971 </p>
6972 !! end
6973
6974 !! test
6975 Magic Word: {{CURRENTDAY2}}
6976 !! input
6977 {{CURRENTDAY2}}
6978 !! result
6979 <p>01
6980 </p>
6981 !! end
6982
6983 !! test
6984 Magic Word: {{CURRENTDAYNAME}}
6985 !! input
6986 {{CURRENTDAYNAME}}
6987 !! result
6988 <p>Thursday
6989 </p>
6990 !! end
6991
6992 !! test
6993 Magic Word: {{CURRENTDOW}}
6994 !! input
6995 {{CURRENTDOW}}
6996 !! result
6997 <p>4
6998 </p>
6999 !! end
7000
7001 !! test
7002 Magic Word: {{CURRENTMONTH}}
7003 !! input
7004 {{CURRENTMONTH}}
7005 !! result
7006 <p>01
7007 </p>
7008 !! end
7009
7010 !! test
7011 Magic Word: {{CURRENTMONTH1}}
7012 !! input
7013 {{CURRENTMONTH1}}
7014 !! result
7015 <p>1
7016 </p>
7017 !! end
7018
7019 !! test
7020 Magic Word: {{CURRENTMONTHABBREV}}
7021 !! input
7022 {{CURRENTMONTHABBREV}}
7023 !! result
7024 <p>Jan
7025 </p>
7026 !! end
7027
7028 !! test
7029 Magic Word: {{CURRENTMONTHNAME}}
7030 !! input
7031 {{CURRENTMONTHNAME}}
7032 !! result
7033 <p>January
7034 </p>
7035 !! end
7036
7037 !! test
7038 Magic Word: {{CURRENTMONTHNAMEGEN}}
7039 !! input
7040 {{CURRENTMONTHNAMEGEN}}
7041 !! result
7042 <p>January
7043 </p>
7044 !! end
7045
7046 !! test
7047 Magic Word: {{CURRENTTIME}}
7048 !! input
7049 {{CURRENTTIME}}
7050 !! result
7051 <p>00:02
7052 </p>
7053 !! end
7054
7055 !! test
7056 Magic Word: {{CURRENTHOUR}}
7057 !! input
7058 {{CURRENTHOUR}}
7059 !! result
7060 <p>00
7061 </p>
7062 !! end
7063
7064 !! test
7065 Magic Word: {{CURRENTWEEK}} (@bug 4594)
7066 !! input
7067 {{CURRENTWEEK}}
7068 !! result
7069 <p>1
7070 </p>
7071 !! end
7072
7073 !! test
7074 Magic Word: {{CURRENTYEAR}}
7075 !! input
7076 {{CURRENTYEAR}}
7077 !! result
7078 <p>1970
7079 </p>
7080 !! end
7081
7082 !! test
7083 Magic Word: {{CURRENTTIMESTAMP}}
7084 !! input
7085 {{CURRENTTIMESTAMP}}
7086 !! result
7087 <p>19700101000203
7088 </p>
7089 !! end
7090
7091 !! test
7092 Magic Words LOCAL (UTC)
7093 !! input
7094 * {{LOCALMONTH}}
7095 * {{LOCALMONTH1}}
7096 * {{LOCALMONTHNAME}}
7097 * {{LOCALMONTHNAMEGEN}}
7098 * {{LOCALMONTHABBREV}}
7099 * {{LOCALDAY}}
7100 * {{LOCALDAY2}}
7101 * {{LOCALDAYNAME}}
7102 * {{LOCALYEAR}}
7103 * {{LOCALTIME}}
7104 * {{LOCALHOUR}}
7105 * {{LOCALWEEK}}
7106 * {{LOCALDOW}}
7107 * {{LOCALTIMESTAMP}}
7108 !! result
7109 <ul>
7110 <li> 01
7111 </li>
7112 <li> 1
7113 </li>
7114 <li> January
7115 </li>
7116 <li> January
7117 </li>
7118 <li> Jan
7119 </li>
7120 <li> 1
7121 </li>
7122 <li> 01
7123 </li>
7124 <li> Thursday
7125 </li>
7126 <li> 1970
7127 </li>
7128 <li> 00:02
7129 </li>
7130 <li> 00
7131 </li>
7132 <li> 1
7133 </li>
7134 <li> 4
7135 </li>
7136 <li> 19700101000203
7137 </li>
7138 </ul>
7139
7140 !! end
7141
7142 !! test
7143 Magic Word: {{FULLPAGENAME}}
7144 !! options
7145 title=[[User:Ævar Arnfjörð Bjarmason]]
7146 !! input
7147 {{FULLPAGENAME}}
7148 !! result
7149 <p>User:Ævar Arnfjörð Bjarmason
7150 </p>
7151 !! end
7152
7153 !! test
7154 Magic Word: {{FULLPAGENAMEE}}
7155 !! options
7156 title=[[User:Ævar Arnfjörð Bjarmason]]
7157 !! input
7158 {{FULLPAGENAMEE}}
7159 !! result
7160 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7161 </p>
7162 !! end
7163
7164 !! test
7165 Magic Word: {{TALKSPACE}}
7166 !! options
7167 title=[[User:Ævar Arnfjörð Bjarmason]]
7168 !! input
7169 {{TALKSPACE}}
7170 !! result
7171 <p>User talk
7172 </p>
7173 !! end
7174
7175 !! test
7176 Magic Word: {{TALKSPACE}}, same namespace
7177 !! options
7178 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7179 !! input
7180 {{TALKSPACE}}
7181 !! result
7182 <p>User talk
7183 </p>
7184 !! end
7185
7186 !! test
7187 Magic Word: {{TALKSPACE}}, main namespace
7188 !! options
7189 title=[[Parser Test]]
7190 !! input
7191 {{TALKSPACE}}
7192 !! result
7193 <p>Talk
7194 </p>
7195 !! end
7196
7197 !! test
7198 Magic Word: {{TALKSPACEE}}
7199 !! options
7200 title=[[User:Ævar Arnfjörð Bjarmason]]
7201 !! input
7202 {{TALKSPACEE}}
7203 !! result
7204 <p>User_talk
7205 </p>
7206 !! end
7207
7208 !! test
7209 Magic Word: {{SUBJECTSPACE}}
7210 !! options
7211 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7212 !! input
7213 {{SUBJECTSPACE}}
7214 !! result
7215 <p>User
7216 </p>
7217 !! end
7218
7219 !! test
7220 Magic Word: {{SUBJECTSPACE}}, same namespace
7221 !! options
7222 title=[[User:Ævar Arnfjörð Bjarmason]]
7223 !! input
7224 {{SUBJECTSPACE}}
7225 !! result
7226 <p>User
7227 </p>
7228 !! end
7229
7230 !! test
7231 Magic Word: {{SUBJECTSPACE}}, main namespace
7232 !! options
7233 title=[[Parser Test]]
7234 !! input
7235 {{SUBJECTSPACE}}
7236 !! result
7237
7238 !! end
7239
7240 !! test
7241 Magic Word: {{SUBJECTSPACEE}}
7242 !! options
7243 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7244 !! input
7245 {{SUBJECTSPACEE}}
7246 !! result
7247 <p>User
7248 </p>
7249 !! end
7250
7251 !! test
7252 Magic Word: {{NAMESPACE}}
7253 !! options
7254 title=[[User:Ævar Arnfjörð Bjarmason]]
7255 !! input
7256 {{NAMESPACE}}
7257 !! result
7258 <p>User
7259 </p>
7260 !! end
7261
7262 !! test
7263 Magic Word: {{NAMESPACEE}}
7264 !! options
7265 title=[[User:Ævar Arnfjörð Bjarmason]]
7266 !! input
7267 {{NAMESPACEE}}
7268 !! result
7269 <p>User
7270 </p>
7271 !! end
7272
7273 !! test
7274 Magic Word: {{NAMESPACENUMBER}}
7275 !! options
7276 title=[[User:Ævar Arnfjörð Bjarmason]]
7277 !! input
7278 {{NAMESPACENUMBER}}
7279 !! result
7280 <p>2
7281 </p>
7282 !! end
7283
7284 !! test
7285 Magic Word: {{SUBPAGENAME}}
7286 !! options
7287 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7288 !! input
7289 {{SUBPAGENAME}}
7290 !! result
7291 <p>sub ö
7292 </p>
7293 !! end
7294
7295 !! test
7296 Magic Word: {{SUBPAGENAMEE}}
7297 !! options
7298 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7299 !! input
7300 {{SUBPAGENAMEE}}
7301 !! result
7302 <p>sub_%C3%B6
7303 </p>
7304 !! end
7305
7306 !! test
7307 Magic Word: {{ROOTPAGENAME}}
7308 !! options
7309 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7310 !! input
7311 {{ROOTPAGENAME}}
7312 !! result
7313 <p>Ævar Arnfjörð Bjarmason
7314 </p>
7315 !! end
7316
7317 !! test
7318 Magic Word: {{ROOTPAGENAMEE}}
7319 !! options
7320 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7321 !! input
7322 {{ROOTPAGENAMEE}}
7323 !! result
7324 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7325 </p>
7326 !! end
7327
7328 !! test
7329 Magic Word: {{BASEPAGENAME}}
7330 !! options
7331 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7332 !! input
7333 {{BASEPAGENAME}}
7334 !! result
7335 <p>Ævar Arnfjörð Bjarmason
7336 </p>
7337 !! end
7338
7339 !! test
7340 Magic Word: {{BASEPAGENAMEE}}
7341 !! options
7342 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7343 !! input
7344 {{BASEPAGENAMEE}}
7345 !! result
7346 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7347 </p>
7348 !! end
7349
7350 !! test
7351 Magic Word: {{TALKPAGENAME}}
7352 !! options
7353 title=[[User:Ævar Arnfjörð Bjarmason]]
7354 !! input
7355 {{TALKPAGENAME}}
7356 !! result
7357 <p>User talk:Ævar Arnfjörð Bjarmason
7358 </p>
7359 !! end
7360
7361 !! test
7362 Magic Word: {{TALKPAGENAMEE}}
7363 !! options
7364 title=[[User:Ævar Arnfjörð Bjarmason]]
7365 !! input
7366 {{TALKPAGENAMEE}}
7367 !! result
7368 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7369 </p>
7370 !! end
7371
7372 !! test
7373 Magic Word: {{SUBJECTPAGENAME}}
7374 !! options
7375 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7376 !! input
7377 {{SUBJECTPAGENAME}}
7378 !! result
7379 <p>User:Ævar Arnfjörð Bjarmason
7380 </p>
7381 !! end
7382
7383 !! test
7384 Magic Word: {{SUBJECTPAGENAMEE}}
7385 !! options
7386 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7387 !! input
7388 {{SUBJECTPAGENAMEE}}
7389 !! result
7390 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7391 </p>
7392 !! end
7393
7394 !! test
7395 Magic Word: {{NUMBEROFFILES}}
7396 !! input
7397 {{NUMBEROFFILES}}
7398 !! result
7399 <p>4
7400 </p>
7401 !! end
7402
7403 !! test
7404 Magic Word: {{PAGENAME}}
7405 !! options
7406 title=[[User:Ævar Arnfjörð Bjarmason]]
7407 !! input
7408 {{PAGENAME}}
7409 !! result
7410 <p>Ævar Arnfjörð Bjarmason
7411 </p>
7412 !! end
7413
7414 !! test
7415 Magic Word: {{PAGENAME}} with metacharacters
7416 !! options
7417 title=[['foo & bar = baz']]
7418 !! input
7419 ''{{PAGENAME}}''
7420 !! result
7421 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
7422 </p>
7423 !! end
7424
7425 !! test
7426 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
7427 !! options
7428 title=[[*RFC 1234 http://example.com/]]
7429 !! input
7430 {{PAGENAME}}
7431 !! result
7432 <p>&#42;RFC&#32;1234 http&#58;//example.com/
7433 </p>
7434 !! end
7435
7436 !! test
7437 Magic Word: {{PAGENAMEE}}
7438 !! options
7439 title=[[User:Ævar Arnfjörð Bjarmason]]
7440 !! input
7441 {{PAGENAMEE}}
7442 !! result
7443 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7444 </p>
7445 !! end
7446
7447 !! test
7448 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
7449 !! options
7450 title=[[*RFC 1234 http://example.com/]]
7451 !! input
7452 {{PAGENAMEE}}
7453 !! result
7454 <p>&#42;RFC_1234_http&#58;//example.com/
7455 </p>
7456 !! end
7457
7458 !! test
7459 Magic Word: {{REVISIONID}}
7460 !! input
7461 {{REVISIONID}}
7462 !! result
7463 <p>1337
7464 </p>
7465 !! end
7466
7467 !! test
7468 Magic Word: {{SCRIPTPATH}}
7469 !! input
7470 {{SCRIPTPATH}}
7471 !! result
7472 <p>/
7473 </p>
7474 !! end
7475
7476 !! test
7477 Magic Word: {{STYLEPATH}}
7478 !! input
7479 {{STYLEPATH}}
7480 !! result
7481 <p>/skins
7482 </p>
7483 !! end
7484
7485 !! test
7486 Magic Word: {{SERVER}}
7487 !! input
7488 {{SERVER}}
7489 !! result
7490 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7491 </p>
7492 !! end
7493
7494 !! test
7495 Magic Word: {{SERVERNAME}}
7496 !! input
7497 {{SERVERNAME}}
7498 !! result
7499 <p>example.org
7500 </p>
7501 !! end
7502
7503 !! test
7504 Magic Word: {{SITENAME}}
7505 !! input
7506 {{SITENAME}}
7507 !! result
7508 <p>MediaWiki
7509 </p>
7510 !! end
7511
7512 !! test
7513 Case-sensitive magic words, when cased differently, should just be template transclusions
7514 !! input
7515 {{CurrentMonth}}
7516 {{currentday}}
7517 {{cURreNTweEK}}
7518 {{currentHour}}
7519 !! result
7520 <p><a href="/index.php?title=Template:CurrentMonth&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentMonth (page does not exist)">Template:CurrentMonth</a>
7521 <a href="/index.php?title=Template:Currentday&amp;action=edit&amp;redlink=1" class="new" title="Template:Currentday (page does not exist)">Template:Currentday</a>
7522 <a href="/index.php?title=Template:CURreNTweEK&amp;action=edit&amp;redlink=1" class="new" title="Template:CURreNTweEK (page does not exist)">Template:CURreNTweEK</a>
7523 <a href="/index.php?title=Template:CurrentHour&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentHour (page does not exist)">Template:CurrentHour</a>
7524 </p>
7525 !! end
7526
7527 !! test
7528 Case-insensitive magic words should still work with weird casing.
7529 !! input
7530 {{sErVeRNaMe}}
7531 {{LCFirst:AOEU}}
7532 {{ucFIRST:aoeu}}
7533 {{SERver}}
7534 !! result
7535 <p>example.org
7536 aOEU
7537 Aoeu
7538 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7539 </p>
7540 !! end
7541
7542 !! test
7543 Namespace 1 {{ns:1}}
7544 !! input
7545 {{ns:1}}
7546 !! result
7547 <p>Talk
7548 </p>
7549 !! end
7550
7551 !! test
7552 Namespace 1 {{ns:01}}
7553 !! input
7554 {{ns:01}}
7555 !! result
7556 <p>Talk
7557 </p>
7558 !! end
7559
7560 !! test
7561 Namespace 0 {{ns:0}} (bug 4783)
7562 !! input
7563 {{ns:0}}
7564 !! result
7565
7566 !! end
7567
7568 !! test
7569 Namespace 0 {{ns:00}} (bug 4783)
7570 !! input
7571 {{ns:00}}
7572 !! result
7573
7574 !! end
7575
7576 !! test
7577 Namespace -1 {{ns:-1}}
7578 !! input
7579 {{ns:-1}}
7580 !! result
7581 <p>Special
7582 </p>
7583 !! end
7584
7585 !! test
7586 Namespace User {{ns:User}}
7587 !! input
7588 {{ns:User}}
7589 !! result
7590 <p>User
7591 </p>
7592 !! end
7593
7594 !! test
7595 Namespace User talk {{ns:User_talk}}
7596 !! input
7597 {{ns:User_talk}}
7598 !! result
7599 <p>User talk
7600 </p>
7601 !! end
7602
7603 !! test
7604 Namespace User talk {{ns:uSeR tAlK}}
7605 !! input
7606 {{ns:uSeR tAlK}}
7607 !! result
7608 <p>User talk
7609 </p>
7610 !! end
7611
7612 !! test
7613 Namespace File {{ns:File}}
7614 !! input
7615 {{ns:File}}
7616 !! result
7617 <p>File
7618 </p>
7619 !! end
7620
7621 !! test
7622 Namespace File {{ns:Image}}
7623 !! input
7624 {{ns:Image}}
7625 !! result
7626 <p>File
7627 </p>
7628 !! end
7629
7630 !! test
7631 Namespace (lang=de) Benutzer {{ns:User}}
7632 !! options
7633 language=de
7634 !! input
7635 {{ns:User}}
7636 !! result
7637 <p>Benutzer
7638 </p>
7639 !! end
7640
7641 !! test
7642 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
7643 !! options
7644 language=de
7645 !! input
7646 {{ns:3}}
7647 !! result
7648 <p>Benutzer Diskussion
7649 </p>
7650 !! end
7651
7652
7653 !! test
7654 Urlencode
7655 !! input
7656 {{urlencode:hi world?!}}
7657 {{urlencode:hi world?!|WIKI}}
7658 {{urlencode:hi world?!|PATH}}
7659 {{urlencode:hi world?!|QUERY}}
7660 !! result
7661 <p>hi+world%3F%21
7662 hi_world%3F!
7663 hi%20world%3F%21
7664 hi+world%3F%21
7665 </p>
7666 !! end
7667
7668 !! test
7669 Magic Word: prioritize type info over data-parsoid
7670 !! options
7671 parsoid=html2wt
7672 !! input
7673 __FORCETOC__
7674 !! result
7675 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
7676 !! end
7677
7678 !! test
7679 Magic Word: serialize on separate line (parsoid)
7680 !! options
7681 parsoid=wt2wt,html2wt
7682 !! input
7683 foo
7684 __NOTOC__
7685 bar
7686 !! result
7687 foo<meta property="mw:PageProp/notoc"/>bar
7688 !! end
7689
7690 !! test
7691 Magic Word: rt non-english wikis
7692 !! options
7693 parsoid=wt2wt
7694 language=de
7695 !! input
7696 __NOEDITSECTION__
7697 !! result
7698 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
7699 !! end
7700
7701 ###
7702 ### Magic links
7703 ###
7704 !! test
7705 Magic links: internal link to RFC (bug 479)
7706 !! input
7707 [[RFC 123]]
7708 !! result
7709 <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>
7710 </p>
7711 !! end
7712
7713 !! test
7714 Magic links: RFC (bug 479)
7715 !! input
7716 RFC 822
7717 !! result
7718 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
7719 </p>
7720 !! end
7721
7722 !! test
7723 Magic links: ISBN (bug 1937)
7724 !! input
7725 ISBN 0-306-40615-2
7726 !! result
7727 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
7728 </p>
7729 !! end
7730
7731 !! test
7732 Magic links: PMID incorrectly converts space to underscore
7733 !! input
7734 PMID 1234
7735 !! result
7736 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
7737 </p>
7738 !! end
7739
7740 ###
7741 ### Templates
7742 ####
7743
7744 !! test
7745 Nonexistent template
7746 !! input
7747 {{thistemplatedoesnotexist}}
7748 !! result
7749 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit&amp;redlink=1" class="new" title="Template:Thistemplatedoesnotexist (page does not exist)">Template:Thistemplatedoesnotexist</a>
7750 </p>
7751 !! end
7752
7753 !! test
7754 Template with invalid target containing tags
7755 !! input
7756 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
7757 !! result
7758 <p>{{a<b>b</b>|foo|a=b|a = b}}
7759 </p>
7760 !! end
7761
7762 !! test
7763 Template with invalid target containing unclosed tag
7764 !! input
7765 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
7766 !! result
7767 <p>{{a<b>|foo|a=b|a = b}}</b>
7768 </p>
7769 !! end
7770
7771 !! test
7772 Template with invalid target containing wikilink (php)
7773 !! options
7774 php
7775 !! input
7776 {{[[Main Page]]}}
7777 !! result
7778 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
7779 </p>
7780 !! end
7781
7782 !! test
7783 Template with invalid target containing wikilink (parsoid)
7784 !! options
7785 parsoid
7786 !! input
7787 {{[[Main Page]]}}
7788 !! result
7789 <p><span typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"[[Main Page]]"},"params":{},"i":0}}]}'>{{</span><a rel="mw:WikiLink" href="./Main_Page" about="#mwt1">Main Page</a><span about="#mwt1">}}</span></p>
7790 !! end
7791
7792 !! article
7793 Template:test
7794 !! text
7795 This is a test template
7796 !! endarticle
7797
7798 !! test
7799 Simple template
7800 !! input
7801 {{test}}
7802 !! result
7803 <p>This is a test template
7804 </p>
7805 !! end
7806
7807 !! test
7808 Template with explicit namespace
7809 !! input
7810 {{Template:test}}
7811 !! result
7812 <p>This is a test template
7813 </p>
7814 !! end
7815
7816
7817 !! article
7818 Template:paramtest
7819 !! text
7820 This is a test template with parameter {{{param}}}
7821 !! endarticle
7822
7823 !! test
7824 Template parameter
7825 !! input
7826 {{paramtest|param=foo}}
7827 !! result
7828 <p>This is a test template with parameter foo
7829 </p>
7830 !! end
7831
7832 !! article
7833 Template:paramtestnum
7834 !! text
7835 [[{{{1}}}|{{{2}}}]]
7836 !! endarticle
7837
7838 !! test
7839 Template unnamed parameter
7840 !! input
7841 {{paramtestnum|Main Page|the main page}}
7842 !! result
7843 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
7844 </p>
7845 !! end
7846
7847 !! article
7848 Template:templatesimple
7849 !! text
7850 (test)
7851 !! endarticle
7852
7853 !! article
7854 Template:templateredirect
7855 !! text
7856 #redirect [[Template:templatesimple]]
7857 !! endarticle
7858
7859 !! article
7860 Template:templateasargtestnum
7861 !! text
7862 {{{{{1}}}}}
7863 !! endarticle
7864
7865 !! article
7866 Template:templateasargtest
7867 !! text
7868 {{template{{{templ}}}}}
7869 !! endarticle
7870
7871 !! article
7872 Template:templateasargtest2
7873 !! text
7874 {{{{{templ}}}}}
7875 !! endarticle
7876
7877 !! test
7878 Template with template name as unnamed argument
7879 !! input
7880 {{templateasargtestnum|templatesimple}}
7881 !! result
7882 <p>(test)
7883 </p>
7884 !! end
7885
7886 !! test
7887 Template with template name as argument
7888 !! input
7889 {{templateasargtest|templ=simple}}
7890 !! result
7891 <p>(test)
7892 </p>
7893 !! end
7894
7895 !! test
7896 Template with template name as argument (2)
7897 !! input
7898 {{templateasargtest2|templ=templatesimple}}
7899 !! result
7900 <p>(test)
7901 </p>
7902 !! end
7903
7904 !! article
7905 Template:templateasargtestdefault
7906 !! text
7907 {{{{{templ|templatesimple}}}}}
7908 !! endarticle
7909
7910 !! article
7911 Template:templa
7912 !! text
7913 '''templ'''
7914 !! endarticle
7915
7916 !! test
7917 Template with default value
7918 !! input
7919 {{templateasargtestdefault}}
7920 !! result
7921 <p>(test)
7922 </p>
7923 !! end
7924
7925 !! test
7926 Template with default value (value set)
7927 !! input
7928 {{templateasargtestdefault|templ=templa}}
7929 !! result
7930 <p><b>templ</b>
7931 </p>
7932 !! end
7933
7934 !! test
7935 Template redirect
7936 !! input
7937 {{templateredirect}}
7938 !! result
7939 <p>(test)
7940 </p>
7941 !! end
7942
7943 !! test
7944 Template with argument in separate line
7945 !! input
7946 {{ templateasargtest |
7947 templ = simple }}
7948 !! result
7949 <p>(test)
7950 </p>
7951 !! end
7952
7953 !! test
7954 Template with complex template as argument
7955 !! input
7956 {{paramtest|
7957 param ={{ templateasargtest |
7958 templ = simple }}}}
7959 !! result
7960 <p>This is a test template with parameter (test)
7961 </p>
7962 !! end
7963
7964 !! test
7965 Template with thumb image (with link in description)
7966 !! input
7967 {{paramtest|
7968 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
7969 !! result
7970 This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
7971
7972 !! end
7973
7974 !! article
7975 Template:complextemplate
7976 !! text
7977 {{{1}}} {{paramtest|
7978 param ={{{param}}}}}
7979 !! endarticle
7980
7981 !! test
7982 Template with complex arguments
7983 !! input
7984 {{complextemplate|
7985 param ={{ templateasargtest |
7986 templ = simple }}|[[Template:complextemplate|link]]}}
7987 !! result
7988 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
7989 </p>
7990 !! end
7991
7992 !! test
7993 BUG 553: link with two variables in a piped link
7994 !! input
7995 {|
7996 |[[{{{1}}}|{{{2}}}]]
7997 |}
7998 !! result
7999 <table>
8000 <tr>
8001 <td>[[{{{1}}}|{{{2}}}]]
8002 </td></tr></table>
8003
8004 !! end
8005
8006 !! test
8007 Magic variable as template parameter
8008 !! input
8009 {{paramtest|param={{SITENAME}}}}
8010 !! result
8011 <p>This is a test template with parameter MediaWiki
8012 </p>
8013 !! end
8014
8015 !! article
8016 Template:linktest
8017 !! text
8018 [[{{{param}}}|link]]
8019 !! endarticle
8020
8021 !! test
8022 Template parameter as link source
8023 !! input
8024 {{linktest|param=Main Page}}
8025 !! result
8026 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
8027 </p>
8028 !! end
8029
8030 !!test
8031 Template-generated attribute string (k='v')
8032 !!input
8033 <span {{attr_str|id|v1}}>bar</span>
8034 !!result
8035 <p><span id="v1">bar</span>
8036 </p>
8037 !!end
8038
8039 !!article
8040 Template:paramtest2
8041 !! text
8042 including another template, {{paramtest|param={{{arg}}}}}
8043 !! endarticle
8044
8045 !! test
8046 Template passing argument to another template
8047 !! input
8048 {{paramtest2|arg='hmm'}}
8049 !! result
8050 <p>including another template, This is a test template with parameter 'hmm'
8051 </p>
8052 !! end
8053
8054 !! article
8055 Template:Linktest2
8056 !! text
8057 Main Page
8058 !! endarticle
8059
8060 !! test
8061 Template as link source
8062 !! input
8063 [[{{linktest2}}]]
8064
8065 [[{{linktest2}}|Main Page]]
8066
8067 [[{{linktest2}}]]Page
8068 !! result
8069 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8070 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8071 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
8072 </p>
8073 !! end
8074
8075
8076 !! article
8077 Template:loop1
8078 !! text
8079 {{loop2}}
8080 !! endarticle
8081
8082 !! article
8083 Template:loop2
8084 !! text
8085 {{loop1}}
8086 !! endarticle
8087
8088 !! test
8089 Template infinite loop
8090 !! input
8091 {{loop1}}
8092 !! result
8093 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
8094 </p>
8095 !! end
8096
8097 !! test
8098 Template from main namespace
8099 !! input
8100 {{:Main Page}}
8101 !! result
8102 <p>blah blah
8103 </p>
8104 !! end
8105
8106 !! article
8107 Template:table
8108 !! text
8109 {|
8110 | 1 || 2
8111 |-
8112 | 3 || 4
8113 |}
8114 !! endarticle
8115
8116 !! test
8117 BUG 529: Template with table, not included at beginning of line
8118 !! input
8119 foo {{table}}
8120 !! result
8121 <p>foo
8122 </p>
8123 <table>
8124 <tr>
8125 <td> 1 </td>
8126 <td> 2
8127 </td></tr>
8128 <tr>
8129 <td> 3 </td>
8130 <td> 4
8131 </td></tr></table>
8132
8133 !! end
8134
8135 !! test
8136 BUG 523: Template shouldn't eat newline (or add an extra one before table)
8137 !! input
8138 foo
8139 {{table}}
8140 !! result
8141 <p>foo
8142 </p>
8143 <table>
8144 <tr>
8145 <td> 1 </td>
8146 <td> 2
8147 </td></tr>
8148 <tr>
8149 <td> 3 </td>
8150 <td> 4
8151 </td></tr></table>
8152
8153 !! end
8154
8155 !! test
8156 BUG 41: Template parameters shown as broken links
8157 !! input
8158 {{{parameter}}}
8159 !! result
8160 <p>{{{parameter}}}
8161 </p>
8162 !! end
8163
8164 !! test
8165 Template with targets containing wikilinks
8166 !! input
8167 {{[[foo]]}}
8168
8169 {{[[{{echo|foo}}]]}}
8170
8171 {{{{echo|[[foo}}]]}}
8172 !! result
8173 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
8174 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
8175 </p><p>{{[[foo}}]]
8176 </p>
8177 !! end
8178
8179 !! article
8180 Template:MSGNW test
8181 !! text
8182 ''None'' of '''this''' should be
8183 * interpreted
8184 but rather passed unmodified
8185 {{test}}
8186 !! endarticle
8187
8188 # hmm, fix this or just deprecate msgnw and document its behavior?
8189 !! test
8190 msgnw keyword
8191 !! options
8192 disabled
8193 !! input
8194 {{msgnw:MSGNW test}}
8195 !! result
8196 <p>''None'' of '''this''' should be
8197 * interpreted
8198 but rather passed unmodified
8199 {{test}}
8200 </p>
8201 !! end
8202
8203 !! test
8204 int keyword
8205 !! input
8206 {{int:youhavenewmessages|lots of money|not!}}
8207 !! result
8208 <p>You have lots of money (not!).
8209 </p>
8210 !! end
8211
8212 !! article
8213 Template:Includes
8214 !! text
8215 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8216 !! endarticle
8217
8218 !! test
8219 <includeonly> and <noinclude> being included
8220 !! input
8221 {{Includes}}
8222 !! result
8223 <p>Foobar
8224 </p>
8225 !! end
8226
8227 !! article
8228 Template:Includes2
8229 !! text
8230 <onlyinclude>Foo</onlyinclude>bar
8231 !! endarticle
8232
8233 !! test
8234 <onlyinclude> being included
8235 !! input
8236 {{Includes2}}
8237 !! result
8238 <p>Foo
8239 </p>
8240 !! end
8241
8242
8243 !! article
8244 Template:Includes3
8245 !! text
8246 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
8247 !! endarticle
8248
8249 !! test
8250 <onlyinclude> and <includeonly> being included
8251 !! input
8252 {{Includes3}}
8253 !! result
8254 <p>Foo
8255 </p>
8256 !! end
8257
8258 !! test
8259 <includeonly> and <noinclude> on a page
8260 !! input
8261 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8262 !! result
8263 <p>Foozar
8264 </p>
8265 !! end
8266
8267 !! test
8268 Un-closed <noinclude>
8269 !! input
8270 <noinclude>
8271 !! result
8272 !! end
8273
8274 !! test
8275 <onlyinclude> on a page
8276 !! input
8277 <onlyinclude>Foo</onlyinclude>bar
8278 !! result
8279 <p>Foobar
8280 </p>
8281 !! end
8282
8283 !! test
8284 Un-closed <onlyinclude>
8285 !! input
8286 <onlyinclude>
8287 !! result
8288 !! end
8289
8290 !!test
8291 Self-closed noinclude, includeonly, onlyinclude tags
8292 !!input
8293 <noinclude />
8294 <includeonly />
8295 <onlyinclude />
8296 !!result
8297 <p><br />
8298 </p>
8299 !!end
8300
8301 !!test
8302 Unbalanced includeonly and noinclude tags
8303 !!input
8304 {|
8305 |a</noinclude>
8306 |b</noinclude></noinclude>
8307 |c</noinclude></includeonly>
8308 |d</includeonly></includeonly>
8309 |}
8310 !!result
8311 <table>
8312 <tr>
8313 <td>a
8314 </td>
8315 <td>b
8316 </td>
8317 <td>c&lt;/includeonly&gt;
8318 </td>
8319 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
8320 </td></tr></table>
8321
8322 !!end
8323
8324 !! article
8325 Template:Includeonly section
8326 !! text
8327 <includeonly>
8328 ==Includeonly section==
8329 </includeonly>
8330 ==Section T-1==
8331 !!endarticle
8332
8333 !! test
8334 Bug 6563: Edit link generation for section shown by <includeonly>
8335 !! input
8336 {{includeonly section}}
8337 !! result
8338 <h2><span class="mw-headline" id="Includeonly_section">Includeonly section</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8339 <h2><span class="mw-headline" id="Section_T-1">Section T-1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8340
8341 !! end
8342
8343 # Uses same input as the contents of [[Template:Includeonly section]]
8344 !! test
8345 Bug 6563: Section extraction for section shown by <includeonly>
8346 !! options
8347 section=T-2
8348 !! input
8349 <includeonly>
8350 ==Includeonly section==
8351 </includeonly>
8352 ==Section T-2==
8353 !! result
8354 ==Section T-2==
8355 !! end
8356
8357 !! test
8358 Bug 6563: Edit link generation for section suppressed by <includeonly>
8359 !! input
8360 <includeonly>
8361 ==Includeonly section==
8362 </includeonly>
8363 ==Section 1==
8364 !! result
8365 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8366
8367 !! end
8368
8369 !! test
8370 Bug 6563: Section extraction for section suppressed by <includeonly>
8371 !! options
8372 section=1
8373 !! input
8374 <includeonly>
8375 ==Includeonly section==
8376 </includeonly>
8377 ==Section 1==
8378 !! result
8379 ==Section 1==
8380 !! end
8381
8382 !! test
8383 Un-closed <includeonly>
8384 !! input
8385 <includeonly>
8386 !! result
8387 !! end
8388
8389 # TODO: test with DOM fragment reuse!
8390 !! test
8391 Parsoid: DOM fragment reuse
8392 !! options
8393 parsoid=wt2wt,wt2html
8394 !! input
8395 a{{echo|b<table></table>c}}d
8396
8397 a{{echo|b
8398 <table></table>
8399 c}}d
8400
8401 {{echo|a
8402
8403 <table></table>
8404
8405 b}}
8406 !! result
8407 a<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b
8408 <table></table>c"}},"i":0}}]}'>b</span>
8409 <table about="#mwt1"></table><span about="#mwt1">c</span>d
8410
8411
8412 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b\n<table></table>\nc"}},"i":0}},"d"]}'>ab</p><span about="#mwt2">
8413 </span>
8414 <table about="#mwt2"></table><span about="#mwt2">
8415 </span>
8416 <p about="#mwt2">cd</p>
8417
8418
8419 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n\n<table></table>\n\nb"}},"i":0}}]}'>a</p><span about="#mwt3">
8420
8421 </span>
8422 <table about="#mwt3"></table><span about="#mwt3">
8423
8424 </span>
8425 <p about="#mwt3">b</p>
8426 !! end
8427
8428 !! test
8429 Parsoid: Merge double tds (bug 50603)
8430 !! options
8431 parsoid
8432 !! input
8433 {|
8434 |{{echo|{{!}} foo}}
8435 |}
8436 !! result
8437 <table><tbody>
8438 <tr><td about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":0}}]}'> foo</td></tr>
8439 </tbody></table>
8440 !! end
8441
8442 !! test
8443 Parsoid: Merge double tds in nested transclusion content (bug 50603)
8444 !! options
8445 parsoid
8446 !! input
8447 {{echo|<div>}}
8448 {|
8449 |{{echo|{{!}} foo}}
8450 |}
8451 {{echo|</div>}}
8452 !! result
8453 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<div>"}},"i":0}},"\n{|\n|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":1}},"\n|}\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"</div>"}},"i":2}}]}'>
8454 <table><tbody>
8455 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
8456 </tbody></table>
8457 </div>
8458 !! end
8459
8460 ###
8461 ### <includeonly> and <noinclude> in attributes
8462 ###
8463 !!test
8464 0. includeonly around the entire attribute
8465 !!input
8466 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
8467 !!result
8468 <p><span id="v2">bar</span>
8469 </p>
8470 !!end
8471
8472 !!test
8473 1. includeonly in html attr key
8474 !!input
8475 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
8476 !!result
8477 <p><span id="foo">bar</span>
8478 </p>
8479 !!end
8480
8481 !!test
8482 2. includeonly in html attr value
8483 !!input
8484 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
8485 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
8486 !!result
8487 <p><span id="v1">bar</span>
8488 <span id="v1">bar</span>
8489 </p>
8490 !!end
8491
8492 !!test
8493 3. includeonly in part of an attr value
8494 !!input
8495 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
8496 !!result
8497 <p><span style="color:red;">bar</span>
8498 </p>
8499 !!end
8500
8501 !!test
8502 4. includeonly in table attributes
8503 !!input
8504 {|
8505 |- <noinclude>
8506 |-
8507 |a
8508 </noinclude>
8509 |- <includeonly>
8510 |-
8511 |b
8512 </includeonly>
8513 |}
8514 !!result
8515 <table>
8516
8517
8518 <tr>
8519 <td>a
8520 </td></tr>
8521 </table>
8522
8523 !!end
8524
8525 ###
8526 ### Testing parsing of templates where a template arg
8527 ### has the same name as the template itself.
8528 ###
8529
8530 !! article
8531 Template:quote
8532 !! text
8533 {{{quote|{{{1}}}}}}
8534 !! endarticle
8535
8536 !!test
8537 Templates: Template Name/Arg clash: 1. Use of positional param
8538 !!input
8539 {{quote|foo}}
8540 !!result
8541 <p>foo
8542 </p>
8543 !!end
8544
8545 !!test
8546 Templates: Template Name/Arg clash: 2. Use of named param
8547 !!input
8548 {{quote|quote=foo}}
8549 !!result
8550 <p>foo
8551 </p>
8552 !!end
8553
8554 !!test
8555 Templates: Template Name/Arg clash: 3. Use of named param with empty input
8556 !!input
8557 {{quote|quote}}
8558 !!result
8559 <p>quote
8560 </p>
8561 !!end
8562
8563 ###
8564 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
8565 ###
8566
8567 !!test
8568 Templates: 1. Simple use
8569 !!input
8570 {{echo|Foo}}
8571 !!result
8572 <p>Foo
8573 </p>
8574 !!end
8575
8576 !!test
8577 Templates: 2. Inside a block tag
8578 !!input
8579 <div>{{echo|Foo}}</div>
8580 <blockquote>{{echo|Foo}}</blockquote>
8581 !!result
8582 <div>Foo</div>
8583 <blockquote>Foo</blockquote>
8584
8585 !!end
8586
8587 !!test
8588 Templates: P-wrapping: 1a. Templates on consecutive lines
8589 !!input
8590 {{echo|Foo}}
8591 {{echo|bar}}
8592 !!result
8593 <p>Foo
8594 bar
8595 </p>
8596 !!end
8597
8598 !!test
8599 Templates: P-wrapping: 1b. Templates on consecutive lines
8600 !!input
8601 Foo
8602
8603 {{echo|bar}}
8604 {{echo|baz}}
8605 !!result
8606 <p>Foo
8607 </p><p>bar
8608 baz
8609 </p>
8610 !!end
8611
8612 !!test
8613 Templates: P-wrapping: 1c. Templates on consecutive lines
8614 !!input
8615 {{echo|Foo}}
8616 {{echo|bar}} <div>baz</div>
8617 !!result
8618 <p>Foo
8619 </p>
8620 bar <div>baz</div>
8621
8622 !!end
8623
8624 !!test
8625 Templates: P-wrapping: 1d. Template preceded by comment-only line
8626 !!options
8627 parsoid
8628 !!input
8629 <!-- foo -->
8630 {{echo|Bar}}
8631 !!result
8632 <!-- foo -->
8633
8634 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
8635 !!end
8636
8637 !!test
8638 Templates: Inline Text: 1. Multiple tmeplate uses
8639 !!input
8640 {{echo|Foo}}bar{{echo|baz}}
8641 !!result
8642 <p>Foobarbaz
8643 </p>
8644 !!end
8645
8646 !!test
8647 Templates: Inline Text: 2. Back-to-back template uses
8648 !!input
8649 {{echo|Foo}}{{echo|bar}}
8650 !!result
8651 <p>Foobar
8652 </p>
8653 !!end
8654
8655 !!test
8656 Templates: Block Tags: 1. Multiple template uses
8657 !!input
8658 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
8659 !!result
8660 <div>Foo</div><div>bar</div><div>baz</div>
8661
8662 !!end
8663
8664 !!test
8665 Templates: Block Tags: 2. Back-to-back template uses
8666 !!input
8667 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
8668 !!result
8669 <div>Foo</div><div>bar</div>
8670
8671 !!end
8672
8673 !!test
8674 Templates: Links: 1. Simple example
8675 !!input
8676 {{echo|[[Foo|bar]]}}
8677 !!result
8678 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8679 </p>
8680 !!end
8681
8682 !!test
8683 Templates: Links: 2. Generation of link href
8684 !!input
8685 [[{{echo|Foo}}|bar]]
8686 !!result
8687 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8688 </p>
8689 !!end
8690
8691 !!test
8692 Templates: Links: 3. Generation of part of a link href
8693 !!input
8694 [[Fo{{echo|o}}|bar]]
8695
8696 [[Foo{{echo|bar}}]]
8697
8698 [[Foo{{echo|bar}}baz]]
8699
8700 [[Foo{{echo|bar}}|bar]]
8701
8702 [[:Foo{{echo|bar}}]]
8703
8704 [[:Foo{{echo|bar}}|bar]]
8705 !!result
8706 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8707 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8708 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
8709 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
8710 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8711 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
8712 </p>
8713 !!end
8714
8715 !!test
8716 Templates: Links: 4. Multiple templates generating link href
8717 !!input
8718 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
8719 !!result
8720 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8721 </p>
8722 !!end
8723
8724 !!test
8725 Templates: Links: 5. Generation of link text
8726 !!input
8727 [[Foo|{{echo|bar}}]]
8728 !!result
8729 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8730 </p>
8731 !!end
8732
8733 !!test
8734 Templates: Links: 5. Nested templates (only outermost template should be marked)
8735 !!input
8736 {{echo|[[{{echo|Foo}}|bar]]}}
8737 !!result
8738 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8739 </p>
8740 !!end
8741
8742 !!test
8743 Templates: HTML Tag: 1. Generation of HTML attr. key
8744 !!input
8745 <div {{echo|style}}="color:red;">foo</div>
8746 !!result
8747 <div style="color:red;">foo</div>
8748
8749 !!end
8750
8751 !!test
8752 Templates: HTML Tag: 2. Generation of HTML attr. value
8753 !!input
8754 <div style={{echo|'color:red;'}}>foo</div>
8755 !!result
8756 <div style="color:red;">foo</div>
8757
8758 !!end
8759
8760 !!test
8761 Templates: HTML Tag: 3. Generation of HTML attr key and value
8762 !!input
8763 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
8764 !!result
8765 <div style="color:red;">foo</div>
8766
8767 !!end
8768
8769 !!test
8770 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
8771 !!input
8772 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
8773 !!result
8774 <div title="This is a long title with just one piece templated">foo</div>
8775
8776 !!end
8777
8778 !!test
8779 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
8780 !!input
8781 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
8782 !!result
8783 <div title="This is a long title with just one piece templated">foo</div>
8784
8785 !!end
8786
8787 !!test
8788 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
8789 !!input
8790 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
8791 !!result
8792 <div title="This is a long title with just one piece templated">foo</div>
8793
8794 !!end
8795
8796 !!test
8797 Templates: HTML Tag: 7. Generation of partial attribute key string
8798 !!input
8799 <div st{{echo|yle}}="color:red;">foo</div>
8800 !!result
8801 <div style="color:red;">foo</div>
8802
8803 !!end
8804
8805 !!test
8806 Templates: HTML Tables: 1. Generating start of a HTML table
8807 !!input
8808 {{echo|<table><tr><td>foo</td>}}</tr></table>
8809 !!result
8810 <table><tr><td>foo</td></tr></table>
8811
8812 !!end
8813
8814 !!test
8815 Templates: HTML Tables: 2a. Generating middle of a HTML table
8816 !!input
8817 <table><tr>{{echo|<td>foo</td>}}</tr></table>
8818 !!result
8819 <table><tr><td>foo</td></tr></table>
8820
8821 !!end
8822
8823 !!test
8824 Templates: HTML Tables: 2b. Generating middle of a HTML table
8825 !!input
8826 <table>{{echo|<tr><td>foo</td></tr>}}</table>
8827 !!result
8828 <table><tr><td>foo</td></tr></table>
8829
8830 !!end
8831
8832 !!test
8833 Templates: HTML Tables: 3. Generating end of a HTML table
8834 !!input
8835 <table><tr>{{echo|<td>foo</td></tr></table>}}
8836 !!result
8837 <table><tr><td>foo</td></tr></table>
8838
8839 !!end
8840
8841 !!test
8842 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
8843 !!input
8844 {{echo|<table>}}<tr><td>foo</td></tr></table>
8845 !!result
8846 <table><tr><td>foo</td></tr></table>
8847
8848 !!end
8849
8850 !!test
8851 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
8852 !!input
8853 <table>{{echo|<tr>}}<td>foo</td></tr></table>
8854 !!result
8855 <table><tr><td>foo</td></tr></table>
8856
8857 !!end
8858
8859 !!test
8860 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
8861 !!input
8862 <table><tr>{{echo|<td>}}foo</td></tr></table>
8863 !!result
8864 <table><tr><td>foo</td></tr></table>
8865
8866 !!end
8867
8868 !!test
8869 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
8870 !!input
8871 <table><tr><td>foo{{echo|</td>}}</tr></table>
8872 !!result
8873 <table><tr><td>foo</td></tr></table>
8874
8875 !!end
8876
8877 !!test
8878 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
8879 !!input
8880 <table><tr><td>foo</td>{{echo|</tr>}}</table>
8881 !!result
8882 <table><tr><td>foo</td></tr></table>
8883
8884 !!end
8885
8886 !!test
8887 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
8888 !!input
8889 <table><tr><td>foo</td></tr>{{echo|</table>}}
8890 !!result
8891 <table><tr><td>foo</td></tr></table>
8892
8893 !!end
8894
8895 !!test
8896 Templates: HTML Tables: 5. Proper fostering of categories from inside
8897 !!options
8898 parsoid=wt2html,wt2wt
8899 !!input
8900 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
8901 <!--Two categories (Bug 50330)-->
8902 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
8903 !!result
8904 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
8905 <!--Two categories (Bug 50330)-->
8906 <link rel="mw:PageProp/Category" href="./Category:Bar1"><link rel="mw:PageProp/Category" href="./Category:Bar2"><table><tbody><tr><td>foo</td></tr></tbody></table>
8907 !!end
8908
8909 !!test
8910 Templates: Wiki Tables: 1a. Fostering of entire template content
8911 !!input
8912 {|
8913 {{echo|a}}
8914 |}
8915 !!result
8916 <table>
8917 a
8918 <tr><td></td></tr></table>
8919
8920 !!end
8921
8922 !!test
8923 Templates: Wiki Tables: 1b. Fostering of entire template content
8924 !!input
8925 {|
8926 {{echo|<div>}}
8927 foo
8928 {{echo|</div>}}
8929 |}
8930 !!result
8931 <table>
8932 <div>
8933 <p>foo
8934 </p>
8935 </div>
8936 <tr><td></td></tr></table>
8937
8938 !!end
8939
8940 !!test
8941 Templates: Wiki Tables: 2. Fostering of partial template content
8942 !!input
8943 {|
8944 {{echo|a
8945 <div>b</div>}}
8946 |}
8947 !!result
8948 <table>
8949 a
8950 <div>b</div>
8951 <tr><td></td></tr></table>
8952
8953 !!end
8954
8955 !!test
8956 Templates: Wiki Tables: 3. td-content via multiple templates
8957 !!input
8958 {|
8959 {{echo|{{pipe}}a}}{{echo|b}}
8960 |}
8961 !!result
8962 <table>
8963 <tr>
8964 <td>ab
8965 </td></tr></table>
8966
8967 !!end
8968
8969 !!test
8970 Templates: Wiki Tables: 4. Templated tags, no content
8971 !!input
8972 {{tbl-start}}
8973 {{tbl-end}}
8974 !!result
8975 <table>
8976 <tr><td></td></tr></table>
8977
8978 !!end
8979
8980 !!test
8981 Templates: Wiki Tables: 5. Templated tags, regular td-tags
8982 !!input
8983 {{tbl-start}}
8984 |foo
8985 {{tbl-end}}
8986 !!result
8987 <table>
8988 <tr>
8989 <td>foo
8990 </td></tr></table>
8991
8992 !!end
8993
8994 !!test
8995 Templates: Wiki Tables: 6. Templated tags, templated td-tags
8996 !!input
8997 {{tbl-start}}
8998 {{!}}foo
8999 {{tbl-end}}
9000 !!result
9001 <table>
9002 <tr>
9003 <td>foo
9004 </td></tr></table>
9005
9006 !!end
9007
9008 !!test
9009 Templates: Lists: Multi-line list-items via templates
9010 !!input
9011 *{{echo|a {{nonexistent|
9012 unused}}}}
9013 *{{echo|b {{nonexistent|
9014 unused}}}}
9015 !!result
9016 <ul>
9017 <li>a <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a>
9018 </li>
9019 <li>b <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a>
9020 </li>
9021 </ul>
9022
9023 !!end
9024
9025 !!test
9026 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
9027 !!input
9028 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
9029 !!result
9030 <p><i>ab</i>c<i>d</i>e
9031 </p>
9032 !!end
9033
9034 !!test
9035 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
9036 (PHP parser generates misnested html)
9037 !! options
9038 parsoid
9039 !!input
9040 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
9041 !!result
9042 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''a&quot;}},&quot;i&quot;:0}}]}"><i>a</i></span><i about="#mwt2" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;b''c''d&quot;}},&quot;i&quot;:0}},{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''e&quot;}},&quot;i&quot;:1}}]}"><span>b</span></i><span about="#mwt2">c</span><i about="#mwt2">d<span></span></i><span about="#mwt2">e</span></p>
9043 !!end
9044
9045 !!test
9046 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
9047 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
9048 !! options
9049 parsoid=wt2html,wt2wt
9050 !!input
9051 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
9052 !!result
9053 <div about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''a&quot;}},&quot;i&quot;:0}}]}"><i>a</i></div>
9054 <div about="#mwt2" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;b''c''d&quot;}},&quot;i&quot;:0}}]}"><i>b</i>c<i>d</i></div>
9055 <div about="#mwt3" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''e&quot;}},&quot;i&quot;:0}}]}">e</div>
9056 !!end
9057
9058 !!test
9059 Templates: Ugly nesting: 4. Divs opened/closed across templates
9060 !!input
9061 a<div>b{{echo|c</div>d}}e
9062 !!result
9063 a<div>bc</div>de
9064
9065 !!end
9066
9067 !!test
9068 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
9069 (Parsoid-centric)
9070 !! options
9071 parsoid
9072 !!input
9073 {|
9074 |{{echo|foo</table>}}
9075 |bar
9076 |}
9077 !!result
9078 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["{|\n|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo</table>"}},"i":0}},"\n|bar\n|}"]}'>
9079
9080 <tbody>
9081 <tr>
9082 <td>foo</td></tr></tbody></table><span about="#mwt1">
9083 </span><span about="#mwt1">|bar</span><span about="#mwt1">
9084 |}</span>
9085 !!end
9086
9087 !!test
9088 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
9089 (Parsoid-centric)
9090 !! options
9091 parsoid
9092 !!input
9093 <table>
9094 <tr>
9095 <td>
9096 <table>
9097 <tr>
9098 <td>1. {{echo|foo </table>}}</td>
9099 <td> bar </td>
9100 <td>2. {{echo|baz </table>}}</td>
9101 </tr>
9102 <tr>
9103 <td>abc</td>
9104 </tr>
9105 </table>
9106 </td>
9107 </tr>
9108 <tr>
9109 <td>xyz</td>
9110 </tr>
9111 </table>
9112 !!result
9113 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["<table>\n <tr>\n <td>\n <table>\n <tr>\n <td>1. ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo </table>"}},"i":0}},"</td>\n <td> bar </td>\n <td>2. ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"baz </table>"}},"i":1}},"</td>\n </tr>\n <tr>\n <td>abc</td>\n </tr>\n </table>\n </td>\n </tr>\n <tr>\n <td>xyz</td>\n </tr>\n</table>"]}'>
9114 <tbody><tr>
9115 <td>
9116 <table>
9117 <tbody><tr>
9118 <td>1. foo </td></tr></tbody></table></td>
9119 <td> bar </td>
9120 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
9121 </span><span about="#mwt2">
9122 </span><span about="#mwt2">
9123 </span><span about="#mwt2">abc</span><span about="#mwt2">
9124 </span><span about="#mwt2">
9125 </span><span about="#mwt2">
9126 </span><span about="#mwt2">
9127 </span><span about="#mwt2">
9128 </span><span about="#mwt2">
9129 </span><span about="#mwt2">xyz</span><span about="#mwt2">
9130 </span><span about="#mwt2">
9131 </span>
9132 !!end
9133
9134 !! test
9135 Templates: Ugly templates: 3. newline-only template parameter
9136 !! input
9137 foo {{echo|
9138 }}
9139 !! result
9140 <p>foo
9141 </p>
9142 !! end
9143
9144 # This looks like a bug: a single newline triggers p/br for some reason.
9145 !! test
9146 Templates: Ugly templates: 4. newline-only template parameter inconsistency
9147 !! input
9148 {{echo|
9149 }}
9150 !! result
9151 <p><br />
9152 </p>
9153 !! end
9154
9155
9156 !!test
9157 Parser Functions: 1. Simple example
9158 !!input
9159 {{uc:foo}}
9160 !!result
9161 <p>FOO
9162 </p>
9163 !!end
9164
9165 !!test
9166 Parser Functions: 2. Nested use (only outermost should be marked up)
9167 !!input
9168 {{uc:{{lc:FOO}}}}
9169 !!result
9170 <p>FOO
9171 </p>
9172 !!end
9173
9174 ###
9175 ### Pre-save transform tests
9176 ###
9177 !! test
9178 pre-save transform: subst:
9179 !! options
9180 PST
9181 !! input
9182 {{subst:test}}
9183 !! result
9184 This is a test template
9185 !! end
9186
9187 !! test
9188 pre-save transform: normal template
9189 !! options
9190 PST
9191 !! input
9192 {{test}}
9193 !! result
9194 {{test}}
9195 !! end
9196
9197 !! test
9198 pre-save transform: nonexistent template
9199 !! options
9200 PST
9201 !! input
9202 {{thistemplatedoesnotexist}}
9203 !! result
9204 {{thistemplatedoesnotexist}}
9205 !! end
9206
9207
9208 !! test
9209 pre-save transform: subst magic variables
9210 !! options
9211 PST
9212 !! input
9213 {{subst:SITENAME}}
9214 !! result
9215 MediaWiki
9216 !! end
9217
9218 # This is bug 89, which I fixed. -- wtm
9219 !! test
9220 pre-save transform: subst: templates with parameters
9221 !! options
9222 pst
9223 !! input
9224 {{subst:paramtest|param="something else"}}
9225 !! result
9226 This is a test template with parameter "something else"
9227 !! end
9228
9229 !! article
9230 Template:nowikitest
9231 !! text
9232 <nowiki>'''not wiki'''</nowiki>
9233 !! endarticle
9234
9235 !! test
9236 pre-save transform: nowiki in subst (bug 1188)
9237 !! options
9238 pst
9239 !! input
9240 {{subst:nowikitest}}
9241 !! result
9242 <nowiki>'''not wiki'''</nowiki>
9243 !! end
9244
9245
9246 !! article
9247 Template:commenttest
9248 !! text
9249 This template has <!-- a comment --> in it.
9250 !! endarticle
9251
9252 !! test
9253 pre-save transform: comment in subst (bug 1936)
9254 !! options
9255 pst
9256 !! input
9257 {{subst:commenttest}}
9258 !! result
9259 This template has <!-- a comment --> in it.
9260 !! end
9261
9262 !! test
9263 pre-save transform: unclosed tag
9264 !! options
9265 pst noxml
9266 !! input
9267 <nowiki>'''not wiki'''
9268 !! result
9269 <nowiki>'''not wiki'''
9270 !! end
9271
9272 !! test
9273 pre-save transform: mixed tag case
9274 !! options
9275 pst noxml
9276 !! input
9277 <NOwiki>'''not wiki'''</noWIKI>
9278 !! result
9279 <NOwiki>'''not wiki'''</noWIKI>
9280 !! end
9281
9282 !! test
9283 pre-save transform: unclosed comment in <nowiki>
9284 !! options
9285 pst noxml
9286 !! input
9287 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9288 !! result
9289 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9290 !!end
9291
9292 # Leading @ in this template definition works around a limitation
9293 # in parsoid's parserTests which otherwise strips the <span> from the
9294 # result (confusing it for a template wrapper)
9295 !! article
9296 Template:dangerous
9297 !!text
9298 @<span onmouseover="alert('crap')">Oh no</span>
9299 !!endarticle
9300
9301 !!test
9302 (confirming safety of fix for subst bug 1936)
9303 !! input
9304 {{Template:dangerous}}
9305 !! result
9306 <p>@<span>Oh no</span>
9307 </p>
9308 !! end
9309
9310 !! test
9311 pre-save transform: comment containing gallery (bug 5024)
9312 !! options
9313 pst
9314 !! input
9315 <!-- <gallery>data</gallery> -->
9316 !!result
9317 <!-- <gallery>data</gallery> -->
9318 !!end
9319
9320 !! test
9321 pre-save transform: comment containing extension
9322 !! options
9323 pst
9324 !! input
9325 <!-- <tag>data</tag> -->
9326 !!result
9327 <!-- <tag>data</tag> -->
9328 !!end
9329
9330 !! test
9331 pre-save transform: comment containing nowiki
9332 !! options
9333 pst
9334 !! input
9335 <!-- <nowiki>data</nowiki> -->
9336 !!result
9337 <!-- <nowiki>data</nowiki> -->
9338 !!end
9339
9340 !! test
9341 pre-save transform: <noinclude> in subst (bug 3298)
9342 !! options
9343 pst
9344 !! input
9345 {{subst:Includes}}
9346 !! result
9347 Foobar
9348 !! end
9349
9350 !! test
9351 pre-save transform: <onlyinclude> in subst (bug 3298)
9352 !! options
9353 pst
9354 !! input
9355 {{subst:Includes2}}
9356 !! result
9357 Foo
9358 !! end
9359
9360 !! article
9361 Template:SubstTest
9362 !!text
9363 {{<includeonly>subst:</includeonly>Includes}}
9364 !! endarticle
9365
9366 !! article
9367 Template:SafeSubstTest
9368 !! text
9369 {{<includeonly>safesubst:</includeonly>Includes}}
9370 !! endarticle
9371
9372 !! test
9373 bug 22297: safesubst: works during PST
9374 !! options
9375 pst
9376 !! input
9377 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
9378 !! result
9379 FoobarFoobar
9380 !! end
9381
9382 !! test
9383 bug 22297: safesubst: works during normal parse
9384 !! input
9385 {{SafeSubstTest}}
9386 !! result
9387 <p>Foobar
9388 </p>
9389 !! end
9390
9391 !! test:
9392 subst: does not work during normal parse
9393 !! input
9394 {{SubstTest}}
9395 !! result
9396 <p>{{subst:Includes}}
9397 </p>
9398 !! end
9399
9400 !! test
9401 pre-save transform: context links ("pipe trick")
9402 !! options
9403 pst
9404 !! input
9405 [[Article (context)|]]
9406 [[Bar:Article|]]
9407 [[:Bar:Article|]]
9408 [[Bar:Article (context)|]]
9409 [[:Bar:Article (context)|]]
9410 [[|Article]]
9411 [[|Article (context)]]
9412 [[Bar:X (Y) Z|]]
9413 [[:Bar:X (Y) Z|]]
9414 !! result
9415 [[Article (context)|Article]]
9416 [[Bar:Article|Article]]
9417 [[:Bar:Article|Article]]
9418 [[Bar:Article (context)|Article]]
9419 [[:Bar:Article (context)|Article]]
9420 [[Article]]
9421 [[Article (context)]]
9422 [[Bar:X (Y) Z|X (Y) Z]]
9423 [[:Bar:X (Y) Z|X (Y) Z]]
9424 !! end
9425
9426 !! test
9427 pre-save transform: context links ("pipe trick") with interwiki prefix
9428 !! options
9429 pst
9430 !! input
9431 [[interwiki:Article|]]
9432 [[:interwiki:Article|]]
9433 [[interwiki:Bar:Article|]]
9434 [[:interwiki:Bar:Article|]]
9435 !! result
9436 [[interwiki:Article|Article]]
9437 [[:interwiki:Article|Article]]
9438 [[interwiki:Bar:Article|Bar:Article]]
9439 [[:interwiki:Bar:Article|Bar:Article]]
9440 !! end
9441
9442 !! test
9443 pre-save transform: context links ("pipe trick") with parens in title
9444 !! options
9445 pst title=[[Somearticle (context)]]
9446 !! input
9447 [[|Article]]
9448 !! result
9449 [[Article (context)|Article]]
9450 !! end
9451
9452 !! test
9453 pre-save transform: context links ("pipe trick") with comma in title
9454 !! options
9455 pst title=[[Someplace, Somewhere]]
9456 !! input
9457 [[|Otherplace]]
9458 [[Otherplace, Elsewhere|]]
9459 [[Otherplace, Elsewhere, Anywhere|]]
9460 !! result
9461 [[Otherplace, Somewhere|Otherplace]]
9462 [[Otherplace, Elsewhere|Otherplace]]
9463 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
9464 !! end
9465
9466 !! test
9467 pre-save transform: context links ("pipe trick") with parens and comma
9468 !! options
9469 pst title=[[Someplace (IGNORED), Somewhere]]
9470 !! input
9471 [[|Otherplace]]
9472 [[Otherplace (place), Elsewhere|]]
9473 !! result
9474 [[Otherplace, Somewhere|Otherplace]]
9475 [[Otherplace (place), Elsewhere|Otherplace]]
9476 !! end
9477
9478 !! test
9479 pre-save transform: context links ("pipe trick") with comma and parens
9480 !! options
9481 pst title=[[Who, me? (context)]]
9482 !! input
9483 [[|Yes, you.]]
9484 [[Me, Myself, and I (1937 song)|]]
9485 !! result
9486 [[Yes, you. (context)|Yes, you.]]
9487 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
9488 !! end
9489
9490 !! test
9491 pre-save transform: context links ("pipe trick") with namespace
9492 !! options
9493 pst title=[[Ns:Somearticle]]
9494 !! input
9495 [[|Article]]
9496 !! result
9497 [[Ns:Article|Article]]
9498 !! end
9499
9500 !! test
9501 pre-save transform: context links ("pipe trick") with namespace and parens
9502 !! options
9503 pst title=[[Ns:Somearticle (context)]]
9504 !! input
9505 [[|Article]]
9506 !! result
9507 [[Ns:Article (context)|Article]]
9508 !! end
9509
9510 !! test
9511 pre-save transform: context links ("pipe trick") with namespace and comma
9512 !! options
9513 pst title=[[Ns:Somearticle, Context, Whatever]]
9514 !! input
9515 [[|Article]]
9516 !! result
9517 [[Ns:Article, Context, Whatever|Article]]
9518 !! end
9519
9520 !! test
9521 pre-save transform: context links ("pipe trick") with namespace, comma and parens
9522 !! options
9523 pst title=[[Ns:Somearticle, Context (context)]]
9524 !! input
9525 [[|Article]]
9526 !! result
9527 [[Ns:Article (context)|Article]]
9528 !! end
9529
9530 !! test
9531 pre-save transform: context links ("pipe trick") with namespace, parens and comma
9532 !! options
9533 pst title=[[Ns:Somearticle (IGNORED), Context]]
9534 !! input
9535 [[|Article]]
9536 !! result
9537 [[Ns:Article, Context|Article]]
9538 !! end
9539
9540 !! test
9541 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
9542 !! options
9543 pst
9544 !! input
9545 [[Article(context)|]]
9546 [[Bar:Article(context)|]]
9547 [[:Bar:Article(context)|]]
9548 [[|Article(context)]]
9549 [[Bar:X(Y)Z|]]
9550 [[:Bar:X(Y)Z|]]
9551 !! result
9552 [[Article(context)|Article]]
9553 [[Bar:Article(context)|Article]]
9554 [[:Bar:Article(context)|Article]]
9555 [[Article(context)]]
9556 [[Bar:X(Y)Z|X(Y)Z]]
9557 [[:Bar:X(Y)Z|X(Y)Z]]
9558 !! end
9559
9560 !! test
9561 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
9562 !! options
9563 pst
9564 !! input
9565 [[Article (context)|]]
9566 [[Bar:Article (context)|]]
9567 [[:Bar:Article (context)|]]
9568 [[|Article (context)]]
9569 [[Bar:X (Y) Z|]]
9570 [[:Bar:X (Y) Z|]]
9571 !! result
9572 [[Article (context)|Article]]
9573 [[Bar:Article (context)|Article]]
9574 [[:Bar:Article (context)|Article]]
9575 [[Article (context)]]
9576 [[Bar:X (Y) Z|X (Y) Z]]
9577 [[:Bar:X (Y) Z|X (Y) Z]]
9578 !! end
9579
9580 !! test
9581 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
9582 !! options
9583 pst
9584 !! input
9585 [[Article(context)|]]
9586 [[Bar:Article(context)|]]
9587 [[:Bar:Article(context)|]]
9588 [[|Article(context)]]
9589 [[Bar:X(Y)Z|]]
9590 [[:Bar:X(Y)Z|]]
9591 !! result
9592 [[Article(context)|Article]]
9593 [[Bar:Article(context)|Article]]
9594 [[:Bar:Article(context)|Article]]
9595 [[Article(context)]]
9596 [[Bar:X(Y)Z|X(Y)Z]]
9597 [[:Bar:X(Y)Z|X(Y)Z]]
9598 !! end
9599
9600 !! test
9601 pre-save transform: context links ("pipe trick") with commas (bug 21660)
9602 !! options
9603 pst
9604 !! input
9605 [[Article (context), context|]]
9606 [[Article (context),context|]]
9607 [[Bar:Article (context), context|]]
9608 [[Bar:Article (context),context|]]
9609 [[:Bar:Article (context), context|]]
9610 [[:Bar:Article (context),context|]]
9611 !! result
9612 [[Article (context), context|Article]]
9613 [[Article (context),context|Article]]
9614 [[Bar:Article (context), context|Article]]
9615 [[Bar:Article (context),context|Article]]
9616 [[:Bar:Article (context), context|Article]]
9617 [[:Bar:Article (context),context|Article]]
9618 !! end
9619
9620 !! test
9621 pre-save transform: trim trailing empty lines
9622 !! options
9623 pst
9624 !! input
9625 Empty lines are trimmed
9626
9627
9628
9629
9630 !! result
9631 Empty lines are trimmed
9632 !! end
9633
9634 !! test
9635 pre-save transform: Signature expansion
9636 !! options
9637 pst
9638 !! input
9639 * ~~~
9640 * <noinclude>~~~</noinclude>
9641 * <includeonly>~~~</includeonly>
9642 * <onlyinclude>~~~</onlyinclude>
9643 !! result
9644 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
9645 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
9646 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
9647 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
9648 !! end
9649
9650
9651 !! test
9652 pre-save transform: Signature expansion in nowiki tags (bug 93)
9653 !! options
9654 pst disabled
9655 !! input
9656 Shall not expand:
9657
9658 <nowiki>~~~~</nowiki>
9659
9660 <includeonly><nowiki>~~~~</nowiki></includeonly>
9661
9662 <noinclude><nowiki>~~~~</nowiki></noinclude>
9663
9664 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
9665
9666 {{subst:Foo}} shall be converted to FOO
9667
9668 As well as inside noinclude/onlyinclude
9669 <noinclude>{{subst:Foo}}</noinclude>
9670 <onlyinclude>{{subst:Foo}}</onlyinclude>
9671
9672 But not inside includeonly
9673 <includeonly>{{subst:Foo}}</includeonly>
9674 !! result
9675 Shall not expand:
9676
9677 <nowiki>~~~~</nowiki>
9678
9679 <includeonly><nowiki>~~~~</nowiki></includeonly>
9680
9681 <noinclude><nowiki>~~~~</nowiki></noinclude>
9682
9683 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
9684
9685 FOO shall be converted to FOO
9686
9687 As well as inside noinclude/onlyinclude
9688 <noinclude>FOO</noinclude>
9689 <onlyinclude>FOO</onlyinclude>
9690
9691 But not inside includeonly
9692 <includeonly>{{subst:Foo}}</includeonly>
9693 !! end
9694
9695 !! test
9696 Parsoid: Recognize nowiki with trailing space in tags
9697 !! options
9698 parsoid=wt2html
9699 !! input
9700 <nowiki ><div>[[foo]]</nowiki >
9701
9702 a<nowiki / >b
9703
9704 c<nowiki />d
9705
9706 e<nowiki/ >f
9707 !! result
9708 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
9709 <p>ab</p>
9710 <p>cd</p>
9711 <p>ef</p>
9712 !! end
9713
9714 !! test
9715 Parsoid: Recognize nowiki with odd capitalization
9716 !! options
9717 parsoid=wt2html
9718 !! input
9719 <noWikI ><div>[[foo]]</Nowiki >
9720 !! result
9721 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
9722 !! end
9723
9724
9725 !! test
9726 Parsoid: Escape nowiki with trailing space in tags
9727 !! options
9728 parsoid=html2wt
9729 !! input
9730 &lt;nowiki &gt; foo &lt;/nowiki &gt;
9731
9732 a&lt;nowiki /&gt;b
9733
9734 c&lt;nowiki/ &gt;d
9735 !! result
9736 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
9737 <p>a&lt;nowiki /&gt;b</p>
9738 <p>c&lt;nowiki/ &gt;d</p>
9739 !! end
9740
9741 !! test
9742 Parsoid: Escape weird noWikI capitalizations
9743 !! options
9744 parsoid=html2wt
9745 !! input
9746 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
9747 !! result
9748 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
9749 !! end
9750
9751 ###
9752 ### Message transform tests
9753 ###
9754 !! test
9755 message transform: magic variables
9756 !! options
9757 msg
9758 !! input
9759 {{SITENAME}}
9760 !! result
9761 MediaWiki
9762 !! end
9763
9764 !! test
9765 message transform: should not transform wiki markup
9766 !! options
9767 msg
9768 !! input
9769 ''test''
9770 !! result
9771 ''test''
9772 !! end
9773
9774 !! test
9775 message transform: <noinclude> in transcluded template (bug 4926)
9776 !! options
9777 msg
9778 !! input
9779 {{Includes}}
9780 !! result
9781 Foobar
9782 !! end
9783
9784 !! test
9785 message transform: <onlyinclude> in transcluded template (bug 4926)
9786 !! options
9787 msg
9788 !! input
9789 {{Includes2}}
9790 !! result
9791 Foo
9792 !! end
9793
9794 !! test
9795 {{#special:}} page name, known
9796 !! options
9797 msg
9798 !! input
9799 {{#special:Recentchanges}}
9800 !! result
9801 Special:RecentChanges
9802 !! end
9803
9804 !! test
9805 {{#special:}} page name with subpage, known
9806 !! options
9807 msg
9808 !! input
9809 {{#special:Recentchanges/param}}
9810 !! result
9811 Special:RecentChanges/param
9812 !! end
9813
9814 !! test
9815 {{#special:}} page name, unknown
9816 !! options
9817 msg
9818 !! input
9819 {{#special:foobar nonexistent}}
9820 !! result
9821 Special:Foobar nonexistent
9822 !! end
9823
9824 !! test
9825 {{#speciale:}} page name, known
9826 !! options
9827 msg
9828 !! input
9829 {{#speciale:Recentchanges}}
9830 !! result
9831 Special:RecentChanges
9832 !! end
9833
9834 !! test
9835 {{#speciale:}} page name with subpage, known
9836 !! options
9837 msg
9838 !! input
9839 {{#speciale:Recentchanges/param}}
9840 !! result
9841 Special:RecentChanges/param
9842 !! end
9843
9844 !! test
9845 {{#speciale:}} page name, unknown
9846 !! options
9847 msg
9848 !! input
9849 {{#speciale:foobar nonexistent}}
9850 !! result
9851 Special:Foobar_nonexistent
9852 !! end
9853
9854 ###
9855 ### Images
9856 ###
9857 ### For Parsoid-specific tests, see
9858 #### http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
9859
9860 !! test
9861 Simple image (php)
9862 !! options
9863 php
9864 !! input
9865 [[Image:foobar.jpg]]
9866 !! result
9867 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9868 </p>
9869 !! end
9870
9871 !! test
9872 Simple image (parsoid)
9873 !! options
9874 parsoid=wt2html
9875 !! input
9876 [[Image:foobar.jpg]]
9877 !! result
9878 <p><span class="mw-default-size" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span>
9879 </p>
9880 !! end
9881
9882 !! test
9883 Simple image (using File: namespace, now canonical) (php)
9884 !! options
9885 php
9886 !! input
9887 [[File:foobar.jpg]]
9888 !! result
9889 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9890 </p>
9891 !! end
9892
9893 !! test
9894 Simple image (using File: namespace, now canonical) (parsoid)
9895 !! options
9896 parsoid
9897 !! input
9898 [[File:Foobar.jpg]]
9899 !! result
9900 <p><span class="mw-default-size" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span>
9901 </p>
9902 !! end
9903
9904 !! test
9905 Right-aligned image (php)
9906 !! options
9907 php
9908 !! input
9909 [[Image:foobar.jpg|right]]
9910 !! result
9911 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
9912
9913 !! end
9914
9915 !! test
9916 Right-aligned image (parsoid)
9917 !! options
9918 parsoid
9919 !! input
9920 [[File:Foobar.jpg|right]]
9921 !! result
9922 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></figure>
9923 !! end
9924
9925 !! test
9926 Image with caption (php)
9927 !! options
9928 php
9929 !! input
9930 [[File:Foobar.jpg|right|Caption text]]
9931 !! result
9932 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
9933
9934 !! end
9935
9936 !! test
9937 Image with caption (parsoid)
9938 !! options
9939 parsoid
9940 !! input
9941 [[File:Foobar.jpg|right|Caption text]]
9942 !! result
9943 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption text</figcaption></figure>
9944 !! end
9945
9946 !! test
9947 Image with caption, bug 53312 #1 (parsoid)
9948 !! options
9949 parsoid
9950 !! input
9951 [[File:Foobar.jpg|right|Caption page stuff]]
9952 !! result
9953 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption page stuff</figcaption></figure>
9954 !! end
9955
9956 !! test
9957 Image with caption, bug 53312 #2 (parsoid)
9958 !! options
9959 parsoid
9960 !! input
9961 [[File:Foobar.jpg|right|Caption page=]]
9962 !! result
9963 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption page=</figcaption></figure>
9964 !! end
9965
9966 !! test
9967 Image with caption, bug 53312 #3 (parsoid)
9968 !! options
9969 parsoid
9970 !! input
9971 [[File:Foobar.jpg|right|Caption page=stuff]]
9972 !! result
9973 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption page=stuff</figcaption></figure>
9974 !! end
9975
9976 !! test
9977 Allow empty links in image captions (Bug 60753) (parsoid)
9978 !! options
9979 parsoid
9980 !!input
9981 [[File:Foobar.jpg|thumb|Caption [[Link1]]
9982 [[]]
9983 [[Link2]]
9984 ]]
9985 !! result
9986 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption [[Link1]]\n[[]]\n[[Link2]]\n"}],"dsr":[0,59,2,2]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"dsr":[2,null,null,null]}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption data-parsoid='{"dsr":[null,57,null,null]}'>Caption <a rel="mw:WikiLink" href="./Link1" data-parsoid='{"stx":"simple","a":{"href":"./Link1"},"sa":{"href":"Link1"},"dsr":[32,41,2,2]}'>Link1</a>
9987 [[]]
9988 <a rel="mw:WikiLink" href="./Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"},"dsr":[47,56,2,2]}'>Link2</a>
9989 </figcaption></figure>
9990 !! end
9991
9992 !! test
9993 Link with empty target
9994 !! input
9995 [[]]
9996 !! result
9997 <p>[[]]
9998 </p>
9999 !! end
10000
10001 !! test
10002 Image with empty attribute (php)
10003 !! options
10004 php
10005 !! input
10006 [[File:Foobar.jpg|right||Caption text]]
10007 !! result
10008 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
10009
10010 !! end
10011
10012 !! test
10013 Image with empty attribute (parsoid)
10014 !! options
10015 parsoid=wt2html
10016 !! input
10017 [[File:Foobar.jpg|right||Caption text]]
10018 !! result
10019 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption text</figcaption></figure>
10020 !! end
10021
10022 !! test
10023 1. Block image with individual attributes from templates
10024 !! options
10025 parsoid
10026 !! input
10027 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
10028 !! result
10029 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[24,38,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]]}\">137px&lt;/span>"}]]}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
10030 !! end
10031
10032 !! test
10033 2. Block Image with individual attributes from templates
10034 !! options
10035 parsoid
10036 !! input
10037 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
10038 !! result
10039 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;thumb&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[18,32,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]]}\">thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[33,47,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]]}\">137px&lt;/span>"}]]}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
10040 !! end
10041
10042 !! test
10043 3. Inline image with individual attributes from templates
10044 !! options
10045 parsoid
10046 !! input
10047 [[File:Foobar.jpg|{{echo|50px}}]]
10048 !! result
10049 <p><span typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-mw='{"attribs":[["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;50px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[18,31,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]]}\">50px&lt;/span>"}]]}' data-parsoid='{"optList":[{"ck":"width","ak":"{{echo|50px}}"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
10050 !! end
10051
10052 !! test
10053 Image with multiple attributes from the same template (php)
10054 !! options
10055 php
10056 !! input
10057 [[File:Foobar.jpg|{{image_attribs}}]]
10058 !! result
10059 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
10060
10061 !! end
10062
10063 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
10064 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
10065 !! test
10066 Image with multiple attributes from the same template (parsoid)
10067 !! options
10068 parsoid
10069 !! input
10070 [[File:Foobar.jpg|{{image_attribs}}]]
10071 !! result
10072 <figure class="mw-default-size mw-halign-right" typeof="mw:Image mw:Placeholder"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption text</figcaption></figure>
10073 !! end
10074
10075 !! test
10076 Image with link tails (php)
10077 !! options
10078 php
10079 !! input
10080 123[[File:Foobar.jpg]]456
10081 123[[File:Foobar.jpg|right]]456
10082 123[[File:Foobar.jpg|thumb]]456
10083 !! result
10084 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>456
10085 </p>
10086 123<div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>456
10087 123<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div></div></div></div>456
10088
10089 !! end
10090
10091 !! test
10092 Image with link tails (parsoid)
10093 !! options
10094 parsoid
10095 !! input
10096 123[[File:Foobar.jpg]]456
10097 123[[File:Foobar.jpg|right]]456
10098 123[[File:Foobar.jpg|thumb]]456
10099 !! result
10100 <p>123<span class="mw-default-size" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span>456</p>
10101 123<figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></figure>456
10102 123<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220"></a></figure>456
10103 !! end
10104
10105 !! test
10106 Image with multiple captions -- only last one is accepted (php)
10107 !! options
10108 php
10109 !! input
10110 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
10111 !! result
10112 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption3 - accepted"><img alt="Caption3 - accepted" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
10113
10114 !! end
10115
10116 !! test
10117 Image with multiple captions -- only last one is accepted (parsoid)
10118 !! options
10119 parsoid
10120 !! input
10121 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
10122 !! result
10123 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption3 - accepted</figcaption></figure>
10124 !! end
10125
10126 !! test
10127 Image with multiple widths -- use last (php)
10128 !! options
10129 php
10130 !! input
10131 [[File:Foobar.jpg|200px|300px|caption]]
10132 !! result
10133 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" width="300" height="34" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/450px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/600px-Foobar.jpg 2x" /></a>
10134 </p>
10135 !! end
10136
10137 !! test
10138 Image with multiple widths -- use last (parsoid)
10139 !! options
10140 parsoid
10141 !! input
10142 [[File:Foobar.jpg|200px|300px|caption]]
10143 !! result
10144 <p><span typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="34" width="300"/></a></span></p>
10145 !! end
10146
10147 !! test
10148 Image with multiple alignments -- use first (bug 48664) (php)
10149 !! options
10150 php
10151 !! input
10152 [[File:Foobar.jpg|thumb|left|right|center|caption]]
10153
10154 [[File:Foobar.jpg|middle|text-top|caption]]
10155 !! result
10156 <div class="thumb tleft"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10157 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" style="vertical-align: middle" /></a>
10158 </p>
10159 !! end
10160
10161 !! test
10162 Image with multiple alignments -- use first (bug 48664) (parsoid)
10163 !! options
10164 parsoid
10165 !! input
10166 [[File:Foobar.jpg|thumb|left|right|center|caption]]
10167
10168 [[File:Foobar.jpg|middle|text-top|caption]]
10169 !! result
10170 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
10171 <p><span class="mw-default-size mw-valign-middle" typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
10172 !! end
10173
10174 !! test
10175 Image with width attribute at different positions (php)
10176 !! options
10177 php
10178 !! input
10179 [[File:Foobar.jpg|200px|right|Caption]]
10180 [[File:Foobar.jpg|right|200px|Caption]]
10181 [[File:Foobar.jpg|right|Caption|200px]]
10182 !! result
10183 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
10184 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
10185 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
10186
10187 !! end
10188
10189 !! test
10190 Image with width attribute at different positions (parsoid)
10191 !! options
10192 parsoid
10193 !! input
10194 [[File:Foobar.jpg|200x200px|right|Caption]]
10195 [[File:Foobar.jpg|right|200x200px|Caption]]
10196 [[File:Foobar.jpg|right|Caption|200x200px]]
10197 !! result
10198 <figure class="mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" height="23" width="200"></a><figcaption>Caption</figcaption></figure>
10199 <figure class="mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" height="23" width="200"></a><figcaption>Caption</figcaption></figure>
10200 <figure class="mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" height="23" width="200"></a><figcaption>Caption</figcaption></figure>
10201 !! end
10202
10203 # a sad bit of backward-compatibility
10204 !! test
10205 Image with size specified with pxpx (bug 13500, 51628) (php)
10206 !! options
10207 php
10208 !! input
10209 [[File:Foobar.jpg|20pxpx]]
10210 [[File:Foobar.jpg|200x20pxpx]]
10211 !! result
10212 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" width="20" height="2" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/30px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/40px-Foobar.jpg 2x" /></a>
10213 <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/177px-Foobar.jpg" width="177" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/265px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/353px-Foobar.jpg 2x" /></a>
10214 </p>
10215 !! end
10216
10217 !! test
10218 Image with size specified with pxpx (bug 13500, 51628) (parsoid)
10219 !! options
10220 parsoid=wt2html,wt2wt
10221 !! input
10222 [[File:Foobar.jpg|20pxpx]]
10223 [[File:Foobar.jpg|200x20pxpx]]
10224 !! result
10225 <p><span typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="2" width="20"/></a></span><span typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="20" width="177"/></a></span></p>
10226 !! end
10227
10228 !! test
10229 Image with link parameter, wiki target (php)
10230 !! options
10231 php
10232 !! input
10233 [[File:Foobar.jpg|link=Main Page]]
10234 !! result
10235 <p><a href="/wiki/Main_Page" title="Main Page"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10236 </p>
10237 !! end
10238
10239 !! test
10240 Image with link parameter, wiki target (parsoid)
10241 !! options
10242 parsoid
10243 !! input
10244 [[File:Foobar.jpg|link=Main Page]]
10245 !! result
10246 <p><span class="mw-default-size" typeof="mw:Image"><a href="Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p>
10247 !! end
10248
10249 !! test
10250 Image with link parameter, URL target (php)
10251 !! options
10252 php
10253 !! input
10254 [[File:Foobar.jpg|link=http://example.com/]]
10255 !! result
10256 <p><a href="http://example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10257 </p>
10258 !! end
10259
10260 # parsoid bug 49293 (part 1)
10261 !! test
10262 Image with link parameter, URL target (parsoid)
10263 !! options
10264 parsoid
10265 !! input
10266 [[File:Foobar.jpg|link=http://example.com/]]
10267 !! result
10268 <p><span class="mw-default-size" typeof="mw:Image"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p>
10269 !! end
10270
10271 !! test
10272 Image with link parameter, protocol-less URL target (php)
10273 !! options
10274 php
10275 !! input
10276 [[File:Foobar.jpg|link=//example.com/]]
10277 !! result
10278 <p><a href="//example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10279 </p>
10280 !! end
10281
10282 # parsoid bug 49293 (part 2)
10283 !! test
10284 Image with link parameter, protocol-less URL target (parsoid)
10285 !! options
10286 parsoid
10287 !! input
10288 [[File:Foobar.jpg|link=//example.com/]]
10289 !! result
10290 <p><span class="mw-default-size" typeof="mw:Image"><a href="//example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p>
10291 !! end
10292
10293 !! test
10294 Image with link parameter, wgExternalLinkTarget
10295 !! input
10296 [[Image:foobar.jpg|link=http://example.com/]]
10297 !! config
10298 wgExternalLinkTarget='foobar'
10299 !! result
10300 <p><a href="http://example.com/" target="foobar" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10301 </p>
10302 !! end
10303
10304 !! test
10305 Image with link parameter, wgNoFollowLinks set to false
10306 !! input
10307 [[Image:foobar.jpg|link=http://example.com/]]
10308 !! config
10309 wgNoFollowLinks=false
10310 !! result
10311 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10312 </p>
10313 !! end
10314
10315 !! test
10316 Image with link parameter, wgNoFollowDomainExceptions
10317 !! input
10318 [[Image:foobar.jpg|link=http://example.com/]]
10319 !! config
10320 wgNoFollowDomainExceptions='example.com'
10321 !! result
10322 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10323 </p>
10324 !! end
10325
10326 !! test
10327 Image with link parameter, wgExternalLinkTarget, unnamed parameter
10328 !! input
10329 [[Image:foobar.jpg|link=http://example.com/|Title]]
10330 !! config
10331 wgExternalLinkTarget='foobar'
10332 !! result
10333 <p><a href="http://example.com/" title="Title" target="foobar" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10334 </p>
10335 !! end
10336
10337 !! test
10338 Image with empty link parameter (php)
10339 !! options
10340 php
10341 !! input
10342 [[File:Foobar.jpg|link=]]
10343 !! result
10344 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
10345 </p>
10346 !! end
10347
10348 !! test
10349 Image with empty link parameter (parsoid)
10350 !! options
10351 parsoid
10352 !! input
10353 [[File:Foobar.jpg|link=]]
10354 !! result
10355 <p><span class="mw-default-size" typeof="mw:Image"><span><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></span></span></p>
10356 !! end
10357
10358 !! test
10359 Image with link parameter (wiki target) and unnamed parameter (php)
10360 !! options
10361 php
10362 !! input
10363 [[File:Foobar.jpg|link=Main Page|Title]]
10364 !! result
10365 <p><a href="/wiki/Main_Page" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10366 </p>
10367 !! end
10368
10369 !! test
10370 Image with link parameter (wiki target) and unnamed parameter (parsoid)
10371 !! options
10372 parsoid
10373 !! input
10374 [[File:Foobar.jpg|link=Main Page|Title]]
10375 !! result
10376 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p>
10377 !! end
10378
10379 !! test
10380 Image with link parameter (URL target) and unnamed parameter (php)
10381 !! options
10382 php
10383 !! input
10384 [[File:Foobar.jpg|link=http://example.com/|Title]]
10385 !! result
10386 <p><a href="http://example.com/" title="Title" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10387 </p>
10388 !! end
10389
10390 !! test
10391 Image with link parameter (URL target) and unnamed parameter (parsoid)
10392 !! options
10393 parsoid
10394 !! input
10395 [[File:Foobar.jpg|link=http://example.com/|Title]]
10396 !! result
10397 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p>
10398 !! end
10399
10400 !! test
10401 Thumbnail image with link parameter
10402 !! options
10403 php
10404 !! input
10405 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
10406 !! result
10407 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="http://example.com/"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10408
10409 !! end
10410
10411 !! test
10412 Manually-specified thumbnail image
10413 !! options
10414 php
10415 !! input
10416 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
10417 !! result
10418 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/File:Foobar.jpg"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10419
10420 !! end
10421
10422 !! test
10423 Manually-specified thumbnail image with explicit link to wiki page
10424 !! options
10425 php
10426 !! input
10427 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
10428 !! result
10429 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10430
10431 !! end
10432
10433 !! test
10434 Manually-specified thumbnail image with explicit link to url
10435 !! options
10436 php
10437 !! input
10438 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
10439 !! result
10440 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="http://example.com"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10441
10442 !! end
10443
10444 !! test
10445 Manually-specified thumbnail image with explicit no link
10446 !! options
10447 php
10448 !! input
10449 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
10450 !! result
10451 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10452
10453 !! end
10454
10455 !! test
10456 Manually-specified thumbnail image with explicit link and alt text
10457 !! options
10458 php
10459 !! input
10460 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
10461 !! result
10462 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="alttext" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10463
10464 !! end
10465
10466 !! test
10467 Image with frame and link
10468 !! input
10469 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
10470 !! result
10471 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
10472
10473 !! end
10474
10475 !! test
10476 Image with frame and link and explicit alt
10477 !! input
10478 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
10479 !! result
10480 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Altitude" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
10481
10482 !! end
10483
10484 !! test
10485 Image with wiki markup in implicit alt
10486 !! input
10487 [[Image:Foobar.jpg|testing '''bold''' in alt]]
10488 !! result
10489 <p><a href="/wiki/File:Foobar.jpg" class="image" title="testing bold in alt"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10490 </p>
10491 !! end
10492
10493 !! test
10494 Image with wiki markup in explicit alt
10495 !! input
10496 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
10497 !! result
10498 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10499 </p>
10500 !! end
10501
10502 !! test
10503 Link to image page- image page normally doesn't exists, hence edit link
10504 Add test with existing image page
10505 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
10506 !! input
10507 [[:Image:test]]
10508 !! result
10509 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">Image:test</a>
10510 </p>
10511 !! end
10512
10513 !! test
10514 bug 18784 Link to non-existent image page with caption should use caption as link text
10515 !! input
10516 [[:Image:test|caption]]
10517 !! result
10518 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">caption</a>
10519 </p>
10520 !! end
10521
10522 !! test
10523 Frameless image caption with a free URL
10524 !! input
10525 [[Image:foobar.jpg|http://example.com]]
10526 !! result
10527 <p><a href="/wiki/File:Foobar.jpg" class="image" title="http://example.com"><img alt="http://example.com" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10528 </p>
10529 !! end
10530
10531 !! test
10532 Thumbnail image caption with a free URL
10533 !! input
10534 [[Image:foobar.jpg|thumb|http://example.com]]
10535 !! result
10536 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
10537
10538 !! end
10539
10540 !! test
10541 Thumbnail image caption with a free URL and explicit alt
10542 !! input
10543 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
10544 !! result
10545 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Alteration" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
10546
10547 !! end
10548
10549 !! test
10550 SVG thumbnails with no language set
10551 !! options
10552 !! input
10553 [[File:Foobar.svg|thumb|caption]]
10554 !! result
10555 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="180" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10556
10557 !! end
10558
10559 !! test
10560 SVG thumbnails with language de
10561 !! options
10562 !! input
10563 [[File:Foobar.svg|thumb|caption|lang=de]]
10564 !! result
10565 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=File:Foobar.svg&amp;lang=de" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/langde-180px-Foobar.svg.png" width="180" height="180" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/langde-270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/langde-360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10566
10567 !! end
10568
10569 !! test
10570 SVG thumbnails with invalid language code
10571 !! options
10572 !! input
10573 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
10574 !! result
10575 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="180" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>lang=invalid.language.code</div></div></div>
10576
10577 !! end
10578
10579 !! test
10580 BUG 1887: A ISBN with a thumbnail
10581 !! input
10582 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
10583 !! result
10584 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
10585
10586 !! end
10587
10588 !! test
10589 BUG 1887: A RFC with a thumbnail
10590 !! input
10591 [[Image:foobar.jpg|thumb|This is RFC 12354]]
10592 !! result
10593 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
10594
10595 !! end
10596
10597 !! test
10598 BUG 1887: A mailto link with a thumbnail
10599 !! input
10600 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
10601 !! result
10602 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
10603
10604 !! end
10605
10606 # Pending resolution to bug 368
10607 !! test
10608 BUG 648: Frameless image caption with a link
10609 !! input
10610 [[Image:foobar.jpg|text with a [[link]] in it]]
10611 !! result
10612 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10613 </p>
10614 !! end
10615
10616 !! test
10617 BUG 648: Frameless image caption with a link (suffix)
10618 !! input
10619 [[Image:foobar.jpg|text with a [[link]]foo in it]]
10620 !! result
10621 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a linkfoo in it"><img alt="text with a linkfoo in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10622 </p>
10623 !! end
10624
10625 !! test
10626 BUG 648: Frameless image caption with an interwiki link
10627 !! input
10628 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
10629 !! result
10630 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a MeatBall:Link in it"><img alt="text with a MeatBall:Link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10631 </p>
10632 !! end
10633
10634 !! test
10635 BUG 648: Frameless image caption with a piped interwiki link
10636 !! input
10637 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
10638 !! result
10639 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10640 </p>
10641 !! end
10642
10643 !! test
10644 Escape HTML special chars in image alt text
10645 !! input
10646 [[Image:foobar.jpg|& < > "]]
10647 !! result
10648 <p><a href="/wiki/File:Foobar.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img alt="&amp; &lt; &gt; &quot;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10649 </p>
10650 !! end
10651
10652 !! test
10653 BUG 499: Alt text should have &#1234;, not &amp;1234;
10654 !! input
10655 [[Image:foobar.jpg|&#9792;]]
10656 !! result
10657 <p><a href="/wiki/File:Foobar.jpg" class="image" title="♀"><img alt="♀" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10658 </p>
10659 !! end
10660
10661 !! test
10662 Broken image caption with link
10663 !! input
10664 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
10665 !! result
10666 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a href="/wiki/Main_Page" title="Main Page">this</a> is just an ordinary link.
10667 </p>
10668 !! end
10669
10670 !! test
10671 Image caption containing another image
10672 !! input
10673 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
10674 !! result
10675 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is a caption with another <a href="/index.php?title=Special:Upload&amp;wpDestFile=Icon.png" class="new" title="File:Icon.png">image</a> inside it!</div></div></div>
10676
10677 !! end
10678
10679 !! test
10680 Image caption containing a newline
10681 !! input
10682 [[Image:Foobar.jpg|This
10683 *is some text]]
10684 !! result
10685 <p><a href="/wiki/File:Foobar.jpg" class="image" title="This *is some text"><img alt="This *is some text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10686 </p>
10687 !!end
10688
10689 !!test
10690 Parsoid: Image caption containing leading space
10691 (The leading space should not trigger nowiki escaping in wt2wt mode)
10692 !! input
10693 [[Image:Foobar.jpg|thumb| bar]]
10694 !! result
10695 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>bar</div></div></div>
10696
10697 !!end
10698
10699 !! test
10700 Image caption containing a table (php)
10701 !! options
10702 php
10703 !! input
10704 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
10705 {|
10706 ! Foo !! Bar
10707 |-
10708 | Foo1 || Bar1
10709 |}
10710 and some more text.]]
10711 !! result
10712 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is an example image thumbnail caption with a table <table> <tr> <th> Foo </th> <th> Bar </th></tr> <tr> <td> Foo1 </td> <td> Bar1 </td></tr></table> and some more text.</div></div></div>
10713
10714 !!end
10715
10716 !! test
10717 Image caption containing a table (parsoid)
10718 !! options
10719 parsoid
10720 !! input
10721 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
10722 {|
10723 ! Foo !! Bar
10724 |-
10725 | Foo1 || Bar1
10726 |}
10727 and some more text.]]
10728 !! result
10729 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="23" width="200"/></a><figcaption>This is an example image thumbnail caption with a table
10730 <table>
10731 <tbody>
10732 <tr><th>Foo </th><th>Bar</th></tr>
10733 <tr>
10734 <td>Foo1 </td>
10735 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
10736 !! end
10737
10738 !! test
10739 Bug 3090: External links other than http: in image captions
10740 !! input
10741 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
10742 !! result
10743 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This caption has <a rel="nofollow" class="external text" href="irc://example.net">irc</a> and <a rel="nofollow" class="external text" href="https://example.com">Secure</a> ext links in it.</div></div></div>
10744
10745 !! end
10746
10747 !! test
10748 Custom class
10749 !! input
10750 [[Image:foobar.jpg|a|class=b]]
10751 !! result
10752 <p><a href="/wiki/File:Foobar.jpg" class="image" title="a"><img alt="a" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="b" /></a>
10753 </p>
10754 !! end
10755
10756 !! test
10757 Localized image handling (1).
10758 !! options
10759 language=es
10760 !! input
10761 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
10762 !! result
10763 <div class="floatleft"><a href="/wiki/Foo" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
10764
10765 !! end
10766
10767 !! test
10768 Localized image handling (2).
10769 !! options
10770 language=es
10771 !! input
10772 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
10773 !! result
10774 <div class="thumb tleft"><div class="thumbinner" style="width:182px;"><a href="/wiki/Foo" title="Foo"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/Archivo:Foobar.jpg" class="internal" title="Aumentar"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10775
10776 !! end
10777
10778 !! test
10779 "border", "frameless" and "class" attributes on an image.
10780 !! input
10781 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
10782 !! result
10783 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="extra thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
10784 </p>
10785 !! end
10786
10787 !! article
10788 File:Barfoo.jpg
10789 !! text
10790 #REDIRECT [[File:Barfoo.jpg]]
10791 !! endarticle
10792
10793 !! test
10794 Redirected image
10795 !! input
10796 [[Image:Barfoo.jpg]]
10797 !! result
10798 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
10799 </p>
10800 !! end
10801
10802 !! test
10803 Missing image with uploads disabled
10804 !! options
10805 wgEnableUploads=0
10806 !! input
10807 [[Image:Foobaz.jpg]]
10808 !! result
10809 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
10810 </p>
10811 !! end
10812
10813 # Parsoid-specific testing for images
10814 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
10815 # Currently imperfect due to a flaw in the Parsoid testrunner
10816 # Work in progress
10817 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
10818 # image tests.
10819
10820 !! test
10821 Parsoid-specific image handling - simple image with size and middle alignment
10822 !! options
10823 parsoid
10824 !! input
10825 [[File:Foobar.jpg|middle|50px]]
10826 !! result
10827 <p><span class="mw-valign-middle" typeof="mw:Image">
10828 <a href="File:Foobar.jpg">
10829 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
10830 </a>
10831 </span>
10832 </p>
10833 !! end
10834
10835 !! test
10836 Parsoid-specific image handling - simple image with size, middle alignment,
10837 non-standard namespace alias
10838 !! options
10839 parsoid=wt2wt,wt2html,html2html
10840 !! input
10841 [[Image:Foobar.jpg|middle|50px]]
10842 !! result
10843 <p><span class="mw-valign-middle" typeof="mw:Image">
10844 <a href="File:Foobar.jpg">
10845 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
10846 </a>
10847 </span>
10848 </p>
10849 !! end
10850
10851 !! test
10852 Parsoid-specific image handling - simple image with size and middle alignment
10853 (existing content)
10854 !! options
10855 parsoid
10856 !! input
10857 [[File:Foobar.jpg|50px|middle]]
10858 !! result
10859 <p><span class="mw-valign-middle" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"50px"},{"ck":"middle","ak":"middle"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
10860 !! end
10861
10862 !! test
10863 Parsoid-specific image handling - simple image with size and middle alignment
10864 and non-standard namespace name
10865 !! options
10866 parsoid=wt2html,wt2wt,html2html
10867 !! input
10868 [[Image:Foobar.jpg|50px|middle]]
10869 !! result
10870 <p><span class="mw-valign-middle" typeof="mw:Image">
10871 <a href="File:Foobar.jpg">
10872 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
10873 </a>
10874 </span>
10875 </p>
10876 !! end
10877
10878 !! test
10879 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
10880 !! options
10881 parsoid
10882 !! input
10883 [[File:Foobar.jpg|500x10px|baseline|caption]]
10884 !! result
10885 <p><span class="mw-valign-baseline" typeof="mw:Image" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"width","ak":"500x10px"},{"ck":"baseline","ak":"baseline"},{"ck":"caption","ak":"caption"}],"size":"500x10"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"10","width":"89"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
10886 !! end
10887
10888 !! test
10889 Parsoid-specific image handling - simple image with border and size spec
10890 !! options
10891 parsoid
10892 !! input
10893 [[File:Foobar.jpg|50px|border|caption]]
10894 !! result
10895 <p><span class="mw-image-border" typeof="mw:Image" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"width","ak":"50px"},{"ck":"border","ak":"border"},{"ck":"caption","ak":"caption"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
10896 !! end
10897
10898 !! test
10899 Parsoid-specific image handling - thumbnail with halign, valign, and caption
10900 !! options
10901 parsoid
10902 !! input
10903 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
10904 !! result
10905 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
10906 <a href="File:Foobar.jpg">
10907 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220" />
10908 </a>
10909 <figcaption>caption content</figcaption>
10910 </figure>
10911 !! end
10912
10913 !! test
10914 Parsoid-specific image handling - thumbnail with halign, valign, and caption
10915 (existing content)
10916 !! options
10917 parsoid
10918 !! input
10919 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
10920 !! result
10921 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"left","ak":"left"},{"ck":"baseline","ak":"baseline"},{"ck":"caption","ak":"caption content"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>caption content</figcaption></figure>
10922 !! end
10923
10924 !! test
10925 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
10926 !! options
10927 parsoid
10928 !! input
10929 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
10930 !! result
10931 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
10932 <a href="File:Foobar.jpg">
10933 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
10934 </a>
10935 <figcaption>caption</figcaption>
10936 </figure>
10937 !! end
10938
10939 !! test
10940 Parsoid-specific image handling - thumbnail with specific size, halign,
10941 valign, and caption (existing content)
10942 !! options
10943 parsoid
10944 !! input
10945 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
10946 !! result
10947 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"50x50px"},{"ck":"right","ak":"right"},{"ck":"middle","ak":"middle"},{"ck":"caption","ak":"caption"}],"size":"50x50"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>caption</figcaption></figure>
10948 !! end
10949
10950 !! test
10951 Parsoid-specific image handling - framed image with specific size and caption
10952 !! options
10953 parsoid
10954 !! input
10955 [[Image:Foobar.jpg|frame|500x50px|caption]]
10956 !! result
10957 <figure typeof="mw:Image/Frame">
10958 <a href="File:Foobar.jpg">
10959 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
10960 </a>
10961 <figcaption>caption</figcaption>
10962 </figure>
10963 !! end
10964
10965 !! test
10966 Parsoid-specific image handling - framed image with specific size and caption
10967 (existing content)
10968 !! options
10969 parsoid
10970 !! input
10971 [[File:Foobar.jpg|442x50px|frame|caption]]
10972 !! result
10973 <figure typeof="mw:Image/Frame" data-parsoid='{"optList":[{"ck":"width","ak":"442x50px"},{"ck":"framed","ak":"frame"},{"ck":"caption","ak":"caption"}],"size":"442x50"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"50","width":"442"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>caption</figcaption></figure>
10974 !! end
10975
10976 !! test
10977 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
10978 !! options
10979 parsoid
10980 !! input
10981 [[Image:Foobar.jpg|left|baseline|frame|500x50px|caption]]
10982 !! result
10983 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
10984 <a href="File:Foobar.jpg">
10985 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
10986 </a>
10987 <figcaption>caption</figcaption>
10988 </figure>
10989 !! end
10990
10991 !! test
10992 Parsoid-specific image handling - framed image with specific size, halign,
10993 valign, and caption (existing content)
10994 !! options
10995 parsoid
10996 !! input
10997 [[File:Foobar.jpg|442x50px|frame|left|baseline|caption]]
10998 !! result
10999 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame" data-parsoid='{"optList":[{"ck":"width","ak":"442x50px"},{"ck":"framed","ak":"frame"},{"ck":"left","ak":"left"},{"ck":"baseline","ak":"baseline"},{"ck":"caption","ak":"caption"}],"size":"442x50"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"50","width":"442"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>caption</figcaption></figure>
11000 !! end
11001
11002 !! test
11003 Parsoid-specific image handling - frameless image with specific size, border, and caption
11004 !! options
11005 parsoid
11006 !! input
11007 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
11008 !! result
11009 <p><span class="mw-image-border" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"frameless","ak":"frameless"},{"ck":"width","ak":"442x50px"},{"ck":"border","ak":"border"},{"ck":"caption","ak":"caption"}],"size":"442x50"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"50","width":"442"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
11010 !! end
11011
11012 !! test
11013 Parsoid-specific image handling - simple image with a formatted caption
11014 !! options
11015 parsoid
11016 !! input
11017 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
11018 !! result
11019 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;table>&lt;tr>&lt;td>a&lt;/td>&lt;td>b&lt;/td>&lt;/tr>&lt;tr>&lt;td>c&lt;/td>&lt;/tr>&lt;/table>"}'>
11020 <a href="File:Foobar.jpg">
11021 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
11022 </a></span></p>
11023 !! end
11024
11025 !! test
11026 Parsoid-specific image handling - caption with a template in it
11027 !! options
11028 parsoid
11029 !! input
11030 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
11031 !! result
11032 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" height="23" width="200"></a><figcaption>This caption has a <span about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;transclusion&quot;}},&quot;i&quot;:0}}]}">transclusion</span> in it.</figcaption></figure>
11033 !! end
11034
11035 !! test
11036 Parsoid-specific image handling - caption with unbalanced tags in it
11037 !! options
11038 parsoid=wt2html,wt2wt,html2html
11039 !! input
11040 foo
11041 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
11042 bar
11043 !! result
11044 <p>foo</p>
11045 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="23" width="200"></a><figcaption>This caption has a <center>unbalanced tag in it.</center></figcaption></figure>
11046 <p>bar</p>
11047 !! end
11048
11049 !! test
11050 Parsoid-specific image handling - empty caption
11051 !! options
11052 parsoid
11053 !! input
11054 [[File:Foobar.jpg|thumb|]]
11055 !! result
11056 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption></figcaption></figure>
11057 !! end
11058
11059 !! test
11060 Parsoid-specific image handling - whitespace caption
11061 !! options
11062 parsoid
11063 !! input
11064 [[File:Foobar.jpg|thumb| ]]
11065 !! result
11066 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption> </figcaption></figure>
11067 !! end
11068
11069 !! test
11070 Parsoid-specific image handling - lang option
11071 !! options
11072 parsoid
11073 !! input
11074 foo
11075 [[File:Foobar.svg|lang=de|caption]]
11076 bar
11077 !! result
11078 <p>foo
11079 <span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" lang="de" height="180" width="240"/></a></span>
11080 bar</p>
11081 !! end
11082
11083
11084 ###
11085 ### Subpages
11086 ###
11087 !! article
11088 Subpage test/subpage
11089 !! text
11090 foo
11091 !! endarticle
11092
11093 !! test
11094 Subpage link
11095 !! options
11096 subpage title=[[Subpage test]]
11097 !! input
11098 [[/subpage]]
11099 !! result
11100 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
11101 </p>
11102 !! end
11103
11104 !! test
11105 Subpage noslash link
11106 !! options
11107 subpage title=[[Subpage test]]
11108 !!input
11109 [[/subpage/]]
11110 !! result
11111 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
11112 </p>
11113 !! end
11114
11115 # TODO: make this PHP-parser compatible!
11116 !! test
11117 Relative subpage noslash link
11118 !! options
11119 parsoid=wt2wt,wt2html,html2html
11120 subpage title=[[Subpage test/1/2/3/4]]
11121 !!input
11122 [[../../subpage/]]
11123
11124 [[../../subpage]]
11125 !! result
11126 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
11127 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
11128 !! end
11129
11130 # TODO: make this PHP-parser compatible!
11131 !! test
11132 Parsoid: dot-slash prefixed wikilinks
11133 !! options
11134 parsoid=wt2wt,wt2html,html2html
11135 !!input
11136 [[./foo]]
11137
11138 [[././bar]]
11139
11140 [[././baz/]]
11141 !! result
11142 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
11143 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
11144 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
11145 !! end
11146
11147 !! test
11148 Disabled subpages
11149 !! input
11150 [[/subpage]]
11151 !! result
11152 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
11153 </p>
11154 !! end
11155
11156 !! test
11157 BUG 561: {{/Subpage}}
11158 !! options
11159 subpage title=[[Page]]
11160 !! input
11161 {{/Subpage}}
11162 !! result
11163 <p><a href="/index.php?title=Page/Subpage&amp;action=edit&amp;redlink=1" class="new" title="Page/Subpage (page does not exist)">Page/Subpage</a>
11164 </p>
11165 !! end
11166
11167 ###
11168 ### Categories
11169 ###
11170 !! article
11171 Category:MediaWiki User's Guide
11172 !! text
11173 blah
11174 !! endarticle
11175
11176 !! test
11177 Link to category
11178 !! input
11179 [[:Category:MediaWiki User's Guide]]
11180 !! result
11181 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
11182 </p>
11183 !! end
11184
11185 !! test
11186 Simple category
11187 !! options
11188 cat
11189 !! input
11190 [[Category:MediaWiki User's Guide]]
11191 !! result
11192 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11193 !! end
11194
11195 !! test
11196 PAGESINCATEGORY invalid title fatal (r33546 fix)
11197 !! input
11198 {{PAGESINCATEGORY:<bogus>}}
11199 !! result
11200 <p>0
11201 </p>
11202 !! end
11203
11204 !! test
11205 Category with different sort key
11206 !! options
11207 cat
11208 !! input
11209 [[Category:MediaWiki User's Guide|Foo]]
11210 !! result
11211 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11212 !! end
11213
11214 !! test
11215 Category with identical sort key
11216 !! options
11217 cat
11218 !! input
11219 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11220 !! result
11221 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11222 !! end
11223
11224 !! test
11225 Category with empty sort key
11226 !! options
11227 cat
11228 pst
11229 !! input
11230 [[Category:MediaWiki User's Guide|]]
11231 !! result
11232 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11233 !! end
11234
11235 !! test
11236 Category with empty sort key and parentheses
11237 !! options
11238 cat
11239 pst
11240 !! input
11241 [[Category:Foo (bar)|]]
11242 !! result
11243 [[Category:Foo (bar)|Foo]]
11244 !! end
11245
11246 !! test
11247 Category with link tail
11248 !! options
11249 cat
11250 pst
11251 !! input
11252 123[[Category:Foo]]456
11253 !! result
11254 123[[Category:Foo]]456
11255 !! end
11256
11257 !! test
11258 Category with template
11259 !! options
11260 cat
11261 pst
11262 !! input
11263 [[Category:{{echo|Foo}}]]
11264 !! result
11265 [[Category:{{echo|Foo}}]]
11266 !! end
11267
11268 !! test
11269 Category with template in sort key
11270 !! options
11271 cat
11272 pst
11273 !! input
11274 [[Category:Foo|{{echo|Bar}}]]
11275 !! result
11276 [[Category:Foo|{{echo|Bar}}]]
11277 !! end
11278
11279 !! test
11280 Category with template in sort key and title
11281 !! options
11282 cat
11283 pst
11284 !! input
11285 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11286 !! result
11287 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11288 !! end
11289
11290 !! test
11291 Category / paragraph interactions
11292 !! input
11293 Foo [[Category:Baz]] Bar
11294
11295 Foo [[Category:Baz]]
11296 Bar
11297
11298 Foo
11299 [[Category:Baz]]
11300 Bar
11301
11302 Foo
11303 [[Category:Baz]] Bar
11304
11305 Foo
11306 [[Category:Baz]]
11307 [[Category:Baz]]
11308 [[Category:Baz]]
11309 Bar
11310
11311 [[Category:Baz]]
11312 [[Category:Baz]]
11313 [[Category:Baz]]
11314
11315 [[Category:Baz]]
11316 {{echo|[[Category:Baz]]}}
11317 [[Category:Baz]]
11318 !! result
11319 <p>Foo Bar
11320 </p><p>Foo
11321 Bar
11322 </p><p>Foo
11323 Bar
11324 </p><p>Foo Bar
11325 </p><p>Foo
11326 Bar
11327 </p>
11328 !! end
11329
11330 !! test
11331 Parsoid: Serialize link to category page with colon escape
11332 !! options
11333 parsoid
11334 !! input
11335
11336 [[:Category:Foo]]
11337 [[:Category:Foo|Bar]]
11338 !! result
11339 <p>
11340 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
11341 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
11342 </p>
11343 !! end
11344
11345 !! test
11346 Parsoid: Link prefix/suffixes aren't applied to category links
11347 !! options
11348 parsoid=wt2html,wt2wt,html2html
11349 language=is
11350 !! input
11351 x[[Category:Foo]]y
11352 !! result
11353 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
11354 !! end
11355
11356 !! test
11357 Parsoid: Serialize link to file page with colon escape
11358 !! options
11359 parsoid
11360 !! input
11361
11362 [[:File:Foo.png]]
11363 [[:File:Foo.png|Bar]]
11364 !! result
11365 <p>
11366 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
11367 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
11368 </p>
11369 !! end
11370
11371 !! test
11372 Parsoid: Serialize a genuine category link without colon escape
11373 !! options
11374 parsoid
11375 !! input
11376 [[Category:Foo]]
11377 [[Category:Foo|Bar]]
11378 !! result
11379 <link rel="mw:PageProp/Category" href="Category:Foo">
11380 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
11381 !! end
11382
11383 !! test
11384 Parsoid: Defaultsort
11385 !! options
11386 parsoid
11387 !! input
11388 {{DEFAULTSORT:Foo}}
11389 !! result
11390 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
11391 !! end
11392
11393 ###
11394 ### Inter-language links
11395 ###
11396 !! test
11397 Inter-language links
11398 !! options
11399 ill
11400 !! input
11401 [[es:Alimento]]
11402 [[fr:Nourriture]]
11403 [[zh:&#39135;&#21697;]]
11404 !! result
11405 es:Alimento fr:Nourriture zh:食品
11406 !! end
11407
11408 !! test
11409 Duplicate interlanguage links (bug 24502)
11410 !! options
11411 ill
11412 !! input
11413 [[es:1]]
11414 [[es:2]]
11415 [[fr:1]]
11416 [[fr:2]]
11417 !! result
11418 es:1 fr:1
11419 !! end
11420
11421 ###
11422 ### Sections
11423 ###
11424 !! test
11425 Basic section headings
11426 !! input
11427 == Headline 1 ==
11428 Some text
11429
11430 ==Headline 2==
11431 More
11432 ===Smaller headline===
11433 Blah blah
11434 !! result
11435 <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11436 <p>Some text
11437 </p>
11438 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11439 <p>More
11440 </p>
11441 <h3><span class="mw-headline" id="Smaller_headline">Smaller headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Smaller headline">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
11442 <p>Blah blah
11443 </p>
11444 !! end
11445
11446 !! test
11447 Section headings with TOC
11448 !! input
11449 == Headline 1 ==
11450 === Subheadline 1 ===
11451 ===== Skipping a level =====
11452 ====== Skipping a level ======
11453
11454 == Headline 2 ==
11455 Some text
11456 ===Another headline===
11457 !! result
11458 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11459 <ul>
11460 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
11461 <ul>
11462 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
11463 <ul>
11464 <li class="toclevel-3 tocsection-3"><a href="#Skipping_a_level"><span class="tocnumber">1.1.1</span> <span class="toctext">Skipping a level</span></a>
11465 <ul>
11466 <li class="toclevel-4 tocsection-4"><a href="#Skipping_a_level_2"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Skipping a level</span></a></li>
11467 </ul>
11468 </li>
11469 </ul>
11470 </li>
11471 </ul>
11472 </li>
11473 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
11474 <ul>
11475 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
11476 </ul>
11477 </li>
11478 </ul>
11479 </div>
11480
11481 <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11482 <h3><span class="mw-headline" id="Subheadline_1">Subheadline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
11483 <h5><span class="mw-headline" id="Skipping_a_level">Skipping a level</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
11484 <h6><span class="mw-headline" id="Skipping_a_level_2">Skipping a level</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Skipping a level">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
11485 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11486 <p>Some text
11487 </p>
11488 <h3><span class="mw-headline" id="Another_headline">Another headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Another headline">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
11489
11490 !! end
11491
11492 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
11493 !! test
11494 Handling of sections up to level 6 and beyond
11495 !! input
11496 = Level 1 Heading=
11497 == Level 2 Heading==
11498 === Level 3 Heading===
11499 ==== Level 4 Heading====
11500 ===== Level 5 Heading=====
11501 ====== Level 6 Heading======
11502 ======= Level 7 Heading=======
11503 ======== Level 8 Heading========
11504 ========= Level 9 Heading=========
11505 ========== Level 10 Heading==========
11506 !! result
11507 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11508 <ul>
11509 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
11510 <ul>
11511 <li class="toclevel-2 tocsection-2"><a href="#Level_2_Heading"><span class="tocnumber">1.1</span> <span class="toctext">Level 2 Heading</span></a>
11512 <ul>
11513 <li class="toclevel-3 tocsection-3"><a href="#Level_3_Heading"><span class="tocnumber">1.1.1</span> <span class="toctext">Level 3 Heading</span></a>
11514 <ul>
11515 <li class="toclevel-4 tocsection-4"><a href="#Level_4_Heading"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Level 4 Heading</span></a>
11516 <ul>
11517 <li class="toclevel-5 tocsection-5"><a href="#Level_5_Heading"><span class="tocnumber">1.1.1.1.1</span> <span class="toctext">Level 5 Heading</span></a>
11518 <ul>
11519 <li class="toclevel-6 tocsection-6"><a href="#Level_6_Heading"><span class="tocnumber">1.1.1.1.1.1</span> <span class="toctext">Level 6 Heading</span></a></li>
11520 <li class="toclevel-6 tocsection-7"><a href="#.3D_Level_7_Heading.3D"><span class="tocnumber">1.1.1.1.1.2</span> <span class="toctext">= Level 7 Heading=</span></a></li>
11521 <li class="toclevel-6 tocsection-8"><a href="#.3D.3D_Level_8_Heading.3D.3D"><span class="tocnumber">1.1.1.1.1.3</span> <span class="toctext">== Level 8 Heading==</span></a></li>
11522 <li class="toclevel-6 tocsection-9"><a href="#.3D.3D.3D_Level_9_Heading.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.4</span> <span class="toctext">=== Level 9 Heading===</span></a></li>
11523 <li class="toclevel-6 tocsection-10"><a href="#.3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.5</span> <span class="toctext">==== Level 10 Heading====</span></a></li>
11524 </ul>
11525 </li>
11526 </ul>
11527 </li>
11528 </ul>
11529 </li>
11530 </ul>
11531 </li>
11532 </ul>
11533 </li>
11534 </ul>
11535 </div>
11536
11537 <h1><span class="mw-headline" id="Level_1_Heading">Level 1 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
11538 <h2><span class="mw-headline" id="Level_2_Heading">Level 2 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11539 <h3><span class="mw-headline" id="Level_3_Heading">Level 3 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
11540 <h4><span class="mw-headline" id="Level_4_Heading">Level 4 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
11541 <h5><span class="mw-headline" id="Level_5_Heading">Level 5 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
11542 <h6><span class="mw-headline" id="Level_6_Heading">Level 6 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
11543 <h6><span class="mw-headline" id=".3D_Level_7_Heading.3D">= Level 7 Heading=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: = Level 7 Heading=">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
11544 <h6><span class="mw-headline" id=".3D.3D_Level_8_Heading.3D.3D">== Level 8 Heading==</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: == Level 8 Heading==">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
11545 <h6><span class="mw-headline" id=".3D.3D.3D_Level_9_Heading.3D.3D.3D">=== Level 9 Heading===</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: === Level 9 Heading===">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
11546 <h6><span class="mw-headline" id=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D">==== Level 10 Heading====</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ==== Level 10 Heading====">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
11547
11548 !! end
11549
11550 !! test
11551 TOC regression (bug 9764)
11552 !! input
11553 == title 1 ==
11554 === title 1.1 ===
11555 ==== title 1.1.1 ====
11556 === title 1.2 ===
11557 == title 2 ==
11558 === title 2.1 ===
11559 !! result
11560 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11561 <ul>
11562 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11563 <ul>
11564 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a>
11565 <ul>
11566 <li class="toclevel-3 tocsection-3"><a href="#title_1.1.1"><span class="tocnumber">1.1.1</span> <span class="toctext">title 1.1.1</span></a></li>
11567 </ul>
11568 </li>
11569 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
11570 </ul>
11571 </li>
11572 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
11573 <ul>
11574 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
11575 </ul>
11576 </li>
11577 </ul>
11578 </div>
11579
11580 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11581 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
11582 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
11583 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
11584 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11585 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
11586
11587 !! end
11588
11589 !! test
11590 TOC with wgMaxTocLevel=3 (bug 6204)
11591 !! options
11592 wgMaxTocLevel=3
11593 !! input
11594 == title 1 ==
11595 === title 1.1 ===
11596 ==== title 1.1.1 ====
11597 === title 1.2 ===
11598 == title 2 ==
11599 === title 2.1 ===
11600 !! result
11601 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11602 <ul>
11603 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11604 <ul>
11605 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
11606 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
11607 </ul>
11608 </li>
11609 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
11610 <ul>
11611 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
11612 </ul>
11613 </li>
11614 </ul>
11615 </div>
11616
11617 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11618 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
11619 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
11620 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
11621 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11622 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
11623
11624 !! end
11625
11626 !! test
11627 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
11628 !! options
11629 wgMaxTocLevel=3
11630 !! input
11631 ==Section 1==
11632 ===Section 1.1===
11633 ====Section 1.1.1====
11634 ====Section 1.1.1.1====
11635 ==Section 2==
11636 !! result
11637 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11638 <ul>
11639 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
11640 <ul>
11641 <li class="toclevel-2 tocsection-2"><a href="#Section_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Section 1.1</span></a></li>
11642 </ul>
11643 </li>
11644 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
11645 </ul>
11646 </div>
11647
11648 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11649 <h3><span class="mw-headline" id="Section_1.1">Section 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
11650 <h4><span class="mw-headline" id="Section_1.1.1">Section 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Section 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
11651 <h4><span class="mw-headline" id="Section_1.1.1.1">Section 1.1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Section 1.1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
11652 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Section 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11653
11654 !! end
11655
11656
11657 !! test
11658 Resolving duplicate section names
11659 !! input
11660 == Foo bar ==
11661 == Foo bar ==
11662 !! result
11663 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11664 <h2><span class="mw-headline" id="Foo_bar_2">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11665
11666 !! end
11667
11668 !! test
11669 Resolving duplicate section names with differing case (bug 10721)
11670 !! input
11671 == Foo bar ==
11672 == Foo Bar ==
11673 !! result
11674 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11675 <h2><span class="mw-headline" id="Foo_Bar_2">Foo Bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11676
11677 !! end
11678
11679 !! article
11680 Template:sections
11681 !! text
11682 ===Section 1===
11683 ==Section 2==
11684 !! endarticle
11685
11686 !! test
11687 Template with sections, __NOTOC__
11688 !! input
11689 __NOTOC__
11690 ==Section 0==
11691 {{sections}}
11692 ==Section 4==
11693 !! result
11694 <h2><span class="mw-headline" id="Section_0">Section 0</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 0">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11695 <h3><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-1" title="Template:Sections">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
11696 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-2" title="Template:Sections">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11697 <h2><span class="mw-headline" id="Section_4">Section 4</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 4">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11698
11699 !! end
11700
11701 !! test
11702 __NOEDITSECTION__ keyword
11703 !! input
11704 __NOEDITSECTION__
11705 ==Section 1==
11706 ==Section 2==
11707 !! result
11708 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
11709 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
11710
11711 !! end
11712
11713 !! test
11714 Link inside a section heading
11715 !! input
11716 ==Section with a [[Main Page|link]] in it==
11717 !! result
11718 <h2><span class="mw-headline" id="Section_with_a_link_in_it">Section with a <a href="/wiki/Main_Page" title="Main Page">link</a> in it</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section with a link in it">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11719
11720 !! end
11721
11722 !! test
11723 TOC regression (bug 12077)
11724 !! input
11725 __TOC__
11726 == title 1 ==
11727 === title 1.1 ===
11728 == title 2 ==
11729 !! result
11730 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11731 <ul>
11732 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11733 <ul>
11734 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
11735 </ul>
11736 </li>
11737 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
11738 </ul>
11739 </div>
11740
11741 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11742 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
11743 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11744
11745 !! end
11746
11747 !! test
11748 BUG 1219 URL next to image (good)
11749 !! input
11750 http://example.com [[Image:foobar.jpg]]
11751 !! result
11752 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11753 </p>
11754 !!end
11755
11756 !! test
11757 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
11758 !! input
11759 ===
11760 The line above must have a trailing space!
11761 === <!--
11762 --> <!-- -->
11763 But just in case it doesn't...
11764 !! result
11765 <h1><span class="mw-headline" id=".3D">=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
11766 <p>The line above must have a trailing space!
11767 </p>
11768 <h1><span class="mw-headline" id=".3D_2">=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
11769 <p>But just in case it doesn't...
11770 </p>
11771 !! end
11772
11773 !! test
11774 Header with special characters (bug 25462)
11775 !! input
11776 The tooltips shall not show entities to the user (ie. be double escaped)
11777
11778 == text > text ==
11779 section 1
11780
11781 == text < text ==
11782 section 2
11783
11784 == text & text ==
11785 section 3
11786
11787 == text ' text ==
11788 section 4
11789
11790 == text " text ==
11791 section 5
11792 !! result
11793 <p>The tooltips shall not show entities to the user (ie. be double escaped)
11794 </p>
11795 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11796 <ul>
11797 <li class="toclevel-1 tocsection-1"><a href="#text_.3E_text"><span class="tocnumber">1</span> <span class="toctext">text &gt; text</span></a></li>
11798 <li class="toclevel-1 tocsection-2"><a href="#text_.3C_text"><span class="tocnumber">2</span> <span class="toctext">text &lt; text</span></a></li>
11799 <li class="toclevel-1 tocsection-3"><a href="#text_.26_text"><span class="tocnumber">3</span> <span class="toctext">text &amp; text</span></a></li>
11800 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
11801 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
11802 </ul>
11803 </div>
11804
11805 <h2><span class="mw-headline" id="text_.3E_text">text &gt; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: text > text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11806 <p>section 1
11807 </p>
11808 <h2><span class="mw-headline" id="text_.3C_text">text &lt; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: text &lt; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11809 <p>section 2
11810 </p>
11811 <h2><span class="mw-headline" id="text_.26_text">text &amp; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: text &amp; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11812 <p>section 3
11813 </p>
11814 <h2><span class="mw-headline" id="text_.27_text">text ' text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: text ' text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11815 <p>section 4
11816 </p>
11817 <h2><span class="mw-headline" id="text_.22_text">text " text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: text &quot; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11818 <p>section 5
11819 </p>
11820 !! end
11821
11822 !! test
11823 Headers with excess '=' characters
11824 (Are similar tests necessary beyond the 1st level?)
11825 !! input
11826 =foo==
11827 ==foo=
11828 =''italic'' heading==
11829 ==''italic'' heading=
11830 !! result
11831 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11832 <ul>
11833 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
11834 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
11835 <li class="toclevel-1 tocsection-3"><a href="#italic_heading.3D"><span class="tocnumber">3</span> <span class="toctext"><i>italic</i> heading=</span></a></li>
11836 <li class="toclevel-1 tocsection-4"><a href="#.3Ditalic_heading"><span class="tocnumber">4</span> <span class="toctext">=<i>italic</i> heading</span></a></li>
11837 </ul>
11838 </div>
11839
11840 <h1><span class="mw-headline" id="foo.3D">foo=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: foo=">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
11841 <h1><span class="mw-headline" id=".3Dfoo">=foo</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =foo">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
11842 <h1><span class="mw-headline" id="italic_heading.3D"><i>italic</i> heading=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: italic heading=">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
11843 <h1><span class="mw-headline" id=".3Ditalic_heading">=<i>italic</i> heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: =italic heading">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
11844
11845 !! end
11846
11847 !! test
11848 HTML headers vs TOC (bug 23393)
11849 (__NOEDITSECTION__ for clearer output, doesn't matter here)
11850 !! input
11851 <h1>Header 1</h1>
11852 == Header 1.1 ==
11853 == Header 1.2 ==
11854
11855 <h1>Header 2
11856 </h1>
11857 == Header 2.1 ==
11858 == Header 2.2 ==
11859 __NOEDITSECTION__
11860 !! result
11861 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11862 <ul>
11863 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
11864 <ul>
11865 <li class="toclevel-2 tocsection-1"><a href="#Header_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Header 1.1</span></a></li>
11866 <li class="toclevel-2 tocsection-2"><a href="#Header_1.2"><span class="tocnumber">1.2</span> <span class="toctext">Header 1.2</span></a></li>
11867 </ul>
11868 </li>
11869 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
11870 <ul>
11871 <li class="toclevel-2 tocsection-3"><a href="#Header_2.1"><span class="tocnumber">2.1</span> <span class="toctext">Header 2.1</span></a></li>
11872 <li class="toclevel-2 tocsection-4"><a href="#Header_2.2"><span class="tocnumber">2.2</span> <span class="toctext">Header 2.2</span></a></li>
11873 </ul>
11874 </li>
11875 </ul>
11876 </div>
11877
11878 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
11879 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
11880 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
11881 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
11882 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
11883 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
11884
11885 !! end
11886
11887 !! test
11888 BUG 1219 URL next to image (broken)
11889 !! input
11890 http://example.com[[Image:foobar.jpg]]
11891 !! result
11892 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11893 </p>
11894 !!end
11895
11896 !! test
11897 Bug 1186 news: in the middle of text
11898 !! input
11899 http://en.wikinews.org/wiki/Wikinews:Workplace
11900 !! result
11901 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
11902 </p>
11903 !!end
11904
11905
11906 !! test
11907 Namespaced link must have a title
11908 !! input
11909 [[Project:]]
11910 !! result
11911 <p>[[Project:]]
11912 </p>
11913 !!end
11914
11915 !! test
11916 Namespaced link must have a title (bad fragment version)
11917 !! input
11918 [[Project:#fragment]]
11919 !! result
11920 <p>[[Project:#fragment]]
11921 </p>
11922 !!end
11923
11924
11925 ###
11926 ### HTML tags and HTML attributes
11927 ###
11928
11929 !! test
11930 div with no attributes
11931 !! input
11932 <div>HTML rocks</div>
11933 !! result
11934 <div>HTML rocks</div>
11935
11936 !! end
11937
11938 !! test
11939 div with double-quoted attribute
11940 !! input
11941 <div id="rock">HTML rocks</div>
11942 !! result
11943 <div id="rock">HTML rocks</div>
11944
11945 !! end
11946
11947 !! test
11948 div with single-quoted attribute
11949 !! input
11950 <div id='rock'>HTML rocks</div>
11951 !! result
11952 <div id="rock">HTML rocks</div>
11953
11954 !! end
11955
11956 !! test
11957 div with unquoted attribute
11958 !! input
11959 <div id=rock>HTML rocks</div>
11960 !! result
11961 <div id="rock">HTML rocks</div>
11962
11963 !! end
11964
11965 !! test
11966 div with illegal double attributes
11967 !! input
11968 <div id="a" id="b">HTML rocks</div>
11969 !! result
11970 <div id="b">HTML rocks</div>
11971
11972 !!end
11973
11974 # FIXME: produce empty string instead of "class" in the PHP parser, following
11975 # the HTML5 spec.
11976 !! test
11977 div with empty attribute value, space before equals
11978 !! options
11979 parsoid
11980 !! input
11981 <div class =>HTML rocks</div>
11982 !! result
11983 <div class="">HTML rocks</div>
11984
11985 !! end
11986
11987 # The PHP parser escapes the opening brace to &#123; for some reason, so
11988 # disabled this test for it.
11989 !! test
11990 div with braces in attribute value
11991 !! options
11992 parsoid
11993 !! input
11994 <div title="{}">Foo</div>
11995 !! result
11996 <div title="{}">Foo</div>
11997 !! end
11998
11999 # This it very inconsistent in the PHP parser: it returns
12000 # class="class" if there is a space between the name and the equal sign (see
12001 # 'div with empty attribute value, space before equals'), but strips the
12002 # attribute completely if the space is missing. We hope that not much content
12003 # depends on this, so are implementing the behavior below in Parsoid for
12004 # consistencies' sake. Disabled for the PHP parser.
12005 # FIXME: fix this behavior in the PHP parser?
12006 !! test
12007 div with empty attribute value, no space before equals
12008 !! options
12009 parsoid
12010 !! input
12011 <div class=>HTML rocks</div>
12012 !! result
12013 <div class="">HTML rocks</div>
12014
12015 !! end
12016
12017 !! test
12018 HTML multiple attributes correction
12019 !! input
12020 <p class="error" class="awesome">Awesome!</p>
12021 !! result
12022 <p class="awesome">Awesome!</p>
12023
12024 !!end
12025
12026 !! test
12027 Table multiple attributes correction
12028 !! input
12029 {|
12030 !+ class="error" class="awesome"| status
12031 |}
12032 !! result
12033 <table>
12034 <tr>
12035 <th class="awesome"> status
12036 </th></tr></table>
12037
12038 !!end
12039
12040 !! test
12041 DIV IN UPPERCASE
12042 !! input
12043 <DIV ID="x">HTML ROCKS</DIV>
12044 !! result
12045 <div id="x">HTML ROCKS</div>
12046
12047 !!end
12048
12049 !! test
12050 Non-ASCII pseudo-tags are rendered as text
12051 !! input
12052 <khyô>
12053 !! result
12054 <p>&lt;khyô&gt;
12055 </p>
12056 !! end
12057
12058 !! test
12059 Pseudo-tag with URL 'name' renders as url link
12060 !! input
12061 <http://example.com/>
12062 !! result
12063 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
12064 </p>
12065 !! end
12066
12067 !! test
12068 text with amp in the middle of nowhere
12069 !! input
12070 Remember AT&T?
12071 !!result
12072 <p>Remember AT&amp;T?
12073 </p>
12074 !! end
12075
12076 !! test
12077 text with character entity: eacute
12078 !! input
12079 I always thought &eacute; was a cute letter.
12080 !! result
12081 <p>I always thought &#233; was a cute letter.
12082 </p>
12083 !! end
12084
12085 !! test
12086 text with entity-escaped character entity-like string: eacute
12087 !! input
12088 I always thought &amp;eacute; was a cute letter.
12089 !! result
12090 <p>I always thought &amp;eacute; was a cute letter.
12091 </p>
12092 !! end
12093
12094 !! test
12095 text with undefined character entity: xacute
12096 !! input
12097 I always thought &xacute; was a cute letter.
12098 !! result
12099 <p>I always thought &amp;xacute; was a cute letter.
12100 </p>
12101 !! end
12102
12103 # TODO: generalize to PHP parser?
12104 !! test
12105 HTML5 tags
12106 !! options
12107 parsoid
12108 !! input
12109 <data value="5">five</data>
12110 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
12111 <mark>This highlighted text</mark>
12112 !! result
12113 <p><data value="5">five</data>
12114 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
12115 <mark>This highlighted text</mark></p>
12116 !! end
12117
12118 !! test
12119 HTML tag with leading space is parsed as text
12120 !! input
12121 < div>foo< /div>
12122 !! result
12123 <p>&lt; div&gt;foo&lt; /div&gt;
12124 </p>
12125 !! end
12126
12127 ###
12128 ### Nesting tests (see bug 41545, 50604, 51081)
12129 ###
12130
12131 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
12132 # Note that html2wt is considerably more difficult if we use <b> in
12133 # the test case, instead of <big>
12134 !! test
12135 Ensure that HTML adoption agency algorithm is properly implemented.
12136 !! input
12137 <big>X<big>Y</big>Z</big>
12138 !! result
12139 <p><big>X<big>Y</big>Z</big>
12140 </p>
12141 !! end
12142
12143 # This was bug 41545 in the PHP parser.
12144 !! test
12145 Nesting of <kbd>
12146 !! input
12147 <kbd>X<kbd>Y</kbd>Z</kbd>
12148 !! result
12149 <p><kbd>X<kbd>Y</kbd>Z</kbd>
12150 </p>
12151 !! end
12152
12153 # The following cases were bug 51081 in the PHP parser.
12154 # Note that there are some other nestable tags (b, i, etc) which are
12155 # not covered; see bug 51081 for discussion.
12156 !! test
12157 Nesting of <em>
12158 !! input
12159 <em>X<em>Y</em>Z</em>
12160 !! result
12161 <p><em>X<em>Y</em>Z</em>
12162 </p>
12163 !! end
12164
12165 !! test
12166 Nesting of <strong>
12167 !! input
12168 <strong>X<strong>Y</strong>Z</strong>
12169 !! result
12170 <p><strong>X<strong>Y</strong>Z</strong>
12171 </p>
12172 !! end
12173
12174 !! test
12175 Nesting of <q>
12176 !! input
12177 <q>X<q>Y</q>Z</q>
12178 !! result
12179 <p><q>X<q>Y</q>Z</q>
12180 </p>
12181 !! end
12182
12183 !! test
12184 Nesting of <ruby>
12185 !! input
12186 <ruby>X<ruby>Y</ruby>Z</ruby>
12187 !! result
12188 <p><ruby>X<ruby>Y</ruby>Z</ruby>
12189 </p>
12190 !! end
12191
12192 !! test
12193 Nesting of <bdo>
12194 !! input
12195 <bdo>X<bdo>Y</bdo>Z</bdo>
12196 !! result
12197 <p><bdo>X<bdo>Y</bdo>Z</bdo>
12198 </p>
12199 !! end
12200
12201
12202 ###
12203 ### Media links
12204 ###
12205
12206 !! test
12207 Media link
12208 !! input
12209 [[Media:Foobar.jpg]]
12210 !! result
12211 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
12212 </p>
12213 !! end
12214
12215 !! test
12216 Media link with text
12217 !! input
12218 [[Media:Foobar.jpg|A neat file to look at]]
12219 !! result
12220 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
12221 </p>
12222 !! end
12223
12224 # FIXME: this is still bad HTML tag nesting
12225 !! test
12226 Media link with nasty text
12227 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
12228 !! input
12229 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
12230 !! result
12231 <a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link&lt;div style="display:none"&gt;" onmouseover="alert(document.cookie)" onfoo="&lt;/div&gt;</a>
12232
12233 !! end
12234
12235 !! test
12236 Media link to nonexistent file (bug 1702)
12237 !! input
12238 [[Media:No such.jpg]]
12239 !! result
12240 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
12241 </p>
12242 !! end
12243
12244 !! test
12245 Image link to nonexistent file (bug 1850 - good)
12246 !! input
12247 [[Image:No such.jpg]]
12248 !! result
12249 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="File:No such.jpg">File:No such.jpg</a>
12250 </p>
12251 !! end
12252
12253 !! test
12254 :Image link to nonexistent file (bug 1850 - bad)
12255 !! input
12256 [[:Image:No such.jpg]]
12257 !! result
12258 <p><a href="/index.php?title=File:No_such.jpg&amp;action=edit&amp;redlink=1" class="new" title="File:No such.jpg (page does not exist)">Image:No such.jpg</a>
12259 </p>
12260 !! end
12261
12262
12263
12264 !! test
12265 Character reference normalization in link text (bug 1938)
12266 !! input
12267 [[Main Page|this&that]]
12268 !! result
12269 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
12270 </p>
12271 !!end
12272
12273 !! article
12274 אַ
12275 !! text
12276 Test for unicode normalization
12277
12278 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
12279 !! endarticle
12280
12281 !! test
12282 (bug 19451) Links should refer to the normalized form.
12283 !! input
12284 [[&#xFB2E;]]
12285 [[&#x5d0;&#x5b7;]]
12286 [[&#x5d0;ַ]]
12287 [[א&#x5b7;]]
12288 [[אַ]]
12289 !! result
12290 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
12291 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
12292 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
12293 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
12294 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
12295 </p>
12296 !! end
12297
12298 !! test
12299 Empty attribute crash test (bug 2067)
12300 !! input
12301 <font color="">foo</font>
12302 !! result
12303 <p><font color="">foo</font>
12304 </p>
12305 !! end
12306
12307 !! test
12308 Empty attribute crash test single-quotes (bug 2067)
12309 !! input
12310 <font color=''>foo</font>
12311 !! result
12312 <p><font color="">foo</font>
12313 </p>
12314 !! end
12315
12316 !! test
12317 Attribute test: equals, then nothing
12318 !! input
12319 <font color=>foo</font>
12320 !! result
12321 <p><font>foo</font>
12322 </p>
12323 !! end
12324
12325 !! test
12326 Attribute test: unquoted value
12327 !! input
12328 <font color=x>foo</font>
12329 !! result
12330 <p><font color="x">foo</font>
12331 </p>
12332 !! end
12333
12334 !! test
12335 Attribute test: unquoted but illegal value (hash)
12336 !! input
12337 <font color=#x>foo</font>
12338 !! result
12339 <p><font color="#x">foo</font>
12340 </p>
12341 !! end
12342
12343 !! test
12344 Attribute test: no value
12345 !! input
12346 <font color>foo</font>
12347 !! result
12348 <p><font color="color">foo</font>
12349 </p>
12350 !! end
12351
12352 !! test
12353 Bug 2095: link with three closing brackets
12354 !! input
12355 [[Main Page]]]
12356 !! result
12357 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
12358 </p>
12359 !! end
12360
12361 !! test
12362 Bug 2095: link with pipe and three closing brackets
12363 !! input
12364 [[Main Page|link]]]
12365 !! result
12366 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
12367 </p>
12368 !! end
12369
12370 !! test
12371 Bug 2095: link with pipe and three closing brackets, version 2
12372 !! input
12373 [[Main Page|[http://example.com/]]]
12374 !! result
12375 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
12376 </p>
12377 !! end
12378
12379
12380 ###
12381 ### Safety
12382 ###
12383
12384 !! article
12385 Template:Dangerous attribute
12386 !! text
12387 " onmouseover="alert(document.cookie)
12388 !! endarticle
12389
12390 !! article
12391 Template:Dangerous style attribute
12392 !! text
12393 border-size: expression(alert(document.cookie))
12394 !! endarticle
12395
12396 !! article
12397 Template:Div style
12398 !! text
12399 <div style="float: right; {{{1}}}">Magic div</div>
12400 !! endarticle
12401
12402 !! test
12403 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
12404 !! input
12405 <div title="{{test}}"></div>
12406 !! result
12407 <div title="This is a test template"></div>
12408
12409 !! end
12410
12411 !! test
12412 Bug 2304: HTML attribute safety (dangerous template; 2309)
12413 !! input
12414 <div title="{{dangerous attribute}}"></div>
12415 !! result
12416 <div title=""></div>
12417
12418 !! end
12419
12420 !! test
12421 Bug 2304: HTML attribute safety (dangerous style template; 2309)
12422 !! input
12423 <div style="{{dangerous style attribute}}"></div>
12424 !! result
12425 <div style="/* insecure input */"></div>
12426
12427 !! end
12428
12429 !! test
12430 Bug 2304: HTML attribute safety (safe parameter; 2309)
12431 !! input
12432 {{div style|width: 200px}}
12433 !! result
12434 <div style="float: right; width: 200px">Magic div</div>
12435
12436 !! end
12437
12438 !! test
12439 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
12440 !! input
12441 {{div style|width: expression(alert(document.cookie))}}
12442 !! result
12443 <div style="/* insecure input */">Magic div</div>
12444
12445 !! end
12446
12447 !! test
12448 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
12449 !! input
12450 {{div style|"><script>alert(document.cookie)</script>}}
12451 !! result
12452 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12453
12454 !! end
12455
12456 !! test
12457 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
12458 !! input
12459 {{div style|" ><script>alert(document.cookie)</script>}}
12460 !! result
12461 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12462
12463 !! end
12464
12465 !! test
12466 Bug 2304: HTML attribute safety (link)
12467 !! input
12468 <div title="[[Main Page]]"></div>
12469 !! result
12470 <div title="&#91;&#91;Main Page]]"></div>
12471
12472 !! end
12473
12474 !! test
12475 Bug 2304: HTML attribute safety (italics)
12476 !! input
12477 <div title="''foobar''"></div>
12478 !! result
12479 <div title="&#39;&#39;foobar&#39;&#39;"></div>
12480
12481 !! end
12482
12483 !! test
12484 Bug 2304: HTML attribute safety (bold)
12485 !! input
12486 <div title="'''foobar'''"></div>
12487 !! result
12488 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
12489
12490 !! end
12491
12492
12493 !! test
12494 Bug 2304: HTML attribute safety (ISBN)
12495 !! input
12496 <div title="ISBN 1234567890"></div>
12497 !! result
12498 <div title="&#73;SBN 1234567890"></div>
12499
12500 !! end
12501
12502 !! test
12503 Bug 2304: HTML attribute safety (RFC)
12504 !! input
12505 <div title="RFC 1234"></div>
12506 !! result
12507 <div title="&#82;FC 1234"></div>
12508
12509 !! end
12510
12511 !! test
12512 Bug 2304: HTML attribute safety (PMID)
12513 !! input
12514 <div title="PMID 1234567890"></div>
12515 !! result
12516 <div title="&#80;MID 1234567890"></div>
12517
12518 !! end
12519
12520 !! test
12521 Bug 2304: HTML attribute safety (web link)
12522 !! input
12523 <div title="http://example.com/"></div>
12524 !! result
12525 <div title="http&#58;//example.com/"></div>
12526
12527 !! end
12528
12529 !! test
12530 Bug 2304: HTML attribute safety (named web link)
12531 !! input
12532 <div title="[http://example.com/ link]"></div>
12533 !! result
12534 <div title="&#91;http&#58;//example.com/ link]"></div>
12535
12536 !! end
12537
12538 !! test
12539 Bug 3244: HTML attribute safety (extension; safe)
12540 !! input
12541 <div style="<nowiki>background:blue</nowiki>"></div>
12542 !! result
12543 <div style="background:blue"></div>
12544
12545 !! end
12546
12547 !! test
12548 Bug 3244: HTML attribute safety (extension; unsafe)
12549 !! input
12550 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
12551 !! result
12552 <div style="/* insecure input */"></div>
12553
12554 !! end
12555
12556 # More MSIE fun discovered by Tom Gilder
12557
12558 !! test
12559 MSIE CSS safety test: spurious slash
12560 !! input
12561 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
12562 !! result
12563 <div style="/* insecure input */">evil</div>
12564
12565 !! end
12566
12567 !! test
12568 MSIE CSS safety test: hex code
12569 !! input
12570 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
12571 !! result
12572 <div style="/* insecure input */">evil</div>
12573
12574 !! end
12575
12576 !! test
12577 MSIE CSS safety test: comment in url
12578 !! input
12579 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
12580 !! result
12581 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
12582
12583 !! end
12584
12585 !! test
12586 MSIE CSS safety test: comment in expression
12587 !! input
12588 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
12589 !! result
12590 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
12591
12592 !! end
12593
12594 !! test
12595 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
12596 !! input
12597 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
12598 !! result
12599 <p style="/* invalid control char */">A</p>
12600
12601 !! end
12602
12603 !! test
12604 MSIE 6 CSS safety test: Fullwidth (bug 55332)
12605 !! input
12606 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
12607 <div style="top:EXPRESSION(alert())">B</div>
12608 !! result
12609 <p style="/* insecure input */">A</p>
12610 <div style="/* insecure input */">B</div>
12611
12612 !! end
12613
12614 !! test
12615 MSIE 6 CSS safety test: IPA extensions (bug 55332)
12616 !! input
12617 <div style="background-image:uʀʟ(javascript:alert())">A</div>
12618 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
12619 !! result
12620 <div style="/* insecure input */">A</div>
12621 <p style="/* insecure input */">B</p>
12622
12623 !! end
12624
12625 !! test
12626 MSIE 6 CSS safety test: sup/sub script (bug 55332)
12627 !! input
12628 <div style="background-image:url⁽javascript:alert())">A</div>
12629 <div style="background-image:url₍javascript:alert())">B</div>
12630 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
12631 !! result
12632 <div style="/* insecure input */">A</div>
12633 <div style="/* insecure input */">B</div>
12634 <p style="/* insecure input */">C</p>
12635
12636 !! end
12637
12638 !! test
12639 Opera -o-link CSS
12640 !! input
12641 <div
12642 title="&#100;&#97;&#116;&#97;&#58;&#116;&#101;&#120;&#116;&#47;&#104;&#116;&#109;&#108;&#44;&#60;&#105;&#109;&#103;&#32;&#115;&#114;&#99;&#61;&#49;&#32;&#111;&#110;&#101;&#114;&#114;&#111;&#114;&#61;&#97;&#108;&#101;&#114;&#116;&#40;&#49;&#41;&#62;"
12643 style="-o-link:attr(title);-o-link-source:current">X</div>
12644 !! result
12645 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
12646
12647 !! end
12648
12649 !! test
12650 MSIE 6 CSS safety test: Repetition markers (bug 55332)
12651 !! input
12652 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
12653 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
12654 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
12655 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
12656 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
12657 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
12658 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
12659 !! result
12660 <p style="/* insecure input */">A</p>
12661 <p style="/* insecure input */">B</p>
12662 <p style="/* insecure input */">C</p>
12663 <p style="/* insecure input */">D</p>
12664 <p style="/* insecure input */">E</p>
12665 <p style="/* insecure input */">F</p>
12666 <p style="/* insecure input */">G</p>
12667
12668 !! end
12669
12670 !! test
12671 Table attribute legitimate extension
12672 !! input
12673 {|
12674 !+ style="<nowiki>color:blue</nowiki>"| status
12675 |}
12676 !! result
12677 <table>
12678 <tr>
12679 <th style="color:blue"> status
12680 </th></tr></table>
12681
12682 !!end
12683
12684 !! test
12685 Table attribute safety
12686 !! input
12687 {|
12688 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
12689 |}
12690 !! result
12691 <table>
12692 <tr>
12693 <th style="/* insecure input */"> status
12694 </th></tr></table>
12695
12696 !! end
12697
12698 !! test
12699 CSS line continuation 1
12700 !! input
12701 <div style="background-image: u\&#10;rl(test.jpg);"></div>
12702 !! result
12703 <div style="/* insecure input */"></div>
12704
12705 !! end
12706
12707 !! test
12708 CSS line continuation 2
12709 !! input
12710 <div style="background-image: u\&#13;rl(test.jpg); "></div>
12711 !! result
12712 <div style="/* insecure input */"></div>
12713
12714 !! end
12715
12716 !! article
12717 Template:Identity
12718 !! text
12719 {{{1}}}
12720 !! endarticle
12721
12722 !! test
12723 Expansion of multi-line templates in attribute values (bug 6255)
12724 !! input
12725 <div style="background: {{identity|#00FF00}}">-</div>
12726 !! result
12727 <div style="background: #00FF00">-</div>
12728
12729 !! end
12730
12731
12732 !! test
12733 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
12734 !! input
12735 <div style="background:
12736 #00FF00">-</div>
12737 !! result
12738 <div style="background: #00FF00">-</div>
12739
12740 !! end
12741
12742 !! test
12743 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
12744 !! input
12745 <div style="background: &#10;#00FF00">-</div>
12746 !! result
12747 <div style="background: &#10;#00FF00">-</div>
12748
12749 !! end
12750
12751 ###
12752 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
12753 ###
12754 !! test
12755 Parser hook: empty input
12756 !! input
12757 <tag></tag>
12758 !! result
12759 <pre>
12760 ''
12761 array (
12762 )
12763 </pre>
12764
12765 !! end
12766
12767 !! test
12768 Parser hook: empty input using terminated empty elements
12769 !! input
12770 <tag/>
12771 !! result
12772 <pre>
12773 NULL
12774 array (
12775 )
12776 </pre>
12777
12778 !! end
12779
12780 !! test
12781 Parser hook: empty input using terminated empty elements (space before)
12782 !! input
12783 <tag />
12784 !! result
12785 <pre>
12786 NULL
12787 array (
12788 )
12789 </pre>
12790
12791 !! end
12792
12793 !! test
12794 Parser hook: basic input
12795 !! input
12796 <tag>input</tag>
12797 !! result
12798 <pre>
12799 'input'
12800 array (
12801 )
12802 </pre>
12803
12804 !! end
12805
12806
12807 !! test
12808 Parser hook: case insensitive
12809 !! input
12810 <TAG>input</TAG>
12811 !! result
12812 <pre>
12813 'input'
12814 array (
12815 )
12816 </pre>
12817
12818 !! end
12819
12820
12821 !! test
12822 Parser hook: case insensitive, redux
12823 !! input
12824 <TaG>input</TAg>
12825 !! result
12826 <pre>
12827 'input'
12828 array (
12829 )
12830 </pre>
12831
12832 !! end
12833
12834 !! test
12835 Parser hook: nested tags
12836 !! options
12837 noxml
12838 !! input
12839 <tag><tag></tag></tag>
12840 !! result
12841 <pre>
12842 '<tag>'
12843 array (
12844 )
12845 </pre>&lt;/tag&gt;
12846
12847 !! end
12848
12849 !! test
12850 Parser hook: basic arguments
12851 !! input
12852 <tag width=200 height = "100" depth = '50' square></tag>
12853 !! result
12854 <pre>
12855 ''
12856 array (
12857 'width' => '200',
12858 'height' => '100',
12859 'depth' => '50',
12860 'square' => 'square',
12861 )
12862 </pre>
12863
12864 !! end
12865
12866 !! test
12867 Parser hook: argument containing a forward slash (bug 5344)
12868 !! input
12869 <tag filename='/tmp/bla'></tag>
12870 !! result
12871 <pre>
12872 ''
12873 array (
12874 'filename' => '/tmp/bla',
12875 )
12876 </pre>
12877
12878 !! end
12879
12880 !! test
12881 Parser hook: empty input using terminated empty elements (bug 2374)
12882 !! input
12883 <tag foo=bar/>text
12884 !! result
12885 <pre>
12886 NULL
12887 array (
12888 'foo' => 'bar',
12889 )
12890 </pre>text
12891
12892 !! end
12893
12894 # </tag> should be output literally since there is no matching tag that begins it
12895 !! test
12896 Parser hook: basic arguments using terminated empty elements (bug 2374)
12897 !! input
12898 <tag width=200 height = "100" depth = '50' square/>
12899 other stuff
12900 </tag>
12901 !! result
12902 <pre>
12903 NULL
12904 array (
12905 'width' => '200',
12906 'height' => '100',
12907 'depth' => '50',
12908 'square' => 'square',
12909 )
12910 </pre>
12911 <p>other stuff
12912 &lt;/tag&gt;
12913 </p>
12914 !! end
12915
12916 ###
12917 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
12918 ###
12919
12920 !! test
12921 Parser hook: static parser hook not inside a comment
12922 !! input
12923 <statictag>hello, world</statictag>
12924 <statictag action=flush/>
12925 !! result
12926 <p>hello, world
12927 </p>
12928 !! end
12929
12930
12931 !! test
12932 Parser hook: static parser hook inside a comment
12933 !! input
12934 <!-- <statictag>hello, world</statictag> -->
12935 <statictag action=flush/>
12936 !! result
12937 <p><br />
12938 </p>
12939 !! end
12940
12941 # Nested template calls; this case was broken by Parser.php rev 1.506,
12942 # since reverted.
12943
12944 !! article
12945 Template:One-parameter
12946 !! text
12947 (My parameter is: {{{1}}})
12948 !! endarticle
12949
12950 !! article
12951 Template:Map-one-parameter
12952 !! text
12953 {{{{{1}}}|{{{2}}}}}
12954 !! endarticle
12955
12956 !! test
12957 Nested template calls
12958 !! input
12959 {{Map-one-parameter|One-parameter|param}}
12960 !! result
12961 <p>(My parameter is: param)
12962 </p>
12963 !! end
12964
12965
12966 ###
12967 ### Sanitizer
12968 ###
12969 !! test
12970 Sanitizer: Closing of open tags
12971 !! input
12972 <s></s><table></table>
12973 !! result
12974 <s></s><table></table>
12975
12976 !! end
12977
12978 !! test
12979 Sanitizer: Closing of open but not closed tags
12980 !! input
12981 <s>foo
12982 !! result
12983 <p><s>foo</s>
12984 </p>
12985 !! end
12986
12987 !! test
12988 Sanitizer: Closing of closed but not open tags
12989 !! input
12990 </s>
12991 !! result
12992 <p>&lt;/s&gt;
12993 </p>
12994 !! end
12995
12996 !! test
12997 Sanitizer: Closing of closed but not open table tags
12998 !! input
12999 Table not started</td></tr></table>
13000 !! result
13001 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
13002 </p>
13003 !! end
13004
13005 !! test
13006 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
13007 !! input
13008 <span id="æ: v">byte</span>[[#æ: v|backlink]]
13009 !! result
13010 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
13011 </p>
13012 !! end
13013
13014 !! test
13015 Sanitizer: Validating the contents of the id attribute (bug 4515)
13016 !! options
13017 disabled
13018 !! input
13019 <br id=9 />
13020 !! result
13021 Something, but definitely not <br id="9" />...
13022 !! end
13023
13024 !! test
13025 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
13026 !! options
13027 disabled
13028 !! input
13029 <br id="foo" /><br id="foo" />
13030 !! result
13031 Something need to be done. foo-2 ?
13032 !! end
13033
13034 !! test
13035 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
13036 !! input
13037 <div itemscope>
13038 <meta itemprop="hello" content="world">
13039 <meta http-equiv="refresh" content="5">
13040 <meta itemprop="hello" http-equiv="refresh" content="5">
13041 <link itemprop="hello" href="{{SERVER}}">
13042 <link rel="stylesheet" href="{{SERVER}}">
13043 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
13044 </div>
13045 !! result
13046 <div itemscope="itemscope">
13047 <p> <meta itemprop="hello" content="world" />
13048 &lt;meta http-equiv="refresh" content="5"&gt;
13049 <meta itemprop="hello" content="5" />
13050 </p>
13051 <link itemprop="hello" href="http&#58;//example.org" />
13052 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
13053 <link itemprop="hello" href="http&#58;//example.org" />
13054 </div>
13055
13056 !! end
13057
13058 !! test
13059 Language converter: output gets cut off unexpectedly (bug 5757)
13060 !! options
13061 language=zh
13062 !! input
13063 this bit is safe: }-
13064
13065 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
13066
13067 then we get cut off here: }-
13068
13069 all additional text is vanished
13070 !! result
13071 <p>this bit is safe: }-
13072 </p><p>but if we add a conversion instance: xxx
13073 </p><p>then we get cut off here: }-
13074 </p><p>all additional text is vanished
13075 </p>
13076 !! end
13077
13078 !! test
13079 Self closed html pairs (bug 5487)
13080 !! options
13081 !! input
13082 <center><font id="bug" />Centered text</center>
13083 <div><font id="bug2" />In div text</div>
13084 !! result
13085 <center>&lt;font id="bug" /&gt;Centered text</center>
13086 <div>&lt;font id="bug2" /&gt;In div text</div>
13087
13088 !! end
13089
13090 #
13091 #
13092 #
13093
13094 !! test
13095 Punctuation: nbsp before exclamation
13096 !! input
13097 C'est grave !
13098 !! result
13099 <p>C'est grave&#160;!
13100 </p>
13101 !! end
13102
13103 !! test
13104 Punctuation: CSS !important (bug 11874)
13105 !! input
13106 <div style="width:50% !important">important</div>
13107 !! result
13108 <div style="width:50% !important">important</div>
13109
13110 !!end
13111
13112 !! test
13113 Punctuation: CSS ! important (bug 11874; with space after)
13114 !! input
13115 <div style="width:50% ! important">important</div>
13116 !! result
13117 <div style="width:50% ! important">important</div>
13118
13119 !!end
13120
13121
13122 !! test
13123 HTML bullet list, closed tags (bug 5497)
13124 !! input
13125 <ul>
13126 <li>One</li>
13127 <li>Two</li>
13128 </ul>
13129 !! result
13130 <ul>
13131 <li>One</li>
13132 <li>Two</li>
13133 </ul>
13134
13135 !! end
13136
13137 !! test
13138 HTML bullet list, unclosed tags (bug 5497)
13139 !! options
13140 disabled
13141 !! input
13142 <ul>
13143 <li>One
13144 <li>Two
13145 </ul>
13146 !! result
13147 <ul>
13148 <li>One
13149 </li>
13150 <li>Two
13151 </li>
13152 </ul>
13153
13154 !! end
13155
13156 !! test
13157 HTML ordered list, closed tags (bug 5497)
13158 !! input
13159 <ol>
13160 <li>One</li>
13161 <li>Two</li>
13162 </ol>
13163 !! result
13164 <ol>
13165 <li>One</li>
13166 <li>Two</li>
13167 </ol>
13168
13169 !! end
13170
13171 !! test
13172 HTML ordered list, unclosed tags (bug 5497)
13173 !! options
13174 disabled
13175 !! input
13176 <ol>
13177 <li>One
13178 <li>Two
13179 </ol>
13180 !! result
13181 <ol>
13182 <li>One
13183 </li>
13184 <li>Two
13185 </li>
13186 </ol>
13187
13188 !! end
13189
13190 !! test
13191 HTML nested bullet list, closed tags (bug 5497)
13192 !! input
13193 <ul>
13194 <li>One</li>
13195 <li>Two:
13196 <ul>
13197 <li>Sub-one</li>
13198 <li>Sub-two</li>
13199 </ul>
13200 </li>
13201 </ul>
13202 !! result
13203 <ul>
13204 <li>One</li>
13205 <li>Two:
13206 <ul>
13207 <li>Sub-one</li>
13208 <li>Sub-two</li>
13209 </ul>
13210 </li>
13211 </ul>
13212
13213 !! end
13214
13215 !! test
13216 HTML nested bullet list, open tags (bug 5497)
13217 !! options
13218 disabled
13219 !! input
13220 <ul>
13221 <li>One
13222 <li>Two:
13223 <ul>
13224 <li>Sub-one
13225 <li>Sub-two
13226 </ul>
13227 </ul>
13228 !! result
13229 <ul>
13230 <li>One
13231 </li>
13232 <li>Two:
13233 <ul>
13234 <li>Sub-one
13235 </li>
13236 <li>Sub-two
13237 </li>
13238 </ul>
13239 </li>
13240 </ul>
13241
13242 !! end
13243
13244 !! test
13245 HTML nested ordered list, closed tags (bug 5497)
13246 !! input
13247 <ol>
13248 <li>One</li>
13249 <li>Two:
13250 <ol>
13251 <li>Sub-one</li>
13252 <li>Sub-two</li>
13253 </ol>
13254 </li>
13255 </ol>
13256 !! result
13257 <ol>
13258 <li>One</li>
13259 <li>Two:
13260 <ol>
13261 <li>Sub-one</li>
13262 <li>Sub-two</li>
13263 </ol>
13264 </li>
13265 </ol>
13266
13267 !! end
13268
13269 !! test
13270 HTML nested ordered list, open tags (bug 5497)
13271 !! options
13272 disabled
13273 !! input
13274 <ol>
13275 <li>One
13276 <li>Two:
13277 <ol>
13278 <li>Sub-one
13279 <li>Sub-two
13280 </ol>
13281 </ol>
13282 !! result
13283 <ol>
13284 <li>One
13285 </li>
13286 <li>Two:
13287 <ol>
13288 <li>Sub-one
13289 </li>
13290 <li>Sub-two
13291 </li>
13292 </ol>
13293 </li>
13294 </ol>
13295
13296 !! end
13297
13298 !! test
13299 HTML ordered list item with parameters oddity
13300 !! input
13301 <ol><li id="fragment">One</li>
13302 </ol>
13303 !! result
13304 <ol><li id="fragment">One</li>
13305 </ol>
13306
13307 !! end
13308
13309 !!test
13310 bug 5918: autonumbering
13311 !! input
13312 [http://first/] [http://second] [ftp://ftp]
13313
13314 ftp://inlineftp
13315
13316 [mailto:enclosed@mail.tld With target]
13317
13318 [mailto:enclosed@mail.tld]
13319
13320 mailto:inline@mail.tld
13321 !! result
13322 <p><a rel="nofollow" class="external autonumber" href="http://first/">[1]</a> <a rel="nofollow" class="external autonumber" href="http://second">[2]</a> <a rel="nofollow" class="external autonumber" href="ftp://ftp">[3]</a>
13323 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
13324 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
13325 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
13326 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
13327 </p>
13328 !! end
13329
13330
13331 #
13332 # Security and HTML correctness
13333 # From Nick Jenkins' fuzz testing
13334 #
13335
13336 !! test
13337 Fuzz testing: Parser13
13338 !! input
13339 {|
13340 | http://a|
13341 !! result
13342 <table>
13343 <tr>
13344 <td>
13345 </td>
13346 </tr>
13347 </table>
13348
13349 !! end
13350
13351 !! test
13352 Fuzz testing: Parser14
13353 !! input
13354 == onmouseover= ==
13355 http://__TOC__
13356 !! result
13357 <h2><span class="mw-headline" id="onmouseover.3D">onmouseover=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13358 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13359 <ul>
13360 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
13361 </ul>
13362 </div>
13363
13364
13365 !! end
13366
13367 !! test
13368 Fuzz testing: Parser14-table
13369 !! input
13370 ==a==
13371 {| STYLE=__TOC__
13372 !! result
13373 <h2><span class="mw-headline" id="a">a</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13374 <table style="&#95;_TOC&#95;_">
13375 <tr><td></td></tr>
13376 </table>
13377
13378 !! end
13379
13380 # Known to produce bogus xml (extra </td>)
13381 !! test
13382 Fuzz testing: Parser16
13383 !! options
13384 noxml
13385 !! input
13386 {|
13387 !https://||||||
13388 !! result
13389 <table>
13390 <tr>
13391 <th>https://</th>
13392 <th></th>
13393 <th></th>
13394 <th>
13395 </td>
13396 </tr>
13397 </table>
13398
13399 !! end
13400
13401 !! test
13402 Fuzz testing: Parser21
13403 !! input
13404 {|
13405 ! irc://{{ftp://a" onmouseover="alert('hello world');"
13406 |
13407 !! result
13408 <table>
13409 <tr>
13410 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
13411 </th>
13412 <td>
13413 </td>
13414 </tr>
13415 </table>
13416
13417 !! end
13418
13419 !! test
13420 Fuzz testing: Parser22
13421 !! input
13422 http://===r:::https://b
13423
13424 {|
13425 !!result
13426 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
13427 </p>
13428 <table>
13429 <tr><td></td></tr>
13430 </table>
13431
13432 !! end
13433
13434 # Known to produce bad XML for now
13435 !! test
13436 Fuzz testing: Parser24
13437 !! options
13438 noxml
13439 !! input
13440 {|
13441 {{{|
13442 <u CLASS=
13443 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
13444 <br style="onmouseover='alert(document.cookie);' " />
13445
13446 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13447 |
13448 !! result
13449 <table>
13450 {{{|
13451 <u class="&#124;">}}}} &gt;
13452 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
13453
13454 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13455 <tr>
13456 <td></u>
13457 </td>
13458 </tr>
13459 </table>
13460
13461 !! end
13462
13463 # Note: the current result listed for this is not what the original one was,
13464 # but the original bug was JavaScript injection, which is fixed in any case.
13465 # It's not clear that the original result listed was any more correct than the
13466 # current one. Original result:
13467 # <p>{{{|
13468 # </p>
13469 # <li class="&#124;&#124;">
13470 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
13471 !!test
13472 Fuzz testing: Parser25 (bug 6055)
13473 !! input
13474 {{{
13475 |
13476 <LI CLASS=||
13477 >
13478 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
13479 !! result
13480 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
13481 </p>
13482 !! end
13483
13484 !!test
13485 Fuzz testing: URL adjacent extension (with space, clean)
13486 !! options
13487 !! input
13488 http://example.com <nowiki>junk</nowiki>
13489 !! result
13490 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
13491 </p>
13492 !!end
13493
13494 !!test
13495 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
13496 !! options
13497 !! input
13498 http://example.com<nowiki>junk</nowiki>
13499 !! result
13500 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
13501 </p>
13502 !!end
13503
13504 !!test
13505 Fuzz testing: URL adjacent extension (no space, dirty; pre)
13506 !! options
13507 !! input
13508 http://example.com<pre>junk</pre>
13509 !! result
13510 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
13511
13512 !!end
13513
13514 !!test
13515 Fuzz testing: image with bogus manual thumbnail
13516 !!input
13517 [[Image:foobar.jpg|thumbnail= ]]
13518 !!result
13519 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
13520
13521 !!end
13522
13523 !! test
13524 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
13525 !! input
13526 <pre dir="&#10;"></pre>
13527 !! result
13528 <pre dir="&#10;"></pre>
13529
13530 !! end
13531
13532 !! test
13533 Parsing optional HTML elements (Bug 6171)
13534 !! options
13535 !! input
13536 <table>
13537 <tr>
13538 <td> Some tabular data</td>
13539 <td> More tabular data ...
13540 <td> And yet som tabular data</td>
13541 </tr>
13542 </table>
13543 !! result
13544 <table>
13545 <tr>
13546 <td> Some tabular data</td>
13547 <td> More tabular data ...
13548 </td><td> And yet som tabular data</td>
13549 </tr>
13550 </table>
13551
13552 !! end
13553
13554 !! test
13555 Correct handling of <td>, <tr> (Bug 6171)
13556 !! options
13557 !! input
13558 <table>
13559 <tr>
13560 <td> Some tabular data</td>
13561 <td> More tabular data ...</td>
13562 <td> And yet som tabular data</td>
13563 </tr>
13564 </table>
13565 !! result
13566 <table>
13567 <tr>
13568 <td> Some tabular data</td>
13569 <td> More tabular data ...</td>
13570 <td> And yet som tabular data</td>
13571 </tr>
13572 </table>
13573
13574 !! end
13575
13576
13577 !! test
13578 Parsing crashing regression (fr:JavaScript)
13579 !! input
13580 </body></x>
13581 !! result
13582 <p>&lt;/body&gt;&lt;/x&gt;
13583 </p>
13584 !! end
13585
13586 !! test
13587 Inline wiki vs wiki block nesting
13588 !! input
13589 '''Bold paragraph
13590
13591 New wiki paragraph
13592 !! result
13593 <p><b>Bold paragraph</b>
13594 </p><p>New wiki paragraph
13595 </p>
13596 !! end
13597
13598 !! test
13599 Inline HTML vs wiki block nesting
13600 !! options
13601 disabled
13602 !! input
13603 <b>Bold paragraph
13604
13605 New wiki paragraph
13606 !! result
13607 <p><b>Bold paragraph</b>
13608 </p><p>New wiki paragraph
13609 </p>
13610 !! end
13611
13612 # Original result was this:
13613 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
13614 # </p>
13615 # While that might be marginally more intuitive, maybe, the six-apostrophe
13616 # construct is clearly pathological and the result stated here (which is what
13617 # the parser actually does) is about as reasonable as anything.
13618 !!test
13619 Mixing markup for italics and bold
13620 !! options
13621 !! input
13622 '''bold''''''bold''bolditalics'''''
13623 !! result
13624 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
13625 </p>
13626 !! end
13627
13628
13629 !! article
13630 Xyzzyx
13631 !! text
13632 Article for special page transclusion test
13633 !! endarticle
13634
13635 !! test
13636 Special page transclusion
13637 !! options
13638 !! input
13639 {{Special:Prefixindex/Xyzzyx}}
13640 !! result
13641 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13642
13643 !! end
13644
13645 !! test
13646 Special page transclusion twice (bug 5021)
13647 !! options
13648 !! input
13649 {{Special:Prefixindex/Xyzzyx}}
13650 {{Special:Prefixindex/Xyzzyx}}
13651 !! result
13652 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13653 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13654
13655 !! end
13656
13657 !! test
13658 Transclusion of default MediaWiki message
13659 !! input
13660 {{MediaWiki:Mainpage}}
13661 !!result
13662 <p>Main Page
13663 </p>
13664 !! end
13665
13666 !! test
13667 Transclusion of nonexistent MediaWiki message
13668 !! input
13669 {{MediaWiki:Mainpagexxx}}
13670 !!result
13671 <p><a href="/index.php?title=MediaWiki:Mainpagexxx&amp;action=edit&amp;redlink=1" class="new" title="MediaWiki:Mainpagexxx (page does not exist)">MediaWiki:Mainpagexxx</a>
13672 </p>
13673 !! end
13674
13675 !! test
13676 Transclusion of MediaWiki message with underscore
13677 !! input
13678 {{MediaWiki:history_short}}
13679 !! result
13680 <p>History
13681 </p>
13682 !! end
13683
13684 !! test
13685 Transclusion of MediaWiki message with space
13686 !! input
13687 {{MediaWiki:history short}}
13688 !! result
13689 <p>History
13690 </p>
13691 !! end
13692
13693 !! test
13694 Invalid header with following text
13695 !! input
13696 = x = y
13697 !! result
13698 <p>= x = y
13699 </p>
13700 !! end
13701
13702
13703 !! test
13704 Section extraction test (section 0)
13705 !! options
13706 section=0
13707 !! input
13708 start
13709 ==a==
13710 ===aa===
13711 ====aaa====
13712 ==b==
13713 ===ba===
13714 ===bb===
13715 ====bba====
13716 ===bc===
13717 ==c==
13718 ===ca===
13719 !! result
13720 start
13721 !! end
13722
13723 !! test
13724 Section extraction test (section 1)
13725 !! options
13726 section=1
13727 !! input
13728 start
13729 ==a==
13730 ===aa===
13731 ====aaa====
13732 ==b==
13733 ===ba===
13734 ===bb===
13735 ====bba====
13736 ===bc===
13737 ==c==
13738 ===ca===
13739 !! result
13740 ==a==
13741 ===aa===
13742 ====aaa====
13743 !! end
13744
13745 !! test
13746 Section extraction test (section 2)
13747 !! options
13748 section=2
13749 !! input
13750 start
13751 ==a==
13752 ===aa===
13753 ====aaa====
13754 ==b==
13755 ===ba===
13756 ===bb===
13757 ====bba====
13758 ===bc===
13759 ==c==
13760 ===ca===
13761 !! result
13762 ===aa===
13763 ====aaa====
13764 !! end
13765
13766 !! test
13767 Section extraction test (section 3)
13768 !! options
13769 section=3
13770 !! input
13771 start
13772 ==a==
13773 ===aa===
13774 ====aaa====
13775 ==b==
13776 ===ba===
13777 ===bb===
13778 ====bba====
13779 ===bc===
13780 ==c==
13781 ===ca===
13782 !! result
13783 ====aaa====
13784 !! end
13785
13786 !! test
13787 Section extraction test (section 4)
13788 !! options
13789 section=4
13790 !! input
13791 start
13792 ==a==
13793 ===aa===
13794 ====aaa====
13795 ==b==
13796 ===ba===
13797 ===bb===
13798 ====bba====
13799 ===bc===
13800 ==c==
13801 ===ca===
13802 !! result
13803 ==b==
13804 ===ba===
13805 ===bb===
13806 ====bba====
13807 ===bc===
13808 !! end
13809
13810 !! test
13811 Section extraction test (section 5)
13812 !! options
13813 section=5
13814 !! input
13815 start
13816 ==a==
13817 ===aa===
13818 ====aaa====
13819 ==b==
13820 ===ba===
13821 ===bb===
13822 ====bba====
13823 ===bc===
13824 ==c==
13825 ===ca===
13826 !! result
13827 ===ba===
13828 !! end
13829
13830 !! test
13831 Section extraction test (section 6)
13832 !! options
13833 section=6
13834 !! input
13835 start
13836 ==a==
13837 ===aa===
13838 ====aaa====
13839 ==b==
13840 ===ba===
13841 ===bb===
13842 ====bba====
13843 ===bc===
13844 ==c==
13845 ===ca===
13846 !! result
13847 ===bb===
13848 ====bba====
13849 !! end
13850
13851 !! test
13852 Section extraction test (section 7)
13853 !! options
13854 section=7
13855 !! input
13856 start
13857 ==a==
13858 ===aa===
13859 ====aaa====
13860 ==b==
13861 ===ba===
13862 ===bb===
13863 ====bba====
13864 ===bc===
13865 ==c==
13866 ===ca===
13867 !! result
13868 ====bba====
13869 !! end
13870
13871 !! test
13872 Section extraction test (section 8)
13873 !! options
13874 section=8
13875 !! input
13876 start
13877 ==a==
13878 ===aa===
13879 ====aaa====
13880 ==b==
13881 ===ba===
13882 ===bb===
13883 ====bba====
13884 ===bc===
13885 ==c==
13886 ===ca===
13887 !! result
13888 ===bc===
13889 !! end
13890
13891 !! test
13892 Section extraction test (section 9)
13893 !! options
13894 section=9
13895 !! input
13896 start
13897 ==a==
13898 ===aa===
13899 ====aaa====
13900 ==b==
13901 ===ba===
13902 ===bb===
13903 ====bba====
13904 ===bc===
13905 ==c==
13906 ===ca===
13907 !! result
13908 ==c==
13909 ===ca===
13910 !! end
13911
13912 !! test
13913 Section extraction test (section 10)
13914 !! options
13915 section=10
13916 !! input
13917 start
13918 ==a==
13919 ===aa===
13920 ====aaa====
13921 ==b==
13922 ===ba===
13923 ===bb===
13924 ====bba====
13925 ===bc===
13926 ==c==
13927 ===ca===
13928 !! result
13929 ===ca===
13930 !! end
13931
13932 !! test
13933 Section extraction test (nonexistent section 11)
13934 !! options
13935 section=11
13936 !! input
13937 start
13938 ==a==
13939 ===aa===
13940 ====aaa====
13941 ==b==
13942 ===ba===
13943 ===bb===
13944 ====bba====
13945 ===bc===
13946 ==c==
13947 ===ca===
13948 !! result
13949 !! end
13950
13951 !! test
13952 Section extraction test with bogus heading (section 1)
13953 !! options
13954 section=1
13955 !! input
13956 ==a==
13957 ==bogus== not a legal section
13958 ==b==
13959 !! result
13960 ==a==
13961 ==bogus== not a legal section
13962 !! end
13963
13964 !! test
13965 Section extraction test with bogus heading (section 2)
13966 !! options
13967 section=2
13968 !! input
13969 ==a==
13970 ==bogus== not a legal section
13971 ==b==
13972 !! result
13973 ==b==
13974 !! end
13975
13976 !! test
13977 Section extraction test with comment after heading (section 1)
13978 !! options
13979 section=1
13980 !! input
13981 ==a==
13982 ==b== <!-- -->
13983 ==c==
13984 !! result
13985 ==a==
13986 !! end
13987
13988 !! test
13989 Section extraction test with comment after heading (section 2)
13990 !! options
13991 section=2
13992 !! input
13993 ==a==
13994 ==b== <!-- -->
13995 ==c==
13996 !! result
13997 ==b== <!-- -->
13998 !! end
13999
14000 !! test
14001 Section extraction test with bogus <nowiki> heading (section 1)
14002 !! options
14003 section=1
14004 !! input
14005 ==a==
14006 ==bogus== <nowiki>not a legal section</nowiki>
14007 ==b==
14008 !! result
14009 ==a==
14010 ==bogus== <nowiki>not a legal section</nowiki>
14011 !! end
14012
14013 !! test
14014 Section extraction test with bogus <nowiki> heading (section 2)
14015 !! options
14016 section=2
14017 !! input
14018 ==a==
14019 ==bogus== <nowiki>not a legal section</nowiki>
14020 ==b==
14021 !! result
14022 ==b==
14023 !! end
14024
14025
14026 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
14027 # instead of respecting commented sections
14028 !! test
14029 Section extraction prefixed by comment (section 1)
14030 !! options
14031 section=1
14032 !! input
14033 <!-- -->==sec1==
14034 ==sec2==
14035 !!result
14036 ==sec2==
14037 !!end
14038
14039 !! test
14040 Section extraction prefixed by comment (section 2)
14041 !! options
14042 section=2
14043 !! input
14044 <!-- -->==sec1==
14045 ==sec2==
14046 !!result
14047
14048 !!end
14049
14050
14051 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
14052 # instead of respecting HTML-style headings
14053 !! test
14054 Section extraction, mixed wiki and html (section 1)
14055 !! options
14056 section=1
14057 !! input
14058 <h2>unmarked</h2>
14059 unmarked
14060 ==1==
14061 one
14062 ==2==
14063 two
14064 !! result
14065 ==1==
14066 one
14067 !! end
14068
14069 !! test
14070 Section extraction, mixed wiki and html (section 2)
14071 !! options
14072 section=2
14073 !! input
14074 <h2>unmarked</h2>
14075 unmarked
14076 ==1==
14077 one
14078 ==2==
14079 two
14080 !! result
14081 ==2==
14082 two
14083 !! end
14084
14085
14086 # Formerly testing for bug 3342
14087 !! test
14088 Section extraction, heading surrounded by <noinclude>
14089 !! options
14090 section=1
14091 !! input
14092 <noinclude>==unmarked==</noinclude>
14093 ==marked==
14094 !! result
14095 ==marked==
14096 !!end
14097
14098 # Test behavior of bug 19910
14099 !! test
14100 Sectiion with all-equals
14101 !! options
14102 section=2
14103 !! input
14104 ===
14105 The line above must have a trailing space
14106 === <!--
14107 --> <!-- -->
14108 But just in case it doesn't...
14109 !! result
14110 === <!--
14111 --> <!-- -->
14112 But just in case it doesn't...
14113 !! end
14114
14115 !! test
14116 Section replacement test (section 0)
14117 !! options
14118 replace=0,"xxx"
14119 !! input
14120 start
14121 ==a==
14122 ===aa===
14123 ====aaa====
14124 ==b==
14125 ===ba===
14126 ===bb===
14127 ====bba====
14128 ===bc===
14129 ==c==
14130 ===ca===
14131 !! result
14132 xxx
14133
14134 ==a==
14135 ===aa===
14136 ====aaa====
14137 ==b==
14138 ===ba===
14139 ===bb===
14140 ====bba====
14141 ===bc===
14142 ==c==
14143 ===ca===
14144 !! end
14145
14146 !! test
14147 Section replacement test (section 1)
14148 !! options
14149 replace=1,"xxx"
14150 !! input
14151 start
14152 ==a==
14153 ===aa===
14154 ====aaa====
14155 ==b==
14156 ===ba===
14157 ===bb===
14158 ====bba====
14159 ===bc===
14160 ==c==
14161 ===ca===
14162 !! result
14163 start
14164 xxx
14165
14166 ==b==
14167 ===ba===
14168 ===bb===
14169 ====bba====
14170 ===bc===
14171 ==c==
14172 ===ca===
14173 !! end
14174
14175 !! test
14176 Section replacement test (section 2)
14177 !! options
14178 replace=2,"xxx"
14179 !! input
14180 start
14181 ==a==
14182 ===aa===
14183 ====aaa====
14184 ==b==
14185 ===ba===
14186 ===bb===
14187 ====bba====
14188 ===bc===
14189 ==c==
14190 ===ca===
14191 !! result
14192 start
14193 ==a==
14194 xxx
14195
14196 ==b==
14197 ===ba===
14198 ===bb===
14199 ====bba====
14200 ===bc===
14201 ==c==
14202 ===ca===
14203 !! end
14204
14205 !! test
14206 Section replacement test (section 3)
14207 !! options
14208 replace=3,"xxx"
14209 !! input
14210 start
14211 ==a==
14212 ===aa===
14213 ====aaa====
14214 ==b==
14215 ===ba===
14216 ===bb===
14217 ====bba====
14218 ===bc===
14219 ==c==
14220 ===ca===
14221 !! result
14222 start
14223 ==a==
14224 ===aa===
14225 xxx
14226
14227 ==b==
14228 ===ba===
14229 ===bb===
14230 ====bba====
14231 ===bc===
14232 ==c==
14233 ===ca===
14234 !! end
14235
14236 !! test
14237 Section replacement test (section 4)
14238 !! options
14239 replace=4,"xxx"
14240 !! input
14241 start
14242 ==a==
14243 ===aa===
14244 ====aaa====
14245 ==b==
14246 ===ba===
14247 ===bb===
14248 ====bba====
14249 ===bc===
14250 ==c==
14251 ===ca===
14252 !! result
14253 start
14254 ==a==
14255 ===aa===
14256 ====aaa====
14257 xxx
14258
14259 ==c==
14260 ===ca===
14261 !! end
14262
14263 !! test
14264 Section replacement test (section 5)
14265 !! options
14266 replace=5,"xxx"
14267 !! input
14268 start
14269 ==a==
14270 ===aa===
14271 ====aaa====
14272 ==b==
14273 ===ba===
14274 ===bb===
14275 ====bba====
14276 ===bc===
14277 ==c==
14278 ===ca===
14279 !! result
14280 start
14281 ==a==
14282 ===aa===
14283 ====aaa====
14284 ==b==
14285 xxx
14286
14287 ===bb===
14288 ====bba====
14289 ===bc===
14290 ==c==
14291 ===ca===
14292 !! end
14293
14294 !! test
14295 Section replacement test (section 6)
14296 !! options
14297 replace=6,"xxx"
14298 !! input
14299 start
14300 ==a==
14301 ===aa===
14302 ====aaa====
14303 ==b==
14304 ===ba===
14305 ===bb===
14306 ====bba====
14307 ===bc===
14308 ==c==
14309 ===ca===
14310 !! result
14311 start
14312 ==a==
14313 ===aa===
14314 ====aaa====
14315 ==b==
14316 ===ba===
14317 xxx
14318
14319 ===bc===
14320 ==c==
14321 ===ca===
14322 !! end
14323
14324 !! test
14325 Section replacement test (section 7)
14326 !! options
14327 replace=7,"xxx"
14328 !! input
14329 start
14330 ==a==
14331 ===aa===
14332 ====aaa====
14333 ==b==
14334 ===ba===
14335 ===bb===
14336 ====bba====
14337 ===bc===
14338 ==c==
14339 ===ca===
14340 !! result
14341 start
14342 ==a==
14343 ===aa===
14344 ====aaa====
14345 ==b==
14346 ===ba===
14347 ===bb===
14348 xxx
14349
14350 ===bc===
14351 ==c==
14352 ===ca===
14353 !! end
14354
14355 !! test
14356 Section replacement test (section 8)
14357 !! options
14358 replace=8,"xxx"
14359 !! input
14360 start
14361 ==a==
14362 ===aa===
14363 ====aaa====
14364 ==b==
14365 ===ba===
14366 ===bb===
14367 ====bba====
14368 ===bc===
14369 ==c==
14370 ===ca===
14371 !! result
14372 start
14373 ==a==
14374 ===aa===
14375 ====aaa====
14376 ==b==
14377 ===ba===
14378 ===bb===
14379 ====bba====
14380 xxx
14381
14382 ==c==
14383 ===ca===
14384 !!end
14385
14386 !! test
14387 Section replacement test (section 9)
14388 !! options
14389 replace=9,"xxx"
14390 !! input
14391 start
14392 ==a==
14393 ===aa===
14394 ====aaa====
14395 ==b==
14396 ===ba===
14397 ===bb===
14398 ====bba====
14399 ===bc===
14400 ==c==
14401 ===ca===
14402 !! result
14403 start
14404 ==a==
14405 ===aa===
14406 ====aaa====
14407 ==b==
14408 ===ba===
14409 ===bb===
14410 ====bba====
14411 ===bc===
14412 xxx
14413 !! end
14414
14415 !! test
14416 Section replacement test (section 10)
14417 !! options
14418 replace=10,"xxx"
14419 !! input
14420 start
14421 ==a==
14422 ===aa===
14423 ====aaa====
14424 ==b==
14425 ===ba===
14426 ===bb===
14427 ====bba====
14428 ===bc===
14429 ==c==
14430 ===ca===
14431 !! result
14432 start
14433 ==a==
14434 ===aa===
14435 ====aaa====
14436 ==b==
14437 ===ba===
14438 ===bb===
14439 ====bba====
14440 ===bc===
14441 ==c==
14442 xxx
14443 !! end
14444
14445 !! test
14446 Section replacement test with initial whitespace (bug 13728)
14447 !! options
14448 replace=2,"xxx"
14449 !! input
14450 Preformatted initial line
14451 ==a==
14452 ===a===
14453 !! result
14454 Preformatted initial line
14455 ==a==
14456 xxx
14457 !! end
14458
14459
14460 !! test
14461 Section extraction, heading followed by pre with 20 spaces (bug 6398)
14462 !! options
14463 section=1
14464 !! input
14465 ==a==
14466 a
14467 !! result
14468 ==a==
14469 a
14470 !! end
14471
14472 !! test
14473 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
14474 !! options
14475 section=1
14476 !! input
14477 ==a==
14478 a
14479 !! result
14480 ==a==
14481 a
14482 !! end
14483
14484
14485 !! test
14486 Section extraction, <pre> around bogus header (bug 10309)
14487 !! options
14488 noxml section=2
14489 !! input
14490 == Section One ==
14491 <pre>
14492 =======
14493 </pre>
14494
14495 == Section Two ==
14496 stuff
14497 !! result
14498 == Section Two ==
14499 stuff
14500 !! end
14501
14502 !! test
14503 Section replacement, <pre> around bogus header (bug 10309)
14504 !! options
14505 noxml replace=2,"xxx"
14506 !! input
14507 == Section One ==
14508 <pre>
14509 =======
14510 </pre>
14511
14512 == Section Two ==
14513 stuff
14514 !! result
14515 == Section One ==
14516 <pre>
14517 =======
14518 </pre>
14519
14520 xxx
14521 !! end
14522
14523
14524
14525 !! test
14526 Handling of &#x0A; in URLs
14527 !! input
14528 **irc://&#x0A;a
14529 !! result
14530 <ul>
14531 <li><ul>
14532 <li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
14533 </li>
14534 </ul>
14535 </li>
14536 </ul>
14537
14538 !!end
14539
14540 !! test
14541 5 quotes, code coverage +1 line (php)
14542 !! options
14543 php
14544 !! input
14545 '''''
14546 !! result
14547 !! end
14548 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
14549 !! test
14550 5 quotes, code coverage +1 line (parsoid)
14551 !! options
14552 parsoid
14553 !! input
14554 '''''
14555 !! result
14556 <p><b><i></i></b></p>
14557 !! end
14558
14559 !! test
14560 Special:Search page linking.
14561 !! input
14562 {{Special:search}}
14563 !! result
14564 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
14565 </p>
14566 !! end
14567
14568 !! test
14569 Say the magic word
14570 !! options
14571 title=[[Parser test]]
14572 !! input
14573 * {{PAGENAME}}
14574 * {{PAGENAMEE}}
14575 * {{FULLPAGENAME}}
14576 * {{FULLPAGENAMEE}}
14577 * {{BASEPAGENAME}}
14578 * {{BASEPAGENAMEE}}
14579 * {{SUBPAGENAME}}
14580 * {{SUBPAGENAMEE}}
14581 * {{ROOTPAGENAME}}
14582 * {{ROOTPAGENAMEE}}
14583 * {{TALKPAGENAME}}
14584 * {{TALKPAGENAMEE}}
14585 * {{SUBJECTPAGENAME}}
14586 * {{SUBJECTPAGENAMEE}}
14587 * {{NAMESPACEE}}
14588 * {{NAMESPACE}}
14589 * {{NAMESPACENUMBER}}
14590 * {{TALKSPACE}}
14591 * {{TALKSPACEE}}
14592 * {{SUBJECTSPACE}}
14593 * {{SUBJECTSPACEE}}
14594 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
14595 !! result
14596 <ul>
14597 <li> Parser test
14598 </li>
14599 <li> Parser_test
14600 </li>
14601 <li> Parser test
14602 </li>
14603 <li> Parser_test
14604 </li>
14605 <li> Parser test
14606 </li>
14607 <li> Parser_test
14608 </li>
14609 <li> Parser test
14610 </li>
14611 <li> Parser_test
14612 </li>
14613 <li> Parser test
14614 </li>
14615 <li> Parser_test
14616 </li>
14617 <li> Talk:Parser test
14618 </li>
14619 <li> Talk:Parser_test
14620 </li>
14621 <li> Parser test
14622 </li>
14623 <li> Parser_test
14624 </li>
14625 <li>
14626 </li>
14627 <li>
14628 </li>
14629 <li> 0
14630 </li>
14631 <li> Talk
14632 </li>
14633 <li> Talk
14634 </li>
14635 <li>
14636 </li>
14637 <li>
14638 </li>
14639 <li> <a href="/index.php?title=Template:Dynamic&amp;action=edit&amp;redlink=1" class="new" title="Template:Dynamic (page does not exist)">Template:Dynamic</a>
14640 </li>
14641 </ul>
14642
14643 !! end
14644 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
14645
14646 !! test
14647 Gallery
14648 !! input
14649 <gallery>
14650 image1.png |
14651 image2.gif|||||
14652
14653 image3|
14654 image4 |300px| centre
14655 image5.svg| http://///////
14656 [[x|xx]]]]
14657 * image6
14658 </gallery>
14659 !! result
14660 <ul class="gallery mw-gallery-traditional">
14661 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14662 <div class="thumb" style="height: 150px;">Image1.png</div>
14663 <div class="gallerytext">
14664 </div>
14665 </div></li>
14666 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14667 <div class="thumb" style="height: 150px;">Image2.gif</div>
14668 <div class="gallerytext">
14669 <p>||||
14670 </p>
14671 </div>
14672 </div></li>
14673 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14674 <div class="thumb" style="height: 150px;">Image3</div>
14675 <div class="gallerytext">
14676 </div>
14677 </div></li>
14678 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14679 <div class="thumb" style="height: 150px;">Image4</div>
14680 <div class="gallerytext">
14681 <p>300px| centre
14682 </p>
14683 </div>
14684 </div></li>
14685 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14686 <div class="thumb" style="height: 150px;">Image5.svg</div>
14687 <div class="gallerytext">
14688 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
14689 </p>
14690 </div>
14691 </div></li>
14692 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14693 <div class="thumb" style="height: 150px;">* image6</div>
14694 <div class="gallerytext">
14695 </div>
14696 </div></li>
14697 </ul>
14698
14699 !! end
14700
14701 !! test
14702 Gallery (with options)
14703 !! input
14704 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
14705 File:Nonexistant.jpg|caption
14706 File:Nonexistant.jpg
14707 image:foobar.jpg|some '''caption''' [[Main Page]]
14708 image:foobar.jpg
14709 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
14710 </gallery>
14711 !! result
14712 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
14713 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
14714 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14715 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
14716 <div class="gallerytext">
14717 <p>caption
14718 </p>
14719 </div>
14720 </div></li>
14721 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14722 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
14723 <div class="gallerytext">
14724 </div>
14725 </div></li>
14726 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14727 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div>
14728 <div class="gallerytext">
14729 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
14730 </p>
14731 </div>
14732 </div></li>
14733 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14734 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div>
14735 <div class="gallerytext">
14736 </div>
14737 </div></li>
14738 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14739 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="This is a foo-bar." src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div>
14740 <div class="gallerytext">
14741 <p>Blabla|blabla.
14742 </p>
14743 </div>
14744 </div></li>
14745 </ul>
14746
14747 !! end
14748
14749 !! test
14750 Gallery with wikitext inside caption
14751 !! input
14752 <gallery>
14753 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
14754 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
14755 </gallery>
14756 !! result
14757 <ul class="gallery mw-gallery-traditional">
14758 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14759 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
14760 <div class="gallerytext">
14761 <p><a href="/wiki/File:Foobar.jpg" class="image" title="desc"><img alt="inneralt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" width="20" height="2" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/30px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/40px-Foobar.jpg 2x" /></a>
14762 </p>
14763 </div>
14764 </div></li>
14765 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14766 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
14767 <div class="gallerytext">
14768 <p>This is a test template
14769 </p>
14770 </div>
14771 </div></li>
14772 </ul>
14773
14774 !! end
14775
14776 !! test
14777 gallery (with showfilename option)
14778 !! input
14779 <gallery showfilename>
14780 File:Nonexistant.jpg|caption
14781 File:Nonexistant.jpg
14782 image:foobar.jpg|some '''caption''' [[Main Page]]
14783 File:Foobar.jpg
14784 </gallery>
14785 !! result
14786 <ul class="gallery mw-gallery-traditional">
14787 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14788 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14789 <div class="gallerytext">
14790 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
14791 caption
14792 </p>
14793 </div>
14794 </div></li>
14795 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14796 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14797 <div class="gallerytext">
14798 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
14799 </p>
14800 </div>
14801 </div></li>
14802 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14803 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
14804 <div class="gallerytext">
14805 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
14806 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
14807 </p>
14808 </div>
14809 </div></li>
14810 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14811 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
14812 <div class="gallerytext">
14813 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
14814 </p>
14815 </div>
14816 </div></li>
14817 </ul>
14818
14819 !! end
14820
14821 !! test
14822 Gallery (with namespace-less filenames)
14823 !! input
14824 <gallery>
14825 File:Nonexistant.jpg
14826 Nonexistant.jpg
14827 image:foobar.jpg
14828 foobar.jpg
14829 </gallery>
14830 !! result
14831 <ul class="gallery mw-gallery-traditional">
14832 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14833 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14834 <div class="gallerytext">
14835 </div>
14836 </div></li>
14837 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14838 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14839 <div class="gallerytext">
14840 </div>
14841 </div></li>
14842 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14843 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
14844 <div class="gallerytext">
14845 </div>
14846 </div></li>
14847 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14848 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
14849 <div class="gallerytext">
14850 </div>
14851 </div></li>
14852 </ul>
14853
14854 !! end
14855
14856 !! test
14857 HTML Hex character encoding (spells the word "JavaScript")
14858 !! input
14859 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
14860 !! result
14861 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
14862 </p>
14863 !! end
14864
14865 !! test
14866 HTML Hex character encoding bogus encoding (bug 26437 regression check)
14867 !! input
14868 &#xsee;&#XSEE;
14869 !! result
14870 <p>&amp;#xsee;&amp;#XSEE;
14871 </p>
14872 !! end
14873
14874 !! test
14875 HTML Hex character encoding mixed case
14876 !! input
14877 &#xEE;&#Xee;
14878 !! result
14879 <p>&#xee;&#xee;
14880 </p>
14881 !! end
14882
14883 !! test
14884 __FORCETOC__ override
14885 !! input
14886 __NEWSECTIONLINK__
14887 __FORCETOC__
14888 !! result
14889 <p><br />
14890 </p>
14891 !! end
14892
14893 !! test
14894 ISBN code coverage
14895 !! input
14896 ISBN 978-0-1234-56&#x20;789
14897 !! result
14898 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
14899 </p>
14900 !! end
14901
14902 !! test
14903 ISBN followed by 5 spaces
14904 !! input
14905 ISBN
14906 !! result
14907 <p>ISBN
14908 </p>
14909 !! end
14910
14911 !! test
14912 Double ISBN
14913 !! input
14914 ISBN ISBN 1234567890
14915 !! result
14916 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
14917 </p>
14918 !! end
14919
14920 !! test
14921 ISBN with an X
14922 !! input
14923 ISBN 3-462-04561-X
14924 !! result
14925 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
14926 </p>
14927 !! end
14928
14929 !! test
14930 Bug 22905: <abbr> followed by ISBN followed by </a>
14931 !! input
14932 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
14933 !! result
14934 <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>
14935 </p>
14936 !! end
14937
14938 !! test
14939 Double RFC
14940 !! input
14941 RFC RFC 1234
14942 !! result
14943 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
14944 </p>
14945 !! end
14946
14947 !! test
14948 Double RFC with a wiki link
14949 !! input
14950 RFC [[RFC 1234]]
14951 !! result
14952 <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>
14953 </p>
14954 !! end
14955
14956 !! test
14957 RFC code coverage
14958 !! input
14959 RFC 983&#x20;987
14960 !! result
14961 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
14962 </p>
14963 !! end
14964
14965 !! test
14966 Centre-aligned image
14967 !! input
14968 [[Image:foobar.jpg|centre]]
14969 !! result
14970 <div class="center"><div class="floatnone"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div></div>
14971
14972 !!end
14973
14974 !! test
14975 None-aligned image
14976 !! input
14977 [[Image:foobar.jpg|none]]
14978 !! result
14979 <div class="floatnone"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
14980
14981 !!end
14982
14983 !! test
14984 Width + Height sized image (using px) (height is ignored)
14985 !! input
14986 [[Image:foobar.jpg|640x480px]]
14987 !! result
14988 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
14989 </p>
14990 !!end
14991
14992 !! test
14993 Width-sized image (using px, no following whitespace)
14994 !! input
14995 [[Image:foobar.jpg|640px]]
14996 !! result
14997 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
14998 </p>
14999 !!end
15000
15001 !! test
15002 Width-sized image (using px, with following whitespace - test regression from r39467)
15003 !! input
15004 [[Image:foobar.jpg|640px ]]
15005 !! result
15006 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
15007 </p>
15008 !!end
15009
15010 !! test
15011 Width-sized image (using px, with preceding whitespace - test regression from r39467)
15012 !! input
15013 [[Image:foobar.jpg| 640px]]
15014 !! result
15015 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
15016 </p>
15017 !!end
15018
15019 !! test
15020 Another italics / bold test
15021 !! input
15022 ''' ''x'
15023 !! result
15024 <pre>'<i> </i>x'
15025 </pre>
15026 !!end
15027
15028 # Note the results may be incorrect, as parserTest output included this:
15029 # XML error: Mismatched tag at byte 6120:
15030 # ...<dd> </dt></dl> </dd...
15031 !! test
15032 dt/dd/dl test
15033 !! options
15034 disabled
15035 !! input
15036 :;;;::
15037 !! result
15038 <dl>
15039 <dd><dl>
15040 <dt><dl>
15041 <dt><dl>
15042 <dt><dl>
15043 <dd><dl>
15044 <dd>
15045 </dd>
15046 </dl>
15047 </dd>
15048 </dl>
15049 </dt>
15050 </dl>
15051 </dt>
15052 </dl>
15053 </dt>
15054 </dl>
15055 </dd>
15056 </dl>
15057
15058 !!end
15059
15060
15061 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
15062 !! test
15063 Images with the "|" character in the comment
15064 !! input
15065 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
15066 !! result
15067 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>An <a rel="nofollow" class="external text" href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx">external</a> URL</div></div></div>
15068
15069 !!end
15070
15071 !! test
15072 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
15073 !! input
15074 <html><script>alert(1);</script></html>
15075 !! result
15076 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
15077 </p>
15078 !! end
15079
15080 !! test
15081 HTML with raw HTML ($wgRawHtml==true)
15082 !! options
15083 wgRawHtml=1
15084 !! input
15085 <html><script>alert(1);</script></html>
15086 !! result
15087 <p><script>alert(1);</script>
15088 </p>
15089 !! end
15090
15091 !! test
15092 Parents of subpages, one level up
15093 !! options
15094 subpage title=[[Subpage test/L1/L2/L3]]
15095 !! input
15096 [[../|L2]]
15097 !! result
15098 <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">L2</a>
15099 </p>
15100 !! end
15101
15102
15103 !! test
15104 Parents of subpages, one level up, not named
15105 !! options
15106 subpage title=[[Subpage test/L1/L2/L3]]
15107 !! input
15108 [[../]]
15109 !! result
15110 <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">Subpage test/L1/L2</a>
15111 </p>
15112 !! end
15113
15114
15115
15116 !! test
15117 Parents of subpages, two levels up
15118 !! options
15119 subpage title=[[Subpage test/L1/L2/L3]]
15120 !! input
15121 [[../../|L1]]2
15122
15123 [[../../|L1]]l
15124 !! result
15125 <p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1</a>2
15126 </p><p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1l</a>
15127 </p>
15128 !! end
15129
15130 !! test
15131 Parents of subpages, two levels up, without trailing slash or name.
15132 !! options
15133 subpage title=[[Subpage test/L1/L2/L3]]
15134 !! input
15135 [[../..]]
15136 !! result
15137 <p>[[../..]]
15138 </p>
15139 !! end
15140
15141 !! test
15142 Parents of subpages, two levels up, with lots of extra trailing slashes.
15143 !! options
15144 subpage title=[[Subpage test/L1/L2/L3]]
15145 !! input
15146 [[../../////]]
15147 !! result
15148 <p><a href="/index.php?title=Subpage_test/L1////&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1//// (page does not exist)">///</a>
15149 </p>
15150 !! end
15151
15152 !! article
15153 Subpage test/L1/L2/L3Sibling
15154 !! text
15155 Sibling article
15156 !! endarticle
15157
15158 !! test
15159 Transclusion of a sibling page (one level up)
15160 !! options
15161 subpage title=[[Subpage test/L1/L2/L3]]
15162 !! input
15163 {{../L3Sibling}}
15164 !! result
15165 <p>Sibling article
15166 </p>
15167 !! end
15168
15169 !! test
15170 Transclusion of a child page
15171 !! options
15172 subpage title=[[Subpage test/L1/L2]]
15173 !! input
15174 {{/L3Sibling}}
15175 !! result
15176 <p>Sibling article
15177 </p>
15178 !! end
15179
15180 !! test
15181 Non-transclusion because of too many up levels
15182 !! options
15183 subpage title=[[Subpage test/L1/L2/L3]]
15184 !! input
15185 {{../../../../More than parent}}
15186 !! result
15187 <p>{{../../../../More than parent}}
15188 </p>
15189 !! end
15190
15191 !! test
15192 Definition list code coverage
15193 !! input
15194 ; title : def
15195 ; title : def
15196 ;title: def
15197 !! result
15198 <dl>
15199 <dt> title &#160;</dt>
15200 <dd> def
15201 </dd>
15202 <dt> title&#160;</dt>
15203 <dd> def
15204 </dd>
15205 <dt>title</dt>
15206 <dd> def
15207 </dd>
15208 </dl>
15209
15210 !! end
15211
15212 !! test
15213 Don't fall for the self-closing div
15214 !! input
15215 <div>hello world</div/>
15216 !! result
15217 <div>hello world</div>
15218
15219 !! end
15220
15221 !! test
15222 MSGNW magic word
15223 !! input
15224 {{MSGNW:msg}}
15225 !! result
15226 <p>&#91;&#91;:Template:Msg&#93;&#93;
15227 </p>
15228 !! end
15229
15230 !! test
15231 RAW magic word
15232 !! input
15233 {{RAW:QUERTY}}
15234 !! result
15235 <p><a href="/index.php?title=Template:QUERTY&amp;action=edit&amp;redlink=1" class="new" title="Template:QUERTY (page does not exist)">Template:QUERTY</a>
15236 </p>
15237 !! end
15238
15239 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
15240 !! test
15241 Always escape literal '>' in output, not just after '<'
15242 !! input
15243 ><>
15244 !! result
15245 <p>&gt;&lt;&gt;
15246 </p>
15247 !! end
15248
15249 !! test
15250 Template caching
15251 !! input
15252 {{Test}}
15253 {{Test}}
15254 !! result
15255 <p>This is a test template
15256 This is a test template
15257 </p>
15258 !! end
15259
15260
15261 !! article
15262 MediaWiki:Fake
15263 !! text
15264 ==header==
15265 !! endarticle
15266
15267 !! test
15268 Inclusion of !userCanEdit() content
15269 !! input
15270 {{MediaWiki:Fake}}
15271 !! result
15272 <h2><span class="mw-headline" id="header">header</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=MediaWiki:Fake&amp;action=edit&amp;section=T-1" title="MediaWiki:Fake">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15273
15274 !! end
15275
15276
15277 !! test
15278 Out-of-order TOC heading levels
15279 !! input
15280 ==2==
15281 ======6======
15282 ===3===
15283 =1=
15284 =====5=====
15285 ==2==
15286 !! result
15287 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15288 <ul>
15289 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
15290 <ul>
15291 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
15292 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
15293 </ul>
15294 </li>
15295 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
15296 <ul>
15297 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
15298 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
15299 </ul>
15300 </li>
15301 </ul>
15302 </div>
15303
15304 <h2><span class="mw-headline" id="2">2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15305 <h6><span class="mw-headline" id="6">6</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: 6">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
15306 <h3><span class="mw-headline" id="3">3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: 3">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
15307 <h1><span class="mw-headline" id="1">1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 1">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
15308 <h5><span class="mw-headline" id="5">5</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: 5">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
15309 <h2><span class="mw-headline" id="2_2">2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15310
15311 !! end
15312
15313
15314 !! test
15315 ISBN with a dummy number
15316 !! input
15317 ISBN ---
15318 !! result
15319 <p>ISBN ---
15320 </p>
15321 !! end
15322
15323
15324 !! test
15325 ISBN with space-delimited number
15326 !! input
15327 ISBN 92 9017 032 8
15328 !! result
15329 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
15330 </p>
15331 !! end
15332
15333
15334 !! test
15335 ISBN with multiple spaces, no number
15336 !! input
15337 ISBN foo
15338 !! result
15339 <p>ISBN foo
15340 </p>
15341 !! end
15342
15343
15344 !! test
15345 ISBN length
15346 !! input
15347 ISBN 123456789
15348
15349 ISBN 1234567890
15350
15351 ISBN 12345678901
15352 !! result
15353 <p>ISBN 123456789
15354 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15355 </p><p>ISBN 12345678901
15356 </p>
15357 !! end
15358
15359
15360 !! test
15361 ISBN with trailing year (bug 8110)
15362 !! input
15363 ISBN 1-234-56789-0 - 2006
15364
15365 ISBN 1 234 56789 0 - 2006
15366 !! result
15367 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
15368 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
15369 </p>
15370 !! end
15371
15372
15373 !! test
15374 anchorencode
15375 !! input
15376 {{anchorencode:foo bar©#%n}}
15377 !! result
15378 <p>foo_bar.C2.A9.23.25n
15379 </p>
15380 !! end
15381
15382 !! test
15383 anchorencode trims spaces
15384 !! input
15385 {{anchorencode: __pretty__please__}}
15386 !! result
15387 <p>pretty_please
15388 </p>
15389 !! end
15390
15391 !! test
15392 anchorencode deals with links
15393 !! input
15394 {{anchorencode: [[hello|world]] [[hi]]}}
15395 !! result
15396 <p>world_hi
15397 </p>
15398 !! end
15399
15400 !! test
15401 anchorencode deals with templates
15402 !! input
15403 {{anchorencode: {{Foo}} }}
15404 !! result
15405 <p>FOO
15406 </p>
15407 !! end
15408
15409 !! test
15410 anchorencode encodes like the TOC generator: (bug 18431)
15411 !! input
15412 === _ +:.3A%3A&&amp;]] ===
15413 {{anchorencode: _ +:.3A%3A&&amp;]] }}
15414 __NOEDITSECTION__
15415 !! result
15416 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
15417 <p>.2B:.3A.253A.26.26.5D.5D
15418 </p>
15419 !! end
15420
15421 !! test
15422 Bug 6200: blockquotes and paragraph formatting
15423 !! input
15424 <blockquote>
15425 foo
15426 </blockquote>
15427
15428 bar
15429
15430 baz
15431 !! result
15432 <blockquote>
15433 <p>foo
15434 </p>
15435 </blockquote>
15436 <p>bar
15437 </p>
15438 <pre>baz
15439 </pre>
15440 !! end
15441
15442 !! test
15443 Bug 8293: Use of center tag ruins paragraph formatting
15444 !! input
15445 <center>
15446 foo
15447 </center>
15448
15449 bar
15450
15451 baz
15452 !! result
15453 <center>
15454 <p>foo
15455 </p>
15456 </center>
15457 <p>bar
15458 </p>
15459 <pre>baz
15460 </pre>
15461 !! end
15462
15463 !!test
15464 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
15465 !!options
15466 php
15467 !!input
15468 <span><s>x</span></s>
15469 !!result
15470 <p><span><s>x&lt;/span&gt;</s></span>
15471 </p>
15472 !!end
15473
15474 !!test
15475 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
15476 !!options
15477 parsoid
15478 !!input
15479 <span><s>x</span></s>
15480 !!result
15481 <p><span><s>x</s></span><s></s>
15482 </p>
15483 !!end
15484
15485 ###
15486 ### Language variants related tests
15487 ###
15488 !! test
15489 Self-link in language variants
15490 !! options
15491 title=[[Dunav]] language=sr
15492 !! input
15493 Both [[Dunav]] and [[Дунав]] are names for this river.
15494 !! result
15495 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
15496 </p>
15497 !!end
15498
15499 !! article
15500 Дуна
15501 !! text
15502 content
15503 !! endarticle
15504
15505 !! test
15506 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
15507 !! options
15508 title=[[Duna]] language=sr
15509 !! input
15510 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
15511 !! result
15512 <p><a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Дуна</a> is not a self-link while <strong class="selflink">Duna</strong> and <strong class="selflink">Dуна</strong> are still self-links.
15513 </p>
15514 !! end
15515
15516 !! test
15517 Link to a section of a variant of this title shouldn't be parsed as self-link
15518 !! options
15519 title=[[Duna]] language=sr
15520 !! input
15521 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
15522 !! result
15523 <p><strong class="selflink">Dуна</strong> is a self-link while <a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Dunа#Foo</a> and <a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Dуна#Foo</a> are not self-links.
15524 </p>
15525 !! end
15526
15527 !! test
15528 Link to pages in language variants
15529 !! options
15530 language=sr
15531 !! input
15532 Main Page can be written as [[Маин Паге]]
15533 !! result
15534 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
15535 </p>
15536 !!end
15537
15538
15539 !! test
15540 Multiple links to pages in language variants
15541 !! options
15542 language=sr
15543 !! input
15544 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
15545 !! result
15546 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a> can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a> same as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>.
15547 </p>
15548 !!end
15549
15550
15551 !! test
15552 Simple template in language variants
15553 !! options
15554 language=sr
15555 !! input
15556 {{тест}}
15557 !! result
15558 <p>This is a test template
15559 </p>
15560 !! end
15561
15562
15563 !! test
15564 Template with explicit namespace in language variants
15565 !! options
15566 language=sr
15567 !! input
15568 {{Template:тест}}
15569 !! result
15570 <p>This is a test template
15571 </p>
15572 !! end
15573
15574
15575 !! test
15576 Basic test for template parameter in language variants
15577 !! options
15578 language=sr
15579 !! input
15580 {{парамтест|param=foo}}
15581 !! result
15582 <p>This is a test template with parameter foo
15583 </p>
15584 !! end
15585
15586
15587 !! test
15588 Simple category in language variants
15589 !! options
15590 language=sr cat
15591 !! input
15592 [[Category:МедиаWики Усер'с Гуиде]]
15593 !! result
15594 <a href="/wiki/%D0%9A%D0%B0%D1%82%D0%B5%D0%B3%D0%BE%D1%80%D0%B8%D1%98%D0%B0:MediaWiki_User%27s_Guide" title="Категорија:MediaWiki User's Guide">MediaWiki User's Guide</a>
15595 !! end
15596
15597
15598 !! article
15599 Category:分类
15600 !! text
15601 blah
15602 !! endarticle
15603
15604 !! article
15605 Category:分類
15606 !! text
15607 blah
15608 !! endarticle
15609
15610 !! test
15611 Don't convert blue categorylinks to another variant (bug 33210)
15612 !! options
15613 language=zh cat
15614 !! input
15615 [[A]][[Category:分类]]
15616 !! result
15617 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
15618 !! end
15619
15620
15621 !! test
15622 Stripping -{}- tags (language variants)
15623 !! options
15624 language=sr
15625 !! input
15626 Latin proverb: -{Ne nuntium necare}-
15627 !! result
15628 <p>Latin proverb: Ne nuntium necare
15629 </p>
15630 !! end
15631
15632
15633 !! test
15634 Prevent conversion with -{}- tags (language variants)
15635 !! options
15636 language=sr variant=sr-ec
15637 !! input
15638 Latinski: -{Ne nuntium necare}-
15639 !! result
15640 <p>Латински: Ne nuntium necare
15641 </p>
15642 !! end
15643
15644
15645 !! test
15646 Prevent conversion of text with -{}- tags (language variants)
15647 !! options
15648 language=sr variant=sr-ec
15649 !! input
15650 Latinski: -{Ne nuntium necare}-
15651 !! result
15652 <p>Латински: Ne nuntium necare
15653 </p>
15654 !! end
15655
15656
15657 !! test
15658 Prevent conversion of links with -{}- tags (language variants)
15659 !! options
15660 language=sr variant=sr-ec
15661 !! input
15662 -{[[Main Page]]}-
15663 !! result
15664 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15665 </p>
15666 !! end
15667
15668
15669 !! test
15670 -{}- tags within headlines (within html for parserConvert())
15671 !! options
15672 language=sr variant=sr-ec
15673 !! input
15674 == -{Naslov}- ==
15675 !! result
15676 <h2><span class="mw-headline" id="-.7BNaslov.7D-">Naslov</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Уредите одељак „Naslov“">уреди</a><span class="mw-editsection-bracket">]</span></span></h2>
15677
15678 !! end
15679
15680
15681 !! test
15682 Explicit definition of language variant alternatives
15683 !! options
15684 language=zh variant=zh-tw
15685 !! input
15686 -{zh:China;zh-tw:Taiwan}-, not China
15687 !! result
15688 <p>Taiwan, not China
15689 </p>
15690 !! end
15691
15692
15693 !! test
15694 Conversion around HTML tags
15695 !! options
15696 language=sr variant=sr-ec
15697 !! input
15698 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
15699 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
15700 !! result
15701 <p>
15702 <span title="ЛаCтин">ски</span>
15703 </p>
15704 !! end
15705
15706
15707 !! test
15708 Explicit session-wise language variant mapping (A flag and - flag)
15709 !! options
15710 language=zh variant=zh-tw
15711 !! input
15712 Taiwan is not China.
15713 But -{A|zh:China;zh-tw:Taiwan}- is China,
15714 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
15715 and -{China}- is China.
15716 !! result
15717 <p>Taiwan is not China.
15718 But Taiwan is Taiwan,
15719 (This should be stripped!)
15720 and China is China.
15721 </p>
15722 !! end
15723
15724 !! test
15725 Explicit session-wise language variant mapping (H flag for hide)
15726 !! options
15727 language=zh variant=zh-tw
15728 !! input
15729 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
15730 Taiwan is China.
15731 !! result
15732 <p>(This should be stripped!)
15733 Taiwan is Taiwan.
15734 </p>
15735 !! end
15736
15737 !! test
15738 Adding explicit conversion rule for title (T flag)
15739 !! options
15740 language=zh variant=zh-tw showtitle
15741 !! input
15742 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
15743 !! result
15744 Taiwan
15745 <p>Should be stripped!
15746 </p>
15747 !! end
15748
15749 !! test
15750 Testing that changing the language variant here in the tests actually works
15751 !! options
15752 language=zh variant=zh showtitle
15753 !! input
15754 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
15755 !! result
15756 China
15757 <p>Should be stripped!
15758 </p>
15759 !! end
15760
15761 !! test
15762 Recursive conversion of alt and title attrs shouldn't clear converter state
15763 !! options
15764 language=zh variant=zh-cn showtitle
15765 !! input
15766 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
15767 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
15768 !! result
15769 China
15770 <p>
15771 Should be stripped<span title="Exclamation">!</span>
15772 </p>
15773 !! end
15774
15775 !! test
15776 Bug 24072: more test on conversion rule for title
15777 !! options
15778 language=zh variant=zh-tw showtitle
15779 !! input
15780 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
15781 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
15782 !! result
15783 Taiwan
15784 <p>This should be stripped!
15785 This won't take interferes with the title rule.
15786 </p>
15787 !! end
15788
15789 !! test
15790 Partly disable title conversion if variant == main language code
15791 !! options
15792 language=zh variant=zh title=[[ZH]] showtitle
15793 !! input
15794 -{T|zh-cn:CN;zh-tw:TW}-
15795 !! result
15796 ZH
15797 <p>
15798 </p>
15799 !! end
15800
15801 !! test
15802 Partly disable title conversion if variant == main language code, more
15803 !! options
15804 language=zh variant=zh title=[[ZH]] showtitle
15805 !! input
15806 -{T|TW}-
15807 !! result
15808 ZH
15809 <p>
15810 </p>
15811 !! end
15812
15813 !! test
15814 Raw output of variant escape tags (R flag)
15815 !! options
15816 language=zh variant=zh-tw
15817 !! input
15818 Raw: -{R|zh:China;zh-tw:Taiwan}-
15819 !! result
15820 <p>Raw: zh:China;zh-tw:Taiwan
15821 </p>
15822 !! end
15823
15824 !! test
15825 Nested using of manual convert syntax
15826 !! options
15827 language=zh variant=zh-hk
15828 !! input
15829 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
15830 !! result
15831 <p>Nested: Hello Hong Kong!
15832 </p>
15833 !! end
15834
15835 !! test
15836 Proper conversion of text in external links
15837 !! options
15838 language=sr variant=sr-ec
15839 !! input
15840 http://www.google.com
15841 gopher://www.google.com
15842 [http://www.google.com http://www.google.com]
15843 [gopher://www.google.com gopher://www.google.com]
15844 [https://www.google.com irc://www.google.com]
15845 [ftp://www.google.com www.google.com/ftp://dir]
15846 [//www.google.com www.google.com]
15847 !! result
15848 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
15849 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
15850 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
15851 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
15852 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
15853 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
15854 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
15855 </p>
15856 !! end
15857
15858 !! test
15859 Do not convert roman numbers to language variants
15860 !! options
15861 language=sr variant=sr-ec
15862 !! input
15863 Fridrih IV je car.
15864 !! result
15865 <p>Фридрих IV је цар.
15866 </p>
15867 !! end
15868
15869 !! test
15870 Unclosed language converter markup "-{"
15871 !! options
15872 language=sr
15873 !! input
15874 -{T|hello
15875 !! result
15876 <p>-{T|hello
15877 </p>
15878 !! end
15879
15880 !! test
15881 Don't convert raw rule "-{R|=&gt;}-" to "=>"
15882 !! options
15883 language=sr
15884 !! input
15885 -{R|=&gt;}-
15886 !! result
15887 <p>=&gt;
15888 </p>
15889 !!end
15890
15891 !! test
15892 Don't break link parsing if language converter markup is in the caption.
15893 !! options
15894 language=sr variant=sr-ec
15895 !! input
15896 [[Main Page|-{R|main page}-]]
15897 !! result
15898 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
15899 </p>
15900 !! end
15901
15902 # This test is currently broken in the PHP parser (bug 52661)
15903 !! test
15904 Don't break image parsing if language converter markup is in the caption.
15905 !! options
15906 language=sr
15907 disabled
15908 !! input
15909 [[File:Foobar.jpg|-{R|caption}-]]
15910 !! result
15911 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15912 </p>
15913 !! end
15914
15915 # This test is currently broken in the PHP parser (bug 52661)
15916 !! test
15917 Don't break list handling if language converter markup is in the item.
15918 !! options
15919 language=zh variant=zh-cn
15920 disabled
15921 !! input
15922 ;-{zh-cn:AAA;zh-tw:BBB}-
15923 !! result
15924 <dl><dt>AAA
15925 </dt></dl>
15926
15927 !! end
15928
15929 # This test is currently broken in the PHP parser (bug 52661)
15930 !! test
15931 Don't break table handling if language converter markup is in the cell.
15932 !! options
15933 language=sr variant=sr-ec
15934 disabled
15935 !! input
15936 {|
15937 |-
15938 | -{R|B}-
15939 |}
15940 !! result
15941 <table>
15942
15943 <tr>
15944 <td> B
15945 </td></tr></table>
15946
15947 !! end
15948
15949 !! test
15950 Bug 529: Uncovered bullet
15951 !! input
15952 * Foo {{bullet}}
15953 !! result
15954 <ul>
15955 <li> Foo
15956 </li>
15957 <li> Bar
15958 </li>
15959 </ul>
15960
15961 !! end
15962
15963 # Plain MediaWiki does not remove empty lists, but tidy actually does.
15964 # Templates in Wikipedia rely on this behavior, as tidy has always been
15965 # enabled there. These tests are normally run *without* tidy, so specify the
15966 # full output here.
15967 # To test realistic parsing behavior, apply a tidy-like transformation to both
15968 # the expected output and your parser's output.
15969 !! test
15970 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
15971 !! input
15972 ******* Foo {{bullet}}
15973 !! result
15974 <ul>
15975 <li><ul>
15976 <li><ul>
15977 <li><ul>
15978 <li><ul>
15979 <li><ul>
15980 <li><ul>
15981 <li> Foo
15982 </li>
15983 </ul>
15984 </li>
15985 </ul>
15986 </li>
15987 </ul>
15988 </li>
15989 </ul>
15990 </li>
15991 </ul>
15992 </li>
15993 </ul>
15994 </li>
15995 <li> Bar
15996 </li>
15997 </ul>
15998
15999 !! end
16000
16001 !! test
16002 Bug 529: Uncovered table already at line-start
16003 !! input
16004 x
16005
16006 {{table}}
16007 y
16008 !! result
16009 <p>x
16010 </p>
16011 <table>
16012 <tr>
16013 <td> 1 </td>
16014 <td> 2
16015 </td></tr>
16016 <tr>
16017 <td> 3 </td>
16018 <td> 4
16019 </td></tr></table>
16020 <p>y
16021 </p>
16022 !! end
16023
16024 !! test
16025 Bug 529: Uncovered bullet in parser function result
16026 !! input
16027 * Foo {{lc:{{bullet}} }}
16028 !! result
16029 <ul>
16030 <li> Foo
16031 </li>
16032 <li> bar
16033 </li>
16034 </ul>
16035
16036 !! end
16037
16038 !! test
16039 Bug 5678: Double-parsed template argument
16040 !! input
16041 {{lc:{{{1}}}|hello}}
16042 !! result
16043 <p>{{{1}}}
16044 </p>
16045 !! end
16046
16047 !! test
16048 Bug 5678: Double-parsed template invocation
16049 !! input
16050 {{lc:{{paramtest {{!}} param = hello }} }}
16051 !! result
16052 <p>{{paramtest | param = hello }}
16053 </p>
16054 !! end
16055
16056 !! test
16057 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
16058 !! options
16059 language=cs
16060 title=[[Main Page]]
16061 !! input
16062 {{PRVNÍVELKÉ:ěščř}}
16063 {{prvnívelké:ěščř}}
16064 {{PRVNÍMALÉ:ěščř}}
16065 {{prvnímalé:ěščř}}
16066 {{MALÁ:ěščř}}
16067 {{malá:ěščř}}
16068 {{VELKÁ:ěščř}}
16069 {{velká:ěščř}}
16070 !! result
16071 <p>Ěščř
16072 Ěščř
16073 ěščř
16074 ěščř
16075 ěščř
16076 ěščř
16077 ĚŠČŘ
16078 ĚŠČŘ
16079 </p>
16080 !! end
16081
16082 !! test
16083 Morwen/13: Unclosed link followed by heading
16084 !! input
16085 [[link
16086 ==heading==
16087 !! result
16088 <p>[[link
16089 </p>
16090 <h2><span class="mw-headline" id="heading">heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16091
16092 !! end
16093
16094 !! test
16095 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
16096 !! input
16097 {{foo|
16098 =heading=
16099 !! result
16100 <p>{{foo|
16101 </p>
16102 <h1><span class="mw-headline" id="heading">heading</span></h1>
16103
16104 !! end
16105
16106 !! test
16107 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
16108 !! input
16109 {{foo|
16110 ==heading==
16111 !! result
16112 <p>{{foo|
16113 </p>
16114 <h2><span class="mw-headline" id="heading">heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16115
16116 !! end
16117
16118 !! test
16119 Tildes in comments
16120 !! options
16121 pst
16122 !! input
16123 <!-- ~~~~ -->
16124 !! result
16125 <!-- ~~~~ -->
16126 !! end
16127
16128 !! test
16129 Paragraphs inside divs (no extra line breaks)
16130 !! input
16131 <div>Line one
16132
16133 Line two</div>
16134 !! result
16135 <div>Line one
16136 Line two</div>
16137
16138 !! end
16139
16140 !! test
16141 Paragraphs inside divs (extra line break on open)
16142 !! input
16143 <div>
16144 Line one
16145
16146 Line two</div>
16147 !! result
16148 <div>
16149 <p>Line one
16150 </p>
16151 Line two</div>
16152
16153 !! end
16154
16155 !! test
16156 Paragraphs inside divs (extra line break on close)
16157 !! input
16158 <div>Line one
16159
16160 Line two
16161 </div>
16162 !! result
16163 <div>Line one
16164 <p>Line two
16165 </p>
16166 </div>
16167
16168 !! end
16169
16170 !! test
16171 Paragraphs inside divs (extra line break on open and close)
16172 !! input
16173 <div>
16174 Line one
16175
16176 Line two
16177 </div>
16178 !! result
16179 <div>
16180 <p>Line one
16181 </p><p>Line two
16182 </p>
16183 </div>
16184
16185 !! end
16186
16187 !! test
16188 Nesting tags, paragraphs on lines which begin with <div>
16189 !! options
16190 disabled
16191 !! input
16192 <div></div><strong>A
16193 B</strong>
16194 !! result
16195 <div></div>
16196 <p><strong>A
16197 B</strong>
16198 </p>
16199 !! end
16200
16201 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
16202 !! test
16203 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
16204 !! input
16205 <blockquote>Line one
16206
16207 Line two</blockquote>
16208 !! result
16209 <blockquote>Line one
16210 Line two</blockquote>
16211
16212 !! end
16213
16214 !! test
16215 Bug 6200: paragraphs inside blockquotes (extra line break on open)
16216 !! input
16217 <blockquote>
16218 Line one
16219
16220 Line two</blockquote>
16221 !! result
16222 <blockquote>
16223 <p>Line one
16224 </p>
16225 Line two</blockquote>
16226
16227 !! end
16228
16229 !! test
16230 Bug 6200: paragraphs inside blockquotes (extra line break on close)
16231 !! input
16232 <blockquote>Line one
16233
16234 Line two
16235 </blockquote>
16236 !! result
16237 <blockquote>Line one
16238 <p>Line two
16239 </p>
16240 </blockquote>
16241
16242 !! end
16243
16244 !! test
16245 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
16246 !! input
16247 <blockquote>
16248 Line one
16249
16250 Line two
16251 </blockquote>
16252 !! result
16253 <blockquote>
16254 <p>Line one
16255 </p><p>Line two
16256 </p>
16257 </blockquote>
16258
16259 !! end
16260
16261 !! test
16262 Paragraphs inside blockquotes/divs (no extra line breaks)
16263 !! input
16264 <blockquote><div>Line one
16265
16266 Line two</div></blockquote>
16267 !! result
16268 <blockquote><div>Line one
16269 Line two</div></blockquote>
16270
16271 !! end
16272
16273 !! test
16274 Paragraphs inside blockquotes/divs (extra line break on open)
16275 !! input
16276 <blockquote><div>
16277 Line one
16278
16279 Line two</div></blockquote>
16280 !! result
16281 <blockquote><div>
16282 <p>Line one
16283 </p>
16284 Line two</div></blockquote>
16285
16286 !! end
16287
16288 !! test
16289 Paragraphs inside blockquotes/divs (extra line break on close)
16290 !! input
16291 <blockquote><div>Line one
16292
16293 Line two
16294 </div></blockquote>
16295 !! result
16296 <blockquote><div>Line one
16297 <p>Line two
16298 </p>
16299 </div></blockquote>
16300
16301 !! end
16302
16303 !! test
16304 Paragraphs inside blockquotes/divs (extra line break on open and close)
16305 !! input
16306 <blockquote><div>
16307 Line one
16308
16309 Line two
16310 </div></blockquote>
16311 !! result
16312 <blockquote><div>
16313 <p>Line one
16314 </p><p>Line two
16315 </p>
16316 </div></blockquote>
16317
16318 !! end
16319
16320 !! test
16321 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
16322 !! options
16323 wgLinkHolderBatchSize=0
16324 !! input
16325 [[meatball:1]]
16326 [[meatball:2]]
16327 [[meatball:3]]
16328 !! result
16329 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
16330 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
16331 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
16332 </p>
16333 !! end
16334
16335 !! test
16336 Free external link invading image caption
16337 !! input
16338 [[Image:Foobar.jpg|thumb|http://x|hello]]
16339 !! result
16340 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>hello</div></div></div>
16341
16342 !! end
16343
16344 !! test
16345 Bug 15196: localised external link numbers
16346 !! options
16347 language=fa
16348 !! input
16349 [http://en.wikipedia.org/]
16350 !! result
16351 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
16352 </p>
16353 !! end
16354
16355 !! test
16356 Multibyte character in padleft
16357 !! input
16358 {{padleft:-Hello|7|Æ}}
16359 !! result
16360 <p>Æ-Hello
16361 </p>
16362 !! end
16363
16364 !! test
16365 Multibyte character in padright
16366 !! input
16367 {{padright:Hello-|7|Æ}}
16368 !! result
16369 <p>Hello-Æ
16370 </p>
16371 !! end
16372
16373 !!test
16374 formatdate parser function
16375 !!input
16376 {{#formatdate:2009-03-24}}
16377 !! result
16378 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
16379 </p>
16380 !! end
16381
16382 !!test
16383 formatdate parser function, with default format
16384 !!input
16385 {{#formatdate:2009-03-24|mdy}}
16386 !! result
16387 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
16388 </p>
16389 !! end
16390
16391 !! test
16392 Spacing of numbers in formatted dates
16393 !! input
16394 {{#formatdate:January 15}}
16395 !! result
16396 <p><span class="mw-formatted-date" title="01-15">January 15</span>
16397 </p>
16398 !! end
16399
16400 !! test
16401 formatdate parser function, with default format and on a page of which the content language is always English and different from the wiki content language
16402 !! options
16403 language=nl title=[[MediaWiki:Common.css]]
16404 !! input
16405 {{#formatdate:2009-03-24|dmy}}
16406 !! result
16407 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
16408 </p>
16409 !! end
16410
16411 #
16412 #
16413 #
16414
16415 #
16416 # Edit comments
16417 #
16418
16419 !! test
16420 Edit comment with link
16421 !! options
16422 comment
16423 !! input
16424 I like the [[Main Page]] a lot
16425 !! result
16426 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
16427 !!end
16428
16429 !! test
16430 Edit comment with link and link text
16431 !! options
16432 comment
16433 !! input
16434 I like the [[Main Page|best pages]] a lot
16435 !! result
16436 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
16437 !!end
16438
16439 !! test
16440 Edit comment with link and link text with suffix
16441 !! options
16442 comment
16443 !! input
16444 I like the [[Main Page|best page]]s a lot
16445 !! result
16446 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
16447 !!end
16448
16449 !! test
16450 Edit comment with section link (non-local, eg in history list)
16451 !! options
16452 comment title=[[Main Page]]
16453 !! input
16454 /* External links */ removed bogus entries
16455 !! result
16456 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
16457 !!end
16458
16459 !! test
16460 Edit comment with section link and text before it (non-local, eg in history list)
16461 !! options
16462 comment title=[[Main Page]]
16463 !! input
16464 pre-comment text /* External links */ removed bogus entries
16465 !! result
16466 pre-comment text <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
16467 !!end
16468
16469 !! test
16470 Edit comment with section link (local, eg in diff view)
16471 !! options
16472 comment local title=[[Main Page]]
16473 !! input
16474 /* External links */ removed bogus entries
16475 !! result
16476 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
16477 !!end
16478
16479 !! test
16480 Edit comment with subpage link (bug 14080)
16481 !! options
16482 comment
16483 subpage
16484 title=[[Subpage test]]
16485 !! input
16486 Poked at a [[/subpage]] here...
16487 !! result
16488 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
16489 !!end
16490
16491 !! test
16492 Edit comment with subpage link and link text (bug 14080)
16493 !! options
16494 comment
16495 subpage
16496 title=[[Subpage test]]
16497 !! input
16498 Poked at a [[/subpage|neat little page]] here...
16499 !! result
16500 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
16501 !!end
16502
16503 !! test
16504 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
16505 !! options
16506 comment
16507 title=[[Subpage test]]
16508 !! input
16509 Poked at a [[/subpage]] here...
16510 !! result
16511 Poked at a <a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a> here...
16512 !!end
16513
16514 !! test
16515 Edit comment with bare anchor link (local, as on diff)
16516 !! options
16517 comment
16518 local
16519 title=[[Main Page]]
16520 !!input
16521 [[#section]]
16522 !! result
16523 <a href="#section">#section</a>
16524 !! end
16525
16526 !! test
16527 Edit comment with bare anchor link (non-local, as on history)
16528 !! options
16529 comment
16530 title=[[Main Page]]
16531 !!input
16532 [[#section]]
16533 !! result
16534 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
16535 !! end
16536
16537 !! test
16538 Anchor starting with underscore
16539 !!input
16540 [[#_ref|One]]
16541 !! result
16542 <p><a href="#_ref">One</a>
16543 </p>
16544 !! end
16545
16546 !! test
16547 Id starting with underscore
16548 !!input
16549 <div id="_ref"></div>
16550 !! result
16551 <div id="_ref"></div>
16552
16553 !! end
16554
16555 !! test
16556 Space normalisation on autocomment (bug 22784)
16557 !! options
16558 comment
16559 title=[[Main Page]]
16560 !!input
16561 /* __hello__world__ */
16562 !! result
16563 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
16564 !! end
16565
16566 !! test
16567 percent-encoding and + signs in comments (Bug 26410)
16568 !! options
16569 comment
16570 !!input
16571 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
16572 !! result
16573 <a href="/index.php?title=ABC3D%25_%2B%2B&amp;action=edit&amp;redlink=1" class="new" title="ABC3D% ++ (page does not exist)">ABC3D% ++</a> <a href="/index.php?title=ABC3D%25_%2B%2B&amp;action=edit&amp;redlink=1" class="new" title="ABC3D% ++ (page does not exist)">+%20</a>
16574 !! end
16575
16576 !! test
16577 Bad images - basic functionality
16578 !! options
16579 disabled
16580 !! input
16581 [[File:Bad.jpg]]
16582 !! result
16583 !! end
16584
16585 !! test
16586 Bad images - bug 16039: text after bad image disappears
16587 !! options
16588 disabled
16589 !! input
16590 Foo bar
16591 [[File:Bad.jpg]]
16592 Bar foo
16593 !! result
16594 <p>Foo bar
16595 </p><p>Bar foo
16596 </p>
16597 !! end
16598
16599 !! test
16600 Verify that displaytitle works (bug #22501) no displaytitle
16601 !! options
16602 showtitle
16603 !! config
16604 wgAllowDisplayTitle=true
16605 wgRestrictDisplayTitle=false
16606 !! input
16607 this is not the the title
16608 !! result
16609 Parser test
16610 <p>this is not the the title
16611 </p>
16612 !! end
16613
16614 !! test
16615 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
16616 !! options
16617 showtitle
16618 title=[[Screen]]
16619 !! config
16620 wgAllowDisplayTitle=true
16621 wgRestrictDisplayTitle=false
16622 !! input
16623 this is not the the title
16624 {{DISPLAYTITLE:whatever}}
16625 !! result
16626 whatever
16627 <p>this is not the the title
16628 </p>
16629 !! end
16630
16631 !! test
16632 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
16633 !! options
16634 showtitle
16635 title=[[Screen]]
16636 !! config
16637 wgAllowDisplayTitle=true
16638 wgRestrictDisplayTitle=true
16639 !! input
16640 this is not the the title
16641 {{DISPLAYTITLE:whatever}}
16642 !! result
16643 Screen
16644 <p>this is not the the title
16645 </p>
16646 !! end
16647
16648 !! test
16649 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
16650 !! options
16651 showtitle
16652 title=[[Screen]]
16653 !! config
16654 wgAllowDisplayTitle=true
16655 wgRestrictDisplayTitle=true
16656 !! input
16657 this is not the the title
16658 {{DISPLAYTITLE:screen}}
16659 !! result
16660 screen
16661 <p>this is not the the title
16662 </p>
16663 !! end
16664
16665 !! test
16666 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
16667 !! options
16668 showtitle
16669 title=[[Screen]]
16670 !! config
16671 wgAllowDisplayTitle=false
16672 !! input
16673 this is not the the title
16674 {{DISPLAYTITLE:screen}}
16675 !! result
16676 Screen
16677 <p>this is not the the title
16678 <a href="/index.php?title=Template:DISPLAYTITLE:screen&amp;action=edit&amp;redlink=1" class="new" title="Template:DISPLAYTITLE:screen (page does not exist)">Template:DISPLAYTITLE:screen</a>
16679 </p>
16680 !! end
16681
16682 !! test
16683 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
16684 !! options
16685 showtitle
16686 title=[[Screen]]
16687 !! config
16688 wgAllowDisplayTitle=false
16689 !! input
16690 this is not the the title
16691 !! result
16692 Screen
16693 <p>this is not the the title
16694 </p>
16695 !! end
16696
16697 !! test
16698 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
16699 !! options
16700 showtitle
16701 title=[[Screen]]
16702 !! config
16703 wgAllowDisplayTitle=true
16704 wgRestrictDisplayTitle=true
16705 !! input
16706 this is not the the title
16707 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
16708 !! result
16709 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
16710 <p>this is not the the title
16711 </p>
16712 !! end
16713
16714 !! test
16715 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
16716 !! options
16717 showtitle
16718 title=[[Screen]]
16719 !! config
16720 wgAllowDisplayTitle=true
16721 wgRestrictDisplayTitle=true
16722 !! input
16723 this is not the the title
16724 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
16725 !! result
16726 <span style="color: red;">s</span>creen
16727 <p>this is not the the title
16728 </p>
16729 !! end
16730
16731 !! test
16732 preload: check <noinclude> and <includeonly>
16733 !! options
16734 preload
16735 !! input
16736 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
16737 !! result
16738 Hello kind world.
16739 !! end
16740
16741 !! test
16742 preload: check <onlyinclude>
16743 !! options
16744 preload
16745 !! input
16746 Goodbye <onlyinclude>Hello world</onlyinclude>
16747 !! result
16748 Hello world
16749 !! end
16750
16751 !! test
16752 preload: can pass tags through if we want to
16753 !! options
16754 preload
16755 !! input
16756 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
16757 !! result
16758 <includeonly>Hello world</includeonly>
16759 !! end
16760
16761 !! test
16762 preload: check that it doesn't try to do tricks
16763 !! options
16764 preload
16765 !! input
16766 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
16767 !! result
16768 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
16769 !! end
16770
16771 !! test
16772 Play a bit with r67090 and bug 3158
16773 !! options
16774 disabled
16775 !! input
16776 <div style="width:50% !important">&nbsp;</div>
16777 <div style="width:50%&nbsp;!important">&nbsp;</div>
16778 <div style="width:50%&#160;!important">&nbsp;</div>
16779 <div style="border : solid;">&nbsp;</div>
16780 !! result
16781 <div style="width:50% !important">&nbsp;</div>
16782 <div style="width:50% !important">&nbsp;</div>
16783 <div style="width:50% !important">&nbsp;</div>
16784 <div style="border&#160;: solid;">&nbsp;</div>
16785
16786 !! end
16787
16788 !! test
16789 HTML5 data attributes
16790 !! input
16791 <span data-foo="bar">Baz</span>
16792 <p data-abc-def_hij="">Quuz</p>
16793 !! result
16794 <p><span data-foo="bar">Baz</span>
16795 </p>
16796 <p data-abc-def_hij="">Quuz</p>
16797
16798 !! end
16799
16800 !! test
16801 percent-encoding and + signs in internal links (Bug 26410)
16802 !! input
16803 [[User:+%]] [[Page+title%]]
16804 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
16805 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
16806 [[%33%45]] [[%33%45+]]
16807 !! result
16808 <p><a href="/index.php?title=User:%2B%25&amp;action=edit&amp;redlink=1" class="new" title="User:+% (page does not exist)">User:+%</a> <a href="/index.php?title=Page%2Btitle%25&amp;action=edit&amp;redlink=1" class="new" title="Page+title% (page does not exist)">Page+title%</a>
16809 <a href="/index.php?title=%25%2B&amp;action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%+</a> <a href="/index.php?title=%25%2B&amp;action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%20</a> <a href="/index.php?title=%25%2B&amp;action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%+ </a> <a href="/index.php?title=%25%2Br&amp;action=edit&amp;redlink=1" class="new" title="%+r (page does not exist)">%+r</a>
16810 <a href="/index.php?title=%25&amp;action=edit&amp;redlink=1" class="new" title="% (page does not exist)">%</a> <a href="/index.php?title=%2B&amp;action=edit&amp;redlink=1" class="new" title="+ (page does not exist)">+</a> <a href="/index.php?title=Special:Upload&amp;wpDestFile=%25%2Babc9" class="new" title="File:%+abc9">bar</a>
16811 <a href="/index.php?title=3E&amp;action=edit&amp;redlink=1" class="new" title="3E (page does not exist)">3E</a> <a href="/index.php?title=3E%2B&amp;action=edit&amp;redlink=1" class="new" title="3E+ (page does not exist)">3E+</a>
16812 </p>
16813 !! end
16814
16815 !! test
16816 Special characters in embedded file links (bug 27679)
16817 !! input
16818 [[File:Contains & ampersand.jpg]]
16819 [[File:Does not exist.jpg|Title with & ampersand]]
16820 !! result
16821 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Contains_%26_ampersand.jpg" class="new" title="File:Contains &amp; ampersand.jpg">File:Contains &amp; ampersand.jpg</a>
16822 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Does_not_exist.jpg" class="new" title="File:Does not exist.jpg">Title with &amp; ampersand</a>
16823 </p>
16824 !! end
16825
16826
16827 !! test
16828 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
16829 !! input
16830 Text&apos;s been normalized?
16831 !! result
16832 <p>Text&#39;s been normalized?
16833 </p>
16834 !! end
16835
16836 !! test
16837 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
16838 !! input
16839 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
16840 !! result
16841 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
16842 </p>
16843 !! end
16844
16845 !! test
16846 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
16847 !! input
16848 [http://www.example.org/ ideograms]
16849 !! result
16850 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
16851 </p>
16852 !! end
16853
16854 !! test
16855 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
16856 !! input
16857 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
16858 !! result
16859 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
16860 </p>
16861 !! end
16862
16863 !! article
16864 Mediawiki:loop1
16865 !! text
16866 {{Identical|A}}
16867 !! endarticle
16868
16869 !! article
16870 Mediawiki:loop2
16871 !! text
16872 {{Identical|B}}
16873 !! endarticle
16874
16875 !! article
16876 Template:Identical
16877 !! text
16878 {{int:loop1}}
16879 {{int:loop2}}
16880 !! endarticle
16881
16882 !! test
16883 Bug 31098 Template which includes system messages which includes the template
16884 !! input
16885 {{Identical}}
16886 !! result
16887 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
16888 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
16889 </p>
16890 !! end
16891
16892 !! test
16893 Bug31490 Turkish: ucfirst 'blah'
16894 !! options
16895 language=tr
16896 !! input
16897 {{ucfirst:blah}}
16898 !! result
16899 <p>Blah
16900 </p>
16901 !! end
16902
16903 !! test
16904 Bug31490 Turkish: ucfirst 'ix'
16905 !! options
16906 language=tr
16907 !! input
16908 {{ucfirst:ix}}
16909 !! result
16910 <p>İx
16911 </p>
16912 !! end
16913
16914 !! test
16915 Bug31490 Turkish: lcfirst 'BLAH'
16916 !! options
16917 language=tr
16918 !! input
16919 {{lcfirst:BLAH}}
16920 !! result
16921 <p>bLAH
16922 </p>
16923 !! end
16924
16925 !! test
16926 Bug31490 Turkish: ucfırst (with a dotless i)
16927 !! options
16928 language=tr
16929 !! input
16930 {{ucfırst:blah}}
16931 !! result
16932 <p><a href="/index.php?title=%C5%9Eablon:Ucf%C4%B1rst:blah&amp;action=edit&amp;redlink=1" class="new" title="Şablon:Ucfırst:blah (sayfa mevcut değil)">Şablon:Ucfırst:blah</a>
16933 </p>
16934 !! end
16935
16936 !! test
16937 Bug31490 ucfırst (with a dotless i) with English language
16938 !! options
16939 language=en
16940 !! input
16941 {{ucfırst:blah}}
16942 !! result
16943 <p><a href="/index.php?title=Template:Ucf%C4%B1rst:blah&amp;action=edit&amp;redlink=1" class="new" title="Template:Ucfırst:blah (page does not exist)">Template:Ucfırst:blah</a>
16944 </p>
16945 !! end
16946
16947 !! test
16948 Bug 26375: TOC with italics
16949 !! options
16950 title=[[Main Page]]
16951 !! input
16952 __TOC__
16953 == ''Lost'' episodes ==
16954 !! result
16955 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16956 <ul>
16957 <li class="toclevel-1 tocsection-1"><a href="#Lost_episodes"><span class="tocnumber">1</span> <span class="toctext"><i>Lost</i> episodes</span></a></li>
16958 </ul>
16959 </div>
16960
16961 <h2><span class="mw-headline" id="Lost_episodes"><i>Lost</i> episodes</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Lost episodes">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16962
16963 !! end
16964
16965 !! test
16966 Bug 26375: TOC with bold
16967 !! options
16968 title=[[Main Page]]
16969 !! input
16970 __TOC__
16971 == '''should be bold''' then normal text ==
16972 !! result
16973 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16974 <ul>
16975 <li class="toclevel-1 tocsection-1"><a href="#should_be_bold_then_normal_text"><span class="tocnumber">1</span> <span class="toctext"><b>should be bold</b> then normal text</span></a></li>
16976 </ul>
16977 </div>
16978
16979 <h2><span class="mw-headline" id="should_be_bold_then_normal_text"><b>should be bold</b> then normal text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: should be bold then normal text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16980
16981 !! end
16982
16983 !! test
16984 Bug 33845: Headings become cursive in TOC when they contain an image
16985 !! options
16986 title=[[Main Page]]
16987 !! input
16988 __TOC__
16989 == Image [[Image:foobar.jpg]] ==
16990 !! result
16991 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16992 <ul>
16993 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
16994 </ul>
16995 </div>
16996
16997 <h2><span class="mw-headline" id="Image">Image <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Image">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16998
16999 !! end
17000
17001 !! test
17002 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
17003 !! options
17004 title=[[Main Page]]
17005 !! input
17006 __TOC__
17007 == <blockquote>Quote</blockquote> ==
17008 !! result
17009 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17010 <ul>
17011 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
17012 </ul>
17013 </div>
17014
17015 <h2><span class="mw-headline" id="Quote"><blockquote>Quote</blockquote></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Quote">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17016
17017 !! end
17018
17019 !! test
17020 Unclosed tags in TOC
17021 !! options
17022 title=[[Main Page]]
17023 !! input
17024 __TOC__
17025 == Proof: 2 < 3 ==
17026 <small>Hanc marginis exiguitas non caperet.</small>
17027 QED
17028 !! result
17029 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17030 <ul>
17031 <li class="toclevel-1 tocsection-1"><a href="#Proof:_2_.3C_3"><span class="tocnumber">1</span> <span class="toctext">Proof: 2 &lt; 3</span></a></li>
17032 </ul>
17033 </div>
17034
17035 <h2><span class="mw-headline" id="Proof:_2_.3C_3">Proof: 2 &lt; 3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Proof: 2 &lt; 3">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17036 <p><small>Hanc marginis exiguitas non caperet.</small>
17037 QED
17038 </p>
17039 !! end
17040
17041 !! test
17042 Multiple tags in TOC
17043 !! input
17044 __TOC__
17045 == <i>Foo</i> <b>Bar</b> ==
17046
17047 == <i>Foo</i> <blockquote>Bar</blockquote> ==
17048 !! result
17049 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17050 <ul>
17051 <li class="toclevel-1 tocsection-1"><a href="#Foo_Bar"><span class="tocnumber">1</span> <span class="toctext"><i>Foo</i> <b>Bar</b></span></a></li>
17052 <li class="toclevel-1 tocsection-2"><a href="#Foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext"><i>Foo</i> Bar</span></a></li>
17053 </ul>
17054 </div>
17055
17056 <h2><span class="mw-headline" id="Foo_Bar"><i>Foo</i> <b>Bar</b></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17057 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i> <blockquote>Bar</blockquote></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17058
17059 !! end
17060
17061 !! test
17062 Tags with parameters in TOC
17063 !! input
17064 __TOC__
17065 == <sup class="in-h2">Hello</sup> ==
17066
17067 == <sup class="a > b">Evilbye</sup> ==
17068 !! result
17069 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17070 <ul>
17071 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
17072 <li class="toclevel-1 tocsection-2"><a href="#b.22.3EEvilbye"><span class="tocnumber">2</span> <span class="toctext"><sup> b"&gt;Evilbye</sup></span></a></li>
17073 </ul>
17074 </div>
17075
17076 <h2><span class="mw-headline" id="Hello"><sup class="in-h2">Hello</sup></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Hello">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17077 <h2><span class="mw-headline" id="b.22.3EEvilbye"><sup> b"&gt;Evilbye</sup></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b&quot;>Evilbye">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17078
17079 !! end
17080
17081 !! test
17082 span tags with directionality in TOC
17083 !! input
17084 __TOC__
17085 == <span dir="ltr">C++</span> ==
17086
17087 == <span dir="rtl">זבנג!</span> ==
17088
17089 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
17090
17091 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
17092
17093 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
17094 !! result
17095 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17096 <ul>
17097 <li class="toclevel-1 tocsection-1"><a href="#C.2B.2B"><span class="tocnumber">1</span> <span class="toctext"><span dir="ltr">C++</span></span></a></li>
17098 <li class="toclevel-1 tocsection-2"><a href="#.D7.96.D7.91.D7.A0.D7.92.21"><span class="tocnumber">2</span> <span class="toctext"><span dir="rtl">זבנג!</span></span></a></li>
17099 <li class="toclevel-1 tocsection-3"><a href="#The_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">3</span> <span class="toctext"><span>The attributes on these span tags must be deleted from the TOC</span></span></a></li>
17100 <li class="toclevel-1 tocsection-4"><a href="#All_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">4</span> <span class="toctext"><span>All attributes on these span tags must be deleted from the TOC</span></span></a></li>
17101 <li class="toclevel-1 tocsection-5"><a href="#Attributes_after_dir_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">5</span> <span class="toctext"><span dir="ltr">Attributes after dir on these span tags must be deleted from the TOC</span></span></a></li>
17102 </ul>
17103 </div>
17104
17105 <h2><span class="mw-headline" id="C.2B.2B"><span dir="ltr">C++</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: C++">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17106 <h2><span class="mw-headline" id=".D7.96.D7.91.D7.A0.D7.92.21"><span dir="rtl">זבנג!</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: זבנג!">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17107 <h2><span class="mw-headline" id="The_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: The attributes on these span tags must be deleted from the TOC">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17108 <h2><span class="mw-headline" id="All_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: All attributes on these span tags must be deleted from the TOC">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17109 <h2><span class="mw-headline" id="Attributes_after_dir_on_these_span_tags_must_be_deleted_from_the_TOC"><span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Attributes after dir on these span tags must be deleted from the TOC">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17110
17111 !! end
17112
17113 !! article
17114 MediaWiki:Bug32057
17115 !! text
17116 == {{int:headline_sample}} ==
17117 !! endarticle
17118
17119 !! test
17120 Bug 32057: Title needed when expanding <h> nodes.
17121 !! options
17122 title=[[Main Page]]
17123 !! input
17124 {{int:Bug32057}}
17125 !! result
17126 <h2><span class="mw-headline" id="Headline_text">Headline text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Headline text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17127
17128 !! end
17129
17130 !! test
17131 Strip marker in urlencode
17132 !! input
17133 {{urlencode:x<nowiki/>y}}
17134 {{urlencode:x<nowiki/>y|wiki}}
17135 {{urlencode:x<nowiki/>y|path}}
17136 !! result
17137 <p>xy
17138 xy
17139 xy
17140 </p>
17141 !! end
17142
17143 !! test
17144 Strip marker in lc
17145 !! input
17146 {{lc:x<nowiki/>y}}
17147 !! result
17148 <p>xy
17149 </p>
17150 !! end
17151
17152 !! test
17153 Strip marker in uc
17154 !! input
17155 {{uc:x<nowiki/>y}}
17156 !! result
17157 <p>XY
17158 </p>
17159 !! end
17160
17161 !! test
17162 Strip marker in formatNum
17163 !! input
17164 {{formatnum:1<nowiki/>2}}
17165 {{formatnum:1<nowiki/>2|R}}
17166 !! result
17167 <p>12
17168 12
17169 </p>
17170 !! end
17171
17172 !! test
17173 Check noCommafy in formatNum
17174 !! options
17175 language=be-tarask
17176 !! input
17177 {{formatnum:123456.78}}
17178 {{formatnum:123456.78|NOSEP}}
17179 !! result
17180 <p>123 456,78
17181 123456.78
17182 </p>
17183 !! end
17184
17185 !! test
17186 Wrong option for formatNum (bug 56199)
17187 !! input
17188 {{formatnum:1,234.56|Random}}
17189 {{formatnum:1,234.56|EVERYTHING}}
17190 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
17191 !! result
17192 <p>1,234.56
17193 1,234.56
17194 1,234.56
17195 </p>
17196 !! end
17197
17198 !! test
17199 Strip marker in grammar
17200 !! options
17201 language=fi
17202 !! input
17203 {{grammar:elative|foo<nowiki/>bar}}
17204 !! result
17205 <p>foobarista
17206 </p>
17207 !! end
17208
17209 !! test
17210 Strip marker in padleft
17211 !! input
17212 {{padleft:|2|x<nowiki/>y}}
17213 !! result
17214 <p>xy
17215 </p>
17216 !! end
17217
17218 !! test
17219 Strip marker in padright
17220 !! input
17221 {{padright:|2|x<nowiki/>y}}
17222 !! result
17223 <p>xy
17224 </p>
17225 !! end
17226
17227 !! test
17228 Strip marker in anchorencode
17229 !! input
17230 {{anchorencode:x<nowiki/>y}}
17231 !! result
17232 <p>xy
17233 </p>
17234 !! end
17235
17236 !! test
17237 nowiki inside link inside heading (bug 18295)
17238 !! input
17239 ==[[foo|x<nowiki>y</nowiki>z]]==
17240 !! result
17241 <h2><span class="mw-headline" id="xyz"><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">xyz</a></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: xyz">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17242
17243 !! end
17244
17245 !! test
17246 new support for bdi element (bug 31817)
17247 !! input
17248 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17249 !! result
17250 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17251
17252 !!end
17253
17254 !! test
17255 Ignore pipe between table row attributes
17256 !! input
17257 {|
17258 | quux
17259 |- id=foo | style='color: red'
17260 | bar
17261 |}
17262 !! result
17263 <table>
17264 <tr>
17265 <td> quux
17266 </td></tr>
17267 <tr id="foo" style="color: red">
17268 <td> bar
17269 </td></tr></table>
17270
17271 !! end
17272
17273 !!test
17274 Gallery override link with WikiLink (bug 34852)
17275 !! input
17276 <gallery>
17277 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
17278 </gallery>
17279 !! result
17280 <ul class="gallery mw-gallery-traditional">
17281 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17282 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/InterWikiLink"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
17283 <div class="gallerytext">
17284 <p>caption
17285 </p>
17286 </div>
17287 </div></li>
17288 </ul>
17289
17290 !! end
17291
17292 !!test
17293 Gallery override link with absolute external link (bug 34852)
17294 !! input
17295 <gallery>
17296 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
17297 </gallery>
17298 !! result
17299 <ul class="gallery mw-gallery-traditional">
17300 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17301 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="http://www.example.org"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
17302 <div class="gallerytext">
17303 <p>caption
17304 </p>
17305 </div>
17306 </div></li>
17307 </ul>
17308
17309 !! end
17310
17311 !!test
17312 Gallery override link with malicious javascript (bug 34852)
17313 !! input
17314 <gallery>
17315 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
17316 </gallery>
17317 !! result
17318 <ul class="gallery mw-gallery-traditional">
17319 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17320 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/%22_onclick%3D%22alert(%27malicious_javascript_code!%27);"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
17321 <div class="gallerytext">
17322 <p>caption
17323 </p>
17324 </div>
17325 </div></li>
17326 </ul>
17327
17328 !! end
17329
17330 !!test
17331 Gallery with invalid title as link (bug 43964)
17332 !! input
17333 <gallery>
17334 File:foobar.jpg|link=<
17335 </gallery>
17336 !! result
17337 <ul class="gallery mw-gallery-traditional">
17338 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17339 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
17340 <div class="gallerytext">
17341 </div>
17342 </div></li>
17343 </ul>
17344
17345 !! end
17346
17347 !!test
17348 Language parser function
17349 !! input
17350 {{#language:ar}}
17351 !! result
17352 <p>العربية
17353 </p>
17354 !! end
17355
17356 !!test
17357 Padleft and padright as substr
17358 !! input
17359 {{padleft:|3|abcde}}
17360 {{padright:|3|abcde}}
17361 !! result
17362 <p>abc
17363 abc
17364 </p>
17365 !! end
17366
17367 !!test
17368 Special parser function
17369 !! input
17370 {{#special:RandomPage}}
17371 {{#special:BaDtItLe}}
17372 {{#special:Foobar}}
17373 !! result
17374 <p>Special:Random
17375 Special:Badtitle
17376 Special:Foobar
17377 </p>
17378 !! end
17379
17380 !!test
17381 Bug 34939 - Case insensitive link parsing ([HttP://])
17382 !! input
17383 [HttP://MediaWiki.Org/]
17384 !! result
17385 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
17386 </p>
17387 !! end
17388
17389 !!test
17390 Bug 34939 - Case insensitive link parsing ([HttP:// title])
17391 !! input
17392 [HttP://MediaWiki.Org/ MediaWiki]
17393 !! result
17394 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
17395 </p>
17396 !! end
17397
17398 !!test
17399 Bug 34939 - Case insensitive link parsing (HttP://)
17400 !! input
17401 HttP://MediaWiki.Org/
17402 !! result
17403 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
17404 </p>
17405 !! end
17406
17407 !!test
17408 Disable TOC
17409 !! options
17410 notoc
17411 !! input
17412 Lead
17413 == Section 1 ==
17414 == Section 2 ==
17415 == Section 3 ==
17416 == Section 4 ==
17417 == Section 5 ==
17418 !! result
17419 <p>Lead
17420 </p>
17421
17422 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17423 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17424 <h2><span class="mw-headline" id="Section_3">Section 3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Section 3">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17425 <h2><span class="mw-headline" id="Section_4">Section 4</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Section 4">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17426 <h2><span class="mw-headline" id="Section_5">Section 5</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Section 5">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17427
17428 !! end
17429
17430
17431 ###
17432 ### Parsoids-specific tests
17433 ### Parsoid-PHP parser incompatibilities
17434 ###
17435 !!test
17436 1. SOL-sensitive wikitext tokens as template-args
17437 !!options
17438 parsoid=wt2html,wt2wt
17439 !!input
17440 {{echo|*a}}
17441 {{echo|#a}}
17442 {{echo|:a}}
17443 !!result
17444 <span about="#mwt1" typeof="mw:Transclusion">
17445 </span><ul about="#mwt1"><li>a</li>
17446 </ul>
17447 <span about="#mwt2" typeof="mw:Transclusion">
17448 </span><ol about="#mwt2"><li>a</li>
17449 </ol>
17450 <span about="#mwt3" typeof="mw:Transclusion">
17451 </span><dl about="#mwt3"><dd>a</dd>
17452 </dl>
17453 !!end
17454
17455 #### ----------------------------------------------------------------
17456 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
17457 #### tags. Parsoid's output for these tags differs from that of the
17458 #### PHP parser.
17459 #### ----------------------------------------------------------------
17460
17461 !!test
17462 Ref: 1. ref-location should be replaced with an index span
17463 !!options
17464 parsoid
17465 !!input
17466 A <ref>foo</ref>
17467 B <ref name="x">foo</ref>
17468 C <ref name="y" />
17469 !!result
17470 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span>
17471 B <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}' id="cite_ref-x-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-2">[2]</a></span>
17472 C <span about="#mwt3" class="reference" data-mw='{"name":"ref","attrs":{"name":"y"}}' id="cite_ref-y-3-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-y-3">[3]</a></span></p>
17473 !!end
17474
17475 !!test
17476 Ref: 2. ref-tags with identical names should all get the same index
17477 !!options
17478 parsoid
17479 !!input
17480 A <ref name="x">foo</ref>
17481 B <ref name="x" />
17482 !!result
17483 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}' id="cite_ref-x-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span>
17484 B <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{"name":"x"}}' id="cite_ref-x-1-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span></p>
17485 !!end
17486
17487 !!test
17488 Ref: 3. spaces in ref-names should be ignored
17489 !!options
17490 parsoid
17491 !!input
17492 A <ref name="x">foo</ref>
17493 B <ref name=" x " />
17494 C <ref name= x />
17495 !!result
17496 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}' id="cite_ref-x-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span>
17497 B <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{"name":"x"}}' id="cite_ref-x-1-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span>
17498 C <span about="#mwt3" class="reference" data-mw='{"name":"ref","attrs":{"name":"x"}}' id="cite_ref-x-1-2" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span></p>
17499 !!end
17500
17501 !!test
17502 Ref: 4. 'constructor' should be accepted as a valid ref-name
17503 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
17504 !!options
17505 parsoid
17506 !!input
17507 A <ref name="constructor">foo</ref>
17508 !!result
17509 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"constructor"}}' id="cite_ref-constructor-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-constructor-1">[1]</a></span></p>
17510 !!end
17511
17512 !!test
17513 Ref: 5. body should accept generic wikitext
17514 !!options
17515 parsoid
17516 !!input
17517 A <ref>
17518 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
17519 </ref>
17520
17521 <references />
17522 !!result
17523 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"This is a &lt;b data-parsoid=&#39;{\"dsr\":[19,40,3,3]}&#39;>&lt;a rel=\"mw:WikiLink\" href=\"./Bolded_link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Bolded_link\"},\"sa\":{\"href\":\"bolded link\"},\"dsr\":[22,37,2,2]}&#39;>bolded link&lt;/a>&lt;/b> and this is a &lt;span about=\"#mwt3\" typeof=\"mw:Transclusion\" data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"transclusion\"}},\"i\":0}}]}&#39; data-parsoid=&#39;{\"dsr\":[55,76,null,null],\"pi\":[[{\"k\":\"1\",\"spc\":[\"\",\"\",\"\",\"\"]}]]}&#39;>transclusion&lt;/span>\n"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
17524
17525 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
17526 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> This is a <b><a rel="mw:WikiLink" href="./Bolded_link">bolded link</a></b> and this is a <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"transclusion"}},"i":0}}]}'>transclusion</span>
17527 </li>
17528 </ol>
17529 !!end
17530
17531 !!test
17532 Ref: 6. indent-pres should not be output in ref-body
17533 !!options
17534 parsoid
17535 !!input
17536 A <ref>
17537 foo
17538 bar
17539 baz
17540 </ref>
17541
17542 <references />
17543 !!result
17544 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo\n bar\n baz\n"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
17545
17546 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
17547 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
17548 bar
17549 baz
17550 </li>
17551 </ol>
17552 !!end
17553
17554 !!test
17555 Ref: 7. No p-wrapping in ref-body
17556 !!options
17557 parsoid
17558 !!input
17559 A <ref>
17560 foo
17561
17562 bar
17563
17564
17565 baz
17566
17567
17568
17569 booz
17570 </ref>
17571
17572 <references />
17573 !!result
17574 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo\n\nbar\n\n\nbaz\n\n\n\nbooz\n"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
17575
17576 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17577 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
17578
17579 bar
17580
17581
17582 baz
17583
17584
17585
17586 booz
17587 </li>
17588 </ol>
17589 !!end
17590
17591 !!test
17592 Ref: 8. transclusion wikitext has lower precedence
17593 !!options
17594 parsoid
17595 !!input
17596 A <ref> foo {{echo|</ref> B C}}
17597
17598 <references />
17599 !!result
17600 <p>A <span class="reference" data-mw="{&quot;name&quot;:&quot;ref&quot;,&quot;body&quot;:{&quot;html&quot;:&quot;foo <span typeof=\&quot;mw:Nowiki\&quot; data-parsoid='{\&quot;src\&quot;:\&quot;{{\&quot;,\&quot;dsr\&quot;:[12,14,0,0]}'>{{</span>echo|&quot;},&quot;attrs&quot;:{}}" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> B C<span typeof="mw:Nowiki">}}</span></p>
17601 <ol class="references" typeof="mw:Extension/references" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
17602 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <span typeof="mw:Nowiki">{{</span>echo|</li>
17603 </ol>
17604 !!end
17605
17606 !!test
17607 Ref: 9. unclosed comments should not leak out of ref-body
17608 !!options
17609 parsoid
17610 !!input
17611 A <ref> foo <!--</ref> B C
17612 <references />
17613 !!result
17614 <p>A <span class="reference" data-mw='{"name":"ref","body":{"html":"foo &lt;!---->"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> B C</p>
17615 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17616 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo </li>
17617 </ol>
17618 !!end
17619
17620 !!test
17621 Ref: 10. Unclosed HTML tags should not leak out of ref-body
17622 !!options
17623 parsoid
17624 !!input
17625 A <ref> <b> foo </ref> B C
17626
17627 <references />
17628 !!result
17629 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"&lt;b data-parsoid=&#39;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[8,16,3,0]}&#39;> foo &lt;/b>"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref> &lt;b> foo &lt;/ref>"}'><a href="#cite_note-1">[1]</a></span> B C</p>
17630
17631
17632 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
17633 <li about="#cite_note-1" id="cite_note-1" data-parsoid="{}"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> <b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></li>
17634 </ol>
17635 !!end
17636
17637 !!test
17638 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
17639 !!options
17640 parsoid
17641 !!input
17642 A <ref>foo</ref> B
17643 C <ref>bar</ref> D
17644 !!result
17645 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>foo&lt;/ref>"}'><a href="#cite_note-1">[1]</a></span> B
17646 C <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>bar&lt;/ref>"}'><a href="#cite_note-2">[2]</a></span> D</p>
17647 !!end
17648
17649 !!test
17650 Ref: 12. ref-tags act as trailing newline migration barrier
17651 !!options
17652 parsoid
17653 !!input
17654 <!--the newline at the end of this line moves out of the p-tag-->a
17655
17656 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
17657 <ref />
17658
17659 c
17660 !!result
17661 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
17662
17663
17664 <p>b<!--the newline at the end of this line stays inside the p-tag--> <span about="#mwt1" class="reference" data-mw='{"name":"ref","attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span>
17665 <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[2]</a></span></p>
17666
17667
17668 <p>c</p>
17669 !!end
17670
17671 !!test
17672 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
17673 !!options
17674 parsoid
17675 !!input
17676 <ref>foo</ref> A
17677 <ref>bar
17678 </ref> B
17679 !!result
17680 <p><span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> A
17681 <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"bar\n"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[2]</a></span> B</p>
17682 !!end
17683
17684 !!test
17685 Ref: 14. A nested ref-tag should be emitted as plain text
17686 !!options
17687 parsoid
17688 !!input
17689 <ref>foo <ref>bar</ref> baz</ref>
17690
17691 <references />
17692 !!result
17693 <p><span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo &amp;lt;ref>bar&amp;lt;/ref> baz"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>foo &lt;ref>bar&lt;/ref> baz&lt;/ref>"}'><a href="#cite_note-1">[1]</a></span></p>
17694
17695 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
17696 <li about="#cite_note-1" id="cite_note-1" data-parsoid="{}"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo &lt;ref>bar&lt;/ref> baz</li>
17697 </ol>
17698 !!end
17699
17700 !!test
17701 Ref: 15. ref-tags with identical names should get identical indexes
17702 !!options
17703 parsoid
17704 !!input
17705 A1 <ref name="a">foo</ref> A2 <ref name="a" />
17706 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
17707
17708 <references />
17709 !!result
17710 <p>A1 <span about="#mwt3" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"a"}}' id="cite_ref-a-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-a-1">[1]</a></span> A2 <span about="#mwt4" class="reference" data-mw='{"name":"ref","attrs":{"name":"a"}}' id="cite_ref-a-1-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-a-1">[1]</a></span>
17711 B1 <span about="#mwt7" class="reference" data-mw='{"name":"ref","attrs":{"name":"b"}}' id="cite_ref-b-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-b-2">[2]</a></span> B2 <span about="#mwt8" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"name":"b"}}' id="cite_ref-b-2-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-b-2">[2]</a></span></p>
17712
17713 <ol about="#mwt10" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy">↑ <a href="#cite_ref-a-1-0">1.0</a> <a href="#cite_ref-a-1-1">1.1</a></span> foo</li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy">↑ <a href="#cite_ref-b-2-0">2.0</a> <a href="#cite_ref-b-2-1">2.1</a></span> bar</li>
17714 </ol>
17715 !!end
17716
17717 ## We don't bother wt2wt-ing non-standard whitespace
17718 !!test
17719 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
17720 !!options
17721 parsoid=wt2html
17722 !!input
17723 A <ref >foo</ref >
17724
17725 <references />
17726 !!result
17727 <p>A <span class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
17728
17729 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17730 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
17731 !!end
17732
17733 !!test
17734 References: 1. references tag without any refs should be handled properly
17735 !!options
17736 parsoid
17737 !!input
17738 <references />
17739 !!result
17740 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
17741 !!end
17742
17743 !!test
17744 References: 2. references tag with group only outputs references from that group
17745 !!options
17746 parsoid
17747 !!input
17748 A <ref group="a">foo</ref>
17749 B <ref group="b">bar</ref>
17750
17751 <references group="a" />
17752 !!result
17753 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"group":"a"}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[a 1]</a></span>
17754 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"group":"b"}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[b 1]</a></span></p>
17755
17756 <ol about="#mwt6" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{"group":"a"}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li>
17757 </ol>
17758 !!end
17759
17760 !!test
17761 References: 3. ref list should be cleared after processing references
17762 !!options
17763 parsoid
17764 !!input
17765 A <ref>foo</ref>
17766
17767 <references />
17768
17769 B <ref>bar</ref>
17770
17771 <references />
17772 !!result
17773 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
17774
17775 <ol about="#mwt4" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li>
17776 </ol>
17777
17778 <p>B <span about="#mwt6" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[1]</a></span></p>
17779
17780 <ol about="#mwt8" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2-0">↑</a></span> bar</li>
17781 </ol>
17782 !!end
17783
17784 !!test
17785 References: 4. only referenced group should be cleared after processing references
17786 !!options
17787 parsoid
17788 !!input
17789 A <ref group="a">afoo</ref>
17790 B <ref>bfoo</ref>
17791
17792 <references group="a" />
17793
17794 C <ref>cfoo</ref>
17795
17796 <references />
17797 !!result
17798 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"afoo"},"attrs":{"group":"a"}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[a 1]</a></span>
17799 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bfoo"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"<ref>bfoo</ref>"}'><a href="#cite_note-2">[1]</a></span></p>
17800
17801 <ol about="#mwt6" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{"group":"a"}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> afoo</li>
17802 </ol>
17803
17804 <p>C <span about="#mwt8" class="reference" data-mw='{"name":"ref","body":{"html":"cfoo"},"attrs":{}}' id="cite_ref-3-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-3">[2]</a></span></p>
17805
17806 <ol about="#mwt10" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2-0">↑</a></span> bfoo</li><li about="#cite_note-3" id="cite_note-3"><span rel="mw:referencedBy"><a href="#cite_ref-3-0">↑</a></span> cfoo</li>
17807 </ol>
17808 !!end
17809
17810 !!test
17811 References: 5. ref tags in references should be processed while ignoring all other content
17812 !!options
17813 parsoid
17814 !!input
17815 A <ref name="a" />
17816 B <ref name="b">bar</ref>
17817
17818 <references>
17819 <ref name="a">foo</ref>
17820 This should just get lost.
17821 </references>
17822 !!result
17823 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{"name":"a"}}' id="cite_ref-a-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref name=\"a\" />"}'><a href="#cite_note-a-1">[1]</a></span>
17824 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"name":"b"}}' id="cite_ref-b-2-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref name=\"b\">bar&lt;/ref>"}'><a href="#cite_note-b-2">[2]</a></span></p>
17825
17826
17827 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-parsoid='{"src":"&lt;references>\n&lt;ref name=\"a\">foo&lt;/ref>\nThis should just get lost.\n&lt;/references>"}' data-mw='{"name":"references","body":{"extsrc":"&lt;ref name=\"a\">foo&lt;/ref>\nThis should just get lost.","html":"\n&lt;span about=\"#mwt8\" class=\"reference\" data-mw=&#39;{\"name\":\"ref\",\"body\":{\"html\":\"foo\"},\"attrs\":{\"name\":\"a\"}}&#39; rel=\"dc:references\" typeof=\"mw:Extension/ref\">&lt;a href=\"#cite_note-a-1\">[1]&lt;/a>&lt;/span>\n"},"attrs":{}}'>
17828 <li about="#cite_note-a-1" id="cite_note-a-1" data-parsoid="{}"><span rel="mw:referencedBy"><a href="#cite_ref-a-1-0">↑</a></span> foo</li>
17829 <li about="#cite_note-b-2" id="cite_note-b-2" data-parsoid="{}"><span rel="mw:referencedBy"><a href="#cite_ref-b-2-0">↑</a></span> bar</li>
17830 </ol>
17831 !!end
17832
17833 !!test
17834 References: 6. <references /> from a transclusion
17835 !!options
17836 parsoid
17837 !!input
17838 <ref>Foo</ref> {{echo|<references />}}
17839 !!result
17840 <span about="#mwt3" class="reference" data-mw='{"name":"ref","body":{"html":"Foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> <ol class="references" typeof="mw:Extension/references mw:Transclusion" about="#mwt4" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;references />"}},"i":0}}]}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> Foo</li></ol>
17841 !!end
17842
17843 !! test
17844 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
17845 !! options
17846 parsoid
17847 !! input
17848 A <ref>foo bar for a</ref>
17849 B <ref name="b" />
17850
17851 <references />
17852
17853 <references>
17854 <ref name="b">foo</ref>
17855 </references>
17856 !! result
17857 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo bar for a"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>foo bar for a&lt;/ref>"}'><a href="#cite_note-1">[1]</a></span>
17858 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","attrs":{"name":"b"}}' id="cite_ref-b-2-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref name=\"b\" />"}'><a href="#cite_note-b-2">[2]</a></span></p>
17859
17860
17861 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
17862 <li about="#cite_note-1" id="cite_note-1" data-parsoid="{}"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo bar for a</li>
17863 <li about="#cite_note-b-2" id="cite_note-b-2" data-parsoid="{}"><span rel="mw:referencedBy"><a href="#cite_ref-b-2-0">↑</a></span> </li></ol>
17864
17865
17866 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-parsoid='{"src":"&lt;references>\n&lt;ref name=\"b\">foo&lt;/ref>\n&lt;/references>"}' data-mw='{"name":"references","body":{"extsrc":"&lt;ref name=\"b\">foo&lt;/ref>","html":"\n&lt;span about=\"#mwt10\" class=\"reference\" data-mw=&#39;{\"name\":\"ref\",\"body\":{\"html\":\"foo\"},\"attrs\":{\"name\":\"b\"}}&#39; rel=\"dc:references\" typeof=\"mw:Extension/ref\">&lt;a href=\"#cite_note-b-3\">[1]&lt;/a>&lt;/span>\n"},"attrs":{}}'>
17867 <li about="#cite_note-b-3" id="cite_note-b-3" data-parsoid="{}"><span rel="mw:referencedBy">↑</span> foo</li>
17868 </ol>
17869 !! end
17870
17871 # This test is wt2html only because we're permitting the serializer to produce
17872 # dirty diffs, normalizing the unclosed references to the self-closed version.
17873 !! test
17874 Generate references for unclosed references tag
17875 !! options
17876 parsoid=wt2html
17877 !! input
17878 a<ref>foo</ref>
17879
17880 <references>
17881 !! result
17882 <p data-parsoid='{}'>a<span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>foo&lt;/ref>"}'><a href="#cite_note-1" data-parsoid="{}">[1]</a></span></p>
17883
17884
17885 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references>"}' data-mw='{"name":"references","attrs":{}}'>
17886 <li about="#cite_note-1" id="cite_note-1" data-parsoid="{}"><span rel="mw:referencedBy" data-parsoid="{}"><a href="#cite_ref-1-0" data-parsoid="{}">↑</a></span> foo</li></ol>
17887 !! end
17888
17889 !! test
17890 New reference serializes on its own line
17891 !! options
17892 parsoid=wt2wt,html2wt
17893 !! input
17894 foo
17895 <references />
17896 !! result
17897 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
17898 !! end
17899
17900 #### ----------------------------------------------------------------
17901 #### The following section of tests are primarily to test
17902 #### wikitext escaping capabilities of Parsoid. Given that
17903 #### escaping can be done any number of ways, the wikitext (input)
17904 #### is always adjusted to reflect how Parsoid adds nowiki
17905 #### escape tags.
17906 ####
17907 #### We are marking several tests as parsoid-only since the
17908 #### HTML in the result section is different from what the
17909 #### PHP parser generates for it.
17910 #### ----------------------------------------------------------------
17911
17912
17913 #### --------------- Headings ---------------
17914 #### 0. Unnested
17915 #### 1. Nested inside html <h1>=foo=</h1>
17916 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
17917 #### 3. Nested inside html with wikitext split by html tags
17918 #### 4. No escape needed
17919 #### 5. Empty headings <h1></h1>
17920 #### 6. Heading chars in SOL context
17921 #### ----------------------------------------
17922 !! test
17923 Headings: 0. Unnested
17924 !! options
17925 parsoid
17926 !! input
17927 <nowiki>=foo=</nowiki>
17928
17929 <nowiki> =foo= </nowiki>
17930 <!--cmt-->
17931 <nowiki>=foo=</nowiki>
17932
17933 =foo''a''<nowiki>=</nowiki>
17934 !! result
17935 <p><span typeof="mw:Nowiki">=foo=</span></p>
17936
17937 <p><span typeof="mw:Nowiki"> =foo= </span>
17938 <!--cmt-->
17939 <span typeof="mw:Nowiki">=foo=</span></p>
17940
17941 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
17942 !!end
17943
17944 !! test
17945 Headings: 1. Nested inside html
17946 (New headings and existing headings are handled differently)
17947 !! options
17948 parsoid=html2wt
17949 !! input
17950 = =foo= =
17951
17952 == =foo= ==
17953
17954 === =foo= ===
17955
17956 =<nowiki>=foo=</nowiki>=
17957 ==<nowiki>=foo=</nowiki>==
17958 ===<nowiki>=foo=</nowiki>===
17959 ====<nowiki>=foo=</nowiki>====
17960 =====<nowiki>=foo=</nowiki>=====
17961 ======<nowiki>=foo=</nowiki>======
17962
17963 !! result
17964 <h1>=foo=</h1>
17965 <h2>=foo=</h2>
17966 <h3>=foo=</h3>
17967
17968 <h1 data-parsoid='{}'>=foo=</h1>
17969 <h2 data-parsoid='{}'>=foo=</h2>
17970 <h3 data-parsoid='{}'>=foo=</h3>
17971 <h4 data-parsoid='{}'>=foo=</h4>
17972 <h5 data-parsoid='{}'>=foo=</h5>
17973 <h6 data-parsoid='{}'>=foo=</h6>
17974 !!end
17975
17976 !! test
17977 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
17978 !! options
17979 parsoid=html2wt
17980 !! input
17981 = foo =
17982 <nowiki>*</nowiki>bar
17983
17984 = foo =
17985 =bar
17986
17987 = foo =
17988 <nowiki>=bar=</nowiki>
17989 !! result
17990 <h1>foo</h1>*bar
17991 <h1>foo</h1>=bar
17992 <h1>foo</h1>=bar=
17993 !!end
17994
17995 !! test
17996 Headings: 3. Nested inside html with wikitext split by html tags
17997 !! options
17998 parsoid=html2wt
17999 !! input
18000 = ='''bold'''<nowiki>foo=</nowiki> =
18001 !! result
18002 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
18003 !!end
18004
18005 !! test
18006 Headings: 4a. No escaping needed (testing just h1 and h2)
18007 !! options
18008 parsoid=html2wt
18009 !! input
18010 = =foo =
18011
18012 = foo= =
18013
18014 = =foo= =
18015
18016 = =foo= bar =
18017
18018 == =foo ==
18019
18020 == foo= ==
18021
18022 = ''=''foo= =
18023
18024 = <nowiki>=</nowiki> =
18025 !! result
18026 <h1>=foo</h1>
18027 <h1>foo=</h1>
18028 <h1> =foo= </h1>
18029 <h1>=foo= bar</h1>
18030 <h2>=foo</h2>
18031 <h2>foo=</h2>
18032 <h1><i>=</i>foo=</h1>
18033 <h1><span typeof="mw:Nowiki">=</span></h1>
18034 !!end
18035
18036 !! test
18037 Headings: 4b. No escaping needed (inside p-tags)
18038 !! options
18039 parsoid=html2wt
18040 !! input
18041 ===
18042 =foo= x
18043 =foo= <s></s>
18044 !! result
18045 <p>===
18046 =foo= x
18047 =foo= <s></s>
18048 </p>
18049 !!end
18050
18051 !! test
18052 Headings: 5. Empty headings
18053 !! options
18054 parsoid
18055 !! input
18056 =<nowiki/>=
18057
18058 ==<nowiki/>==
18059
18060 ===<nowiki/>===
18061
18062 ====<nowiki/>====
18063
18064 =====<nowiki/>=====
18065
18066 ======<nowiki/>======
18067 !! result
18068 <h1></h1>
18069 <h2></h2>
18070 <h3></h3>
18071 <h4></h4>
18072 <h5></h5>
18073 <h6></h6>
18074 !!end
18075
18076 !! test
18077 Headings: 6a. Heading chars in SOL context (with trailing spaces)
18078 !! options
18079 parsoid
18080 !! input
18081 <nowiki>=a=</nowiki>
18082
18083 <nowiki>=a=</nowiki>
18084
18085 <nowiki>=a=</nowiki>
18086
18087 <nowiki>=a=</nowiki>
18088 !! result
18089 <p>=a=</p>
18090 <p>=a= </p>
18091 <p>=a= </p>
18092 <p>=a= </p>
18093 !!end
18094
18095 !! test
18096 Headings: 6b. Heading chars in SOL context (with trailing newlines)
18097 !! options
18098 parsoid
18099 !! input
18100 <nowiki>=a=
18101 b</nowiki>
18102
18103 <nowiki>=a=
18104 b</nowiki>
18105
18106 <nowiki>=a=
18107 b</nowiki>
18108
18109 <nowiki>=a=
18110 b</nowiki>
18111 !! result
18112 <p>=a=
18113 b</p>
18114 <p>=a=
18115 b</p>
18116 <p>=a=
18117 b</p>
18118 <p>=a=
18119 b</p>
18120 </p>
18121 !!end
18122
18123 !! test
18124 Headings: 6c. Heading chars in SOL context (leading newline break)
18125 !! options
18126 parsoid
18127 !! input
18128 a
18129 <nowiki>=b=</nowiki>
18130 !! result
18131 <p>a
18132 =b=</p>
18133 !!end
18134
18135 !! test
18136 Headings: 6d. Heading chars in SOL context (with interspersed comments)
18137 !! options
18138 parsoid
18139 !! input
18140 <!--c0--><nowiki>=a=</nowiki>
18141
18142 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
18143 !! result
18144 <p><!--c0-->=a=</p>
18145 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
18146 !!end
18147
18148 !! test
18149 Headings: 6d. Heading chars in SOL context (No escaping needed)
18150 !! options
18151 parsoid=html2wt
18152 !! input
18153 =a=<div>b</div>
18154 !! result
18155 =a=<div>b</div>
18156 !!end
18157
18158 #### --------------- Lists ---------------
18159 #### 0. Outside nests (*foo, etc.)
18160 #### 1. Nested inside html <ul><li>*foo</li></ul>
18161 #### 2. Inside definition lists
18162 #### 3. Only bullets at start should be escaped
18163 #### 4. No escapes needed
18164 #### 5. No unnecessary escapes
18165 #### 6. Escape bullets in SOL position
18166 #### 7. Escape bullets in a multi-line context
18167 #### ----------------------------------------
18168
18169 !! test
18170 Lists: 0. Outside nests
18171 !! input
18172 <nowiki>*</nowiki>foo
18173
18174 <nowiki>#</nowiki>foo
18175 !! result
18176 <p>*foo
18177 </p><p>#foo
18178 </p>
18179 !!end
18180
18181 !! test
18182 Lists: 1. Nested inside html
18183 !! input
18184 *<nowiki>*foo</nowiki>
18185
18186 *<nowiki>#foo</nowiki>
18187
18188 *<nowiki>:foo</nowiki>
18189
18190 *<nowiki>;foo</nowiki>
18191
18192 #<nowiki>*foo</nowiki>
18193
18194 #<nowiki>#foo</nowiki>
18195
18196 #<nowiki>:foo</nowiki>
18197
18198 #<nowiki>;foo</nowiki>
18199 !! result
18200 <ul>
18201 <li>*foo
18202 </li>
18203 </ul>
18204 <ul>
18205 <li>#foo
18206 </li>
18207 </ul>
18208 <ul>
18209 <li>:foo
18210 </li>
18211 </ul>
18212 <ul>
18213 <li>;foo
18214 </li>
18215 </ul>
18216 <ol>
18217 <li>*foo
18218 </li>
18219 </ol>
18220 <ol>
18221 <li>#foo
18222 </li>
18223 </ol>
18224 <ol>
18225 <li>:foo
18226 </li>
18227 </ol>
18228 <ol>
18229 <li>;foo
18230 </li>
18231 </ol>
18232
18233 !!end
18234
18235 !! test
18236 Lists: 2. Inside definition lists
18237 !! input
18238 ;<nowiki>;foo</nowiki>
18239
18240 ;<nowiki>:foo</nowiki>
18241
18242 ;<nowiki>:foo</nowiki>
18243 :bar
18244
18245 :<nowiki>:foo</nowiki>
18246 !! result
18247 <dl>
18248 <dt>;foo
18249 </dt>
18250 </dl>
18251 <dl>
18252 <dt>:foo
18253 </dt>
18254 </dl>
18255 <dl>
18256 <dt>:foo
18257 </dt>
18258 <dd>bar
18259 </dd>
18260 </dl>
18261 <dl>
18262 <dd>:foo
18263 </dd>
18264 </dl>
18265
18266 !!end
18267
18268 !! test
18269 Lists: 3. Only bullets at start of text should be escaped
18270 !! input
18271 *<nowiki>*foo*bar</nowiki>
18272
18273 *<nowiki>*foo</nowiki>''it''*bar
18274 !! result
18275 <ul>
18276 <li>*foo*bar
18277 </li>
18278 </ul>
18279 <ul>
18280 <li>*foo<i>it</i>*bar
18281 </li>
18282 </ul>
18283
18284 !!end
18285
18286 !! test
18287 Lists: 4. No escapes needed
18288 !! options
18289 parsoid
18290 !! input
18291 *foo*bar
18292
18293 *''foo''*bar
18294
18295 *[[Foo]]: bar
18296
18297 *[[Foo]]*bar
18298 !! result
18299 <ul>
18300 <li>foo*bar
18301 </li>
18302 </ul>
18303 <ul>
18304 <li><i>foo</i>*bar
18305 </li>
18306 </ul>
18307 <ul>
18308 <li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
18309 </li>
18310 </ul>
18311 <ul>
18312 <li><a rel="mw:WikiLink" href="Foo">Foo</a>*bar
18313 </li>
18314 </ul>
18315 !!end
18316
18317 !! test
18318 Lists: 5. No unnecessary escapes
18319 !! input
18320 * bar <span><nowiki>[[foo]]</nowiki></span>
18321
18322 *=bar <span><nowiki>[[foo]]</nowiki></span>
18323
18324 *[[bar <span><nowiki>[[foo]]</nowiki></span>
18325
18326 *]]bar <span><nowiki>[[foo]]</nowiki></span>
18327
18328 *=bar <span>foo]]</span>=
18329
18330 * <s></s>: a
18331 !! result
18332 <ul>
18333 <li> bar <span>[[foo]]</span>
18334 </li>
18335 </ul>
18336 <ul>
18337 <li>=bar <span>[[foo]]</span>
18338 </li>
18339 </ul>
18340 <ul>
18341 <li>[[bar <span>[[foo]]</span>
18342 </li>
18343 </ul>
18344 <ul>
18345 <li>]]bar <span>[[foo]]</span>
18346 </li>
18347 </ul>
18348 <ul>
18349 <li>=bar <span>foo]]</span>=
18350 </li>
18351 </ul>
18352 <ul>
18353 <li> <s></s>: a
18354 </li>
18355 </ul>
18356
18357 !!end
18358
18359 !! test
18360 Lists: 6. Escape bullets in SOL position
18361 !! options
18362 parsoid
18363 !! input
18364 <!--cmt--><nowiki>*foo</nowiki>
18365 !! result
18366 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
18367 !!end
18368
18369 !! test
18370 Lists: 7. Escape bullets in a multi-line context
18371 !! input
18372 a
18373 <nowiki>*</nowiki>b
18374 !! result
18375 <p>a
18376 *b
18377 </p>
18378 !!end
18379
18380 #### --------------- HRs ---------------
18381 #### 1. Single line
18382 #### -----------------------------------
18383
18384 !! test
18385 HRs: 1. Single line
18386 !! options
18387 parsoid
18388 !! input
18389 ----<nowiki>----</nowiki>
18390 ----=foo=
18391 ----*foo
18392 !! result
18393 <hr><span typeof="mw:Nowiki">----</span>
18394 <hr>=foo=
18395 <hr>*foo
18396 !! end
18397
18398 #### --------------- Tables ---------------
18399 #### 1a. Simple example
18400 #### 1b. No escaping needed (!foo)
18401 #### 1c. No escaping needed (|foo)
18402 #### 1d. No escaping needed (|}foo)
18403 ####
18404 #### 2a. Nested in td (<td>foo|bar</td>)
18405 #### 2b. Nested in td (<td>foo||bar</td>)
18406 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
18407 ####
18408 #### 3a. Nested in th (<th>foo!bar</th>)
18409 #### 3b. Nested in th (<th>foo!!bar</th>)
18410 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
18411 ####
18412 #### 4a. Escape -
18413 #### 4b. Escape +
18414 #### 4c. No escaping needed
18415 #### --------------------------------------
18416
18417 !! test
18418 Tables: 1a. Simple example
18419 !! input
18420 <nowiki>{|
18421 |}</nowiki>
18422 !! result
18423 <p>{|
18424 |}
18425 </p>
18426 !! end
18427
18428 !! test
18429 Tables: 1b. No escaping needed
18430 !! input
18431 !foo
18432 !! result
18433 <p>!foo
18434 </p>
18435 !! end
18436
18437 !! test
18438 Tables: 1c. No escaping needed
18439 !! input
18440 |foo
18441 !! result
18442 <p>|foo
18443 </p>
18444 !! end
18445
18446 !! test
18447 Tables: 1d. No escaping needed
18448 !! input
18449 |}foo
18450 !! result
18451 <p>|}foo
18452 </p>
18453 !! end
18454
18455 !! test
18456 Tables: 2a. Nested in td
18457 !! options
18458 parsoid=html2wt
18459 !! input
18460 {|
18461 |<nowiki>foo|bar</nowiki>
18462 |-
18463 |x<div><nowiki>a|b</nowiki></div>
18464 |}
18465 !! result
18466 <table><tbody><tr>
18467 <td>foo|bar</td></tr>
18468 <tr><td>x<div>a|b</div></td>
18469 </tbody></table>
18470 !! end
18471
18472 !! test
18473 Tables: 2b. Nested in td
18474 !! options
18475 parsoid
18476 !! input
18477 {|
18478 |<nowiki>foo||bar</nowiki>
18479 |''it''<nowiki>foo||bar</nowiki>
18480 |}
18481 !! result
18482 <table><tbody><tr>
18483 <td><span typeof="mw:Nowiki">foo||bar</span></td>
18484 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
18485 !! end
18486
18487 !! test
18488 Tables: 2c. Nested in td -- no escaping needed
18489 !! options
18490 parsoid
18491 !! input
18492 {|
18493 |foo!!bar
18494 |}
18495 !! result
18496 <table><tbody><tr><td>foo!!bar
18497 </td></tr></tbody></table>
18498
18499 !! end
18500
18501 !! test
18502 Tables: 3a. Nested in th
18503 !! options
18504 parsoid
18505 !! input
18506 {|
18507 !foo!bar
18508 |}
18509 !! result
18510 <table><tbody><tr><th>foo!bar
18511 </th></tr></tbody></table>
18512
18513 !! end
18514
18515 !! test
18516 Tables: 3b. Nested in th
18517 !! options
18518 parsoid
18519 !! input
18520 {|
18521 !<nowiki>foo!!bar</nowiki>
18522 |}
18523 !! result
18524 <table>
18525 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
18526 </tbody></table>
18527 !! end
18528
18529 !! test
18530 Tables: 3c. Nested in th -- no escaping needed
18531 !! options
18532 parsoid
18533 !! input
18534 {|
18535 !<nowiki>foo||bar</nowiki>
18536 |}
18537 !! result
18538 <table><tbody><tr>
18539 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
18540 !! end
18541
18542 !! test
18543 Tables: 4a. Escape -
18544 !! options
18545 parsoid
18546 !! input
18547 {|
18548 !-bar
18549 |-
18550 |<nowiki>-bar</nowiki>
18551 |}
18552 !! result
18553 <table><tbody>
18554 <tr><th>-bar</th></tr>
18555 <tr>
18556 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
18557 !! end
18558
18559 !! test
18560 Tables: 4b. Escape +
18561 !! options
18562 parsoid
18563 !! input
18564 {|
18565 !+bar
18566 |-
18567 |<nowiki>+bar</nowiki>
18568 |}
18569 !! result
18570 <table><tbody>
18571 <tr><th>+bar</th></tr>
18572 <tr>
18573 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
18574 !! end
18575
18576 !! test
18577 Tables: 4c. No escaping needed
18578 !! options
18579 parsoid
18580 !! input
18581 {|
18582 |foo-bar
18583 |foo+bar
18584 |-
18585 |''foo''-bar
18586 |''foo''+bar
18587 |-
18588 |foo
18589 bar|baz
18590 +bar
18591 -bar
18592 |-
18593 |x
18594 <div>a|b</div>
18595 |}
18596 !! result
18597 <table><tbody>
18598 <tr><td>foo-bar</td><td>foo+bar</td></tr>
18599 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
18600 <tr><td>foo
18601 <p>bar|baz
18602 +bar
18603 -bar</p></td></tr>
18604 <tr><td>x
18605 <div>a|b</div></td>
18606 </tbody></table>
18607 !! end
18608
18609 !! test
18610 Tables: 4d. No escaping needed
18611 !! options
18612 parsoid
18613 !! input
18614 {|
18615 |[[Foo]]-bar
18616 ||+1
18617 ||-2
18618 |}
18619 !! result
18620 <table>
18621 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo">Foo</a>-bar</td>
18622 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
18623 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
18624 </tbody></table>
18625 !! end
18626
18627 !! test
18628 Tables: Digest broken attributes on table and tr tag
18629 !! options
18630 parsoid=wt2html
18631 !! input
18632 {| || |} ++
18633 |- || || ++ --
18634 |}
18635 !! result
18636 <table>
18637 <tbody>
18638 <tr></tr>
18639 </tbody></table>
18640 !! end
18641
18642 #### --------------- Links ----------------
18643 #### 1. Quote marks in link text
18644 #### 2. Wikilinks: Escapes needed
18645 #### 3. Wikilinks: No escapes needed
18646 #### 4. Extlinks: Escapes needed
18647 #### 5. Extlinks: No escapes needed
18648 #### --------------------------------------
18649 !! test
18650 Links 1. Quote marks in link text
18651 !! options
18652 parsoid
18653 !! input
18654 [[Foo|Foo<nowiki>''boo''</nowiki>]]
18655 !! result
18656 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
18657 !! end
18658
18659 !! test
18660 Links 2. WikiLinks: Escapes needed
18661 !! options
18662 parsoid
18663 !! input
18664 [[Foo|[Foobar]]]
18665 [[Foo|<nowiki>Foobar]</nowiki>]]
18666 [[Foo|x [Foobar] x]]
18667 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
18668 [[Foo|<nowiki>[[Bar]]</nowiki>]]
18669 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
18670 [[Foo|<nowiki>|Bar</nowiki>]]
18671 [[Foo|<nowiki>]]bar</nowiki>]]
18672 [[Foo|<nowiki>[[bar</nowiki>]]
18673 [[Foo|<nowiki>x [[ y</nowiki>]]
18674 [[Foo|<nowiki>x ]] y</nowiki>]]
18675 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
18676 !! result
18677 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
18678 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
18679 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
18680 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
18681 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
18682 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
18683 <a href="Foo" rel="mw:WikiLink">|Bar</a>
18684 <a href="Foo" rel="mw:WikiLink">]]bar</a>
18685 <a href="Foo" rel="mw:WikiLink">[[bar</a>
18686 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
18687 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
18688 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
18689 !! end
18690
18691 !! test
18692 Links 3. WikiLinks: No escapes needed
18693 !! options
18694 parsoid
18695 !! input
18696 [[Foo|[Foobar]]
18697 [[Foo|foo|bar]]
18698 !! result
18699 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
18700 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
18701 !! end
18702
18703 !! test
18704 Links 4. ExtLinks: Escapes needed
18705 !! options
18706 parsoid
18707 !! input
18708 [http://google.com <nowiki>[google]</nowiki>]
18709 [http://google.com <nowiki>google]</nowiki>]
18710
18711 <nowiki>[http://google.com]</nowiki>
18712
18713 <nowiki>[http://google.com google]</nowiki>
18714
18715 !! result
18716 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
18717 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
18718 <p>[http://google.com]</p>
18719 <p>[http://google.com google]</p>
18720 !! end
18721
18722 !! test
18723 Links 5. ExtLinks: No escapes needed
18724 !! options
18725 parsoid
18726 !! input
18727 [http://google.com [google]
18728 !! result
18729 <a href="http://google.com" rel="mw:ExtLink">[google</a>
18730 !! end
18731
18732 #### --------------- Quotes ---------------
18733 #### 1. Quotes inside <b> and <i>
18734 #### 2. Link fragments separated by <i> and <b> tags
18735 #### 3. Link fragments inside <i> and <b>
18736 #### 4. No escaping needed
18737 #### --------------------------------------
18738 !! test
18739 1. Quotes inside <b> and <i>
18740 !! options
18741 parsoid=html2wt,wt2wt
18742 !! input
18743 ''<nowiki>'foo'</nowiki>''
18744 ''<nowiki>''foo''</nowiki>''
18745 ''<nowiki>'''foo'''</nowiki>''
18746 ''foo''<nowiki/>'s
18747 '''<nowiki>'foo'</nowiki>'''
18748 '''<nowiki>''foo''</nowiki>'''
18749 '''<nowiki>'''foo'''</nowiki>'''
18750 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
18751 '''foo'''<nowiki/>'s
18752 '''foo''
18753 ''foo''<nowiki/>'
18754 '<nowiki/>''foo''<nowiki/>'
18755 ''''foo'''
18756 '''foo'''<nowiki/>'
18757 '<nowiki/>'''foo'''<nowiki/>'
18758 ''fools'<span> errand</span>''
18759 ''<span>fool</span>'s errand''
18760 !! result
18761 <p><i>'foo'</i>
18762 <i>''foo''</i>
18763 <i>'''foo'''</i>
18764 <i>foo</i>'s
18765 <b>'foo'</b>
18766 <b>''foo''</b>
18767 <b>'''foo'''</b>
18768 <b>foo'<i>bar'</i>baz</b>
18769 <b>foo</b>'s
18770 '<i>foo</i>
18771 <i>foo</i>'
18772 '<i>foo</i>'
18773 '<b>foo</b>
18774 <b>foo</b>'
18775 '<b>foo</b>'</p>
18776 <i>fools'<span> errand</span></i>
18777 <i><span>fool</span>'s errand</i>
18778 !! end
18779
18780 !! test
18781 2. Link fragments separated by <i> and <b> tags
18782 !! input
18783 [[''foo''<nowiki>hello]]</nowiki>
18784
18785 [['''foo'''<nowiki>hello]]</nowiki>
18786 !! result
18787 <p>[[<i>foo</i>hello]]
18788 </p><p>[[<b>foo</b>hello]]
18789 </p>
18790 !! end
18791
18792 !! test
18793 3. Link fragments inside <i> and <b>
18794 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
18795 this is one of the shortcomings of this format)
18796 !! input
18797 ''[[foo''<nowiki>]]</nowiki>
18798
18799 '''[[foo'''<nowiki>]]</nowiki>
18800 !! result
18801 <p><i>[[foo</i>]]
18802 </p><p><b>[[foo</b>]]
18803 </p>
18804 !! end
18805
18806 !! test
18807 4. No escaping needed
18808 !! input
18809 '<span>''bar''</span>'
18810 '<span>'''bar'''</span>'
18811 !! result
18812 <p>'<span><i>bar</i></span>'
18813 '<span><b>bar</b></span>'
18814 </p>
18815 !! end
18816
18817 #### ----------- Paragraphs ---------------
18818 #### 1. No unnecessary escapes
18819 #### --------------------------------------
18820
18821 !! test
18822 1. No unnecessary escapes
18823 !! input
18824 bar <span><nowiki>[[foo]]</nowiki></span>
18825
18826 =bar <span><nowiki>[[foo]]</nowiki></span>
18827
18828 [[bar <span><nowiki>[[foo]]</nowiki></span>
18829
18830 ]]bar <span><nowiki>[[foo]]</nowiki></span>
18831
18832 =bar <span>foo]]</span><nowiki>=</nowiki>
18833 !! result
18834 <p>bar <span>[[foo]]</span>
18835 </p><p>=bar <span>[[foo]]</span>
18836 </p><p>[[bar <span>[[foo]]</span>
18837 </p><p>]]bar <span>[[foo]]</span>
18838 </p><p>=bar <span>foo]]</span>=
18839 </p>
18840 !!end
18841
18842 #### ----------------------- PRE --------------------------
18843 #### 1. Leading whitespace in SOL context should be escaped
18844 #### ------------------------------------------------------
18845 !! test
18846 1. Leading whitespace in SOL context should be escaped
18847 !! options
18848 parsoid
18849 !! input
18850 <nowiki> </nowiki>a
18851
18852 <nowiki> </nowiki> a
18853
18854 <nowiki> </nowiki>a(tab)
18855
18856 <nowiki> </nowiki> a
18857 <!--cmt-->
18858 <nowiki> </nowiki> a
18859
18860 a
18861 <nowiki> </nowiki>b
18862
18863 a
18864 <nowiki> </nowiki>b
18865
18866 a
18867 <nowiki> </nowiki> b
18868 !! result
18869 <p> a</p>
18870 <p> a</p>
18871 <p> a(tab)</p>
18872 <p> a</p>
18873 <p><!--cmt--> a</p>
18874 <p>a
18875 b</p>
18876 <p>a
18877 b</p>
18878 <p>a
18879 b</p>
18880 !! end
18881
18882 #### --------------- Behavior Switches --------------------
18883 !! test
18884 1. Valid behavior switches should be escaped
18885 !! options
18886 parsoid=html2wt
18887 !! input
18888 <nowiki>__TOC__</nowiki>
18889 !! result
18890 __TOC__
18891 !! end
18892
18893 !! test
18894 2. Invalid behavior switches should not be escaped
18895 !! options
18896 parsoid=html2wt
18897 !! input
18898 __TOO__
18899 __|__
18900 !! result
18901 __TOO__
18902 __|__
18903 !! end
18904
18905 #### --------------- HTML tags ---------------
18906 #### 1. a tags
18907 #### 2. other tags
18908 #### 3. multi-line html tag
18909 #### 4. extension tags
18910 #### -----------------------------------------
18911 !! test
18912 1. a tags
18913 !! options
18914 parsoid
18915 !! input
18916 <a href="http://google.com">google</a>
18917 !! result
18918 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
18919 !! end
18920
18921 !! test
18922 2. other tags
18923 !! input
18924 <nowiki><div>foo</div>
18925 <div style="color:red">foo</div></nowiki>
18926 !! result
18927 <p>&lt;div&gt;foo&lt;/div&gt;
18928 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
18929 </p>
18930 !! end
18931
18932 !! test
18933 3. multi-line html tag
18934 !! input
18935 <nowiki><div
18936 >foo</div
18937 ></nowiki>
18938 !! result
18939 <p>&lt;div
18940 &gt;foo&lt;/div
18941 &gt;
18942 </p>
18943 !! end
18944
18945 !! test
18946 4. extension tags
18947 !! input
18948 <nowiki><ref>foo</ref></nowiki>
18949
18950 <nowiki><ref>bar</nowiki>
18951
18952 baz<nowiki></ref></nowiki>
18953 !! result
18954 <p>&lt;ref&gt;foo&lt;/ref&gt;
18955 </p><p>&lt;ref&gt;bar
18956 </p><p>baz&lt;/ref&gt;
18957 </p>
18958 !! end
18959
18960 #### --------------- Others ---------------
18961 !! test
18962 Escaping nowikis
18963 !! input
18964 &lt;nowiki&gt;foo&lt;/nowiki&gt;
18965 !! result
18966 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
18967 </p>
18968 !! end
18969
18970 ## The quote-char in the input is necessary for triggering the bug
18971 !! test
18972 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
18973 !! options
18974 parsoid=wt2wt,html2wt
18975 !! input
18976 foo's bar :
18977 !! result
18978 <p>foo's bar :</p>
18979 !! end
18980
18981 !! test
18982
18983 Tag-like HTML structures are passed through as text
18984 !! input
18985 <x y>
18986
18987 <x.y>
18988
18989 <x-y>
18990
18991 1>2
18992
18993 x<y
18994
18995 a>b
18996
18997 1<d e>f
18998 !! result
18999 <p>&lt;x y&gt;
19000 </p><p>&lt;x.y&gt;
19001 </p><p>&lt;x-y&gt;
19002 </p><p>1&gt;2
19003 </p><p>x&lt;y
19004 </p><p>a&gt;b
19005 </p><p>1&lt;d e&gt;f
19006 </p>
19007 !! end
19008
19009
19010 # This was a bug in the PHP parser (see bug 17663 and its dups,
19011 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
19012 !! test
19013 Tag names followed by punctuation should not be recognized as tags
19014 !! input
19015 <s.ome> text
19016 !! result
19017 <p>&lt;s.ome&gt; text
19018 </p>
19019 !! end
19020
19021 !! test
19022 HTML tag with necessary entities in attributes
19023 !! input
19024 <span title="&amp;amp;">foo</span>
19025 !! result
19026 <p><span title="&amp;amp;">foo</span>
19027 </p>
19028 !! end
19029
19030 !! test
19031 HTML tag with 'unnecessary' entity encoding in attributes
19032 !! input
19033 <span title="&amp;">foo</span>
19034 !! result
19035 <p><span title="&amp;">foo</span>
19036 </p>
19037 !! end
19038
19039 !! test
19040 HTML tag with broken attribute value quoting
19041 !! input
19042 <span title="Hello world>Foo</span>
19043 !! result
19044 <p><span>Foo</span>
19045 </p>
19046 !! end
19047
19048 !! test
19049 Parsoid-only: HTML tag with broken attribute value quoting
19050 !! options
19051 parsoid
19052 !! input
19053 <span title="Hello world>Foo</span>
19054 !! result
19055 <p><span title="Hello world">Foo</span>
19056 </p>
19057 !! end
19058
19059 !! test
19060 Table with broken attribute value quoting
19061 !! input
19062 {|
19063 | title="Hello world|Foo
19064 |}
19065 !! result
19066 <table>
19067 <tr>
19068 <td>Foo
19069 </td></tr></table>
19070
19071 !! end
19072
19073 !! test
19074 Table with broken attribute value quoting on consecutive lines
19075 !! input
19076 {|
19077 | title="Hello world|Foo
19078 | style="color:red|Bar
19079 |}
19080 !! result
19081 <table>
19082 <tr>
19083 <td>Foo
19084 </td>
19085 <td>Bar
19086 </td></tr></table>
19087
19088 !! end
19089
19090 !! test
19091 Parsoid-only: Table with broken attribute value quoting on consecutive lines
19092 !! options
19093 parsoid
19094 !! input
19095 {|
19096 | title="Hello world|Foo
19097 | style="color:red|Bar
19098 |}
19099 !! result
19100 <table><tbody>
19101 <tr>
19102 <td title="Hello world">Foo
19103 </td><td style="color: red">Bar
19104 </td></tr></tbody></table>
19105
19106 !! end
19107
19108 !! test
19109 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
19110 !! options
19111 parsoid
19112 !! input
19113 {{}}
19114 !! result
19115 {{}}
19116 !! end
19117
19118 !! test
19119 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
19120 !! options
19121 parsoid
19122 !! input
19123 }}{{
19124 !! result
19125 }}{{
19126 !! end
19127
19128 !!test
19129 Accept empty td cell attribute
19130 !!input
19131 {|
19132 | align="center" | foo || |
19133 |}
19134 !!result
19135 <table>
19136 <tr>
19137 <td align="center"> foo </td>
19138 <td>
19139 </td></tr></table>
19140
19141 !!end
19142
19143 !!test
19144 Non-empty attributes in th-cells
19145 !!input
19146 {|
19147 ! Foo !! style="color: red" | Bar
19148 |}
19149 !!result
19150 <table>
19151 <tr>
19152 <th> Foo </th>
19153 <th style="color: red"> Bar
19154 </th></tr></table>
19155
19156 !!end
19157
19158 !!test
19159 Accept empty attributes in th-cells
19160 !!input
19161 {|
19162 !| foo !!| bar
19163 |}
19164 !!result
19165 <table>
19166 <tr>
19167 <th> foo </th>
19168 <th> bar
19169 </th></tr></table>
19170
19171 !!end
19172
19173 !!test
19174 Empty table rows go away
19175 !!input
19176 {|
19177 | Hello
19178 | there
19179 |- class="foo"
19180 |-
19181 |}
19182 !! result
19183 <table>
19184 <tr>
19185 <td> Hello
19186 </td>
19187 <td> there
19188 </td></tr>
19189
19190 </table>
19191
19192 !! end
19193
19194 ###
19195 ### Parsoid-centric tests for testing RTing of inter-element separators
19196 ### Edge cases not tested by existing parser tests and specific to
19197 ### Parsoid-specific serialization strategies.
19198 ###
19199
19200 !!test
19201 RT-ed inter-element separators should be valid separators
19202 !!input
19203 {|
19204 |- [[foo]]
19205 |}
19206 !!result
19207 <table>
19208
19209 </table>
19210
19211 !!end
19212
19213 !!test
19214 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
19215 (Parsoid-only since PHP parser relies on Tidy for correct output)
19216 !!options
19217 parsoid
19218 !!input
19219 {|
19220 |<small>foo
19221 bar
19222 |}
19223
19224 {|
19225 |<small>foo<small>
19226 |}
19227 !!result
19228 !!end
19229
19230 !!test
19231 Empty TD followed by TD with tpl-generated attribute
19232 !!input
19233 {|
19234 |-
19235 |
19236 |{{echo|style='color:red'}}|foo
19237 |}
19238 !!result
19239 <table>
19240
19241 <tr>
19242 <td>
19243 </td>
19244 <td>foo
19245 </td></tr></table>
19246
19247 !!end
19248
19249 !!test
19250 Indented table with an empty td
19251 !!input
19252 {|
19253 |-
19254 |
19255 |foo
19256 |}
19257 !!result
19258 <table>
19259
19260 <tr>
19261 <td>
19262 </td>
19263 <td>foo
19264 </td></tr></table>
19265
19266 !!end
19267
19268 !!test
19269 Empty TR followed by a template-generated TR
19270 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
19271 !!options
19272 parsoid
19273 !!input
19274 {|
19275 |-
19276 {{echo|<tr><td>foo</td></tr>}}
19277 |}
19278 !!result
19279 <table>
19280 <tbody>
19281 <tr></tr>
19282 <tr about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<tr><td>foo</td></tr>"}},"i":0}}]}'>
19283 <td>foo</td></tr>
19284 </tbody></table>
19285 !!end
19286
19287 ## PHP and parsoid output differ for this, and since this is primarily
19288 ## for testing Parsoid's serializer, marking this Parsoid only
19289 !!test
19290 Empty TR followed by mixed-ws-comment line should RT correctly
19291 !!options
19292 parsoid
19293 !!input
19294 {|
19295 |-
19296 <!--c-->
19297 |-
19298 <!--c--> <!--d-->
19299 |}
19300 !!result
19301 <table>
19302 <tbody>
19303 <tr></tr>
19304 <!--c-->
19305 <tr>
19306 <!--c--> </tr><!--d-->
19307 </tbody></table>
19308
19309 !!end
19310
19311 !!test
19312 Multi-line image caption generated by templates with/without trailing newlines
19313 !!options
19314 parsoid
19315 !!input
19316 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
19317 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
19318 !!result
19319 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Foo.jpg" class="new" title="File:Foo.jpg">File:Foo.jpg</a> <div class="thumbcaption">foo\nA\nB\nC</div></div></div>
19320 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Foo.jpg" class="new" title="File:Foo.jpg">File:Foo.jpg</a> <div class="thumbcaption">foo\nA\nB\nC\n\n</div></div></div>
19321
19322 !!end
19323
19324 ## PHP emits broken html for this, and since this is primarily
19325 ## a Parsoid serializer test, marking this Parsoid only
19326 !!test
19327 Improperly nested inline or quotes tags with whitespace in between
19328 !!options
19329 parsoid
19330 !!input
19331 <span> <s>x</span> </s>
19332 ''' ''x''' ''
19333 !!result
19334 <p><span> <s>x</s></span><s> </s>
19335 <b> <i>x</i></b><i> </i>
19336 </p>
19337 !!end
19338
19339 !!test
19340 Encapsulate protected attributes from wt
19341 !!options
19342 parsoid
19343 !!input
19344 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
19345 !!result
19346 <body><div data-x-typeof="mw:placeholder stuff" data-x-data-parsoid="weird" data-x-data-parsoid-other="no" data-x-about="time" data-x-rel="mw:true">foo</div>
19347 </body>
19348 !!end
19349
19350 ## Currently the p-wrapper is fragile in how adds / removes transformations.
19351 ## Having nested or stray pre tags results in the attempt to add duplicates,
19352 ## causing an assertion fail. This test tries to prevent that situation.
19353 !!test
19354 Ensure ParagraphWrapper can deal with stray closing pre tags
19355 !!options
19356 parsoid=wt2html
19357 !!input
19358 plain text</pre>
19359 !!result
19360 plain text
19361 !!end
19362
19363 !!test
19364 1. Ensure fostered text content is wrapped in spans
19365 !!options
19366 parsoid=wt2html
19367 !!input
19368 <table>hi</table><table>ho</table>
19369 !!result
19370 <span>hi</span>
19371 <table></table>
19372 <span>ho</span>
19373 <table></table>
19374 !!end
19375
19376 !!test
19377 2. Ensure fostered text content is wrapped in spans (traps regressions around fostered marker on the span getting lost)
19378 !!options
19379 parsoid=wt2html,wt2wt
19380 !!input
19381 <table>
19382 <tr> || ||
19383 <td> a
19384 </table>
19385 !!result
19386 <span> || ||</span>
19387 <table>
19388 <tbody>
19389 <tr>
19390 <td> a</td></tr>
19391 </tbody></table>
19392 !!end
19393
19394 !!test
19395 Encapsulation properly handles null DSR information from foster box
19396 !!options
19397 parsoid=wt2html,wt2wt
19398 !!input
19399 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
19400 !!result
19401 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;
19402 <table>foo
19403 <tr>
19404 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
19405 <table>
19406 <tbody>
19407 <tr>
19408 <td>bar</td></tr></tbody></table>
19409 !!end
19410
19411 !!test
19412 1. Encapsulate foster-parented transclusion content
19413 !!options
19414 parsoid=wt2wt,wt2html
19415 !!input
19416 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
19417 !!result
19418 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19419 <table>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo
19420 <tr>
19421 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
19422 <table>
19423 <tbody>
19424 <tr>
19425 <td>bar</td></tr></tbody></table>
19426 !!end
19427
19428 !!test
19429 2. Encapsulate foster-parented transclusion content
19430 !!options
19431 parsoid=wt2wt,wt2html
19432 !!input
19433 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
19434 !!result
19435 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19436 <table>
19437 <div>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo&quot;}},&quot;i&quot;:0}},&quot;</div>
19438 <tr>
19439 <td>bar</td></tr></table>&quot;]}">foo</div>
19440 <table>
19441 <tbody>
19442 <tr>
19443 <td>bar</td></tr></tbody></table>
19444 !!end
19445
19446 !!test
19447 3. Encapsulate foster-parented transclusion content
19448 !!options
19449 parsoid=wt2wt,wt2html
19450 !!input
19451 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
19452 !!result
19453 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19454 <table>
19455 <div>
19456 <p>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo</p></div>
19457 <tr>
19458 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
19459 <p>foo</p></div>
19460 <table>
19461 <tbody>
19462 <tr>
19463 <td>bar</td></tr></tbody></table>
19464 !!end
19465
19466 !!test
19467 4. Encapsulate foster-parented transclusion content
19468 !!options
19469 parsoid=wt2wt,wt2html
19470 !!input
19471 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
19472 !!result
19473 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19474 <table>
19475 <div>
19476 <p>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo</p></div>
19477 <tr>
19478 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
19479 <p>foo</p></div>
19480 <table>
19481 <tbody>
19482 <tr>
19483 <td>bar</td></tr></tbody></table>
19484 !!end
19485
19486 !!test
19487 5. Encapsulate foster-parented transclusion content
19488 !!options
19489 parsoid=wt2wt,wt2html
19490 !!input
19491 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
19492 !!result
19493 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19494 <table>
19495 <tr>
19496 <td>
19497 <div>
19498 <p>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo</p></div></td>foo&quot;}},&quot;i&quot;:0}},&quot;</tr></table>&quot;]}">foo</span>
19499 <table>
19500 <tbody>
19501 <tr>
19502 <td>
19503 <div>
19504 <p>foo</p></div></td></tr></tbody></table>
19505 !!end
19506
19507 !!test
19508 6. Encapsulate foster-parented transclusion content
19509 !!options
19510 parsoid=wt2wt,wt2html
19511 !!input
19512 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
19513 !!result
19514 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19515 <table>
19516 <tr>
19517 <td>
19518 <div>
19519 <p>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo</p></div></td>foo</tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
19520 <table>
19521 <tbody>
19522 <tr>
19523 <td>
19524 <div>
19525 <p>foo</p></div></td></tr></tbody></table>
19526 <p>ok</p>
19527 !!end
19528
19529 !!test
19530 7. Encapsulate foster-parented transclusion content
19531 !!options
19532 parsoid=wt2wt,wt2html
19533 !!input
19534 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
19535 !!result
19536 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19537 <table>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;
19538 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
19539 <td>bar</td></table>&quot;]}">foo</p>
19540 <table>
19541 <tbody>
19542 <tr>
19543 <td>bar</td></tr></tbody></table>
19544 !!end
19545
19546 !!test
19547 8. Encapsulate foster-parented transclusion content
19548 !!options
19549 parsoid=wt2wt,wt2html
19550 !!input
19551 {{echo|a
19552 }}{|{{echo|style='color:red'}}
19553 |-
19554 |b
19555 |}
19556 !!result
19557 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a\n&quot;}},&quot;i&quot;:0}}]}">a</p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;{|&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;style&quot;:{&quot;wt&quot;:&quot;'color:red'&quot;}},&quot;i&quot;:0}},&quot;\n|-\n|b\n|}&quot;]}">{{{1}}}</span>
19558 <table>
19559 <tbody>
19560 <tr>
19561 <td>b</td></tr></tbody></table>
19562 !!end
19563
19564 !!test
19565 Table in fosterable position
19566 !!options
19567 parsoid=wt2html,wt2wt
19568 !!input
19569 {{OpenTable}}
19570 <div>
19571 {|
19572 |}
19573 </div>
19574 |}
19575 !!result
19576 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"OpenTable","href":"./Template:OpenTable"},"params":{},"i":0}},"\n&lt;div>"]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[]]}'></div><span about="#mwt1" data-parsoid="{}">
19577 </span>
19578 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
19579
19580 <table>
19581 </table>
19582 !!end
19583
19584 !!test
19585 Support <object> element with .data attribute
19586 !!options
19587 parsoid=html2wt
19588 !!input
19589 <object data="test.swf"></object>
19590 !!result
19591 <object data="test.swf"></object>
19592 !!end
19593
19594 # -----------------------------------------------------------------
19595 # The following section of tests are primarily to spec requirements
19596 # around serialization of new/edited content.
19597 #
19598 # All these tests are marked Parsoid html2wt and html2html only
19599 # ----------------------------------------------------------------
19600
19601 !! test
19602 Image: Modifying size of an image (1)
19603 !! options
19604 parsoid=html2wt
19605 !! input
19606 [[Image:Foobar.jpg|200x200px]]
19607 !! result
19608 <p><span typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"230x230px"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/230px-Foobar.jpg" height="22" width="200" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"26","width":"230"},"sa":{"resource":"Image:Foobar.jpg"}}'/></a></span></p>
19609 !!end
19610
19611 !! test
19612 Image: Modifying size of an image (2)
19613 !! options
19614 parsoid=html2wt
19615 !! input
19616 [[Image:Foobar.jpg|500x500px]]
19617 !! result
19618 <p><span typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"230x230px"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/230px-Foobar.jpg" height="100" width="500" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"26","width":"230"},"sa":{"resource":"Image:Foobar.jpg"}}'/></a></span></p>
19619 !!end
19620
19621 # note that the data-parsoid value conflicts with the figure's class
19622 !! test
19623 Image: Modifying alignment of an image (bug 48665)
19624 !! options
19625 parsoid=html2wt
19626 !! input
19627 [[Image:Foobar.jpg|thumb|caption|left]]
19628 !! result
19629 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"caption"},{"ck":"right","ak":"right"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="20" width="180" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"20","width":"180"},"sa":{"resource":"Image:Foobar.jpg"}}'/></a><figcaption>caption</figcaption></figure>
19630 !! end
19631
19632 !! test
19633 Image: Modifying valign of an image (bug 49221)
19634 !! options
19635 parsoid=html2wt
19636 !! input
19637 [[File:Foobar.jpg|20px|text-top]]
19638 !! result
19639 <p><span class="mw-valign-text-top" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"20px"},{"ck":"text_top","ak":"text-top"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" height="2" width="20" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"2","width":"20"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
19640 !! end
19641
19642 !! test
19643 Image: Modifying alt attribute of an image (bug 56400)
19644 !! options
19645 parsoid=html2wt
19646 !! input
19647 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
19648 !! result
19649 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"some caption"},{"ck":"alt","ak":"alt=some alternate text"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img alt="some alternate edited text" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="20" width="180" data-parsoid='{"a":{"alt":"some alternate edited text","resource":"./File:Foobar.jpg","height":"20","width":"180"},"sa":{"alt":"alt=some alternate edited text","resource":"File:Foobar.jpg"}}'/></a><figcaption>some caption</figcaption></figure>
19650 !!end
19651
19652 !! test
19653 Image: Modifying caption of an image
19654 !! options
19655 parsoid=html2wt
19656 !! input
19657 [[Image:Foobar.jpg|thumb|new caption]]
19658 !! result
19659 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"original caption"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="20" width="180" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"20","width":"180"},"sa":{"resource":"Image:Foobar.jpg"}}'/></a><figcaption>new caption</figcaption></figure>
19660 !!end
19661
19662 !! test
19663 Image: empty alt attribute (bug 48924)
19664 !! options
19665 parsoid
19666 !! input
19667 [[File:Foobar.jpg|thumb|alt=|bar]]
19668 !! result
19669 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"alt","ak":"alt="},{"ck":"caption","ak":"bar"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img alt="" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" height="25" width="220" data-parsoid='{"a":{"alt":"","resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"alt":"alt=","resource":"File:Foobar.jpg"}}'/></a><figcaption>bar</figcaption></figure>
19670 !! end
19671
19672 #!! test
19673 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
19674 #!! options
19675 #parsoid=html2wt
19676 #language=ar
19677 #!! input
19678 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
19679 #!! result
19680 #<figure class="mw-default-size mw-halign-right" typeof="mw:Image/Thumb"><a href="Imagen:Foobar.jpg"><img resource="./Imagen:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="20" width="180"/></a></figure>
19681 #!! end
19682
19683 !! test
19684 Image: Block level image should have \n before and after
19685 !! options
19686 parsoid
19687 !! input
19688 123
19689 [[File:Foobar.jpg|right|thumb|150x150px]]
19690 456
19691 !! result
19692 <p>123</p><figure typeof="mw:Image/Thumb" class="mw-halign-right"><a href="./File:Foobar.png"><img src="http://192.168.142.128/mw/images/thumb/b/bc/Foobar.png/131px-Foobar.png" width="131" height="150" resource="./File:Foobar.png" data-parsoid='{"a":{"resource":"./File:Foobar.png","width":"131"},"sa":{"resource":"File:Foobar.png","width":"150"}}'></a></figure><p>456</p>
19693 !!end
19694
19695 !! test
19696 Image: New block level image should have \n before and after (existing
19697 content)
19698 !! options
19699 parsoid
19700 !! input
19701 123
19702 [[File:Foobar.jpg|right|thumb|150x150px]]
19703 456
19704 !! result
19705 <p data-parsoid='{"dsr":[0,3,0,0]}'>123</p>
19706 <figure class="mw-halign-right" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"right","ak":"right"},{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"150x150px"}],"dsr":[4,45,2,2]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"dsr":[6,43,null,null]}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/150px-Foobar.jpg" height="17" width="150" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"17","width":"150"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure>
19707 <p data-parsoid='{"dsr":[46,49,0,0]}'>456</p>
19708 !!end
19709
19710 !! test
19711 Images: upright option (parsoid)
19712 !! options
19713 parsoid
19714 !! input
19715 [[File:Foobar.jpg|thumb|upright|caption]]
19716 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
19717 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
19718 !! result
19719 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="19" width="170"/></a><figcaption>caption</figcaption></figure><figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="19" width="170"/></a><figcaption>caption</figcaption></figure><figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="57" width="500"/></a><figcaption>caption</figcaption></figure>
19720 !!end
19721
19722 !! test
19723 Images: upright option is ignored on inline and frame images (parsoid)
19724 !! options
19725 parsoid
19726 !! input
19727 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
19728 !! result
19729 <p><span typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="57" width="500"/></a></span></p>
19730 !!end
19731
19732 !! test
19733 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
19734 !! options
19735 parsoid=html2wt
19736 !! input
19737 * foo
19738 !! result
19739 <ul>
19740 <li><p>foo</p></li>
19741 </ul>
19742 !! end
19743
19744 !! test
19745 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
19746 !! options
19747 parsoid=html2wt
19748 !! input
19749 * foo
19750 !! result
19751 <ul> <li>foo</li></ul>
19752 !! end
19753
19754 !! test
19755 Don't strip leading whitespace when handling indent-pre suppressing tags
19756 !! options
19757 parsoid=html2wt
19758 !! input
19759 {|
19760 | indented row
19761 |}
19762 <blockquote>
19763 '''This is very bold of you!'''
19764
19765 {|
19766 |
19767 indented cell (no pre-wrapping!)
19768 |}
19769 </blockquote>
19770 foo
19771 <div>bar</div>
19772 !! result
19773 <table>
19774 <tr><td> indented row</td></tr>
19775 </table>
19776 <blockquote><p>
19777 <b>This is very bold of you!</b>
19778 </p>
19779 <table><tr><td>
19780 indented cell (no pre-wrapping!)
19781 </td></tr></table>
19782 </blockquote>
19783 <p>foo</p>
19784 <div>bar</div>
19785 !! end
19786
19787 !! test
19788 Strip leading whitespace when handling indent-pre inducing tags
19789 !! options
19790 parsoid=html2wt
19791 !! input
19792 foo
19793 <span>bar</span>
19794
19795 <span>foo2
19796 </span>bar2
19797
19798 <div>foo</div>
19799 <span>bar</span>
19800
19801 <div>
19802 <span>foo</span>
19803 </div>
19804 !! result
19805 <p>foo</p>
19806 <span>bar</span>
19807
19808 <span>foo2
19809 </span>bar2
19810
19811 <div>foo</div>
19812 <span>bar</span>
19813
19814 <div>
19815 <span>foo</span>
19816 </div>
19817 !! end
19818
19819 !! test
19820 Lists: Add space after bullets
19821 !! options
19822 parsoid=html2wt
19823 !! input
19824 * foo
19825 * bar
19826 * <span> baz</span>
19827 !! result
19828 <ul>
19829 <li>foo</li>
19830 <li> bar</li>
19831 <li><span> baz</span></li>
19832 </ul>
19833 !! end
19834
19835 !! test
19836 Headings: Add space before/after == (Bug 51744)
19837 !! options
19838 parsoid=html2wt
19839 !! input
19840 == foo ==
19841
19842 == bar ==
19843
19844 == baz ==
19845
19846 == <span> baz</span> ==
19847 !! result
19848 <h2>foo</h2>
19849 <h2> bar</h2>
19850 <h2>baz </h2>
19851 <h2><span> baz</span></h2>
19852 !! end
19853
19854 !! test
19855 Parsoid: Serialize positional parameters with = in them as named parameter
19856 !! options
19857 parsoid=html2wt
19858 !! input
19859 {{echo|1 = f=oo}}
19860
19861 {{echo|1 = f=oo|2 = bar}}
19862
19863 <!--Orig params with data-parsoid has heuristics for handling = chars-->
19864 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
19865 {{echo|<nowiki>f=oo</nowiki>|bar}}
19866 !! result
19867 <p about="#mwt1" typeof="mw:Transclusion"
19868 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
19869
19870 <p about="#mwt1" typeof="mw:Transclusion"
19871 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
19872
19873 <!--Orig params with data-parsoid has heuristics for handling = chars-->
19874 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
19875 <p data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]},{"k":"2","spc":["","","",""]}]]}' about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"},"2":{"wt":"bar"}},"i":0}}]}'>foo</p>
19876 !! end
19877
19878 !! test
19879 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
19880 !! options
19881 parsoid=html2wt
19882 !! input
19883 <div>a
19884 b
19885 </div>
19886 <div>a
19887 b
19888 </div>
19889 <div>
19890 a
19891
19892 b
19893 </div>
19894 !! result
19895 <div>a<p>b</p></div>
19896 <div>a
19897 <p>b</p></div>
19898 <div>
19899 a
19900 <p>b</p></div>
19901 !! end
19902
19903 #-----------------------------
19904 # I/B quote minimization tests
19905 #-----------------------------
19906
19907 !! test
19908 1. I/B quote minimization: wikitext-only tags should be combined
19909 !! options
19910 parsoid=html2wt
19911 !! input
19912 ''AB''
19913
19914 '''AB'''
19915
19916 ''A'''B'''''
19917
19918 '''A''B'''''
19919
19920 '''A''BC''D'''
19921
19922 '''''AB'''''
19923
19924 '''''AB'''''
19925
19926 '''''AB'''''
19927 !! result
19928 <p><i>A</i><i>B</i></p>
19929 <p><b>A</b><b>B</b></p>
19930 <p><i>A</i><b><i>B</i></b></p>
19931 <p><b>A</b><i><b>B</b></i></p>
19932 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
19933 <p><i><b>A</b></i><i><b>B</b></i></p>
19934 <p><i><b>A</b></i><b><i>B</i></b></p>
19935 <p><b><i>A</i></b><i><b>B</b></i></p>
19936 !! end
19937
19938 !! test
19939 2. I/B quote minimization: wikitext and html tags should not be combined
19940 !! options
19941 parsoid=html2wt
19942 !! input
19943 ''A''<i>B</i>
19944
19945 ''A'''''<i>B</i>'''
19946 !! result
19947 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
19948 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
19949 !! end
19950
19951 !! test
19952 3. I/B quote minimization: templated content stops minimization
19953 !! options
19954 parsoid=html2wt
19955 !! input
19956 ''A''{{echo|''B''}}
19957
19958 ''A''{{echo|'''''B'''''}}
19959 !! result
19960 <p><i>A</i><i about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;B&#39;&#39;"}},"i":0}}]}'>B</i>
19961 <p><i>A</i><b about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;&#39;&#39;&#39;B&#39;&#39;&#39;&#39;&#39;"}},"i":0}}]}'><i>B</i></b>
19962 !! end
19963
19964 !! test
19965 4. I/B quote minimization: new content should be mimimized with adjacent old content
19966 !! options
19967 parsoid=html2wt
19968 !! input
19969 ''AB''
19970
19971 '''AB'''
19972
19973 ''A'''B'''''
19974 !! result
19975 <p><i>A</i><i data-parsoid='{}'>B</i></p>
19976 <p><b data-parsoid='{}'>A</b><b>B</b></p>
19977 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
19978 !! end
19979
19980 #------------------------------------
19981 # End of I/B quote minimization tests
19982 #------------------------------------
19983
19984 !!test
19985 Bug 54262: New entities
19986 !! options
19987 parsoid=html2wt
19988 !! input
19989 foo
19990 !! result
19991 <span typeof="mw:Entity">foo</span>
19992 !! end
19993
19994 ## Note that there is no wikitext output for 'unknownproperty' ##
19995 ## Unknown magic words are silently dropped ##
19996
19997 !! test
19998 Magic words
19999 !! options
20000 parsoid=html2wt
20001 !! input
20002 __TOC__
20003 __NOTOC__
20004 __FORCETOC__
20005 __INDEX__
20006 __NOINDEX__
20007 __NOGALLERY__
20008 __NOEDITSECTION__
20009 __NOTITLECONVERT__
20010 __NOCONTENTCONVERT__
20011 !! result
20012 <meta property='mw:PageProp/toc' />
20013 <meta property='mw:PageProp/notoc' />
20014 <meta property='mw:PageProp/forcetoc' />
20015 <meta property='mw:PageProp/index' />
20016 <meta property='mw:PageProp/noindex' />
20017 <meta property='mw:PageProp/nogallery' />
20018 <meta property='mw:PageProp/noeditsection' />
20019 <meta property='mw:PageProp/notitleconvert' />
20020 <meta property='mw:PageProp/nocontentconvert' />
20021 <meta property='mw:PageProp/unknownproperty' />
20022 !! end
20023
20024 !! test
20025 Consecutive <pre>s should not get merged
20026 !! options
20027 parsoid=html2wt,html2html
20028 !! input
20029 a
20030
20031 b
20032
20033 c
20034
20035 d
20036
20037 e
20038
20039
20040
20041 f
20042 !! result
20043 <pre>a</pre><pre>b</pre>
20044
20045 <pre>c
20046 </pre><pre>
20047 d</pre>
20048
20049 <pre>e
20050
20051 </pre><pre>
20052
20053 f</pre>
20054 !! end
20055
20056 !! test
20057 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
20058 !! options
20059 parsoid=html2wt
20060 !! input
20061 [[Special:BookSources/1234567890|ISBN 1234567895]]
20062 !! result
20063 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
20064 !! end
20065
20066 !! test
20067 Edited RFC links not serializable as RFC links should serialize as extlinks
20068 !! options
20069 parsoid=html2wt
20070 !! input
20071 [//tools.ietf.org/html/rfc123 New RFC]
20072 !! result
20073 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
20074 !! end
20075
20076 !! test
20077 Edited PMID links not serializable as PMID links should serialize as extlinks
20078 !! options
20079 parsoid=html2wt
20080 !! input
20081 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
20082 !! result
20083 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
20084 !! end
20085
20086 !! test
20087 Edited Redirect link should emit a non-piped wikitext link
20088 !! options
20089 parsoid=html2wt
20090 !! input
20091 #REDIRECT [[Bar]]
20092 !! result
20093 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
20094 !! end
20095
20096 # -----------------------------------------------------------------
20097 # End of section for Parsoid-only html2wt tests for serialization
20098 # of new content
20099 # -----------------------------------------------------------------
20100
20101 TODO:
20102 more images
20103 more tables
20104 character entities
20105 and much more
20106 Try for 100% code coverage