Merge "Deleting a page and then immediately create-protecting it caused a PHP Fatal...
[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 ###
150 ### Basic tests
151 ###
152 !! test
153 Blank input
154 !! input
155 !! result
156 !! end
157
158
159 !! test
160 Simple paragraph
161 !! input
162 This is a simple paragraph.
163 !! result
164 <p>This is a simple paragraph.
165 </p>
166 !! end
167
168 !! test
169 Paragraphs with extra newline spacing
170 !! input
171 foo
172
173 bar
174
175
176 baz
177
178
179
180 booz
181 !! result
182 <p>foo
183 </p><p>bar
184 </p><p><br />
185 baz
186 </p><p><br />
187 </p><p>booz
188 </p>
189 !! end
190
191 !! test
192 Paragraphs with newline spacing with comment lines in between
193 !! input
194 ----
195 a
196 <!--foo-->
197 b
198 ----
199 a
200 <!--foo--><!--More than 1 comment, still stripped-->
201 b
202 ----
203 a
204 <!--foo--> <!----> <!-- bar -->
205 b
206 ----
207 a
208 <!--foo-->
209
210 b
211 ----
212 a
213
214 <!--foo-->
215 b
216 ----
217 a
218 <!--foo-->
219
220
221 b
222 ----
223 a
224
225
226 <!--foo-->
227 b
228 ----
229 !! result
230 <hr />
231 <p>a
232 b
233 </p>
234 <hr />
235 <p>a
236 b
237 </p>
238 <hr />
239 <p>a
240 b
241 </p>
242 <hr />
243 <p>a
244 </p><p>b
245 </p>
246 <hr />
247 <p>a
248 </p><p>b
249 </p>
250 <hr />
251 <p>a
252 </p><p><br />
253 b
254 </p>
255 <hr />
256 <p>a
257 </p><p><br />
258 b
259 </p>
260 <hr />
261
262 !! end
263
264 !! test
265 Paragraphs with newline spacing with non-empty white-space lines in between
266 !! input
267 ----
268 a
269
270 b
271 ----
272 a
273
274
275 b
276 ----
277 !! result
278 <hr />
279 <p>a
280 </p><p>b
281 </p>
282 <hr />
283 <p>a
284 </p><p><br />
285 b
286 </p>
287 <hr />
288
289 !! end
290
291 !! test
292 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
293 !! input
294 ----
295 a
296 <!--foo-->
297 b
298 ----
299 a
300 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
301 b
302 ----
303 a
304
305 <!--foo-->
306 <!--bar-->
307 b
308 ----
309 a
310
311 <!--foo-->
312 <!--bar-->
313
314 b
315 ----
316 !! result
317 <hr />
318 <p>a
319 b
320 </p>
321 <hr />
322 <p>a
323 b
324 </p>
325 <hr />
326 <p>a
327 </p><p>b
328 </p>
329 <hr />
330 <p>a
331 </p><p><br />
332 b
333 </p>
334 <hr />
335
336 !! end
337
338 !! test
339 Extra newlines: More paragraphs with indented comment
340 !! input
341 a
342
343 <!--boo-->
344
345 b
346 !!result
347 <p>a
348 </p><p><br />
349 b
350 </p>
351 !!end
352
353 !! test
354 Extra newlines followed by heading
355 !! input
356 a
357
358
359
360 =b=
361 [[a]]
362
363
364 =b=
365 !! result
366 <p>a
367 </p><p><br />
368 </p>
369 <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>
370 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
371 </p><p><br />
372 </p>
373 <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>
374
375 !! end
376
377 !! test
378 Extra newlines between heading and content are swallowed
379 !! input
380 =b=
381
382
383
384 [[a]]
385 !! result
386 <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>
387 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
388 </p>
389 !! end
390
391 !! test
392 Parsing an URL
393 !! input
394 http://fr.wikipedia.org/wiki/🍺
395 <!-- EasterEgg we love beer, better be able be able to link to it -->
396 !! result
397 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
398 </p>
399 !! end
400
401 !! test
402 Simple list
403 !! input
404 * Item 1
405 * Item 2
406 !! result
407 <ul>
408 <li> Item 1
409 </li>
410 <li> Item 2
411 </li>
412 </ul>
413
414 !! end
415
416 !! test
417 Italics and bold
418 !! input
419 * plain
420 * plain''italic''plain
421 * plain''italic''plain''italic''plain
422 * plain'''bold'''plain
423 * plain'''bold'''plain'''bold'''plain
424 * plain''italic''plain'''bold'''plain
425 * plain'''bold'''plain''italic''plain
426 * plain''italic'''bold-italic'''italic''plain
427 * plain'''bold''bold-italic''bold'''plain
428 * plain'''''bold-italic'''italic''plain
429 * plain'''''bold-italic''bold'''plain
430 * plain''italic'''bold-italic'''''plain
431 * plain'''bold''bold-italic'''''plain
432 * plain l'''italic''plain
433 * plain l''''bold''' plain
434 !! result
435 <ul>
436 <li> plain
437 </li>
438 <li> plain<i>italic</i>plain
439 </li>
440 <li> plain<i>italic</i>plain<i>italic</i>plain
441 </li>
442 <li> plain<b>bold</b>plain
443 </li>
444 <li> plain<b>bold</b>plain<b>bold</b>plain
445 </li>
446 <li> plain<i>italic</i>plain<b>bold</b>plain
447 </li>
448 <li> plain<b>bold</b>plain<i>italic</i>plain
449 </li>
450 <li> plain<i>italic<b>bold-italic</b>italic</i>plain
451 </li>
452 <li> plain<b>bold<i>bold-italic</i>bold</b>plain
453 </li>
454 <li> plain<i><b>bold-italic</b>italic</i>plain
455 </li>
456 <li> plain<b><i>bold-italic</i>bold</b>plain
457 </li>
458 <li> plain<i>italic<b>bold-italic</b></i>plain
459 </li>
460 <li> plain<b>bold<i>bold-italic</i></b>plain
461 </li>
462 <li> plain l'<i>italic</i>plain
463 </li>
464 <li> plain l'<b>bold</b> plain
465 </li>
466 </ul>
467
468 !! end
469
470 # this example taken from the [[simple:Moon]] article (bug 47326)
471 !! test
472 Italics and possessives (1)
473 !! input
474 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
475 !! result
476 <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
477 </p>
478 !! end
479
480 # this example taken from [[en:Flaming Pie]] (bug 49926)
481 !! test
482 Italics and possessives (2)
483 !! input
484 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
485 !! result
486 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
487 </p>
488 !! end
489
490 # this example taken from [[en:Dictionary]] (bug 49926)
491 !! test
492 Italics and possessives (3)
493 !! input
494 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''.
495 !! result
496 <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>.
497 </p>
498 !! end
499
500
501 ###
502 ### 2-quote opening sequence tests
503 ###
504 !! test
505 Italics and bold: 2-quote opening sequence: (2,2)
506 !! input
507 ''foo''
508 !! result
509 <p><i>foo</i>
510 </p>
511 !!end
512
513
514 !! test
515 Italics and bold: 2-quote opening sequence: (2,3)
516 !! input
517 ''foo'''
518 !! result
519 <p><i>foo'</i>
520 </p>
521 !!end
522
523
524 !! test
525 Italics and bold: 2-quote opening sequence: (2,4)
526 !! input
527 ''foo''''
528 !! result
529 <p><i>foo''</i>
530 </p>
531 !!end
532
533
534 !! test
535 Italics and bold: 2-quote opening sequence: (2,5) (php)
536 !! options
537 php
538 !! input
539 ''foo'''''
540 !! result
541 <p><i>foo</i>
542 </p>
543 !!end
544 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
545 !! test
546 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
547 !! options
548 parsoid
549 !! input
550 ''foo'''''
551 !! result
552 <p><i>foo</i><b></b>
553 </p>
554 !!end
555
556
557 ###
558 ### 3-quote opening sequence tests
559 ###
560
561 !! test
562 Italics and bold: 3-quote opening sequence: (3,2)
563 !! input
564 '''foo''
565 !! result
566 <p>'<i>foo</i>
567 </p>
568 !!end
569
570
571 !! test
572 Italics and bold: 3-quote opening sequence: (3,3)
573 !! input
574 '''foo'''
575 !! result
576 <p><b>foo</b>
577 </p>
578 !!end
579
580
581 !! test
582 Italics and bold: 3-quote opening sequence: (3,4)
583 !! input
584 '''foo''''
585 !! result
586 <p><b>foo'</b>
587 </p>
588 !!end
589
590
591 !! test
592 Italics and bold: 3-quote opening sequence: (3,5) (php)
593 !! options
594 php
595 !! input
596 '''foo'''''
597 !! result
598 <p><b>foo</b>
599 </p>
600 !!end
601 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
602 !! test
603 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
604 !! options
605 parsoid
606 !! input
607 '''foo'''''
608 !! result
609 <p><b>foo</b><i></i>
610 </p>
611 !!end
612
613
614 ###
615 ### 4-quote opening sequence tests
616 ###
617
618 !! test
619 Italics and bold: 4-quote opening sequence: (4,2)
620 !! input
621 ''''foo''
622 !! result
623 <p>''<i>foo</i>
624 </p>
625 !!end
626
627
628 !! test
629 Italics and bold: 4-quote opening sequence: (4,3)
630 !! input
631 ''''foo'''
632 !! result
633 <p>'<b>foo</b>
634 </p>
635 !!end
636
637
638 !! test
639 Italics and bold: 4-quote opening sequence: (4,4)
640 !! input
641 ''''foo''''
642 !! result
643 <p>'<b>foo'</b>
644 </p>
645 !!end
646
647
648 !! test
649 Italics and bold: 4-quote opening sequence: (4,5) (php)
650 !! options
651 php
652 !! input
653 ''''foo'''''
654 !! result
655 <p>'<b>foo</b>
656 </p>
657 !!end
658 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
659 !! test
660 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
661 !! options
662 parsoid
663 !! input
664 ''''foo'''''
665 !! result
666 <p>'<b>foo</b><i></i>
667 </p>
668 !!end
669
670
671 ###
672 ### 5-quote opening sequence tests
673 ###
674
675 !! test
676 Italics and bold: 5-quote opening sequence: (5,2)
677 !! options
678 !! input
679 '''''foo''
680 !! result
681 <p><b><i>foo</i></b>
682 </p>
683 !!end
684
685
686 !! test
687 Italics and bold: 5-quote opening sequence: (5,3)
688 !! input
689 '''''foo'''
690 !! result
691 <p><i><b>foo</b></i>
692 </p>
693 !!end
694
695
696 !! test
697 Italics and bold: 5-quote opening sequence: (5,4)
698 !! input
699 '''''foo''''
700 !! result
701 <p><i><b>foo'</b></i>
702 </p>
703 !!end
704
705
706 !! test
707 Italics and bold: 5-quote opening sequence: (5,5)
708 !! input
709 '''''foo'''''
710 !! result
711 <p><i><b>foo</b></i>
712 </p>
713 !!end
714
715 ###
716 ### multiple quote sequences in a line
717 ###
718 !! test
719 Italics and bold: multiple quote sequences: (2,4,2)
720 !! input
721 ''foo''''bar''
722 !! result
723 <p><i>foo'<b>bar</b></i>
724 </p>
725 !!end
726
727
728 !! test
729 Italics and bold: multiple quote sequences: (2,4,3)
730 !! input
731 ''foo''''bar'''
732 !! result
733 <p><i>foo'<b>bar</b></i>
734 </p>
735 !!end
736
737
738 !! test
739 Italics and bold: multiple quote sequences: (2,4,4)
740 !! input
741 ''foo''''bar''''
742 !! result
743 <p><i>foo'<b>bar'</b></i>
744 </p>
745 !!end
746
747
748 !! test
749 Italics and bold: multiple quote sequences: (3,4,2) (php)
750 !! options
751 php
752 !! input
753 '''foo''''bar''
754 !! result
755 <p><b>foo'</b>bar
756 </p>
757 !!end
758 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
759 !! test
760 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
761 !! options
762 parsoid
763 !! input
764 '''foo''''bar''
765 !! result
766 <p><b>foo'</b>bar<i></i>
767 </p>
768 !!end
769
770
771 !! test
772 Italics and bold: multiple quote sequences: (3,4,3) (php)
773 !! options
774 php
775 !! input
776 '''foo''''bar'''
777 !! result
778 <p><b>foo'</b>bar
779 </p>
780 !!end
781 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
782 !! test
783 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
784 !! options
785 parsoid
786 !! input
787 '''foo''''bar'''
788 !! result
789 <p><b>foo'</b>bar<b></b>
790 </p>
791 !!end
792
793 ###
794 ### other quote tests
795 ###
796 !! test
797 Italics and bold: other quote tests: (2,3,5)
798 !! input
799 ''this is about '''foo's family'''''
800 !! result
801 <p><i>this is about <b>foo's family</b></i>
802 </p>
803 !!end
804
805
806 !! test
807 Italics and bold: other quote tests: (2,(3,3),2)
808 !! input
809 ''this is about '''foo's''' family''
810 !! result
811 <p><i>this is about <b>foo's</b> family</i>
812 </p>
813 !!end
814
815
816 !! test
817 Italics and bold: other quote tests: (3,2,3,2)
818 !! input
819 '''this is about ''foo'''s family''
820 !! result
821 <p><b>this is about <i>foo</i></b><i>s family</i>
822 </p>
823 !!end
824
825
826 !! test
827 Italics and bold: other quote tests: (3,2,3,3)
828 !! options
829 !! input
830 '''this is about ''foo'''s family'''
831 !! result
832 <p>'<i>this is about </i>foo<b>s family</b>
833 </p>
834 !!end
835
836
837 !! test
838 Italics and bold: other quote tests: (3,(2,2),3)
839 !! input
840 '''this is about ''foo's'' family'''
841 !! result
842 <p><b>this is about <i>foo's</i> family</b>
843 </p>
844 !!end
845
846
847 !! test
848 Italicized possessive
849 !! input
850 The ''[[Main Page]]'''s talk page.
851 !! result
852 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
853 </p>
854 !! end
855
856 !! test
857 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
858 (Requires tidy for PHP parser output to be fixed up)
859 !! options
860 parsoid=wt2html,wt2wt
861 !! input
862 {|
863 !''a!!''b
864 |''a||''b
865 |}
866 !! result
867 <table>
868 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
869 <td><i>a</i></td><td><i>b</i></td></tr>
870 </tbody></table>
871 !! end
872
873 ###
874 ### Non-html5 tags
875 ###
876
877 !! test
878 Non-html5 tags should be accepted
879 !! input
880 <center>''foo''</center>
881 <big>''foo''</big>
882 <font>''foo''</font>
883 <strike>''foo''</strike>
884 <tt>''foo''</tt>
885 !! result
886 <center><i>foo</i></center>
887 <p><big><i>foo</i></big>
888 <font><i>foo</i></font>
889 <strike><i>foo</i></strike>
890 <tt><i>foo</i></tt>
891 </p>
892 !! end
893
894 !! test
895 <wbr> is valid wikitext (bug 52468)
896 !! input
897 <wbr>
898 !! result
899 <p><wbr />
900 </p>
901 !! end
902
903 # <strike> is HTML4, <s> is HTML4/5.
904 !! test
905 <s> or <strike> for strikethrough
906 !! input
907 <strike>strike</strike>
908
909 <s>s</s>
910 !! result
911 <p><strike>strike</strike>
912 </p><p><s>s</s>
913 </p>
914 !! end
915
916 !! test
917 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
918 !! input
919 <b→> doesn't work! </b>
920
921 <bä> doesn't work! </b>
922
923 <boo> works fine </b>
924
925 <s.foo>foo</s>
926
927 <s.foo>s.foo</s.foo>
928
929 <sub-ID#1>
930 !! result
931 <p>&lt;b→&gt; doesn't work! &lt;/b&gt;
932 </p><p>&lt;bä&gt; doesn't work! &lt;/b&gt;
933 </p><p>&lt;boo&gt; works fine &lt;/b&gt;
934 </p><p>&lt;s.foo&gt;foo&lt;/s&gt;
935 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
936 </p><p>&lt;sub-ID#1&gt;
937 </p>
938 !! end
939
940 ###
941 ### Special characters
942 ###
943
944 !! test
945 Bare pipe character (bug 52363)
946 !! input
947 |
948 !! result
949 <p>|
950 </p>
951 !! end
952
953 !! test
954 Bare pipe character from a template (bug 52363)
955 !! input
956 {{pipe}}
957 !! result
958 <p>|
959 </p>
960 !! end
961
962 ###
963 ### <nowiki> test cases
964 ###
965
966 !! test
967 <nowiki> unordered list
968 !! input
969 <nowiki>* This is not an unordered list item.</nowiki>
970 !! result
971 <p>* This is not an unordered list item.
972 </p>
973 !! end
974
975 !! test
976 <nowiki> spacing
977 !! input
978 <nowiki>Lorem ipsum dolor
979
980 sed abit.
981 sed nullum.
982
983 :and a colon
984 </nowiki>
985 !! result
986 <p>Lorem ipsum dolor
987
988 sed abit.
989 sed nullum.
990
991 :and a colon
992
993 </p>
994 !! end
995
996 !! test
997 nowiki 3
998 !! input
999 :There is not nowiki.
1000 :There is <nowiki>nowiki</nowiki>.
1001
1002 #There is not nowiki.
1003 #There is <nowiki>nowiki</nowiki>.
1004
1005 *There is not nowiki.
1006 *There is <nowiki>nowiki</nowiki>.
1007 !! result
1008 <dl>
1009 <dd>There is not nowiki.
1010 </dd>
1011 <dd>There is nowiki.
1012 </dd>
1013 </dl>
1014 <ol>
1015 <li>There is not nowiki.
1016 </li>
1017 <li>There is nowiki.
1018 </li>
1019 </ol>
1020 <ul>
1021 <li>There is not nowiki.
1022 </li>
1023 <li>There is nowiki.
1024 </li>
1025 </ul>
1026
1027 !! end
1028
1029 !! test
1030 Entities inside <nowiki>
1031 !! input
1032 <nowiki>&lt;</nowiki>
1033 !! result
1034 <p>&lt;
1035 </p>
1036 !! end
1037
1038 !! test
1039 Entities inside template parameters
1040 !! options
1041 parsoid
1042 !! input
1043 {{echo|&ndash;}}
1044 !! result
1045 <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>
1046 </p>
1047 !! end
1048
1049 ###
1050 ### Comments
1051 ###
1052 !! test
1053 Comments and Indent-Pre
1054 !! input
1055 <!-- comment 1 --> asdf
1056
1057 <!-- comment 1 --> asdf
1058 <!-- comment 2 -->
1059
1060 <!-- comment 1 --> asdf
1061 <!-- comment 2 -->xyz
1062
1063 <!-- comment 1 --> asdf
1064 <!-- comment 2 --> xyz
1065 !! result
1066 <pre>asdf
1067 </pre>
1068 <pre>asdf
1069 </pre>
1070 <pre>asdf
1071 </pre>
1072 <p>xyz
1073 </p>
1074 <pre>asdf
1075 xyz
1076 </pre>
1077 !! end
1078
1079 !! test
1080 Comment test 2a
1081 !! input
1082 asdf
1083 <!-- comment 1 -->
1084 jkl
1085 !! result
1086 <p>asdf
1087 jkl
1088 </p>
1089 !! end
1090
1091 !! test
1092 Comment test 2b
1093 !! input
1094 asdf
1095 <!-- comment 1 -->
1096
1097 jkl
1098 !! result
1099 <p>asdf
1100 </p><p>jkl
1101 </p>
1102 !! end
1103
1104 !! test
1105 Comment test 3
1106 !! input
1107 asdf
1108 <!-- comment 1 -->
1109 <!-- comment 2 -->
1110 jkl
1111 !! result
1112 <p>asdf
1113 jkl
1114 </p>
1115 !! end
1116
1117 !! test
1118 Comment test 4
1119 !! input
1120 asdf<!-- comment 1 -->jkl
1121 !! result
1122 <p>asdfjkl
1123 </p>
1124 !! end
1125
1126 !! test
1127 Comment spacing
1128 !! input
1129 a
1130 <!-- foo --> b <!-- bar -->
1131 c
1132 !! result
1133 <p>a
1134 </p>
1135 <pre> b
1136 </pre>
1137 <p>c
1138 </p>
1139 !! end
1140
1141 !! test
1142 Comment whitespace
1143 !! input
1144 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1145 !! result
1146
1147 !! end
1148
1149 !! test
1150 Comment semantics and delimiters
1151 !! input
1152 <!-- --><!----><!-----><!------>
1153 !! result
1154
1155 !! end
1156
1157 !! test
1158 Comment semantics and delimiters, redux
1159 !! input
1160 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1161 -- foo -- funky huh? ... -->
1162 !! result
1163
1164 !! end
1165
1166 !! test
1167 Comment semantics and delimiters: directors cut
1168 !! input
1169 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1170 everything starting with < followed by !-- until the first -- and > we see,
1171 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1172 -->-->
1173 !! result
1174 <p>--&gt;
1175 </p>
1176 !! end
1177
1178 !! test
1179 Comment semantics: nesting
1180 !! input
1181 <!--<!-- no, we're not going to do anything fancy here -->-->
1182 !! result
1183 <p>--&gt;
1184 </p>
1185 !! end
1186
1187 !! test
1188 Comment semantics: unclosed comment at end
1189 !! input
1190 <!--This comment will run out to the end of the document
1191 !! result
1192
1193 !! end
1194
1195 !! test
1196 Comment in template title
1197 !! input
1198 {{f<!---->oo}}
1199 !! result
1200 <p>FOO
1201 </p>
1202 !! end
1203
1204 !! test
1205 Comment on its own line post-expand
1206 !! input
1207 a
1208 {{blank}}<!---->
1209 b
1210 !! result
1211 <p>a
1212 </p><p>b
1213 </p>
1214 !! end
1215
1216 !! test
1217 Comment on its own line post-expand with non-significant whitespace
1218 !! input
1219 a
1220 {{blank}} <!---->
1221 b
1222 !! result
1223 <p>a
1224 </p><p>b
1225 </p>
1226 !! end
1227
1228 ###
1229 ### paragraph wrapping tests
1230 ###
1231 !! test
1232 No block tags
1233 !! input
1234 a
1235
1236 b
1237 !! result
1238 <p>a
1239 </p><p>b
1240 </p>
1241 !! end
1242
1243 !! test
1244 Block tag on one line (<div>)
1245 !! input
1246 a <div>foo</div>
1247
1248 b
1249 !! result
1250 a <div>foo</div>
1251 <p>b
1252 </p>
1253 !! end
1254
1255 !! test
1256 Block tag on one line (<blockquote>)
1257 !! input
1258 a <blockquote>foo</blockquote>
1259
1260 b
1261 !! result
1262 a <blockquote>foo</blockquote>
1263 <p>b
1264 </p>
1265 !! end
1266
1267 !! test
1268 Block tag on both lines (<div>)
1269 !! input
1270 a <div>foo</div>
1271
1272 b <div>foo</div>
1273 !! result
1274 a <div>foo</div>
1275 b <div>foo</div>
1276
1277 !! end
1278
1279 !! test
1280 Block tag on both lines (<blockquote>)
1281 !! input
1282 a <blockquote>foo</blockquote>
1283
1284 b <blockquote>foo</blockquote>
1285 !! result
1286 a <blockquote>foo</blockquote>
1287 b <blockquote>foo</blockquote>
1288
1289 !! end
1290
1291 !! test
1292 Multiple lines without block tags
1293 !! input
1294 <div>foo</div> a
1295 b
1296 c
1297 d<!--foo--> e
1298 x <div>foo</div> z
1299 !! result
1300 <div>foo</div> a
1301 <p>b
1302 c
1303 d e
1304 </p>
1305 x <div>foo</div> z
1306
1307 !! end
1308
1309 !! test
1310 Empty lines between lines with block tags
1311 !! input
1312 <div></div>
1313
1314
1315 <div></div>a
1316
1317 b
1318 <div>a</div>b
1319
1320 <div>b</div>d
1321
1322
1323 <div>e</div>
1324 !! result
1325 <div></div>
1326 <p><br />
1327 </p>
1328 <div></div>a
1329 <p>b
1330 </p>
1331 <div>a</div>b
1332 <div>b</div>d
1333 <p><br />
1334 </p>
1335 <div>e</div>
1336
1337 !! end
1338
1339 ###
1340 ### Preformatted text
1341 ###
1342 !! test
1343 Preformatted text
1344 !! input
1345 This is some
1346 Preformatted text
1347 With ''italic''
1348 And '''bold'''
1349 And a [[Main Page|link]]
1350 !! result
1351 <pre>This is some
1352 Preformatted text
1353 With <i>italic</i>
1354 And <b>bold</b>
1355 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1356 </pre>
1357 !! end
1358
1359 !! test
1360 Tabs don't trigger preformatted text
1361 !! input
1362 This is not
1363 preformatted text.
1364 This is preformatted text.
1365 So is this.
1366 !! result
1367 <p> This is not
1368 preformatted text.
1369 </p>
1370 <pre>This is preformatted text.
1371 So is this.
1372 </pre>
1373 !! end
1374
1375 !! test
1376 Ident preformatting with inline content
1377 !! input
1378 a
1379 ''b''
1380 !! result
1381 <pre>a
1382 <i>b</i>
1383 </pre>
1384 !! end
1385
1386 !! test
1387 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1388 !! input
1389 <pre><nowiki>
1390 <b>
1391 <cite>
1392 <em>
1393 </nowiki></pre>
1394 !! result
1395 <pre>
1396 &lt;b&gt;
1397 &lt;cite&gt;
1398 &lt;em&gt;
1399 </pre>
1400
1401 !! end
1402
1403 !! test
1404 Regression with preformatted in <center>
1405 !! input
1406 <center>
1407 Blah
1408 </center>
1409 !! result
1410 <center>
1411 <pre>Blah
1412 </pre>
1413 </center>
1414
1415 !! end
1416
1417 !! test
1418 Bug 52763: Preformatted in <blockquote>
1419 !! input
1420 <blockquote>
1421 Blah
1422 {|
1423 |
1424 indented cell (no pre-wrapping!)
1425 |}
1426 </blockquote>
1427 !! result
1428 <blockquote>
1429 <p> Blah
1430 </p>
1431 <table>
1432 <tr>
1433 <td>
1434 <p> indented cell (no pre-wrapping!)
1435 </p>
1436 </td></tr></table>
1437 </blockquote>
1438
1439 !! end
1440
1441 !! test
1442 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1443 !! input
1444 <blockquote>
1445 Foo
1446
1447 Bar
1448 </blockquote>
1449 !! result
1450 <blockquote>
1451 <p>Foo
1452 </p><p>Bar
1453 </p>
1454 </blockquote>
1455
1456 !! end
1457
1458 !! test
1459 Bug 15491: <ins>/<del> in blockquote
1460 !! input
1461 <blockquote>
1462 Foo <del>bar</del> <ins>baz</ins> quux
1463 </blockquote>
1464 !! result
1465 <blockquote>
1466 <p>Foo <del>bar</del> <ins>baz</ins> quux
1467 </p>
1468 </blockquote>
1469
1470 !! end
1471
1472 # Note that the p-wrapping is newline sensitive, which could be
1473 # considered a bug: tidy will wrap only the 'Foo' in the example
1474 # below in a <p> tag. (see comment 23-25 of bug #6200)
1475 !! test
1476 Bug 15491: <ins>/<del> in blockquote (2)
1477 !! input
1478 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1479 </blockquote>
1480 !! result
1481 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1482 </blockquote>
1483
1484 !! end
1485
1486 !! test
1487 <pre> with attributes (bug 3202)
1488 !! input
1489 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1490 !! result
1491 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1492
1493 !! end
1494
1495 !! test
1496 <pre> with width attribute (bug 3202)
1497 !! input
1498 <pre width="8">Narrow screen goodies</pre>
1499 !! result
1500 <pre width="8">Narrow screen goodies</pre>
1501
1502 !! end
1503
1504 !! test
1505 <pre> with forbidden attribute (bug 3202)
1506 !! input
1507 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1508 !! result
1509 <pre width="8">Narrow screen goodies</pre>
1510
1511 !! end
1512
1513 !! test
1514 Entities inside <pre>
1515 !! input
1516 <pre>&lt;</pre>
1517 !! result
1518 <pre>&lt;</pre>
1519
1520 !! end
1521
1522 !! test
1523 <pre> with forbidden attribute values (bug 3202)
1524 !! input
1525 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1526 !! result
1527 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1528
1529 !! end
1530
1531 !! test
1532 <nowiki> inside <pre> (bug 13238)
1533 !! input
1534 <pre>
1535 <nowiki>
1536 </pre>
1537 <pre>
1538 <nowiki></nowiki>
1539 </pre>
1540 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1541 !! result
1542 <pre>
1543 &lt;nowiki&gt;
1544 </pre>
1545 <pre>
1546
1547 </pre>
1548 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1549
1550 !! end
1551
1552 !! test
1553 <nowiki> and <pre> preference (first one wins)
1554 !! input
1555 <pre>
1556 <nowiki>
1557 </pre>
1558 </nowiki>
1559 </pre>
1560
1561 <nowiki>
1562 <pre>
1563 <nowiki>
1564 </pre>
1565 </nowiki>
1566 </pre>
1567
1568 !! result
1569 <pre>
1570 &lt;nowiki&gt;
1571 </pre>
1572 <p>&lt;/nowiki&gt;
1573 &lt;/pre&gt;
1574 </p><p>
1575 &lt;pre&gt;
1576 &lt;nowiki&gt;
1577 &lt;/pre&gt;
1578
1579 &lt;/pre&gt;
1580 </p>
1581 !! end
1582
1583 !! test
1584 </pre> inside nowiki
1585 !! input
1586 <nowiki></pre></nowiki>
1587 !! result
1588 <p>&lt;/pre&gt;
1589 </p>
1590 !! end
1591
1592 !!test
1593 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1594 !!input
1595 {{echo|}}
1596 !!result
1597
1598 !!end
1599
1600 !!test
1601 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1602 !!input
1603 {{echo|
1604 foo}}
1605 !!result
1606 <p>foo
1607 </p>
1608 !!end
1609
1610 !! test
1611 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1612 !! input
1613 {{echo|a
1614 b}}
1615 !!result
1616 <pre>a
1617 </pre>
1618 <p>b
1619 </p>
1620 !!end
1621
1622 !! test
1623 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1624 !! input
1625 {{echo|a
1626 b
1627 c
1628 d
1629 e
1630 }}
1631 !!result
1632 <pre>a
1633 </pre>
1634 <p>b
1635 c
1636 </p>
1637 <pre>d
1638 </pre>
1639 <p>e
1640 </p>
1641 !!end
1642
1643 !!test
1644 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1645 !!input
1646 {{echo| foo}}
1647
1648 {{echo| foo}}{{echo| bar}}
1649
1650 {{echo| foo}}
1651 {{echo| bar}}
1652
1653 {{echo|<!--cmt--> foo}}
1654
1655 <!--cmt-->{{echo| foo}}
1656
1657 {{echo|{{echo| }}bar}}
1658 !!result
1659 <pre>foo
1660 </pre>
1661 <pre>foo bar
1662 </pre>
1663 <pre>foo
1664 bar
1665 </pre>
1666 <pre>foo
1667 </pre>
1668 <pre>foo
1669 </pre>
1670 <pre>bar
1671 </pre>
1672 !!end
1673
1674 !! test
1675 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1676 !! input
1677 {{echo| }}a
1678
1679 {{echo|
1680 }}a
1681
1682 {{echo|
1683 b}}
1684
1685 {{echo|a
1686 }}b
1687
1688 {{echo|a
1689 }} b
1690 !!result
1691 <pre>a
1692 </pre>
1693 <p><br />
1694 </p>
1695 <pre>a
1696 </pre>
1697 <p><br />
1698 </p>
1699 <pre>b
1700 </pre>
1701 <p>a
1702 </p>
1703 <pre>b
1704 </pre>
1705 <p>a
1706 </p>
1707 <pre>b
1708 </pre>
1709 !!end
1710
1711 # TODO / maybe: fix wt2wt for this
1712 !! test
1713 Parsoid: Don't paragraph-wrap fosterable content
1714 !! options
1715 parsoid=wt2html
1716 !! input
1717 {|
1718 <td></td>
1719 <td></td>
1720
1721
1722
1723 |}
1724 !! result
1725 <table>
1726
1727 <tbody>
1728 <tr>
1729 <td></td>
1730
1731 <td></td></tr>
1732
1733
1734
1735 </tbody></table>
1736 !! end
1737
1738 !! test
1739 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
1740 !! options
1741 parsoid=wt2html
1742 !! input
1743 {|
1744 <td>
1745 <td>
1746 </td>
1747
1748
1749
1750 |}
1751 !! result
1752 <table>
1753
1754 <tbody>
1755 <tr>
1756 <td></td>
1757
1758 <td>
1759 </td></tr>
1760
1761
1762
1763 </tbody></table>
1764 !! end
1765
1766
1767 #--------------------------------------------------------------------
1768 # Transclusion parameter whitespace stripping tests
1769 # Behavior is different for positional and named parameters
1770 #--------------------------------------------------------------------
1771 !! test
1772 Templates: Strip leading and trailing whitespace from named-param values
1773 !! input
1774 {{echo|1= a }}
1775
1776 {{echo|1= {{echo|b}} }}
1777
1778 {{echo| 1 =
1779 c }}
1780
1781 {{echo| 1 =
1782 * d
1783 }}
1784 !! result
1785 <p>a
1786 </p><p>b
1787 </p><p>c
1788 </p>
1789 <ul>
1790 <li> d
1791 </li>
1792 </ul>
1793
1794 !! end
1795
1796 !! test
1797 Templates: Don't strip whitespace from positional-param values
1798 !! input
1799 {{echo|a }}
1800
1801 {{echo|{{echo|b}} }}
1802
1803 {{echo| c
1804 }}
1805
1806 {{echo| {{echo|d}}
1807 }}
1808
1809 {{echo|
1810 e}}
1811
1812 {{echo|
1813 * f}}
1814
1815 {{echo|
1816 }}g
1817 !! result
1818 <p>a
1819 </p><p>b
1820 </p>
1821 <pre>c
1822 </pre>
1823 <p><br />
1824 </p>
1825 <pre>d
1826 </pre>
1827 <p><br />
1828 </p>
1829 <pre>e
1830 </pre>
1831 <p><br />
1832 </p>
1833 <ul>
1834 <li> f
1835 </li>
1836 </ul>
1837 <p><br />
1838 </p>
1839 <pre>g
1840 </pre>
1841 !! end
1842
1843 !! test
1844 Templates: Handle empty comment-and-ws-only lines correctly
1845 !! input
1846 {{echo|foo
1847 <!--should be ignored-->
1848 <!--should be ignored as well-->
1849 bar}}
1850 !! result
1851 <p>foo
1852 bar
1853 </p>
1854 !! end
1855
1856 #--------------------------------------------------------------------
1857 # Transclusion parameter escaping tests
1858 #--------------------------------------------------------------------
1859 !! test
1860 Templates: Parsoid parameter escaping test 1
1861 !! options
1862 parsoid
1863 !! input
1864 {{echo|[foo]|{{echo|[bar]}}}}
1865 !! result
1866 <p about="#mwt1" typeof="mw:Transclusion"
1867 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
1868 !! end
1869
1870 !! test
1871 Parsoid: Pipes in external links in template parameter
1872 !! options
1873 parsoid
1874 !! input
1875 {{echo|[{{echo|http://example.com}} link]}}
1876 !! result
1877 <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>
1878 !! end
1879
1880 !! test
1881 Parsoid: pipe in transclusion parameter
1882 !! options
1883 parsoid
1884 !! input
1885 {{echo|http://foo.com/a&#124;b}}
1886 !! result
1887 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1888 typeof="mw:Transclusion"
1889 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>
1890 !! end
1891
1892 !! test
1893 Parsoid: Pipe in external link target and content in template parameter
1894 !! options
1895 parsoid=html2wt,wt2wt
1896 !! input
1897 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
1898 !! result
1899 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1900 typeof="mw:Transclusion"
1901 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
1902 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
1903 !! end
1904
1905 !! test
1906 Templates: Don't escape already nowiki-escaped text in template parameters
1907 !! options
1908 parsoid=html2wt,wt2wt
1909 !! input
1910 {{echo|foo<nowiki>|</nowiki>bar}}
1911 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
1912 {{echo|<nowiki></nowiki>}}
1913 !! result
1914 <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>
1915 <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>
1916 <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>
1917 </p>
1918 !! end
1919
1920 ## Bug 52824
1921 !! test
1922 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
1923 !! options
1924 parsoid=html2wt,wt2wt
1925 !! input
1926 {{echo|{{echo|1=bar}}}}
1927 !! result
1928 <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>
1929 !! end
1930
1931 ###
1932 ### Parsoid-centric tests for testing RT edge cases for pre
1933 ###
1934
1935 !!test
1936 1a. Indent-Pre and Comments
1937 !!input
1938 a
1939 <!--a-->
1940 c
1941 !!result
1942 <pre>a
1943 </pre>
1944 <p>c
1945 </p>
1946 !!end
1947
1948 !!test
1949 1b. Indent-Pre and Comments
1950 !!input
1951 a
1952 <!--a-->
1953 c
1954 !!result
1955 <pre>a
1956 </pre>
1957 <p>c
1958 </p>
1959 !!end
1960
1961 !!test
1962 1c. Indent-Pre and Comments
1963 !!input
1964 <!--a--> a
1965
1966 <!--a--> a
1967 !!result
1968 <pre> a
1969 </pre>
1970 <pre> a
1971 </pre>
1972 !!end
1973
1974 !!test
1975 1d. Indent-Pre and Comments
1976 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
1977 !!input
1978 <!--a--> a
1979
1980 <!--b-->b
1981 !!result
1982 <pre>a
1983 </pre>
1984 <pre>b
1985 </pre>
1986 !!end
1987
1988 !!test
1989 2a. Indent-Pre and tables
1990 !!input
1991 {|
1992 |-
1993 !h1!!h2
1994 |foo||bar
1995 |}
1996 !!result
1997 <table>
1998
1999 <tr>
2000 <th>h1</th>
2001 <th>h2
2002 </th>
2003 <td>foo</td>
2004 <td>bar
2005 </td></tr></table>
2006
2007 !!end
2008
2009 !!test
2010 2b. Indent-Pre and tables
2011 !!input
2012 {|
2013 |-
2014 |foo
2015 |}
2016 !!result
2017 <table>
2018
2019 <tr>
2020 <td>foo
2021 </td></tr></table>
2022
2023 !!end
2024
2025 !!test
2026 2c. Indent-Pre and tables (bug 42252)
2027 !!input
2028 {|
2029 |+ foo
2030 ! | bar
2031 |}
2032 !!result
2033 <table>
2034 <caption> foo
2035 </caption>
2036 <tr>
2037 <th> bar
2038 </th></tr></table>
2039
2040 !!end
2041
2042 !!test
2043 3a. Indent-Pre and block tags (single-line html)
2044 !!input
2045 <p> foo </p>
2046 <div> foo </div>
2047 <blockquote> foo </blockquote>
2048 <span> foo </span>
2049 !!result
2050 <p> foo </p>
2051 <div> foo </div>
2052 <blockquote> foo </blockquote>
2053 <pre><span> foo </span>
2054 </pre>
2055 !!end
2056
2057 !!test
2058 3b. Indent-Pre and block tags (pre-content on separate line)
2059 !!input
2060 <p>
2061 foo
2062 </p>
2063
2064 <div>
2065 foo
2066 </div>
2067
2068 <center>
2069 foo
2070 </center>
2071
2072 <blockquote>
2073 foo
2074 </blockquote>
2075
2076 <blockquote>
2077 <pre>
2078 foo
2079 </pre>
2080 </blockquote>
2081
2082 <table><tr><td>
2083 foo
2084 </td></tr></table>
2085
2086 <ul><li>
2087 foo
2088 </li></ul>
2089
2090 !!result
2091 <p>
2092 foo
2093 </p>
2094 <div>
2095 <pre>foo
2096 </pre>
2097 </div>
2098 <center>
2099 <pre>foo
2100 </pre>
2101 </center>
2102 <blockquote>
2103 <p> foo
2104 </p>
2105 </blockquote>
2106 <blockquote>
2107 <pre>
2108 foo
2109 </pre>
2110 </blockquote>
2111 <table><tr><td>
2112 <pre>foo
2113 </pre>
2114 </td></tr></table>
2115 <ul><li>
2116 foo
2117 </li></ul>
2118
2119 !!end
2120
2121 !!test
2122 4. Multiple spaces at start-of-line
2123 !!input
2124 <p> foo </p>
2125 foo
2126 {|
2127 |foo
2128 |}
2129 !!result
2130 <p> foo </p>
2131 <pre> foo
2132 </pre>
2133 <table>
2134 <tr>
2135 <td>foo
2136 </td></tr></table>
2137
2138 !!end
2139
2140 !! test
2141 5. White-space in indent-pre
2142 NOTE: the white-space char on 2nd line is significant
2143 !! input
2144 a<br/>
2145
2146 b
2147 !! result
2148 <pre>a<br />
2149
2150 b
2151 </pre>
2152 !! end
2153
2154 !! test
2155 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2156 !! input
2157 a
2158
2159 <!-- continue -->
2160 b
2161
2162 c
2163
2164 d
2165 !! result
2166 <pre>a
2167
2168 b
2169 </pre>
2170 <pre>c
2171
2172 </pre>
2173 <p>d
2174 </p>
2175 !! end
2176
2177 !! test
2178 7a. Indent-pre and category links
2179 !! options
2180 parsoid=wt2html,wt2wt
2181 !! input
2182 [[Category:foo]] <!-- No pre-wrapping -->
2183 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2184 !! result
2185 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
2186 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span>
2187 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
2188 !! end
2189
2190 !! test
2191 7b. Indent-pre and category links
2192 !! options
2193 parsoid=wt2html,wt2wt
2194 !! input
2195 [[Category:foo]] a
2196 [[Category:foo]] {{echo|b}}
2197 !! result
2198 <pre>
2199 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
2200
2201 <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>
2202 !! end
2203
2204 ###
2205 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2206 ###
2207
2208 !!test
2209 HTML-pre: 1. embedded newlines
2210 !!input
2211 <pre>foo</pre>
2212
2213 <pre>
2214 foo
2215 </pre>
2216
2217 <pre>
2218
2219 foo
2220 </pre>
2221
2222 <pre>
2223
2224
2225 foo
2226 </pre>
2227 !!result
2228 <pre>foo</pre>
2229 <pre>
2230 foo
2231 </pre>
2232 <pre>
2233
2234 foo
2235 </pre>
2236 <pre>
2237
2238
2239 foo
2240 </pre>
2241
2242 !!end
2243
2244 !!test
2245 HTML-pre: 2: indented text
2246 !!input
2247 <pre>
2248 foo
2249 </pre>
2250 !!result
2251 <pre>
2252 foo
2253 </pre>
2254
2255 !!end
2256
2257 !!test
2258 HTML-pre: 3: other wikitext
2259 !!input
2260 <pre>
2261 * foo
2262 # bar
2263 = no-h =
2264 '' no-italic ''
2265 [[ NoLink ]]
2266 </pre>
2267 !!result
2268 <pre>
2269 * foo
2270 # bar
2271 = no-h =
2272 '' no-italic ''
2273 [[ NoLink ]]
2274 </pre>
2275
2276 !!end
2277
2278 ###
2279 ### Definition lists
2280 ###
2281 !! test
2282 Simple definition
2283 !! input
2284 ; name : Definition
2285 !! result
2286 <dl>
2287 <dt> name&#160;</dt>
2288 <dd> Definition
2289 </dd>
2290 </dl>
2291
2292 !! end
2293
2294 !! test
2295 Definition list for indentation only
2296 !! input
2297 : Indented text
2298 !! result
2299 <dl>
2300 <dd> Indented text
2301 </dd>
2302 </dl>
2303
2304 !! end
2305
2306 !! test
2307 Definition list with no space
2308 !! input
2309 ;name:Definition
2310 !! result
2311 <dl>
2312 <dt>name</dt>
2313 <dd>Definition
2314 </dd>
2315 </dl>
2316
2317 !!end
2318
2319 !! test
2320 Definition list with URL link
2321 !! input
2322 ; http://example.com/ : definition
2323 !! result
2324 <dl>
2325 <dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
2326 <dd> definition
2327 </dd>
2328 </dl>
2329
2330 !! end
2331
2332 !! test
2333 Definition list with bracketed URL link
2334 !! input
2335 ;[http://www.example.com/ Example]:Something about it
2336 !! result
2337 <dl>
2338 <dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
2339 <dd>Something about it
2340 </dd>
2341 </dl>
2342
2343 !! end
2344
2345 !! test
2346 Definition list with wikilink containing colon
2347 !! input
2348 ; [[Help:FAQ]]: The least-read page on Wikipedia
2349 !! result
2350 <dl>
2351 <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>
2352 <dd> The least-read page on Wikipedia
2353 </dd>
2354 </dl>
2355
2356 !! end
2357
2358 # At Brion's and JeLuF's insistence... :)
2359 !! test
2360 Definition list with news link containing colon
2361 !! input
2362 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
2363 !! result
2364 <dl>
2365 <dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
2366 <dd> This isn't even a real newsgroup!
2367 </dd>
2368 </dl>
2369
2370 !! end
2371
2372 !! test
2373 Malformed definition list with colon
2374 !! input
2375 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2376 !! result
2377 <dl>
2378 <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
2379 </dt>
2380 </dl>
2381
2382 !! end
2383
2384 !! test
2385 Definition lists: colon in external link text
2386 !! input
2387 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2388 !! result
2389 <dl>
2390 <dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
2391 <dd> OK, I made that up
2392 </dd>
2393 </dl>
2394
2395 !! end
2396
2397 !! test
2398 Definition lists: colon in HTML attribute
2399 !! input
2400 ;<b style="display: inline">bold</b>
2401 !! result
2402 <dl>
2403 <dt><b style="display: inline">bold</b>
2404 </dt>
2405 </dl>
2406
2407 !! end
2408
2409 !! test
2410 Definition lists: self-closed tag
2411 !! input
2412 ;one<br/>two : two-line fun
2413 !! result
2414 <dl>
2415 <dt>one<br />two&#160;</dt>
2416 <dd> two-line fun
2417 </dd>
2418 </dl>
2419
2420 !! end
2421
2422 !! test
2423 Bug 11748: Literal closing tags
2424 !! input
2425 <dl>
2426 <dt>test 1</dt>
2427 <dd>test test test test test</dd>
2428 <dt>test 2</dt>
2429 <dd>test test test test test</dd>
2430 </dl>
2431 !! result
2432 <dl>
2433 <dt>test 1</dt>
2434 <dd>test test test test test</dd>
2435 <dt>test 2</dt>
2436 <dd>test test test test test</dd>
2437 </dl>
2438
2439 !! end
2440
2441 !! test
2442 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2443 !! input
2444 <ul><li>
2445 ; term : description
2446 * unordered
2447 </li></ul>
2448 !! result
2449 <ul><li>
2450 <dl>
2451 <dt> term&#160;</dt>
2452 <dd> description
2453 </dd>
2454 </dl>
2455 <ul>
2456 <li> unordered
2457 </li>
2458 </ul>
2459 </li></ul>
2460
2461 !! end
2462
2463 !! test
2464
2465 Definition list with empty definition and following paragraph
2466 !! input
2467 ; term:
2468 Paragraph text
2469 !! result
2470 <dl>
2471 <dt> term</dt>
2472 <dd>
2473 </dd>
2474 </dl>
2475 <p>Paragraph text
2476 </p>
2477 !! end
2478
2479 !! test
2480 Nested definition lists using html syntax
2481 !! input
2482 <dl><dd>
2483 <dl>
2484 <dd>Foo</dd>
2485 </dl>
2486 </dd></dl>
2487 !! result
2488 <dl><dd>
2489 <dl>
2490 <dd>Foo</dd>
2491 </dl>
2492 </dd></dl>
2493
2494 !! end
2495
2496 !! test
2497 Definition Lists: No nesting: Multiple dd's
2498 !! input
2499 ;x
2500 :a
2501 :b
2502 !! result
2503 <dl>
2504 <dt>x
2505 </dt>
2506 <dd>a
2507 </dd>
2508 <dd>b
2509 </dd>
2510 </dl>
2511
2512 !! end
2513
2514 !! test
2515 Definition Lists: Indentation: Regular
2516 !! input
2517 :i1
2518 ::i2
2519 :::i3
2520 !! result
2521 <dl>
2522 <dd>i1
2523 <dl>
2524 <dd>i2
2525 <dl>
2526 <dd>i3
2527 </dd>
2528 </dl>
2529 </dd>
2530 </dl>
2531 </dd>
2532 </dl>
2533
2534 !! end
2535
2536 !! test
2537 Definition Lists: Indentation: Missing 1st level
2538 !! input
2539 ::i2
2540 :::i3
2541 !! result
2542 <dl>
2543 <dd><dl>
2544 <dd>i2
2545 <dl>
2546 <dd>i3
2547 </dd>
2548 </dl>
2549 </dd>
2550 </dl>
2551 </dd>
2552 </dl>
2553
2554 !! end
2555
2556 !! test
2557 Definition Lists: Indentation: Multi-level indent
2558 !! input
2559 :::i3
2560 !! result
2561 <dl>
2562 <dd><dl>
2563 <dd><dl>
2564 <dd>i3
2565 </dd>
2566 </dl>
2567 </dd>
2568 </dl>
2569 </dd>
2570 </dl>
2571
2572 !! end
2573
2574 !! test
2575 Definition Lists: Hacky use to indent tables
2576 !! input
2577 ::{|
2578 |foo
2579 |bar
2580 |}
2581 this text
2582 should be left alone
2583 !! result
2584 <dl><dd><dl><dd><table>
2585 <tr>
2586 <td>foo
2587 </td>
2588 <td>bar
2589 </td></tr></table></dd></dl></dd></dl>
2590 <p>this text
2591 should be left alone
2592 </p>
2593 !! end
2594
2595 # Bug 52473
2596 !! test
2597 Definition Lists: Hacky use to indent tables (WS-insensitive)
2598 !! options
2599 parsoid
2600 !! input
2601 : {|
2602 |a
2603 |}
2604 !! result
2605 <dl>
2606 <dd> <table><tr><td>a</td></tr></table> </dd>
2607 </dl>
2608 !! end
2609 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2610 ## as an empty dt item. It also ignores all but the last ";" when followed
2611 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2612 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2613 ## ";"s.
2614 ##
2615 ## Ex: ";;t2 ::d2" is transformed into:
2616 ##
2617 ## <dl>
2618 ## <dt>t2 </dt>
2619 ## <dd>
2620 ## <dl>
2621 ## <dt></dt>
2622 ## <dd>d2</dd>
2623 ## </dl>
2624 ## </dd>
2625 ## </dl>
2626 ##
2627 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2628 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2629 ##
2630 ## <dl>
2631 ## <dt>
2632 ## <dl>
2633 ## <dt>t2 </dt>
2634 ## <dd>:d2</dd>
2635 ## </dl>
2636 ## </dt>
2637 ## </dl>
2638 ##
2639 ## All Parsoid only definition list tests have this difference.
2640 ##
2641 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2642 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2643
2644 !! test
2645 Table / list interaction: indented table with lists in table contents
2646 !! input
2647 :{|
2648 |-
2649 | a
2650 * b
2651 |-
2652 | c
2653 * d
2654 |}
2655 !! result
2656 <dl><dd><table>
2657
2658 <tr>
2659 <td> a
2660 <ul>
2661 <li> b
2662 </li>
2663 </ul>
2664 </td></tr>
2665 <tr>
2666 <td> c
2667 <ul>
2668 <li> d
2669 </li>
2670 </ul>
2671 </td></tr></table></dd></dl>
2672
2673 !! end
2674
2675 !!test
2676 Table / list interaction: lists nested in tables nested in indented lists
2677 !!input
2678 :{|
2679 |
2680 :a
2681 :b
2682 |
2683 *c
2684 *d
2685 |}
2686
2687 *e
2688 *f
2689 !!result
2690 <dl><dd><table>
2691 <tr>
2692 <td>
2693 <dl>
2694 <dd>a
2695 </dd>
2696 <dd>b
2697 </dd>
2698 </dl>
2699 </td>
2700 <td>
2701 <ul>
2702 <li>c
2703 </li>
2704 <li>d
2705 </li>
2706 </ul>
2707 </td></tr></table></dd></dl>
2708 <ul>
2709 <li>e
2710 </li>
2711 <li>f
2712 </li>
2713 </ul>
2714
2715 !!end
2716
2717 !! test
2718 Definition Lists: Nesting: Multi-level (Parsoid only)
2719 !! options
2720 parsoid
2721 !! input
2722 ;t1 :d1
2723 ;;t2 ::d2
2724 ;;;t3 :::d3
2725 !! result
2726 <dl>
2727 <dt>t1 </dt>
2728 <dd>d1</dd>
2729 <dt>
2730 <dl>
2731 <dt>t2 </dt>
2732 <dd>:d2</dd>
2733 <dt>
2734 <dl>
2735 <dt>t3 </dt>
2736 <dd>::d3</dd>
2737 </dl>
2738 </dt>
2739 </dl>
2740 </dt>
2741 </dl>
2742
2743
2744 !! end
2745
2746
2747 !! test
2748 Definition Lists: Nesting: Test 2 (Parsoid only)
2749 !! options
2750 parsoid
2751 !! input
2752 ;t1
2753 ::d2
2754 !! result
2755 <dl>
2756 <dt>t1</dt>
2757 <dd>
2758 <dl>
2759 <dd>d2</dd>
2760 </dl>
2761 </dd>
2762 </dl>
2763
2764 !! end
2765
2766
2767 !! test
2768 Definition Lists: Nesting: Test 3 (Parsoid only)
2769 !! options
2770 parsoid
2771 !! input
2772 :;t1
2773 ::::d2
2774 !! result
2775 <dl>
2776 <dd>
2777 <dl>
2778 <dt>t1</dt>
2779 <dd>
2780 <dl>
2781 <dd>
2782 <dl>
2783 <dd>d2</dd>
2784 </dl>
2785 </dd>
2786 </dl>
2787 </dd>
2788 </dl>
2789 </dd>
2790 </dl>
2791
2792 !! end
2793
2794
2795 !! test
2796 Definition Lists: Nesting: Test 4
2797 !! input
2798 ::;t3
2799 :::d3
2800 !! result
2801 <dl>
2802 <dd><dl>
2803 <dd><dl>
2804 <dt>t3
2805 </dt>
2806 <dd>d3
2807 </dd>
2808 </dl>
2809 </dd>
2810 </dl>
2811 </dd>
2812 </dl>
2813
2814 !! end
2815
2816
2817 ## The Parsoid team believes the following three test exposes a
2818 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2819 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2820 !! test
2821 Definition Lists: Mixed Lists: Test 1 (php)
2822 !! options
2823 php
2824 !! input
2825 :;* foo
2826 ::* bar
2827 :; baz
2828 !! result
2829 <dl>
2830 <dd><dl>
2831 <dt><ul>
2832 <li> foo
2833 </li>
2834 <li> bar
2835 </li>
2836 </ul>
2837 </dt>
2838 </dl>
2839 <dl>
2840 <dt> baz
2841 </dt>
2842 </dl>
2843 </dd>
2844 </dl>
2845
2846 !! end
2847 !! test
2848 Definition Lists: Mixed Lists: Test 1 (parsoid)
2849 !! options
2850 parsoid
2851 !! input
2852 :;* foo
2853 ::* bar
2854 :; baz
2855 !! result
2856 <dl>
2857 <dd><dl>
2858 <dt><ul>
2859 <li> foo
2860 </li>
2861 </ul></dt>
2862 <dd><ul>
2863 <li> bar
2864 </li>
2865 </ul></dd>
2866 <dt> baz</dt>
2867 </dl></dd>
2868 </dl>
2869 !! end
2870
2871 !! test
2872 Definition Lists: Mixed Lists: Test 2
2873 !! input
2874 *: d1
2875 *: d2
2876 !! result
2877 <ul>
2878 <li><dl>
2879 <dd> d1
2880 </dd>
2881 <dd> d2
2882 </dd>
2883 </dl>
2884 </li>
2885 </ul>
2886
2887 !! end
2888
2889
2890 !! test
2891 Definition Lists: Mixed Lists: Test 3
2892 !! input
2893 *::: d1
2894 *::: d2
2895 !! result
2896 <ul>
2897 <li><dl>
2898 <dd><dl>
2899 <dd><dl>
2900 <dd> d1
2901 </dd>
2902 <dd> d2
2903 </dd>
2904 </dl>
2905 </dd>
2906 </dl>
2907 </dd>
2908 </dl>
2909 </li>
2910 </ul>
2911
2912 !! end
2913
2914
2915 !! test
2916 Definition Lists: Mixed Lists: Test 4
2917 !! input
2918 *;d1 :d2
2919 *;d3 :d4
2920 !! result
2921 <ul>
2922 <li><dl>
2923 <dt>d1&#160;</dt>
2924 <dd>d2
2925 </dd>
2926 <dt>d3&#160;</dt>
2927 <dd>d4
2928 </dd>
2929 </dl>
2930 </li>
2931 </ul>
2932
2933 !! end
2934
2935
2936 !! test
2937 Definition Lists: Mixed Lists: Test 5
2938 !! input
2939 *:d1
2940 *:: d2
2941 !! result
2942 <ul>
2943 <li><dl>
2944 <dd>d1
2945 <dl>
2946 <dd> d2
2947 </dd>
2948 </dl>
2949 </dd>
2950 </dl>
2951 </li>
2952 </ul>
2953
2954 !! end
2955
2956
2957 !! test
2958 Definition Lists: Mixed Lists: Test 6
2959 !! input
2960 #*:d1
2961 #*::: d3
2962 !! result
2963 <ol>
2964 <li><ul>
2965 <li><dl>
2966 <dd>d1
2967 <dl>
2968 <dd><dl>
2969 <dd> d3
2970 </dd>
2971 </dl>
2972 </dd>
2973 </dl>
2974 </dd>
2975 </dl>
2976 </li>
2977 </ul>
2978 </li>
2979 </ol>
2980
2981 !! end
2982
2983
2984 !! test
2985 Definition Lists: Mixed Lists: Test 7
2986 !! input
2987 :* d1
2988 :* d2
2989 !! result
2990 <dl>
2991 <dd><ul>
2992 <li> d1
2993 </li>
2994 <li> d2
2995 </li>
2996 </ul>
2997 </dd>
2998 </dl>
2999
3000 !! end
3001
3002
3003 !! test
3004 Definition Lists: Mixed Lists: Test 8
3005 !! input
3006 :* d1
3007 ::* d2
3008 !! result
3009 <dl>
3010 <dd><ul>
3011 <li> d1
3012 </li>
3013 </ul>
3014 <dl>
3015 <dd><ul>
3016 <li> d2
3017 </li>
3018 </ul>
3019 </dd>
3020 </dl>
3021 </dd>
3022 </dl>
3023
3024 !! end
3025
3026
3027 !! test
3028 Definition Lists: Mixed Lists: Test 9
3029 !! input
3030 *;foo :bar
3031 !! result
3032 <ul>
3033 <li><dl>
3034 <dt>foo&#160;</dt>
3035 <dd>bar
3036 </dd>
3037 </dl>
3038 </li>
3039 </ul>
3040
3041 !! end
3042
3043
3044 !! test
3045 Definition Lists: Mixed Lists: Test 10
3046 !! input
3047 *#;foo :bar
3048 !! result
3049 <ul>
3050 <li><ol>
3051 <li><dl>
3052 <dt>foo&#160;</dt>
3053 <dd>bar
3054 </dd>
3055 </dl>
3056 </li>
3057 </ol>
3058 </li>
3059 </ul>
3060
3061 !! end
3062
3063 # The Parsoid team disagrees with the PHP parser's seemingly-random
3064 # rules regarding dd/dt on the next two tests. Parsoid is more
3065 # consistent, and recognizes the shared nesting and keeps the
3066 # still-open tags around until the nesting is complete.
3067
3068 !! test
3069 Definition Lists: Mixed Lists: Test 11 (php)
3070 !! options
3071 php
3072 !! input
3073 *#*#;*;;foo :bar
3074 *#*#;boo :baz
3075 !! result
3076 <ul>
3077 <li><ol>
3078 <li><ul>
3079 <li><ol>
3080 <li><dl>
3081 <dt>foo&#160;</dt>
3082 <dd><ul>
3083 <li><dl>
3084 <dt><dl>
3085 <dt>bar
3086 </dt>
3087 </dl>
3088 </dd>
3089 </dl>
3090 </li>
3091 </ul>
3092 </dd>
3093 </dl>
3094 <dl>
3095 <dt>boo&#160;</dt>
3096 <dd>baz
3097 </dd>
3098 </dl>
3099 </li>
3100 </ol>
3101 </li>
3102 </ul>
3103 </li>
3104 </ol>
3105 </li>
3106 </ul>
3107
3108 !! end
3109 !! test
3110 Definition Lists: Mixed Lists: Test 11 (parsoid)
3111 !! options
3112 parsoid
3113 !! input
3114 *#*#;*;;foo :bar
3115 *#*#;boo :baz
3116 !! result
3117 <ul>
3118 <li>
3119 <ol>
3120 <li>
3121 <ul>
3122 <li>
3123 <ol>
3124 <li>
3125 <dl>
3126 <dt>
3127 <ul>
3128 <li>
3129 <dl>
3130 <dt>
3131 <dl>
3132 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3133 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3134 </dl></dt>
3135 </dl></li>
3136 </ul></dt>
3137 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3138 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3139 </dl></li>
3140 </ol></li>
3141 </ul></li>
3142 </ol></li>
3143 </ul>
3144 !! end
3145
3146
3147 !! test
3148 Definition Lists: Weird Ones: Test 1 (php)
3149 !! options
3150 php
3151 !! input
3152 *#;*::;; foo : bar (who uses this?)
3153 !! result
3154 <ul>
3155 <li><ol>
3156 <li><dl>
3157 <dt> foo&#160;</dt>
3158 <dd><ul>
3159 <li><dl>
3160 <dd><dl>
3161 <dd><dl>
3162 <dt><dl>
3163 <dt> bar (who uses this?)
3164 </dt>
3165 </dl>
3166 </dd>
3167 </dl>
3168 </dd>
3169 </dl>
3170 </dd>
3171 </dl>
3172 </li>
3173 </ul>
3174 </dd>
3175 </dl>
3176 </li>
3177 </ol>
3178 </li>
3179 </ul>
3180
3181 !! end
3182 !! test
3183 Definition Lists: Weird Ones: Test 1 (parsoid)
3184 !! options
3185 parsoid
3186 !! input
3187 *#;*::;; foo : bar (who uses this?)
3188 !! result
3189 <ul>
3190 <li>
3191 <ol>
3192 <li>
3193 <dl>
3194 <dt>
3195 <ul>
3196 <li>
3197 <dl>
3198 <dd>
3199 <dl>
3200 <dd>
3201 <dl>
3202 <dt>
3203 <dl>
3204 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3205 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3206 </dl></dt>
3207 </dl></dd>
3208 </dl></dd>
3209 </dl></li>
3210 </ul></dt>
3211 </dl></li>
3212 </ol></li>
3213 </ul>
3214 !! end
3215
3216 ###
3217 ### External links
3218 ###
3219 !! test
3220 External links: non-bracketed
3221 !! input
3222 Non-bracketed: http://example.com
3223 !! result
3224 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3225 </p>
3226 !! end
3227
3228 !! test
3229 External links: numbered
3230 !! input
3231 Numbered: [http://example.com]
3232 Numbered: [http://example.net]
3233 Numbered: [http://example.com]
3234 !! result
3235 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
3236 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
3237 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
3238 </p>
3239 !!end
3240
3241 !! test
3242 External links: specified text
3243 !! input
3244 Specified text: [http://example.com link]
3245 !! result
3246 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
3247 </p>
3248 !!end
3249
3250 !! test
3251 External links: trail
3252 !! input
3253 Linktrails should not work for external links: [http://example.com link]s
3254 !! result
3255 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
3256 </p>
3257 !! end
3258
3259 !! test
3260 External links: dollar sign in URL
3261 !! input
3262 http://example.com/1$2345
3263 !! result
3264 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
3265 </p>
3266 !! end
3267
3268 !! test
3269 External links: dollar sign in URL (named)
3270 !! input
3271 [http://example.com/1$2345]
3272 !! result
3273 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
3274 </p>
3275 !!end
3276
3277 !! test
3278 External links: open square bracket forbidden in URL (bug 4377)
3279 !! input
3280 http://example.com/1[2345
3281 !! result
3282 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
3283 </p>
3284 !! end
3285
3286 !! test
3287 External links: open square bracket forbidden in URL (named) (bug 4377)
3288 !! input
3289 [http://example.com/1[2345]
3290 !! result
3291 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3292 </p>
3293 !!end
3294
3295 !! test
3296 External links: nowiki in URL link text (bug 6230)
3297 !!input
3298 [http://example.com/ <nowiki>''example site''</nowiki>]
3299 !! result
3300 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
3301 </p>
3302 !! end
3303
3304 !! test
3305 External links: newline forbidden in text (bug 6230 regression check)
3306 !! input
3307 [http://example.com/ first
3308 second]
3309 !! result
3310 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
3311 second]
3312 </p>
3313 !!end
3314
3315 !! test
3316 External links: Pipe char between url and text
3317 !! input
3318 [http://example.com | link]
3319 !! result
3320 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
3321 </p>
3322 !!end
3323
3324 !! test
3325 External links: protocol-relative URL in brackets
3326 !! input
3327 [//example.com/ Test]
3328 !! result
3329 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
3330 </p>
3331 !! end
3332
3333 !! test
3334 External links: protocol-relative URL in brackets without text
3335 !! input
3336 [//example.com]
3337 !! result
3338 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
3339 </p>
3340 !! end
3341
3342 !! test
3343 External links: protocol-relative URL in free text is left alone
3344 !! input
3345 //example.com/Foo
3346 !! result
3347 <p>//example.com/Foo
3348 </p>
3349 !!end
3350
3351 !! test
3352 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
3353 !! input
3354 foo//example.com/Foo
3355 !! result
3356 <p>foo//example.com/Foo
3357 </p>
3358 !! end
3359
3360 !! test
3361 External image
3362 !! input
3363 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3364 !! result
3365 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3366 </p>
3367 !! end
3368
3369 !! test
3370 External image from https
3371 !! input
3372 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3373 !! result
3374 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3375 </p>
3376 !! end
3377
3378 !! test
3379 External image (when not allowed)
3380 !! options
3381 wgAllowExternalImages=0
3382 !! input
3383 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3384 !! result
3385 <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>
3386 </p>
3387 !! end
3388
3389 !! test
3390 Link to non-http image, no img tag
3391 !! input
3392 Link to non-http image, no img tag: ftp://example.com/test.jpg
3393 !! result
3394 <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>
3395 </p>
3396 !! end
3397
3398 !! test
3399 External links: terminating separator
3400 !! input
3401 Terminating separator: http://example.com/thing,
3402 !! result
3403 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
3404 </p>
3405 !! end
3406
3407 !! test
3408 External links: intervening separator
3409 !! input
3410 Intervening separator: http://example.com/1,2,3
3411 !! result
3412 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
3413 </p>
3414 !! end
3415
3416 !! test
3417 External links: old bug with URL in query
3418 !! input
3419 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
3420 !! result
3421 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
3422 </p>
3423 !! end
3424
3425 !! test
3426 External links: old URL-in-URL bug, mixed protocols
3427 !! input
3428 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
3429 !! result
3430 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
3431 </p>
3432 !!end
3433
3434 !! test
3435 External links: URL in text
3436 !! input
3437 URL in text: [http://example.com http://example.com]
3438 !! result
3439 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3440 </p>
3441 !! end
3442
3443 !! test
3444 External links: Clickable images
3445 !! input
3446 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
3447 !! result
3448 <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>
3449 </p>
3450 !!end
3451
3452 !! test
3453 External links: raw ampersand
3454 !! input
3455 Old &amp; use: http://x&y
3456 !! result
3457 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3458 </p>
3459 !! end
3460
3461 !! test
3462 External links: encoded ampersand
3463 !! input
3464 Old &amp; use: http://x&amp;y
3465 !! result
3466 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3467 </p>
3468 !! end
3469
3470 !! test
3471 External links: encoded equals (bug 6102)
3472 !! input
3473 http://example.com/?foo&#61;bar
3474 !! result
3475 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
3476 </p>
3477 !! end
3478
3479 !! test
3480 External links: [raw ampersand]
3481 !! input
3482 Old &amp; use: [http://x&y]
3483 !! result
3484 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3485 </p>
3486 !! end
3487
3488 !! test
3489 External links: [encoded ampersand]
3490 !! input
3491 Old &amp; use: [http://x&amp;y]
3492 !! result
3493 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3494 </p>
3495 !! end
3496
3497 !! test
3498 External links: [encoded equals] (bug 6102)
3499 !! input
3500 [http://example.com/?foo&#61;bar]
3501 !! result
3502 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3503 </p>
3504 !! end
3505
3506 !! test
3507 External links: [IDN ignored character reference in hostname; strip it right off]
3508 !! input
3509 [http://e&zwnj;xample.com/]
3510 !! result
3511 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
3512 </p>
3513 !! end
3514
3515 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
3516 # Where an external link could easily circumvent the sanitization of the text of
3517 # a link like this (where an IDN-ignore character is in the URL somewhere), this
3518 # test demands a higher standard. That's a bit strange.
3519 #
3520 # Example:
3521 #
3522 # http://e‌xample.com -> [http://example.com|http://example.com]
3523 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
3524 #
3525 # The first example is sanitized, but the second is not. Any security benefits
3526 # from this production are trivial to circumvent. Either remove this test and
3527 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
3528 # the test accordingly.
3529 #
3530 # All our love,
3531 # The Parsoid team.
3532 !! test
3533 External links: IDN ignored character reference in hostname; strip it right off
3534 !! input
3535 http://e&zwnj;xample.com/
3536 !! result
3537 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
3538 </p>
3539 !! end
3540
3541 !! test
3542 External links: www.jpeg.org (bug 554)
3543 !! input
3544 http://www.jpeg.org
3545 !!result
3546 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
3547 </p>
3548 !! end
3549
3550 !! test
3551 External links: URL within URL (original bug 2)
3552 !! input
3553 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
3554 !! result
3555 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
3556 </p>
3557 !! end
3558
3559 !! test
3560 BUG 361: URL inside bracketed URL
3561 !! input
3562 [http://www.example.com/foo http://www.example.com/bar]
3563 !! result
3564 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
3565 </p>
3566 !! end
3567
3568 !! test
3569 BUG 361: URL within URL, not bracketed
3570 !! input
3571 http://www.example.com/foo?=http://www.example.com/bar
3572 !! result
3573 <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>
3574 </p>
3575 !! end
3576
3577 !! test
3578 BUG 289: ">"-token in URL-tail
3579 !! input
3580 http://www.example.com/<hello>
3581 !! result
3582 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
3583 </p>
3584 !!end
3585
3586 !! test
3587 BUG 289: literal ">"-token in URL-tail
3588 !! input
3589 http://www.example.com/<b>html</b>
3590 !! result
3591 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
3592 </p>
3593 !!end
3594
3595 !! test
3596 BUG 289: ">"-token in bracketed URL
3597 !! input
3598 [http://www.example.com/<hello> stuff]
3599 !! result
3600 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
3601 </p>
3602 !!end
3603
3604 !! test
3605 BUG 289: literal ">"-token in bracketed URL
3606 !! input
3607 [http://www.example.com/<b>html</b> stuff]
3608 !! result
3609 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
3610 </p>
3611 !!end
3612
3613 !! test
3614 BUG 289: literal double quote at end of URL
3615 !! input
3616 http://www.example.com/"hello"
3617 !! result
3618 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
3619 </p>
3620 !!end
3621
3622 !! test
3623 BUG 289: literal double quote in bracketed URL
3624 !! input
3625 [http://www.example.com/"hello" stuff]
3626 !! result
3627 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
3628 </p>
3629 !!end
3630
3631 !! test
3632 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
3633 !! input
3634 [http://www.example.com test]
3635 !! result
3636 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3637 </p>
3638 !! end
3639
3640 !! test
3641 External links: link text with spaces
3642 !! input
3643 [http://www.example.com a b c]
3644 [http://www.example.com ''a'' ''b'']
3645 !! result
3646 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3647 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3648 </p>
3649 !! end
3650
3651 !! test
3652 External links: wiki links within external link (Bug 3695)
3653 !! options
3654 php
3655 !! input
3656 [http://example.com [[wikilink]] embedded in ext link]
3657 !! result
3658 <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>
3659 </p>
3660 !! end
3661
3662 !! test
3663 Parsoid: External links: wiki links within external link (Bug 3695)
3664 !! options
3665 parsoid
3666 !! input
3667 [http://example.com [[wikilink]] embedded in ext link]
3668 !! result
3669 <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>
3670 !! end
3671
3672 !! test
3673 BUG 787: Links with one slash after the url protocol are invalid
3674 !! input
3675 http:/example.com
3676
3677 [http:/example.com title]
3678 !! result
3679 <p>http:/example.com
3680 </p><p>[http:/example.com title]
3681 </p>
3682 !! end
3683
3684 !! test
3685 Bracketed external links with template-generated invalid target
3686 !! input
3687 [{{echo|http:/example.com}} title]
3688 !! result
3689 <p>[http:/example.com title]
3690 </p>
3691 !! end
3692
3693 !! test
3694 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3695 !! input
3696 ''[http://example.com text'']
3697 [http://example.com '''text]'''
3698 ''Something [http://example.com in italic'']
3699 ''Something [http://example.com mixed''''', even bold]'''
3700 '''''Now [http://example.com both''''']
3701 !! result
3702 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3703 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3704 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3705 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3706 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3707 </p>
3708 !! end
3709
3710
3711 !! test
3712 Bug 4781: %26 in URL
3713 !! input
3714 http://www.example.com/?title=AT%26T
3715 !! result
3716 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3717 </p>
3718 !! end
3719
3720 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3721 # % is actually legal in HTML5. Any change in output would need testing though.
3722 !! test
3723 Bug 4781, 5267: %25 in URL
3724 !! input
3725 http://www.example.com/?title=100%25_Bran
3726 !! result
3727 <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>
3728 </p>
3729 !! end
3730
3731 !! test
3732 Bug 4781, 5267: %28, %29 in URL
3733 !! input
3734 http://www.example.com/?title=Ben-Hur_%281959_film%29
3735 !! result
3736 <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>
3737 </p>
3738 !! end
3739
3740
3741 !! test
3742 Bug 4781: %26 in autonumber URL
3743 !! input
3744 [http://www.example.com/?title=AT%26T]
3745 !! result
3746 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3747 </p>
3748 !! end
3749
3750 !! test
3751 Bug 4781, 5267: %26 in autonumber URL
3752 !! input
3753 [http://www.example.com/?title=100%25_Bran]
3754 !! result
3755 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3756 </p>
3757 !! end
3758
3759 !! test
3760 Bug 4781, 5267: %28, %29 in autonumber URL
3761 !! input
3762 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3763 !! result
3764 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3765 </p>
3766 !! end
3767
3768
3769 !! test
3770 Bug 4781: %26 in bracketed URL
3771 !! input
3772 [http://www.example.com/?title=AT%26T link]
3773 !! result
3774 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3775 </p>
3776 !! end
3777
3778 !! test
3779 Bug 4781, 5267: %26 in bracketed URL
3780 !! input
3781 [http://www.example.com/?title=100%25_Bran link]
3782 !! result
3783 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3784 </p>
3785 !! end
3786
3787 !! test
3788 Bug 4781, 5267: %28, %29 in bracketed URL
3789 !! input
3790 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3791 !! result
3792 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3793 </p>
3794 !! end
3795
3796 !! test
3797 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3798 !! input
3799 Some [http://example.com/ pretty ''italics'' and stuff]!
3800 !! result
3801 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3802 </p>
3803 !! end
3804
3805 !! test
3806 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3807 !! input
3808 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3809 !! result
3810 <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>
3811 </p>
3812 !! end
3813
3814 !! test
3815 External link containing double-single-quotes with no space separating the url from text in italics
3816 !! options
3817 php
3818 !! input
3819 [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]].]
3820 !! result
3821 <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>
3822 </p>
3823 !! end
3824
3825 !! test
3826 Parsoid:External link containing double-single-quotes with no space separating the url from text in italics
3827 !! options
3828 parsoid
3829 !! input
3830 [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]].]
3831 !! result
3832 <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>
3833 !! end
3834
3835 !! test
3836 External link with comments in link text
3837 !! input
3838 [http://www.google.com Google <!-- comment -->]
3839 !! result
3840 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3841 </p>
3842 !! end
3843
3844 !! test
3845 URL-encoding in URL functions (single parameter)
3846 !! input
3847 {{localurl:Some page|amp=&}}
3848 !! result
3849 <p>/index.php?title=Some_page&amp;amp=&amp;
3850 </p>
3851 !! end
3852
3853 !! test
3854 URL-encoding in URL functions (multiple parameters)
3855 !! input
3856 {{localurl:Some page|q=?&amp=&}}
3857 !! result
3858 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3859 </p>
3860 !! end
3861
3862 !! test
3863 Brackets in urls
3864 !! input
3865 http://example.com/index.php?foozoid%5B%5D=bar
3866
3867 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3868 !! result
3869 <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>
3870 </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>
3871 </p>
3872 !! end
3873
3874 !! test
3875 IPv6 urls (bug 21261)
3876 !! options
3877 disabled
3878 !! input
3879 http://[2404:130:0:1000::187:2]/index.php
3880 !! result
3881 <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>
3882 </p>
3883 !! end
3884
3885 !! test
3886 Non-extlinks in brackets
3887 !! input
3888 [foo]
3889 [foo bar]
3890 [foo ''bar'']
3891 [fool's] errand
3892 [fool's errand]
3893 [{{echo|foo}}]
3894 [{{echo|foo}} bar]
3895 [{{echo|foo}} ''bar'']
3896 [{{echo|foo}}l's] errand
3897 [{{echo|foo}}l's errand]
3898 [url={{echo|foo}}]
3899 [url=http://example.com]
3900 !! result
3901 <p>[foo]
3902 [foo bar]
3903 [foo <i>bar</i>]
3904 [fool's] errand
3905 [fool's errand]
3906 [foo]
3907 [foo bar]
3908 [foo <i>bar</i>]
3909 [fool's] errand
3910 [fool's errand]
3911 [url=foo]
3912 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3913 </p>
3914 !! end
3915
3916 !! test
3917 Parsoid: Percent encoding in external links
3918 !! options
3919 parsoid
3920 !! input
3921 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
3922 !! result
3923 <p><a rel="mw:ExtLink"
3924 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
3925 !! end
3926
3927 !! test
3928 Parsoid: use url link syntax for links where the content is equal the link
3929 target
3930 !! options
3931 parsoid
3932 !! input
3933 http://example.com
3934 !! result
3935 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
3936 !! end
3937
3938 ###
3939 ### Quotes
3940 ###
3941
3942 !! test
3943 Quotes
3944 !! input
3945 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3946
3947 Normal text. '''''Bold italic text.''''' Normal text.
3948 !!result
3949 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3950 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3951 </p>
3952 !! end
3953
3954
3955 !! test
3956 Unclosed and unmatched quotes (php)
3957 !! options
3958 php
3959 !! input
3960 '''''Bold italic text '''with bold deactivated''' in between.'''''
3961
3962 '''''Bold italic text ''with italic deactivated'' in between.'''''
3963
3964 '''Bold text..
3965
3966 ..spanning two paragraphs (should not work).'''
3967
3968 '''Bold tag left open
3969
3970 ''Italic tag left open
3971
3972 Normal text.
3973
3974 <!-- Unmatching number of opening, closing tags: -->
3975 '''This year''''s election ''should'' beat '''last year''''s.
3976
3977 ''Tom'''s car is bigger than ''Susan'''s.
3978
3979 Plain ''italic'''s plain
3980 !! result
3981 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3982 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3983 </p><p><b>Bold text..</b>
3984 </p><p>..spanning two paragraphs (should not work).
3985 </p><p><b>Bold tag left open</b>
3986 </p><p><i>Italic tag left open</i>
3987 </p><p>Normal text.
3988 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3989 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3990 </p><p>Plain <i>italic'</i>s plain
3991 </p>
3992 !! end
3993 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3994 # parser strips. The wikitext contains just the first half of the bold
3995 # quote pair.
3996 !! test
3997 Unclosed and unmatched quotes (parsoid)
3998 !! options
3999 parsoid
4000 !! input
4001 '''''Bold italic text '''with bold deactivated''' in between.'''''
4002
4003 '''''Bold italic text ''with italic deactivated'' in between.'''''
4004
4005 '''Bold text..
4006
4007 ..spanning two paragraphs (should not work).'''
4008
4009 '''Bold tag left open
4010
4011 ''Italic tag left open
4012
4013 Normal text.
4014
4015 <!-- Unmatching number of opening, closing tags: -->
4016 '''This year''''s election ''should'' beat '''last year''''s.
4017
4018 ''Tom'''s car is bigger than ''Susan'''s.
4019
4020 Plain ''italic'''s plain
4021 !! result
4022 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4023 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4024 </p><p><b>Bold text..</b>
4025 </p><p>..spanning two paragraphs (should not work).<b></b>
4026 </p><p><b>Bold tag left open</b>
4027 </p><p><i>Italic tag left open</i>
4028 </p><p>Normal text.
4029 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4030 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4031 </p><p>Plain <i>italic'</i>s plain
4032 </p>
4033 !! end
4034
4035 ###
4036 ### Tables
4037 ###
4038 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
4039 ###
4040
4041 # This should not produce <table></table> as <table><tr><td></td></tr></table>
4042 # is the bare minimum required by the spec, see:
4043 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
4044 !! test
4045 A table with no data. (php)
4046 !! options
4047 php
4048 !! input
4049 {||}
4050 !! result
4051 !! end
4052 # Parsoid team replies: empty table tags are legal in HTML5
4053 !! test
4054 A table with no data. (parsoid)
4055 !! options
4056 parsoid
4057 !! input
4058 {||}
4059 !! result
4060 <table></table>
4061 !! end
4062
4063 # A table with nothing but a caption is invalid XHTML, we might want to render
4064 # this as <p>caption</p>
4065 !! test
4066 A table with nothing but a caption (php)
4067 !! options
4068 php
4069 !! input
4070 {|
4071 |+ caption
4072 |}
4073 !! result
4074 <table>
4075 <caption> caption
4076 </caption><tr><td></td></tr></table>
4077
4078 !! end
4079 # Parsoid team replies: table with only a caption is legal in HTML5
4080 !! test
4081 A table with nothing but a caption (parsoid)
4082 !! options
4083 parsoid
4084 !! input
4085 {|
4086 |+ caption
4087 |}
4088 !! result
4089 <table><caption> caption</caption></table>
4090 !! end
4091
4092 !! test
4093 A table with caption with default-spaced attributes and a table row
4094 !! input
4095 {|
4096 |+ style="color: red;" | caption1
4097 |-
4098 | foo
4099 |}
4100 !! result
4101 <table>
4102 <caption style="color: red;"> caption1
4103 </caption>
4104 <tr>
4105 <td> foo
4106 </td></tr></table>
4107
4108 !! end
4109
4110 !! test
4111 A table with captions with non-default spaced attributes and a table row
4112 !! input
4113 {|
4114 |+style="color: red;"|caption2
4115 |+ style="color: red;"| caption3
4116 |-
4117 | foo
4118 |}
4119 !! result
4120 <table>
4121 <caption style="color: red;">caption2
4122 </caption>
4123 <caption style="color: red;"> caption3
4124 </caption>
4125 <tr>
4126 <td> foo
4127 </td></tr></table>
4128
4129 !! end
4130
4131 !! test
4132 Table td-cell syntax variations
4133 !! input
4134 {|
4135 | foo bar foo | baz
4136 | foo bar foo || baz
4137 | style='color:red;' | baz
4138 | style='color:red;' || baz
4139 |}
4140 !! result
4141 <table>
4142 <tr>
4143 <td> baz
4144 </td>
4145 <td> foo bar foo </td>
4146 <td> baz
4147 </td>
4148 <td style="color:red;"> baz
4149 </td>
4150 <td> style='color:red;' </td>
4151 <td> baz
4152 </td></tr></table>
4153
4154 !! end
4155
4156 !! test
4157 Simple table
4158 !! input
4159 {|
4160 | 1 || 2
4161 |-
4162 | 3 || 4
4163 |}
4164 !! result
4165 <table>
4166 <tr>
4167 <td> 1 </td>
4168 <td> 2
4169 </td></tr>
4170 <tr>
4171 <td> 3 </td>
4172 <td> 4
4173 </td></tr></table>
4174
4175 !! end
4176
4177 !! test
4178 Simple table but with multiple dashes for row wikitext
4179 !! input
4180 {|
4181 | foo
4182 |-----
4183 | bar
4184 |}
4185 !! result
4186 <table>
4187 <tr>
4188 <td> foo
4189 </td></tr>
4190 <tr>
4191 <td> bar
4192 </td></tr></table>
4193
4194 !! end
4195 !! test
4196 Multiplication table
4197 !! input
4198 {| border="1" cellpadding="2"
4199 |+Multiplication table
4200 |-
4201 ! &times; !! 1 !! 2 !! 3
4202 |-
4203 ! 1
4204 | 1 || 2 || 3
4205 |-
4206 ! 2
4207 | 2 || 4 || 6
4208 |-
4209 ! 3
4210 | 3 || 6 || 9
4211 |-
4212 ! 4
4213 | 4 || 8 || 12
4214 |-
4215 ! 5
4216 | 5 || 10 || 15
4217 |}
4218 !! result
4219 <table border="1" cellpadding="2">
4220 <caption>Multiplication table
4221 </caption>
4222 <tr>
4223 <th> &#215; </th>
4224 <th> 1 </th>
4225 <th> 2 </th>
4226 <th> 3
4227 </th></tr>
4228 <tr>
4229 <th> 1
4230 </th>
4231 <td> 1 </td>
4232 <td> 2 </td>
4233 <td> 3
4234 </td></tr>
4235 <tr>
4236 <th> 2
4237 </th>
4238 <td> 2 </td>
4239 <td> 4 </td>
4240 <td> 6
4241 </td></tr>
4242 <tr>
4243 <th> 3
4244 </th>
4245 <td> 3 </td>
4246 <td> 6 </td>
4247 <td> 9
4248 </td></tr>
4249 <tr>
4250 <th> 4
4251 </th>
4252 <td> 4 </td>
4253 <td> 8 </td>
4254 <td> 12
4255 </td></tr>
4256 <tr>
4257 <th> 5
4258 </th>
4259 <td> 5 </td>
4260 <td> 10 </td>
4261 <td> 15
4262 </td></tr></table>
4263
4264 !! end
4265
4266 !! test
4267 Accept "||" in table headings
4268 !! input
4269 {|
4270 !h1 || h2
4271 |}
4272 !! result
4273 <table>
4274 <tr>
4275 <th>h1 </th>
4276 <th> h2
4277 </th></tr></table>
4278
4279 !! end
4280
4281 !! test
4282 Accept "||" in indented table headings
4283 !! input
4284 :{|
4285 !h1 || h2
4286 |}
4287 !! result
4288 <dl><dd><table>
4289 <tr>
4290 <th>h1 </th>
4291 <th> h2
4292 </th></tr></table></dd></dl>
4293
4294 !! end
4295
4296 !! test
4297 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
4298 !! input
4299 {|
4300 !| h1
4301 || a
4302 |}
4303 !! result
4304 <table>
4305 <tr>
4306 <th> h1
4307 </th>
4308 <td> a
4309 </td></tr></table>
4310
4311 !! end
4312
4313 !!test
4314 Accept "| !" at start of line in tables (ignore !-attribute)
4315 !!input
4316 {|
4317 |-
4318 | !style="color:red" | bar
4319 |}
4320 !!result
4321 <table>
4322
4323 <tr>
4324 <td> bar
4325 </td></tr></table>
4326
4327 !!end
4328
4329 !!test
4330 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 +/-
4331 !!input
4332 {|
4333 |-
4334 |style='color:red;'|+1
4335 |style='color:blue;'|-1
4336 |-
4337 | 1 || 2 || 3
4338 | 1 ||+2 ||-3
4339 |-
4340 | +1
4341 | -1
4342 |}
4343 !!result
4344 <table>
4345
4346 <tr>
4347 <td style="color:red;">+1
4348 </td>
4349 <td style="color:blue;">-1
4350 </td></tr>
4351 <tr>
4352 <td> 1 </td>
4353 <td> 2 </td>
4354 <td> 3
4355 </td>
4356 <td> 1 </td>
4357 <td>+2 </td>
4358 <td>-3
4359 </td></tr>
4360 <tr>
4361 <td> +1
4362 </td>
4363 <td> -1
4364 </td></tr></table>
4365
4366 !!end
4367
4368 !! test
4369 Table rowspan
4370 !! input
4371 {| border=1
4372 | Cell 1, row 1
4373 |rowspan=2| Cell 2, row 1 (and 2)
4374 | Cell 3, row 1
4375 |-
4376 | Cell 1, row 2
4377 | Cell 3, row 2
4378 |}
4379 !! result
4380 <table border="1">
4381 <tr>
4382 <td> Cell 1, row 1
4383 </td>
4384 <td rowspan="2"> Cell 2, row 1 (and 2)
4385 </td>
4386 <td> Cell 3, row 1
4387 </td></tr>
4388 <tr>
4389 <td> Cell 1, row 2
4390 </td>
4391 <td> Cell 3, row 2
4392 </td></tr></table>
4393
4394 !! end
4395
4396 !! test
4397 Nested table
4398 !! input
4399 {| border=1
4400 | &alpha;
4401 |
4402 {| bgcolor=#ABCDEF border=2
4403 |nested
4404 |-
4405 |table
4406 |}
4407 |the original table again
4408 |}
4409 !! result
4410 <table border="1">
4411 <tr>
4412 <td> &#945;
4413 </td>
4414 <td>
4415 <table bgcolor="#ABCDEF" border="2">
4416 <tr>
4417 <td>nested
4418 </td></tr>
4419 <tr>
4420 <td>table
4421 </td></tr></table>
4422 </td>
4423 <td>the original table again
4424 </td></tr></table>
4425
4426 !! end
4427
4428 !! test
4429 Invalid attributes in table cell (bug 1830)
4430 !! input
4431 {|
4432 |Cell:|broken
4433 |}
4434 !! result
4435 <table>
4436 <tr>
4437 <td>broken
4438 </td></tr></table>
4439
4440 !! end
4441
4442
4443 !! test
4444 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
4445 !! input
4446 {|
4447 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
4448 !! result
4449 <table>
4450 <tr>
4451 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
4452 <td>]" onmouseover="alert(document.cookie)"&gt;test
4453 </td>
4454 </tr>
4455 </table>
4456
4457 !! end
4458
4459
4460 !! test
4461 Indented table markup mixed with indented pre content (proposed in bug 6200)
4462 !! input
4463 <table>
4464 <tr>
4465 <td>
4466 Text that should be rendered preformatted
4467 </td>
4468 </tr>
4469 </table>
4470 !! result
4471 <table>
4472 <tr>
4473 <td>
4474 <pre>Text that should be rendered preformatted
4475 </pre>
4476 </td>
4477 </tr>
4478 </table>
4479
4480 !! end
4481
4482 !! test
4483 Template-generated table cell attributes and cell content
4484 !! input
4485 {|
4486 |{{table_attribs}}
4487 | {{table_attribs}}
4488 |}
4489 !! result
4490 <table>
4491 <tr>
4492 <td style="color: red"> Foo
4493 </td>
4494 <td style="color: red"> Foo
4495 </td></tr></table>
4496
4497 !! end
4498
4499 !! test
4500 Template-generated table cell attributes and cell content (2)
4501 !! input
4502 {|
4503 |align=center {{table_attribs}}
4504 |}
4505 !! result
4506 <table>
4507 <tr>
4508 <td align="center" style="color: red"> Foo
4509 </td></tr></table>
4510
4511 !! end
4512
4513 !! test
4514 Template-generated table cell attributes and cell content (3)
4515 !! input
4516 {|
4517 |align=center {{table_cells}}
4518 |}
4519 !! result
4520 <table>
4521 <tr>
4522 <td align="center" style="color: red"> Foo </td>
4523 <td> Bar </td>
4524 <td> Baz
4525 </td></tr></table>
4526
4527 !! end
4528
4529 !! test
4530 Table with row followed by newlines and table heading
4531 !! input
4532 {|
4533 |-
4534
4535 ! foo
4536 |}
4537 !! result
4538 <table>
4539
4540
4541 <tr>
4542 <th> foo
4543 </th></tr></table>
4544
4545 !! end
4546
4547 !! test
4548 Table with empty line following the start tag
4549 !! input
4550 {|
4551
4552 |-
4553 | foo
4554 |}
4555 !! result
4556 <table>
4557
4558
4559 <tr>
4560 <td> foo
4561 </td></tr></table>
4562
4563 !! end
4564
4565 # FIXME: Preserve the attribute properly (with an empty string as value) in
4566 # the PHP parser. Parsoid implements the behavior below.
4567 !! test
4568 Table attributes with empty value
4569 !! options
4570 parsoid
4571 !! input
4572 {|
4573 | style=| hello
4574 |}
4575 !! result
4576 <table>
4577 <tbody>
4578 <tr>
4579 <td style=""> hello
4580 </td></tr></tbody></table>
4581
4582 !! end
4583
4584 !! test
4585 Wikitext table with a lot of comments
4586 !! input
4587 {|
4588 <!-- c0 -->
4589 | foo
4590 <!-- c1 -->
4591 |- <!-- c2 -->
4592 <!-- c3 -->
4593 |<!-- c4 -->
4594 <!-- c5 -->
4595 |}
4596 !! result
4597 <table>
4598 <tr>
4599 <td> foo
4600 </td></tr>
4601 <tr>
4602 <td>
4603 </td></tr></table>
4604
4605 !! end
4606
4607 !! test
4608 Wikitext table with double-line table cell
4609 !! input
4610 {|
4611 |a
4612 b
4613 |}
4614 !! result
4615 <table>
4616 <tr>
4617 <td>a
4618 <p>b
4619 </p>
4620 </td></tr></table>
4621
4622 !! end
4623
4624 !! test
4625 Table cell with a single comment
4626 !! input
4627 {|
4628 | <!-- c1 -->
4629 | a
4630 |}
4631 !! result
4632 <table>
4633 <tr>
4634 <td>
4635 </td>
4636 <td> a
4637 </td></tr></table>
4638
4639 !! end
4640
4641 # The expected HTML structure in this test is debatable. The PHP parser does
4642 # not parse this kind of table at all. The main focus for Parsoid is on
4643 # round-tripping, so this output is ok for now. TODO: revisit!
4644 !! test
4645 Wikitext table with html-syntax row (Parsoid)
4646 !! options
4647 parsoid
4648 !! input
4649 {|
4650 |-
4651 <td>foo</td>
4652 |}
4653 !! result
4654 <table>
4655 <tbody>
4656 <tr>
4657 <td>foo</td></tr></tbody></table>
4658 !! end
4659
4660 !! test
4661 Implicit <td> after a |-
4662 (PHP parser relies on Tidy to add the missing <td> tags)
4663 !! options
4664 parsoid=wt2html,wt2wt
4665 !! input
4666 {|
4667 |-
4668 a
4669 |}
4670 !! result
4671 <table>
4672 <tr><td>a</td></tr>
4673 </table>
4674 !! end
4675
4676 !! test
4677 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
4678 (PHP parser relies on Tidy to add the missing <td> tags)
4679 !! options
4680 parsoid=wt2html,wt2wt
4681 !! input
4682 {|
4683 |-
4684 |
4685 a
4686 |-
4687 b
4688 |}
4689 !! result
4690 <table>
4691 <tbody>
4692 <tr><td><pre>a</pre></td></tr>
4693 <tr><td> b</td></tr>
4694 </tbody>
4695 </table>
4696 !! end
4697
4698 !! test
4699 Lists should be recognized in an implicit <td> context
4700 (PHP parser relies on Tidy to add the missing <td> tags)
4701 !! options
4702 parsoid=wt2html,wt2wt
4703 !! input
4704 {|
4705 |-
4706 *a
4707 |}
4708 !! result
4709 <table>
4710 <tr>
4711 <td><ul>
4712 <li>a</li>
4713 </ul></td>
4714 </tr>
4715 </table>
4716 !! end
4717
4718 !! test
4719 Parsoid: Round-trip tables directly followed by content (bug 51219)
4720 !! options
4721 parsoid=wt2html,wt2wt
4722 !! input
4723 {|
4724 |foo
4725 |} bar
4726
4727 {|
4728 |baz
4729 |}<b>quux</b>
4730 !! result
4731 <table><tbody>
4732 <tr>
4733 <td>foo</td></tr></tbody></table> bar
4734 <table>
4735 <tbody>
4736 <tr>
4737 <td>baz</td></tr></tbody></table><b>quux</b>
4738 !! end
4739
4740 !! test
4741 Parsoid: Default to a newline after tables in new content (bug 51219)
4742 !! options
4743 parsoid=html2wt
4744 !! input
4745 {|
4746 |foo
4747 |}
4748 <nowiki> </nowiki>bar
4749 {|
4750 |baz
4751 |}
4752 '''quux'''
4753 !! result
4754 <table><tbody>
4755 <tr><td>foo</td></tr></tbody></table> bar
4756 <table><tbody>
4757 <tr><td>baz</td></tr></tbody></table><b>quux</b>
4758 !! end
4759
4760 ###
4761 ### Internal links
4762 ###
4763 !! test
4764 Plain link, capitalized
4765 !! input
4766 [[Main Page]]
4767 !! result
4768 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4769 </p>
4770 !! end
4771
4772 !! test
4773 Plain link, uncapitalized
4774 !! input
4775 [[main Page]]
4776 !! result
4777 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
4778 </p>
4779 !! end
4780
4781 !! test
4782 Piped link
4783 !! input
4784 [[Main Page|The Main Page]]
4785 !! result
4786 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4787 </p>
4788 !! end
4789
4790 !! test
4791 Piped link with comment in link text
4792 !! input
4793 [[Main Page|The Main<!--front--> Page]]
4794 !! result
4795 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4796 </p>
4797 !! end
4798
4799 !! test
4800 Broken link
4801 !! input
4802 [[Zigzagzogzagzig]]
4803 !! result
4804 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
4805 </p>
4806 !! end
4807
4808 !! test
4809 Broken link with fragment
4810 !! input
4811 [[Zigzagzogzagzig#zug]]
4812 !! result
4813 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
4814 </p>
4815 !! end
4816
4817 !! test
4818 Special page link with fragment
4819 !! input
4820 [[Special:Version#anchor]]
4821 !! result
4822 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
4823 </p>
4824 !! end
4825
4826 !! test
4827 Nonexistent special page link with fragment
4828 !! input
4829 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
4830 !! result
4831 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
4832 </p>
4833 !! end
4834
4835 !! test
4836 Link with prefix
4837 !! input
4838 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
4839 !! result
4840 <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>
4841 </p>
4842 !! end
4843
4844 !! test
4845 Link with suffix
4846 !! input
4847 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
4848 !! result
4849 <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>!!!
4850 </p>
4851 !! end
4852
4853 !! article
4854 prefixed article
4855 !! text
4856 Some text
4857 !! endarticle
4858
4859 !! test
4860 Bug 43661: Piped links with identical prefixes
4861 !! input
4862 [[prefixed article|prefixed articles with spaces]]
4863
4864 [[prefixed article|prefixed articlesaoeu]]
4865
4866 [[Main Page|Main Page test]]
4867 !! result
4868 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
4869 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
4870 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
4871 </p>
4872 !! end
4873
4874
4875 !! test
4876 Link with HTML entity in suffix / tail
4877 !! input
4878 [[Main Page]]&quot;, [[Main Page]]&#97;
4879 !! result
4880 <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;
4881 </p>
4882 !! end
4883
4884 !! test
4885 Link with 3 brackets
4886 !! input
4887 [[[main page]]]
4888 !! result
4889 <p>[[[main page]]]
4890 </p>
4891 !! end
4892
4893 !! test
4894 Piped link with 3 brackets
4895 !! input
4896 [[[main page|the main page]]]
4897 !! result
4898 <p>[[[main page|the main page]]]
4899 </p>
4900 !! end
4901
4902 !! test
4903 Link with multiple pipes
4904 !! input
4905 [[Main Page|The|Main|Page]]
4906 !! result
4907 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
4908 </p>
4909 !! end
4910
4911 !! test
4912 Link to namespaces
4913 !! input
4914 [[Talk:Parser testing]], [[Meta:Disclaimers]]
4915 !! result
4916 <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>
4917 </p>
4918 !! end
4919
4920 !! article
4921 MemoryAlpha:AlphaTest
4922 !! text
4923 This is an article in the MemoryAlpha namespace
4924 (which shadows the memoryalpha interwiki link).
4925 !! endarticle
4926
4927 !! test
4928 Namespace takes precedence over interwiki link (bug 51680)
4929 !! input
4930 [[MemoryAlpha:AlphaTest]]
4931 !! result
4932 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
4933 </p>
4934 !! end
4935
4936 # The previous test doesn't work correctly in html2*, due to not recognizing the
4937 # link as an internal one. This one checks for the correct behavior.
4938 !! test
4939 Link to namespace preferred over interwiki with correct rel attribute
4940 !! options
4941 parsoid=html2wt,html2html
4942 !! input
4943 [[MemoryAlpha:AlphaTest]]
4944 !! result
4945 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
4946 </p>
4947 !! end
4948
4949 !! test
4950 Piped link to namespace
4951 !! input
4952 [[Meta:Disclaimers|The disclaimers]]
4953 !! result
4954 <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>
4955 </p>
4956 !! end
4957
4958 !! test
4959 Link containing }
4960 !! input
4961 [[Usually caused by a typo (oops}]]
4962 !! result
4963 <p>[[Usually caused by a typo (oops}]]
4964 </p>
4965 !! end
4966
4967 !! test
4968 Link containing % (not as a hex sequence)
4969 !! input
4970 [[7% Solution]]
4971 !! result
4972 <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>
4973 </p>
4974 !! end
4975
4976 !! test
4977 Link containing % as a single hex sequence interpreted to char
4978 !! input
4979 [[7%25 Solution]]
4980 !! result
4981 <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>
4982 </p>
4983 !!end
4984
4985 !! test
4986 Link containing % as a double hex sequence interpreted to hex sequence
4987 !! input
4988 [[7%2525 Solution]]
4989 !! result
4990 <p>[[7%2525 Solution]]
4991 </p>
4992 !!end
4993
4994 !! test
4995 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
4996 Example for such a section: == < ==
4997 !! input
4998 [[%23%3c]][[%23%3e]]
4999 !! result
5000 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
5001 </p>
5002 !! end
5003
5004 !! test
5005 Link containing "<#" and ">#" as a hex sequences
5006 !! input
5007 [[%3c%23]][[%3e%23]]
5008 !! result
5009 <p>[[%3c%23]][[%3e%23]]
5010 </p>
5011 !! end
5012
5013 !! test
5014 Link containing an equals sign
5015 !! input
5016 [[Special:BookSources/isbn=4-00-026157-6]]
5017 !! result
5018 <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>
5019 </p>
5020 !! end
5021
5022 !! article
5023 Foo~bar
5024 !! text
5025 Just a test of an article title containing a tilde.
5026 !! endarticle
5027
5028 # note that links containing signatures, like [[Foo~~~~]], are
5029 # massaged by the pre-save transform (PST) and so the tildes are never
5030 # seen by the parser.
5031 !! test
5032 Link containing a tilde
5033 !! input
5034 [[Foo~bar]]
5035 !! result
5036 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
5037 </p>
5038 !! end
5039
5040 !! test
5041 Link containing double-single-quotes '' (bug 4598)
5042 !! input
5043 [[Lista d''e paise d''o munno]]
5044 !! result
5045 <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>
5046 </p>
5047 !! end
5048
5049 !! test
5050 Link containing double-single-quotes '' in text (bug 4598 sanity check)
5051 !! input
5052 Some [[Link|pretty ''italics'' and stuff]]!
5053 !! result
5054 <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>!
5055 </p>
5056 !! end
5057
5058 !! test
5059 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
5060 !! input
5061 ''Some [[Link|pretty ''italics'' and stuff]]!
5062 !! result
5063 <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>
5064 </p>
5065 !! end
5066
5067 !! test
5068 Link with double quotes in title part (literal) and alternate part (interpreted)
5069 !! input
5070 [[File:Denys Savchenko ''Pentecoste''.jpg]]
5071
5072 [[''Pentecoste'']]
5073
5074 [[''Pentecoste''|Pentecoste]]
5075
5076 [[''Pentecoste''|''Pentecoste'']]
5077 !! result
5078 <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>
5079 </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>
5080 </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>
5081 </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>
5082 </p>
5083 !! end
5084
5085 !! test
5086 Broken image links with HTML captions (bug 39700)
5087 !! input
5088 [[File:Nonexistent|<script></script>]]
5089 [[File:Nonexistent|100px|<script></script>]]
5090 [[File:Nonexistent|&lt;]]
5091 [[File:Nonexistent|a<i>b</i>c]]
5092 !! result
5093 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5094 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5095 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
5096 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
5097 </p>
5098 !! end
5099
5100 !! test
5101 Plain link to URL
5102 !! input
5103 [[http://www.example.com]]
5104 !! result
5105 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
5106 </p>
5107 !! end
5108
5109 !! test
5110 Plain link to URL with link text
5111 !! input
5112 [[http://www.example.com Link text]]
5113 !! result
5114 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
5115 </p>
5116 !! end
5117
5118 !! test
5119 Plain link to protocol-relative URL
5120 !! input
5121 [[//www.example.com]]
5122 !! result
5123 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
5124 </p>
5125 !! end
5126
5127 !! test
5128 Plain link to protocol-relative URL with link text
5129 !! input
5130 [[//www.example.com Link text]]
5131 !! result
5132 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
5133 </p>
5134 !! end
5135
5136 !! test
5137 Plain link to page with question mark in title
5138 !! input
5139 [[A?b]]
5140
5141 [[A?b|Baz]]
5142 !! result
5143 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
5144 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
5145 </p>
5146 !! end
5147
5148
5149 # I'm fairly sure the expected result here is wrong.
5150 # We want these to be URL links, not pseudo-pages with URLs for titles....
5151 # However the current output is also pretty screwy.
5152 #
5153 # ----
5154 # I'm changing it to match the current output--it arguably makes more
5155 # sense in the light of the test above. Old expected result was:
5156 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
5157 #</p>
5158 # But I think this test is bordering on "garbage in, garbage out" anyway.
5159 # -- wtm
5160 !! test
5161 Piped link to URL
5162 !! input
5163 Piped link to URL: [[http://www.example.com|an example URL]]
5164 !! result
5165 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
5166 </p>
5167 !! end
5168
5169 !! test
5170 BUG 2: [[page|http://url/]] should link to page, not http://url/
5171 !! input
5172 [[Main Page|http://url/]]
5173 !! result
5174 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
5175 </p>
5176 !! end
5177
5178 !! test
5179 BUG 337: Escaped self-links should be bold
5180 !! options
5181 title=[[Bug462]]
5182 !! input
5183 [[Bu&#103;462]] [[Bug462]]
5184 !! result
5185 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
5186 </p>
5187 !! end
5188
5189 !! test
5190 Self-link to section should not be bold
5191 !! options
5192 title=[[Main Page]]
5193 !! input
5194 [[Main Page#section]]
5195 !! result
5196 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
5197 </p>
5198 !! end
5199
5200 !! article
5201 00
5202 !! text
5203 This is 00.
5204 !! endarticle
5205
5206 !!test
5207 Self-link to numeric title
5208 !!options
5209 title=[[0]]
5210 !!input
5211 [[0]]
5212 !!result
5213 <p><strong class="selflink">0</strong>
5214 </p>
5215 !!end
5216
5217 !!test
5218 Link to numeric-equivalent title
5219 !!options
5220 title=[[0]]
5221 !!input
5222 [[00]]
5223 !!result
5224 <p><a href="/wiki/00" title="00">00</a>
5225 </p>
5226 !!end
5227
5228 !! test
5229 <nowiki> inside a link
5230 !! input
5231 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
5232 !! result
5233 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
5234 </p>
5235 !! end
5236
5237 !! test
5238 Non-breaking spaces in title
5239 !! input
5240 [[&nbsp; Main &nbsp; Page &nbsp;]]
5241 !! result
5242 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
5243 </p>
5244 !!end
5245
5246 !! test
5247 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
5248 !! options
5249 language=ca
5250 !! input
5251 '''[[Main Page]]'''
5252 !! result
5253 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
5254 </p>
5255 !! end
5256
5257 !! test
5258 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
5259 !! options
5260 language=ca
5261 !! input
5262 ''[[Main Page]]''
5263 !! result
5264 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
5265 </p>
5266 !! end
5267
5268 !! test
5269 Internal link with en linktrail: no apostrophes (bug 27473)
5270 !! options
5271 language=en
5272 !! input
5273 [[Something]]'nice
5274 !! result
5275 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
5276 </p>
5277 !! end
5278
5279 !! test
5280 Internal link with ca linktrail with apostrophes (bug 27473)
5281 !! options
5282 language=ca
5283 !! input
5284 [[Something]]'nice
5285 !! result
5286 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
5287 </p>
5288 !! end
5289
5290 !! test
5291 Internal link with kaa linktrail with apostrophes (bug 27473)
5292 !! options
5293 language=kaa
5294 !! input
5295 [[Something]]'nice
5296 !! result
5297 <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>
5298 </p>
5299 !! end
5300
5301 !! article
5302 Söfnuður
5303 !! text
5304 Test.
5305 !! endarticle
5306
5307 !! test
5308 Internal link with is link prefix
5309 !! options
5310 language=is
5311 !! input
5312 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
5313 !! result
5314 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
5315 </p>
5316 !! end
5317
5318 !! article
5319 Mótmælendatrú
5320 !! text
5321 Test.
5322 !! endarticle
5323
5324 !! test
5325 Internal link with is link trail and link prefix
5326 !! options
5327 language=is
5328 !! input
5329 [[mótmælendatrú|xxx]]ar
5330 [[mótmælendatrú]]ar
5331 mótmælenda[[söfnuður]]
5332 mótmælenda[[söfnuður|söfnuðir]]
5333 mótmælenda[[söfnuður|söfnuðir]]xxx
5334 !! result
5335 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
5336 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
5337 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
5338 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
5339 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
5340 </p>
5341 !! end
5342
5343 !! test
5344 Parsoid link trail escaping
5345 !! options
5346 parsoid=html2wt,html2html
5347 !! input
5348 [[apple]]<nowiki/>s
5349 !! result
5350 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
5351 !! end
5352
5353 !! test
5354 Parsoid link prefix escaping
5355 !! options
5356 language=is
5357 parsoid=html2wt,html2html
5358 !! input
5359 Aðrir mótmælenda<nowiki/>[[söfnuður]]
5360 !! result
5361 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
5362 !! end
5363
5364 !! test
5365 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
5366 !! input
5367 [[Foo| bar]]
5368
5369 [[Foo| ''bar'']]
5370
5371 [http://wp.org foo]
5372
5373 [http://wp.org ''foo'']
5374 !! result
5375 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
5376 </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>
5377 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
5378 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
5379 </p>
5380 !! end
5381
5382 !! test
5383 Parsoid: Scoped parsing should handle mixed transclusions and plain text
5384 !! options
5385 parsoid
5386 !! input
5387 [[Foo|{{echo|a}} b {{echo|c}}]]
5388 !! result
5389 <p data-parsoid='{"dsr":[0,20,0,0]}'><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>
5390 !! end
5391
5392 ###
5393 ### Interwiki links (see maintenance/interwiki.sql)
5394 ###
5395
5396 !! test
5397 Inline interwiki link
5398 !! input
5399 [[MeatBall:SoftSecurity]]
5400 !! result
5401 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
5402 </p>
5403 !! end
5404
5405 !! test
5406 Inline interwiki link with empty title (bug 2372)
5407 !! input
5408 [[MeatBall:]]
5409 !! result
5410 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
5411 </p>
5412 !! end
5413
5414 !! test
5415 Interwiki link encoding conversion (bug 1636)
5416 !! input
5417 *[[Wikipedia:ro:Olteni&#0355;a]]
5418 *[[Wikipedia:ro:Olteni&#355;a]]
5419 !! result
5420 <ul>
5421 <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>
5422 </li>
5423 <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>
5424 </li>
5425 </ul>
5426
5427 !! end
5428
5429 !! test
5430 Interwiki link with fragment (bug 2130)
5431 !! input
5432 [[MeatBall:SoftSecurity#foo]]
5433 !! result
5434 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
5435 </p>
5436 !! end
5437
5438 # Ideally the wikipedia: prefix here should be proto-relative too
5439 !! test
5440 Different interwiki prefixes mapping to the same URL
5441 !! options
5442 parsoid
5443 !! input
5444 [[wikipedia:Foo]]
5445
5446 [[:en:Foo]]
5447 !! result
5448 <p data-parsoid='{"dsr":[0,17,0,0]}'><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,"dsr":[0,17,null,1]}'>wikipedia:Foo</a></p>
5449
5450
5451 <p data-parsoid='{"dsr":[19,30,0,0]}'><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,"dsr":[19,30,null,1]}'>en:Foo</a></p>
5452 !! end
5453
5454
5455 ###
5456 ### Interlanguage links
5457 ### Language links (so that searching for '### language' matches..)
5458 ###
5459
5460 !! test
5461 Interlanguage link
5462 !! input
5463 Blah blah blah
5464 [[zh:Chinese]]
5465 !!result
5466 <p>Blah blah blah
5467 </p>
5468 !! end
5469
5470 !! test
5471 Double interlanguage link
5472 !! input
5473 Blah blah blah
5474 [[es:Spanish]]
5475 [[zh:Chinese]]
5476 !!result
5477 <p>Blah blah blah
5478 </p>
5479 !! end
5480
5481 !! test
5482 Interlanguage link, with prefix links
5483 !! options
5484 language=ln
5485 !! input
5486 Blah blah blah
5487 [[zh:Chinese]]
5488 !!result
5489 <p>Blah blah blah
5490 </p>
5491 !! end
5492
5493 !! test
5494 Double interlanguage link, with prefix links (bug 8897)
5495 !! options
5496 language=ln
5497 !! input
5498 Blah blah blah
5499 [[es:Spanish]]
5500 [[zh:Chinese]]
5501 !!result
5502 <p>Blah blah blah
5503 </p>
5504 !! end
5505
5506 !! test
5507 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
5508 !! options
5509 language=ln
5510 !! input
5511 [[WW&nbsp;II]]
5512 !!result
5513 <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>
5514 </p>
5515 !! end
5516
5517 !! test
5518 Parsoid bug 53221: Wikilinks should be properly entity-escaped
5519 !! options
5520 parsoid=html2wt
5521 !! input
5522 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
5523
5524 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
5525 !!result
5526 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
5527 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
5528 !! end
5529
5530 !! test
5531 Parsoid: handle constructor well
5532 !! options
5533 parsoid
5534 !! input
5535 [[constructor]]
5536
5537 [[constructor:foo]]
5538 !! result
5539 <p data-parsoid="{&quot;dsr&quot;:[0,15,0,0]}"><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;},&quot;dsr&quot;:[0,15,2,2]}">constructor</a></p>
5540
5541
5542 <p data-parsoid="{&quot;dsr&quot;:[17,36,0,0]}"><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;},&quot;dsr&quot;:[17,36,2,2]}">constructor:foo</a></p>
5543 !! end
5544
5545 !! test
5546 Parsoid: recognize interlanguage links without a target page
5547 !! options
5548 parsoid
5549 !! input
5550 [[ko:]]
5551 !! result
5552 <p>
5553 <link rel="mw:PageProp/Language" href="http://ko.wikipedia.org/wiki/"></p>
5554 !! end
5555
5556 !! test
5557 Parsoid: recognize interwiki links without a target page
5558 !! options
5559 parsoid
5560 !! input
5561 [[:ko:]]
5562 !! result
5563 <p><a rel="mw:ExtLink" href="//ko.wikipedia.org/wiki/">ko:</a></p>
5564 !! end
5565
5566 ###
5567 ### Redirects, Parsoid-only
5568 ###
5569 !! test
5570 Simple redirect to page
5571 !! options
5572 parsoid
5573 !! input
5574 #REDIRECT [[Main Page]]
5575 !! result
5576 <link rel="mw:PageProp/redirect" href="./Main_Page">
5577 !! end
5578
5579 !! test
5580 Optional colon in #REDIRECT
5581 !! options
5582 # the colon is archaic syntax. we support it for wt2html, but we
5583 # don't care that it roundtrips back to the modern syntax.
5584 parsoid=wt2html,html2html
5585 !! input
5586 #REDIRECT:[[Main Page]]
5587 !! result
5588 <link rel="mw:PageProp/redirect" href="./Main_Page">
5589 !! end
5590
5591 !! test
5592 Whitespace in #REDIRECT with optional colon
5593 !! options
5594 # the colon and gratuitous whitespace is archaic syntax. we support
5595 # it for wt2html, but we don't care that it roundtrips back to the
5596 # modern syntax (without extra whitespace)
5597 parsoid=wt2html,html2html
5598 !! input
5599
5600 #REDIRECT
5601 :
5602 [[Main Page]]
5603 !! result
5604 <link rel="mw:PageProp/redirect" href="./Main_Page">
5605 !! end
5606
5607 !! test
5608 Piped link in #REDIRECT
5609 !! options
5610 # content after piped link is ignored. we support this syntax,
5611 # but don't care that the piped link is lost when we roundtrip this.
5612 parsoid=wt2html
5613 !! input
5614 #REDIRECT [[Main Page|bar]]
5615 !! result
5616 <link rel="mw:PageProp/redirect" href="./Main_Page">
5617 !! end
5618
5619 !! test
5620 Redirect to category
5621 !! options
5622 parsoid=wt2html
5623 !! input
5624 #REDIRECT [[Category:Foo]]
5625 !! result
5626 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
5627 !! end
5628
5629 !! test
5630 Redirect to category with URL encoding
5631 !! options
5632 parsoid=wt2html
5633 !! input
5634 #REDIRECT [[Category%3AFoo]]
5635 !! result
5636 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
5637 !! end
5638
5639 !! test
5640 Redirect to category page
5641 !! options
5642 parsoid=wt2html,html2html
5643 !! input
5644 #REDIRECT [[:Category:Foo]]
5645 !! result
5646 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
5647 !! end
5648
5649 !! test
5650 Redirect to image page (1)
5651 !! options
5652 parsoid
5653 !! input
5654 #REDIRECT [[File:Wiki.png]]
5655 !! result
5656 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5657 !! end
5658
5659 !! test
5660 Redirect to image page (2)
5661 !! options
5662 parsoid
5663 !! input
5664 #REDIRECT [[Image:Wiki.png]]
5665 !! result
5666 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5667 !! end
5668
5669 !! test
5670 Redirect to language
5671 !! options
5672 parsoid
5673 !! input
5674 #REDIRECT [[en:File:Wiki.png]]
5675 !! result
5676 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5677 !! end
5678
5679 !! test
5680 Redirect to interwiki
5681 !! options
5682 parsoid
5683 !! input
5684 #REDIRECT [[meatball:File:Wiki.png]]
5685 !! result
5686 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5687 !! end
5688
5689 !! test
5690 Non-English #REDIRECT
5691 !! options
5692 parsoid
5693 language=is
5694 !! input
5695 #TILVÍSUN [[Main Page]]
5696 !! result
5697 <link rel="mw:PageProp/redirect" href="./Main_Page">
5698 !! end
5699
5700 ##
5701 ## XHTML tidiness
5702 ###
5703
5704 !! test
5705 <br> to <br />
5706 !! input
5707 1<br>2<br />3
5708 !! result
5709 <p>1<br />2<br />3
5710 </p>
5711 !! end
5712
5713 !! test
5714 Broken br tag sanitization
5715 !! options
5716 php
5717 !! input
5718 </br>
5719 !! result
5720 <p>&lt;/br&gt;
5721 </p>
5722 !! end
5723
5724 # TODO: Fix html2html mode (bug 51055)!
5725 !! test
5726 Parsoid: Broken br tag recognition
5727 !! options
5728 parsoid=wt2html
5729 !! input
5730 </br>
5731 !! result
5732 <p><br></p>
5733 !! end
5734
5735 !! test
5736 Incorrecly removing closing slashes from correctly formed XHTML
5737 !! input
5738 <br style="clear:both;" />
5739 !! result
5740 <p><br style="clear:both;" />
5741 </p>
5742 !! end
5743
5744 !! test
5745 Failing to transform badly formed HTML into correct XHTML
5746 !! input
5747 <br style="clear: left;">
5748 <br style="clear: right;">
5749 <br style="clear: both;">
5750 !! result
5751 <p><br style="clear: left;" />
5752 <br style="clear: right;" />
5753 <br style="clear: both;" />
5754 </p>
5755 !!end
5756
5757 !! test
5758 Handling html with a div self-closing tag
5759 !! input
5760 <div title />
5761 <div title/>
5762 <div title/ >
5763 <div title=bar />
5764 <div title=bar/>
5765 <div title=bar/ >
5766 !! result
5767 <p>&lt;div title /&gt;
5768 &lt;div title/&gt;
5769 </p>
5770 <div>
5771 <p>&lt;div title=bar /&gt;
5772 &lt;div title=bar/&gt;
5773 </p>
5774 <div title="bar/"></div>
5775 </div>
5776
5777 !! end
5778
5779 !! test
5780 Handling html with a br self-closing tag
5781 !! input
5782 <br title />
5783 <br title/>
5784 <br title/ >
5785 <br title=bar />
5786 <br title=bar/>
5787 <br title=bar/ >
5788 !! result
5789 <p><br title="title" />
5790 <br title="title" />
5791 <br />
5792 <br title="bar" />
5793 <br title="bar" />
5794 <br title="bar/" />
5795 </p>
5796 !! end
5797
5798 !! test
5799 Horizontal ruler (should it add that extra space?)
5800 !! input
5801 <hr>
5802 <hr >
5803 foo <hr
5804 > bar
5805 !! result
5806 <hr />
5807 <hr />
5808 foo <hr /> bar
5809
5810 !! end
5811
5812 !! test
5813 Horizontal ruler -- 4+ dashes render hr
5814 !! input
5815 ----
5816 !! result
5817 <hr />
5818
5819 !! end
5820
5821 !! test
5822 Horizontal ruler -- eats additional dashes on the same line
5823 !! input
5824 ---------
5825 !! result
5826 <hr />
5827
5828 !! end
5829
5830 !! test
5831 Horizontal ruler -- does not collapse dashes on consecutive lines
5832 !! input
5833 ----
5834 ----
5835 !! result
5836 <hr />
5837 <hr />
5838
5839 !! end
5840
5841 !! test
5842 Horizontal ruler -- <4 dashes render as plain text
5843 !! input
5844 ---
5845 !! result
5846 <p>---
5847 </p>
5848 !! end
5849
5850 !! test
5851 Horizontal ruler -- Supports content following dashes on same line
5852 !! input
5853 ---- Foo
5854 !! result
5855 <hr /> Foo
5856
5857 !! end
5858
5859 ###
5860 ### Block-level elements
5861 ###
5862 !! test
5863 Common list
5864 !! input
5865 *Common list
5866 * item 2
5867 *item 3
5868 !! result
5869 <ul>
5870 <li>Common list
5871 </li>
5872 <li> item 2
5873 </li>
5874 <li>item 3
5875 </li>
5876 </ul>
5877
5878 !! end
5879
5880 !! test
5881 Numbered list
5882 !! input
5883 #Numbered list
5884 #item 2
5885 # item 3
5886 !! result
5887 <ol>
5888 <li>Numbered list
5889 </li>
5890 <li>item 2
5891 </li>
5892 <li> item 3
5893 </li>
5894 </ol>
5895
5896 !! end
5897
5898 !! test
5899 Mixed list
5900 !! input
5901 *Mixed list
5902 *# with numbers
5903 ** and bullets
5904 *# and numbers
5905 *bullets again
5906 **bullet level 2
5907 ***bullet level 3
5908 ***#Number on level 4
5909 **bullet level 2
5910 **#Number on level 3
5911 **#Number on level 3
5912 *#number level 2
5913 *Level 1
5914 *** Level 3
5915 #** Level 3, but ordered
5916 !! result
5917 <ul>
5918 <li>Mixed list
5919 <ol>
5920 <li> with numbers
5921 </li>
5922 </ol>
5923 <ul>
5924 <li> and bullets
5925 </li>
5926 </ul>
5927 <ol>
5928 <li> and numbers
5929 </li>
5930 </ol>
5931 </li>
5932 <li>bullets again
5933 <ul>
5934 <li>bullet level 2
5935 <ul>
5936 <li>bullet level 3
5937 <ol>
5938 <li>Number on level 4
5939 </li>
5940 </ol>
5941 </li>
5942 </ul>
5943 </li>
5944 <li>bullet level 2
5945 <ol>
5946 <li>Number on level 3
5947 </li>
5948 <li>Number on level 3
5949 </li>
5950 </ol>
5951 </li>
5952 </ul>
5953 <ol>
5954 <li>number level 2
5955 </li>
5956 </ol>
5957 </li>
5958 <li>Level 1
5959 <ul>
5960 <li><ul>
5961 <li> Level 3
5962 </li>
5963 </ul>
5964 </li>
5965 </ul>
5966 </li>
5967 </ul>
5968 <ol>
5969 <li><ul>
5970 <li><ul>
5971 <li> Level 3, but ordered
5972 </li>
5973 </ul>
5974 </li>
5975 </ul>
5976 </li>
5977 </ol>
5978
5979 !! end
5980
5981 !! test
5982 Nested lists 1
5983 !! input
5984 *foo
5985 **bar
5986 !! result
5987 <ul>
5988 <li>foo
5989 <ul>
5990 <li>bar
5991 </li>
5992 </ul>
5993 </li>
5994 </ul>
5995
5996 !! end
5997
5998 !! test
5999 Nested lists 2
6000 !! input
6001 **foo
6002 *bar
6003 !! result
6004 <ul>
6005 <li><ul>
6006 <li>foo
6007 </li>
6008 </ul>
6009 </li>
6010 <li>bar
6011 </li>
6012 </ul>
6013
6014 !! end
6015
6016 !! test
6017 Nested lists 3 (first element empty)
6018 !! input
6019 *
6020 **bar
6021 !! result
6022 <ul>
6023 <li>
6024 <ul>
6025 <li>bar
6026 </li>
6027 </ul>
6028 </li>
6029 </ul>
6030
6031 !! end
6032
6033 !! test
6034 Nested lists 4 (first element empty)
6035 !! input
6036 **
6037 *bar
6038 !! result
6039 <ul>
6040 <li><ul>
6041 <li>
6042 </li>
6043 </ul>
6044 </li>
6045 <li>bar
6046 </li>
6047 </ul>
6048
6049 !! end
6050
6051 !! test
6052 Nested lists 5 (both elements empty)
6053 !! input
6054 **
6055 *
6056 !! result
6057 <ul>
6058 <li><ul>
6059 <li>
6060 </li>
6061 </ul>
6062 </li>
6063 <li>
6064 </li>
6065 </ul>
6066
6067 !! end
6068
6069 !! test
6070 Nested lists 6 (both elements empty)
6071 !! input
6072 *
6073 **
6074 !! result
6075 <ul>
6076 <li>
6077 <ul>
6078 <li>
6079 </li>
6080 </ul>
6081 </li>
6082 </ul>
6083
6084 !! end
6085
6086 !! test
6087 Nested lists 7 (skip initial nesting levels)
6088 !! input
6089 *** foo
6090 !! result
6091 <ul>
6092 <li><ul>
6093 <li><ul>
6094 <li> foo
6095 </li>
6096 </ul>
6097 </li>
6098 </ul>
6099 </li>
6100 </ul>
6101
6102 !! end
6103
6104 !! test
6105 Nested lists 8 (multiple nesting transitions)
6106 !! input
6107 * foo
6108 *** bar
6109 ** baz
6110 * boo
6111 !! result
6112 <ul>
6113 <li> foo
6114 <ul>
6115 <li><ul>
6116 <li> bar
6117 </li>
6118 </ul>
6119 </li>
6120 <li> baz
6121 </li>
6122 </ul>
6123 </li>
6124 <li> boo
6125 </li>
6126 </ul>
6127
6128 !! end
6129
6130 !! test
6131 1. Lists with start-of-line-transparent tokens before bullets: Comments
6132 !! input
6133 *foo
6134 *<!--cmt-->bar
6135 <!--cmt-->*baz
6136 !! result
6137 <ul>
6138 <li>foo
6139 </li>
6140 <li>bar
6141 </li>
6142 <li>baz
6143 </li>
6144 </ul>
6145
6146 !! end
6147
6148 !! test
6149 2. Lists with start-of-line-transparent tokens before bullets: Template close
6150 !! input
6151 *foo {{echo|bar
6152 }}*baz
6153 !! result
6154 <ul>
6155 <li>foo bar
6156 </li>
6157 <li>baz
6158 </li>
6159 </ul>
6160
6161 !! end
6162
6163 !! test
6164 List items are not parsed correctly following a <pre> block (bug 785)
6165 !! input
6166 * <pre>foo</pre>
6167 * <pre>bar</pre>
6168 * zar
6169 !! result
6170 <ul>
6171 <li> <pre>foo</pre>
6172 </li>
6173 <li> <pre>bar</pre>
6174 </li>
6175 <li> zar
6176 </li>
6177 </ul>
6178
6179 !! end
6180
6181 !! test
6182 List items from template
6183 !! input
6184
6185 {{inner list}}
6186 * item 2
6187
6188 * item 0
6189 {{inner list}}
6190 * item 2
6191
6192 * item 0
6193 * notSOL{{inner list}}
6194 * item 2
6195 !! result
6196 <ul>
6197 <li> item 1
6198 </li>
6199 <li> item 2
6200 </li>
6201 </ul>
6202 <ul>
6203 <li> item 0
6204 </li>
6205 <li> item 1
6206 </li>
6207 <li> item 2
6208 </li>
6209 </ul>
6210 <ul>
6211 <li> item 0
6212 </li>
6213 <li> notSOL
6214 </li>
6215 <li> item 1
6216 </li>
6217 <li> item 2
6218 </li>
6219 </ul>
6220
6221 !! end
6222
6223 !! test
6224 List interrupted by empty line or heading
6225 !! input
6226 * foo
6227
6228 ** bar
6229 == A heading ==
6230 * Another list item
6231 !! result
6232 <ul>
6233 <li> foo
6234 </li>
6235 </ul>
6236 <ul>
6237 <li><ul>
6238 <li> bar
6239 </li>
6240 </ul>
6241 </li>
6242 </ul>
6243 <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>
6244 <ul>
6245 <li> Another list item
6246 </li>
6247 </ul>
6248
6249 !!end
6250
6251 !!test
6252 Multiple list tags generated by templates
6253 !!input
6254 {{echo|<li>}}a
6255 {{echo|<li>}}b
6256 {{echo|<li>}}c
6257 !!result
6258 <li>a
6259 <li>b
6260 <li>c</li>
6261 </li>
6262 </li>
6263
6264 !!end
6265
6266 !!test
6267 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
6268 !!input
6269 *a
6270 <!--This line will NOT split the list-->
6271 *b
6272 <!--This line will NOT split the list either-->
6273 *c
6274 <!--foo--> <!----> <!--This line NOT split the list either-->
6275 *d
6276 !!result
6277 <ul>
6278 <li>a
6279 </li>
6280 <li>b
6281 </li>
6282 <li>c
6283 </li>
6284 <li>d
6285 </li>
6286 </ul>
6287
6288 !!end
6289
6290 !!test
6291 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
6292 !!input
6293 *a
6294 <!--This line will NOT split the list-->
6295 *b
6296 <!--This line will NOT split the list either-->
6297 *c
6298 <!--foo--> <!----> <!--This line NOT split the list
6299 either-->
6300 *d
6301 !!result
6302 <ul>
6303 <li>a
6304 </li>
6305 <li>b
6306 </li>
6307 <li>c
6308 </li>
6309 <li>d
6310 </li>
6311 </ul>
6312
6313 !!end
6314
6315 !!test
6316 Test the li-hack
6317 (Cannot test this with PHP parser since it relies on Tidy for the hack)
6318 !!options
6319 parsoid=wt2html,wt2wt
6320 !!input
6321 * foo
6322 * <li>li-hack
6323 * {{echo|<li>templated li-hack}}
6324 * <!--foo--> <li> unsupported li-hack with preceding comments
6325
6326 <ul>
6327 <li><li>not a li-hack
6328 </li>
6329 </ul>
6330 !!result
6331 <ul>
6332 <li> foo</li>
6333 <li>li-hack</li>
6334 <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>
6335 <li> <!--foo--> </li>
6336 <li> li-hack with preceding comments</li>
6337 </ul>
6338
6339 <ul>
6340 <li></li>
6341 <li>not a li-hack
6342 </li>
6343 </ul>
6344 !!end
6345
6346 !! test
6347 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
6348 !! options
6349 parsoid
6350 !! input
6351 # foo
6352 ## bar
6353 * foo
6354 ** bar
6355 : foo
6356 :: bar
6357 !! result
6358 <ol>
6359 <li> foo<ol>
6360 <li> bar</li>
6361 </ol></li>
6362 </ol><ul>
6363 <li> foo<ul>
6364 <li> bar</li>
6365 </ul></li>
6366 </ul><dl>
6367 <dd> foo<dl>
6368 <dd> bar</dd>
6369 </dl></dd>
6370 </dl>
6371 !! end
6372
6373 !! test
6374 Parsoid: Test of whitespace serialization with Templated bullets
6375 !! options
6376 parsoid
6377 !! input
6378 * {{bullet}}
6379 !! result
6380 <ul>
6381 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
6382 </ul>
6383 !! end
6384
6385 # ------------------------------------------------------------------------
6386 # The next set of tests are about Parsoid's ability to handle badly nested
6387 # tags (parse, minimize scope of fixup, and roundtrip back)
6388 # ------------------------------------------------------------------------
6389
6390 !! test
6391 Unbalanced closing block tags break a list
6392 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6393 !! options
6394 parsoid
6395 !! input
6396 <div>
6397 *a</div><div>
6398 *b</div>
6399 !! result
6400 <div>
6401 <ul>
6402 <li>a
6403 </li>
6404 </ul></div><div>
6405 <ul>
6406 <li>b
6407 </li>
6408 </ul></div>
6409 !! end
6410
6411 !! test
6412 Unbalanced closing non-block tags don't break a list
6413 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6414 !! options
6415 parsoid
6416 !! input
6417 <span>
6418 *a</span><span>
6419 *b</span>
6420 !! result
6421 <p><span></span>
6422 </p>
6423 <ul>
6424 <li>a<span></span>
6425 </li>
6426 <li>b
6427 </li>
6428 </ul>
6429 !! end
6430
6431 !! test
6432 Unclosed formatting tags that straddle lists are closed and reopened
6433 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6434 !! options
6435 parsoid
6436 !! input
6437 # <s> a
6438 # b </s>
6439 !! result
6440 <ol>
6441 <li> <s> a </s>
6442 </li>
6443 <li> <s> b </s>
6444 </li>
6445 </ol>
6446 !! end
6447
6448 !!test
6449 List embedded in a non-block tag
6450 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
6451 !! options
6452 parsoid
6453 !!input
6454 <small>
6455 * foo
6456 </small>
6457 !!result
6458 <p><small></small></p>
6459 <small>
6460 <ul>
6461 <li> foo</li>
6462 </ul>
6463 </small>
6464 <p><small></small></p>
6465 !!end
6466
6467 !! test
6468 Table with missing opening <tr> tag
6469 !! options
6470 parsoid=wt2html,wt2wt
6471 !! input
6472 <table>
6473 <td>foo</td>
6474 </tr>
6475 </table>
6476 !! result
6477 <table>
6478 <tr>
6479 <td>foo</td>
6480 </tr>
6481 </table>
6482 !! end
6483
6484 ###
6485 ### Magic Words
6486 ###
6487
6488 # Note that the current date is hard-coded as
6489 # 1970-01-01T00:02:03Z (a Thursday)
6490 # when running parser tests. The timezone is also fixed to GMT, so
6491 # local date will be identical to current date.
6492
6493 !! test
6494 Magic Word: {{CURRENTDAY}}
6495 !! input
6496 {{CURRENTDAY}}
6497 !! result
6498 <p>1
6499 </p>
6500 !! end
6501
6502 !! test
6503 Magic Word: {{CURRENTDAY2}}
6504 !! input
6505 {{CURRENTDAY2}}
6506 !! result
6507 <p>01
6508 </p>
6509 !! end
6510
6511 !! test
6512 Magic Word: {{CURRENTDAYNAME}}
6513 !! input
6514 {{CURRENTDAYNAME}}
6515 !! result
6516 <p>Thursday
6517 </p>
6518 !! end
6519
6520 !! test
6521 Magic Word: {{CURRENTDOW}}
6522 !! input
6523 {{CURRENTDOW}}
6524 !! result
6525 <p>4
6526 </p>
6527 !! end
6528
6529 !! test
6530 Magic Word: {{CURRENTMONTH}}
6531 !! input
6532 {{CURRENTMONTH}}
6533 !! result
6534 <p>01
6535 </p>
6536 !! end
6537
6538 !! test
6539 Magic Word: {{CURRENTMONTH1}}
6540 !! input
6541 {{CURRENTMONTH1}}
6542 !! result
6543 <p>1
6544 </p>
6545 !! end
6546
6547 !! test
6548 Magic Word: {{CURRENTMONTHABBREV}}
6549 !! input
6550 {{CURRENTMONTHABBREV}}
6551 !! result
6552 <p>Jan
6553 </p>
6554 !! end
6555
6556 !! test
6557 Magic Word: {{CURRENTMONTHNAME}}
6558 !! input
6559 {{CURRENTMONTHNAME}}
6560 !! result
6561 <p>January
6562 </p>
6563 !! end
6564
6565 !! test
6566 Magic Word: {{CURRENTMONTHNAMEGEN}}
6567 !! input
6568 {{CURRENTMONTHNAMEGEN}}
6569 !! result
6570 <p>January
6571 </p>
6572 !! end
6573
6574 !! test
6575 Magic Word: {{CURRENTTIME}}
6576 !! input
6577 {{CURRENTTIME}}
6578 !! result
6579 <p>00:02
6580 </p>
6581 !! end
6582
6583 !! test
6584 Magic Word: {{CURRENTHOUR}}
6585 !! input
6586 {{CURRENTHOUR}}
6587 !! result
6588 <p>00
6589 </p>
6590 !! end
6591
6592 !! test
6593 Magic Word: {{CURRENTWEEK}} (@bug 4594)
6594 !! input
6595 {{CURRENTWEEK}}
6596 !! result
6597 <p>1
6598 </p>
6599 !! end
6600
6601 !! test
6602 Magic Word: {{CURRENTYEAR}}
6603 !! input
6604 {{CURRENTYEAR}}
6605 !! result
6606 <p>1970
6607 </p>
6608 !! end
6609
6610 !! test
6611 Magic Word: {{CURRENTTIMESTAMP}}
6612 !! input
6613 {{CURRENTTIMESTAMP}}
6614 !! result
6615 <p>19700101000203
6616 </p>
6617 !! end
6618
6619 !! test
6620 Magic Words LOCAL (UTC)
6621 !! input
6622 * {{LOCALMONTH}}
6623 * {{LOCALMONTH1}}
6624 * {{LOCALMONTHNAME}}
6625 * {{LOCALMONTHNAMEGEN}}
6626 * {{LOCALMONTHABBREV}}
6627 * {{LOCALDAY}}
6628 * {{LOCALDAY2}}
6629 * {{LOCALDAYNAME}}
6630 * {{LOCALYEAR}}
6631 * {{LOCALTIME}}
6632 * {{LOCALHOUR}}
6633 * {{LOCALWEEK}}
6634 * {{LOCALDOW}}
6635 * {{LOCALTIMESTAMP}}
6636 !! result
6637 <ul>
6638 <li> 01
6639 </li>
6640 <li> 1
6641 </li>
6642 <li> January
6643 </li>
6644 <li> January
6645 </li>
6646 <li> Jan
6647 </li>
6648 <li> 1
6649 </li>
6650 <li> 01
6651 </li>
6652 <li> Thursday
6653 </li>
6654 <li> 1970
6655 </li>
6656 <li> 00:02
6657 </li>
6658 <li> 00
6659 </li>
6660 <li> 1
6661 </li>
6662 <li> 4
6663 </li>
6664 <li> 19700101000203
6665 </li>
6666 </ul>
6667
6668 !! end
6669
6670 !! test
6671 Magic Word: {{FULLPAGENAME}}
6672 !! options
6673 title=[[User:Ævar Arnfjörð Bjarmason]]
6674 !! input
6675 {{FULLPAGENAME}}
6676 !! result
6677 <p>User:Ævar Arnfjörð Bjarmason
6678 </p>
6679 !! end
6680
6681 !! test
6682 Magic Word: {{FULLPAGENAMEE}}
6683 !! options
6684 title=[[User:Ævar Arnfjörð Bjarmason]]
6685 !! input
6686 {{FULLPAGENAMEE}}
6687 !! result
6688 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6689 </p>
6690 !! end
6691
6692 !! test
6693 Magic Word: {{TALKSPACE}}
6694 !! options
6695 title=[[User:Ævar Arnfjörð Bjarmason]]
6696 !! input
6697 {{TALKSPACE}}
6698 !! result
6699 <p>User talk
6700 </p>
6701 !! end
6702
6703 !! test
6704 Magic Word: {{TALKSPACE}}, same namespace
6705 !! options
6706 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6707 !! input
6708 {{TALKSPACE}}
6709 !! result
6710 <p>User talk
6711 </p>
6712 !! end
6713
6714 !! test
6715 Magic Word: {{TALKSPACE}}, main namespace
6716 !! options
6717 title=[[Parser Test]]
6718 !! input
6719 {{TALKSPACE}}
6720 !! result
6721 <p>Talk
6722 </p>
6723 !! end
6724
6725 !! test
6726 Magic Word: {{TALKSPACEE}}
6727 !! options
6728 title=[[User:Ævar Arnfjörð Bjarmason]]
6729 !! input
6730 {{TALKSPACEE}}
6731 !! result
6732 <p>User_talk
6733 </p>
6734 !! end
6735
6736 !! test
6737 Magic Word: {{SUBJECTSPACE}}
6738 !! options
6739 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6740 !! input
6741 {{SUBJECTSPACE}}
6742 !! result
6743 <p>User
6744 </p>
6745 !! end
6746
6747 !! test
6748 Magic Word: {{SUBJECTSPACE}}, same namespace
6749 !! options
6750 title=[[User:Ævar Arnfjörð Bjarmason]]
6751 !! input
6752 {{SUBJECTSPACE}}
6753 !! result
6754 <p>User
6755 </p>
6756 !! end
6757
6758 !! test
6759 Magic Word: {{SUBJECTSPACE}}, main namespace
6760 !! options
6761 title=[[Parser Test]]
6762 !! input
6763 {{SUBJECTSPACE}}
6764 !! result
6765
6766 !! end
6767
6768 !! test
6769 Magic Word: {{SUBJECTSPACEE}}
6770 !! options
6771 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6772 !! input
6773 {{SUBJECTSPACEE}}
6774 !! result
6775 <p>User
6776 </p>
6777 !! end
6778
6779 !! test
6780 Magic Word: {{NAMESPACE}}
6781 !! options
6782 title=[[User:Ævar Arnfjörð Bjarmason]]
6783 !! input
6784 {{NAMESPACE}}
6785 !! result
6786 <p>User
6787 </p>
6788 !! end
6789
6790 !! test
6791 Magic Word: {{NAMESPACEE}}
6792 !! options
6793 title=[[User:Ævar Arnfjörð Bjarmason]]
6794 !! input
6795 {{NAMESPACEE}}
6796 !! result
6797 <p>User
6798 </p>
6799 !! end
6800
6801 !! test
6802 Magic Word: {{NAMESPACENUMBER}}
6803 !! options
6804 title=[[User:Ævar Arnfjörð Bjarmason]]
6805 !! input
6806 {{NAMESPACENUMBER}}
6807 !! result
6808 <p>2
6809 </p>
6810 !! end
6811
6812 !! test
6813 Magic Word: {{SUBPAGENAME}}
6814 !! options
6815 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
6816 !! input
6817 {{SUBPAGENAME}}
6818 !! result
6819 <p>sub ö
6820 </p>
6821 !! end
6822
6823 !! test
6824 Magic Word: {{SUBPAGENAMEE}}
6825 !! options
6826 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
6827 !! input
6828 {{SUBPAGENAMEE}}
6829 !! result
6830 <p>sub_%C3%B6
6831 </p>
6832 !! end
6833
6834 !! test
6835 Magic Word: {{ROOTPAGENAME}}
6836 !! options
6837 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
6838 !! input
6839 {{ROOTPAGENAME}}
6840 !! result
6841 <p>Ævar Arnfjörð Bjarmason
6842 </p>
6843 !! end
6844
6845 !! test
6846 Magic Word: {{ROOTPAGENAMEE}}
6847 !! options
6848 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
6849 !! input
6850 {{ROOTPAGENAMEE}}
6851 !! result
6852 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6853 </p>
6854 !! end
6855
6856 !! test
6857 Magic Word: {{BASEPAGENAME}}
6858 !! options
6859 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
6860 !! input
6861 {{BASEPAGENAME}}
6862 !! result
6863 <p>Ævar Arnfjörð Bjarmason
6864 </p>
6865 !! end
6866
6867 !! test
6868 Magic Word: {{BASEPAGENAMEE}}
6869 !! options
6870 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
6871 !! input
6872 {{BASEPAGENAMEE}}
6873 !! result
6874 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6875 </p>
6876 !! end
6877
6878 !! test
6879 Magic Word: {{TALKPAGENAME}}
6880 !! options
6881 title=[[User:Ævar Arnfjörð Bjarmason]]
6882 !! input
6883 {{TALKPAGENAME}}
6884 !! result
6885 <p>User talk:Ævar Arnfjörð Bjarmason
6886 </p>
6887 !! end
6888
6889 !! test
6890 Magic Word: {{TALKPAGENAMEE}}
6891 !! options
6892 title=[[User:Ævar Arnfjörð Bjarmason]]
6893 !! input
6894 {{TALKPAGENAMEE}}
6895 !! result
6896 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6897 </p>
6898 !! end
6899
6900 !! test
6901 Magic Word: {{SUBJECTPAGENAME}}
6902 !! options
6903 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6904 !! input
6905 {{SUBJECTPAGENAME}}
6906 !! result
6907 <p>User:Ævar Arnfjörð Bjarmason
6908 </p>
6909 !! end
6910
6911 !! test
6912 Magic Word: {{SUBJECTPAGENAMEE}}
6913 !! options
6914 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6915 !! input
6916 {{SUBJECTPAGENAMEE}}
6917 !! result
6918 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6919 </p>
6920 !! end
6921
6922 !! test
6923 Magic Word: {{NUMBEROFFILES}}
6924 !! input
6925 {{NUMBEROFFILES}}
6926 !! result
6927 <p>4
6928 </p>
6929 !! end
6930
6931 !! test
6932 Magic Word: {{PAGENAME}}
6933 !! options
6934 title=[[User:Ævar Arnfjörð Bjarmason]]
6935 !! input
6936 {{PAGENAME}}
6937 !! result
6938 <p>Ævar Arnfjörð Bjarmason
6939 </p>
6940 !! end
6941
6942 !! test
6943 Magic Word: {{PAGENAME}} with metacharacters
6944 !! options
6945 title=[['foo & bar = baz']]
6946 !! input
6947 ''{{PAGENAME}}''
6948 !! result
6949 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
6950 </p>
6951 !! end
6952
6953 !! test
6954 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
6955 !! options
6956 title=[[*RFC 1234 http://example.com/]]
6957 !! input
6958 {{PAGENAME}}
6959 !! result
6960 <p>&#42;RFC&#32;1234 http&#58;//example.com/
6961 </p>
6962 !! end
6963
6964 !! test
6965 Magic Word: {{PAGENAMEE}}
6966 !! options
6967 title=[[User:Ævar Arnfjörð Bjarmason]]
6968 !! input
6969 {{PAGENAMEE}}
6970 !! result
6971 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6972 </p>
6973 !! end
6974
6975 !! test
6976 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
6977 !! options
6978 title=[[*RFC 1234 http://example.com/]]
6979 !! input
6980 {{PAGENAMEE}}
6981 !! result
6982 <p>&#42;RFC_1234_http&#58;//example.com/
6983 </p>
6984 !! end
6985
6986 !! test
6987 Magic Word: {{REVISIONID}}
6988 !! input
6989 {{REVISIONID}}
6990 !! result
6991 <p>1337
6992 </p>
6993 !! end
6994
6995 !! test
6996 Magic Word: {{SCRIPTPATH}}
6997 !! input
6998 {{SCRIPTPATH}}
6999 !! result
7000 <p>/
7001 </p>
7002 !! end
7003
7004 !! test
7005 Magic Word: {{STYLEPATH}}
7006 !! input
7007 {{STYLEPATH}}
7008 !! result
7009 <p>/skins
7010 </p>
7011 !! end
7012
7013 !! test
7014 Magic Word: {{SERVER}}
7015 !! input
7016 {{SERVER}}
7017 !! result
7018 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7019 </p>
7020 !! end
7021
7022 !! test
7023 Magic Word: {{SERVERNAME}}
7024 !! input
7025 {{SERVERNAME}}
7026 !! result
7027 <p>example.org
7028 </p>
7029 !! end
7030
7031 !! test
7032 Magic Word: {{SITENAME}}
7033 !! input
7034 {{SITENAME}}
7035 !! result
7036 <p>MediaWiki
7037 </p>
7038 !! end
7039
7040 !! test
7041 Case-sensitive magic words, when cased differently, should just be template transclusions
7042 !! input
7043 {{CurrentMonth}}
7044 {{currentday}}
7045 {{cURreNTweEK}}
7046 {{currentHour}}
7047 !! result
7048 <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>
7049 <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>
7050 <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>
7051 <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>
7052 </p>
7053 !! end
7054
7055 !! test
7056 Case-insensitive magic words should still work with weird casing.
7057 !! input
7058 {{sErVeRNaMe}}
7059 {{LCFirst:AOEU}}
7060 {{ucFIRST:aoeu}}
7061 {{SERver}}
7062 !! result
7063 <p>example.org
7064 aOEU
7065 Aoeu
7066 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7067 </p>
7068 !! end
7069
7070 !! test
7071 Namespace 1 {{ns:1}}
7072 !! input
7073 {{ns:1}}
7074 !! result
7075 <p>Talk
7076 </p>
7077 !! end
7078
7079 !! test
7080 Namespace 1 {{ns:01}}
7081 !! input
7082 {{ns:01}}
7083 !! result
7084 <p>Talk
7085 </p>
7086 !! end
7087
7088 !! test
7089 Namespace 0 {{ns:0}} (bug 4783)
7090 !! input
7091 {{ns:0}}
7092 !! result
7093
7094 !! end
7095
7096 !! test
7097 Namespace 0 {{ns:00}} (bug 4783)
7098 !! input
7099 {{ns:00}}
7100 !! result
7101
7102 !! end
7103
7104 !! test
7105 Namespace -1 {{ns:-1}}
7106 !! input
7107 {{ns:-1}}
7108 !! result
7109 <p>Special
7110 </p>
7111 !! end
7112
7113 !! test
7114 Namespace User {{ns:User}}
7115 !! input
7116 {{ns:User}}
7117 !! result
7118 <p>User
7119 </p>
7120 !! end
7121
7122 !! test
7123 Namespace User talk {{ns:User_talk}}
7124 !! input
7125 {{ns:User_talk}}
7126 !! result
7127 <p>User talk
7128 </p>
7129 !! end
7130
7131 !! test
7132 Namespace User talk {{ns:uSeR tAlK}}
7133 !! input
7134 {{ns:uSeR tAlK}}
7135 !! result
7136 <p>User talk
7137 </p>
7138 !! end
7139
7140 !! test
7141 Namespace File {{ns:File}}
7142 !! input
7143 {{ns:File}}
7144 !! result
7145 <p>File
7146 </p>
7147 !! end
7148
7149 !! test
7150 Namespace File {{ns:Image}}
7151 !! input
7152 {{ns:Image}}
7153 !! result
7154 <p>File
7155 </p>
7156 !! end
7157
7158 !! test
7159 Namespace (lang=de) Benutzer {{ns:User}}
7160 !! options
7161 language=de
7162 !! input
7163 {{ns:User}}
7164 !! result
7165 <p>Benutzer
7166 </p>
7167 !! end
7168
7169 !! test
7170 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
7171 !! options
7172 language=de
7173 !! input
7174 {{ns:3}}
7175 !! result
7176 <p>Benutzer Diskussion
7177 </p>
7178 !! end
7179
7180
7181 !! test
7182 Urlencode
7183 !! input
7184 {{urlencode:hi world?!}}
7185 {{urlencode:hi world?!|WIKI}}
7186 {{urlencode:hi world?!|PATH}}
7187 {{urlencode:hi world?!|QUERY}}
7188 !! result
7189 <p>hi+world%3F%21
7190 hi_world%3F!
7191 hi%20world%3F%21
7192 hi+world%3F%21
7193 </p>
7194 !! end
7195
7196 ###
7197 ### Magic links
7198 ###
7199 !! test
7200 Magic links: internal link to RFC (bug 479)
7201 !! input
7202 [[RFC 123]]
7203 !! result
7204 <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>
7205 </p>
7206 !! end
7207
7208 !! test
7209 Magic links: RFC (bug 479)
7210 !! input
7211 RFC 822
7212 !! result
7213 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
7214 </p>
7215 !! end
7216
7217 !! test
7218 Magic links: ISBN (bug 1937)
7219 !! input
7220 ISBN 0-306-40615-2
7221 !! result
7222 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
7223 </p>
7224 !! end
7225
7226 !! test
7227 Magic links: PMID incorrectly converts space to underscore
7228 !! input
7229 PMID 1234
7230 !! result
7231 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
7232 </p>
7233 !! end
7234
7235 ###
7236 ### Templates
7237 ####
7238
7239 !! test
7240 Nonexistent template
7241 !! input
7242 {{thistemplatedoesnotexist}}
7243 !! result
7244 <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>
7245 </p>
7246 !! end
7247
7248 !! test
7249 Template with invalid target containing tags
7250 !! input
7251 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
7252 !! result
7253 <p>{{a<b>b</b>|foo|a=b|a = b}}
7254 </p>
7255 !! end
7256
7257 !! test
7258 Template with invalid target containing unclosed tag
7259 !! input
7260 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
7261 !! result
7262 <p>{{a<b>|foo|a=b|a = b}}</b>
7263 </p>
7264 !! end
7265
7266 !! article
7267 Template:test
7268 !! text
7269 This is a test template
7270 !! endarticle
7271
7272 !! test
7273 Simple template
7274 !! input
7275 {{test}}
7276 !! result
7277 <p>This is a test template
7278 </p>
7279 !! end
7280
7281 !! test
7282 Template with explicit namespace
7283 !! input
7284 {{Template:test}}
7285 !! result
7286 <p>This is a test template
7287 </p>
7288 !! end
7289
7290
7291 !! article
7292 Template:paramtest
7293 !! text
7294 This is a test template with parameter {{{param}}}
7295 !! endarticle
7296
7297 !! test
7298 Template parameter
7299 !! input
7300 {{paramtest|param=foo}}
7301 !! result
7302 <p>This is a test template with parameter foo
7303 </p>
7304 !! end
7305
7306 !! article
7307 Template:paramtestnum
7308 !! text
7309 [[{{{1}}}|{{{2}}}]]
7310 !! endarticle
7311
7312 !! test
7313 Template unnamed parameter
7314 !! input
7315 {{paramtestnum|Main Page|the main page}}
7316 !! result
7317 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
7318 </p>
7319 !! end
7320
7321 !! article
7322 Template:templatesimple
7323 !! text
7324 (test)
7325 !! endarticle
7326
7327 !! article
7328 Template:templateredirect
7329 !! text
7330 #redirect [[Template:templatesimple]]
7331 !! endarticle
7332
7333 !! article
7334 Template:templateasargtestnum
7335 !! text
7336 {{{{{1}}}}}
7337 !! endarticle
7338
7339 !! article
7340 Template:templateasargtest
7341 !! text
7342 {{template{{{templ}}}}}
7343 !! endarticle
7344
7345 !! article
7346 Template:templateasargtest2
7347 !! text
7348 {{{{{templ}}}}}
7349 !! endarticle
7350
7351 !! test
7352 Template with template name as unnamed argument
7353 !! input
7354 {{templateasargtestnum|templatesimple}}
7355 !! result
7356 <p>(test)
7357 </p>
7358 !! end
7359
7360 !! test
7361 Template with template name as argument
7362 !! input
7363 {{templateasargtest|templ=simple}}
7364 !! result
7365 <p>(test)
7366 </p>
7367 !! end
7368
7369 !! test
7370 Template with template name as argument (2)
7371 !! input
7372 {{templateasargtest2|templ=templatesimple}}
7373 !! result
7374 <p>(test)
7375 </p>
7376 !! end
7377
7378 !! article
7379 Template:templateasargtestdefault
7380 !! text
7381 {{{{{templ|templatesimple}}}}}
7382 !! endarticle
7383
7384 !! article
7385 Template:templa
7386 !! text
7387 '''templ'''
7388 !! endarticle
7389
7390 !! test
7391 Template with default value
7392 !! input
7393 {{templateasargtestdefault}}
7394 !! result
7395 <p>(test)
7396 </p>
7397 !! end
7398
7399 !! test
7400 Template with default value (value set)
7401 !! input
7402 {{templateasargtestdefault|templ=templa}}
7403 !! result
7404 <p><b>templ</b>
7405 </p>
7406 !! end
7407
7408 !! test
7409 Template redirect
7410 !! input
7411 {{templateredirect}}
7412 !! result
7413 <p>(test)
7414 </p>
7415 !! end
7416
7417 !! test
7418 Template with argument in separate line
7419 !! input
7420 {{ templateasargtest |
7421 templ = simple }}
7422 !! result
7423 <p>(test)
7424 </p>
7425 !! end
7426
7427 !! test
7428 Template with complex template as argument
7429 !! input
7430 {{paramtest|
7431 param ={{ templateasargtest |
7432 templ = simple }}}}
7433 !! result
7434 <p>This is a test template with parameter (test)
7435 </p>
7436 !! end
7437
7438 !! test
7439 Template with thumb image (with link in description)
7440 !! input
7441 {{paramtest|
7442 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
7443 !! result
7444 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>
7445
7446 !! end
7447
7448 !! article
7449 Template:complextemplate
7450 !! text
7451 {{{1}}} {{paramtest|
7452 param ={{{param}}}}}
7453 !! endarticle
7454
7455 !! test
7456 Template with complex arguments
7457 !! input
7458 {{complextemplate|
7459 param ={{ templateasargtest |
7460 templ = simple }}|[[Template:complextemplate|link]]}}
7461 !! result
7462 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
7463 </p>
7464 !! end
7465
7466 !! test
7467 BUG 553: link with two variables in a piped link
7468 !! input
7469 {|
7470 |[[{{{1}}}|{{{2}}}]]
7471 |}
7472 !! result
7473 <table>
7474 <tr>
7475 <td>[[{{{1}}}|{{{2}}}]]
7476 </td></tr></table>
7477
7478 !! end
7479
7480 !! test
7481 Magic variable as template parameter
7482 !! input
7483 {{paramtest|param={{SITENAME}}}}
7484 !! result
7485 <p>This is a test template with parameter MediaWiki
7486 </p>
7487 !! end
7488
7489 !! article
7490 Template:linktest
7491 !! text
7492 [[{{{param}}}|link]]
7493 !! endarticle
7494
7495 !! test
7496 Template parameter as link source
7497 !! input
7498 {{linktest|param=Main Page}}
7499 !! result
7500 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
7501 </p>
7502 !! end
7503
7504 !!test
7505 Template-generated attribute string (k='v')
7506 !!input
7507 <span {{attr_str|id|v1}}>bar</span>
7508 !!result
7509 <p><span id="v1">bar</span>
7510 </p>
7511 !!end
7512
7513 !!article
7514 Template:paramtest2
7515 !! text
7516 including another template, {{paramtest|param={{{arg}}}}}
7517 !! endarticle
7518
7519 !! test
7520 Template passing argument to another template
7521 !! input
7522 {{paramtest2|arg='hmm'}}
7523 !! result
7524 <p>including another template, This is a test template with parameter 'hmm'
7525 </p>
7526 !! end
7527
7528 !! article
7529 Template:Linktest2
7530 !! text
7531 Main Page
7532 !! endarticle
7533
7534 !! test
7535 Template as link source
7536 !! input
7537 [[{{linktest2}}]]
7538
7539 [[{{linktest2}}|Main Page]]
7540
7541 [[{{linktest2}}]]Page
7542 !! result
7543 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7544 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7545 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
7546 </p>
7547 !! end
7548
7549
7550 !! article
7551 Template:loop1
7552 !! text
7553 {{loop2}}
7554 !! endarticle
7555
7556 !! article
7557 Template:loop2
7558 !! text
7559 {{loop1}}
7560 !! endarticle
7561
7562 !! test
7563 Template infinite loop
7564 !! input
7565 {{loop1}}
7566 !! result
7567 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
7568 </p>
7569 !! end
7570
7571 !! test
7572 Template from main namespace
7573 !! input
7574 {{:Main Page}}
7575 !! result
7576 <p>blah blah
7577 </p>
7578 !! end
7579
7580 !! article
7581 Template:table
7582 !! text
7583 {|
7584 | 1 || 2
7585 |-
7586 | 3 || 4
7587 |}
7588 !! endarticle
7589
7590 !! test
7591 BUG 529: Template with table, not included at beginning of line
7592 !! input
7593 foo {{table}}
7594 !! result
7595 <p>foo
7596 </p>
7597 <table>
7598 <tr>
7599 <td> 1 </td>
7600 <td> 2
7601 </td></tr>
7602 <tr>
7603 <td> 3 </td>
7604 <td> 4
7605 </td></tr></table>
7606
7607 !! end
7608
7609 !! test
7610 BUG 523: Template shouldn't eat newline (or add an extra one before table)
7611 !! input
7612 foo
7613 {{table}}
7614 !! result
7615 <p>foo
7616 </p>
7617 <table>
7618 <tr>
7619 <td> 1 </td>
7620 <td> 2
7621 </td></tr>
7622 <tr>
7623 <td> 3 </td>
7624 <td> 4
7625 </td></tr></table>
7626
7627 !! end
7628
7629 !! test
7630 BUG 41: Template parameters shown as broken links
7631 !! input
7632 {{{parameter}}}
7633 !! result
7634 <p>{{{parameter}}}
7635 </p>
7636 !! end
7637
7638 !! test
7639 Template with targets containing wikilinks
7640 !! input
7641 {{[[foo]]}}
7642
7643 {{[[{{echo|foo}}]]}}
7644
7645 {{{{echo|[[foo}}]]}}
7646 !! result
7647 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
7648 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
7649 </p><p>{{[[foo}}]]
7650 </p>
7651 !! end
7652
7653 !! article
7654 Template:MSGNW test
7655 !! text
7656 ''None'' of '''this''' should be
7657 * interpreted
7658 but rather passed unmodified
7659 {{test}}
7660 !! endarticle
7661
7662 # hmm, fix this or just deprecate msgnw and document its behavior?
7663 !! test
7664 msgnw keyword
7665 !! options
7666 disabled
7667 !! input
7668 {{msgnw:MSGNW test}}
7669 !! result
7670 <p>''None'' of '''this''' should be
7671 * interpreted
7672 but rather passed unmodified
7673 {{test}}
7674 </p>
7675 !! end
7676
7677 !! test
7678 int keyword
7679 !! input
7680 {{int:youhavenewmessages|lots of money|not!}}
7681 !! result
7682 <p>You have lots of money (not!).
7683 </p>
7684 !! end
7685
7686 !! article
7687 Template:Includes
7688 !! text
7689 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
7690 !! endarticle
7691
7692 !! test
7693 <includeonly> and <noinclude> being included
7694 !! input
7695 {{Includes}}
7696 !! result
7697 <p>Foobar
7698 </p>
7699 !! end
7700
7701 !! article
7702 Template:Includes2
7703 !! text
7704 <onlyinclude>Foo</onlyinclude>bar
7705 !! endarticle
7706
7707 !! test
7708 <onlyinclude> being included
7709 !! input
7710 {{Includes2}}
7711 !! result
7712 <p>Foo
7713 </p>
7714 !! end
7715
7716
7717 !! article
7718 Template:Includes3
7719 !! text
7720 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
7721 !! endarticle
7722
7723 !! test
7724 <onlyinclude> and <includeonly> being included
7725 !! input
7726 {{Includes3}}
7727 !! result
7728 <p>Foo
7729 </p>
7730 !! end
7731
7732 !! test
7733 <includeonly> and <noinclude> on a page
7734 !! input
7735 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
7736 !! result
7737 <p>Foozar
7738 </p>
7739 !! end
7740
7741 !! test
7742 Un-closed <noinclude>
7743 !! input
7744 <noinclude>
7745 !! result
7746 !! end
7747
7748 !! test
7749 <onlyinclude> on a page
7750 !! input
7751 <onlyinclude>Foo</onlyinclude>bar
7752 !! result
7753 <p>Foobar
7754 </p>
7755 !! end
7756
7757 !! test
7758 Un-closed <onlyinclude>
7759 !! input
7760 <onlyinclude>
7761 !! result
7762 !! end
7763
7764 !!test
7765 Self-closed noinclude, includeonly, onlyinclude tags
7766 !!input
7767 <noinclude />
7768 <includeonly />
7769 <onlyinclude />
7770 !!result
7771 <p><br />
7772 </p>
7773 !!end
7774
7775 !!test
7776 Unbalanced includeonly and noinclude tags
7777 !!input
7778 {|
7779 |a</noinclude>
7780 |b</noinclude></noinclude>
7781 |c</noinclude></includeonly>
7782 |d</includeonly></includeonly>
7783 |}
7784 !!result
7785 <table>
7786 <tr>
7787 <td>a
7788 </td>
7789 <td>b
7790 </td>
7791 <td>c&lt;/includeonly&gt;
7792 </td>
7793 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
7794 </td></tr></table>
7795
7796 !!end
7797
7798 !! article
7799 Template:Includeonly section
7800 !! text
7801 <includeonly>
7802 ==Includeonly section==
7803 </includeonly>
7804 ==Section T-1==
7805 !!endarticle
7806
7807 !! test
7808 Bug 6563: Edit link generation for section shown by <includeonly>
7809 !! input
7810 {{includeonly section}}
7811 !! result
7812 <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>
7813 <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>
7814
7815 !! end
7816
7817 # Uses same input as the contents of [[Template:Includeonly section]]
7818 !! test
7819 Bug 6563: Section extraction for section shown by <includeonly>
7820 !! options
7821 section=T-2
7822 !! input
7823 <includeonly>
7824 ==Includeonly section==
7825 </includeonly>
7826 ==Section T-2==
7827 !! result
7828 ==Section T-2==
7829 !! end
7830
7831 !! test
7832 Bug 6563: Edit link generation for section suppressed by <includeonly>
7833 !! input
7834 <includeonly>
7835 ==Includeonly section==
7836 </includeonly>
7837 ==Section 1==
7838 !! result
7839 <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>
7840
7841 !! end
7842
7843 !! test
7844 Bug 6563: Section extraction for section suppressed by <includeonly>
7845 !! options
7846 section=1
7847 !! input
7848 <includeonly>
7849 ==Includeonly section==
7850 </includeonly>
7851 ==Section 1==
7852 !! result
7853 ==Section 1==
7854 !! end
7855
7856 !! test
7857 Un-closed <includeonly>
7858 !! input
7859 <includeonly>
7860 !! result
7861 !! end
7862
7863 # TODO: test with DOM fragment reuse!
7864 !! test
7865 Parsoid: DOM fragment reuse
7866 !! options
7867 parsoid=wt2wt,wt2html
7868 !! input
7869 a{{echo|b<table></table>c}}d
7870
7871 a{{echo|b
7872 <table></table>
7873 c}}d
7874
7875 {{echo|a
7876
7877 <table></table>
7878
7879 b}}
7880 !! result
7881 a<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b
7882 <table></table>c"}},"i":0}}]}'>b</span>
7883 <table about="#mwt1"></table><span about="#mwt1">c</span>d
7884
7885
7886 <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">
7887 </span>
7888 <table about="#mwt2"></table><span about="#mwt2">
7889 </span>
7890 <p about="#mwt2">cd</p>
7891
7892
7893 <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">
7894
7895 </span>
7896 <table about="#mwt3"></table><span about="#mwt3">
7897
7898 </span>
7899 <p about="#mwt3">b</p>
7900 !! end
7901
7902 !! test
7903 Parsoid: Merge double tds (bug 50603)
7904 !! options
7905 parsoid
7906 !! input
7907 {|
7908 |{{echo|{{!}} foo}}
7909 |}
7910 !! result
7911 <table><tbody>
7912 <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>
7913 </tbody></table>
7914 !! end
7915
7916 !! test
7917 Parsoid: Merge double tds in nested transclusion content (bug 50603)
7918 !! options
7919 parsoid
7920 !! input
7921 {{echo|<div>}}
7922 {|
7923 |{{echo|{{!}} foo}}
7924 |}
7925 {{echo|</div>}}
7926 !! result
7927 <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}}]}'>
7928 <table><tbody>
7929 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
7930 </tbody></table>
7931 </div>
7932 !! end
7933
7934 ###
7935 ### <includeonly> and <noinclude> in attributes
7936 ###
7937 !!test
7938 0. includeonly around the entire attribute
7939 !!input
7940 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
7941 !!result
7942 <p><span id="v2">bar</span>
7943 </p>
7944 !!end
7945
7946 !!test
7947 1. includeonly in html attr key
7948 !!input
7949 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
7950 !!result
7951 <p><span id="foo">bar</span>
7952 </p>
7953 !!end
7954
7955 !!test
7956 2. includeonly in html attr value
7957 !!input
7958 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
7959 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
7960 !!result
7961 <p><span id="v1">bar</span>
7962 <span id="v1">bar</span>
7963 </p>
7964 !!end
7965
7966 !!test
7967 3. includeonly in part of an attr value
7968 !!input
7969 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
7970 !!result
7971 <p><span style="color:red;">bar</span>
7972 </p>
7973 !!end
7974
7975 ###
7976 ### Testing parsing of templates where a template arg
7977 ### has the same name as the template itself.
7978 ###
7979
7980 !! article
7981 Template:quote
7982 !! text
7983 {{{quote|{{{1}}}}}}
7984 !! endarticle
7985
7986 !!test
7987 Templates: Template Name/Arg clash: 1. Use of positional param
7988 !!input
7989 {{quote|foo}}
7990 !!result
7991 <p>foo
7992 </p>
7993 !!end
7994
7995 !!test
7996 Templates: Template Name/Arg clash: 2. Use of named param
7997 !!input
7998 {{quote|quote=foo}}
7999 !!result
8000 <p>foo
8001 </p>
8002 !!end
8003
8004 !!test
8005 Templates: Template Name/Arg clash: 3. Use of named param with empty input
8006 !!input
8007 {{quote|quote}}
8008 !!result
8009 <p>quote
8010 </p>
8011 !!end
8012
8013 ###
8014 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
8015 ###
8016
8017 !!test
8018 Templates: 1. Simple use
8019 !!input
8020 {{echo|Foo}}
8021 !!result
8022 <p>Foo
8023 </p>
8024 !!end
8025
8026 !!test
8027 Templates: 2. Inside a block tag
8028 !!input
8029 <div>{{echo|Foo}}</div>
8030 <blockquote>{{echo|Foo}}</blockquote>
8031 !!result
8032 <div>Foo</div>
8033 <blockquote>Foo</blockquote>
8034
8035 !!end
8036
8037 !!test
8038 Templates: P-wrapping: 1a. Templates on consecutive lines
8039 !!input
8040 {{echo|Foo}}
8041 {{echo|bar}}
8042 !!result
8043 <p>Foo
8044 bar
8045 </p>
8046 !!end
8047
8048 !!test
8049 Templates: P-wrapping: 1b. Templates on consecutive lines
8050 !!input
8051 Foo
8052
8053 {{echo|bar}}
8054 {{echo|baz}}
8055 !!result
8056 <p>Foo
8057 </p><p>bar
8058 baz
8059 </p>
8060 !!end
8061
8062 !!test
8063 Templates: P-wrapping: 1c. Templates on consecutive lines
8064 !!input
8065 {{echo|Foo}}
8066 {{echo|bar}} <div>baz</div>
8067 !!result
8068 <p>Foo
8069 </p>
8070 bar <div>baz</div>
8071
8072 !!end
8073
8074 !!test
8075 Templates: P-wrapping: 1d. Template preceded by comment-only line
8076 !!options
8077 parsoid
8078 !!input
8079 <!-- foo -->
8080 {{echo|Bar}}
8081 !!result
8082 <!-- foo -->
8083
8084 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
8085 !!end
8086
8087 !!test
8088 Templates: Inline Text: 1. Multiple tmeplate uses
8089 !!input
8090 {{echo|Foo}}bar{{echo|baz}}
8091 !!result
8092 <p>Foobarbaz
8093 </p>
8094 !!end
8095
8096 !!test
8097 Templates: Inline Text: 2. Back-to-back template uses
8098 !!input
8099 {{echo|Foo}}{{echo|bar}}
8100 !!result
8101 <p>Foobar
8102 </p>
8103 !!end
8104
8105 !!test
8106 Templates: Block Tags: 1. Multiple template uses
8107 !!input
8108 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
8109 !!result
8110 <div>Foo</div><div>bar</div><div>baz</div>
8111
8112 !!end
8113
8114 !!test
8115 Templates: Block Tags: 2. Back-to-back template uses
8116 !!input
8117 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
8118 !!result
8119 <div>Foo</div><div>bar</div>
8120
8121 !!end
8122
8123 !!test
8124 Templates: Links: 1. Simple example
8125 !!input
8126 {{echo|[[Foo|bar]]}}
8127 !!result
8128 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8129 </p>
8130 !!end
8131
8132 !!test
8133 Templates: Links: 2. Generation of link href
8134 !!input
8135 [[{{echo|Foo}}|bar]]
8136 !!result
8137 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8138 </p>
8139 !!end
8140
8141 !!test
8142 Templates: Links: 3. Generation of part of a link href
8143 !!input
8144 [[Fo{{echo|o}}|bar]]
8145
8146 [[Foo{{echo|bar}}]]
8147
8148 [[Foo{{echo|bar}}baz]]
8149
8150 [[Foo{{echo|bar}}|bar]]
8151
8152 [[:Foo{{echo|bar}}]]
8153
8154 [[:Foo{{echo|bar}}|bar]]
8155 !!result
8156 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8157 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8158 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
8159 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
8160 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8161 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
8162 </p>
8163 !!end
8164
8165 !!test
8166 Templates: Links: 4. Multiple templates generating link href
8167 !!input
8168 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
8169 !!result
8170 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8171 </p>
8172 !!end
8173
8174 !!test
8175 Templates: Links: 5. Generation of link text
8176 !!input
8177 [[Foo|{{echo|bar}}]]
8178 !!result
8179 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8180 </p>
8181 !!end
8182
8183 !!test
8184 Templates: Links: 5. Nested templates (only outermost template should be marked)
8185 !!input
8186 {{echo|[[{{echo|Foo}}|bar]]}}
8187 !!result
8188 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8189 </p>
8190 !!end
8191
8192 !!test
8193 Templates: HTML Tag: 1. Generation of HTML attr. key
8194 !!input
8195 <div {{echo|style}}="color:red;">foo</div>
8196 !!result
8197 <div style="color:red;">foo</div>
8198
8199 !!end
8200
8201 !!test
8202 Templates: HTML Tag: 2. Generation of HTML attr. value
8203 !!input
8204 <div style={{echo|'color:red;'}}>foo</div>
8205 !!result
8206 <div style="color:red;">foo</div>
8207
8208 !!end
8209
8210 !!test
8211 Templates: HTML Tag: 3. Generation of HTML attr key and value
8212 !!input
8213 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
8214 !!result
8215 <div style="color:red;">foo</div>
8216
8217 !!end
8218
8219 !!test
8220 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
8221 !!input
8222 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
8223 !!result
8224 <div title="This is a long title with just one piece templated">foo</div>
8225
8226 !!end
8227
8228 !!test
8229 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
8230 !!input
8231 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
8232 !!result
8233 <div title="This is a long title with just one piece templated">foo</div>
8234
8235 !!end
8236
8237 !!test
8238 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
8239 !!input
8240 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
8241 !!result
8242 <div title="This is a long title with just one piece templated">foo</div>
8243
8244 !!end
8245
8246 !!test
8247 Templates: HTML Tag: 7. Generation of partial attribute key string
8248 !!input
8249 <div st{{echo|yle}}="color:red;">foo</div>
8250 !!result
8251 <div style="color:red;">foo</div>
8252
8253 !!end
8254
8255 !!test
8256 Templates: HTML Tables: 1. Generating start of a HTML table
8257 !!input
8258 {{echo|<table><tr><td>foo</td>}}</tr></table>
8259 !!result
8260 <table><tr><td>foo</td></tr></table>
8261
8262 !!end
8263
8264 !!test
8265 Templates: HTML Tables: 2a. Generating middle of a HTML table
8266 !!input
8267 <table><tr>{{echo|<td>foo</td>}}</tr></table>
8268 !!result
8269 <table><tr><td>foo</td></tr></table>
8270
8271 !!end
8272
8273 !!test
8274 Templates: HTML Tables: 2b. Generating middle of a HTML table
8275 !!input
8276 <table>{{echo|<tr><td>foo</td></tr>}}</table>
8277 !!result
8278 <table><tr><td>foo</td></tr></table>
8279
8280 !!end
8281
8282 !!test
8283 Templates: HTML Tables: 3. Generating end of a HTML table
8284 !!input
8285 <table><tr>{{echo|<td>foo</td></tr></table>}}
8286 !!result
8287 <table><tr><td>foo</td></tr></table>
8288
8289 !!end
8290
8291 !!test
8292 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
8293 !!input
8294 {{echo|<table>}}<tr><td>foo</td></tr></table>
8295 !!result
8296 <table><tr><td>foo</td></tr></table>
8297
8298 !!end
8299
8300 !!test
8301 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
8302 !!input
8303 <table>{{echo|<tr>}}<td>foo</td></tr></table>
8304 !!result
8305 <table><tr><td>foo</td></tr></table>
8306
8307 !!end
8308
8309 !!test
8310 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
8311 !!input
8312 <table><tr>{{echo|<td>}}foo</td></tr></table>
8313 !!result
8314 <table><tr><td>foo</td></tr></table>
8315
8316 !!end
8317
8318 !!test
8319 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
8320 !!input
8321 <table><tr><td>foo{{echo|</td>}}</tr></table>
8322 !!result
8323 <table><tr><td>foo</td></tr></table>
8324
8325 !!end
8326
8327 !!test
8328 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
8329 !!input
8330 <table><tr><td>foo</td>{{echo|</tr>}}</table>
8331 !!result
8332 <table><tr><td>foo</td></tr></table>
8333
8334 !!end
8335
8336 !!test
8337 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
8338 !!input
8339 <table><tr><td>foo</td></tr>{{echo|</table>}}
8340 !!result
8341 <table><tr><td>foo</td></tr></table>
8342
8343 !!end
8344
8345 !!test
8346 Templates: HTML Tables: 5. Proper fostering of categories from inside
8347 !!options
8348 parsoid=wt2html,wt2wt
8349 !!input
8350 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
8351 <!--Two categories (Bug 50330)-->
8352 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
8353 !!result
8354 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
8355 <!--Two categories (Bug 50330)-->
8356 <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>
8357 !!end
8358
8359 !!test
8360 Templates: Wiki Tables: 1a. Fostering of entire template content
8361 !!input
8362 {|
8363 {{echo|a}}
8364 |}
8365 !!result
8366 <table>
8367 a
8368 <tr><td></td></tr></table>
8369
8370 !!end
8371
8372 !!test
8373 Templates: Wiki Tables: 1b. Fostering of entire template content
8374 !!input
8375 {|
8376 {{echo|<div>}}
8377 foo
8378 {{echo|</div>}}
8379 |}
8380 !!result
8381 <table>
8382 <div>
8383 <p>foo
8384 </p>
8385 </div>
8386 <tr><td></td></tr></table>
8387
8388 !!end
8389
8390 !!test
8391 Templates: Wiki Tables: 2. Fostering of partial template content
8392 !!input
8393 {|
8394 {{echo|a
8395 <div>b</div>}}
8396 |}
8397 !!result
8398 <table>
8399 a
8400 <div>b</div>
8401 <tr><td></td></tr></table>
8402
8403 !!end
8404
8405 !!test
8406 Templates: Wiki Tables: 3. td-content via multiple templates
8407 !!input
8408 {|
8409 {{echo|{{pipe}}a}}{{echo|b}}
8410 |}
8411 !!result
8412 <table>
8413 <tr>
8414 <td>ab
8415 </td></tr></table>
8416
8417 !!end
8418
8419 !!test
8420 Templates: Wiki Tables: 4. Templated tags, no content
8421 !!input
8422 {{tbl-start}}
8423 {{tbl-end}}
8424 !!result
8425 <table>
8426 <tr><td></td></tr></table>
8427
8428 !!end
8429
8430 !!test
8431 Templates: Wiki Tables: 5. Templated tags, regular td-tags
8432 !!input
8433 {{tbl-start}}
8434 |foo
8435 {{tbl-end}}
8436 !!result
8437 <table>
8438 <tr>
8439 <td>foo
8440 </td></tr></table>
8441
8442 !!end
8443
8444 !!test
8445 Templates: Wiki Tables: 6. Templated tags, templated td-tags
8446 !!input
8447 {{tbl-start}}
8448 {{!}}foo
8449 {{tbl-end}}
8450 !!result
8451 <table>
8452 <tr>
8453 <td>foo
8454 </td></tr></table>
8455
8456 !!end
8457
8458 !!test
8459 Templates: Lists: Multi-line list-items via templates
8460 !!input
8461 *{{echo|a {{nonexistent|
8462 unused}}}}
8463 *{{echo|b {{nonexistent|
8464 unused}}}}
8465 !!result
8466 <ul>
8467 <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>
8468 </li>
8469 <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>
8470 </li>
8471 </ul>
8472
8473 !!end
8474
8475 !!test
8476 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
8477 !!input
8478 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
8479 !!result
8480 <p><i>ab</i>c<i>d</i>e
8481 </p>
8482 !!end
8483
8484 !!test
8485 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
8486 (PHP parser generates misnested html)
8487 !! options
8488 parsoid
8489 !!input
8490 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
8491 !!result
8492 <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>
8493 !!end
8494
8495 !!test
8496 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
8497 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
8498 !! options
8499 parsoid=wt2html,wt2wt
8500 !!input
8501 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
8502 !!result
8503 <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>
8504 <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>
8505 <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>
8506 !!end
8507
8508 !!test
8509 Templates: Ugly nesting: 4. Divs opened/closed across templates
8510 !!input
8511 a<div>b{{echo|c</div>d}}e
8512 !!result
8513 a<div>bc</div>de
8514
8515 !!end
8516
8517 !!test
8518 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
8519 (Parsoid-centric)
8520 !! options
8521 parsoid
8522 !!input
8523 {|
8524 |{{echo|foo</table>}}
8525 |bar
8526 |}
8527 !!result
8528 <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|}"]}'>
8529
8530 <tbody>
8531 <tr>
8532 <td>foo</td></tr></tbody></table><span about="#mwt1">
8533 </span><span about="#mwt1">bar</span><span about="#mwt1">
8534 </span>
8535 !!end
8536
8537 !!test
8538 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
8539 (Parsoid-centric)
8540 !! options
8541 parsoid
8542 !!input
8543 <table>
8544 <tr>
8545 <td>
8546 <table>
8547 <tr>
8548 <td>1. {{echo|foo </table>}}</td>
8549 <td> bar </td>
8550 <td>2. {{echo|baz </table>}}</td>
8551 </tr>
8552 <tr>
8553 <td>abc</td>
8554 </tr>
8555 </table>
8556 </td>
8557 </tr>
8558 <tr>
8559 <td>xyz</td>
8560 </tr>
8561 </table>
8562 !!result
8563 <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>"]}'>
8564 <tbody><tr>
8565 <td>
8566 <table>
8567 <tbody><tr>
8568 <td>1. foo </td></tr></tbody></table></td>
8569 <td> bar </td>
8570 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
8571 </span><span about="#mwt2">
8572 </span><span about="#mwt2">
8573 </span><span about="#mwt2">abc</span><span about="#mwt2">
8574 </span><span about="#mwt2">
8575 </span><span about="#mwt2">
8576 </span><span about="#mwt2">
8577 </span><span about="#mwt2">
8578 </span><span about="#mwt2">
8579 </span><span about="#mwt2">xyz</span><span about="#mwt2">
8580 </span><span about="#mwt2">
8581 </span>
8582 !!end
8583
8584 !! test
8585 Templates: Ugly templates: 3. newline-only template parameter
8586 !! input
8587 foo {{echo|
8588 }}
8589 !! result
8590 <p>foo
8591 </p>
8592 !! end
8593
8594 # This looks like a bug: a single newline triggers p/br for some reason.
8595 !! test
8596 Templates: Ugly templates: 4. newline-only template parameter inconsistency
8597 !! input
8598 {{echo|
8599 }}
8600 !! result
8601 <p><br />
8602 </p>
8603 !! end
8604
8605
8606 !!test
8607 Parser Functions: 1. Simple example
8608 !!input
8609 {{uc:foo}}
8610 !!result
8611 <p>FOO
8612 </p>
8613 !!end
8614
8615 !!test
8616 Parser Functions: 2. Nested use (only outermost should be marked up)
8617 !!input
8618 {{uc:{{lc:FOO}}}}
8619 !!result
8620 <p>FOO
8621 </p>
8622 !!end
8623
8624 ###
8625 ### Pre-save transform tests
8626 ###
8627 !! test
8628 pre-save transform: subst:
8629 !! options
8630 PST
8631 !! input
8632 {{subst:test}}
8633 !! result
8634 This is a test template
8635 !! end
8636
8637 !! test
8638 pre-save transform: normal template
8639 !! options
8640 PST
8641 !! input
8642 {{test}}
8643 !! result
8644 {{test}}
8645 !! end
8646
8647 !! test
8648 pre-save transform: nonexistent template
8649 !! options
8650 PST
8651 !! input
8652 {{thistemplatedoesnotexist}}
8653 !! result
8654 {{thistemplatedoesnotexist}}
8655 !! end
8656
8657
8658 !! test
8659 pre-save transform: subst magic variables
8660 !! options
8661 PST
8662 !! input
8663 {{subst:SITENAME}}
8664 !! result
8665 MediaWiki
8666 !! end
8667
8668 # This is bug 89, which I fixed. -- wtm
8669 !! test
8670 pre-save transform: subst: templates with parameters
8671 !! options
8672 pst
8673 !! input
8674 {{subst:paramtest|param="something else"}}
8675 !! result
8676 This is a test template with parameter "something else"
8677 !! end
8678
8679 !! article
8680 Template:nowikitest
8681 !! text
8682 <nowiki>'''not wiki'''</nowiki>
8683 !! endarticle
8684
8685 !! test
8686 pre-save transform: nowiki in subst (bug 1188)
8687 !! options
8688 pst
8689 !! input
8690 {{subst:nowikitest}}
8691 !! result
8692 <nowiki>'''not wiki'''</nowiki>
8693 !! end
8694
8695
8696 !! article
8697 Template:commenttest
8698 !! text
8699 This template has <!-- a comment --> in it.
8700 !! endarticle
8701
8702 !! test
8703 pre-save transform: comment in subst (bug 1936)
8704 !! options
8705 pst
8706 !! input
8707 {{subst:commenttest}}
8708 !! result
8709 This template has <!-- a comment --> in it.
8710 !! end
8711
8712 !! test
8713 pre-save transform: unclosed tag
8714 !! options
8715 pst noxml
8716 !! input
8717 <nowiki>'''not wiki'''
8718 !! result
8719 <nowiki>'''not wiki'''
8720 !! end
8721
8722 !! test
8723 pre-save transform: mixed tag case
8724 !! options
8725 pst noxml
8726 !! input
8727 <NOwiki>'''not wiki'''</noWIKI>
8728 !! result
8729 <NOwiki>'''not wiki'''</noWIKI>
8730 !! end
8731
8732 !! test
8733 pre-save transform: unclosed comment in <nowiki>
8734 !! options
8735 pst noxml
8736 !! input
8737 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
8738 !! result
8739 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
8740 !!end
8741
8742 # Leading @ in this template definition works around a limitation
8743 # in parsoid's parserTests which otherwise strips the <span> from the
8744 # result (confusing it for a template wrapper)
8745 !! article
8746 Template:dangerous
8747 !!text
8748 @<span onmouseover="alert('crap')">Oh no</span>
8749 !!endarticle
8750
8751 !!test
8752 (confirming safety of fix for subst bug 1936)
8753 !! input
8754 {{Template:dangerous}}
8755 !! result
8756 <p>@<span>Oh no</span>
8757 </p>
8758 !! end
8759
8760 !! test
8761 pre-save transform: comment containing gallery (bug 5024)
8762 !! options
8763 pst
8764 !! input
8765 <!-- <gallery>data</gallery> -->
8766 !!result
8767 <!-- <gallery>data</gallery> -->
8768 !!end
8769
8770 !! test
8771 pre-save transform: comment containing extension
8772 !! options
8773 pst
8774 !! input
8775 <!-- <tag>data</tag> -->
8776 !!result
8777 <!-- <tag>data</tag> -->
8778 !!end
8779
8780 !! test
8781 pre-save transform: comment containing nowiki
8782 !! options
8783 pst
8784 !! input
8785 <!-- <nowiki>data</nowiki> -->
8786 !!result
8787 <!-- <nowiki>data</nowiki> -->
8788 !!end
8789
8790 !! test
8791 pre-save transform: <noinclude> in subst (bug 3298)
8792 !! options
8793 pst
8794 !! input
8795 {{subst:Includes}}
8796 !! result
8797 Foobar
8798 !! end
8799
8800 !! test
8801 pre-save transform: <onlyinclude> in subst (bug 3298)
8802 !! options
8803 pst
8804 !! input
8805 {{subst:Includes2}}
8806 !! result
8807 Foo
8808 !! end
8809
8810 !! article
8811 Template:SubstTest
8812 !!text
8813 {{<includeonly>subst:</includeonly>Includes}}
8814 !! endarticle
8815
8816 !! article
8817 Template:SafeSubstTest
8818 !! text
8819 {{<includeonly>safesubst:</includeonly>Includes}}
8820 !! endarticle
8821
8822 !! test
8823 bug 22297: safesubst: works during PST
8824 !! options
8825 pst
8826 !! input
8827 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
8828 !! result
8829 FoobarFoobar
8830 !! end
8831
8832 !! test
8833 bug 22297: safesubst: works during normal parse
8834 !! input
8835 {{SafeSubstTest}}
8836 !! result
8837 <p>Foobar
8838 </p>
8839 !! end
8840
8841 !! test:
8842 subst: does not work during normal parse
8843 !! input
8844 {{SubstTest}}
8845 !! result
8846 <p>{{subst:Includes}}
8847 </p>
8848 !! end
8849
8850 !! test
8851 pre-save transform: context links ("pipe trick")
8852 !! options
8853 pst
8854 !! input
8855 [[Article (context)|]]
8856 [[Bar:Article|]]
8857 [[:Bar:Article|]]
8858 [[Bar:Article (context)|]]
8859 [[:Bar:Article (context)|]]
8860 [[|Article]]
8861 [[|Article (context)]]
8862 [[Bar:X (Y) Z|]]
8863 [[:Bar:X (Y) Z|]]
8864 !! result
8865 [[Article (context)|Article]]
8866 [[Bar:Article|Article]]
8867 [[:Bar:Article|Article]]
8868 [[Bar:Article (context)|Article]]
8869 [[:Bar:Article (context)|Article]]
8870 [[Article]]
8871 [[Article (context)]]
8872 [[Bar:X (Y) Z|X (Y) Z]]
8873 [[:Bar:X (Y) Z|X (Y) Z]]
8874 !! end
8875
8876 !! test
8877 pre-save transform: context links ("pipe trick") with interwiki prefix
8878 !! options
8879 pst
8880 !! input
8881 [[interwiki:Article|]]
8882 [[:interwiki:Article|]]
8883 [[interwiki:Bar:Article|]]
8884 [[:interwiki:Bar:Article|]]
8885 !! result
8886 [[interwiki:Article|Article]]
8887 [[:interwiki:Article|Article]]
8888 [[interwiki:Bar:Article|Bar:Article]]
8889 [[:interwiki:Bar:Article|Bar:Article]]
8890 !! end
8891
8892 !! test
8893 pre-save transform: context links ("pipe trick") with parens in title
8894 !! options
8895 pst title=[[Somearticle (context)]]
8896 !! input
8897 [[|Article]]
8898 !! result
8899 [[Article (context)|Article]]
8900 !! end
8901
8902 !! test
8903 pre-save transform: context links ("pipe trick") with comma in title
8904 !! options
8905 pst title=[[Someplace, Somewhere]]
8906 !! input
8907 [[|Otherplace]]
8908 [[Otherplace, Elsewhere|]]
8909 [[Otherplace, Elsewhere, Anywhere|]]
8910 !! result
8911 [[Otherplace, Somewhere|Otherplace]]
8912 [[Otherplace, Elsewhere|Otherplace]]
8913 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
8914 !! end
8915
8916 !! test
8917 pre-save transform: context links ("pipe trick") with parens and comma
8918 !! options
8919 pst title=[[Someplace (IGNORED), Somewhere]]
8920 !! input
8921 [[|Otherplace]]
8922 [[Otherplace (place), Elsewhere|]]
8923 !! result
8924 [[Otherplace, Somewhere|Otherplace]]
8925 [[Otherplace (place), Elsewhere|Otherplace]]
8926 !! end
8927
8928 !! test
8929 pre-save transform: context links ("pipe trick") with comma and parens
8930 !! options
8931 pst title=[[Who, me? (context)]]
8932 !! input
8933 [[|Yes, you.]]
8934 [[Me, Myself, and I (1937 song)|]]
8935 !! result
8936 [[Yes, you. (context)|Yes, you.]]
8937 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
8938 !! end
8939
8940 !! test
8941 pre-save transform: context links ("pipe trick") with namespace
8942 !! options
8943 pst title=[[Ns:Somearticle]]
8944 !! input
8945 [[|Article]]
8946 !! result
8947 [[Ns:Article|Article]]
8948 !! end
8949
8950 !! test
8951 pre-save transform: context links ("pipe trick") with namespace and parens
8952 !! options
8953 pst title=[[Ns:Somearticle (context)]]
8954 !! input
8955 [[|Article]]
8956 !! result
8957 [[Ns:Article (context)|Article]]
8958 !! end
8959
8960 !! test
8961 pre-save transform: context links ("pipe trick") with namespace and comma
8962 !! options
8963 pst title=[[Ns:Somearticle, Context, Whatever]]
8964 !! input
8965 [[|Article]]
8966 !! result
8967 [[Ns:Article, Context, Whatever|Article]]
8968 !! end
8969
8970 !! test
8971 pre-save transform: context links ("pipe trick") with namespace, comma and parens
8972 !! options
8973 pst title=[[Ns:Somearticle, Context (context)]]
8974 !! input
8975 [[|Article]]
8976 !! result
8977 [[Ns:Article (context)|Article]]
8978 !! end
8979
8980 !! test
8981 pre-save transform: context links ("pipe trick") with namespace, parens and comma
8982 !! options
8983 pst title=[[Ns:Somearticle (IGNORED), Context]]
8984 !! input
8985 [[|Article]]
8986 !! result
8987 [[Ns:Article, Context|Article]]
8988 !! end
8989
8990 !! test
8991 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
8992 !! options
8993 pst
8994 !! input
8995 [[Article(context)|]]
8996 [[Bar:Article(context)|]]
8997 [[:Bar:Article(context)|]]
8998 [[|Article(context)]]
8999 [[Bar:X(Y)Z|]]
9000 [[:Bar:X(Y)Z|]]
9001 !! result
9002 [[Article(context)|Article]]
9003 [[Bar:Article(context)|Article]]
9004 [[:Bar:Article(context)|Article]]
9005 [[Article(context)]]
9006 [[Bar:X(Y)Z|X(Y)Z]]
9007 [[:Bar:X(Y)Z|X(Y)Z]]
9008 !! end
9009
9010 !! test
9011 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
9012 !! options
9013 pst
9014 !! input
9015 [[Article (context)|]]
9016 [[Bar:Article (context)|]]
9017 [[:Bar:Article (context)|]]
9018 [[|Article (context)]]
9019 [[Bar:X (Y) Z|]]
9020 [[:Bar:X (Y) Z|]]
9021 !! result
9022 [[Article (context)|Article]]
9023 [[Bar:Article (context)|Article]]
9024 [[:Bar:Article (context)|Article]]
9025 [[Article (context)]]
9026 [[Bar:X (Y) Z|X (Y) Z]]
9027 [[:Bar:X (Y) Z|X (Y) Z]]
9028 !! end
9029
9030 !! test
9031 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
9032 !! options
9033 pst
9034 !! input
9035 [[Article(context)|]]
9036 [[Bar:Article(context)|]]
9037 [[:Bar:Article(context)|]]
9038 [[|Article(context)]]
9039 [[Bar:X(Y)Z|]]
9040 [[:Bar:X(Y)Z|]]
9041 !! result
9042 [[Article(context)|Article]]
9043 [[Bar:Article(context)|Article]]
9044 [[:Bar:Article(context)|Article]]
9045 [[Article(context)]]
9046 [[Bar:X(Y)Z|X(Y)Z]]
9047 [[:Bar:X(Y)Z|X(Y)Z]]
9048 !! end
9049
9050 !! test
9051 pre-save transform: context links ("pipe trick") with commas (bug 21660)
9052 !! options
9053 pst
9054 !! input
9055 [[Article (context), context|]]
9056 [[Article (context),context|]]
9057 [[Bar:Article (context), context|]]
9058 [[Bar:Article (context),context|]]
9059 [[:Bar:Article (context), context|]]
9060 [[:Bar:Article (context),context|]]
9061 !! result
9062 [[Article (context), context|Article]]
9063 [[Article (context),context|Article]]
9064 [[Bar:Article (context), context|Article]]
9065 [[Bar:Article (context),context|Article]]
9066 [[:Bar:Article (context), context|Article]]
9067 [[:Bar:Article (context),context|Article]]
9068 !! end
9069
9070 !! test
9071 pre-save transform: trim trailing empty lines
9072 !! options
9073 pst
9074 !! input
9075 Empty lines are trimmed
9076
9077
9078
9079
9080 !! result
9081 Empty lines are trimmed
9082 !! end
9083
9084 !! test
9085 pre-save transform: Signature expansion
9086 !! options
9087 pst
9088 !! input
9089 * ~~~
9090 * <noinclude>~~~</noinclude>
9091 * <includeonly>~~~</includeonly>
9092 * <onlyinclude>~~~</onlyinclude>
9093 !! result
9094 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
9095 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
9096 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
9097 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
9098 !! end
9099
9100
9101 !! test
9102 pre-save transform: Signature expansion in nowiki tags (bug 93)
9103 !! options
9104 pst disabled
9105 !! input
9106 Shall not expand:
9107
9108 <nowiki>~~~~</nowiki>
9109
9110 <includeonly><nowiki>~~~~</nowiki></includeonly>
9111
9112 <noinclude><nowiki>~~~~</nowiki></noinclude>
9113
9114 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
9115
9116 {{subst:Foo}} shall be converted to FOO
9117
9118 As well as inside noinclude/onlyinclude
9119 <noinclude>{{subst:Foo}}</noinclude>
9120 <onlyinclude>{{subst:Foo}}</onlyinclude>
9121
9122 But not inside includeonly
9123 <includeonly>{{subst:Foo}}</includeonly>
9124 !! result
9125 Shall not expand:
9126
9127 <nowiki>~~~~</nowiki>
9128
9129 <includeonly><nowiki>~~~~</nowiki></includeonly>
9130
9131 <noinclude><nowiki>~~~~</nowiki></noinclude>
9132
9133 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
9134
9135 FOO shall be converted to FOO
9136
9137 As well as inside noinclude/onlyinclude
9138 <noinclude>FOO</noinclude>
9139 <onlyinclude>FOO</onlyinclude>
9140
9141 But not inside includeonly
9142 <includeonly>{{subst:Foo}}</includeonly>
9143 !! end
9144
9145 !! test
9146 Parsoid: Recognize nowiki with trailing space in tags
9147 !! options
9148 parsoid=wt2html
9149 !! input
9150 <nowiki ><div>[[foo]]</nowiki >
9151
9152 a<nowiki / >b
9153
9154 c<nowiki />d
9155
9156 e<nowiki/ >f
9157 !! result
9158 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
9159 <p>ab</p>
9160 <p>cd</p>
9161 <p>ef</p>
9162 !! end
9163
9164 !! test
9165 Parsoid: Recognize nowiki with odd capitalization
9166 !! options
9167 parsoid=wt2html
9168 !! input
9169 <noWikI ><div>[[foo]]</Nowiki >
9170 !! result
9171 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
9172 !! end
9173
9174
9175 !! test
9176 Parsoid: Escape nowiki with trailing space in tags
9177 !! options
9178 parsoid=html2wt
9179 !! input
9180 &lt;nowiki &gt; foo &lt;/nowiki &gt;
9181
9182 a&lt;nowiki /&gt;b
9183
9184 c&lt;nowiki/ &gt;d
9185 !! result
9186 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
9187 <p>a&lt;nowiki /&gt;b</p>
9188 <p>c&lt;nowiki/ &gt;d</p>
9189 !! end
9190
9191 !! test
9192 Parsoid: Escape weird noWikI capitalizations
9193 !! options
9194 parsoid=html2wt
9195 !! input
9196 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
9197 !! result
9198 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
9199 !! end
9200
9201 ###
9202 ### Message transform tests
9203 ###
9204 !! test
9205 message transform: magic variables
9206 !! options
9207 msg
9208 !! input
9209 {{SITENAME}}
9210 !! result
9211 MediaWiki
9212 !! end
9213
9214 !! test
9215 message transform: should not transform wiki markup
9216 !! options
9217 msg
9218 !! input
9219 ''test''
9220 !! result
9221 ''test''
9222 !! end
9223
9224 !! test
9225 message transform: <noinclude> in transcluded template (bug 4926)
9226 !! options
9227 msg
9228 !! input
9229 {{Includes}}
9230 !! result
9231 Foobar
9232 !! end
9233
9234 !! test
9235 message transform: <onlyinclude> in transcluded template (bug 4926)
9236 !! options
9237 msg
9238 !! input
9239 {{Includes2}}
9240 !! result
9241 Foo
9242 !! end
9243
9244 !! test
9245 {{#special:}} page name, known
9246 !! options
9247 msg
9248 !! input
9249 {{#special:Recentchanges}}
9250 !! result
9251 Special:RecentChanges
9252 !! end
9253
9254 !! test
9255 {{#special:}} page name with subpage, known
9256 !! options
9257 msg
9258 !! input
9259 {{#special:Recentchanges/param}}
9260 !! result
9261 Special:RecentChanges/param
9262 !! end
9263
9264 !! test
9265 {{#special:}} page name, unknown
9266 !! options
9267 msg
9268 !! input
9269 {{#special:foobar nonexistent}}
9270 !! result
9271 Special:Foobar nonexistent
9272 !! end
9273
9274 !! test
9275 {{#speciale:}} page name, known
9276 !! options
9277 msg
9278 !! input
9279 {{#speciale:Recentchanges}}
9280 !! result
9281 Special:RecentChanges
9282 !! end
9283
9284 !! test
9285 {{#speciale:}} page name with subpage, known
9286 !! options
9287 msg
9288 !! input
9289 {{#speciale:Recentchanges/param}}
9290 !! result
9291 Special:RecentChanges/param
9292 !! end
9293
9294 !! test
9295 {{#speciale:}} page name, unknown
9296 !! options
9297 msg
9298 !! input
9299 {{#speciale:foobar nonexistent}}
9300 !! result
9301 Special:Foobar_nonexistent
9302 !! end
9303
9304 ###
9305 ### Images
9306 ###
9307 ### For Parsoid-specific tests, see
9308 #### http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
9309
9310 !! test
9311 Simple image (php)
9312 !! options
9313 php
9314 !! input
9315 [[Image:foobar.jpg]]
9316 !! result
9317 <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>
9318 </p>
9319 !! end
9320
9321 !! test
9322 Simple image (parsoid)
9323 !! options
9324 parsoid=wt2html
9325 !! input
9326 [[Image:foobar.jpg]]
9327 !! result
9328 <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>
9329 </p>
9330 !! end
9331
9332 !! test
9333 Simple image (using File: namespace, now canonical) (php)
9334 !! options
9335 php
9336 !! input
9337 [[File:foobar.jpg]]
9338 !! result
9339 <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>
9340 </p>
9341 !! end
9342
9343 !! test
9344 Simple image (using File: namespace, now canonical) (parsoid)
9345 !! options
9346 parsoid
9347 !! input
9348 [[File:Foobar.jpg]]
9349 !! result
9350 <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>
9351 </p>
9352 !! end
9353
9354 !! test
9355 Right-aligned image (php)
9356 !! options
9357 php
9358 !! input
9359 [[Image:foobar.jpg|right]]
9360 !! result
9361 <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>
9362
9363 !! end
9364
9365 !! test
9366 Right-aligned image (parsoid)
9367 !! options
9368 parsoid
9369 !! input
9370 [[File:Foobar.jpg|right]]
9371 !! result
9372 <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>
9373 !! end
9374
9375 !! test
9376 Image with caption (php)
9377 !! options
9378 php
9379 !! input
9380 [[File:Foobar.jpg|right|Caption text]]
9381 !! result
9382 <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>
9383
9384 !! end
9385
9386 !! test
9387 Image with caption (parsoid)
9388 !! options
9389 parsoid
9390 !! input
9391 [[File:Foobar.jpg|right|Caption text]]
9392 !! result
9393 <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>
9394 !! end
9395
9396 !! test
9397 Image with empty attribute (php)
9398 !! options
9399 php
9400 !! input
9401 [[File:Foobar.jpg|right||Caption text]]
9402 !! result
9403 <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>
9404
9405 !! end
9406
9407 !! test
9408 Image with empty attribute (parsoid)
9409 !! options
9410 parsoid=wt2html
9411 !! input
9412 [[File:Foobar.jpg|right||Caption text]]
9413 !! result
9414 <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>
9415 !! end
9416
9417 !! test
9418 Image with attributes from template (php)
9419 !! options
9420 php
9421 !! input
9422 [[File:Foobar.jpg|{{image_attribs}}]]
9423 !! result
9424 <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>
9425
9426 !! end
9427
9428 !! test
9429 Image with attributes from template (parsoid)
9430 !! options
9431 parsoid
9432 !! input
9433 [[File:Foobar.jpg|{{image_attribs}}]]
9434 !! result
9435 <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>
9436 !! end
9437
9438 !! test
9439 Image with link tails (php)
9440 !! options
9441 php
9442 !! input
9443 123[[File:Foobar.jpg]]456
9444 123[[File:Foobar.jpg|right]]456
9445 123[[File:Foobar.jpg|thumb]]456
9446 !! result
9447 <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
9448 </p>
9449 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
9450 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
9451
9452 !! end
9453
9454 !! test
9455 Image with link tails (parsoid)
9456 !! options
9457 parsoid
9458 !! input
9459 123[[File:Foobar.jpg]]456
9460 123[[File:Foobar.jpg|right]]456
9461 123[[File:Foobar.jpg|thumb]]456
9462 !! result
9463 <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>
9464 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
9465 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="20" width="180"></a></figure>456
9466 !! end
9467
9468 !! test
9469 Image with multiple captions -- only last one is accepted (php)
9470 !! options
9471 php
9472 !! input
9473 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
9474 !! result
9475 <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>
9476
9477 !! end
9478
9479 !! test
9480 Image with multiple captions -- only last one is accepted (parsoid)
9481 !! options
9482 parsoid
9483 !! input
9484 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
9485 !! result
9486 <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>
9487 !! end
9488
9489 !! test
9490 Image with width attribute at different positions (php)
9491 !! options
9492 php
9493 !! input
9494 [[File:Foobar.jpg|200px|right|Caption]]
9495 [[File:Foobar.jpg|right|200px|Caption]]
9496 [[File:Foobar.jpg|right|Caption|200px]]
9497 !! result
9498 <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>
9499 <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>
9500 <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>
9501
9502 !! end
9503
9504 !! test
9505 Image with width attribute at different positions (parsoid)
9506 !! options
9507 parsoid
9508 !! input
9509 [[File:Foobar.jpg|200px|right|Caption]]
9510 [[File:Foobar.jpg|right|200px|Caption]]
9511 [[File:Foobar.jpg|right|Caption|200px]]
9512 !! result
9513 <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>
9514 <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>
9515 <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>
9516 !! end
9517
9518 !! test
9519 Image with link parameter, wiki target (php)
9520 !! options
9521 php
9522 !! input
9523 [[File:Foobar.jpg|link=Main Page]]
9524 !! result
9525 <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>
9526 </p>
9527 !! end
9528
9529 !! test
9530 Image with link parameter, wiki target (parsoid)
9531 !! options
9532 parsoid
9533 !! input
9534 [[File:Foobar.jpg|link=Main Page]]
9535 !! result
9536 <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>
9537 !! end
9538
9539 !! test
9540 Image with link parameter, URL target (php)
9541 !! options
9542 php
9543 !! input
9544 [[File:Foobar.jpg|link=http://example.com/]]
9545 !! result
9546 <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>
9547 </p>
9548 !! end
9549
9550 # parsoid bug 49293 (part 1)
9551 !! test
9552 Image with link parameter, URL target (parsoid)
9553 !! options
9554 parsoid
9555 !! input
9556 [[File:Foobar.jpg|link=http://example.com/]]
9557 !! result
9558 <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>
9559 !! end
9560
9561 !! test
9562 Image with link parameter, protocol-less URL target (php)
9563 !! options
9564 php
9565 !! input
9566 [[File:Foobar.jpg|link=//example.com/]]
9567 !! result
9568 <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>
9569 </p>
9570 !! end
9571
9572 # parsoid bug 49293 (part 2)
9573 !! test
9574 Image with link parameter, protocol-less URL target (parsoid)
9575 !! options
9576 parsoid
9577 !! input
9578 [[File:Foobar.jpg|link=//example.com/]]
9579 !! result
9580 <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>
9581 !! end
9582
9583 !! test
9584 Image with link parameter, wgExternalLinkTarget
9585 !! input
9586 [[Image:foobar.jpg|link=http://example.com/]]
9587 !! config
9588 wgExternalLinkTarget='foobar'
9589 !! result
9590 <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>
9591 </p>
9592 !! end
9593
9594 !! test
9595 Image with link parameter, wgNoFollowLinks set to false
9596 !! input
9597 [[Image:foobar.jpg|link=http://example.com/]]
9598 !! config
9599 wgNoFollowLinks=false
9600 !! result
9601 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9602 </p>
9603 !! end
9604
9605 !! test
9606 Image with link parameter, wgNoFollowDomainExceptions
9607 !! input
9608 [[Image:foobar.jpg|link=http://example.com/]]
9609 !! config
9610 wgNoFollowDomainExceptions='example.com'
9611 !! result
9612 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9613 </p>
9614 !! end
9615
9616 !! test
9617 Image with link parameter, wgExternalLinkTarget, unnamed parameter
9618 !! input
9619 [[Image:foobar.jpg|link=http://example.com/|Title]]
9620 !! config
9621 wgExternalLinkTarget='foobar'
9622 !! result
9623 <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>
9624 </p>
9625 !! end
9626
9627 !! test
9628 Image with empty link parameter (php)
9629 !! options
9630 php
9631 !! input
9632 [[File:Foobar.jpg|link=]]
9633 !! result
9634 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
9635 </p>
9636 !! end
9637
9638 !! test
9639 Image with empty link parameter (parsoid)
9640 !! options
9641 parsoid
9642 !! input
9643 [[File:Foobar.jpg|link=]]
9644 !! result
9645 <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>
9646 !! end
9647
9648 !! test
9649 Image with link parameter (wiki target) and unnamed parameter (php)
9650 !! options
9651 php
9652 !! input
9653 [[File:Foobar.jpg|link=Main Page|Title]]
9654 !! result
9655 <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>
9656 </p>
9657 !! end
9658
9659 !! test
9660 Image with link parameter (wiki target) and unnamed parameter (parsoid)
9661 !! options
9662 parsoid
9663 !! input
9664 [[File:Foobar.jpg|link=Main Page|Title]]
9665 !! result
9666 <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>
9667 !! end
9668
9669 !! test
9670 Image with link parameter (URL target) and unnamed parameter (php)
9671 !! options
9672 php
9673 !! input
9674 [[File:Foobar.jpg|link=http://example.com/|Title]]
9675 !! result
9676 <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>
9677 </p>
9678 !! end
9679
9680 !! test
9681 Image with link parameter (URL target) and unnamed parameter (parsoid)
9682 !! options
9683 parsoid
9684 !! input
9685 [[File:Foobar.jpg|link=http://example.com/|Title]]
9686 !! result
9687 <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>
9688 !! end
9689
9690 !! test
9691 Thumbnail image with link parameter
9692 !! options
9693 php
9694 !! input
9695 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
9696 !! result
9697 <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>
9698
9699 !! end
9700
9701 !! test
9702 Manually-specified thumbnail image
9703 !! options
9704 php
9705 !! input
9706 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
9707 !! result
9708 <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>
9709
9710 !! end
9711
9712 !! test
9713 Manually-specified thumbnail image with explicit link to wiki page
9714 !! options
9715 php
9716 !! input
9717 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
9718 !! result
9719 <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>
9720
9721 !! end
9722
9723 !! test
9724 Manually-specified thumbnail image with explicit link to url
9725 !! options
9726 php
9727 !! input
9728 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
9729 !! result
9730 <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>
9731
9732 !! end
9733
9734 !! test
9735 Manually-specified thumbnail image with explicit no link
9736 !! options
9737 php
9738 !! input
9739 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
9740 !! result
9741 <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>
9742
9743 !! end
9744
9745 !! test
9746 Manually-specified thumbnail image with explicit link and alt text
9747 !! options
9748 php
9749 !! input
9750 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
9751 !! result
9752 <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>
9753
9754 !! end
9755
9756 !! test
9757 Image with frame and link
9758 !! input
9759 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
9760 !! result
9761 <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>
9762
9763 !! end
9764
9765 !! test
9766 Image with frame and link and explicit alt
9767 !! input
9768 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
9769 !! result
9770 <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>
9771
9772 !! end
9773
9774 !! test
9775 Image with wiki markup in implicit alt
9776 !! input
9777 [[Image:Foobar.jpg|testing '''bold''' in alt]]
9778 !! result
9779 <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>
9780 </p>
9781 !! end
9782
9783 !! test
9784 Image with wiki markup in explicit alt
9785 !! input
9786 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
9787 !! result
9788 <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>
9789 </p>
9790 !! end
9791
9792 !! test
9793 Link to image page- image page normally doesn't exists, hence edit link
9794 Add test with existing image page
9795 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
9796 !! input
9797 [[:Image:test]]
9798 !! result
9799 <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>
9800 </p>
9801 !! end
9802
9803 !! test
9804 bug 18784 Link to non-existent image page with caption should use caption as link text
9805 !! input
9806 [[:Image:test|caption]]
9807 !! result
9808 <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>
9809 </p>
9810 !! end
9811
9812 !! test
9813 Frameless image caption with a free URL
9814 !! input
9815 [[Image:foobar.jpg|http://example.com]]
9816 !! result
9817 <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>
9818 </p>
9819 !! end
9820
9821 !! test
9822 Thumbnail image caption with a free URL
9823 !! input
9824 [[Image:foobar.jpg|thumb|http://example.com]]
9825 !! result
9826 <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>
9827
9828 !! end
9829
9830 !! test
9831 Thumbnail image caption with a free URL and explicit alt
9832 !! input
9833 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
9834 !! result
9835 <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>
9836
9837 !! end
9838
9839 !! test
9840 SVG thumbnails with no language set
9841 !! options
9842 !! input
9843 [[File:Foobar.svg|thumb|width=200]]
9844 !! result
9845 <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>width=200</div></div></div>
9846
9847 !! end
9848
9849 !! test
9850 SVG thumbnails with language de
9851 !! options
9852 !! input
9853 [[File:Foobar.svg|thumb|width=200|lang=de]]
9854 !! result
9855 <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>width=200</div></div></div>
9856
9857 !! end
9858
9859 !! test
9860 SVG thumbnails with invalid language code
9861 !! options
9862 !! input
9863 [[File:Foobar.svg|thumb|width=200|lang=invalid.language.code]]
9864 !! result
9865 <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>
9866
9867 !! end
9868
9869 !! test
9870 BUG 1887: A ISBN with a thumbnail
9871 !! input
9872 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
9873 !! result
9874 <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>
9875
9876 !! end
9877
9878 !! test
9879 BUG 1887: A RFC with a thumbnail
9880 !! input
9881 [[Image:foobar.jpg|thumb|This is RFC 12354]]
9882 !! result
9883 <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>
9884
9885 !! end
9886
9887 !! test
9888 BUG 1887: A mailto link with a thumbnail
9889 !! input
9890 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
9891 !! result
9892 <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>
9893
9894 !! end
9895
9896 # Pending resolution to bug 368
9897 !! test
9898 BUG 648: Frameless image caption with a link
9899 !! input
9900 [[Image:foobar.jpg|text with a [[link]] in it]]
9901 !! result
9902 <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>
9903 </p>
9904 !! end
9905
9906 !! test
9907 BUG 648: Frameless image caption with a link (suffix)
9908 !! input
9909 [[Image:foobar.jpg|text with a [[link]]foo in it]]
9910 !! result
9911 <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>
9912 </p>
9913 !! end
9914
9915 !! test
9916 BUG 648: Frameless image caption with an interwiki link
9917 !! input
9918 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
9919 !! result
9920 <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>
9921 </p>
9922 !! end
9923
9924 !! test
9925 BUG 648: Frameless image caption with a piped interwiki link
9926 !! input
9927 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
9928 !! result
9929 <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>
9930 </p>
9931 !! end
9932
9933 !! test
9934 Escape HTML special chars in image alt text
9935 !! input
9936 [[Image:foobar.jpg|& < > "]]
9937 !! result
9938 <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>
9939 </p>
9940 !! end
9941
9942 !! test
9943 BUG 499: Alt text should have &#1234;, not &amp;1234;
9944 !! input
9945 [[Image:foobar.jpg|&#9792;]]
9946 !! result
9947 <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>
9948 </p>
9949 !! end
9950
9951 !! test
9952 Broken image caption with link
9953 !! input
9954 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
9955 !! result
9956 <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.
9957 </p>
9958 !! end
9959
9960 !! test
9961 Image caption containing another image
9962 !! input
9963 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
9964 !! result
9965 <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>
9966
9967 !! end
9968
9969 !! test
9970 Image caption containing a newline
9971 !! input
9972 [[Image:Foobar.jpg|This
9973 *is some text]]
9974 !! result
9975 <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>
9976 </p>
9977 !!end
9978
9979 !!test
9980 Parsoid: Image caption containing leading space
9981 (The leading space should not trigger nowiki escaping in wt2wt mode)
9982 !! input
9983 [[Image:Foobar.jpg|thumb| bar]]
9984 !! result
9985 <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>
9986
9987 !!end
9988
9989 !! test
9990 Bug 3090: External links other than http: in image captions
9991 !! input
9992 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
9993 !! result
9994 <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>
9995
9996 !! end
9997
9998 !! test
9999 Custom class
10000 !! input
10001 [[Image:foobar.jpg|a|class=b]]
10002 !! result
10003 <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>
10004 </p>
10005 !! end
10006
10007 !! test
10008 Localized image handling (1).
10009 !! options
10010 language=es
10011 !! input
10012 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
10013 !! result
10014 <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>
10015
10016 !! end
10017
10018 !! test
10019 Localized image handling (2).
10020 !! options
10021 language=es
10022 !! input
10023 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
10024 !! result
10025 <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>
10026
10027 !! end
10028
10029 !! test
10030 "border", "frameless" and "class" attributes on an image.
10031 !! input
10032 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
10033 !! result
10034 <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>
10035 </p>
10036 !! end
10037
10038 !! article
10039 File:Barfoo.jpg
10040 !! text
10041 #REDIRECT [[File:Barfoo.jpg]]
10042 !! endarticle
10043
10044 !! test
10045 Redirected image
10046 !! input
10047 [[Image:Barfoo.jpg]]
10048 !! result
10049 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
10050 </p>
10051 !! end
10052
10053 !! test
10054 Missing image with uploads disabled
10055 !! options
10056 wgEnableUploads=0
10057 !! input
10058 [[Image:Foobaz.jpg]]
10059 !! result
10060 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
10061 </p>
10062 !! end
10063
10064 # Parsoid-specific testing for images
10065 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
10066 # Currently imperfect due to a flaw in the Parsoid testrunner
10067 # Work in progress
10068 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
10069 # image tests.
10070
10071 !! test
10072 Parsoid-specific image handling - simple image with size and middle alignment
10073 !! options
10074 parsoid
10075 !! input
10076 [[Image:Foobar.jpg|50px|middle]]
10077 !! result
10078 <p>
10079 <span class="mw-valign-middle" typeof="mw:Image">
10080 <a href="File:Foobar.jpg">
10081 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
10082 </a>
10083 </span>
10084 </p>
10085 !! end
10086
10087 !! test
10088 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
10089 !! options
10090 parsoid
10091 !! input
10092 [[Image:Foobar.jpg|500x10px|baseline|caption]]
10093 !! result
10094 <p>
10095 <span class="mw-valign-baseline" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
10096 <a href="File:Foobar.jpg">
10097 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89">
10098 </a>
10099 </span>
10100 </p>
10101 !! end
10102
10103 !! test
10104 Parsoid-specific image handling - simple image with border and size spec
10105 !! options
10106 parsoid
10107 !! input
10108 [[Image:Foobar.jpg|50px|border|caption]]
10109 !! result
10110 <p>
10111 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
10112 <a href="File:Foobar.jpg">
10113 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
10114 </a>
10115 </span>
10116 </p>
10117 !! end
10118
10119 !! test
10120 Parsoid-specific image handling - thumbnail with halign, valign, and caption
10121 !! options
10122 parsoid
10123 !! input
10124 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
10125 !! result
10126 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
10127 <a href="File:Foobar.jpg">
10128 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="21" width="180" />
10129 </a>
10130 <figcaption>caption content</figcaption>
10131 </figure>
10132 !! end
10133
10134 !! test
10135 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
10136 !! options
10137 parsoid
10138 !! input
10139 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
10140 !! result
10141 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
10142 <a href="File:Foobar.jpg">
10143 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
10144 </a>
10145 <figcaption>caption</figcaption>
10146 </figure>
10147 !! end
10148
10149 !! test
10150 Parsoid-specific image handling - framed image with specific size and caption
10151 !! options
10152 parsoid
10153 !! input
10154 [[Image:Foobar.jpg|500x50px|frame|caption]]
10155 !! result
10156 <figure typeof="mw:Image/Frame">
10157 <a href="File:Foobar.jpg">
10158 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
10159 </a>
10160 <figcaption>caption</figcaption>
10161 </figure>
10162 !! end
10163
10164 !! test
10165 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
10166 !! options
10167 parsoid
10168 !! input
10169 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
10170 !! result
10171 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
10172 <a href="File:Foobar.jpg">
10173 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
10174 </a>
10175 <figcaption>caption</figcaption>
10176 </figure>
10177 !! end
10178
10179 !! test
10180 Parsoid-specific image handling - frameless image with specific size, border, and caption
10181 !! options
10182 parsoid
10183 !! input
10184 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
10185 !! result
10186 <p>
10187 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
10188 <a href="File:Foobar.jpg">
10189 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
10190 </a>
10191 </p>
10192 !! end
10193
10194 #!! test
10195 #Parsoid-specific image handling - simple image with a formatted caption
10196 #!! options
10197 #parsoid
10198 #!! input
10199 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
10200 #!! result
10201 #<p>
10202 #<span typeof="mw:Image">
10203 #<a class="mw-default-size" href="Image:Foobar.jpg">
10204 #<img alt="Foobar.jpg" class="mw-default-size" src="http://example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
10205 #</a>
10206 #<span>abc</span>
10207 #</span>
10208 #</p>
10209
10210 !! test
10211 Caption with a template in it
10212 !! options
10213 parsoid
10214 !! input
10215 [[Image:Foobar.jpg|thumb|200px|This caption has a {{echo|transclusion}} in it.]]
10216 !! result
10217 <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>
10218 !! end
10219
10220 !! test
10221 Caption with unbalanced tags in it
10222 !! options
10223 parsoid
10224 !! input
10225 foo
10226 [[Image:Foobar.jpg|thumb|200px|This caption has a <center>unbalanced tag in it.]]
10227 bar
10228 !! result
10229 <p>foo</p>
10230 <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>
10231 <p>bar</p>
10232 !! end
10233
10234
10235 ###
10236 ### Subpages
10237 ###
10238 !! article
10239 Subpage test/subpage
10240 !! text
10241 foo
10242 !! endarticle
10243
10244 !! test
10245 Subpage link
10246 !! options
10247 subpage title=[[Subpage test]]
10248 !! input
10249 [[/subpage]]
10250 !! result
10251 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
10252 </p>
10253 !! end
10254
10255 !! test
10256 Subpage noslash link
10257 !! options
10258 subpage title=[[Subpage test]]
10259 !!input
10260 [[/subpage/]]
10261 !! result
10262 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
10263 </p>
10264 !! end
10265
10266 # TODO: make this PHP-parser compatible!
10267 !! test
10268 Relative subpage noslash link
10269 !! options
10270 parsoid=wt2wt,wt2html,html2html
10271 subpage title=[[Subpage test/1/2/3/4]]
10272 !!input
10273 [[../../subpage/]]
10274
10275 [[../../subpage]]
10276 !! result
10277 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
10278 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
10279 !! end
10280
10281 # TODO: make this PHP-parser compatible!
10282 !! test
10283 Parsoid: dot-slash prefixed wikilinks
10284 !! options
10285 parsoid=wt2wt,wt2html,html2html
10286 !!input
10287 [[./foo]]
10288
10289 [[././bar]]
10290
10291 [[././baz/]]
10292 !! result
10293 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
10294 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
10295 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
10296 !! end
10297
10298 !! test
10299 Disabled subpages
10300 !! input
10301 [[/subpage]]
10302 !! result
10303 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
10304 </p>
10305 !! end
10306
10307 !! test
10308 BUG 561: {{/Subpage}}
10309 !! options
10310 subpage title=[[Page]]
10311 !! input
10312 {{/Subpage}}
10313 !! result
10314 <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>
10315 </p>
10316 !! end
10317
10318 ###
10319 ### Categories
10320 ###
10321 !! article
10322 Category:MediaWiki User's Guide
10323 !! text
10324 blah
10325 !! endarticle
10326
10327 !! test
10328 Link to category
10329 !! input
10330 [[:Category:MediaWiki User's Guide]]
10331 !! result
10332 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
10333 </p>
10334 !! end
10335
10336 !! test
10337 Simple category
10338 !! options
10339 cat
10340 !! input
10341 [[Category:MediaWiki User's Guide]]
10342 !! result
10343 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
10344 !! end
10345
10346 !! test
10347 PAGESINCATEGORY invalid title fatal (r33546 fix)
10348 !! input
10349 {{PAGESINCATEGORY:<bogus>}}
10350 !! result
10351 <p>0
10352 </p>
10353 !! end
10354
10355 !! test
10356 Category with different sort key
10357 !! options
10358 cat
10359 !! input
10360 [[Category:MediaWiki User's Guide|Foo]]
10361 !! result
10362 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
10363 !! end
10364
10365 !! test
10366 Category with identical sort key
10367 !! options
10368 cat
10369 !! input
10370 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
10371 !! result
10372 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
10373 !! end
10374
10375 !! test
10376 Category with empty sort key
10377 !! options
10378 cat
10379 pst
10380 !! input
10381 [[Category:MediaWiki User's Guide|]]
10382 !! result
10383 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
10384 !! end
10385
10386 !! test
10387 Category with empty sort key and parentheses
10388 !! options
10389 cat
10390 pst
10391 !! input
10392 [[Category:Foo (bar)|]]
10393 !! result
10394 [[Category:Foo (bar)|Foo]]
10395 !! end
10396
10397 !! test
10398 Category with link tail
10399 !! options
10400 cat
10401 pst
10402 !! input
10403 123[[Category:Foo]]456
10404 !! result
10405 123[[Category:Foo]]456
10406 !! end
10407
10408 !! test
10409 Category with template
10410 !! options
10411 cat
10412 pst
10413 !! input
10414 [[Category:{{echo|Foo}}]]
10415 !! result
10416 [[Category:{{echo|Foo}}]]
10417 !! end
10418
10419 !! test
10420 Category with template in sort key
10421 !! options
10422 cat
10423 pst
10424 !! input
10425 [[Category:Foo|{{echo|Bar}}]]
10426 !! result
10427 [[Category:Foo|{{echo|Bar}}]]
10428 !! end
10429
10430 !! test
10431 Category with template in sort key and title
10432 !! options
10433 cat
10434 pst
10435 !! input
10436 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
10437 !! result
10438 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
10439 !! end
10440
10441 !! test
10442 Category / paragraph interactions
10443 !! input
10444 Foo [[Category:Baz]] Bar
10445
10446 Foo [[Category:Baz]]
10447 Bar
10448
10449 Foo
10450 [[Category:Baz]]
10451 Bar
10452
10453 Foo
10454 [[Category:Baz]] Bar
10455
10456 Foo
10457 [[Category:Baz]]
10458 [[Category:Baz]]
10459 [[Category:Baz]]
10460 Bar
10461
10462 [[Category:Baz]]
10463 [[Category:Baz]]
10464 [[Category:Baz]]
10465
10466 [[Category:Baz]]
10467 {{echo|[[Category:Baz]]}}
10468 [[Category:Baz]]
10469 !! result
10470 <p>Foo Bar
10471 </p><p>Foo
10472 Bar
10473 </p><p>Foo
10474 Bar
10475 </p><p>Foo Bar
10476 </p><p>Foo
10477 Bar
10478 </p>
10479 !! end
10480
10481 !! test
10482 Parsoid: Serialize link to category page with colon escape
10483 !! options
10484 parsoid
10485 !! input
10486
10487 [[:Category:Foo]]
10488 [[:Category:Foo|Bar]]
10489 !! result
10490 <p>
10491 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
10492 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
10493 </p>
10494 !! end
10495
10496 !! test
10497 Parsoid: Link prefix/suffixes aren't applied to category links
10498 !! options
10499 parsoid=wt2html,wt2wt,html2html
10500 language=is
10501 !! input
10502 x[[Category:Foo]]y
10503 !! result
10504 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
10505 !! end
10506
10507 !! test
10508 Parsoid: Serialize link to file page with colon escape
10509 !! options
10510 parsoid
10511 !! input
10512
10513 [[:File:Foo.png]]
10514 [[:File:Foo.png|Bar]]
10515 !! result
10516 <p>
10517 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
10518 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
10519 </p>
10520 !! end
10521
10522 !! test
10523 Parsoid: Serialize a genuine category link without colon escape
10524 !! options
10525 parsoid
10526 !! input
10527 [[Category:Foo]]
10528 [[Category:Foo|Bar]]
10529 !! result
10530 <link rel="mw:PageProp/Category" href="Category:Foo">
10531 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
10532 !! end
10533
10534 ###
10535 ### Inter-language links
10536 ###
10537 !! test
10538 Inter-language links
10539 !! options
10540 ill
10541 !! input
10542 [[es:Alimento]]
10543 [[fr:Nourriture]]
10544 [[zh:&#39135;&#21697;]]
10545 !! result
10546 es:Alimento fr:Nourriture zh:食品
10547 !! end
10548
10549 !! test
10550 Duplicate interlanguage links (bug 24502)
10551 !! options
10552 ill
10553 !! input
10554 [[es:1]]
10555 [[es:2]]
10556 [[fr:1]]
10557 [[fr:2]]
10558 !! result
10559 es:1 fr:1
10560 !! end
10561
10562 ###
10563 ### Sections
10564 ###
10565 !! test
10566 Basic section headings
10567 !! input
10568 == Headline 1 ==
10569 Some text
10570
10571 ==Headline 2==
10572 More
10573 ===Smaller headline===
10574 Blah blah
10575 !! result
10576 <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>
10577 <p>Some text
10578 </p>
10579 <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>
10580 <p>More
10581 </p>
10582 <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>
10583 <p>Blah blah
10584 </p>
10585 !! end
10586
10587 !! test
10588 Section headings with TOC
10589 !! input
10590 == Headline 1 ==
10591 === Subheadline 1 ===
10592 ===== Skipping a level =====
10593 ====== Skipping a level ======
10594
10595 == Headline 2 ==
10596 Some text
10597 ===Another headline===
10598 !! result
10599 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10600 <ul>
10601 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
10602 <ul>
10603 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
10604 <ul>
10605 <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>
10606 <ul>
10607 <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>
10608 </ul>
10609 </li>
10610 </ul>
10611 </li>
10612 </ul>
10613 </li>
10614 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
10615 <ul>
10616 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
10617 </ul>
10618 </li>
10619 </ul>
10620 </div>
10621
10622 <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>
10623 <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>
10624 <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>
10625 <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>
10626 <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>
10627 <p>Some text
10628 </p>
10629 <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>
10630
10631 !! end
10632
10633 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
10634 !! test
10635 Handling of sections up to level 6 and beyond
10636 !! input
10637 = Level 1 Heading=
10638 == Level 2 Heading==
10639 === Level 3 Heading===
10640 ==== Level 4 Heading====
10641 ===== Level 5 Heading=====
10642 ====== Level 6 Heading======
10643 ======= Level 7 Heading=======
10644 ======== Level 8 Heading========
10645 ========= Level 9 Heading=========
10646 ========== Level 10 Heading==========
10647 !! result
10648 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10649 <ul>
10650 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
10651 <ul>
10652 <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>
10653 <ul>
10654 <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>
10655 <ul>
10656 <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>
10657 <ul>
10658 <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>
10659 <ul>
10660 <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>
10661 <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>
10662 <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>
10663 <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>
10664 <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>
10665 </ul>
10666 </li>
10667 </ul>
10668 </li>
10669 </ul>
10670 </li>
10671 </ul>
10672 </li>
10673 </ul>
10674 </li>
10675 </ul>
10676 </div>
10677
10678 <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>
10679 <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>
10680 <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>
10681 <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>
10682 <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>
10683 <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>
10684 <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>
10685 <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>
10686 <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>
10687 <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>
10688
10689 !! end
10690
10691 !! test
10692 TOC regression (bug 9764)
10693 !! input
10694 == title 1 ==
10695 === title 1.1 ===
10696 ==== title 1.1.1 ====
10697 === title 1.2 ===
10698 == title 2 ==
10699 === title 2.1 ===
10700 !! result
10701 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10702 <ul>
10703 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
10704 <ul>
10705 <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>
10706 <ul>
10707 <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>
10708 </ul>
10709 </li>
10710 <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>
10711 </ul>
10712 </li>
10713 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
10714 <ul>
10715 <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>
10716 </ul>
10717 </li>
10718 </ul>
10719 </div>
10720
10721 <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>
10722 <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>
10723 <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>
10724 <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>
10725 <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>
10726 <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>
10727
10728 !! end
10729
10730 !! test
10731 TOC with wgMaxTocLevel=3 (bug 6204)
10732 !! options
10733 wgMaxTocLevel=3
10734 !! input
10735 == title 1 ==
10736 === title 1.1 ===
10737 ==== title 1.1.1 ====
10738 === title 1.2 ===
10739 == title 2 ==
10740 === title 2.1 ===
10741 !! result
10742 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10743 <ul>
10744 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
10745 <ul>
10746 <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>
10747 <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>
10748 </ul>
10749 </li>
10750 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
10751 <ul>
10752 <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>
10753 </ul>
10754 </li>
10755 </ul>
10756 </div>
10757
10758 <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>
10759 <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>
10760 <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>
10761 <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>
10762 <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>
10763 <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>
10764
10765 !! end
10766
10767 !! test
10768 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
10769 !! options
10770 wgMaxTocLevel=3
10771 !! input
10772 ==Section 1==
10773 ===Section 1.1===
10774 ====Section 1.1.1====
10775 ====Section 1.1.1.1====
10776 ==Section 2==
10777 !! result
10778 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10779 <ul>
10780 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
10781 <ul>
10782 <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>
10783 </ul>
10784 </li>
10785 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
10786 </ul>
10787 </div>
10788
10789 <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>
10790 <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>
10791 <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>
10792 <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>
10793 <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>
10794
10795 !! end
10796
10797
10798 !! test
10799 Resolving duplicate section names
10800 !! input
10801 == Foo bar ==
10802 == Foo bar ==
10803 !! result
10804 <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>
10805 <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>
10806
10807 !! end
10808
10809 !! test
10810 Resolving duplicate section names with differing case (bug 10721)
10811 !! input
10812 == Foo bar ==
10813 == Foo Bar ==
10814 !! result
10815 <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>
10816 <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>
10817
10818 !! end
10819
10820 !! article
10821 Template:sections
10822 !! text
10823 ===Section 1===
10824 ==Section 2==
10825 !! endarticle
10826
10827 !! test
10828 Template with sections, __NOTOC__
10829 !! input
10830 __NOTOC__
10831 ==Section 0==
10832 {{sections}}
10833 ==Section 4==
10834 !! result
10835 <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>
10836 <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>
10837 <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>
10838 <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>
10839
10840 !! end
10841
10842 !! test
10843 __NOEDITSECTION__ keyword
10844 !! input
10845 __NOEDITSECTION__
10846 ==Section 1==
10847 ==Section 2==
10848 !! result
10849 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
10850 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
10851
10852 !! end
10853
10854 !! test
10855 Link inside a section heading
10856 !! input
10857 ==Section with a [[Main Page|link]] in it==
10858 !! result
10859 <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>
10860
10861 !! end
10862
10863 !! test
10864 TOC regression (bug 12077)
10865 !! input
10866 __TOC__
10867 == title 1 ==
10868 === title 1.1 ===
10869 == title 2 ==
10870 !! result
10871 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10872 <ul>
10873 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
10874 <ul>
10875 <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>
10876 </ul>
10877 </li>
10878 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
10879 </ul>
10880 </div>
10881
10882 <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>
10883 <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>
10884 <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>
10885
10886 !! end
10887
10888 !! test
10889 BUG 1219 URL next to image (good)
10890 !! input
10891 http://example.com [[Image:foobar.jpg]]
10892 !! result
10893 <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>
10894 </p>
10895 !!end
10896
10897 !! test
10898 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
10899 !! input
10900 ===
10901 The line above must have a trailing space!
10902 === <!--
10903 --> <!-- -->
10904 But just in case it doesn't...
10905 !! result
10906 <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>
10907 <p>The line above must have a trailing space!
10908 </p>
10909 <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>
10910 <p>But just in case it doesn't...
10911 </p>
10912 !! end
10913
10914 !! test
10915 Header with special characters (bug 25462)
10916 !! input
10917 The tooltips shall not show entities to the user (ie. be double escaped)
10918
10919 == text > text ==
10920 section 1
10921
10922 == text < text ==
10923 section 2
10924
10925 == text & text ==
10926 section 3
10927
10928 == text ' text ==
10929 section 4
10930
10931 == text " text ==
10932 section 5
10933 !! result
10934 <p>The tooltips shall not show entities to the user (ie. be double escaped)
10935 </p>
10936 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10937 <ul>
10938 <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>
10939 <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>
10940 <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>
10941 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
10942 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
10943 </ul>
10944 </div>
10945
10946 <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>
10947 <p>section 1
10948 </p>
10949 <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>
10950 <p>section 2
10951 </p>
10952 <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>
10953 <p>section 3
10954 </p>
10955 <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>
10956 <p>section 4
10957 </p>
10958 <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>
10959 <p>section 5
10960 </p>
10961 !! end
10962
10963 !! test
10964 Headers with excess '=' characters
10965 (Are similar tests necessary beyond the 1st level?)
10966 !! input
10967 =foo==
10968 ==foo=
10969 =''italic'' heading==
10970 ==''italic'' heading=
10971 !! result
10972 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10973 <ul>
10974 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
10975 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
10976 <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>
10977 <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>
10978 </ul>
10979 </div>
10980
10981 <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>
10982 <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>
10983 <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>
10984 <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>
10985
10986 !! end
10987
10988 !! test
10989 HTML headers vs TOC (bug 23393)
10990 (__NOEDITSECTION__ for clearer output, doesn't matter here)
10991 !! input
10992 <h1>Header 1</h1>
10993 == Header 1.1 ==
10994 == Header 1.2 ==
10995
10996 <h1>Header 2
10997 </h1>
10998 == Header 2.1 ==
10999 == Header 2.2 ==
11000 __NOEDITSECTION__
11001 !! result
11002 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11003 <ul>
11004 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
11005 <ul>
11006 <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>
11007 <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>
11008 </ul>
11009 </li>
11010 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
11011 <ul>
11012 <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>
11013 <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>
11014 </ul>
11015 </li>
11016 </ul>
11017 </div>
11018
11019 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
11020 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
11021 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
11022 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
11023 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
11024 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
11025
11026 !! end
11027
11028 !! test
11029 BUG 1219 URL next to image (broken)
11030 !! input
11031 http://example.com[[Image:foobar.jpg]]
11032 !! result
11033 <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>
11034 </p>
11035 !!end
11036
11037 !! test
11038 Bug 1186 news: in the middle of text
11039 !! input
11040 http://en.wikinews.org/wiki/Wikinews:Workplace
11041 !! result
11042 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
11043 </p>
11044 !!end
11045
11046
11047 !! test
11048 Namespaced link must have a title
11049 !! input
11050 [[Project:]]
11051 !! result
11052 <p>[[Project:]]
11053 </p>
11054 !!end
11055
11056 !! test
11057 Namespaced link must have a title (bad fragment version)
11058 !! input
11059 [[Project:#fragment]]
11060 !! result
11061 <p>[[Project:#fragment]]
11062 </p>
11063 !!end
11064
11065
11066 ###
11067 ### HTML tags and HTML attributes
11068 ###
11069
11070 !! test
11071 div with no attributes
11072 !! input
11073 <div>HTML rocks</div>
11074 !! result
11075 <div>HTML rocks</div>
11076
11077 !! end
11078
11079 !! test
11080 div with double-quoted attribute
11081 !! input
11082 <div id="rock">HTML rocks</div>
11083 !! result
11084 <div id="rock">HTML rocks</div>
11085
11086 !! end
11087
11088 !! test
11089 div with single-quoted attribute
11090 !! input
11091 <div id='rock'>HTML rocks</div>
11092 !! result
11093 <div id="rock">HTML rocks</div>
11094
11095 !! end
11096
11097 !! test
11098 div with unquoted attribute
11099 !! input
11100 <div id=rock>HTML rocks</div>
11101 !! result
11102 <div id="rock">HTML rocks</div>
11103
11104 !! end
11105
11106 !! test
11107 div with illegal double attributes
11108 !! input
11109 <div id="a" id="b">HTML rocks</div>
11110 !! result
11111 <div id="b">HTML rocks</div>
11112
11113 !!end
11114
11115 # FIXME: produce empty string instead of "class" in the PHP parser, following
11116 # the HTML5 spec.
11117 !! test
11118 div with empty attribute value, space before equals
11119 !! options
11120 parsoid
11121 !! input
11122 <div class =>HTML rocks</div>
11123 !! result
11124 <div class="">HTML rocks</div>
11125
11126 !! end
11127
11128 # The PHP parser escapes the opening brace to &#123; for some reason, so
11129 # disabled this test for it.
11130 !! test
11131 div with braces in attribute value
11132 !! options
11133 parsoid
11134 !! input
11135 <div title="{}">Foo</div>
11136 !! result
11137 <div title="{}">Foo</div>
11138 !! end
11139
11140 # This it very inconsistent in the PHP parser: it returns
11141 # class="class" if there is a space between the name and the equal sign (see
11142 # 'div with empty attribute value, space before equals'), but strips the
11143 # attribute completely if the space is missing. We hope that not much content
11144 # depends on this, so are implementing the behavior below in Parsoid for
11145 # consistencies' sake. Disabled for the PHP parser.
11146 # FIXME: fix this behavior in the PHP parser?
11147 !! test
11148 div with empty attribute value, no space before equals
11149 !! options
11150 parsoid
11151 !! input
11152 <div class=>HTML rocks</div>
11153 !! result
11154 <div class="">HTML rocks</div>
11155
11156 !! end
11157
11158 !! test
11159 HTML multiple attributes correction
11160 !! input
11161 <p class="error" class="awesome">Awesome!</p>
11162 !! result
11163 <p class="awesome">Awesome!</p>
11164
11165 !!end
11166
11167 !! test
11168 Table multiple attributes correction
11169 !! input
11170 {|
11171 !+ class="error" class="awesome"| status
11172 |}
11173 !! result
11174 <table>
11175 <tr>
11176 <th class="awesome"> status
11177 </th></tr></table>
11178
11179 !!end
11180
11181 !! test
11182 DIV IN UPPERCASE
11183 !! input
11184 <DIV ID="x">HTML ROCKS</DIV>
11185 !! result
11186 <div id="x">HTML ROCKS</div>
11187
11188 !!end
11189
11190 !! test
11191 Non-ASCII pseudo-tags are rendered as text
11192 !! input
11193 <khyô>
11194 !! result
11195 <p>&lt;khyô&gt;
11196 </p>
11197 !! end
11198
11199 !! test
11200 Pseudo-tag with URL 'name' renders as url link
11201 !! input
11202 <http://example.com/>
11203 !! result
11204 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
11205 </p>
11206 !! end
11207
11208 !! test
11209 text with amp in the middle of nowhere
11210 !! input
11211 Remember AT&T?
11212 !!result
11213 <p>Remember AT&amp;T?
11214 </p>
11215 !! end
11216
11217 !! test
11218 text with character entity: eacute
11219 !! input
11220 I always thought &eacute; was a cute letter.
11221 !! result
11222 <p>I always thought &#233; was a cute letter.
11223 </p>
11224 !! end
11225
11226 !! test
11227 text with entity-escaped character entity-like string: eacute
11228 !! input
11229 I always thought &amp;eacute; was a cute letter.
11230 !! result
11231 <p>I always thought &amp;eacute; was a cute letter.
11232 </p>
11233 !! end
11234
11235 !! test
11236 text with undefined character entity: xacute
11237 !! input
11238 I always thought &xacute; was a cute letter.
11239 !! result
11240 <p>I always thought &amp;xacute; was a cute letter.
11241 </p>
11242 !! end
11243
11244
11245 ###
11246 ### Nesting tests (see bug 41545, 50604, 51081)
11247 ###
11248
11249 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
11250 # Note that html2wt is considerably more difficult if we use <b> in
11251 # the test case, instead of <big>
11252 !! test
11253 Ensure that HTML adoption agency algorithm is properly implemented.
11254 !! input
11255 <big>X<big>Y</big>Z</big>
11256 !! result
11257 <p><big>X<big>Y</big>Z</big>
11258 </p>
11259 !! end
11260
11261 # This was bug 41545 in the PHP parser.
11262 !! test
11263 Nesting of <kbd>
11264 !! input
11265 <kbd>X<kbd>Y</kbd>Z</kbd>
11266 !! result
11267 <p><kbd>X<kbd>Y</kbd>Z</kbd>
11268 </p>
11269 !! end
11270
11271 # The following cases were bug 51081 in the PHP parser.
11272 # Note that there are some other nestable tags (b, i, etc) which are
11273 # not covered; see bug 51081 for discussion.
11274 !! test
11275 Nesting of <em>
11276 !! input
11277 <em>X<em>Y</em>Z</em>
11278 !! result
11279 <p><em>X<em>Y</em>Z</em>
11280 </p>
11281 !! end
11282
11283 !! test
11284 Nesting of <strong>
11285 !! input
11286 <strong>X<strong>Y</strong>Z</strong>
11287 !! result
11288 <p><strong>X<strong>Y</strong>Z</strong>
11289 </p>
11290 !! end
11291
11292 !! test
11293 Nesting of <q>
11294 !! input
11295 <q>X<q>Y</q>Z</q>
11296 !! result
11297 <p><q>X<q>Y</q>Z</q>
11298 </p>
11299 !! end
11300
11301 !! test
11302 Nesting of <ruby>
11303 !! input
11304 <ruby>X<ruby>Y</ruby>Z</ruby>
11305 !! result
11306 <p><ruby>X<ruby>Y</ruby>Z</ruby>
11307 </p>
11308 !! end
11309
11310 !! test
11311 Nesting of <bdo>
11312 !! input
11313 <bdo>X<bdo>Y</bdo>Z</bdo>
11314 !! result
11315 <p><bdo>X<bdo>Y</bdo>Z</bdo>
11316 </p>
11317 !! end
11318
11319
11320 ###
11321 ### Media links
11322 ###
11323
11324 !! test
11325 Media link
11326 !! input
11327 [[Media:Foobar.jpg]]
11328 !! result
11329 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
11330 </p>
11331 !! end
11332
11333 !! test
11334 Media link with text
11335 !! input
11336 [[Media:Foobar.jpg|A neat file to look at]]
11337 !! result
11338 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
11339 </p>
11340 !! end
11341
11342 # FIXME: this is still bad HTML tag nesting
11343 !! test
11344 Media link with nasty text
11345 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
11346 !! input
11347 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
11348 !! result
11349 <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>
11350
11351 !! end
11352
11353 !! test
11354 Media link to nonexistent file (bug 1702)
11355 !! input
11356 [[Media:No such.jpg]]
11357 !! result
11358 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
11359 </p>
11360 !! end
11361
11362 !! test
11363 Image link to nonexistent file (bug 1850 - good)
11364 !! input
11365 [[Image:No such.jpg]]
11366 !! result
11367 <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>
11368 </p>
11369 !! end
11370
11371 !! test
11372 :Image link to nonexistent file (bug 1850 - bad)
11373 !! input
11374 [[:Image:No such.jpg]]
11375 !! result
11376 <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>
11377 </p>
11378 !! end
11379
11380
11381
11382 !! test
11383 Character reference normalization in link text (bug 1938)
11384 !! input
11385 [[Main Page|this&that]]
11386 !! result
11387 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
11388 </p>
11389 !!end
11390
11391 !! article
11392 אַ
11393 !! text
11394 Test for unicode normalization
11395
11396 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
11397 !! endarticle
11398
11399 !! test
11400 (bug 19451) Links should refer to the normalized form.
11401 !! input
11402 [[&#xFB2E;]]
11403 [[&#x5d0;&#x5b7;]]
11404 [[&#x5d0;ַ]]
11405 [[א&#x5b7;]]
11406 [[אַ]]
11407 !! result
11408 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
11409 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
11410 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
11411 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
11412 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
11413 </p>
11414 !! end
11415
11416 !! test
11417 Empty attribute crash test (bug 2067)
11418 !! input
11419 <font color="">foo</font>
11420 !! result
11421 <p><font color="">foo</font>
11422 </p>
11423 !! end
11424
11425 !! test
11426 Empty attribute crash test single-quotes (bug 2067)
11427 !! input
11428 <font color=''>foo</font>
11429 !! result
11430 <p><font color="">foo</font>
11431 </p>
11432 !! end
11433
11434 !! test
11435 Attribute test: equals, then nothing
11436 !! input
11437 <font color=>foo</font>
11438 !! result
11439 <p><font>foo</font>
11440 </p>
11441 !! end
11442
11443 !! test
11444 Attribute test: unquoted value
11445 !! input
11446 <font color=x>foo</font>
11447 !! result
11448 <p><font color="x">foo</font>
11449 </p>
11450 !! end
11451
11452 !! test
11453 Attribute test: unquoted but illegal value (hash)
11454 !! input
11455 <font color=#x>foo</font>
11456 !! result
11457 <p><font color="#x">foo</font>
11458 </p>
11459 !! end
11460
11461 !! test
11462 Attribute test: no value
11463 !! input
11464 <font color>foo</font>
11465 !! result
11466 <p><font color="color">foo</font>
11467 </p>
11468 !! end
11469
11470 !! test
11471 Bug 2095: link with three closing brackets
11472 !! input
11473 [[Main Page]]]
11474 !! result
11475 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
11476 </p>
11477 !! end
11478
11479 !! test
11480 Bug 2095: link with pipe and three closing brackets
11481 !! input
11482 [[Main Page|link]]]
11483 !! result
11484 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
11485 </p>
11486 !! end
11487
11488 !! test
11489 Bug 2095: link with pipe and three closing brackets, version 2
11490 !! input
11491 [[Main Page|[http://example.com/]]]
11492 !! result
11493 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
11494 </p>
11495 !! end
11496
11497
11498 ###
11499 ### Safety
11500 ###
11501
11502 !! article
11503 Template:Dangerous attribute
11504 !! text
11505 " onmouseover="alert(document.cookie)
11506 !! endarticle
11507
11508 !! article
11509 Template:Dangerous style attribute
11510 !! text
11511 border-size: expression(alert(document.cookie))
11512 !! endarticle
11513
11514 !! article
11515 Template:Div style
11516 !! text
11517 <div style="float: right; {{{1}}}">Magic div</div>
11518 !! endarticle
11519
11520 !! test
11521 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
11522 !! input
11523 <div title="{{test}}"></div>
11524 !! result
11525 <div title="This is a test template"></div>
11526
11527 !! end
11528
11529 !! test
11530 Bug 2304: HTML attribute safety (dangerous template; 2309)
11531 !! input
11532 <div title="{{dangerous attribute}}"></div>
11533 !! result
11534 <div title=""></div>
11535
11536 !! end
11537
11538 !! test
11539 Bug 2304: HTML attribute safety (dangerous style template; 2309)
11540 !! input
11541 <div style="{{dangerous style attribute}}"></div>
11542 !! result
11543 <div style="/* insecure input */"></div>
11544
11545 !! end
11546
11547 !! test
11548 Bug 2304: HTML attribute safety (safe parameter; 2309)
11549 !! input
11550 {{div style|width: 200px}}
11551 !! result
11552 <div style="float: right; width: 200px">Magic div</div>
11553
11554 !! end
11555
11556 !! test
11557 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
11558 !! input
11559 {{div style|width: expression(alert(document.cookie))}}
11560 !! result
11561 <div style="/* insecure input */">Magic div</div>
11562
11563 !! end
11564
11565 !! test
11566 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
11567 !! input
11568 {{div style|"><script>alert(document.cookie)</script>}}
11569 !! result
11570 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
11571
11572 !! end
11573
11574 !! test
11575 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
11576 !! input
11577 {{div style|" ><script>alert(document.cookie)</script>}}
11578 !! result
11579 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
11580
11581 !! end
11582
11583 !! test
11584 Bug 2304: HTML attribute safety (link)
11585 !! input
11586 <div title="[[Main Page]]"></div>
11587 !! result
11588 <div title="&#91;&#91;Main Page]]"></div>
11589
11590 !! end
11591
11592 !! test
11593 Bug 2304: HTML attribute safety (italics)
11594 !! input
11595 <div title="''foobar''"></div>
11596 !! result
11597 <div title="&#39;&#39;foobar&#39;&#39;"></div>
11598
11599 !! end
11600
11601 !! test
11602 Bug 2304: HTML attribute safety (bold)
11603 !! input
11604 <div title="'''foobar'''"></div>
11605 !! result
11606 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
11607
11608 !! end
11609
11610
11611 !! test
11612 Bug 2304: HTML attribute safety (ISBN)
11613 !! input
11614 <div title="ISBN 1234567890"></div>
11615 !! result
11616 <div title="&#73;SBN 1234567890"></div>
11617
11618 !! end
11619
11620 !! test
11621 Bug 2304: HTML attribute safety (RFC)
11622 !! input
11623 <div title="RFC 1234"></div>
11624 !! result
11625 <div title="&#82;FC 1234"></div>
11626
11627 !! end
11628
11629 !! test
11630 Bug 2304: HTML attribute safety (PMID)
11631 !! input
11632 <div title="PMID 1234567890"></div>
11633 !! result
11634 <div title="&#80;MID 1234567890"></div>
11635
11636 !! end
11637
11638 !! test
11639 Bug 2304: HTML attribute safety (web link)
11640 !! input
11641 <div title="http://example.com/"></div>
11642 !! result
11643 <div title="http&#58;//example.com/"></div>
11644
11645 !! end
11646
11647 !! test
11648 Bug 2304: HTML attribute safety (named web link)
11649 !! input
11650 <div title="[http://example.com/ link]"></div>
11651 !! result
11652 <div title="&#91;http&#58;//example.com/ link]"></div>
11653
11654 !! end
11655
11656 !! test
11657 Bug 3244: HTML attribute safety (extension; safe)
11658 !! input
11659 <div style="<nowiki>background:blue</nowiki>"></div>
11660 !! result
11661 <div style="background:blue"></div>
11662
11663 !! end
11664
11665 !! test
11666 Bug 3244: HTML attribute safety (extension; unsafe)
11667 !! input
11668 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
11669 !! result
11670 <div style="/* insecure input */"></div>
11671
11672 !! end
11673
11674 # More MSIE fun discovered by Tom Gilder
11675
11676 !! test
11677 MSIE CSS safety test: spurious slash
11678 !! input
11679 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
11680 !! result
11681 <div style="/* insecure input */">evil</div>
11682
11683 !! end
11684
11685 !! test
11686 MSIE CSS safety test: hex code
11687 !! input
11688 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
11689 !! result
11690 <div style="/* insecure input */">evil</div>
11691
11692 !! end
11693
11694 !! test
11695 MSIE CSS safety test: comment in url
11696 !! input
11697 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
11698 !! result
11699 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
11700
11701 !! end
11702
11703 !! test
11704 MSIE CSS safety test: comment in expression
11705 !! input
11706 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
11707 !! result
11708 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
11709
11710 !! end
11711
11712 !! test
11713 CSS safety test: vertical tab
11714 !! input
11715 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
11716 !! result
11717 <p style="/* invalid control char */">A</p>
11718
11719 !! end
11720
11721 !! test
11722 MSIE CSS safety test: Fullwidth
11723 !! input
11724 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
11725 <div style="top:EXPRESSION(alert())">B</div>
11726 !! result
11727 <p style="/* insecure input */">A</p>
11728 <div style="/* insecure input */">B</div>
11729
11730 !! end
11731
11732 !! test
11733 MSIE CSS safety test: IPA extensions
11734 !! input
11735 <div style="background-image:uʀʟ(javascript:alert())">A</div>
11736 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
11737 !! result
11738 <div style="/* insecure input */">A</div>
11739 <p style="/* insecure input */">B</p>
11740
11741 !! end
11742
11743 !! test
11744 MSIE CSS safety test: sup/sub script
11745 !! input
11746 <div style="background-image:url⁽javascript:alert())">A</div>
11747 <div style="background-image:url₍javascript:alert())">B</div>
11748 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
11749 !! result
11750 <div style="/* insecure input */">A</div>
11751 <div style="/* insecure input */">B</div>
11752 <p style="/* insecure input */">C</p>
11753
11754 !! end
11755
11756 !! test
11757 MSIE CSS safety test: Repetition markers
11758 !! input
11759 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
11760 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
11761 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
11762 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
11763 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
11764 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
11765 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
11766 !! result
11767 <p style="/* insecure input */">A</p>
11768 <p style="/* insecure input */">B</p>
11769 <p style="/* insecure input */">C</p>
11770 <p style="/* insecure input */">D</p>
11771 <p style="/* insecure input */">E</p>
11772 <p style="/* insecure input */">F</p>
11773 <p style="/* insecure input */">G</p>
11774
11775 !! end
11776
11777 !! test
11778 Table attribute legitimate extension
11779 !! input
11780 {|
11781 !+ style="<nowiki>color:blue</nowiki>"| status
11782 |}
11783 !! result
11784 <table>
11785 <tr>
11786 <th style="color:blue"> status
11787 </th></tr></table>
11788
11789 !!end
11790
11791 !! test
11792 Table attribute safety
11793 !! input
11794 {|
11795 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
11796 |}
11797 !! result
11798 <table>
11799 <tr>
11800 <th style="/* insecure input */"> status
11801 </th></tr></table>
11802
11803 !! end
11804
11805 !! test
11806 CSS line continuation 1
11807 !! input
11808 <div style="background-image: u\&#10;rl(test.jpg);"></div>
11809 !! result
11810 <div style="/* insecure input */"></div>
11811
11812 !! end
11813
11814 !! test
11815 CSS line continuation 2
11816 !! input
11817 <div style="background-image: u\&#13;rl(test.jpg); "></div>
11818 !! result
11819 <div style="/* insecure input */"></div>
11820
11821 !! end
11822
11823 !! article
11824 Template:Identity
11825 !! text
11826 {{{1}}}
11827 !! endarticle
11828
11829 !! test
11830 Expansion of multi-line templates in attribute values (bug 6255)
11831 !! input
11832 <div style="background: {{identity|#00FF00}}">-</div>
11833 !! result
11834 <div style="background: #00FF00">-</div>
11835
11836 !! end
11837
11838
11839 !! test
11840 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
11841 !! input
11842 <div style="background:
11843 #00FF00">-</div>
11844 !! result
11845 <div style="background: #00FF00">-</div>
11846
11847 !! end
11848
11849 !! test
11850 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
11851 !! input
11852 <div style="background: &#10;#00FF00">-</div>
11853 !! result
11854 <div style="background: &#10;#00FF00">-</div>
11855
11856 !! end
11857
11858 ###
11859 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
11860 ###
11861 !! test
11862 Parser hook: empty input
11863 !! input
11864 <tag></tag>
11865 !! result
11866 <pre>
11867 ''
11868 array (
11869 )
11870 </pre>
11871
11872 !! end
11873
11874 !! test
11875 Parser hook: empty input using terminated empty elements
11876 !! input
11877 <tag/>
11878 !! result
11879 <pre>
11880 NULL
11881 array (
11882 )
11883 </pre>
11884
11885 !! end
11886
11887 !! test
11888 Parser hook: empty input using terminated empty elements (space before)
11889 !! input
11890 <tag />
11891 !! result
11892 <pre>
11893 NULL
11894 array (
11895 )
11896 </pre>
11897
11898 !! end
11899
11900 !! test
11901 Parser hook: basic input
11902 !! input
11903 <tag>input</tag>
11904 !! result
11905 <pre>
11906 'input'
11907 array (
11908 )
11909 </pre>
11910
11911 !! end
11912
11913
11914 !! test
11915 Parser hook: case insensitive
11916 !! input
11917 <TAG>input</TAG>
11918 !! result
11919 <pre>
11920 'input'
11921 array (
11922 )
11923 </pre>
11924
11925 !! end
11926
11927
11928 !! test
11929 Parser hook: case insensitive, redux
11930 !! input
11931 <TaG>input</TAg>
11932 !! result
11933 <pre>
11934 'input'
11935 array (
11936 )
11937 </pre>
11938
11939 !! end
11940
11941 !! test
11942 Parser hook: nested tags
11943 !! options
11944 noxml
11945 !! input
11946 <tag><tag></tag></tag>
11947 !! result
11948 <pre>
11949 '<tag>'
11950 array (
11951 )
11952 </pre>&lt;/tag&gt;
11953
11954 !! end
11955
11956 !! test
11957 Parser hook: basic arguments
11958 !! input
11959 <tag width=200 height = "100" depth = '50' square></tag>
11960 !! result
11961 <pre>
11962 ''
11963 array (
11964 'width' => '200',
11965 'height' => '100',
11966 'depth' => '50',
11967 'square' => 'square',
11968 )
11969 </pre>
11970
11971 !! end
11972
11973 !! test
11974 Parser hook: argument containing a forward slash (bug 5344)
11975 !! input
11976 <tag filename='/tmp/bla'></tag>
11977 !! result
11978 <pre>
11979 ''
11980 array (
11981 'filename' => '/tmp/bla',
11982 )
11983 </pre>
11984
11985 !! end
11986
11987 !! test
11988 Parser hook: empty input using terminated empty elements (bug 2374)
11989 !! input
11990 <tag foo=bar/>text
11991 !! result
11992 <pre>
11993 NULL
11994 array (
11995 'foo' => 'bar',
11996 )
11997 </pre>text
11998
11999 !! end
12000
12001 # </tag> should be output literally since there is no matching tag that begins it
12002 !! test
12003 Parser hook: basic arguments using terminated empty elements (bug 2374)
12004 !! input
12005 <tag width=200 height = "100" depth = '50' square/>
12006 other stuff
12007 </tag>
12008 !! result
12009 <pre>
12010 NULL
12011 array (
12012 'width' => '200',
12013 'height' => '100',
12014 'depth' => '50',
12015 'square' => 'square',
12016 )
12017 </pre>
12018 <p>other stuff
12019 &lt;/tag&gt;
12020 </p>
12021 !! end
12022
12023 ###
12024 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
12025 ###
12026
12027 !! test
12028 Parser hook: static parser hook not inside a comment
12029 !! input
12030 <statictag>hello, world</statictag>
12031 <statictag action=flush/>
12032 !! result
12033 <p>hello, world
12034 </p>
12035 !! end
12036
12037
12038 !! test
12039 Parser hook: static parser hook inside a comment
12040 !! input
12041 <!-- <statictag>hello, world</statictag> -->
12042 <statictag action=flush/>
12043 !! result
12044 <p><br />
12045 </p>
12046 !! end
12047
12048 # Nested template calls; this case was broken by Parser.php rev 1.506,
12049 # since reverted.
12050
12051 !! article
12052 Template:One-parameter
12053 !! text
12054 (My parameter is: {{{1}}})
12055 !! endarticle
12056
12057 !! article
12058 Template:Map-one-parameter
12059 !! text
12060 {{{{{1}}}|{{{2}}}}}
12061 !! endarticle
12062
12063 !! test
12064 Nested template calls
12065 !! input
12066 {{Map-one-parameter|One-parameter|param}}
12067 !! result
12068 <p>(My parameter is: param)
12069 </p>
12070 !! end
12071
12072
12073 ###
12074 ### Sanitizer
12075 ###
12076 !! test
12077 Sanitizer: Closing of open tags
12078 !! input
12079 <s></s><table></table>
12080 !! result
12081 <s></s><table></table>
12082
12083 !! end
12084
12085 !! test
12086 Sanitizer: Closing of open but not closed tags
12087 !! input
12088 <s>foo
12089 !! result
12090 <p><s>foo</s>
12091 </p>
12092 !! end
12093
12094 !! test
12095 Sanitizer: Closing of closed but not open tags
12096 !! input
12097 </s>
12098 !! result
12099 <p>&lt;/s&gt;
12100 </p>
12101 !! end
12102
12103 !! test
12104 Sanitizer: Closing of closed but not open table tags
12105 !! input
12106 Table not started</td></tr></table>
12107 !! result
12108 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
12109 </p>
12110 !! end
12111
12112 !! test
12113 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
12114 !! input
12115 <span id="æ: v">byte</span>[[#æ: v|backlink]]
12116 !! result
12117 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
12118 </p>
12119 !! end
12120
12121 !! test
12122 Sanitizer: Validating the contents of the id attribute (bug 4515)
12123 !! options
12124 disabled
12125 !! input
12126 <br id=9 />
12127 !! result
12128 Something, but definitely not <br id="9" />...
12129 !! end
12130
12131 !! test
12132 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
12133 !! options
12134 disabled
12135 !! input
12136 <br id="foo" /><br id="foo" />
12137 !! result
12138 Something need to be done. foo-2 ?
12139 !! end
12140
12141 !! test
12142 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
12143 !! input
12144 <div itemscope>
12145 <meta itemprop="hello" content="world">
12146 <meta http-equiv="refresh" content="5">
12147 <meta itemprop="hello" http-equiv="refresh" content="5">
12148 <link itemprop="hello" href="{{SERVER}}">
12149 <link rel="stylesheet" href="{{SERVER}}">
12150 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
12151 </div>
12152 !! result
12153 <div itemscope="itemscope">
12154 <p> <meta itemprop="hello" content="world" />
12155 &lt;meta http-equiv="refresh" content="5"&gt;
12156 <meta itemprop="hello" content="5" />
12157 </p>
12158 <link itemprop="hello" href="http&#58;//example.org" />
12159 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
12160 <link itemprop="hello" href="http&#58;//example.org" />
12161 </div>
12162
12163 !! end
12164
12165 !! test
12166 Language converter: output gets cut off unexpectedly (bug 5757)
12167 !! options
12168 language=zh
12169 !! input
12170 this bit is safe: }-
12171
12172 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
12173
12174 then we get cut off here: }-
12175
12176 all additional text is vanished
12177 !! result
12178 <p>this bit is safe: }-
12179 </p><p>but if we add a conversion instance: xxx
12180 </p><p>then we get cut off here: }-
12181 </p><p>all additional text is vanished
12182 </p>
12183 !! end
12184
12185 !! test
12186 Self closed html pairs (bug 5487)
12187 !! options
12188 !! input
12189 <center><font id="bug" />Centered text</center>
12190 <div><font id="bug2" />In div text</div>
12191 !! result
12192 <center>&lt;font id="bug" /&gt;Centered text</center>
12193 <div>&lt;font id="bug2" /&gt;In div text</div>
12194
12195 !! end
12196
12197 #
12198 #
12199 #
12200
12201 !! test
12202 Punctuation: nbsp before exclamation
12203 !! input
12204 C'est grave !
12205 !! result
12206 <p>C'est grave&#160;!
12207 </p>
12208 !! end
12209
12210 !! test
12211 Punctuation: CSS !important (bug 11874)
12212 !! input
12213 <div style="width:50% !important">important</div>
12214 !! result
12215 <div style="width:50% !important">important</div>
12216
12217 !!end
12218
12219 !! test
12220 Punctuation: CSS ! important (bug 11874; with space after)
12221 !! input
12222 <div style="width:50% ! important">important</div>
12223 !! result
12224 <div style="width:50% ! important">important</div>
12225
12226 !!end
12227
12228
12229 !! test
12230 HTML bullet list, closed tags (bug 5497)
12231 !! input
12232 <ul>
12233 <li>One</li>
12234 <li>Two</li>
12235 </ul>
12236 !! result
12237 <ul>
12238 <li>One</li>
12239 <li>Two</li>
12240 </ul>
12241
12242 !! end
12243
12244 !! test
12245 HTML bullet list, unclosed tags (bug 5497)
12246 !! options
12247 disabled
12248 !! input
12249 <ul>
12250 <li>One
12251 <li>Two
12252 </ul>
12253 !! result
12254 <ul>
12255 <li>One
12256 </li>
12257 <li>Two
12258 </li>
12259 </ul>
12260
12261 !! end
12262
12263 !! test
12264 HTML ordered list, closed tags (bug 5497)
12265 !! input
12266 <ol>
12267 <li>One</li>
12268 <li>Two</li>
12269 </ol>
12270 !! result
12271 <ol>
12272 <li>One</li>
12273 <li>Two</li>
12274 </ol>
12275
12276 !! end
12277
12278 !! test
12279 HTML ordered list, unclosed tags (bug 5497)
12280 !! options
12281 disabled
12282 !! input
12283 <ol>
12284 <li>One
12285 <li>Two
12286 </ol>
12287 !! result
12288 <ol>
12289 <li>One
12290 </li>
12291 <li>Two
12292 </li>
12293 </ol>
12294
12295 !! end
12296
12297 !! test
12298 HTML nested bullet list, closed tags (bug 5497)
12299 !! input
12300 <ul>
12301 <li>One</li>
12302 <li>Two:
12303 <ul>
12304 <li>Sub-one</li>
12305 <li>Sub-two</li>
12306 </ul>
12307 </li>
12308 </ul>
12309 !! result
12310 <ul>
12311 <li>One</li>
12312 <li>Two:
12313 <ul>
12314 <li>Sub-one</li>
12315 <li>Sub-two</li>
12316 </ul>
12317 </li>
12318 </ul>
12319
12320 !! end
12321
12322 !! test
12323 HTML nested bullet list, open tags (bug 5497)
12324 !! options
12325 disabled
12326 !! input
12327 <ul>
12328 <li>One
12329 <li>Two:
12330 <ul>
12331 <li>Sub-one
12332 <li>Sub-two
12333 </ul>
12334 </ul>
12335 !! result
12336 <ul>
12337 <li>One
12338 </li>
12339 <li>Two:
12340 <ul>
12341 <li>Sub-one
12342 </li>
12343 <li>Sub-two
12344 </li>
12345 </ul>
12346 </li>
12347 </ul>
12348
12349 !! end
12350
12351 !! test
12352 HTML nested ordered list, closed tags (bug 5497)
12353 !! input
12354 <ol>
12355 <li>One</li>
12356 <li>Two:
12357 <ol>
12358 <li>Sub-one</li>
12359 <li>Sub-two</li>
12360 </ol>
12361 </li>
12362 </ol>
12363 !! result
12364 <ol>
12365 <li>One</li>
12366 <li>Two:
12367 <ol>
12368 <li>Sub-one</li>
12369 <li>Sub-two</li>
12370 </ol>
12371 </li>
12372 </ol>
12373
12374 !! end
12375
12376 !! test
12377 HTML nested ordered list, open tags (bug 5497)
12378 !! options
12379 disabled
12380 !! input
12381 <ol>
12382 <li>One
12383 <li>Two:
12384 <ol>
12385 <li>Sub-one
12386 <li>Sub-two
12387 </ol>
12388 </ol>
12389 !! result
12390 <ol>
12391 <li>One
12392 </li>
12393 <li>Two:
12394 <ol>
12395 <li>Sub-one
12396 </li>
12397 <li>Sub-two
12398 </li>
12399 </ol>
12400 </li>
12401 </ol>
12402
12403 !! end
12404
12405 !! test
12406 HTML ordered list item with parameters oddity
12407 !! input
12408 <ol><li id="fragment">One</li>
12409 </ol>
12410 !! result
12411 <ol><li id="fragment">One</li>
12412 </ol>
12413
12414 !! end
12415
12416 !!test
12417 bug 5918: autonumbering
12418 !! input
12419 [http://first/] [http://second] [ftp://ftp]
12420
12421 ftp://inlineftp
12422
12423 [mailto:enclosed@mail.tld With target]
12424
12425 [mailto:enclosed@mail.tld]
12426
12427 mailto:inline@mail.tld
12428 !! result
12429 <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>
12430 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
12431 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
12432 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
12433 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
12434 </p>
12435 !! end
12436
12437
12438 #
12439 # Security and HTML correctness
12440 # From Nick Jenkins' fuzz testing
12441 #
12442
12443 !! test
12444 Fuzz testing: Parser13
12445 !! input
12446 {|
12447 | http://a|
12448 !! result
12449 <table>
12450 <tr>
12451 <td>
12452 </td>
12453 </tr>
12454 </table>
12455
12456 !! end
12457
12458 !! test
12459 Fuzz testing: Parser14
12460 !! input
12461 == onmouseover= ==
12462 http://__TOC__
12463 !! result
12464 <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>
12465 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12466 <ul>
12467 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
12468 </ul>
12469 </div>
12470
12471
12472 !! end
12473
12474 !! test
12475 Fuzz testing: Parser14-table
12476 !! input
12477 ==a==
12478 {| STYLE=__TOC__
12479 !! result
12480 <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>
12481 <table style="&#95;_TOC&#95;_">
12482 <tr><td></td></tr>
12483 </table>
12484
12485 !! end
12486
12487 # Known to produce bogus xml (extra </td>)
12488 !! test
12489 Fuzz testing: Parser16
12490 !! options
12491 noxml
12492 !! input
12493 {|
12494 !https://||||||
12495 !! result
12496 <table>
12497 <tr>
12498 <th>https://</th>
12499 <th></th>
12500 <th></th>
12501 <th>
12502 </td>
12503 </tr>
12504 </table>
12505
12506 !! end
12507
12508 !! test
12509 Fuzz testing: Parser21
12510 !! input
12511 {|
12512 ! irc://{{ftp://a" onmouseover="alert('hello world');"
12513 |
12514 !! result
12515 <table>
12516 <tr>
12517 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
12518 </th>
12519 <td>
12520 </td>
12521 </tr>
12522 </table>
12523
12524 !! end
12525
12526 !! test
12527 Fuzz testing: Parser22
12528 !! input
12529 http://===r:::https://b
12530
12531 {|
12532 !!result
12533 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
12534 </p>
12535 <table>
12536 <tr><td></td></tr>
12537 </table>
12538
12539 !! end
12540
12541 # Known to produce bad XML for now
12542 !! test
12543 Fuzz testing: Parser24
12544 !! options
12545 noxml
12546 !! input
12547 {|
12548 {{{|
12549 <u CLASS=
12550 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
12551 <br style="onmouseover='alert(document.cookie);' " />
12552
12553 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
12554 |
12555 !! result
12556 <table>
12557 {{{|
12558 <u class="&#124;">}}}} &gt;
12559 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
12560
12561 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
12562 <tr>
12563 <td></u>
12564 </td>
12565 </tr>
12566 </table>
12567
12568 !! end
12569
12570 # Note: the current result listed for this is not what the original one was,
12571 # but the original bug was JavaScript injection, which is fixed in any case.
12572 # It's not clear that the original result listed was any more correct than the
12573 # current one. Original result:
12574 # <p>{{{|
12575 # </p>
12576 # <li class="&#124;&#124;">
12577 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
12578 !!test
12579 Fuzz testing: Parser25 (bug 6055)
12580 !! input
12581 {{{
12582 |
12583 <LI CLASS=||
12584 >
12585 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
12586 !! result
12587 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
12588 </p>
12589 !! end
12590
12591 !!test
12592 Fuzz testing: URL adjacent extension (with space, clean)
12593 !! options
12594 !! input
12595 http://example.com <nowiki>junk</nowiki>
12596 !! result
12597 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
12598 </p>
12599 !!end
12600
12601 !!test
12602 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
12603 !! options
12604 !! input
12605 http://example.com<nowiki>junk</nowiki>
12606 !! result
12607 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
12608 </p>
12609 !!end
12610
12611 !!test
12612 Fuzz testing: URL adjacent extension (no space, dirty; pre)
12613 !! options
12614 !! input
12615 http://example.com<pre>junk</pre>
12616 !! result
12617 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
12618
12619 !!end
12620
12621 !!test
12622 Fuzz testing: image with bogus manual thumbnail
12623 !!input
12624 [[Image:foobar.jpg|thumbnail= ]]
12625 !!result
12626 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
12627
12628 !!end
12629
12630 !! test
12631 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
12632 !! input
12633 <pre dir="&#10;"></pre>
12634 !! result
12635 <pre dir="&#10;"></pre>
12636
12637 !! end
12638
12639 !! test
12640 Parsing optional HTML elements (Bug 6171)
12641 !! options
12642 !! input
12643 <table>
12644 <tr>
12645 <td> Some tabular data</td>
12646 <td> More tabular data ...
12647 <td> And yet som tabular data</td>
12648 </tr>
12649 </table>
12650 !! result
12651 <table>
12652 <tr>
12653 <td> Some tabular data</td>
12654 <td> More tabular data ...
12655 </td><td> And yet som tabular data</td>
12656 </tr>
12657 </table>
12658
12659 !! end
12660
12661 !! test
12662 Correct handling of <td>, <tr> (Bug 6171)
12663 !! options
12664 !! input
12665 <table>
12666 <tr>
12667 <td> Some tabular data</td>
12668 <td> More tabular data ...</td>
12669 <td> And yet som tabular data</td>
12670 </tr>
12671 </table>
12672 !! result
12673 <table>
12674 <tr>
12675 <td> Some tabular data</td>
12676 <td> More tabular data ...</td>
12677 <td> And yet som tabular data</td>
12678 </tr>
12679 </table>
12680
12681 !! end
12682
12683
12684 !! test
12685 Parsing crashing regression (fr:JavaScript)
12686 !! input
12687 </body></x>
12688 !! result
12689 <p>&lt;/body&gt;&lt;/x&gt;
12690 </p>
12691 !! end
12692
12693 !! test
12694 Inline wiki vs wiki block nesting
12695 !! input
12696 '''Bold paragraph
12697
12698 New wiki paragraph
12699 !! result
12700 <p><b>Bold paragraph</b>
12701 </p><p>New wiki paragraph
12702 </p>
12703 !! end
12704
12705 !! test
12706 Inline HTML vs wiki block nesting
12707 !! options
12708 disabled
12709 !! input
12710 <b>Bold paragraph
12711
12712 New wiki paragraph
12713 !! result
12714 <p><b>Bold paragraph</b>
12715 </p><p>New wiki paragraph
12716 </p>
12717 !! end
12718
12719 # Original result was this:
12720 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
12721 # </p>
12722 # While that might be marginally more intuitive, maybe, the six-apostrophe
12723 # construct is clearly pathological and the result stated here (which is what
12724 # the parser actually does) is about as reasonable as anything.
12725 !!test
12726 Mixing markup for italics and bold
12727 !! options
12728 !! input
12729 '''bold''''''bold''bolditalics'''''
12730 !! result
12731 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
12732 </p>
12733 !! end
12734
12735
12736 !! article
12737 Xyzzyx
12738 !! text
12739 Article for special page transclusion test
12740 !! endarticle
12741
12742 !! test
12743 Special page transclusion
12744 !! options
12745 !! input
12746 {{Special:Prefixindex/Xyzzyx}}
12747 !! result
12748 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
12749
12750 !! end
12751
12752 !! test
12753 Special page transclusion twice (bug 5021)
12754 !! options
12755 !! input
12756 {{Special:Prefixindex/Xyzzyx}}
12757 {{Special:Prefixindex/Xyzzyx}}
12758 !! result
12759 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
12760 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
12761
12762 !! end
12763
12764 !! test
12765 Transclusion of default MediaWiki message
12766 !! input
12767 {{MediaWiki:Mainpage}}
12768 !!result
12769 <p>Main Page
12770 </p>
12771 !! end
12772
12773 !! test
12774 Transclusion of nonexistent MediaWiki message
12775 !! input
12776 {{MediaWiki:Mainpagexxx}}
12777 !!result
12778 <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>
12779 </p>
12780 !! end
12781
12782 !! test
12783 Transclusion of MediaWiki message with underscore
12784 !! input
12785 {{MediaWiki:history_short}}
12786 !! result
12787 <p>History
12788 </p>
12789 !! end
12790
12791 !! test
12792 Transclusion of MediaWiki message with space
12793 !! input
12794 {{MediaWiki:history short}}
12795 !! result
12796 <p>History
12797 </p>
12798 !! end
12799
12800 !! test
12801 Invalid header with following text
12802 !! input
12803 = x = y
12804 !! result
12805 <p>= x = y
12806 </p>
12807 !! end
12808
12809
12810 !! test
12811 Section extraction test (section 0)
12812 !! options
12813 section=0
12814 !! input
12815 start
12816 ==a==
12817 ===aa===
12818 ====aaa====
12819 ==b==
12820 ===ba===
12821 ===bb===
12822 ====bba====
12823 ===bc===
12824 ==c==
12825 ===ca===
12826 !! result
12827 start
12828 !! end
12829
12830 !! test
12831 Section extraction test (section 1)
12832 !! options
12833 section=1
12834 !! input
12835 start
12836 ==a==
12837 ===aa===
12838 ====aaa====
12839 ==b==
12840 ===ba===
12841 ===bb===
12842 ====bba====
12843 ===bc===
12844 ==c==
12845 ===ca===
12846 !! result
12847 ==a==
12848 ===aa===
12849 ====aaa====
12850 !! end
12851
12852 !! test
12853 Section extraction test (section 2)
12854 !! options
12855 section=2
12856 !! input
12857 start
12858 ==a==
12859 ===aa===
12860 ====aaa====
12861 ==b==
12862 ===ba===
12863 ===bb===
12864 ====bba====
12865 ===bc===
12866 ==c==
12867 ===ca===
12868 !! result
12869 ===aa===
12870 ====aaa====
12871 !! end
12872
12873 !! test
12874 Section extraction test (section 3)
12875 !! options
12876 section=3
12877 !! input
12878 start
12879 ==a==
12880 ===aa===
12881 ====aaa====
12882 ==b==
12883 ===ba===
12884 ===bb===
12885 ====bba====
12886 ===bc===
12887 ==c==
12888 ===ca===
12889 !! result
12890 ====aaa====
12891 !! end
12892
12893 !! test
12894 Section extraction test (section 4)
12895 !! options
12896 section=4
12897 !! input
12898 start
12899 ==a==
12900 ===aa===
12901 ====aaa====
12902 ==b==
12903 ===ba===
12904 ===bb===
12905 ====bba====
12906 ===bc===
12907 ==c==
12908 ===ca===
12909 !! result
12910 ==b==
12911 ===ba===
12912 ===bb===
12913 ====bba====
12914 ===bc===
12915 !! end
12916
12917 !! test
12918 Section extraction test (section 5)
12919 !! options
12920 section=5
12921 !! input
12922 start
12923 ==a==
12924 ===aa===
12925 ====aaa====
12926 ==b==
12927 ===ba===
12928 ===bb===
12929 ====bba====
12930 ===bc===
12931 ==c==
12932 ===ca===
12933 !! result
12934 ===ba===
12935 !! end
12936
12937 !! test
12938 Section extraction test (section 6)
12939 !! options
12940 section=6
12941 !! input
12942 start
12943 ==a==
12944 ===aa===
12945 ====aaa====
12946 ==b==
12947 ===ba===
12948 ===bb===
12949 ====bba====
12950 ===bc===
12951 ==c==
12952 ===ca===
12953 !! result
12954 ===bb===
12955 ====bba====
12956 !! end
12957
12958 !! test
12959 Section extraction test (section 7)
12960 !! options
12961 section=7
12962 !! input
12963 start
12964 ==a==
12965 ===aa===
12966 ====aaa====
12967 ==b==
12968 ===ba===
12969 ===bb===
12970 ====bba====
12971 ===bc===
12972 ==c==
12973 ===ca===
12974 !! result
12975 ====bba====
12976 !! end
12977
12978 !! test
12979 Section extraction test (section 8)
12980 !! options
12981 section=8
12982 !! input
12983 start
12984 ==a==
12985 ===aa===
12986 ====aaa====
12987 ==b==
12988 ===ba===
12989 ===bb===
12990 ====bba====
12991 ===bc===
12992 ==c==
12993 ===ca===
12994 !! result
12995 ===bc===
12996 !! end
12997
12998 !! test
12999 Section extraction test (section 9)
13000 !! options
13001 section=9
13002 !! input
13003 start
13004 ==a==
13005 ===aa===
13006 ====aaa====
13007 ==b==
13008 ===ba===
13009 ===bb===
13010 ====bba====
13011 ===bc===
13012 ==c==
13013 ===ca===
13014 !! result
13015 ==c==
13016 ===ca===
13017 !! end
13018
13019 !! test
13020 Section extraction test (section 10)
13021 !! options
13022 section=10
13023 !! input
13024 start
13025 ==a==
13026 ===aa===
13027 ====aaa====
13028 ==b==
13029 ===ba===
13030 ===bb===
13031 ====bba====
13032 ===bc===
13033 ==c==
13034 ===ca===
13035 !! result
13036 ===ca===
13037 !! end
13038
13039 !! test
13040 Section extraction test (nonexistent section 11)
13041 !! options
13042 section=11
13043 !! input
13044 start
13045 ==a==
13046 ===aa===
13047 ====aaa====
13048 ==b==
13049 ===ba===
13050 ===bb===
13051 ====bba====
13052 ===bc===
13053 ==c==
13054 ===ca===
13055 !! result
13056 !! end
13057
13058 !! test
13059 Section extraction test with bogus heading (section 1)
13060 !! options
13061 section=1
13062 !! input
13063 ==a==
13064 ==bogus== not a legal section
13065 ==b==
13066 !! result
13067 ==a==
13068 ==bogus== not a legal section
13069 !! end
13070
13071 !! test
13072 Section extraction test with bogus heading (section 2)
13073 !! options
13074 section=2
13075 !! input
13076 ==a==
13077 ==bogus== not a legal section
13078 ==b==
13079 !! result
13080 ==b==
13081 !! end
13082
13083 !! test
13084 Section extraction test with comment after heading (section 1)
13085 !! options
13086 section=1
13087 !! input
13088 ==a==
13089 ==b== <!-- -->
13090 ==c==
13091 !! result
13092 ==a==
13093 !! end
13094
13095 !! test
13096 Section extraction test with comment after heading (section 2)
13097 !! options
13098 section=2
13099 !! input
13100 ==a==
13101 ==b== <!-- -->
13102 ==c==
13103 !! result
13104 ==b== <!-- -->
13105 !! end
13106
13107 !! test
13108 Section extraction test with bogus <nowiki> heading (section 1)
13109 !! options
13110 section=1
13111 !! input
13112 ==a==
13113 ==bogus== <nowiki>not a legal section</nowiki>
13114 ==b==
13115 !! result
13116 ==a==
13117 ==bogus== <nowiki>not a legal section</nowiki>
13118 !! end
13119
13120 !! test
13121 Section extraction test with bogus <nowiki> heading (section 2)
13122 !! options
13123 section=2
13124 !! input
13125 ==a==
13126 ==bogus== <nowiki>not a legal section</nowiki>
13127 ==b==
13128 !! result
13129 ==b==
13130 !! end
13131
13132
13133 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
13134 # instead of respecting commented sections
13135 !! test
13136 Section extraction prefixed by comment (section 1)
13137 !! options
13138 section=1
13139 !! input
13140 <!-- -->==sec1==
13141 ==sec2==
13142 !!result
13143 ==sec2==
13144 !!end
13145
13146 !! test
13147 Section extraction prefixed by comment (section 2)
13148 !! options
13149 section=2
13150 !! input
13151 <!-- -->==sec1==
13152 ==sec2==
13153 !!result
13154
13155 !!end
13156
13157
13158 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
13159 # instead of respecting HTML-style headings
13160 !! test
13161 Section extraction, mixed wiki and html (section 1)
13162 !! options
13163 section=1
13164 !! input
13165 <h2>unmarked</h2>
13166 unmarked
13167 ==1==
13168 one
13169 ==2==
13170 two
13171 !! result
13172 ==1==
13173 one
13174 !! end
13175
13176 !! test
13177 Section extraction, mixed wiki and html (section 2)
13178 !! options
13179 section=2
13180 !! input
13181 <h2>unmarked</h2>
13182 unmarked
13183 ==1==
13184 one
13185 ==2==
13186 two
13187 !! result
13188 ==2==
13189 two
13190 !! end
13191
13192
13193 # Formerly testing for bug 3342
13194 !! test
13195 Section extraction, heading surrounded by <noinclude>
13196 !! options
13197 section=1
13198 !! input
13199 <noinclude>==unmarked==</noinclude>
13200 ==marked==
13201 !! result
13202 ==marked==
13203 !!end
13204
13205 # Test behavior of bug 19910
13206 !! test
13207 Sectiion with all-equals
13208 !! options
13209 section=2
13210 !! input
13211 ===
13212 The line above must have a trailing space
13213 === <!--
13214 --> <!-- -->
13215 But just in case it doesn't...
13216 !! result
13217 === <!--
13218 --> <!-- -->
13219 But just in case it doesn't...
13220 !! end
13221
13222 !! test
13223 Section replacement test (section 0)
13224 !! options
13225 replace=0,"xxx"
13226 !! input
13227 start
13228 ==a==
13229 ===aa===
13230 ====aaa====
13231 ==b==
13232 ===ba===
13233 ===bb===
13234 ====bba====
13235 ===bc===
13236 ==c==
13237 ===ca===
13238 !! result
13239 xxx
13240
13241 ==a==
13242 ===aa===
13243 ====aaa====
13244 ==b==
13245 ===ba===
13246 ===bb===
13247 ====bba====
13248 ===bc===
13249 ==c==
13250 ===ca===
13251 !! end
13252
13253 !! test
13254 Section replacement test (section 1)
13255 !! options
13256 replace=1,"xxx"
13257 !! input
13258 start
13259 ==a==
13260 ===aa===
13261 ====aaa====
13262 ==b==
13263 ===ba===
13264 ===bb===
13265 ====bba====
13266 ===bc===
13267 ==c==
13268 ===ca===
13269 !! result
13270 start
13271 xxx
13272
13273 ==b==
13274 ===ba===
13275 ===bb===
13276 ====bba====
13277 ===bc===
13278 ==c==
13279 ===ca===
13280 !! end
13281
13282 !! test
13283 Section replacement test (section 2)
13284 !! options
13285 replace=2,"xxx"
13286 !! input
13287 start
13288 ==a==
13289 ===aa===
13290 ====aaa====
13291 ==b==
13292 ===ba===
13293 ===bb===
13294 ====bba====
13295 ===bc===
13296 ==c==
13297 ===ca===
13298 !! result
13299 start
13300 ==a==
13301 xxx
13302
13303 ==b==
13304 ===ba===
13305 ===bb===
13306 ====bba====
13307 ===bc===
13308 ==c==
13309 ===ca===
13310 !! end
13311
13312 !! test
13313 Section replacement test (section 3)
13314 !! options
13315 replace=3,"xxx"
13316 !! input
13317 start
13318 ==a==
13319 ===aa===
13320 ====aaa====
13321 ==b==
13322 ===ba===
13323 ===bb===
13324 ====bba====
13325 ===bc===
13326 ==c==
13327 ===ca===
13328 !! result
13329 start
13330 ==a==
13331 ===aa===
13332 xxx
13333
13334 ==b==
13335 ===ba===
13336 ===bb===
13337 ====bba====
13338 ===bc===
13339 ==c==
13340 ===ca===
13341 !! end
13342
13343 !! test
13344 Section replacement test (section 4)
13345 !! options
13346 replace=4,"xxx"
13347 !! input
13348 start
13349 ==a==
13350 ===aa===
13351 ====aaa====
13352 ==b==
13353 ===ba===
13354 ===bb===
13355 ====bba====
13356 ===bc===
13357 ==c==
13358 ===ca===
13359 !! result
13360 start
13361 ==a==
13362 ===aa===
13363 ====aaa====
13364 xxx
13365
13366 ==c==
13367 ===ca===
13368 !! end
13369
13370 !! test
13371 Section replacement test (section 5)
13372 !! options
13373 replace=5,"xxx"
13374 !! input
13375 start
13376 ==a==
13377 ===aa===
13378 ====aaa====
13379 ==b==
13380 ===ba===
13381 ===bb===
13382 ====bba====
13383 ===bc===
13384 ==c==
13385 ===ca===
13386 !! result
13387 start
13388 ==a==
13389 ===aa===
13390 ====aaa====
13391 ==b==
13392 xxx
13393
13394 ===bb===
13395 ====bba====
13396 ===bc===
13397 ==c==
13398 ===ca===
13399 !! end
13400
13401 !! test
13402 Section replacement test (section 6)
13403 !! options
13404 replace=6,"xxx"
13405 !! input
13406 start
13407 ==a==
13408 ===aa===
13409 ====aaa====
13410 ==b==
13411 ===ba===
13412 ===bb===
13413 ====bba====
13414 ===bc===
13415 ==c==
13416 ===ca===
13417 !! result
13418 start
13419 ==a==
13420 ===aa===
13421 ====aaa====
13422 ==b==
13423 ===ba===
13424 xxx
13425
13426 ===bc===
13427 ==c==
13428 ===ca===
13429 !! end
13430
13431 !! test
13432 Section replacement test (section 7)
13433 !! options
13434 replace=7,"xxx"
13435 !! input
13436 start
13437 ==a==
13438 ===aa===
13439 ====aaa====
13440 ==b==
13441 ===ba===
13442 ===bb===
13443 ====bba====
13444 ===bc===
13445 ==c==
13446 ===ca===
13447 !! result
13448 start
13449 ==a==
13450 ===aa===
13451 ====aaa====
13452 ==b==
13453 ===ba===
13454 ===bb===
13455 xxx
13456
13457 ===bc===
13458 ==c==
13459 ===ca===
13460 !! end
13461
13462 !! test
13463 Section replacement test (section 8)
13464 !! options
13465 replace=8,"xxx"
13466 !! input
13467 start
13468 ==a==
13469 ===aa===
13470 ====aaa====
13471 ==b==
13472 ===ba===
13473 ===bb===
13474 ====bba====
13475 ===bc===
13476 ==c==
13477 ===ca===
13478 !! result
13479 start
13480 ==a==
13481 ===aa===
13482 ====aaa====
13483 ==b==
13484 ===ba===
13485 ===bb===
13486 ====bba====
13487 xxx
13488
13489 ==c==
13490 ===ca===
13491 !!end
13492
13493 !! test
13494 Section replacement test (section 9)
13495 !! options
13496 replace=9,"xxx"
13497 !! input
13498 start
13499 ==a==
13500 ===aa===
13501 ====aaa====
13502 ==b==
13503 ===ba===
13504 ===bb===
13505 ====bba====
13506 ===bc===
13507 ==c==
13508 ===ca===
13509 !! result
13510 start
13511 ==a==
13512 ===aa===
13513 ====aaa====
13514 ==b==
13515 ===ba===
13516 ===bb===
13517 ====bba====
13518 ===bc===
13519 xxx
13520 !! end
13521
13522 !! test
13523 Section replacement test (section 10)
13524 !! options
13525 replace=10,"xxx"
13526 !! input
13527 start
13528 ==a==
13529 ===aa===
13530 ====aaa====
13531 ==b==
13532 ===ba===
13533 ===bb===
13534 ====bba====
13535 ===bc===
13536 ==c==
13537 ===ca===
13538 !! result
13539 start
13540 ==a==
13541 ===aa===
13542 ====aaa====
13543 ==b==
13544 ===ba===
13545 ===bb===
13546 ====bba====
13547 ===bc===
13548 ==c==
13549 xxx
13550 !! end
13551
13552 !! test
13553 Section replacement test with initial whitespace (bug 13728)
13554 !! options
13555 replace=2,"xxx"
13556 !! input
13557 Preformatted initial line
13558 ==a==
13559 ===a===
13560 !! result
13561 Preformatted initial line
13562 ==a==
13563 xxx
13564 !! end
13565
13566
13567 !! test
13568 Section extraction, heading followed by pre with 20 spaces (bug 6398)
13569 !! options
13570 section=1
13571 !! input
13572 ==a==
13573 a
13574 !! result
13575 ==a==
13576 a
13577 !! end
13578
13579 !! test
13580 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
13581 !! options
13582 section=1
13583 !! input
13584 ==a==
13585 a
13586 !! result
13587 ==a==
13588 a
13589 !! end
13590
13591
13592 !! test
13593 Section extraction, <pre> around bogus header (bug 10309)
13594 !! options
13595 noxml section=2
13596 !! input
13597 == Section One ==
13598 <pre>
13599 =======
13600 </pre>
13601
13602 == Section Two ==
13603 stuff
13604 !! result
13605 == Section Two ==
13606 stuff
13607 !! end
13608
13609 !! test
13610 Section replacement, <pre> around bogus header (bug 10309)
13611 !! options
13612 noxml replace=2,"xxx"
13613 !! input
13614 == Section One ==
13615 <pre>
13616 =======
13617 </pre>
13618
13619 == Section Two ==
13620 stuff
13621 !! result
13622 == Section One ==
13623 <pre>
13624 =======
13625 </pre>
13626
13627 xxx
13628 !! end
13629
13630
13631
13632 !! test
13633 Handling of &#x0A; in URLs
13634 !! input
13635 **irc://&#x0A;a
13636 !! result
13637 <ul>
13638 <li><ul>
13639 <li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
13640 </li>
13641 </ul>
13642 </li>
13643 </ul>
13644
13645 !!end
13646
13647 !! test
13648 5 quotes, code coverage +1 line (php)
13649 !! options
13650 php
13651 !! input
13652 '''''
13653 !! result
13654 !! end
13655 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
13656 !! test
13657 5 quotes, code coverage +1 line (parsoid)
13658 !! options
13659 parsoid
13660 !! input
13661 '''''
13662 !! result
13663 <p><b><i></i></b></p>
13664 !! end
13665
13666 !! test
13667 Special:Search page linking.
13668 !! input
13669 {{Special:search}}
13670 !! result
13671 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
13672 </p>
13673 !! end
13674
13675 !! test
13676 Say the magic word
13677 !! options
13678 title=[[Parser test]]
13679 !! input
13680 * {{PAGENAME}}
13681 * {{PAGENAMEE}}
13682 * {{FULLPAGENAME}}
13683 * {{FULLPAGENAMEE}}
13684 * {{BASEPAGENAME}}
13685 * {{BASEPAGENAMEE}}
13686 * {{SUBPAGENAME}}
13687 * {{SUBPAGENAMEE}}
13688 * {{ROOTPAGENAME}}
13689 * {{ROOTPAGENAMEE}}
13690 * {{TALKPAGENAME}}
13691 * {{TALKPAGENAMEE}}
13692 * {{SUBJECTPAGENAME}}
13693 * {{SUBJECTPAGENAMEE}}
13694 * {{NAMESPACEE}}
13695 * {{NAMESPACE}}
13696 * {{NAMESPACENUMBER}}
13697 * {{TALKSPACE}}
13698 * {{TALKSPACEE}}
13699 * {{SUBJECTSPACE}}
13700 * {{SUBJECTSPACEE}}
13701 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
13702 !! result
13703 <ul>
13704 <li> Parser test
13705 </li>
13706 <li> Parser_test
13707 </li>
13708 <li> Parser test
13709 </li>
13710 <li> Parser_test
13711 </li>
13712 <li> Parser test
13713 </li>
13714 <li> Parser_test
13715 </li>
13716 <li> Parser test
13717 </li>
13718 <li> Parser_test
13719 </li>
13720 <li> Parser test
13721 </li>
13722 <li> Parser_test
13723 </li>
13724 <li> Talk:Parser test
13725 </li>
13726 <li> Talk:Parser_test
13727 </li>
13728 <li> Parser test
13729 </li>
13730 <li> Parser_test
13731 </li>
13732 <li>
13733 </li>
13734 <li>
13735 </li>
13736 <li> 0
13737 </li>
13738 <li> Talk
13739 </li>
13740 <li> Talk
13741 </li>
13742 <li>
13743 </li>
13744 <li>
13745 </li>
13746 <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>
13747 </li>
13748 </ul>
13749
13750 !! end
13751 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
13752
13753 !! test
13754 Gallery
13755 !! input
13756 <gallery>
13757 image1.png |
13758 image2.gif|||||
13759
13760 image3|
13761 image4 |300px| centre
13762 image5.svg| http://///////
13763 [[x|xx]]]]
13764 * image6
13765 </gallery>
13766 !! result
13767 <ul class="gallery mw-gallery-traditional">
13768 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13769 <div class="thumb" style="height: 150px;">Image1.png</div>
13770 <div class="gallerytext">
13771 </div>
13772 </div></li>
13773 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13774 <div class="thumb" style="height: 150px;">Image2.gif</div>
13775 <div class="gallerytext">
13776 <p>||||
13777 </p>
13778 </div>
13779 </div></li>
13780 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13781 <div class="thumb" style="height: 150px;">Image3</div>
13782 <div class="gallerytext">
13783 </div>
13784 </div></li>
13785 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13786 <div class="thumb" style="height: 150px;">Image4</div>
13787 <div class="gallerytext">
13788 <p>300px| centre
13789 </p>
13790 </div>
13791 </div></li>
13792 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13793 <div class="thumb" style="height: 150px;">Image5.svg</div>
13794 <div class="gallerytext">
13795 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
13796 </p>
13797 </div>
13798 </div></li>
13799 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13800 <div class="thumb" style="height: 150px;">* image6</div>
13801 <div class="gallerytext">
13802 </div>
13803 </div></li>
13804 </ul>
13805
13806 !! end
13807
13808 !! test
13809 Gallery (with options)
13810 !! input
13811 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
13812 File:Nonexistant.jpg|caption
13813 File:Nonexistant.jpg
13814 image:foobar.jpg|some '''caption''' [[Main Page]]
13815 image:foobar.jpg
13816 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
13817 </gallery>
13818 !! result
13819 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
13820 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
13821 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13822 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
13823 <div class="gallerytext">
13824 <p>caption
13825 </p>
13826 </div>
13827 </div></li>
13828 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13829 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
13830 <div class="gallerytext">
13831 </div>
13832 </div></li>
13833 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13834 <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>
13835 <div class="gallerytext">
13836 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
13837 </p>
13838 </div>
13839 </div></li>
13840 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13841 <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>
13842 <div class="gallerytext">
13843 </div>
13844 </div></li>
13845 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13846 <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>
13847 <div class="gallerytext">
13848 <p>Blabla|blabla.
13849 </p>
13850 </div>
13851 </div></li>
13852 </ul>
13853
13854 !! end
13855
13856 !! test
13857 Gallery with wikitext inside caption
13858 !! input
13859 <gallery>
13860 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
13861 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
13862 </gallery>
13863 !! result
13864 <ul class="gallery mw-gallery-traditional">
13865 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13866 <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>
13867 <div class="gallerytext">
13868 <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>
13869 </p>
13870 </div>
13871 </div></li>
13872 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13873 <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>
13874 <div class="gallerytext">
13875 <p>This is a test template
13876 </p>
13877 </div>
13878 </div></li>
13879 </ul>
13880
13881 !! end
13882
13883 !! test
13884 gallery (with showfilename option)
13885 !! input
13886 <gallery showfilename>
13887 File:Nonexistant.jpg|caption
13888 File:Nonexistant.jpg
13889 image:foobar.jpg|some '''caption''' [[Main Page]]
13890 File:Foobar.jpg
13891 </gallery>
13892 !! result
13893 <ul class="gallery mw-gallery-traditional">
13894 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13895 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13896 <div class="gallerytext">
13897 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
13898 caption
13899 </p>
13900 </div>
13901 </div></li>
13902 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13903 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13904 <div class="gallerytext">
13905 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
13906 </p>
13907 </div>
13908 </div></li>
13909 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13910 <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>
13911 <div class="gallerytext">
13912 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
13913 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
13914 </p>
13915 </div>
13916 </div></li>
13917 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13918 <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>
13919 <div class="gallerytext">
13920 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
13921 </p>
13922 </div>
13923 </div></li>
13924 </ul>
13925
13926 !! end
13927
13928 !! test
13929 Gallery (with namespace-less filenames)
13930 !! input
13931 <gallery>
13932 File:Nonexistant.jpg
13933 Nonexistant.jpg
13934 image:foobar.jpg
13935 foobar.jpg
13936 </gallery>
13937 !! result
13938 <ul class="gallery mw-gallery-traditional">
13939 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13940 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13941 <div class="gallerytext">
13942 </div>
13943 </div></li>
13944 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13945 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13946 <div class="gallerytext">
13947 </div>
13948 </div></li>
13949 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13950 <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>
13951 <div class="gallerytext">
13952 </div>
13953 </div></li>
13954 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13955 <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>
13956 <div class="gallerytext">
13957 </div>
13958 </div></li>
13959 </ul>
13960
13961 !! end
13962
13963 !! test
13964 HTML Hex character encoding (spells the word "JavaScript")
13965 !! input
13966 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
13967 !! result
13968 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
13969 </p>
13970 !! end
13971
13972 !! test
13973 HTML Hex character encoding bogus encoding (bug 26437 regression check)
13974 !! input
13975 &#xsee;&#XSEE;
13976 !! result
13977 <p>&amp;#xsee;&amp;#XSEE;
13978 </p>
13979 !! end
13980
13981 !! test
13982 HTML Hex character encoding mixed case
13983 !! input
13984 &#xEE;&#Xee;
13985 !! result
13986 <p>&#xee;&#xee;
13987 </p>
13988 !! end
13989
13990 !! test
13991 __FORCETOC__ override
13992 !! input
13993 __NEWSECTIONLINK__
13994 __FORCETOC__
13995 !! result
13996 <p><br />
13997 </p>
13998 !! end
13999
14000 !! test
14001 ISBN code coverage
14002 !! input
14003 ISBN 978-0-1234-56&#x20;789
14004 !! result
14005 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
14006 </p>
14007 !! end
14008
14009 !! test
14010 ISBN followed by 5 spaces
14011 !! input
14012 ISBN
14013 !! result
14014 <p>ISBN
14015 </p>
14016 !! end
14017
14018 !! test
14019 Double ISBN
14020 !! input
14021 ISBN ISBN 1234567890
14022 !! result
14023 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
14024 </p>
14025 !! end
14026
14027 !! test
14028 Bug 22905: <abbr> followed by ISBN followed by </a>
14029 !! input
14030 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
14031 !! result
14032 <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>
14033 </p>
14034 !! end
14035
14036 !! test
14037 Double RFC
14038 !! input
14039 RFC RFC 1234
14040 !! result
14041 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
14042 </p>
14043 !! end
14044
14045 !! test
14046 Double RFC with a wiki link
14047 !! input
14048 RFC [[RFC 1234]]
14049 !! result
14050 <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>
14051 </p>
14052 !! end
14053
14054 !! test
14055 RFC code coverage
14056 !! input
14057 RFC 983&#x20;987
14058 !! result
14059 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
14060 </p>
14061 !! end
14062
14063 !! test
14064 Centre-aligned image
14065 !! input
14066 [[Image:foobar.jpg|centre]]
14067 !! result
14068 <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>
14069
14070 !!end
14071
14072 !! test
14073 None-aligned image
14074 !! input
14075 [[Image:foobar.jpg|none]]
14076 !! result
14077 <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>
14078
14079 !!end
14080
14081 !! test
14082 Width + Height sized image (using px) (height is ignored)
14083 !! input
14084 [[Image:foobar.jpg|640x480px]]
14085 !! result
14086 <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>
14087 </p>
14088 !!end
14089
14090 !! test
14091 Width-sized image (using px, no following whitespace)
14092 !! input
14093 [[Image:foobar.jpg|640px]]
14094 !! result
14095 <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>
14096 </p>
14097 !!end
14098
14099 !! test
14100 Width-sized image (using px, with following whitespace - test regression from r39467)
14101 !! input
14102 [[Image:foobar.jpg|640px ]]
14103 !! result
14104 <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>
14105 </p>
14106 !!end
14107
14108 !! test
14109 Width-sized image (using px, with preceding whitespace - test regression from r39467)
14110 !! input
14111 [[Image:foobar.jpg| 640px]]
14112 !! result
14113 <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>
14114 </p>
14115 !!end
14116
14117 !! test
14118 Another italics / bold test
14119 !! input
14120 ''' ''x'
14121 !! result
14122 <pre>'<i> </i>x'
14123 </pre>
14124 !!end
14125
14126 # Note the results may be incorrect, as parserTest output included this:
14127 # XML error: Mismatched tag at byte 6120:
14128 # ...<dd> </dt></dl> </dd...
14129 !! test
14130 dt/dd/dl test
14131 !! options
14132 disabled
14133 !! input
14134 :;;;::
14135 !! result
14136 <dl>
14137 <dd><dl>
14138 <dt><dl>
14139 <dt><dl>
14140 <dt><dl>
14141 <dd><dl>
14142 <dd>
14143 </dd>
14144 </dl>
14145 </dd>
14146 </dl>
14147 </dt>
14148 </dl>
14149 </dt>
14150 </dl>
14151 </dt>
14152 </dl>
14153 </dd>
14154 </dl>
14155
14156 !!end
14157
14158
14159 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
14160 !! test
14161 Images with the "|" character in the comment
14162 !! input
14163 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
14164 !! result
14165 <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>
14166
14167 !!end
14168
14169 !! test
14170 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
14171 !! input
14172 <html><script>alert(1);</script></html>
14173 !! result
14174 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
14175 </p>
14176 !! end
14177
14178 !! test
14179 HTML with raw HTML ($wgRawHtml==true)
14180 !! options
14181 wgRawHtml=1
14182 !! input
14183 <html><script>alert(1);</script></html>
14184 !! result
14185 <p><script>alert(1);</script>
14186 </p>
14187 !! end
14188
14189 !! test
14190 Parents of subpages, one level up
14191 !! options
14192 subpage title=[[Subpage test/L1/L2/L3]]
14193 !! input
14194 [[../|L2]]
14195 !! result
14196 <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>
14197 </p>
14198 !! end
14199
14200
14201 !! test
14202 Parents of subpages, one level up, not named
14203 !! options
14204 subpage title=[[Subpage test/L1/L2/L3]]
14205 !! input
14206 [[../]]
14207 !! result
14208 <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>
14209 </p>
14210 !! end
14211
14212
14213
14214 !! test
14215 Parents of subpages, two levels up
14216 !! options
14217 subpage title=[[Subpage test/L1/L2/L3]]
14218 !! input
14219 [[../../|L1]]2
14220
14221 [[../../|L1]]l
14222 !! result
14223 <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
14224 </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>
14225 </p>
14226 !! end
14227
14228 !! test
14229 Parents of subpages, two levels up, without trailing slash or name.
14230 !! options
14231 subpage title=[[Subpage test/L1/L2/L3]]
14232 !! input
14233 [[../..]]
14234 !! result
14235 <p>[[../..]]
14236 </p>
14237 !! end
14238
14239 !! test
14240 Parents of subpages, two levels up, with lots of extra trailing slashes.
14241 !! options
14242 subpage title=[[Subpage test/L1/L2/L3]]
14243 !! input
14244 [[../../////]]
14245 !! result
14246 <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>
14247 </p>
14248 !! end
14249
14250 !! article
14251 Subpage test/L1/L2/L3Sibling
14252 !! text
14253 Sibling article
14254 !! endarticle
14255
14256 !! test
14257 Transclusion of a sibling page (one level up)
14258 !! options
14259 subpage title=[[Subpage test/L1/L2/L3]]
14260 !! input
14261 {{../L3Sibling}}
14262 !! result
14263 <p>Sibling article
14264 </p>
14265 !! end
14266
14267 !! test
14268 Transclusion of a child page
14269 !! options
14270 subpage title=[[Subpage test/L1/L2]]
14271 !! input
14272 {{/L3Sibling}}
14273 !! result
14274 <p>Sibling article
14275 </p>
14276 !! end
14277
14278 !! test
14279 Non-transclusion because of too many up levels
14280 !! options
14281 subpage title=[[Subpage test/L1/L2/L3]]
14282 !! input
14283 {{../../../../More than parent}}
14284 !! result
14285 <p>{{../../../../More than parent}}
14286 </p>
14287 !! end
14288
14289 !! test
14290 Definition list code coverage
14291 !! input
14292 ; title : def
14293 ; title : def
14294 ;title: def
14295 !! result
14296 <dl>
14297 <dt> title &#160;</dt>
14298 <dd> def
14299 </dd>
14300 <dt> title&#160;</dt>
14301 <dd> def
14302 </dd>
14303 <dt>title</dt>
14304 <dd> def
14305 </dd>
14306 </dl>
14307
14308 !! end
14309
14310 !! test
14311 Don't fall for the self-closing div
14312 !! input
14313 <div>hello world</div/>
14314 !! result
14315 <div>hello world</div>
14316
14317 !! end
14318
14319 !! test
14320 MSGNW magic word
14321 !! input
14322 {{MSGNW:msg}}
14323 !! result
14324 <p>&#91;&#91;:Template:Msg&#93;&#93;
14325 </p>
14326 !! end
14327
14328 !! test
14329 RAW magic word
14330 !! input
14331 {{RAW:QUERTY}}
14332 !! result
14333 <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>
14334 </p>
14335 !! end
14336
14337 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
14338 !! test
14339 Always escape literal '>' in output, not just after '<'
14340 !! input
14341 ><>
14342 !! result
14343 <p>&gt;&lt;&gt;
14344 </p>
14345 !! end
14346
14347 !! test
14348 Template caching
14349 !! input
14350 {{Test}}
14351 {{Test}}
14352 !! result
14353 <p>This is a test template
14354 This is a test template
14355 </p>
14356 !! end
14357
14358
14359 !! article
14360 MediaWiki:Fake
14361 !! text
14362 ==header==
14363 !! endarticle
14364
14365 !! test
14366 Inclusion of !userCanEdit() content
14367 !! input
14368 {{MediaWiki:Fake}}
14369 !! result
14370 <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>
14371
14372 !! end
14373
14374
14375 !! test
14376 Out-of-order TOC heading levels
14377 !! input
14378 ==2==
14379 ======6======
14380 ===3===
14381 =1=
14382 =====5=====
14383 ==2==
14384 !! result
14385 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14386 <ul>
14387 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
14388 <ul>
14389 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
14390 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
14391 </ul>
14392 </li>
14393 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
14394 <ul>
14395 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
14396 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
14397 </ul>
14398 </li>
14399 </ul>
14400 </div>
14401
14402 <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>
14403 <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>
14404 <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>
14405 <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>
14406 <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>
14407 <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>
14408
14409 !! end
14410
14411
14412 !! test
14413 ISBN with a dummy number
14414 !! input
14415 ISBN ---
14416 !! result
14417 <p>ISBN ---
14418 </p>
14419 !! end
14420
14421
14422 !! test
14423 ISBN with space-delimited number
14424 !! input
14425 ISBN 92 9017 032 8
14426 !! result
14427 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
14428 </p>
14429 !! end
14430
14431
14432 !! test
14433 ISBN with multiple spaces, no number
14434 !! input
14435 ISBN foo
14436 !! result
14437 <p>ISBN foo
14438 </p>
14439 !! end
14440
14441
14442 !! test
14443 ISBN length
14444 !! input
14445 ISBN 123456789
14446
14447 ISBN 1234567890
14448
14449 ISBN 12345678901
14450 !! result
14451 <p>ISBN 123456789
14452 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
14453 </p><p>ISBN 12345678901
14454 </p>
14455 !! end
14456
14457
14458 !! test
14459 ISBN with trailing year (bug 8110)
14460 !! input
14461 ISBN 1-234-56789-0 - 2006
14462
14463 ISBN 1 234 56789 0 - 2006
14464 !! result
14465 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
14466 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
14467 </p>
14468 !! end
14469
14470
14471 !! test
14472 anchorencode
14473 !! input
14474 {{anchorencode:foo bar©#%n}}
14475 !! result
14476 <p>foo_bar.C2.A9.23.25n
14477 </p>
14478 !! end
14479
14480 !! test
14481 anchorencode trims spaces
14482 !! input
14483 {{anchorencode: __pretty__please__}}
14484 !! result
14485 <p>pretty_please
14486 </p>
14487 !! end
14488
14489 !! test
14490 anchorencode deals with links
14491 !! input
14492 {{anchorencode: [[hello|world]] [[hi]]}}
14493 !! result
14494 <p>world_hi
14495 </p>
14496 !! end
14497
14498 !! test
14499 anchorencode deals with templates
14500 !! input
14501 {{anchorencode: {{Foo}} }}
14502 !! result
14503 <p>FOO
14504 </p>
14505 !! end
14506
14507 !! test
14508 anchorencode encodes like the TOC generator: (bug 18431)
14509 !! input
14510 === _ +:.3A%3A&&amp;]] ===
14511 {{anchorencode: _ +:.3A%3A&&amp;]] }}
14512 __NOEDITSECTION__
14513 !! result
14514 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
14515 <p>.2B:.3A.253A.26.26.5D.5D
14516 </p>
14517 !! end
14518
14519 !! test
14520 Bug 6200: blockquotes and paragraph formatting
14521 !! input
14522 <blockquote>
14523 foo
14524 </blockquote>
14525
14526 bar
14527
14528 baz
14529 !! result
14530 <blockquote>
14531 <p>foo
14532 </p>
14533 </blockquote>
14534 <p>bar
14535 </p>
14536 <pre>baz
14537 </pre>
14538 !! end
14539
14540 !! test
14541 Bug 8293: Use of center tag ruins paragraph formatting
14542 !! input
14543 <center>
14544 foo
14545 </center>
14546
14547 bar
14548
14549 baz
14550 !! result
14551 <center>
14552 <p>foo
14553 </p>
14554 </center>
14555 <p>bar
14556 </p>
14557 <pre>baz
14558 </pre>
14559 !! end
14560
14561 !!test
14562 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
14563 !!options
14564 php
14565 !!input
14566 <span><s>x</span></s>
14567 !!result
14568 <p><span><s>x&lt;/span&gt;</s></span>
14569 </p>
14570 !!end
14571
14572 !!test
14573 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
14574 !!options
14575 parsoid
14576 !!input
14577 <span><s>x</span></s>
14578 !!result
14579 <p><span><s>x</s></span><s></s>
14580 </p>
14581 !!end
14582
14583 ###
14584 ### Language variants related tests
14585 ###
14586 !! test
14587 Self-link in language variants
14588 !! options
14589 title=[[Dunav]] language=sr
14590 !! input
14591 Both [[Dunav]] and [[Дунав]] are names for this river.
14592 !! result
14593 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
14594 </p>
14595 !!end
14596
14597 !! article
14598 Дуна
14599 !! text
14600 content
14601 !! endarticle
14602
14603 !! test
14604 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
14605 !! options
14606 title=[[Duna]] language=sr
14607 !! input
14608 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
14609 !! result
14610 <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.
14611 </p>
14612 !! end
14613
14614 !! test
14615 Link to a section of a variant of this title shouldn't be parsed as self-link
14616 !! options
14617 title=[[Duna]] language=sr
14618 !! input
14619 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
14620 !! result
14621 <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.
14622 </p>
14623 !! end
14624
14625 !! test
14626 Link to pages in language variants
14627 !! options
14628 language=sr
14629 !! input
14630 Main Page can be written as [[Маин Паге]]
14631 !! result
14632 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
14633 </p>
14634 !!end
14635
14636
14637 !! test
14638 Multiple links to pages in language variants
14639 !! options
14640 language=sr
14641 !! input
14642 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
14643 !! result
14644 <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>.
14645 </p>
14646 !!end
14647
14648
14649 !! test
14650 Simple template in language variants
14651 !! options
14652 language=sr
14653 !! input
14654 {{тест}}
14655 !! result
14656 <p>This is a test template
14657 </p>
14658 !! end
14659
14660
14661 !! test
14662 Template with explicit namespace in language variants
14663 !! options
14664 language=sr
14665 !! input
14666 {{Template:тест}}
14667 !! result
14668 <p>This is a test template
14669 </p>
14670 !! end
14671
14672
14673 !! test
14674 Basic test for template parameter in language variants
14675 !! options
14676 language=sr
14677 !! input
14678 {{парамтест|param=foo}}
14679 !! result
14680 <p>This is a test template with parameter foo
14681 </p>
14682 !! end
14683
14684
14685 !! test
14686 Simple category in language variants
14687 !! options
14688 language=sr cat
14689 !! input
14690 [[Category:МедиаWики Усер'с Гуиде]]
14691 !! result
14692 <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>
14693 !! end
14694
14695
14696 !! article
14697 Category:分类
14698 !! text
14699 blah
14700 !! endarticle
14701
14702 !! article
14703 Category:分類
14704 !! text
14705 blah
14706 !! endarticle
14707
14708 !! test
14709 Don't convert blue categorylinks to another variant (bug 33210)
14710 !! options
14711 language=zh cat
14712 !! input
14713 [[A]][[Category:分类]]
14714 !! result
14715 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
14716 !! end
14717
14718
14719 !! test
14720 Stripping -{}- tags (language variants)
14721 !! options
14722 language=sr
14723 !! input
14724 Latin proverb: -{Ne nuntium necare}-
14725 !! result
14726 <p>Latin proverb: Ne nuntium necare
14727 </p>
14728 !! end
14729
14730
14731 !! test
14732 Prevent conversion with -{}- tags (language variants)
14733 !! options
14734 language=sr variant=sr-ec
14735 !! input
14736 Latinski: -{Ne nuntium necare}-
14737 !! result
14738 <p>Латински: Ne nuntium necare
14739 </p>
14740 !! end
14741
14742
14743 !! test
14744 Prevent conversion of text with -{}- tags (language variants)
14745 !! options
14746 language=sr variant=sr-ec
14747 !! input
14748 Latinski: -{Ne nuntium necare}-
14749 !! result
14750 <p>Латински: Ne nuntium necare
14751 </p>
14752 !! end
14753
14754
14755 !! test
14756 Prevent conversion of links with -{}- tags (language variants)
14757 !! options
14758 language=sr variant=sr-ec
14759 !! input
14760 -{[[Main Page]]}-
14761 !! result
14762 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
14763 </p>
14764 !! end
14765
14766
14767 !! test
14768 -{}- tags within headlines (within html for parserConvert())
14769 !! options
14770 language=sr variant=sr-ec
14771 !! input
14772 == -{Naslov}- ==
14773 !! result
14774 <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>
14775
14776 !! end
14777
14778
14779 !! test
14780 Explicit definition of language variant alternatives
14781 !! options
14782 language=zh variant=zh-tw
14783 !! input
14784 -{zh:China;zh-tw:Taiwan}-, not China
14785 !! result
14786 <p>Taiwan, not China
14787 </p>
14788 !! end
14789
14790
14791 !! test
14792 Conversion around HTML tags
14793 !! options
14794 language=sr variant=sr-ec
14795 !! input
14796 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
14797 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
14798 !! result
14799 <p>
14800 <span title="ЛаCтин">ски</span>
14801 </p>
14802 !! end
14803
14804
14805 !! test
14806 Explicit session-wise language variant mapping (A flag and - flag)
14807 !! options
14808 language=zh variant=zh-tw
14809 !! input
14810 Taiwan is not China.
14811 But -{A|zh:China;zh-tw:Taiwan}- is China,
14812 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
14813 and -{China}- is China.
14814 !! result
14815 <p>Taiwan is not China.
14816 But Taiwan is Taiwan,
14817 (This should be stripped!)
14818 and China is China.
14819 </p>
14820 !! end
14821
14822 !! test
14823 Explicit session-wise language variant mapping (H flag for hide)
14824 !! options
14825 language=zh variant=zh-tw
14826 !! input
14827 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
14828 Taiwan is China.
14829 !! result
14830 <p>(This should be stripped!)
14831 Taiwan is Taiwan.
14832 </p>
14833 !! end
14834
14835 !! test
14836 Adding explicit conversion rule for title (T flag)
14837 !! options
14838 language=zh variant=zh-tw showtitle
14839 !! input
14840 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
14841 !! result
14842 Taiwan
14843 <p>Should be stripped!
14844 </p>
14845 !! end
14846
14847 !! test
14848 Testing that changing the language variant here in the tests actually works
14849 !! options
14850 language=zh variant=zh showtitle
14851 !! input
14852 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
14853 !! result
14854 China
14855 <p>Should be stripped!
14856 </p>
14857 !! end
14858
14859 !! test
14860 Recursive conversion of alt and title attrs shouldn't clear converter state
14861 !! options
14862 language=zh variant=zh-cn showtitle
14863 !! input
14864 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
14865 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
14866 !! result
14867 China
14868 <p>
14869 Should be stripped<span title="Exclamation">!</span>
14870 </p>
14871 !! end
14872
14873 !! test
14874 Bug 24072: more test on conversion rule for title
14875 !! options
14876 language=zh variant=zh-tw showtitle
14877 !! input
14878 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
14879 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
14880 !! result
14881 Taiwan
14882 <p>This should be stripped!
14883 This won't take interferes with the title rule.
14884 </p>
14885 !! end
14886
14887 !! test
14888 Partly disable title conversion if variant == main language code
14889 !! options
14890 language=zh variant=zh title=[[ZH]] showtitle
14891 !! input
14892 -{T|zh-cn:CN;zh-tw:TW}-
14893 !! result
14894 ZH
14895 <p>
14896 </p>
14897 !! end
14898
14899 !! test
14900 Partly disable title conversion if variant == main language code, more
14901 !! options
14902 language=zh variant=zh title=[[ZH]] showtitle
14903 !! input
14904 -{T|TW}-
14905 !! result
14906 ZH
14907 <p>
14908 </p>
14909 !! end
14910
14911 !! test
14912 Raw output of variant escape tags (R flag)
14913 !! options
14914 language=zh variant=zh-tw
14915 !! input
14916 Raw: -{R|zh:China;zh-tw:Taiwan}-
14917 !! result
14918 <p>Raw: zh:China;zh-tw:Taiwan
14919 </p>
14920 !! end
14921
14922 !! test
14923 Nested using of manual convert syntax
14924 !! options
14925 language=zh variant=zh-hk
14926 !! input
14927 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
14928 !! result
14929 <p>Nested: Hello Hong Kong!
14930 </p>
14931 !! end
14932
14933 !! test
14934 Proper conversion of text in external links
14935 !! options
14936 language=sr variant=sr-ec
14937 !! input
14938 http://www.google.com
14939 gopher://www.google.com
14940 [http://www.google.com http://www.google.com]
14941 [gopher://www.google.com gopher://www.google.com]
14942 [https://www.google.com irc://www.google.com]
14943 [ftp://www.google.com www.google.com/ftp://dir]
14944 [//www.google.com www.google.com]
14945 !! result
14946 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
14947 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
14948 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
14949 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
14950 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
14951 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
14952 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
14953 </p>
14954 !! end
14955
14956 !! test
14957 Do not convert roman numbers to language variants
14958 !! options
14959 language=sr variant=sr-ec
14960 !! input
14961 Fridrih IV je car.
14962 !! result
14963 <p>Фридрих IV је цар.
14964 </p>
14965 !! end
14966
14967 !! test
14968 Unclosed language converter markup "-{"
14969 !! options
14970 language=sr
14971 !! input
14972 -{T|hello
14973 !! result
14974 <p>-{T|hello
14975 </p>
14976 !! end
14977
14978 !! test
14979 Don't convert raw rule "-{R|=&gt;}-" to "=>"
14980 !! options
14981 language=sr
14982 !! input
14983 -{R|=&gt;}-
14984 !! result
14985 <p>=&gt;
14986 </p>
14987 !!end
14988
14989 !! test
14990 Don't break link parsing if language converter markup is in the caption.
14991 !! options
14992 language=sr variant=sr-ec
14993 !! input
14994 [[Main Page|-{R|main page}-]]
14995 !! result
14996 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
14997 </p>
14998 !! end
14999
15000 # This test is currently broken in the PHP parser (bug 52661)
15001 !! test
15002 Don't break image parsing if language converter markup is in the caption.
15003 !! options
15004 language=sr
15005 disabled
15006 !! input
15007 [[File:Foobar.jpg|-{R|caption}-]]
15008 !! result
15009 <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>
15010 </p>
15011 !! end
15012
15013 # This test is currently broken in the PHP parser (bug 52661)
15014 !! test
15015 Don't break list handling if language converter markup is in the item.
15016 !! options
15017 language=zh variant=zh-cn
15018 disabled
15019 !! input
15020 ;-{zh-cn:AAA;zh-tw:BBB}-
15021 !! result
15022 <dl><dt>AAA
15023 </dt></dl>
15024
15025 !! end
15026
15027 # This test is currently broken in the PHP parser (bug 52661)
15028 !! test
15029 Don't break table handling if language converter markup is in the cell.
15030 !! options
15031 language=sr variant=sr-ec
15032 disabled
15033 !! input
15034 {|
15035 |-
15036 | -{R|B}-
15037 |}
15038 !! result
15039 <table>
15040
15041 <tr>
15042 <td> B
15043 </td></tr></table>
15044
15045 !! end
15046
15047 !! test
15048 Bug 529: Uncovered bullet
15049 !! input
15050 * Foo {{bullet}}
15051 !! result
15052 <ul>
15053 <li> Foo
15054 </li>
15055 <li> Bar
15056 </li>
15057 </ul>
15058
15059 !! end
15060
15061 # Plain MediaWiki does not remove empty lists, but tidy actually does.
15062 # Templates in Wikipedia rely on this behavior, as tidy has always been
15063 # enabled there. These tests are normally run *without* tidy, so specify the
15064 # full output here.
15065 # To test realistic parsing behavior, apply a tidy-like transformation to both
15066 # the expected output and your parser's output.
15067 !! test
15068 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
15069 !! input
15070 ******* Foo {{bullet}}
15071 !! result
15072 <ul>
15073 <li><ul>
15074 <li><ul>
15075 <li><ul>
15076 <li><ul>
15077 <li><ul>
15078 <li><ul>
15079 <li> Foo
15080 </li>
15081 </ul>
15082 </li>
15083 </ul>
15084 </li>
15085 </ul>
15086 </li>
15087 </ul>
15088 </li>
15089 </ul>
15090 </li>
15091 </ul>
15092 </li>
15093 <li> Bar
15094 </li>
15095 </ul>
15096
15097 !! end
15098
15099 !! test
15100 Bug 529: Uncovered table already at line-start
15101 !! input
15102 x
15103
15104 {{table}}
15105 y
15106 !! result
15107 <p>x
15108 </p>
15109 <table>
15110 <tr>
15111 <td> 1 </td>
15112 <td> 2
15113 </td></tr>
15114 <tr>
15115 <td> 3 </td>
15116 <td> 4
15117 </td></tr></table>
15118 <p>y
15119 </p>
15120 !! end
15121
15122 !! test
15123 Bug 529: Uncovered bullet in parser function result
15124 !! input
15125 * Foo {{lc:{{bullet}} }}
15126 !! result
15127 <ul>
15128 <li> Foo
15129 </li>
15130 <li> bar
15131 </li>
15132 </ul>
15133
15134 !! end
15135
15136 !! test
15137 Bug 5678: Double-parsed template argument
15138 !! input
15139 {{lc:{{{1}}}|hello}}
15140 !! result
15141 <p>{{{1}}}
15142 </p>
15143 !! end
15144
15145 !! test
15146 Bug 5678: Double-parsed template invocation
15147 !! input
15148 {{lc:{{paramtest {{!}} param = hello }} }}
15149 !! result
15150 <p>{{paramtest | param = hello }}
15151 </p>
15152 !! end
15153
15154 !! test
15155 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
15156 !! options
15157 language=cs
15158 title=[[Main Page]]
15159 !! input
15160 {{PRVNÍVELKÉ:ěščř}}
15161 {{prvnívelké:ěščř}}
15162 {{PRVNÍMALÉ:ěščř}}
15163 {{prvnímalé:ěščř}}
15164 {{MALÁ:ěščř}}
15165 {{malá:ěščř}}
15166 {{VELKÁ:ěščř}}
15167 {{velká:ěščř}}
15168 !! result
15169 <p>Ěščř
15170 Ěščř
15171 ěščř
15172 ěščř
15173 ěščř
15174 ěščř
15175 ĚŠČŘ
15176 ĚŠČŘ
15177 </p>
15178 !! end
15179
15180 !! test
15181 Morwen/13: Unclosed link followed by heading
15182 !! input
15183 [[link
15184 ==heading==
15185 !! result
15186 <p>[[link
15187 </p>
15188 <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>
15189
15190 !! end
15191
15192 !! test
15193 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
15194 !! input
15195 {{foo|
15196 =heading=
15197 !! result
15198 <p>{{foo|
15199 </p>
15200 <h1><span class="mw-headline" id="heading">heading</span></h1>
15201
15202 !! end
15203
15204 !! test
15205 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
15206 !! input
15207 {{foo|
15208 ==heading==
15209 !! result
15210 <p>{{foo|
15211 </p>
15212 <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>
15213
15214 !! end
15215
15216 !! test
15217 Tildes in comments
15218 !! options
15219 pst
15220 !! input
15221 <!-- ~~~~ -->
15222 !! result
15223 <!-- ~~~~ -->
15224 !! end
15225
15226 !! test
15227 Paragraphs inside divs (no extra line breaks)
15228 !! input
15229 <div>Line one
15230
15231 Line two</div>
15232 !! result
15233 <div>Line one
15234 Line two</div>
15235
15236 !! end
15237
15238 !! test
15239 Paragraphs inside divs (extra line break on open)
15240 !! input
15241 <div>
15242 Line one
15243
15244 Line two</div>
15245 !! result
15246 <div>
15247 <p>Line one
15248 </p>
15249 Line two</div>
15250
15251 !! end
15252
15253 !! test
15254 Paragraphs inside divs (extra line break on close)
15255 !! input
15256 <div>Line one
15257
15258 Line two
15259 </div>
15260 !! result
15261 <div>Line one
15262 <p>Line two
15263 </p>
15264 </div>
15265
15266 !! end
15267
15268 !! test
15269 Paragraphs inside divs (extra line break on open and close)
15270 !! input
15271 <div>
15272 Line one
15273
15274 Line two
15275 </div>
15276 !! result
15277 <div>
15278 <p>Line one
15279 </p><p>Line two
15280 </p>
15281 </div>
15282
15283 !! end
15284
15285 !! test
15286 Nesting tags, paragraphs on lines which begin with <div>
15287 !! options
15288 disabled
15289 !! input
15290 <div></div><strong>A
15291 B</strong>
15292 !! result
15293 <div></div>
15294 <p><strong>A
15295 B</strong>
15296 </p>
15297 !! end
15298
15299 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
15300 !! test
15301 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
15302 !! input
15303 <blockquote>Line one
15304
15305 Line two</blockquote>
15306 !! result
15307 <blockquote>Line one
15308 Line two</blockquote>
15309
15310 !! end
15311
15312 !! test
15313 Bug 6200: paragraphs inside blockquotes (extra line break on open)
15314 !! input
15315 <blockquote>
15316 Line one
15317
15318 Line two</blockquote>
15319 !! result
15320 <blockquote>
15321 <p>Line one
15322 </p>
15323 Line two</blockquote>
15324
15325 !! end
15326
15327 !! test
15328 Bug 6200: paragraphs inside blockquotes (extra line break on close)
15329 !! input
15330 <blockquote>Line one
15331
15332 Line two
15333 </blockquote>
15334 !! result
15335 <blockquote>Line one
15336 <p>Line two
15337 </p>
15338 </blockquote>
15339
15340 !! end
15341
15342 !! test
15343 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
15344 !! input
15345 <blockquote>
15346 Line one
15347
15348 Line two
15349 </blockquote>
15350 !! result
15351 <blockquote>
15352 <p>Line one
15353 </p><p>Line two
15354 </p>
15355 </blockquote>
15356
15357 !! end
15358
15359 !! test
15360 Paragraphs inside blockquotes/divs (no extra line breaks)
15361 !! input
15362 <blockquote><div>Line one
15363
15364 Line two</div></blockquote>
15365 !! result
15366 <blockquote><div>Line one
15367 Line two</div></blockquote>
15368
15369 !! end
15370
15371 !! test
15372 Paragraphs inside blockquotes/divs (extra line break on open)
15373 !! input
15374 <blockquote><div>
15375 Line one
15376
15377 Line two</div></blockquote>
15378 !! result
15379 <blockquote><div>
15380 <p>Line one
15381 </p>
15382 Line two</div></blockquote>
15383
15384 !! end
15385
15386 !! test
15387 Paragraphs inside blockquotes/divs (extra line break on close)
15388 !! input
15389 <blockquote><div>Line one
15390
15391 Line two
15392 </div></blockquote>
15393 !! result
15394 <blockquote><div>Line one
15395 <p>Line two
15396 </p>
15397 </div></blockquote>
15398
15399 !! end
15400
15401 !! test
15402 Paragraphs inside blockquotes/divs (extra line break on open and close)
15403 !! input
15404 <blockquote><div>
15405 Line one
15406
15407 Line two
15408 </div></blockquote>
15409 !! result
15410 <blockquote><div>
15411 <p>Line one
15412 </p><p>Line two
15413 </p>
15414 </div></blockquote>
15415
15416 !! end
15417
15418 !! test
15419 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
15420 !! options
15421 wgLinkHolderBatchSize=0
15422 !! input
15423 [[meatball:1]]
15424 [[meatball:2]]
15425 [[meatball:3]]
15426 !! result
15427 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
15428 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
15429 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
15430 </p>
15431 !! end
15432
15433 !! test
15434 Free external link invading image caption
15435 !! input
15436 [[Image:Foobar.jpg|thumb|http://x|hello]]
15437 !! result
15438 <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>
15439
15440 !! end
15441
15442 !! test
15443 Bug 15196: localised external link numbers
15444 !! options
15445 language=fa
15446 !! input
15447 [http://en.wikipedia.org/]
15448 !! result
15449 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
15450 </p>
15451 !! end
15452
15453 !! test
15454 Multibyte character in padleft
15455 !! input
15456 {{padleft:-Hello|7|Æ}}
15457 !! result
15458 <p>Æ-Hello
15459 </p>
15460 !! end
15461
15462 !! test
15463 Multibyte character in padright
15464 !! input
15465 {{padright:Hello-|7|Æ}}
15466 !! result
15467 <p>Hello-Æ
15468 </p>
15469 !! end
15470
15471 !!test
15472 formatdate parser function
15473 !!input
15474 {{#formatdate:2009-03-24}}
15475 !! result
15476 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
15477 </p>
15478 !! end
15479
15480 !!test
15481 formatdate parser function, with default format
15482 !!input
15483 {{#formatdate:2009-03-24|mdy}}
15484 !! result
15485 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
15486 </p>
15487 !! end
15488
15489 !! test
15490 Spacing of numbers in formatted dates
15491 !! input
15492 {{#formatdate:January 15}}
15493 !! result
15494 <p><span class="mw-formatted-date" title="01-15">January 15</span>
15495 </p>
15496 !! end
15497
15498 !! test
15499 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
15500 !! options
15501 language=nl title=[[MediaWiki:Common.css]]
15502 !! input
15503 {{#formatdate:2009-03-24|dmy}}
15504 !! result
15505 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
15506 </p>
15507 !! end
15508
15509 #
15510 #
15511 #
15512
15513 #
15514 # Edit comments
15515 #
15516
15517 !! test
15518 Edit comment with link
15519 !! options
15520 comment
15521 !! input
15522 I like the [[Main Page]] a lot
15523 !! result
15524 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
15525 !!end
15526
15527 !! test
15528 Edit comment with link and link text
15529 !! options
15530 comment
15531 !! input
15532 I like the [[Main Page|best pages]] a lot
15533 !! result
15534 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
15535 !!end
15536
15537 !! test
15538 Edit comment with link and link text with suffix
15539 !! options
15540 comment
15541 !! input
15542 I like the [[Main Page|best page]]s a lot
15543 !! result
15544 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
15545 !!end
15546
15547 !! test
15548 Edit comment with section link (non-local, eg in history list)
15549 !! options
15550 comment title=[[Main Page]]
15551 !! input
15552 /* External links */ removed bogus entries
15553 !! result
15554 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
15555 !!end
15556
15557 !! test
15558 Edit comment with section link and text before it (non-local, eg in history list)
15559 !! options
15560 comment title=[[Main Page]]
15561 !! input
15562 pre-comment text /* External links */ removed bogus entries
15563 !! result
15564 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>
15565 !!end
15566
15567 !! test
15568 Edit comment with section link (local, eg in diff view)
15569 !! options
15570 comment local title=[[Main Page]]
15571 !! input
15572 /* External links */ removed bogus entries
15573 !! result
15574 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
15575 !!end
15576
15577 !! test
15578 Edit comment with subpage link (bug 14080)
15579 !! options
15580 comment
15581 subpage
15582 title=[[Subpage test]]
15583 !! input
15584 Poked at a [[/subpage]] here...
15585 !! result
15586 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
15587 !!end
15588
15589 !! test
15590 Edit comment with subpage link and link text (bug 14080)
15591 !! options
15592 comment
15593 subpage
15594 title=[[Subpage test]]
15595 !! input
15596 Poked at a [[/subpage|neat little page]] here...
15597 !! result
15598 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
15599 !!end
15600
15601 !! test
15602 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
15603 !! options
15604 comment
15605 title=[[Subpage test]]
15606 !! input
15607 Poked at a [[/subpage]] here...
15608 !! result
15609 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...
15610 !!end
15611
15612 !! test
15613 Edit comment with bare anchor link (local, as on diff)
15614 !! options
15615 comment
15616 local
15617 title=[[Main Page]]
15618 !!input
15619 [[#section]]
15620 !! result
15621 <a href="#section">#section</a>
15622 !! end
15623
15624 !! test
15625 Edit comment with bare anchor link (non-local, as on history)
15626 !! options
15627 comment
15628 title=[[Main Page]]
15629 !!input
15630 [[#section]]
15631 !! result
15632 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
15633 !! end
15634
15635 !! test
15636 Anchor starting with underscore
15637 !!input
15638 [[#_ref|One]]
15639 !! result
15640 <p><a href="#_ref">One</a>
15641 </p>
15642 !! end
15643
15644 !! test
15645 Id starting with underscore
15646 !!input
15647 <div id="_ref"></div>
15648 !! result
15649 <div id="_ref"></div>
15650
15651 !! end
15652
15653 !! test
15654 Space normalisation on autocomment (bug 22784)
15655 !! options
15656 comment
15657 title=[[Main Page]]
15658 !!input
15659 /* __hello__world__ */
15660 !! result
15661 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
15662 !! end
15663
15664 !! test
15665 percent-encoding and + signs in comments (Bug 26410)
15666 !! options
15667 comment
15668 !!input
15669 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
15670 !! result
15671 <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>
15672 !! end
15673
15674 !! test
15675 Bad images - basic functionality
15676 !! options
15677 disabled
15678 !! input
15679 [[File:Bad.jpg]]
15680 !! result
15681 !! end
15682
15683 !! test
15684 Bad images - bug 16039: text after bad image disappears
15685 !! options
15686 disabled
15687 !! input
15688 Foo bar
15689 [[File:Bad.jpg]]
15690 Bar foo
15691 !! result
15692 <p>Foo bar
15693 </p><p>Bar foo
15694 </p>
15695 !! end
15696
15697 !! test
15698 Verify that displaytitle works (bug #22501) no displaytitle
15699 !! options
15700 showtitle
15701 !! config
15702 wgAllowDisplayTitle=true
15703 wgRestrictDisplayTitle=false
15704 !! input
15705 this is not the the title
15706 !! result
15707 Parser test
15708 <p>this is not the the title
15709 </p>
15710 !! end
15711
15712 !! test
15713 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
15714 !! options
15715 showtitle
15716 title=[[Screen]]
15717 !! config
15718 wgAllowDisplayTitle=true
15719 wgRestrictDisplayTitle=false
15720 !! input
15721 this is not the the title
15722 {{DISPLAYTITLE:whatever}}
15723 !! result
15724 whatever
15725 <p>this is not the the title
15726 </p>
15727 !! end
15728
15729 !! test
15730 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
15731 !! options
15732 showtitle
15733 title=[[Screen]]
15734 !! config
15735 wgAllowDisplayTitle=true
15736 wgRestrictDisplayTitle=true
15737 !! input
15738 this is not the the title
15739 {{DISPLAYTITLE:whatever}}
15740 !! result
15741 Screen
15742 <p>this is not the the title
15743 </p>
15744 !! end
15745
15746 !! test
15747 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
15748 !! options
15749 showtitle
15750 title=[[Screen]]
15751 !! config
15752 wgAllowDisplayTitle=true
15753 wgRestrictDisplayTitle=true
15754 !! input
15755 this is not the the title
15756 {{DISPLAYTITLE:screen}}
15757 !! result
15758 screen
15759 <p>this is not the the title
15760 </p>
15761 !! end
15762
15763 !! test
15764 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
15765 !! options
15766 showtitle
15767 title=[[Screen]]
15768 !! config
15769 wgAllowDisplayTitle=false
15770 !! input
15771 this is not the the title
15772 {{DISPLAYTITLE:screen}}
15773 !! result
15774 Screen
15775 <p>this is not the the title
15776 <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>
15777 </p>
15778 !! end
15779
15780 !! test
15781 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
15782 !! options
15783 showtitle
15784 title=[[Screen]]
15785 !! config
15786 wgAllowDisplayTitle=false
15787 !! input
15788 this is not the the title
15789 !! result
15790 Screen
15791 <p>this is not the the title
15792 </p>
15793 !! end
15794
15795 !! test
15796 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
15797 !! options
15798 showtitle
15799 title=[[Screen]]
15800 !! config
15801 wgAllowDisplayTitle=true
15802 wgRestrictDisplayTitle=true
15803 !! input
15804 this is not the the title
15805 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
15806 !! result
15807 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
15808 <p>this is not the the title
15809 </p>
15810 !! end
15811
15812 !! test
15813 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
15814 !! options
15815 showtitle
15816 title=[[Screen]]
15817 !! config
15818 wgAllowDisplayTitle=true
15819 wgRestrictDisplayTitle=true
15820 !! input
15821 this is not the the title
15822 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
15823 !! result
15824 <span style="color: red;">s</span>creen
15825 <p>this is not the the title
15826 </p>
15827 !! end
15828
15829 !! test
15830 preload: check <noinclude> and <includeonly>
15831 !! options
15832 preload
15833 !! input
15834 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
15835 !! result
15836 Hello kind world.
15837 !! end
15838
15839 !! test
15840 preload: check <onlyinclude>
15841 !! options
15842 preload
15843 !! input
15844 Goodbye <onlyinclude>Hello world</onlyinclude>
15845 !! result
15846 Hello world
15847 !! end
15848
15849 !! test
15850 preload: can pass tags through if we want to
15851 !! options
15852 preload
15853 !! input
15854 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
15855 !! result
15856 <includeonly>Hello world</includeonly>
15857 !! end
15858
15859 !! test
15860 preload: check that it doesn't try to do tricks
15861 !! options
15862 preload
15863 !! input
15864 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
15865 !! result
15866 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
15867 !! end
15868
15869 !! test
15870 Play a bit with r67090 and bug 3158
15871 !! options
15872 disabled
15873 !! input
15874 <div style="width:50% !important">&nbsp;</div>
15875 <div style="width:50%&nbsp;!important">&nbsp;</div>
15876 <div style="width:50%&#160;!important">&nbsp;</div>
15877 <div style="border : solid;">&nbsp;</div>
15878 !! result
15879 <div style="width:50% !important">&nbsp;</div>
15880 <div style="width:50% !important">&nbsp;</div>
15881 <div style="width:50% !important">&nbsp;</div>
15882 <div style="border&#160;: solid;">&nbsp;</div>
15883
15884 !! end
15885
15886 !! test
15887 HTML5 data attributes
15888 !! input
15889 <span data-foo="bar">Baz</span>
15890 <p data-abc-def_hij="">Quuz</p>
15891 !! result
15892 <p><span data-foo="bar">Baz</span>
15893 </p>
15894 <p data-abc-def_hij="">Quuz</p>
15895
15896 !! end
15897
15898 !! test
15899 percent-encoding and + signs in internal links (Bug 26410)
15900 !! input
15901 [[User:+%]] [[Page+title%]]
15902 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
15903 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
15904 [[%33%45]] [[%33%45+]]
15905 !! result
15906 <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>
15907 <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>
15908 <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>
15909 <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>
15910 </p>
15911 !! end
15912
15913 !! test
15914 Special characters in embedded file links (bug 27679)
15915 !! input
15916 [[File:Contains & ampersand.jpg]]
15917 [[File:Does not exist.jpg|Title with & ampersand]]
15918 !! result
15919 <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>
15920 <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>
15921 </p>
15922 !! end
15923
15924
15925 !! test
15926 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
15927 !! input
15928 Text&apos;s been normalized?
15929 !! result
15930 <p>Text&#39;s been normalized?
15931 </p>
15932 !! end
15933
15934 !! test
15935 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
15936 !! input
15937 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
15938 !! result
15939 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
15940 </p>
15941 !! end
15942
15943 !! test
15944 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
15945 !! input
15946 [http://www.example.org/ ideograms]
15947 !! result
15948 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
15949 </p>
15950 !! end
15951
15952 !! test
15953 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
15954 !! input
15955 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
15956 !! result
15957 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
15958 </p>
15959 !! end
15960
15961 !! article
15962 Mediawiki:loop1
15963 !! text
15964 {{Identical|A}}
15965 !! endarticle
15966
15967 !! article
15968 Mediawiki:loop2
15969 !! text
15970 {{Identical|B}}
15971 !! endarticle
15972
15973 !! article
15974 Template:Identical
15975 !! text
15976 {{int:loop1}}
15977 {{int:loop2}}
15978 !! endarticle
15979
15980 !! test
15981 Bug 31098 Template which includes system messages which includes the template
15982 !! input
15983 {{Identical}}
15984 !! result
15985 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
15986 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
15987 </p>
15988 !! end
15989
15990 !! test
15991 Bug31490 Turkish: ucfirst 'blah'
15992 !! options
15993 language=tr
15994 !! input
15995 {{ucfirst:blah}}
15996 !! result
15997 <p>Blah
15998 </p>
15999 !! end
16000
16001 !! test
16002 Bug31490 Turkish: ucfirst 'ix'
16003 !! options
16004 language=tr
16005 !! input
16006 {{ucfirst:ix}}
16007 !! result
16008 <p>İx
16009 </p>
16010 !! end
16011
16012 !! test
16013 Bug31490 Turkish: lcfirst 'BLAH'
16014 !! options
16015 language=tr
16016 !! input
16017 {{lcfirst:BLAH}}
16018 !! result
16019 <p>bLAH
16020 </p>
16021 !! end
16022
16023 !! test
16024 Bug31490 Turkish: ucfırst (with a dotless i)
16025 !! options
16026 language=tr
16027 !! input
16028 {{ucfırst:blah}}
16029 !! result
16030 <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>
16031 </p>
16032 !! end
16033
16034 !! test
16035 Bug31490 ucfırst (with a dotless i) with English language
16036 !! options
16037 language=en
16038 !! input
16039 {{ucfırst:blah}}
16040 !! result
16041 <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>
16042 </p>
16043 !! end
16044
16045 !! test
16046 Bug 26375: TOC with italics
16047 !! options
16048 title=[[Main Page]]
16049 !! input
16050 __TOC__
16051 == ''Lost'' episodes ==
16052 !! result
16053 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16054 <ul>
16055 <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>
16056 </ul>
16057 </div>
16058
16059 <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>
16060
16061 !! end
16062
16063 !! test
16064 Bug 26375: TOC with bold
16065 !! options
16066 title=[[Main Page]]
16067 !! input
16068 __TOC__
16069 == '''should be bold''' then normal text ==
16070 !! result
16071 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16072 <ul>
16073 <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>
16074 </ul>
16075 </div>
16076
16077 <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>
16078
16079 !! end
16080
16081 !! test
16082 Bug 33845: Headings become cursive in TOC when they contain an image
16083 !! options
16084 title=[[Main Page]]
16085 !! input
16086 __TOC__
16087 == Image [[Image:foobar.jpg]] ==
16088 !! result
16089 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16090 <ul>
16091 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
16092 </ul>
16093 </div>
16094
16095 <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>
16096
16097 !! end
16098
16099 !! test
16100 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
16101 !! options
16102 title=[[Main Page]]
16103 !! input
16104 __TOC__
16105 == <blockquote>Quote</blockquote> ==
16106 !! result
16107 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16108 <ul>
16109 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
16110 </ul>
16111 </div>
16112
16113 <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>
16114
16115 !! end
16116
16117 !! test
16118 Unclosed tags in TOC
16119 !! options
16120 title=[[Main Page]]
16121 !! input
16122 __TOC__
16123 == Proof: 2 < 3 ==
16124 <small>Hanc marginis exiguitas non caperet.</small>
16125 QED
16126 !! result
16127 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16128 <ul>
16129 <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>
16130 </ul>
16131 </div>
16132
16133 <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>
16134 <p><small>Hanc marginis exiguitas non caperet.</small>
16135 QED
16136 </p>
16137 !! end
16138
16139 !! test
16140 Multiple tags in TOC
16141 !! input
16142 __TOC__
16143 == <i>Foo</i> <b>Bar</b> ==
16144
16145 == <i>Foo</i> <blockquote>Bar</blockquote> ==
16146 !! result
16147 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16148 <ul>
16149 <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>
16150 <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>
16151 </ul>
16152 </div>
16153
16154 <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>
16155 <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>
16156
16157 !! end
16158
16159 !! test
16160 Tags with parameters in TOC
16161 !! input
16162 __TOC__
16163 == <sup class="in-h2">Hello</sup> ==
16164
16165 == <sup class="a > b">Evilbye</sup> ==
16166 !! result
16167 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16168 <ul>
16169 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
16170 <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>
16171 </ul>
16172 </div>
16173
16174 <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>
16175 <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>
16176
16177 !! end
16178
16179 !! test
16180 span tags with directionality in TOC
16181 !! input
16182 __TOC__
16183 == <span dir="ltr">C++</span> ==
16184
16185 == <span dir="rtl">זבנג!</span> ==
16186
16187 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
16188
16189 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
16190
16191 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
16192 !! result
16193 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16194 <ul>
16195 <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>
16196 <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>
16197 <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>
16198 <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>
16199 <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>
16200 </ul>
16201 </div>
16202
16203 <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>
16204 <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>
16205 <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>
16206 <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>
16207 <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>
16208
16209 !! end
16210
16211 !! article
16212 MediaWiki:Bug32057
16213 !! text
16214 == {{int:headline_sample}} ==
16215 !! endarticle
16216
16217 !! test
16218 Bug 32057: Title needed when expanding <h> nodes.
16219 !! options
16220 title=[[Main Page]]
16221 !! input
16222 {{int:Bug32057}}
16223 !! result
16224 <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>
16225
16226 !! end
16227
16228 !! test
16229 Strip marker in urlencode
16230 !! input
16231 {{urlencode:x<nowiki/>y}}
16232 {{urlencode:x<nowiki/>y|wiki}}
16233 {{urlencode:x<nowiki/>y|path}}
16234 !! result
16235 <p>xy
16236 xy
16237 xy
16238 </p>
16239 !! end
16240
16241 !! test
16242 Strip marker in lc
16243 !! input
16244 {{lc:x<nowiki/>y}}
16245 !! result
16246 <p>xy
16247 </p>
16248 !! end
16249
16250 !! test
16251 Strip marker in uc
16252 !! input
16253 {{uc:x<nowiki/>y}}
16254 !! result
16255 <p>XY
16256 </p>
16257 !! end
16258
16259 !! test
16260 Strip marker in formatNum
16261 !! input
16262 {{formatnum:1<nowiki/>2}}
16263 {{formatnum:1<nowiki/>2|R}}
16264 !! result
16265 <p>12
16266 12
16267 </p>
16268 !! end
16269
16270 !! test
16271 Check noCommafy in formatNum
16272 !! options
16273 language=be-tarask
16274 !! input
16275 {{formatnum:123456.78}}
16276 {{formatnum:123456.78|NOSEP}}
16277 !! result
16278 <p>123 456,78
16279 123456.78
16280 </p>
16281 !! end
16282
16283 !! test
16284 Strip marker in grammar
16285 !! options
16286 language=fi
16287 !! input
16288 {{grammar:elative|foo<nowiki/>bar}}
16289 !! result
16290 <p>foobarista
16291 </p>
16292 !! end
16293
16294 !! test
16295 Strip marker in padleft
16296 !! input
16297 {{padleft:|2|x<nowiki/>y}}
16298 !! result
16299 <p>xy
16300 </p>
16301 !! end
16302
16303 !! test
16304 Strip marker in padright
16305 !! input
16306 {{padright:|2|x<nowiki/>y}}
16307 !! result
16308 <p>xy
16309 </p>
16310 !! end
16311
16312 !! test
16313 Strip marker in anchorencode
16314 !! input
16315 {{anchorencode:x<nowiki/>y}}
16316 !! result
16317 <p>xy
16318 </p>
16319 !! end
16320
16321 !! test
16322 nowiki inside link inside heading (bug 18295)
16323 !! input
16324 ==[[foo|x<nowiki>y</nowiki>z]]==
16325 !! result
16326 <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>
16327
16328 !! end
16329
16330 !! test
16331 new support for bdi element (bug 31817)
16332 !! input
16333 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
16334 !! result
16335 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
16336
16337 !!end
16338
16339 !! test
16340 Ignore pipe between table row attributes
16341 !! input
16342 {|
16343 | quux
16344 |- id=foo | style='color: red'
16345 | bar
16346 |}
16347 !! result
16348 <table>
16349 <tr>
16350 <td> quux
16351 </td></tr>
16352 <tr id="foo" style="color: red">
16353 <td> bar
16354 </td></tr></table>
16355
16356 !! end
16357
16358 !!test
16359 Gallery override link with WikiLink (bug 34852)
16360 !! input
16361 <gallery>
16362 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
16363 </gallery>
16364 !! result
16365 <ul class="gallery mw-gallery-traditional">
16366 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16367 <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>
16368 <div class="gallerytext">
16369 <p>caption
16370 </p>
16371 </div>
16372 </div></li>
16373 </ul>
16374
16375 !! end
16376
16377 !!test
16378 Gallery override link with absolute external link (bug 34852)
16379 !! input
16380 <gallery>
16381 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
16382 </gallery>
16383 !! result
16384 <ul class="gallery mw-gallery-traditional">
16385 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16386 <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>
16387 <div class="gallerytext">
16388 <p>caption
16389 </p>
16390 </div>
16391 </div></li>
16392 </ul>
16393
16394 !! end
16395
16396 !!test
16397 Gallery override link with malicious javascript (bug 34852)
16398 !! input
16399 <gallery>
16400 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
16401 </gallery>
16402 !! result
16403 <ul class="gallery mw-gallery-traditional">
16404 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16405 <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>
16406 <div class="gallerytext">
16407 <p>caption
16408 </p>
16409 </div>
16410 </div></li>
16411 </ul>
16412
16413 !! end
16414
16415 !!test
16416 Gallery with invalid title as link (bug 43964)
16417 !! input
16418 <gallery>
16419 File:foobar.jpg|link=<
16420 </gallery>
16421 !! result
16422 <ul class="gallery mw-gallery-traditional">
16423 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16424 <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>
16425 <div class="gallerytext">
16426 </div>
16427 </div></li>
16428 </ul>
16429
16430 !! end
16431
16432 !!test
16433 Language parser function
16434 !! input
16435 {{#language:ar}}
16436 !! result
16437 <p>العربية
16438 </p>
16439 !! end
16440
16441 !!test
16442 Padleft and padright as substr
16443 !! input
16444 {{padleft:|3|abcde}}
16445 {{padright:|3|abcde}}
16446 !! result
16447 <p>abc
16448 abc
16449 </p>
16450 !! end
16451
16452 !!test
16453 Special parser function
16454 !! input
16455 {{#special:RandomPage}}
16456 {{#special:BaDtItLe}}
16457 {{#special:Foobar}}
16458 !! result
16459 <p>Special:Random
16460 Special:Badtitle
16461 Special:Foobar
16462 </p>
16463 !! end
16464
16465 !!test
16466 Bug 34939 - Case insensitive link parsing ([HttP://])
16467 !! input
16468 [HttP://MediaWiki.Org/]
16469 !! result
16470 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
16471 </p>
16472 !! end
16473
16474 !!test
16475 Bug 34939 - Case insensitive link parsing ([HttP:// title])
16476 !! input
16477 [HttP://MediaWiki.Org/ MediaWiki]
16478 !! result
16479 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
16480 </p>
16481 !! end
16482
16483 !!test
16484 Bug 34939 - Case insensitive link parsing (HttP://)
16485 !! input
16486 HttP://MediaWiki.Org/
16487 !! result
16488 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
16489 </p>
16490 !! end
16491
16492 !!test
16493 Disable TOC
16494 !! options
16495 notoc
16496 !! input
16497 Lead
16498 == Section 1 ==
16499 == Section 2 ==
16500 == Section 3 ==
16501 == Section 4 ==
16502 == Section 5 ==
16503 !! result
16504 <p>Lead
16505 </p>
16506
16507 <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>
16508 <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>
16509 <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>
16510 <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>
16511 <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>
16512
16513 !! end
16514
16515
16516 ###
16517 ### Parsoids-specific tests
16518 ### Parsoid-PHP parser incompatibilities
16519 ###
16520 !!test
16521 1. SOL-sensitive wikitext tokens as template-args
16522 !!options
16523 parsoid=wt2html,wt2wt
16524 !!input
16525 {{echo|*a}}
16526 {{echo|#a}}
16527 {{echo|:a}}
16528 !!result
16529 <span about="#mwt1" typeof="mw:Transclusion">
16530 </span><ul about="#mwt1"><li>a</li>
16531 </ul>
16532 <span about="#mwt2" typeof="mw:Transclusion">
16533 </span><ol about="#mwt2"><li>a</li>
16534 </ol>
16535 <span about="#mwt3" typeof="mw:Transclusion">
16536 </span><dl about="#mwt3"><dd>a</dd>
16537 </dl>
16538 !!end
16539
16540 #### ----------------------------------------------------------------
16541 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
16542 #### tags. Parsoid's output for these tags differs from that of the
16543 #### PHP parser.
16544 #### ----------------------------------------------------------------
16545
16546 !!test
16547 Ref: 1. ref-location should be replaced with an index span
16548 !!options
16549 parsoid
16550 !!input
16551 A <ref>foo</ref>
16552 B <ref name="x">foo</ref>
16553 C <ref name="y" />
16554 !!result
16555 <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>
16556 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>
16557 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>
16558 !!end
16559
16560 !!test
16561 Ref: 2. ref-tags with identical names should all get the same index
16562 !!options
16563 parsoid
16564 !!input
16565 A <ref name="x">foo</ref>
16566 B <ref name="x" />
16567 !!result
16568 <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>
16569 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>
16570 !!end
16571
16572 !!test
16573 Ref: 3. spaces in ref-names should be ignored
16574 !!options
16575 parsoid
16576 !!input
16577 A <ref name="x">foo</ref>
16578 B <ref name=" x " />
16579 C <ref name= x />
16580 !!result
16581 <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>
16582 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>
16583 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>
16584 !!end
16585
16586 !!test
16587 Ref: 4. 'constructor' should be accepted as a valid ref-name
16588 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
16589 !!options
16590 parsoid
16591 !!input
16592 A <ref name="constructor">foo</ref>
16593 !!result
16594 <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>
16595 !!end
16596
16597 !!test
16598 Ref: 5. body should accept generic wikitext
16599 !!options
16600 parsoid
16601 !!input
16602 A <ref>
16603 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
16604 </ref>
16605
16606 <references />
16607 !!result
16608 <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=\"#mwt5\" 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>
16609
16610 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
16611 <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="#mwt5" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"transclusion"}},"i":0}}]}'>transclusion</span>
16612 </li>
16613 </ol>
16614 !!end
16615
16616 !!test
16617 Ref: 6. indent-pres should not be output in ref-body
16618 !!options
16619 parsoid
16620 !!input
16621 A <ref>
16622 foo
16623 bar
16624 baz
16625 </ref>
16626
16627 <references />
16628 !!result
16629 <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>
16630
16631 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
16632 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
16633 bar
16634 baz
16635 </li>
16636 </ol>
16637 !!end
16638
16639 !!test
16640 Ref: 7. No p-wrapping in ref-body
16641 !!options
16642 parsoid
16643 !!input
16644 A <ref>
16645 foo
16646
16647 bar
16648
16649
16650 baz
16651
16652
16653
16654 booz
16655 </ref>
16656
16657 <references />
16658 !!result
16659 <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>
16660
16661 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
16662 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
16663
16664 bar
16665
16666
16667 baz
16668
16669
16670
16671 booz
16672 </li>
16673 </ol>
16674 !!end
16675
16676 !!test
16677 Ref: 8. transclusion wikitext has lower precedence
16678 !!options
16679 parsoid
16680 !!input
16681 A <ref> foo {{echo|</ref> B C}}
16682
16683 <references />
16684 !!result
16685 <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>
16686 <ol class="references" typeof="mw:Extension/references" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
16687 <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>
16688 </ol>
16689 !!end
16690
16691 !!test
16692 Ref: 9. unclosed comments should not leak out of ref-body
16693 !!options
16694 parsoid
16695 !!input
16696 A <ref> foo <!--</ref> B C
16697 <references />
16698 !!result
16699 <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>
16700 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
16701 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo </li>
16702 </ol>
16703 !!end
16704
16705 !!test
16706 Ref: 10. Unclosed HTML tags should not leak out of ref-body
16707 !!options
16708 parsoid
16709 !!input
16710 A <ref> <b> foo </ref> B C
16711
16712 <references />
16713 !!result
16714 <p data-parsoid='{"dsr":[0,26,0,0]}'>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>","dsr":[2,22,5,6]}'><a href="#cite_note-1">[1]</a></span> B C</p>
16715
16716
16717 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references />","dsr":[28,42,2,2]}' data-mw='{"name":"references","attrs":{}}'>
16718 <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,"dsr":[8,16,3,0]}'> foo </b></li>
16719 </ol>
16720 !!end
16721
16722 !!test
16723 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
16724 !!options
16725 parsoid
16726 !!input
16727 A <ref>foo</ref> B
16728 C <ref>bar</ref> D
16729 !!result
16730 <p data-parsoid='{"dsr":[0,37,0,0]}'>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>","dsr":[2,16,5,6]}'><a href="#cite_note-1">[1]</a></span> B
16731 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>","dsr":[21,35,5,6]}'><a href="#cite_note-2">[2]</a></span> D</p>
16732 !!end
16733
16734 !!test
16735 Ref: 12. ref-tags act as trailing newline migration barrier
16736 !!options
16737 parsoid
16738 !!input
16739 <!--the newline at the end of this line moves out of the p-tag-->a
16740
16741 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
16742 <ref />
16743
16744 c
16745 !!result
16746 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
16747
16748
16749 <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>
16750 <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>
16751
16752
16753 <p>c</p>
16754 !!end
16755
16756 !!test
16757 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
16758 !!options
16759 parsoid
16760 !!input
16761 <ref>foo</ref> A
16762 <ref>bar
16763 </ref> B
16764 !!result
16765 <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
16766 <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>
16767 !!end
16768
16769 !!test
16770 Ref: 14. A nested ref-tag should be emitted as plain text
16771 !!options
16772 parsoid
16773 !!input
16774 <ref>foo <ref>bar</ref> baz</ref>
16775
16776 <references />
16777 !!result
16778 <p data-parsoid='{"dsr":[0,33,0,0]}'><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>","dsr":[0,33,5,6]}'><a href="#cite_note-1">[1]</a></span></p>
16779
16780 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-parsoid='{"src":"&lt;references />","dsr":[35,49,2,2]}' data-mw='{"name":"references","attrs":{}}'>
16781 <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>
16782 </ol>
16783 !!end
16784
16785 !!test
16786 Ref: 15. ref-tags with identical names should get identical indexes
16787 !!options
16788 parsoid
16789 !!input
16790 A1 <ref name="a">foo</ref> A2 <ref name="a" />
16791 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
16792
16793 <references />
16794 !!result
16795 <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>
16796 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>
16797
16798 <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>
16799 </ol>
16800 !!end
16801
16802 !!test
16803 References: 1. references tag without any refs should be handled properly
16804 !!options
16805 parsoid
16806 !!input
16807 <references />
16808 !!result
16809 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
16810 !!end
16811
16812 !!test
16813 References: 2. references tag with group only outputs references from that group
16814 !!options
16815 parsoid
16816 !!input
16817 A <ref group="a">foo</ref>
16818 B <ref group="b">bar</ref>
16819
16820 <references group='a' />
16821 !!result
16822 <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>
16823 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"group":"b"}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[b 1]</a></span></p>
16824
16825 <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>
16826 </ol>
16827 !!end
16828
16829 !!test
16830 References: 3. ref list should be cleared after processing references
16831 !!options
16832 parsoid
16833 !!input
16834 A <ref>foo</ref>
16835
16836 <references />
16837
16838 B <ref>bar</ref>
16839
16840 <references />
16841 !!result
16842 <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>
16843
16844 <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>
16845 </ol>
16846
16847 <p>B <span about="#mwt6" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
16848
16849 <ol about="#mwt8" 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> bar</li>
16850 </ol>
16851 !!end
16852
16853 !!test
16854 References: 4. only referenced group should be cleared after processing references
16855 !!options
16856 parsoid
16857 !!input
16858 A <ref group="a">afoo</ref>
16859 B <ref>bfoo</ref>
16860
16861 <references group="a"/>
16862
16863 C <ref>cfoo</ref>
16864
16865 <references />
16866 !!result
16867 <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>
16868 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bfoo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"<ref>bfoo</ref>","dsr":[30,45,5,6]}'><a href="#cite_note-1">[1]</a></span></p>
16869
16870 <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>
16871 </ol>
16872
16873 <p>C <span about="#mwt8" class="reference" data-mw='{"name":"ref","body":{"html":"cfoo"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[2]</a></span></p>
16874
16875 <ol about="#mwt10" 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> bfoo</li><li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2-0">↑</a></span> cfoo</li>
16876 </ol>
16877 !!end
16878
16879 !!test
16880 References: 5. ref tags in references should be processed while ignoring all other content
16881 !!options
16882 parsoid
16883 !!input
16884 A <ref name="a" />
16885 B <ref name="b">bar</ref>
16886
16887 <references>
16888 <ref name="a">foo</ref>
16889 This should just get lost.
16890 </references>
16891 !!result
16892 <p data-parsoid='{"dsr":[0,57,0,0]}'>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\" />","dsr":[2,18,16,0]}'><a href="#cite_note-a-1">[1]</a></span>
16893 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>","dsr":[21,44,14,6]}'><a href="#cite_note-b-2">[2]</a></span></p>
16894
16895
16896 <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>","dsr":[46,123,2,2]}' 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":{}}'>
16897 <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>
16898 <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>
16899 </ol>
16900 !!end
16901
16902 !!test
16903 References: 6. <references /> from a transclusion
16904 !!options
16905 parsoid
16906 !!input
16907 {{echo|<references />}}
16908 !!result
16909 <ol class="references" about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<references />"}},"i":0}}]}'></ol>
16910 !!end
16911
16912 !! test
16913 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
16914 !! options
16915 parsoid
16916 !! input
16917 A <ref>foo bar for a</ref>
16918 B <ref name="b" />
16919
16920 <references />
16921
16922 <references>
16923 <ref name="b">foo</ref>
16924 </references>
16925 !! result
16926 <p data-parsoid='{"dsr":[0,45,0,0]}'>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>","dsr":[2,26,5,6]}'><a href="#cite_note-1">[1]</a></span>
16927 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\" />","dsr":[29,45,16,0]}'><a href="#cite_note-b-2">[2]</a></span></p>
16928
16929
16930 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-parsoid='{"src":"&lt;references />","dsr":[47,61,2,2]}' data-mw='{"name":"references","attrs":{}}'>
16931 <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>
16932 <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>
16933
16934
16935 <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>","dsr":[63,113,2,2]}' 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-1\">[1]&lt;/a>&lt;/span>\n"},"attrs":{}}'>
16936 <li about="#cite_note-b-1" id="cite_note-b-1" data-parsoid="{}"><span rel="mw:referencedBy">↑</span> foo</li>
16937 </ol>
16938 !! end
16939
16940 #### ----------------------------------------------------------------
16941 #### The following section of tests are primarily to test
16942 #### wikitext escaping capabilities of Parsoid. Given that
16943 #### escaping can be done any number of ways, the wikitext (input)
16944 #### is always adjusted to reflect how Parsoid adds nowiki
16945 #### escape tags.
16946 ####
16947 #### We are marking several tests as parsoid-only since the
16948 #### HTML in the result section is different from what the
16949 #### PHP parser generates for it.
16950 #### ----------------------------------------------------------------
16951
16952
16953 #### --------------- Headings ---------------
16954 #### 0. Unnested
16955 #### 1. Nested inside html <h1>=foo=</h1>
16956 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
16957 #### 3. Nested inside html with wikitext split by html tags
16958 #### 4. No escape needed
16959 #### 5. Empty headings <h1></h1>
16960 #### 6. Heading chars in SOL context
16961 #### ----------------------------------------
16962 !! test
16963 Headings: 0. Unnested
16964 !! options
16965 parsoid
16966 !! input
16967 <nowiki>=foo=</nowiki>
16968
16969 <nowiki> =foo= </nowiki>
16970 <!--cmt-->
16971 <nowiki>=foo=</nowiki>
16972
16973 =foo''a''<nowiki>=</nowiki>
16974 !! result
16975 <p><span typeof="mw:Nowiki">=foo=</span></p>
16976
16977 <p><span typeof="mw:Nowiki"> =foo= </span>
16978 <!--cmt-->
16979 <span typeof="mw:Nowiki">=foo=</span></p>
16980
16981 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
16982 !!end
16983
16984 !! test
16985 Headings: 1. Nested inside html
16986 !! options
16987 parsoid
16988 !! input
16989 =<nowiki>=foo=</nowiki>=
16990
16991 ==<nowiki>=foo=</nowiki>==
16992
16993 ===<nowiki>=foo=</nowiki>===
16994
16995 ====<nowiki>=foo=</nowiki>====
16996
16997 =====<nowiki>=foo=</nowiki>=====
16998
16999 ======<nowiki>=foo=</nowiki>======
17000 !! result
17001 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
17002 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
17003 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
17004 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
17005 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
17006 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
17007 !!end
17008
17009 !! test
17010 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
17011 !! options
17012 parsoid
17013 !! input
17014 =foo=
17015 <nowiki>*</nowiki>bar
17016
17017 =foo=
17018 =bar
17019
17020 =foo=
17021 <nowiki>=bar=</nowiki>
17022 !! result
17023 <h1>foo</h1>*bar
17024 <h1>foo</h1>=bar
17025 <h1>foo</h1>=bar=
17026 !!end
17027
17028 !! test
17029 Headings: 3. Nested inside html with wikitext split by html tags
17030 !! options
17031 parsoid
17032 !! input
17033 =='''bold'''<nowiki>foo=</nowiki>=
17034 !! result
17035 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
17036 !!end
17037
17038 !! test
17039 Headings: 4a. No escaping needed (testing just h1 and h2)
17040 !! options
17041 parsoid
17042 !! input
17043 ==foo=
17044
17045 =foo==
17046
17047 = =foo= =
17048
17049 ==foo= bar=
17050
17051 ===foo==
17052
17053 ==foo===
17054
17055 =''=''foo==
17056
17057 =<nowiki>=</nowiki>=
17058 !! result
17059 <h1>=foo</h1>
17060 <h1>foo=</h1>
17061 <h1> =foo= </h1>
17062 <h1>=foo= bar</h1>
17063 <h2>=foo</h2>
17064 <h2>foo=</h2>
17065 <h1><i>=</i>foo=</h1>
17066 <h1><span typeof="mw:Nowiki">=</span></h1>
17067 !!end
17068
17069 !! test
17070 Headings: 4b. No escaping needed (inside p-tags)
17071 !! options
17072 parsoid
17073 !! input
17074 ===
17075 =foo= x
17076 =foo= <s></s>
17077 !! result
17078 <p>===
17079 =foo= x
17080 =foo= <s></s>
17081 </p>
17082 !!end
17083
17084 !! test
17085 Headings: 5. Empty headings
17086 !! options
17087 parsoid
17088 !! input
17089 =<nowiki/>=
17090
17091 ==<nowiki/>==
17092
17093 ===<nowiki/>===
17094
17095 ====<nowiki/>====
17096
17097 =====<nowiki/>=====
17098
17099 ======<nowiki/>======
17100 !! result
17101 <h1></h1>
17102 <h2></h2>
17103 <h3></h3>
17104 <h4></h4>
17105 <h5></h5>
17106 <h6></h6>
17107 !!end
17108
17109 !! test
17110 Headings: 6a. Heading chars in SOL context (with trailing spaces)
17111 !! options
17112 parsoid
17113 !! input
17114 <nowiki>=a=</nowiki>
17115
17116 <nowiki>=a=</nowiki>
17117
17118 <nowiki>=a=</nowiki>
17119
17120 <nowiki>=a=</nowiki>
17121 !! result
17122 <p>=a=</p>
17123 <p>=a= </p>
17124 <p>=a= </p>
17125 <p>=a= </p>
17126 !!end
17127
17128 !! test
17129 Headings: 6b. Heading chars in SOL context (with trailing newlines)
17130 !! options
17131 parsoid
17132 !! input
17133 <nowiki>=a=
17134 b</nowiki>
17135
17136 <nowiki>=a=
17137 b</nowiki>
17138
17139 <nowiki>=a=
17140 b</nowiki>
17141
17142 <nowiki>=a=
17143 b</nowiki>
17144 !! result
17145 <p>=a=
17146 b</p>
17147 <p>=a=
17148 b</p>
17149 <p>=a=
17150 b</p>
17151 <p>=a=
17152 b</p>
17153 </p>
17154 !!end
17155
17156 !! test
17157 Headings: 6c. Heading chars in SOL context (leading newline break)
17158 !! options
17159 parsoid
17160 !! input
17161 a
17162 <nowiki>=b=</nowiki>
17163 !! result
17164 <p>a
17165 =b=</p>
17166 !!end
17167
17168 !! test
17169 Headings: 6d. Heading chars in SOL context (with interspersed comments)
17170 !! options
17171 parsoid
17172 !! input
17173 <!--c0--><nowiki>=a=</nowiki>
17174 <!--c1-->
17175 <nowiki>=a=</nowiki> <!--c2--> <!--c3-->
17176 !! result
17177 <p><!--c0-->=a=</p>
17178 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
17179 !!end
17180
17181 !! test
17182 Headings: 6d. Heading chars in SOL context (No escaping needed)
17183 !! options
17184 parsoid=html2wt
17185 !! input
17186 =a=<div>b</div>
17187 !! result
17188 =a=<div>b</div>
17189 !!end
17190
17191 #### --------------- Lists ---------------
17192 #### 0. Outside nests (*foo, etc.)
17193 #### 1. Nested inside html <ul><li>*foo</li></ul>
17194 #### 2. Inside definition lists
17195 #### 3. Only bullets at start should be escaped
17196 #### 4. No escapes needed
17197 #### 5. No unnecessary escapes
17198 #### 6. Escape bullets in SOL position
17199 #### 7. Escape bullets in a multi-line context
17200 #### ----------------------------------------
17201
17202 !! test
17203 Lists: 0. Outside nests
17204 !! input
17205 <nowiki>*</nowiki>foo
17206
17207 <nowiki>#</nowiki>foo
17208 !! result
17209 <p>*foo
17210 </p><p>#foo
17211 </p>
17212 !!end
17213
17214 !! test
17215 Lists: 1. Nested inside html
17216 !! input
17217 *<nowiki>*foo</nowiki>
17218
17219 *<nowiki>#foo</nowiki>
17220
17221 *<nowiki>:foo</nowiki>
17222
17223 *<nowiki>;foo</nowiki>
17224
17225 #<nowiki>*foo</nowiki>
17226
17227 #<nowiki>#foo</nowiki>
17228
17229 #<nowiki>:foo</nowiki>
17230
17231 #<nowiki>;foo</nowiki>
17232 !! result
17233 <ul>
17234 <li>*foo
17235 </li>
17236 </ul>
17237 <ul>
17238 <li>#foo
17239 </li>
17240 </ul>
17241 <ul>
17242 <li>:foo
17243 </li>
17244 </ul>
17245 <ul>
17246 <li>;foo
17247 </li>
17248 </ul>
17249 <ol>
17250 <li>*foo
17251 </li>
17252 </ol>
17253 <ol>
17254 <li>#foo
17255 </li>
17256 </ol>
17257 <ol>
17258 <li>:foo
17259 </li>
17260 </ol>
17261 <ol>
17262 <li>;foo
17263 </li>
17264 </ol>
17265
17266 !!end
17267
17268 !! test
17269 Lists: 2. Inside definition lists
17270 !! input
17271 ;<nowiki>;foo</nowiki>
17272
17273 ;<nowiki>:foo</nowiki>
17274
17275 ;<nowiki>:foo</nowiki>
17276 :bar
17277
17278 :<nowiki>:foo</nowiki>
17279 !! result
17280 <dl>
17281 <dt>;foo
17282 </dt>
17283 </dl>
17284 <dl>
17285 <dt>:foo
17286 </dt>
17287 </dl>
17288 <dl>
17289 <dt>:foo
17290 </dt>
17291 <dd>bar
17292 </dd>
17293 </dl>
17294 <dl>
17295 <dd>:foo
17296 </dd>
17297 </dl>
17298
17299 !!end
17300
17301 !! test
17302 Lists: 3. Only bullets at start of text should be escaped
17303 !! input
17304 *<nowiki>*foo*bar</nowiki>
17305
17306 *<nowiki>*foo</nowiki>''it''*bar
17307 !! result
17308 <ul>
17309 <li>*foo*bar
17310 </li>
17311 </ul>
17312 <ul>
17313 <li>*foo<i>it</i>*bar
17314 </li>
17315 </ul>
17316
17317 !!end
17318
17319 !! test
17320 Lists: 4. No escapes needed
17321 !! options
17322 parsoid
17323 !! input
17324 *foo*bar
17325
17326 *''foo''*bar
17327
17328 *[[Foo]]: bar
17329 !! result
17330 <ul>
17331 <li>foo*bar
17332 </li>
17333 </ul>
17334 <ul>
17335 <li><i>foo</i>*bar
17336 </li>
17337 </ul>
17338 <ul>
17339 <li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
17340 </li>
17341 </ul>
17342 !!end
17343
17344 !! test
17345 Lists: 5. No unnecessary escapes
17346 !! input
17347 * bar <span><nowiki>[[foo]]</nowiki></span>
17348
17349 *=bar <span><nowiki>[[foo]]</nowiki></span>
17350
17351 *[[bar <span><nowiki>[[foo]]</nowiki></span>
17352
17353 *]]bar <span><nowiki>[[foo]]</nowiki></span>
17354
17355 *=bar <span>foo]]</span>=
17356
17357 * <s></s>: a
17358 !! result
17359 <ul>
17360 <li> bar <span>[[foo]]</span>
17361 </li>
17362 </ul>
17363 <ul>
17364 <li>=bar <span>[[foo]]</span>
17365 </li>
17366 </ul>
17367 <ul>
17368 <li>[[bar <span>[[foo]]</span>
17369 </li>
17370 </ul>
17371 <ul>
17372 <li>]]bar <span>[[foo]]</span>
17373 </li>
17374 </ul>
17375 <ul>
17376 <li>=bar <span>foo]]</span>=
17377 </li>
17378 </ul>
17379 <ul>
17380 <li> <s></s>: a
17381 </li>
17382 </ul>
17383
17384 !!end
17385
17386 !! test
17387 Lists: 6. Escape bullets in SOL position
17388 !! options
17389 parsoid
17390 !! input
17391 <!--cmt--><nowiki>*foo</nowiki>
17392 !! result
17393 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
17394 !!end
17395
17396 !! test
17397 Lists: 7. Escape bullets in a multi-line context
17398 !! input
17399 a
17400 <nowiki>*</nowiki>b
17401 !! result
17402 <p>a
17403 *b
17404 </p>
17405 !!end
17406
17407 #### --------------- HRs ---------------
17408 #### 1. Single line
17409 #### -----------------------------------
17410
17411 !! test
17412 HRs: 1. Single line
17413 !! options
17414 parsoid
17415 !! input
17416 ----<nowiki>----</nowiki>
17417 ----=foo=
17418 ----*foo
17419 !! result
17420 <hr><span typeof="mw:Nowiki">----</span>
17421 <hr>=foo=
17422 <hr>*foo
17423 !! end
17424
17425 #### --------------- Tables ---------------
17426 #### 1a. Simple example
17427 #### 1b. No escaping needed (!foo)
17428 #### 1c. No escaping needed (|foo)
17429 #### 1d. No escaping needed (|}foo)
17430 ####
17431 #### 2a. Nested in td (<td>foo|bar</td>)
17432 #### 2b. Nested in td (<td>foo||bar</td>)
17433 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
17434 ####
17435 #### 3a. Nested in th (<th>foo!bar</th>)
17436 #### 3b. Nested in th (<th>foo!!bar</th>)
17437 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
17438 ####
17439 #### 4a. Escape -
17440 #### 4b. Escape +
17441 #### 4c. No escaping needed
17442 #### --------------------------------------
17443
17444 !! test
17445 Tables: 1a. Simple example
17446 !! input
17447 <nowiki>{|
17448 |}</nowiki>
17449 !! result
17450 <p>{|
17451 |}
17452 </p>
17453 !! end
17454
17455 !! test
17456 Tables: 1b. No escaping needed
17457 !! input
17458 !foo
17459 !! result
17460 <p>!foo
17461 </p>
17462 !! end
17463
17464 !! test
17465 Tables: 1c. No escaping needed
17466 !! input
17467 |foo
17468 !! result
17469 <p>|foo
17470 </p>
17471 !! end
17472
17473 !! test
17474 Tables: 1d. No escaping needed
17475 !! input
17476 |}foo
17477 !! result
17478 <p>|}foo
17479 </p>
17480 !! end
17481
17482 !! test
17483 Tables: 2a. Nested in td
17484 !! options
17485 parsoid
17486 !! input
17487 {|
17488 |<nowiki>foo|bar</nowiki>
17489 |}
17490 !! result
17491 <table><tbody><tr>
17492 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
17493 !! end
17494
17495 !! test
17496 Tables: 2b. Nested in td
17497 !! options
17498 parsoid
17499 !! input
17500 {|
17501 |<nowiki>foo||bar</nowiki>
17502 |''it''<nowiki>foo||bar</nowiki>
17503 |}
17504 !! result
17505 <table><tbody><tr>
17506 <td><span typeof="mw:Nowiki">foo||bar</span></td>
17507 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
17508 !! end
17509
17510 !! test
17511 Tables: 2c. Nested in td -- no escaping needed
17512 !! options
17513 parsoid
17514 !! input
17515 {|
17516 |foo!!bar
17517 |}
17518 !! result
17519 <table><tbody><tr><td>foo!!bar
17520 </td></tr></tbody></table>
17521
17522 !! end
17523
17524 !! test
17525 Tables: 3a. Nested in th
17526 !! options
17527 parsoid
17528 !! input
17529 {|
17530 !foo!bar
17531 |}
17532 !! result
17533 <table><tbody><tr><th>foo!bar
17534 </th></tr></tbody></table>
17535
17536 !! end
17537
17538 !! test
17539 Tables: 3b. Nested in th
17540 !! options
17541 parsoid
17542 !! input
17543 {|
17544 !<nowiki>foo!!bar</nowiki>
17545 |}
17546 !! result
17547 <table>
17548 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
17549 </tbody></table>
17550 !! end
17551
17552 !! test
17553 Tables: 3c. Nested in th -- no escaping needed
17554 !! options
17555 parsoid
17556 !! input
17557 {|
17558 !<nowiki>foo||bar</nowiki>
17559 |}
17560 !! result
17561 <table><tbody><tr>
17562 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
17563 !! end
17564
17565 !! test
17566 Tables: 4a. Escape -
17567 !! options
17568 parsoid
17569 !! input
17570 {|
17571 !-bar
17572 |-
17573 |<nowiki>-bar</nowiki>
17574 |}
17575 !! result
17576 <table><tbody>
17577 <tr><th>-bar</th></tr>
17578 <tr>
17579 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
17580 !! end
17581
17582 !! test
17583 Tables: 4b. Escape +
17584 !! options
17585 parsoid
17586 !! input
17587 {|
17588 !+bar
17589 |-
17590 |<nowiki>+bar</nowiki>
17591 |}
17592 !! result
17593 <table><tbody>
17594 <tr><th>+bar</th></tr>
17595 <tr>
17596 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
17597 !! end
17598
17599 !! test
17600 Tables: 4c. No escaping needed
17601 !! options
17602 parsoid
17603 !! input
17604 {|
17605 |foo-bar
17606 |foo+bar
17607 |-
17608 |''foo''-bar
17609 |''foo''+bar
17610 |-
17611 |foo
17612 bar|baz
17613 +bar
17614 -bar
17615 |}
17616 !! result
17617 <table><tbody>
17618 <tr><td>foo-bar</td><td>foo+bar</td></tr>
17619 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
17620 <tr><td>foo
17621 <p>bar|baz
17622 +bar
17623 -bar</p></td></tr>
17624 </tbody></table>
17625 !! end
17626
17627 ### SSS FIXME: Disabled right now because accurate html2wt
17628 ### on this snippet requires data-parsoid flags that we've
17629 ### stripped out of these tests. We should scheme how we
17630 ### we want to handle these kind of tests that require
17631 ### data-parsoid flags for accurate html2wt serialization
17632
17633 !! test
17634 Tables: 4d. No escaping needed
17635 !! options
17636 disabled
17637 !! input
17638 {|
17639 ||+1
17640 ||-2
17641 |}
17642 !! result
17643 <table>
17644 <tr>
17645 <td>+1
17646 </td>
17647 <td>-2
17648 </td></tr></table>
17649
17650 !! end
17651
17652 #### --------------- Links ----------------
17653 #### 1. Quote marks in link text
17654 #### 2. Wikilinks: Escapes needed
17655 #### 3. Wikilinks: No escapes needed
17656 #### 4. Extlinks: Escapes needed
17657 #### 5. Extlinks: No escapes needed
17658 #### --------------------------------------
17659 !! test
17660 Links 1. Quote marks in link text
17661 !! options
17662 parsoid
17663 !! input
17664 [[Foo|Foo<nowiki>''boo''</nowiki>]]
17665 !! result
17666 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
17667 !! end
17668
17669 !! test
17670 Links 2. WikiLinks: Escapes needed
17671 !! options
17672 parsoid
17673 !! input
17674 [[Foo|<nowiki>[Foobar]</nowiki>]]
17675 [[Foo|<nowiki>Foobar]</nowiki>]]
17676 [[Foo|x [Foobar] x]]
17677 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
17678 [[Foo|<nowiki>[[Bar]]</nowiki>]]
17679 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
17680 [[Foo|<nowiki>|Bar</nowiki>]]
17681 [[Foo|<nowiki>]]bar</nowiki>]]
17682 [[Foo|<nowiki>[[bar</nowiki>]]
17683 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
17684 !! result
17685 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
17686 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
17687 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
17688 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
17689 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
17690 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
17691 <a href="Foo" rel="mw:WikiLink">|Bar</a>
17692 <a href="Foo" rel="mw:WikiLink">]]bar</a>
17693 <a href="Foo" rel="mw:WikiLink">[[bar</a>
17694 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
17695 !! end
17696
17697 !! test
17698 Links 3. WikiLinks: No escapes needed
17699 !! options
17700 parsoid
17701 !! input
17702 [[Foo|[Foobar]]
17703 [[Foo|foo|bar]]
17704 !! result
17705 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
17706 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
17707 !! end
17708
17709 !! test
17710 Links 4. ExtLinks: Escapes needed
17711 !! options
17712 parsoid
17713 !! input
17714 [http://google.com <nowiki>[google]</nowiki>]
17715 [http://google.com <nowiki>google]</nowiki>]
17716 !! result
17717 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
17718 <a href="http://google.com" rel="mw:ExtLink">google]</a>
17719 !! end
17720
17721 !! test
17722 Links 5. ExtLinks: No escapes needed
17723 !! options
17724 parsoid
17725 !! input
17726 [http://google.com [google]
17727 !! result
17728 <a href="http://google.com" rel="mw:ExtLink">[google</a>
17729 !! end
17730
17731 #### --------------- Quotes ---------------
17732 #### 1. Quotes inside <b> and <i>
17733 #### 2. Link fragments separated by <i> and <b> tags
17734 #### 3. Link fragments inside <i> and <b>
17735 #### 4. No escaping needed
17736 #### --------------------------------------
17737 !! test
17738 1. Quotes inside <b> and <i>
17739 !! options
17740 parsoid=html2wt,wt2wt
17741 !! input
17742 ''<nowiki>'foo'</nowiki>''
17743 ''<nowiki>''foo''</nowiki>''
17744 ''<nowiki>'''foo'''</nowiki>''
17745 ''foo''<nowiki/>'s
17746 '''<nowiki>'foo'</nowiki>'''
17747 '''<nowiki>''foo''</nowiki>'''
17748 '''<nowiki>'''foo'''</nowiki>'''
17749 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
17750 '''foo'''<nowiki/>'s
17751 '''foo''
17752 ''foo''<nowiki/>'
17753 '<nowiki/>''foo''<nowiki/>'
17754 ''''foo'''
17755 '''foo'''<nowiki/>'
17756 '<nowiki/>'''foo'''<nowiki/>'
17757 !! result
17758 <p><i>'foo'</i>
17759 <i>''foo''</i>
17760 <i>'''foo'''</i>
17761 <i>foo</i>'s
17762 <b>'foo'</b>
17763 <b>''foo''</b>
17764 <b>'''foo'''</b>
17765 <b>foo'<i>bar'</i>baz</b>
17766 <b>foo</b>'s
17767 '<i>foo</i>
17768 <i>foo</i>'
17769 '<i>foo</i>'
17770 '<b>foo</b>
17771 <b>foo</b>'
17772 '<b>foo</b>'</p>
17773 !! end
17774
17775 !! test
17776 2. Link fragments separated by <i> and <b> tags
17777 !! input
17778 [[''foo''<nowiki>hello]]</nowiki>
17779
17780 [['''foo'''<nowiki>hello]]</nowiki>
17781 !! result
17782 <p>[[<i>foo</i>hello]]
17783 </p><p>[[<b>foo</b>hello]]
17784 </p>
17785 !! end
17786
17787 !! test
17788 3. Link fragments inside <i> and <b>
17789 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
17790 this is one of the shortcomings of this format)
17791 !! input
17792 ''[[foo''<nowiki>]]</nowiki>
17793
17794 '''[[foo'''<nowiki>]]</nowiki>
17795 !! result
17796 <p><i>[[foo</i>]]
17797 </p><p><b>[[foo</b>]]
17798 </p>
17799 !! end
17800
17801 !! test
17802 4. No escaping needed
17803 !! input
17804 '<span>''bar''</span>'
17805 '<span>'''bar'''</span>'
17806 !! result
17807 <p>'<span><i>bar</i></span>'
17808 '<span><b>bar</b></span>'
17809 </p>
17810 !! end
17811
17812 #### ----------- Paragraphs ---------------
17813 #### 1. No unnecessary escapes
17814 #### --------------------------------------
17815
17816 !! test
17817 1. No unnecessary escapes
17818 !! input
17819 bar <span><nowiki>[[foo]]</nowiki></span>
17820
17821 =bar <span><nowiki>[[foo]]</nowiki></span>
17822
17823 [[bar <span><nowiki>[[foo]]</nowiki></span>
17824
17825 ]]bar <span><nowiki>[[foo]]</nowiki></span>
17826
17827 =bar <span>foo]]</span><nowiki>=</nowiki>
17828 !! result
17829 <p>bar <span>[[foo]]</span>
17830 </p><p>=bar <span>[[foo]]</span>
17831 </p><p>[[bar <span>[[foo]]</span>
17832 </p><p>]]bar <span>[[foo]]</span>
17833 </p><p>=bar <span>foo]]</span>=
17834 </p>
17835 !!end
17836
17837 #### ----------------------- PRE --------------------------
17838 #### 1. Leading whitespace in SOL context should be escaped
17839 #### ------------------------------------------------------
17840 !! test
17841 1. Leading whitespace in SOL context should be escaped
17842 !! options
17843 parsoid
17844 !! input
17845 <nowiki> </nowiki>a
17846
17847 <nowiki> </nowiki> a
17848
17849 <nowiki> </nowiki>a(tab)
17850
17851 <nowiki> </nowiki> a
17852 <!--cmt-->
17853 <nowiki> </nowiki> a
17854
17855 a
17856 <nowiki> </nowiki>b
17857
17858 a
17859 <nowiki> </nowiki>b
17860
17861 a
17862 <nowiki> </nowiki> b
17863 !! result
17864 <p> a</p>
17865 <p> a</p>
17866 <p> a(tab)</p>
17867 <p> a</p>
17868 <p><!--cmt--> a</p>
17869 <p>a
17870 b</p>
17871 <p>a
17872 b</p>
17873 <p>a
17874 b</p>
17875 !! end
17876
17877 #### --------------- Behavior Switches --------------------
17878 !! test
17879 1. Valid behavior switches should be escaped
17880 !! options
17881 parsoid=html2wt
17882 !! input
17883 <nowiki>__TOC__</nowiki>
17884 !! result
17885 __TOC__
17886 !! end
17887
17888 !! test
17889 2. Invalid behavior switches should not be escaped
17890 !! options
17891 parsoid=html2wt
17892 !! input
17893 __TOO__
17894 __|__
17895 !! result
17896 __TOO__
17897 __|__
17898 !! end
17899
17900 #### --------------- HTML tags ---------------
17901 #### 1. a tags
17902 #### 2. other tags
17903 #### 3. multi-line html tag
17904 #### -----------------------------------------
17905 !! test
17906 1. a tags
17907 !! options
17908 parsoid
17909 !! input
17910 <a href="http://google.com">google</a>
17911 !! result
17912 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
17913 !! end
17914
17915 !! test
17916 2. other tags
17917 !! input
17918 <nowiki><div>foo</div>
17919 <div style="color:red">foo</div></nowiki>
17920 !! result
17921 <p>&lt;div&gt;foo&lt;/div&gt;
17922 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
17923 </p>
17924 !! end
17925
17926 !! test
17927 3. multi-line html tag
17928 !! input
17929 <nowiki><div
17930 >foo</div
17931 ></nowiki>
17932 !! result
17933 <p>&lt;div
17934 &gt;foo&lt;/div
17935 &gt;
17936 </p>
17937 !! end
17938
17939 !! test
17940 4. extension tags
17941 !! input
17942 <nowiki><ref>foo</ref></nowiki>
17943 !! result
17944 <p>&lt;ref&gt;foo&lt;/ref&gt;
17945 </p>
17946 !! end
17947
17948 #### --------------- Others ---------------
17949 !! test
17950 Escaping nowikis
17951 !! input
17952 &lt;nowiki&gt;foo&lt;/nowiki&gt;
17953 !! result
17954 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
17955 </p>
17956 !! end
17957
17958 ## The quote-char in the input is necessary for triggering the bug
17959 !! test
17960 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
17961 !! options
17962 parsoid=wt2wt,html2wt
17963 !! input
17964 foo's bar :
17965 !! result
17966 <p>foo's bar :</p>
17967 !! end
17968
17969 !! test
17970
17971 Tag-like HTML structures are passed through as text
17972 !! input
17973 <x y>
17974
17975 <x.y>
17976
17977 <x-y>
17978
17979 1>2
17980
17981 x<y
17982
17983 a>b
17984
17985 1<d e>f
17986 !! result
17987 <p>&lt;x y&gt;
17988 </p><p>&lt;x.y&gt;
17989 </p><p>&lt;x-y&gt;
17990 </p><p>1&gt;2
17991 </p><p>x&lt;y
17992 </p><p>a&gt;b
17993 </p><p>1&lt;d e&gt;f
17994 </p>
17995 !! end
17996
17997
17998 # This was a bug in the PHP parser (see bug 17663 and its dups,
17999 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
18000 !! test
18001 Tag names followed by punctuation should not be recognized as tags
18002 !! input
18003 <s.ome> text
18004 !! result
18005 <p>&lt;s.ome&gt; text
18006 </p>
18007 !! end
18008
18009 !! test
18010 HTML tag with necessary entities in attributes
18011 !! input
18012 <span title="&amp;amp;">foo</span>
18013 !! result
18014 <p><span title="&amp;amp;">foo</span>
18015 </p>
18016 !! end
18017
18018 !! test
18019 HTML tag with 'unnecessary' entity encoding in attributes
18020 !! input
18021 <span title="&amp;">foo</span>
18022 !! result
18023 <p><span title="&amp;">foo</span>
18024 </p>
18025 !! end
18026
18027 !! test
18028 HTML tag with broken attribute value quoting
18029 !! input
18030 <span title="Hello world>Foo</span>
18031 !! result
18032 <p><span>Foo</span>
18033 </p>
18034 !! end
18035
18036 !! test
18037 Parsoid-only: HTML tag with broken attribute value quoting
18038 !! options
18039 parsoid
18040 !! input
18041 <span title="Hello world>Foo</span>
18042 !! result
18043 <p><span title="Hello world">Foo</span>
18044 </p>
18045 !! end
18046
18047 !! test
18048 Table with broken attribute value quoting
18049 !! input
18050 {|
18051 | title="Hello world|Foo
18052 |}
18053 !! result
18054 <table>
18055 <tr>
18056 <td>Foo
18057 </td></tr></table>
18058
18059 !! end
18060
18061 !! test
18062 Table with broken attribute value quoting on consecutive lines
18063 !! input
18064 {|
18065 | title="Hello world|Foo
18066 | style="color:red|Bar
18067 |}
18068 !! result
18069 <table>
18070 <tr>
18071 <td>Foo
18072 </td>
18073 <td>Bar
18074 </td></tr></table>
18075
18076 !! end
18077
18078 !! test
18079 Parsoid-only: Table with broken attribute value quoting on consecutive lines
18080 !! options
18081 parsoid
18082 !! input
18083 {|
18084 | title="Hello world|Foo
18085 | style="color:red|Bar
18086 |}
18087 !! result
18088 <table><tbody>
18089 <tr>
18090 <td title="Hello world">Foo
18091 </td><td style="color: red">Bar
18092 </td></tr></tbody></table>
18093
18094 !! end
18095
18096 !! test
18097 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
18098 !! options
18099 parsoid
18100 !! input
18101 {{}}
18102 !! result
18103 {{}}
18104 !! end
18105
18106 !! test
18107 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
18108 !! options
18109 parsoid
18110 !! input
18111 }}{{
18112 !! result
18113 }}{{
18114 !! end
18115
18116 !!test
18117 Accept empty td cell attribute
18118 !!input
18119 {|
18120 | align="center" | foo || |
18121 |}
18122 !!result
18123 <table>
18124 <tr>
18125 <td align="center"> foo </td>
18126 <td>
18127 </td></tr></table>
18128
18129 !!end
18130
18131 !!test
18132 Non-empty attributes in th-cells
18133 !!input
18134 {|
18135 ! Foo !! style="color: red" | Bar
18136 |}
18137 !!result
18138 <table>
18139 <tr>
18140 <th> Foo </th>
18141 <th style="color: red"> Bar
18142 </th></tr></table>
18143
18144 !!end
18145
18146 !!test
18147 Accept empty attributes in th-cells
18148 !!input
18149 {|
18150 !| foo !!| bar
18151 |}
18152 !!result
18153 <table>
18154 <tr>
18155 <th> foo </th>
18156 <th> bar
18157 </th></tr></table>
18158
18159 !!end
18160
18161 !!test
18162 Empty table rows go away
18163 !!input
18164 {|
18165 | Hello
18166 | there
18167 |- class="foo"
18168 |-
18169 |}
18170 !! result
18171 <table>
18172 <tr>
18173 <td> Hello
18174 </td>
18175 <td> there
18176 </td></tr>
18177
18178 </table>
18179
18180 !! end
18181
18182 ###
18183 ### Parsoid-centric tests for testing RTing of inter-element separators
18184 ### Edge cases not tested by existing parser tests and specific to
18185 ### Parsoid-specific serialization strategies.
18186 ###
18187
18188 !!test
18189 RT-ed inter-element separators should be valid separators
18190 !!input
18191 {|
18192 |- [[foo]]
18193 |}
18194 !!result
18195 <table>
18196
18197 </table>
18198
18199 !!end
18200
18201 !!test
18202 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
18203 (Parsoid-only since PHP parser relies on Tidy for correct output)
18204 !!options
18205 parsoid
18206 !!input
18207 {|
18208 |<small>foo
18209 bar
18210 |}
18211
18212 {|
18213 |<small>foo<small>
18214 |}
18215 !!result
18216 !!end
18217
18218 !!test
18219 Empty TD followed by TD with tpl-generated attribute
18220 !!input
18221 {|
18222 |-
18223 |
18224 |{{echo|style='color:red'}}|foo
18225 |}
18226 !!result
18227 <table>
18228
18229 <tr>
18230 <td>
18231 </td>
18232 <td>foo
18233 </td></tr></table>
18234
18235 !!end
18236
18237 !!test
18238 Indented table with an empty td
18239 !!input
18240 {|
18241 |-
18242 |
18243 |foo
18244 |}
18245 !!result
18246 <table>
18247
18248 <tr>
18249 <td>
18250 </td>
18251 <td>foo
18252 </td></tr></table>
18253
18254 !!end
18255
18256 !!test
18257 Empty TR followed by a template-generated TR
18258 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
18259 !!options
18260 parsoid
18261 !!input
18262 {|
18263 |-
18264 {{echo|<tr><td>foo</td></tr>}}
18265 |}
18266 !!result
18267 <table>
18268 <tbody>
18269 <tr></tr>
18270 <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}}]}'>
18271 <td>foo</td></tr>
18272 </tbody></table>
18273 !!end
18274
18275 ## PHP and parsoid output differ for this, and since this is primarily
18276 ## for testing Parsoid's serializer, marking this Parsoid only
18277 !!test
18278 Empty TR followed by mixed-ws-comment line should RT correctly
18279 !!options
18280 parsoid
18281 !!input
18282 {|
18283 |-
18284 <!--c-->
18285 |-
18286 <!--c--> <!--d-->
18287 |}
18288 !!result
18289 <table>
18290 <tbody>
18291 <tr></tr>
18292 <!--c-->
18293 <tr>
18294 <!--c--> </tr><!--d-->
18295 </tbody></table>
18296
18297 !!end
18298
18299 !!test
18300 Multi-line image caption generated by templates with/without trailing newlines
18301 !!options
18302 parsoid
18303 !!input
18304 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
18305 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
18306 !!result
18307 <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>
18308 <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>
18309
18310 !!end
18311
18312 ## PHP emits broken html for this, and since this is primarily
18313 ## a Parsoid serializer test, marking this Parsoid only
18314 !!test
18315 Improperly nested inline or quotes tags with whitespace in between
18316 !!options
18317 parsoid
18318 !!input
18319 <span> <s>x</span> </s>
18320 ''' ''x''' ''
18321 !!result
18322 <p><span> <s>x</s></span><s> </s>
18323 <b> <i>x</i></b><i> </i>
18324 </p>
18325 !!end
18326
18327 !!test
18328 Encapsulate protected attributes from wt
18329 !!options
18330 parsoid
18331 !!input
18332 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
18333 !!result
18334 <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>
18335 </body>
18336 !!end
18337
18338 ## Currently the p-wrapper is fragile in how adds / removes transformations.
18339 ## Having nested or stray pre tags results in the attempt to add duplicates,
18340 ## causing an assertion fail. This test tries to prevent that situation.
18341 !!test
18342 Ensure ParagraphWrapper can deal with stray closing pre tags
18343 !!options
18344 parsoid=wt2html
18345 !!input
18346 plain text</pre>
18347 !!result
18348 plain text
18349 !!end
18350
18351 !!test
18352 Ensure fostered text content is wrapped in spans
18353 !!options
18354 parsoid=wt2html
18355 !!input
18356 <table>hi</table><table>ho</table>
18357 !!result
18358 <span>hi</span>
18359 <table></table>
18360 <span>ho</span>
18361 <table></table>
18362 !!end
18363
18364 !!test
18365 Encapsulation properly handles null DSR information from foster box
18366 !!options
18367 parsoid=wt2html,wt2wt
18368 !!input
18369 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
18370 !!result
18371 <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;
18372 <table>foo
18373 <tr>
18374 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
18375 <table>
18376 <tbody>
18377 <tr>
18378 <td>bar</td></tr></tbody></table>
18379 !!end
18380
18381 !!test
18382 1. Encapsulate foster-parented transclusion content
18383 !!options
18384 parsoid=wt2wt,wt2html
18385 !!input
18386 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
18387 !!result
18388 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
18389 <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
18390 <tr>
18391 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
18392 <table>
18393 <tbody>
18394 <tr>
18395 <td>bar</td></tr></tbody></table>
18396 !!end
18397
18398 !!test
18399 2. Encapsulate foster-parented transclusion content
18400 !!options
18401 parsoid=wt2wt,wt2html
18402 !!input
18403 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
18404 !!result
18405 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
18406 <table>
18407 <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>
18408 <tr>
18409 <td>bar</td></tr></table>&quot;]}">foo</div>
18410 <table>
18411 <tbody>
18412 <tr>
18413 <td>bar</td></tr></tbody></table>
18414 !!end
18415
18416 !!test
18417 3. Encapsulate foster-parented transclusion content
18418 !!options
18419 parsoid=wt2wt,wt2html
18420 !!input
18421 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
18422 !!result
18423 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
18424 <table>
18425 <div>
18426 <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>
18427 <tr>
18428 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
18429 <p>foo</p></div>
18430 <table>
18431 <tbody>
18432 <tr>
18433 <td>bar</td></tr></tbody></table>
18434 !!end
18435
18436 !!test
18437 4. Encapsulate foster-parented transclusion content
18438 !!options
18439 parsoid=wt2wt,wt2html
18440 !!input
18441 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
18442 !!result
18443 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
18444 <table>
18445 <div>
18446 <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>
18447 <tr>
18448 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
18449 <p>foo</p></div>
18450 <table>
18451 <tbody>
18452 <tr>
18453 <td>bar</td></tr></tbody></table>
18454 !!end
18455
18456 !!test
18457 5. Encapsulate foster-parented transclusion content
18458 !!options
18459 parsoid=wt2wt,wt2html
18460 !!input
18461 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
18462 !!result
18463 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
18464 <table>
18465 <tr>
18466 <td>
18467 <div>
18468 <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>
18469 <table>
18470 <tbody>
18471 <tr>
18472 <td>
18473 <div>
18474 <p>foo</p></div></td></tr></tbody></table>
18475 !!end
18476
18477 !!test
18478 6. Encapsulate foster-parented transclusion content
18479 !!options
18480 parsoid=wt2wt,wt2html
18481 !!input
18482 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
18483 !!result
18484 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
18485 <table>
18486 <tr>
18487 <td>
18488 <div>
18489 <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>
18490 <table>
18491 <tbody>
18492 <tr>
18493 <td>
18494 <div>
18495 <p>foo</p></div></td></tr></tbody></table>
18496 <p>ok</p>
18497 !!end
18498
18499 !!test
18500 7. Encapsulate foster-parented transclusion content
18501 !!options
18502 parsoid=wt2wt,wt2html
18503 !!input
18504 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
18505 !!result
18506 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
18507 <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;
18508 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
18509 <td>bar</td></table>&quot;]}">foo</p>
18510 <table>
18511 <tbody>
18512 <tr>
18513 <td>bar</td></tr></tbody></table>
18514 !!end
18515
18516 !!test
18517 8. Encapsulate foster-parented transclusion content
18518 !!options
18519 parsoid=wt2wt,wt2html
18520 !!input
18521 {{echo|a
18522 }}{|{{echo|style='color:red'}}
18523 |-
18524 |b
18525 |}
18526 !!result
18527 <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>
18528 <table>
18529 <tbody>
18530 <tr>
18531 <td>b</td></tr></tbody></table>
18532 !!end
18533
18534 # -----------------------------------------------------------------
18535 # The following section of tests are primarily to spec requirements
18536 # around serialization of new/edited content.
18537 #
18538 # All these tests are marked Parsoid html2wt and html2html only
18539 # ----------------------------------------------------------------
18540
18541 !! test
18542 Image: Modifying size of an image
18543 !! options
18544 parsoid=html2wt
18545 !! input
18546 [[Image:Wiki.png|230x230px]]
18547 !! result
18548 <p data-parsoid='{"dsr":[0,24,0,0]}'><span typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"100px"}],"cacheKey":"[[Image:Wiki.png|100px]]","img":{"h":115,"w":100,"wdset":true},"dsr":[0,24,null,null]}'><a href="./File:Wiki.png" data-parsoid='{"a":{"href":"./File:Wiki.png"}}'><img resource="./File:Wiki.png" src="//upload.wikimedia.org/wikipedia/en/thumb/b/bc/Wiki.png/100px-Wiki.png" height="230" width="200" data-parsoid='{"a":{"resource":"./File:Wiki.png"},"sa":{"resource":"Image:Wiki.png"}}'></a></span></p>
18549 !!end
18550
18551 !! test
18552 Image: New block level image should have \n before and after
18553 !! options
18554 parsoid=html2wt
18555 !! input
18556 123
18557 [[File:Wiki.png|right|thumb|150x150px]]
18558 456
18559 !! result
18560 <p>123</p><figure typeof="mw:Image/Thumb" class="mw-halign-right"><a href="./File:Wiki.png"><img src="http://192.168.142.128/mw/images/thumb/b/bc/Wiki.png/131px-Wiki.png" width="131" height="150" resource="./File:Wiki.png"></a></figure><p>456</p>
18561 !!end
18562
18563 # Wacky -- the leading newline in input is required because
18564 # that is what the serializer emits. To be fixed. Not fixing
18565 # the test because this test is required to test serialization of
18566 # new content and preferred whitespace style.
18567 !! test
18568 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
18569 !! options
18570 parsoid=html2wt
18571 !! input
18572
18573 * foo
18574 !! result
18575 <ul>
18576 <li><p>foo</p></li>
18577 </ul>
18578 !! end
18579
18580 !! test
18581 Don't strip leading whitespace when handling indent-pre suppressing tags
18582 !! options
18583 parsoid=html2wt
18584 !! input
18585 {|
18586 | indented row
18587 |}
18588 <blockquote>
18589 '''This is very bold of you!'''
18590
18591 {|
18592 |
18593 indented cell (no pre-wrapping!)
18594 |}
18595 </blockquote>
18596 foo
18597 <div>bar</div>
18598 !! result
18599 <table>
18600 <tr><td> indented row</td></tr>
18601 </table>
18602 <blockquote><p>
18603 <b>This is very bold of you!</b>
18604 </p>
18605 <table><tr><td>
18606 indented cell (no pre-wrapping!)
18607 </td></tr></table>
18608 </blockquote>
18609 <p>foo</p>
18610 <div>bar</div>
18611 !! end
18612
18613 !! test
18614 Strip leading whitespace when handling indent-pre inducing tags
18615 !! options
18616 parsoid=html2wt
18617 !! input
18618 foo
18619 <span>bar</span>
18620
18621 <span>foo2
18622 </span>bar2
18623
18624 <div>foo</div>
18625 <span>bar</span>
18626 !! result
18627 <p>foo</p>
18628 <span>bar</span>
18629
18630 <span>foo2
18631 </span>bar2
18632
18633 <div>foo</div>
18634 <span>bar</span>
18635 !! end
18636
18637 # Wacky -- the leading newline in input is required because
18638 # that is what the serializer emits. To be fixed. Not fixing
18639 # the test because this test is required to test serialization of
18640 # new content and preferred whitespace style.
18641 !! test
18642 Lists: Add space after bullets
18643 !! options
18644 parsoid=html2wt
18645 !! input
18646
18647 * foo
18648 * bar
18649 * <span> baz</span>
18650 !! result
18651 <ul>
18652 <li>foo</li>
18653 <li> bar</li>
18654 <li><span> baz</span></li>
18655 </ul>
18656 !! end
18657
18658 !! test
18659 Parsoid: Serialize positional parameters with = in them as named parameter
18660 !! options
18661 parsoid=html2wt
18662 !! input
18663 {{echo|1 = f=oo}}
18664
18665 {{echo|1 = f=oo|2 = bar}}
18666
18667 <!--Orig params with data-parsoid has heuristics for handling = chars-->
18668 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
18669 {{echo|<nowiki>f=oo</nowiki>|bar}}
18670 !! result
18671 <p about="#mwt1" typeof="mw:Transclusion"
18672 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
18673
18674 <p about="#mwt1" typeof="mw:Transclusion"
18675 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
18676
18677 <!--Orig params with data-parsoid has heuristics for handling = chars-->
18678 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
18679 <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>
18680 !! end
18681
18682 !! test
18683 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
18684 !! options
18685 parsoid=html2wt
18686 !! input
18687 <div>a
18688 b
18689 </div>
18690 <div>a
18691 b
18692 </div>
18693 <div>
18694 a
18695
18696 b
18697 </div>
18698 !! result
18699 <div>a<p>b</p></div>
18700 <div>a
18701 <p>b</p></div>
18702 <div>
18703 a
18704 <p>b</p></div>
18705 !! end
18706
18707 #-----------------------------
18708 # I/B quote minimization tests
18709 #-----------------------------
18710
18711 !! test
18712 1. I/B quote minimization: wikitext-only tags should be combined
18713 !! options
18714 parsoid=html2wt
18715 !! input
18716 ''AB''
18717
18718 '''AB'''
18719
18720 ''A'''B'''''
18721
18722 '''A''B'''''
18723
18724 '''A''BC''D'''
18725
18726 '''''AB'''''
18727
18728 '''''AB'''''
18729
18730 '''''AB'''''
18731 !! result
18732 <p><i>A</i><i>B</i></p>
18733 <p><b>A</b><b>B</b></p>
18734 <p><i>A</i><b><i>B</i></b></p>
18735 <p><b>A</b><i><b>B</b></i></p>
18736 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
18737 <p><i><b>A</b></i><i><b>B</b></i></p>
18738 <p><i><b>A</b></i><b><i>B</i></b></p>
18739 <p><b><i>A</i></b><i><b>B</b></i></p>
18740 !! end
18741
18742 !! test
18743 2. I/B quote minimization: wikitext and html tags should not be combined
18744 !! options
18745 parsoid=html2wt
18746 !! input
18747 ''A''<i>B</i>
18748
18749 ''A'''''<i>B</i>'''
18750 !! result
18751 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
18752 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
18753 !! end
18754
18755 !! test
18756 3. I/B quote minimization: templated content stops minimization
18757 !! options
18758 parsoid=html2wt
18759 !! input
18760 ''A''{{echo|''B''}}
18761
18762 ''A''{{echo|'''''B'''''}}
18763 !! result
18764 <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>
18765 <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>
18766 !! end
18767
18768 !! test
18769 4. I/B quote minimization: new content should be mimimized with adjacent old content
18770 !! options
18771 parsoid=html2wt
18772 !! input
18773 ''AB''
18774
18775 '''AB'''
18776
18777 ''A'''B'''''
18778 !! result
18779 <p><i>A</i><i data-parsoid='{}'>B</i></p>
18780 <p><b data-parsoid='{}'>A</b><b>B</b></p>
18781 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
18782 !! end
18783
18784 !!test
18785 5. Bug 54262: New entities
18786 !! options
18787 parsoid=html2wt
18788 !! input
18789 foo
18790 !! result
18791 <span typeof="mw:Entity">foo</span>
18792 !! end
18793
18794 # -----------------------------------------------------------------
18795 # End of section for Parsoid-only html2wt tests for serialization
18796 # of new content
18797 # -----------------------------------------------------------------
18798
18799 TODO:
18800 more images
18801 more tables
18802 character entities
18803 and much more
18804 Try for 100% code coverage