Merge "Use a more standard "Forgot your password?" in userlogin-resetpassword-link"
[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
11713 !! test
11714 Table attribute legitimate extension
11715 !! input
11716 {|
11717 !+ style="<nowiki>color:blue</nowiki>"| status
11718 |}
11719 !! result
11720 <table>
11721 <tr>
11722 <th style="color:blue"> status
11723 </th></tr></table>
11724
11725 !!end
11726
11727 !! test
11728 Table attribute safety
11729 !! input
11730 {|
11731 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
11732 |}
11733 !! result
11734 <table>
11735 <tr>
11736 <th style="/* insecure input */"> status
11737 </th></tr></table>
11738
11739 !! end
11740
11741 !! test
11742 CSS line continuation 1
11743 !! input
11744 <div style="background-image: u\&#10;rl(test.jpg);"></div>
11745 !! result
11746 <div style="/* insecure input */"></div>
11747
11748 !! end
11749
11750 !! test
11751 CSS line continuation 2
11752 !! input
11753 <div style="background-image: u\&#13;rl(test.jpg); "></div>
11754 !! result
11755 <div style="/* insecure input */"></div>
11756
11757 !! end
11758
11759 !! article
11760 Template:Identity
11761 !! text
11762 {{{1}}}
11763 !! endarticle
11764
11765 !! test
11766 Expansion of multi-line templates in attribute values (bug 6255)
11767 !! input
11768 <div style="background: {{identity|#00FF00}}">-</div>
11769 !! result
11770 <div style="background: #00FF00">-</div>
11771
11772 !! end
11773
11774
11775 !! test
11776 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
11777 !! input
11778 <div style="background:
11779 #00FF00">-</div>
11780 !! result
11781 <div style="background: #00FF00">-</div>
11782
11783 !! end
11784
11785 !! test
11786 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
11787 !! input
11788 <div style="background: &#10;#00FF00">-</div>
11789 !! result
11790 <div style="background: &#10;#00FF00">-</div>
11791
11792 !! end
11793
11794 ###
11795 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
11796 ###
11797 !! test
11798 Parser hook: empty input
11799 !! input
11800 <tag></tag>
11801 !! result
11802 <pre>
11803 ''
11804 array (
11805 )
11806 </pre>
11807
11808 !! end
11809
11810 !! test
11811 Parser hook: empty input using terminated empty elements
11812 !! input
11813 <tag/>
11814 !! result
11815 <pre>
11816 NULL
11817 array (
11818 )
11819 </pre>
11820
11821 !! end
11822
11823 !! test
11824 Parser hook: empty input using terminated empty elements (space before)
11825 !! input
11826 <tag />
11827 !! result
11828 <pre>
11829 NULL
11830 array (
11831 )
11832 </pre>
11833
11834 !! end
11835
11836 !! test
11837 Parser hook: basic input
11838 !! input
11839 <tag>input</tag>
11840 !! result
11841 <pre>
11842 'input'
11843 array (
11844 )
11845 </pre>
11846
11847 !! end
11848
11849
11850 !! test
11851 Parser hook: case insensitive
11852 !! input
11853 <TAG>input</TAG>
11854 !! result
11855 <pre>
11856 'input'
11857 array (
11858 )
11859 </pre>
11860
11861 !! end
11862
11863
11864 !! test
11865 Parser hook: case insensitive, redux
11866 !! input
11867 <TaG>input</TAg>
11868 !! result
11869 <pre>
11870 'input'
11871 array (
11872 )
11873 </pre>
11874
11875 !! end
11876
11877 !! test
11878 Parser hook: nested tags
11879 !! options
11880 noxml
11881 !! input
11882 <tag><tag></tag></tag>
11883 !! result
11884 <pre>
11885 '<tag>'
11886 array (
11887 )
11888 </pre>&lt;/tag&gt;
11889
11890 !! end
11891
11892 !! test
11893 Parser hook: basic arguments
11894 !! input
11895 <tag width=200 height = "100" depth = '50' square></tag>
11896 !! result
11897 <pre>
11898 ''
11899 array (
11900 'width' => '200',
11901 'height' => '100',
11902 'depth' => '50',
11903 'square' => 'square',
11904 )
11905 </pre>
11906
11907 !! end
11908
11909 !! test
11910 Parser hook: argument containing a forward slash (bug 5344)
11911 !! input
11912 <tag filename='/tmp/bla'></tag>
11913 !! result
11914 <pre>
11915 ''
11916 array (
11917 'filename' => '/tmp/bla',
11918 )
11919 </pre>
11920
11921 !! end
11922
11923 !! test
11924 Parser hook: empty input using terminated empty elements (bug 2374)
11925 !! input
11926 <tag foo=bar/>text
11927 !! result
11928 <pre>
11929 NULL
11930 array (
11931 'foo' => 'bar',
11932 )
11933 </pre>text
11934
11935 !! end
11936
11937 # </tag> should be output literally since there is no matching tag that begins it
11938 !! test
11939 Parser hook: basic arguments using terminated empty elements (bug 2374)
11940 !! input
11941 <tag width=200 height = "100" depth = '50' square/>
11942 other stuff
11943 </tag>
11944 !! result
11945 <pre>
11946 NULL
11947 array (
11948 'width' => '200',
11949 'height' => '100',
11950 'depth' => '50',
11951 'square' => 'square',
11952 )
11953 </pre>
11954 <p>other stuff
11955 &lt;/tag&gt;
11956 </p>
11957 !! end
11958
11959 ###
11960 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
11961 ###
11962
11963 !! test
11964 Parser hook: static parser hook not inside a comment
11965 !! input
11966 <statictag>hello, world</statictag>
11967 <statictag action=flush/>
11968 !! result
11969 <p>hello, world
11970 </p>
11971 !! end
11972
11973
11974 !! test
11975 Parser hook: static parser hook inside a comment
11976 !! input
11977 <!-- <statictag>hello, world</statictag> -->
11978 <statictag action=flush/>
11979 !! result
11980 <p><br />
11981 </p>
11982 !! end
11983
11984 # Nested template calls; this case was broken by Parser.php rev 1.506,
11985 # since reverted.
11986
11987 !! article
11988 Template:One-parameter
11989 !! text
11990 (My parameter is: {{{1}}})
11991 !! endarticle
11992
11993 !! article
11994 Template:Map-one-parameter
11995 !! text
11996 {{{{{1}}}|{{{2}}}}}
11997 !! endarticle
11998
11999 !! test
12000 Nested template calls
12001 !! input
12002 {{Map-one-parameter|One-parameter|param}}
12003 !! result
12004 <p>(My parameter is: param)
12005 </p>
12006 !! end
12007
12008
12009 ###
12010 ### Sanitizer
12011 ###
12012 !! test
12013 Sanitizer: Closing of open tags
12014 !! input
12015 <s></s><table></table>
12016 !! result
12017 <s></s><table></table>
12018
12019 !! end
12020
12021 !! test
12022 Sanitizer: Closing of open but not closed tags
12023 !! input
12024 <s>foo
12025 !! result
12026 <p><s>foo</s>
12027 </p>
12028 !! end
12029
12030 !! test
12031 Sanitizer: Closing of closed but not open tags
12032 !! input
12033 </s>
12034 !! result
12035 <p>&lt;/s&gt;
12036 </p>
12037 !! end
12038
12039 !! test
12040 Sanitizer: Closing of closed but not open table tags
12041 !! input
12042 Table not started</td></tr></table>
12043 !! result
12044 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
12045 </p>
12046 !! end
12047
12048 !! test
12049 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
12050 !! input
12051 <span id="æ: v">byte</span>[[#æ: v|backlink]]
12052 !! result
12053 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
12054 </p>
12055 !! end
12056
12057 !! test
12058 Sanitizer: Validating the contents of the id attribute (bug 4515)
12059 !! options
12060 disabled
12061 !! input
12062 <br id=9 />
12063 !! result
12064 Something, but definitely not <br id="9" />...
12065 !! end
12066
12067 !! test
12068 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
12069 !! options
12070 disabled
12071 !! input
12072 <br id="foo" /><br id="foo" />
12073 !! result
12074 Something need to be done. foo-2 ?
12075 !! end
12076
12077 !! test
12078 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
12079 !! input
12080 <div itemscope>
12081 <meta itemprop="hello" content="world">
12082 <meta http-equiv="refresh" content="5">
12083 <meta itemprop="hello" http-equiv="refresh" content="5">
12084 <link itemprop="hello" href="{{SERVER}}">
12085 <link rel="stylesheet" href="{{SERVER}}">
12086 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
12087 </div>
12088 !! result
12089 <div itemscope="itemscope">
12090 <p> <meta itemprop="hello" content="world" />
12091 &lt;meta http-equiv="refresh" content="5"&gt;
12092 <meta itemprop="hello" content="5" />
12093 </p>
12094 <link itemprop="hello" href="http&#58;//example.org" />
12095 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
12096 <link itemprop="hello" href="http&#58;//example.org" />
12097 </div>
12098
12099 !! end
12100
12101 !! test
12102 Language converter: output gets cut off unexpectedly (bug 5757)
12103 !! options
12104 language=zh
12105 !! input
12106 this bit is safe: }-
12107
12108 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
12109
12110 then we get cut off here: }-
12111
12112 all additional text is vanished
12113 !! result
12114 <p>this bit is safe: }-
12115 </p><p>but if we add a conversion instance: xxx
12116 </p><p>then we get cut off here: }-
12117 </p><p>all additional text is vanished
12118 </p>
12119 !! end
12120
12121 !! test
12122 Self closed html pairs (bug 5487)
12123 !! options
12124 !! input
12125 <center><font id="bug" />Centered text</center>
12126 <div><font id="bug2" />In div text</div>
12127 !! result
12128 <center>&lt;font id="bug" /&gt;Centered text</center>
12129 <div>&lt;font id="bug2" /&gt;In div text</div>
12130
12131 !! end
12132
12133 #
12134 #
12135 #
12136
12137 !! test
12138 Punctuation: nbsp before exclamation
12139 !! input
12140 C'est grave !
12141 !! result
12142 <p>C'est grave&#160;!
12143 </p>
12144 !! end
12145
12146 !! test
12147 Punctuation: CSS !important (bug 11874)
12148 !! input
12149 <div style="width:50% !important">important</div>
12150 !! result
12151 <div style="width:50% !important">important</div>
12152
12153 !!end
12154
12155 !! test
12156 Punctuation: CSS ! important (bug 11874; with space after)
12157 !! input
12158 <div style="width:50% ! important">important</div>
12159 !! result
12160 <div style="width:50% ! important">important</div>
12161
12162 !!end
12163
12164
12165 !! test
12166 HTML bullet list, closed tags (bug 5497)
12167 !! input
12168 <ul>
12169 <li>One</li>
12170 <li>Two</li>
12171 </ul>
12172 !! result
12173 <ul>
12174 <li>One</li>
12175 <li>Two</li>
12176 </ul>
12177
12178 !! end
12179
12180 !! test
12181 HTML bullet list, unclosed tags (bug 5497)
12182 !! options
12183 disabled
12184 !! input
12185 <ul>
12186 <li>One
12187 <li>Two
12188 </ul>
12189 !! result
12190 <ul>
12191 <li>One
12192 </li>
12193 <li>Two
12194 </li>
12195 </ul>
12196
12197 !! end
12198
12199 !! test
12200 HTML ordered list, closed tags (bug 5497)
12201 !! input
12202 <ol>
12203 <li>One</li>
12204 <li>Two</li>
12205 </ol>
12206 !! result
12207 <ol>
12208 <li>One</li>
12209 <li>Two</li>
12210 </ol>
12211
12212 !! end
12213
12214 !! test
12215 HTML ordered list, unclosed tags (bug 5497)
12216 !! options
12217 disabled
12218 !! input
12219 <ol>
12220 <li>One
12221 <li>Two
12222 </ol>
12223 !! result
12224 <ol>
12225 <li>One
12226 </li>
12227 <li>Two
12228 </li>
12229 </ol>
12230
12231 !! end
12232
12233 !! test
12234 HTML nested bullet list, closed tags (bug 5497)
12235 !! input
12236 <ul>
12237 <li>One</li>
12238 <li>Two:
12239 <ul>
12240 <li>Sub-one</li>
12241 <li>Sub-two</li>
12242 </ul>
12243 </li>
12244 </ul>
12245 !! result
12246 <ul>
12247 <li>One</li>
12248 <li>Two:
12249 <ul>
12250 <li>Sub-one</li>
12251 <li>Sub-two</li>
12252 </ul>
12253 </li>
12254 </ul>
12255
12256 !! end
12257
12258 !! test
12259 HTML nested bullet list, open tags (bug 5497)
12260 !! options
12261 disabled
12262 !! input
12263 <ul>
12264 <li>One
12265 <li>Two:
12266 <ul>
12267 <li>Sub-one
12268 <li>Sub-two
12269 </ul>
12270 </ul>
12271 !! result
12272 <ul>
12273 <li>One
12274 </li>
12275 <li>Two:
12276 <ul>
12277 <li>Sub-one
12278 </li>
12279 <li>Sub-two
12280 </li>
12281 </ul>
12282 </li>
12283 </ul>
12284
12285 !! end
12286
12287 !! test
12288 HTML nested ordered list, closed tags (bug 5497)
12289 !! input
12290 <ol>
12291 <li>One</li>
12292 <li>Two:
12293 <ol>
12294 <li>Sub-one</li>
12295 <li>Sub-two</li>
12296 </ol>
12297 </li>
12298 </ol>
12299 !! result
12300 <ol>
12301 <li>One</li>
12302 <li>Two:
12303 <ol>
12304 <li>Sub-one</li>
12305 <li>Sub-two</li>
12306 </ol>
12307 </li>
12308 </ol>
12309
12310 !! end
12311
12312 !! test
12313 HTML nested ordered list, open tags (bug 5497)
12314 !! options
12315 disabled
12316 !! input
12317 <ol>
12318 <li>One
12319 <li>Two:
12320 <ol>
12321 <li>Sub-one
12322 <li>Sub-two
12323 </ol>
12324 </ol>
12325 !! result
12326 <ol>
12327 <li>One
12328 </li>
12329 <li>Two:
12330 <ol>
12331 <li>Sub-one
12332 </li>
12333 <li>Sub-two
12334 </li>
12335 </ol>
12336 </li>
12337 </ol>
12338
12339 !! end
12340
12341 !! test
12342 HTML ordered list item with parameters oddity
12343 !! input
12344 <ol><li id="fragment">One</li>
12345 </ol>
12346 !! result
12347 <ol><li id="fragment">One</li>
12348 </ol>
12349
12350 !! end
12351
12352 !!test
12353 bug 5918: autonumbering
12354 !! input
12355 [http://first/] [http://second] [ftp://ftp]
12356
12357 ftp://inlineftp
12358
12359 [mailto:enclosed@mail.tld With target]
12360
12361 [mailto:enclosed@mail.tld]
12362
12363 mailto:inline@mail.tld
12364 !! result
12365 <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>
12366 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
12367 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
12368 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
12369 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
12370 </p>
12371 !! end
12372
12373
12374 #
12375 # Security and HTML correctness
12376 # From Nick Jenkins' fuzz testing
12377 #
12378
12379 !! test
12380 Fuzz testing: Parser13
12381 !! input
12382 {|
12383 | http://a|
12384 !! result
12385 <table>
12386 <tr>
12387 <td>
12388 </td>
12389 </tr>
12390 </table>
12391
12392 !! end
12393
12394 !! test
12395 Fuzz testing: Parser14
12396 !! input
12397 == onmouseover= ==
12398 http://__TOC__
12399 !! result
12400 <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>
12401 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12402 <ul>
12403 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
12404 </ul>
12405 </div>
12406
12407
12408 !! end
12409
12410 !! test
12411 Fuzz testing: Parser14-table
12412 !! input
12413 ==a==
12414 {| STYLE=__TOC__
12415 !! result
12416 <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>
12417 <table style="&#95;_TOC&#95;_">
12418 <tr><td></td></tr>
12419 </table>
12420
12421 !! end
12422
12423 # Known to produce bogus xml (extra </td>)
12424 !! test
12425 Fuzz testing: Parser16
12426 !! options
12427 noxml
12428 !! input
12429 {|
12430 !https://||||||
12431 !! result
12432 <table>
12433 <tr>
12434 <th>https://</th>
12435 <th></th>
12436 <th></th>
12437 <th>
12438 </td>
12439 </tr>
12440 </table>
12441
12442 !! end
12443
12444 !! test
12445 Fuzz testing: Parser21
12446 !! input
12447 {|
12448 ! irc://{{ftp://a" onmouseover="alert('hello world');"
12449 |
12450 !! result
12451 <table>
12452 <tr>
12453 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
12454 </th>
12455 <td>
12456 </td>
12457 </tr>
12458 </table>
12459
12460 !! end
12461
12462 !! test
12463 Fuzz testing: Parser22
12464 !! input
12465 http://===r:::https://b
12466
12467 {|
12468 !!result
12469 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
12470 </p>
12471 <table>
12472 <tr><td></td></tr>
12473 </table>
12474
12475 !! end
12476
12477 # Known to produce bad XML for now
12478 !! test
12479 Fuzz testing: Parser24
12480 !! options
12481 noxml
12482 !! input
12483 {|
12484 {{{|
12485 <u CLASS=
12486 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
12487 <br style="onmouseover='alert(document.cookie);' " />
12488
12489 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
12490 |
12491 !! result
12492 <table>
12493 {{{|
12494 <u class="&#124;">}}}} &gt;
12495 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
12496
12497 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
12498 <tr>
12499 <td></u>
12500 </td>
12501 </tr>
12502 </table>
12503
12504 !! end
12505
12506 # Note: the current result listed for this is not what the original one was,
12507 # but the original bug was JavaScript injection, which is fixed in any case.
12508 # It's not clear that the original result listed was any more correct than the
12509 # current one. Original result:
12510 # <p>{{{|
12511 # </p>
12512 # <li class="&#124;&#124;">
12513 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
12514 !!test
12515 Fuzz testing: Parser25 (bug 6055)
12516 !! input
12517 {{{
12518 |
12519 <LI CLASS=||
12520 >
12521 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
12522 !! result
12523 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
12524 </p>
12525 !! end
12526
12527 !!test
12528 Fuzz testing: URL adjacent extension (with space, clean)
12529 !! options
12530 !! input
12531 http://example.com <nowiki>junk</nowiki>
12532 !! result
12533 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
12534 </p>
12535 !!end
12536
12537 !!test
12538 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
12539 !! options
12540 !! input
12541 http://example.com<nowiki>junk</nowiki>
12542 !! result
12543 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
12544 </p>
12545 !!end
12546
12547 !!test
12548 Fuzz testing: URL adjacent extension (no space, dirty; pre)
12549 !! options
12550 !! input
12551 http://example.com<pre>junk</pre>
12552 !! result
12553 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
12554
12555 !!end
12556
12557 !!test
12558 Fuzz testing: image with bogus manual thumbnail
12559 !!input
12560 [[Image:foobar.jpg|thumbnail= ]]
12561 !!result
12562 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
12563
12564 !!end
12565
12566 !! test
12567 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
12568 !! input
12569 <pre dir="&#10;"></pre>
12570 !! result
12571 <pre dir="&#10;"></pre>
12572
12573 !! end
12574
12575 !! test
12576 Parsing optional HTML elements (Bug 6171)
12577 !! options
12578 !! input
12579 <table>
12580 <tr>
12581 <td> Some tabular data</td>
12582 <td> More tabular data ...
12583 <td> And yet som tabular data</td>
12584 </tr>
12585 </table>
12586 !! result
12587 <table>
12588 <tr>
12589 <td> Some tabular data</td>
12590 <td> More tabular data ...
12591 </td><td> And yet som tabular data</td>
12592 </tr>
12593 </table>
12594
12595 !! end
12596
12597 !! test
12598 Correct handling of <td>, <tr> (Bug 6171)
12599 !! options
12600 !! input
12601 <table>
12602 <tr>
12603 <td> Some tabular data</td>
12604 <td> More tabular data ...</td>
12605 <td> And yet som tabular data</td>
12606 </tr>
12607 </table>
12608 !! result
12609 <table>
12610 <tr>
12611 <td> Some tabular data</td>
12612 <td> More tabular data ...</td>
12613 <td> And yet som tabular data</td>
12614 </tr>
12615 </table>
12616
12617 !! end
12618
12619
12620 !! test
12621 Parsing crashing regression (fr:JavaScript)
12622 !! input
12623 </body></x>
12624 !! result
12625 <p>&lt;/body&gt;&lt;/x&gt;
12626 </p>
12627 !! end
12628
12629 !! test
12630 Inline wiki vs wiki block nesting
12631 !! input
12632 '''Bold paragraph
12633
12634 New wiki paragraph
12635 !! result
12636 <p><b>Bold paragraph</b>
12637 </p><p>New wiki paragraph
12638 </p>
12639 !! end
12640
12641 !! test
12642 Inline HTML vs wiki block nesting
12643 !! options
12644 disabled
12645 !! input
12646 <b>Bold paragraph
12647
12648 New wiki paragraph
12649 !! result
12650 <p><b>Bold paragraph</b>
12651 </p><p>New wiki paragraph
12652 </p>
12653 !! end
12654
12655 # Original result was this:
12656 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
12657 # </p>
12658 # While that might be marginally more intuitive, maybe, the six-apostrophe
12659 # construct is clearly pathological and the result stated here (which is what
12660 # the parser actually does) is about as reasonable as anything.
12661 !!test
12662 Mixing markup for italics and bold
12663 !! options
12664 !! input
12665 '''bold''''''bold''bolditalics'''''
12666 !! result
12667 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
12668 </p>
12669 !! end
12670
12671
12672 !! article
12673 Xyzzyx
12674 !! text
12675 Article for special page transclusion test
12676 !! endarticle
12677
12678 !! test
12679 Special page transclusion
12680 !! options
12681 !! input
12682 {{Special:Prefixindex/Xyzzyx}}
12683 !! result
12684 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
12685
12686 !! end
12687
12688 !! test
12689 Special page transclusion twice (bug 5021)
12690 !! options
12691 !! input
12692 {{Special:Prefixindex/Xyzzyx}}
12693 {{Special:Prefixindex/Xyzzyx}}
12694 !! result
12695 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
12696 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
12697
12698 !! end
12699
12700 !! test
12701 Transclusion of default MediaWiki message
12702 !! input
12703 {{MediaWiki:Mainpage}}
12704 !!result
12705 <p>Main Page
12706 </p>
12707 !! end
12708
12709 !! test
12710 Transclusion of nonexistent MediaWiki message
12711 !! input
12712 {{MediaWiki:Mainpagexxx}}
12713 !!result
12714 <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>
12715 </p>
12716 !! end
12717
12718 !! test
12719 Transclusion of MediaWiki message with underscore
12720 !! input
12721 {{MediaWiki:history_short}}
12722 !! result
12723 <p>History
12724 </p>
12725 !! end
12726
12727 !! test
12728 Transclusion of MediaWiki message with space
12729 !! input
12730 {{MediaWiki:history short}}
12731 !! result
12732 <p>History
12733 </p>
12734 !! end
12735
12736 !! test
12737 Invalid header with following text
12738 !! input
12739 = x = y
12740 !! result
12741 <p>= x = y
12742 </p>
12743 !! end
12744
12745
12746 !! test
12747 Section extraction test (section 0)
12748 !! options
12749 section=0
12750 !! input
12751 start
12752 ==a==
12753 ===aa===
12754 ====aaa====
12755 ==b==
12756 ===ba===
12757 ===bb===
12758 ====bba====
12759 ===bc===
12760 ==c==
12761 ===ca===
12762 !! result
12763 start
12764 !! end
12765
12766 !! test
12767 Section extraction test (section 1)
12768 !! options
12769 section=1
12770 !! input
12771 start
12772 ==a==
12773 ===aa===
12774 ====aaa====
12775 ==b==
12776 ===ba===
12777 ===bb===
12778 ====bba====
12779 ===bc===
12780 ==c==
12781 ===ca===
12782 !! result
12783 ==a==
12784 ===aa===
12785 ====aaa====
12786 !! end
12787
12788 !! test
12789 Section extraction test (section 2)
12790 !! options
12791 section=2
12792 !! input
12793 start
12794 ==a==
12795 ===aa===
12796 ====aaa====
12797 ==b==
12798 ===ba===
12799 ===bb===
12800 ====bba====
12801 ===bc===
12802 ==c==
12803 ===ca===
12804 !! result
12805 ===aa===
12806 ====aaa====
12807 !! end
12808
12809 !! test
12810 Section extraction test (section 3)
12811 !! options
12812 section=3
12813 !! input
12814 start
12815 ==a==
12816 ===aa===
12817 ====aaa====
12818 ==b==
12819 ===ba===
12820 ===bb===
12821 ====bba====
12822 ===bc===
12823 ==c==
12824 ===ca===
12825 !! result
12826 ====aaa====
12827 !! end
12828
12829 !! test
12830 Section extraction test (section 4)
12831 !! options
12832 section=4
12833 !! input
12834 start
12835 ==a==
12836 ===aa===
12837 ====aaa====
12838 ==b==
12839 ===ba===
12840 ===bb===
12841 ====bba====
12842 ===bc===
12843 ==c==
12844 ===ca===
12845 !! result
12846 ==b==
12847 ===ba===
12848 ===bb===
12849 ====bba====
12850 ===bc===
12851 !! end
12852
12853 !! test
12854 Section extraction test (section 5)
12855 !! options
12856 section=5
12857 !! input
12858 start
12859 ==a==
12860 ===aa===
12861 ====aaa====
12862 ==b==
12863 ===ba===
12864 ===bb===
12865 ====bba====
12866 ===bc===
12867 ==c==
12868 ===ca===
12869 !! result
12870 ===ba===
12871 !! end
12872
12873 !! test
12874 Section extraction test (section 6)
12875 !! options
12876 section=6
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 ===bb===
12891 ====bba====
12892 !! end
12893
12894 !! test
12895 Section extraction test (section 7)
12896 !! options
12897 section=7
12898 !! input
12899 start
12900 ==a==
12901 ===aa===
12902 ====aaa====
12903 ==b==
12904 ===ba===
12905 ===bb===
12906 ====bba====
12907 ===bc===
12908 ==c==
12909 ===ca===
12910 !! result
12911 ====bba====
12912 !! end
12913
12914 !! test
12915 Section extraction test (section 8)
12916 !! options
12917 section=8
12918 !! input
12919 start
12920 ==a==
12921 ===aa===
12922 ====aaa====
12923 ==b==
12924 ===ba===
12925 ===bb===
12926 ====bba====
12927 ===bc===
12928 ==c==
12929 ===ca===
12930 !! result
12931 ===bc===
12932 !! end
12933
12934 !! test
12935 Section extraction test (section 9)
12936 !! options
12937 section=9
12938 !! input
12939 start
12940 ==a==
12941 ===aa===
12942 ====aaa====
12943 ==b==
12944 ===ba===
12945 ===bb===
12946 ====bba====
12947 ===bc===
12948 ==c==
12949 ===ca===
12950 !! result
12951 ==c==
12952 ===ca===
12953 !! end
12954
12955 !! test
12956 Section extraction test (section 10)
12957 !! options
12958 section=10
12959 !! input
12960 start
12961 ==a==
12962 ===aa===
12963 ====aaa====
12964 ==b==
12965 ===ba===
12966 ===bb===
12967 ====bba====
12968 ===bc===
12969 ==c==
12970 ===ca===
12971 !! result
12972 ===ca===
12973 !! end
12974
12975 !! test
12976 Section extraction test (nonexistent section 11)
12977 !! options
12978 section=11
12979 !! input
12980 start
12981 ==a==
12982 ===aa===
12983 ====aaa====
12984 ==b==
12985 ===ba===
12986 ===bb===
12987 ====bba====
12988 ===bc===
12989 ==c==
12990 ===ca===
12991 !! result
12992 !! end
12993
12994 !! test
12995 Section extraction test with bogus heading (section 1)
12996 !! options
12997 section=1
12998 !! input
12999 ==a==
13000 ==bogus== not a legal section
13001 ==b==
13002 !! result
13003 ==a==
13004 ==bogus== not a legal section
13005 !! end
13006
13007 !! test
13008 Section extraction test with bogus heading (section 2)
13009 !! options
13010 section=2
13011 !! input
13012 ==a==
13013 ==bogus== not a legal section
13014 ==b==
13015 !! result
13016 ==b==
13017 !! end
13018
13019 !! test
13020 Section extraction test with comment after heading (section 1)
13021 !! options
13022 section=1
13023 !! input
13024 ==a==
13025 ==b== <!-- -->
13026 ==c==
13027 !! result
13028 ==a==
13029 !! end
13030
13031 !! test
13032 Section extraction test with comment after heading (section 2)
13033 !! options
13034 section=2
13035 !! input
13036 ==a==
13037 ==b== <!-- -->
13038 ==c==
13039 !! result
13040 ==b== <!-- -->
13041 !! end
13042
13043 !! test
13044 Section extraction test with bogus <nowiki> heading (section 1)
13045 !! options
13046 section=1
13047 !! input
13048 ==a==
13049 ==bogus== <nowiki>not a legal section</nowiki>
13050 ==b==
13051 !! result
13052 ==a==
13053 ==bogus== <nowiki>not a legal section</nowiki>
13054 !! end
13055
13056 !! test
13057 Section extraction test with bogus <nowiki> heading (section 2)
13058 !! options
13059 section=2
13060 !! input
13061 ==a==
13062 ==bogus== <nowiki>not a legal section</nowiki>
13063 ==b==
13064 !! result
13065 ==b==
13066 !! end
13067
13068
13069 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
13070 # instead of respecting commented sections
13071 !! test
13072 Section extraction prefixed by comment (section 1)
13073 !! options
13074 section=1
13075 !! input
13076 <!-- -->==sec1==
13077 ==sec2==
13078 !!result
13079 ==sec2==
13080 !!end
13081
13082 !! test
13083 Section extraction prefixed by comment (section 2)
13084 !! options
13085 section=2
13086 !! input
13087 <!-- -->==sec1==
13088 ==sec2==
13089 !!result
13090
13091 !!end
13092
13093
13094 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
13095 # instead of respecting HTML-style headings
13096 !! test
13097 Section extraction, mixed wiki and html (section 1)
13098 !! options
13099 section=1
13100 !! input
13101 <h2>unmarked</h2>
13102 unmarked
13103 ==1==
13104 one
13105 ==2==
13106 two
13107 !! result
13108 ==1==
13109 one
13110 !! end
13111
13112 !! test
13113 Section extraction, mixed wiki and html (section 2)
13114 !! options
13115 section=2
13116 !! input
13117 <h2>unmarked</h2>
13118 unmarked
13119 ==1==
13120 one
13121 ==2==
13122 two
13123 !! result
13124 ==2==
13125 two
13126 !! end
13127
13128
13129 # Formerly testing for bug 3342
13130 !! test
13131 Section extraction, heading surrounded by <noinclude>
13132 !! options
13133 section=1
13134 !! input
13135 <noinclude>==unmarked==</noinclude>
13136 ==marked==
13137 !! result
13138 ==marked==
13139 !!end
13140
13141 # Test behavior of bug 19910
13142 !! test
13143 Sectiion with all-equals
13144 !! options
13145 section=2
13146 !! input
13147 ===
13148 The line above must have a trailing space
13149 === <!--
13150 --> <!-- -->
13151 But just in case it doesn't...
13152 !! result
13153 === <!--
13154 --> <!-- -->
13155 But just in case it doesn't...
13156 !! end
13157
13158 !! test
13159 Section replacement test (section 0)
13160 !! options
13161 replace=0,"xxx"
13162 !! input
13163 start
13164 ==a==
13165 ===aa===
13166 ====aaa====
13167 ==b==
13168 ===ba===
13169 ===bb===
13170 ====bba====
13171 ===bc===
13172 ==c==
13173 ===ca===
13174 !! result
13175 xxx
13176
13177 ==a==
13178 ===aa===
13179 ====aaa====
13180 ==b==
13181 ===ba===
13182 ===bb===
13183 ====bba====
13184 ===bc===
13185 ==c==
13186 ===ca===
13187 !! end
13188
13189 !! test
13190 Section replacement test (section 1)
13191 !! options
13192 replace=1,"xxx"
13193 !! input
13194 start
13195 ==a==
13196 ===aa===
13197 ====aaa====
13198 ==b==
13199 ===ba===
13200 ===bb===
13201 ====bba====
13202 ===bc===
13203 ==c==
13204 ===ca===
13205 !! result
13206 start
13207 xxx
13208
13209 ==b==
13210 ===ba===
13211 ===bb===
13212 ====bba====
13213 ===bc===
13214 ==c==
13215 ===ca===
13216 !! end
13217
13218 !! test
13219 Section replacement test (section 2)
13220 !! options
13221 replace=2,"xxx"
13222 !! input
13223 start
13224 ==a==
13225 ===aa===
13226 ====aaa====
13227 ==b==
13228 ===ba===
13229 ===bb===
13230 ====bba====
13231 ===bc===
13232 ==c==
13233 ===ca===
13234 !! result
13235 start
13236 ==a==
13237 xxx
13238
13239 ==b==
13240 ===ba===
13241 ===bb===
13242 ====bba====
13243 ===bc===
13244 ==c==
13245 ===ca===
13246 !! end
13247
13248 !! test
13249 Section replacement test (section 3)
13250 !! options
13251 replace=3,"xxx"
13252 !! input
13253 start
13254 ==a==
13255 ===aa===
13256 ====aaa====
13257 ==b==
13258 ===ba===
13259 ===bb===
13260 ====bba====
13261 ===bc===
13262 ==c==
13263 ===ca===
13264 !! result
13265 start
13266 ==a==
13267 ===aa===
13268 xxx
13269
13270 ==b==
13271 ===ba===
13272 ===bb===
13273 ====bba====
13274 ===bc===
13275 ==c==
13276 ===ca===
13277 !! end
13278
13279 !! test
13280 Section replacement test (section 4)
13281 !! options
13282 replace=4,"xxx"
13283 !! input
13284 start
13285 ==a==
13286 ===aa===
13287 ====aaa====
13288 ==b==
13289 ===ba===
13290 ===bb===
13291 ====bba====
13292 ===bc===
13293 ==c==
13294 ===ca===
13295 !! result
13296 start
13297 ==a==
13298 ===aa===
13299 ====aaa====
13300 xxx
13301
13302 ==c==
13303 ===ca===
13304 !! end
13305
13306 !! test
13307 Section replacement test (section 5)
13308 !! options
13309 replace=5,"xxx"
13310 !! input
13311 start
13312 ==a==
13313 ===aa===
13314 ====aaa====
13315 ==b==
13316 ===ba===
13317 ===bb===
13318 ====bba====
13319 ===bc===
13320 ==c==
13321 ===ca===
13322 !! result
13323 start
13324 ==a==
13325 ===aa===
13326 ====aaa====
13327 ==b==
13328 xxx
13329
13330 ===bb===
13331 ====bba====
13332 ===bc===
13333 ==c==
13334 ===ca===
13335 !! end
13336
13337 !! test
13338 Section replacement test (section 6)
13339 !! options
13340 replace=6,"xxx"
13341 !! input
13342 start
13343 ==a==
13344 ===aa===
13345 ====aaa====
13346 ==b==
13347 ===ba===
13348 ===bb===
13349 ====bba====
13350 ===bc===
13351 ==c==
13352 ===ca===
13353 !! result
13354 start
13355 ==a==
13356 ===aa===
13357 ====aaa====
13358 ==b==
13359 ===ba===
13360 xxx
13361
13362 ===bc===
13363 ==c==
13364 ===ca===
13365 !! end
13366
13367 !! test
13368 Section replacement test (section 7)
13369 !! options
13370 replace=7,"xxx"
13371 !! input
13372 start
13373 ==a==
13374 ===aa===
13375 ====aaa====
13376 ==b==
13377 ===ba===
13378 ===bb===
13379 ====bba====
13380 ===bc===
13381 ==c==
13382 ===ca===
13383 !! result
13384 start
13385 ==a==
13386 ===aa===
13387 ====aaa====
13388 ==b==
13389 ===ba===
13390 ===bb===
13391 xxx
13392
13393 ===bc===
13394 ==c==
13395 ===ca===
13396 !! end
13397
13398 !! test
13399 Section replacement test (section 8)
13400 !! options
13401 replace=8,"xxx"
13402 !! input
13403 start
13404 ==a==
13405 ===aa===
13406 ====aaa====
13407 ==b==
13408 ===ba===
13409 ===bb===
13410 ====bba====
13411 ===bc===
13412 ==c==
13413 ===ca===
13414 !! result
13415 start
13416 ==a==
13417 ===aa===
13418 ====aaa====
13419 ==b==
13420 ===ba===
13421 ===bb===
13422 ====bba====
13423 xxx
13424
13425 ==c==
13426 ===ca===
13427 !!end
13428
13429 !! test
13430 Section replacement test (section 9)
13431 !! options
13432 replace=9,"xxx"
13433 !! input
13434 start
13435 ==a==
13436 ===aa===
13437 ====aaa====
13438 ==b==
13439 ===ba===
13440 ===bb===
13441 ====bba====
13442 ===bc===
13443 ==c==
13444 ===ca===
13445 !! result
13446 start
13447 ==a==
13448 ===aa===
13449 ====aaa====
13450 ==b==
13451 ===ba===
13452 ===bb===
13453 ====bba====
13454 ===bc===
13455 xxx
13456 !! end
13457
13458 !! test
13459 Section replacement test (section 10)
13460 !! options
13461 replace=10,"xxx"
13462 !! input
13463 start
13464 ==a==
13465 ===aa===
13466 ====aaa====
13467 ==b==
13468 ===ba===
13469 ===bb===
13470 ====bba====
13471 ===bc===
13472 ==c==
13473 ===ca===
13474 !! result
13475 start
13476 ==a==
13477 ===aa===
13478 ====aaa====
13479 ==b==
13480 ===ba===
13481 ===bb===
13482 ====bba====
13483 ===bc===
13484 ==c==
13485 xxx
13486 !! end
13487
13488 !! test
13489 Section replacement test with initial whitespace (bug 13728)
13490 !! options
13491 replace=2,"xxx"
13492 !! input
13493 Preformatted initial line
13494 ==a==
13495 ===a===
13496 !! result
13497 Preformatted initial line
13498 ==a==
13499 xxx
13500 !! end
13501
13502
13503 !! test
13504 Section extraction, heading followed by pre with 20 spaces (bug 6398)
13505 !! options
13506 section=1
13507 !! input
13508 ==a==
13509 a
13510 !! result
13511 ==a==
13512 a
13513 !! end
13514
13515 !! test
13516 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
13517 !! options
13518 section=1
13519 !! input
13520 ==a==
13521 a
13522 !! result
13523 ==a==
13524 a
13525 !! end
13526
13527
13528 !! test
13529 Section extraction, <pre> around bogus header (bug 10309)
13530 !! options
13531 noxml section=2
13532 !! input
13533 == Section One ==
13534 <pre>
13535 =======
13536 </pre>
13537
13538 == Section Two ==
13539 stuff
13540 !! result
13541 == Section Two ==
13542 stuff
13543 !! end
13544
13545 !! test
13546 Section replacement, <pre> around bogus header (bug 10309)
13547 !! options
13548 noxml replace=2,"xxx"
13549 !! input
13550 == Section One ==
13551 <pre>
13552 =======
13553 </pre>
13554
13555 == Section Two ==
13556 stuff
13557 !! result
13558 == Section One ==
13559 <pre>
13560 =======
13561 </pre>
13562
13563 xxx
13564 !! end
13565
13566
13567
13568 !! test
13569 Handling of &#x0A; in URLs
13570 !! input
13571 **irc://&#x0A;a
13572 !! result
13573 <ul>
13574 <li><ul>
13575 <li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
13576 </li>
13577 </ul>
13578 </li>
13579 </ul>
13580
13581 !!end
13582
13583 !! test
13584 5 quotes, code coverage +1 line (php)
13585 !! options
13586 php
13587 !! input
13588 '''''
13589 !! result
13590 !! end
13591 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
13592 !! test
13593 5 quotes, code coverage +1 line (parsoid)
13594 !! options
13595 parsoid
13596 !! input
13597 '''''
13598 !! result
13599 <p><b><i></i></b></p>
13600 !! end
13601
13602 !! test
13603 Special:Search page linking.
13604 !! input
13605 {{Special:search}}
13606 !! result
13607 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
13608 </p>
13609 !! end
13610
13611 !! test
13612 Say the magic word
13613 !! options
13614 title=[[Parser test]]
13615 !! input
13616 * {{PAGENAME}}
13617 * {{PAGENAMEE}}
13618 * {{FULLPAGENAME}}
13619 * {{FULLPAGENAMEE}}
13620 * {{BASEPAGENAME}}
13621 * {{BASEPAGENAMEE}}
13622 * {{SUBPAGENAME}}
13623 * {{SUBPAGENAMEE}}
13624 * {{ROOTPAGENAME}}
13625 * {{ROOTPAGENAMEE}}
13626 * {{TALKPAGENAME}}
13627 * {{TALKPAGENAMEE}}
13628 * {{SUBJECTPAGENAME}}
13629 * {{SUBJECTPAGENAMEE}}
13630 * {{NAMESPACEE}}
13631 * {{NAMESPACE}}
13632 * {{NAMESPACENUMBER}}
13633 * {{TALKSPACE}}
13634 * {{TALKSPACEE}}
13635 * {{SUBJECTSPACE}}
13636 * {{SUBJECTSPACEE}}
13637 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
13638 !! result
13639 <ul>
13640 <li> Parser test
13641 </li>
13642 <li> Parser_test
13643 </li>
13644 <li> Parser test
13645 </li>
13646 <li> Parser_test
13647 </li>
13648 <li> Parser test
13649 </li>
13650 <li> Parser_test
13651 </li>
13652 <li> Parser test
13653 </li>
13654 <li> Parser_test
13655 </li>
13656 <li> Parser test
13657 </li>
13658 <li> Parser_test
13659 </li>
13660 <li> Talk:Parser test
13661 </li>
13662 <li> Talk:Parser_test
13663 </li>
13664 <li> Parser test
13665 </li>
13666 <li> Parser_test
13667 </li>
13668 <li>
13669 </li>
13670 <li>
13671 </li>
13672 <li> 0
13673 </li>
13674 <li> Talk
13675 </li>
13676 <li> Talk
13677 </li>
13678 <li>
13679 </li>
13680 <li>
13681 </li>
13682 <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>
13683 </li>
13684 </ul>
13685
13686 !! end
13687 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
13688
13689 !! test
13690 Gallery
13691 !! input
13692 <gallery>
13693 image1.png |
13694 image2.gif|||||
13695
13696 image3|
13697 image4 |300px| centre
13698 image5.svg| http://///////
13699 [[x|xx]]]]
13700 * image6
13701 </gallery>
13702 !! result
13703 <ul class="gallery mw-gallery-traditional">
13704 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13705 <div class="thumb" style="height: 150px;">Image1.png</div>
13706 <div class="gallerytext">
13707 </div>
13708 </div></li>
13709 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13710 <div class="thumb" style="height: 150px;">Image2.gif</div>
13711 <div class="gallerytext">
13712 <p>||||
13713 </p>
13714 </div>
13715 </div></li>
13716 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13717 <div class="thumb" style="height: 150px;">Image3</div>
13718 <div class="gallerytext">
13719 </div>
13720 </div></li>
13721 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13722 <div class="thumb" style="height: 150px;">Image4</div>
13723 <div class="gallerytext">
13724 <p>300px| centre
13725 </p>
13726 </div>
13727 </div></li>
13728 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13729 <div class="thumb" style="height: 150px;">Image5.svg</div>
13730 <div class="gallerytext">
13731 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
13732 </p>
13733 </div>
13734 </div></li>
13735 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13736 <div class="thumb" style="height: 150px;">* image6</div>
13737 <div class="gallerytext">
13738 </div>
13739 </div></li>
13740 </ul>
13741
13742 !! end
13743
13744 !! test
13745 Gallery (with options)
13746 !! input
13747 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
13748 File:Nonexistant.jpg|caption
13749 File:Nonexistant.jpg
13750 image:foobar.jpg|some '''caption''' [[Main Page]]
13751 image:foobar.jpg
13752 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
13753 </gallery>
13754 !! result
13755 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
13756 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
13757 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13758 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
13759 <div class="gallerytext">
13760 <p>caption
13761 </p>
13762 </div>
13763 </div></li>
13764 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13765 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
13766 <div class="gallerytext">
13767 </div>
13768 </div></li>
13769 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13770 <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>
13771 <div class="gallerytext">
13772 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
13773 </p>
13774 </div>
13775 </div></li>
13776 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13777 <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>
13778 <div class="gallerytext">
13779 </div>
13780 </div></li>
13781 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13782 <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>
13783 <div class="gallerytext">
13784 <p>Blabla|blabla.
13785 </p>
13786 </div>
13787 </div></li>
13788 </ul>
13789
13790 !! end
13791
13792 !! test
13793 Gallery with wikitext inside caption
13794 !! input
13795 <gallery>
13796 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
13797 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
13798 </gallery>
13799 !! result
13800 <ul class="gallery mw-gallery-traditional">
13801 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13802 <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>
13803 <div class="gallerytext">
13804 <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>
13805 </p>
13806 </div>
13807 </div></li>
13808 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13809 <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>
13810 <div class="gallerytext">
13811 <p>This is a test template
13812 </p>
13813 </div>
13814 </div></li>
13815 </ul>
13816
13817 !! end
13818
13819 !! test
13820 gallery (with showfilename option)
13821 !! input
13822 <gallery showfilename>
13823 File:Nonexistant.jpg|caption
13824 File:Nonexistant.jpg
13825 image:foobar.jpg|some '''caption''' [[Main Page]]
13826 File:Foobar.jpg
13827 </gallery>
13828 !! result
13829 <ul class="gallery mw-gallery-traditional">
13830 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13831 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13832 <div class="gallerytext">
13833 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
13834 caption
13835 </p>
13836 </div>
13837 </div></li>
13838 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13839 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13840 <div class="gallerytext">
13841 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
13842 </p>
13843 </div>
13844 </div></li>
13845 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13846 <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>
13847 <div class="gallerytext">
13848 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
13849 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
13850 </p>
13851 </div>
13852 </div></li>
13853 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13854 <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>
13855 <div class="gallerytext">
13856 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
13857 </p>
13858 </div>
13859 </div></li>
13860 </ul>
13861
13862 !! end
13863
13864 !! test
13865 Gallery (with namespace-less filenames)
13866 !! input
13867 <gallery>
13868 File:Nonexistant.jpg
13869 Nonexistant.jpg
13870 image:foobar.jpg
13871 foobar.jpg
13872 </gallery>
13873 !! result
13874 <ul class="gallery mw-gallery-traditional">
13875 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13876 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13877 <div class="gallerytext">
13878 </div>
13879 </div></li>
13880 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13881 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13882 <div class="gallerytext">
13883 </div>
13884 </div></li>
13885 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13886 <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>
13887 <div class="gallerytext">
13888 </div>
13889 </div></li>
13890 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13891 <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>
13892 <div class="gallerytext">
13893 </div>
13894 </div></li>
13895 </ul>
13896
13897 !! end
13898
13899 !! test
13900 HTML Hex character encoding (spells the word "JavaScript")
13901 !! input
13902 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
13903 !! result
13904 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
13905 </p>
13906 !! end
13907
13908 !! test
13909 HTML Hex character encoding bogus encoding (bug 26437 regression check)
13910 !! input
13911 &#xsee;&#XSEE;
13912 !! result
13913 <p>&amp;#xsee;&amp;#XSEE;
13914 </p>
13915 !! end
13916
13917 !! test
13918 HTML Hex character encoding mixed case
13919 !! input
13920 &#xEE;&#Xee;
13921 !! result
13922 <p>&#xee;&#xee;
13923 </p>
13924 !! end
13925
13926 !! test
13927 __FORCETOC__ override
13928 !! input
13929 __NEWSECTIONLINK__
13930 __FORCETOC__
13931 !! result
13932 <p><br />
13933 </p>
13934 !! end
13935
13936 !! test
13937 ISBN code coverage
13938 !! input
13939 ISBN 978-0-1234-56&#x20;789
13940 !! result
13941 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
13942 </p>
13943 !! end
13944
13945 !! test
13946 ISBN followed by 5 spaces
13947 !! input
13948 ISBN
13949 !! result
13950 <p>ISBN
13951 </p>
13952 !! end
13953
13954 !! test
13955 Double ISBN
13956 !! input
13957 ISBN ISBN 1234567890
13958 !! result
13959 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
13960 </p>
13961 !! end
13962
13963 !! test
13964 Bug 22905: <abbr> followed by ISBN followed by </a>
13965 !! input
13966 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
13967 !! result
13968 <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>
13969 </p>
13970 !! end
13971
13972 !! test
13973 Double RFC
13974 !! input
13975 RFC RFC 1234
13976 !! result
13977 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
13978 </p>
13979 !! end
13980
13981 !! test
13982 Double RFC with a wiki link
13983 !! input
13984 RFC [[RFC 1234]]
13985 !! result
13986 <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>
13987 </p>
13988 !! end
13989
13990 !! test
13991 RFC code coverage
13992 !! input
13993 RFC 983&#x20;987
13994 !! result
13995 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
13996 </p>
13997 !! end
13998
13999 !! test
14000 Centre-aligned image
14001 !! input
14002 [[Image:foobar.jpg|centre]]
14003 !! result
14004 <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>
14005
14006 !!end
14007
14008 !! test
14009 None-aligned image
14010 !! input
14011 [[Image:foobar.jpg|none]]
14012 !! result
14013 <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>
14014
14015 !!end
14016
14017 !! test
14018 Width + Height sized image (using px) (height is ignored)
14019 !! input
14020 [[Image:foobar.jpg|640x480px]]
14021 !! result
14022 <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>
14023 </p>
14024 !!end
14025
14026 !! test
14027 Width-sized image (using px, no following whitespace)
14028 !! input
14029 [[Image:foobar.jpg|640px]]
14030 !! result
14031 <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>
14032 </p>
14033 !!end
14034
14035 !! test
14036 Width-sized image (using px, with following whitespace - test regression from r39467)
14037 !! input
14038 [[Image:foobar.jpg|640px ]]
14039 !! result
14040 <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>
14041 </p>
14042 !!end
14043
14044 !! test
14045 Width-sized image (using px, with preceding whitespace - test regression from r39467)
14046 !! input
14047 [[Image:foobar.jpg| 640px]]
14048 !! result
14049 <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>
14050 </p>
14051 !!end
14052
14053 !! test
14054 Another italics / bold test
14055 !! input
14056 ''' ''x'
14057 !! result
14058 <pre>'<i> </i>x'
14059 </pre>
14060 !!end
14061
14062 # Note the results may be incorrect, as parserTest output included this:
14063 # XML error: Mismatched tag at byte 6120:
14064 # ...<dd> </dt></dl> </dd...
14065 !! test
14066 dt/dd/dl test
14067 !! options
14068 disabled
14069 !! input
14070 :;;;::
14071 !! result
14072 <dl>
14073 <dd><dl>
14074 <dt><dl>
14075 <dt><dl>
14076 <dt><dl>
14077 <dd><dl>
14078 <dd>
14079 </dd>
14080 </dl>
14081 </dd>
14082 </dl>
14083 </dt>
14084 </dl>
14085 </dt>
14086 </dl>
14087 </dt>
14088 </dl>
14089 </dd>
14090 </dl>
14091
14092 !!end
14093
14094
14095 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
14096 !! test
14097 Images with the "|" character in the comment
14098 !! input
14099 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
14100 !! result
14101 <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>
14102
14103 !!end
14104
14105 !! test
14106 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
14107 !! input
14108 <html><script>alert(1);</script></html>
14109 !! result
14110 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
14111 </p>
14112 !! end
14113
14114 !! test
14115 HTML with raw HTML ($wgRawHtml==true)
14116 !! options
14117 wgRawHtml=1
14118 !! input
14119 <html><script>alert(1);</script></html>
14120 !! result
14121 <p><script>alert(1);</script>
14122 </p>
14123 !! end
14124
14125 !! test
14126 Parents of subpages, one level up
14127 !! options
14128 subpage title=[[Subpage test/L1/L2/L3]]
14129 !! input
14130 [[../|L2]]
14131 !! result
14132 <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>
14133 </p>
14134 !! end
14135
14136
14137 !! test
14138 Parents of subpages, one level up, not named
14139 !! options
14140 subpage title=[[Subpage test/L1/L2/L3]]
14141 !! input
14142 [[../]]
14143 !! result
14144 <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>
14145 </p>
14146 !! end
14147
14148
14149
14150 !! test
14151 Parents of subpages, two levels up
14152 !! options
14153 subpage title=[[Subpage test/L1/L2/L3]]
14154 !! input
14155 [[../../|L1]]2
14156
14157 [[../../|L1]]l
14158 !! result
14159 <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
14160 </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>
14161 </p>
14162 !! end
14163
14164 !! test
14165 Parents of subpages, two levels up, without trailing slash or name.
14166 !! options
14167 subpage title=[[Subpage test/L1/L2/L3]]
14168 !! input
14169 [[../..]]
14170 !! result
14171 <p>[[../..]]
14172 </p>
14173 !! end
14174
14175 !! test
14176 Parents of subpages, two levels up, with lots of extra trailing slashes.
14177 !! options
14178 subpage title=[[Subpage test/L1/L2/L3]]
14179 !! input
14180 [[../../////]]
14181 !! result
14182 <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>
14183 </p>
14184 !! end
14185
14186 !! article
14187 Subpage test/L1/L2/L3Sibling
14188 !! text
14189 Sibling article
14190 !! endarticle
14191
14192 !! test
14193 Transclusion of a sibling page (one level up)
14194 !! options
14195 subpage title=[[Subpage test/L1/L2/L3]]
14196 !! input
14197 {{../L3Sibling}}
14198 !! result
14199 <p>Sibling article
14200 </p>
14201 !! end
14202
14203 !! test
14204 Transclusion of a child page
14205 !! options
14206 subpage title=[[Subpage test/L1/L2]]
14207 !! input
14208 {{/L3Sibling}}
14209 !! result
14210 <p>Sibling article
14211 </p>
14212 !! end
14213
14214 !! test
14215 Non-transclusion because of too many up levels
14216 !! options
14217 subpage title=[[Subpage test/L1/L2/L3]]
14218 !! input
14219 {{../../../../More than parent}}
14220 !! result
14221 <p>{{../../../../More than parent}}
14222 </p>
14223 !! end
14224
14225 !! test
14226 Definition list code coverage
14227 !! input
14228 ; title : def
14229 ; title : def
14230 ;title: def
14231 !! result
14232 <dl>
14233 <dt> title &#160;</dt>
14234 <dd> def
14235 </dd>
14236 <dt> title&#160;</dt>
14237 <dd> def
14238 </dd>
14239 <dt>title</dt>
14240 <dd> def
14241 </dd>
14242 </dl>
14243
14244 !! end
14245
14246 !! test
14247 Don't fall for the self-closing div
14248 !! input
14249 <div>hello world</div/>
14250 !! result
14251 <div>hello world</div>
14252
14253 !! end
14254
14255 !! test
14256 MSGNW magic word
14257 !! input
14258 {{MSGNW:msg}}
14259 !! result
14260 <p>&#91;&#91;:Template:Msg&#93;&#93;
14261 </p>
14262 !! end
14263
14264 !! test
14265 RAW magic word
14266 !! input
14267 {{RAW:QUERTY}}
14268 !! result
14269 <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>
14270 </p>
14271 !! end
14272
14273 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
14274 !! test
14275 Always escape literal '>' in output, not just after '<'
14276 !! input
14277 ><>
14278 !! result
14279 <p>&gt;&lt;&gt;
14280 </p>
14281 !! end
14282
14283 !! test
14284 Template caching
14285 !! input
14286 {{Test}}
14287 {{Test}}
14288 !! result
14289 <p>This is a test template
14290 This is a test template
14291 </p>
14292 !! end
14293
14294
14295 !! article
14296 MediaWiki:Fake
14297 !! text
14298 ==header==
14299 !! endarticle
14300
14301 !! test
14302 Inclusion of !userCanEdit() content
14303 !! input
14304 {{MediaWiki:Fake}}
14305 !! result
14306 <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>
14307
14308 !! end
14309
14310
14311 !! test
14312 Out-of-order TOC heading levels
14313 !! input
14314 ==2==
14315 ======6======
14316 ===3===
14317 =1=
14318 =====5=====
14319 ==2==
14320 !! result
14321 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14322 <ul>
14323 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
14324 <ul>
14325 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
14326 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
14327 </ul>
14328 </li>
14329 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
14330 <ul>
14331 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
14332 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
14333 </ul>
14334 </li>
14335 </ul>
14336 </div>
14337
14338 <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>
14339 <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>
14340 <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>
14341 <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>
14342 <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>
14343 <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>
14344
14345 !! end
14346
14347
14348 !! test
14349 ISBN with a dummy number
14350 !! input
14351 ISBN ---
14352 !! result
14353 <p>ISBN ---
14354 </p>
14355 !! end
14356
14357
14358 !! test
14359 ISBN with space-delimited number
14360 !! input
14361 ISBN 92 9017 032 8
14362 !! result
14363 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
14364 </p>
14365 !! end
14366
14367
14368 !! test
14369 ISBN with multiple spaces, no number
14370 !! input
14371 ISBN foo
14372 !! result
14373 <p>ISBN foo
14374 </p>
14375 !! end
14376
14377
14378 !! test
14379 ISBN length
14380 !! input
14381 ISBN 123456789
14382
14383 ISBN 1234567890
14384
14385 ISBN 12345678901
14386 !! result
14387 <p>ISBN 123456789
14388 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
14389 </p><p>ISBN 12345678901
14390 </p>
14391 !! end
14392
14393
14394 !! test
14395 ISBN with trailing year (bug 8110)
14396 !! input
14397 ISBN 1-234-56789-0 - 2006
14398
14399 ISBN 1 234 56789 0 - 2006
14400 !! result
14401 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
14402 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
14403 </p>
14404 !! end
14405
14406
14407 !! test
14408 anchorencode
14409 !! input
14410 {{anchorencode:foo bar©#%n}}
14411 !! result
14412 <p>foo_bar.C2.A9.23.25n
14413 </p>
14414 !! end
14415
14416 !! test
14417 anchorencode trims spaces
14418 !! input
14419 {{anchorencode: __pretty__please__}}
14420 !! result
14421 <p>pretty_please
14422 </p>
14423 !! end
14424
14425 !! test
14426 anchorencode deals with links
14427 !! input
14428 {{anchorencode: [[hello|world]] [[hi]]}}
14429 !! result
14430 <p>world_hi
14431 </p>
14432 !! end
14433
14434 !! test
14435 anchorencode deals with templates
14436 !! input
14437 {{anchorencode: {{Foo}} }}
14438 !! result
14439 <p>FOO
14440 </p>
14441 !! end
14442
14443 !! test
14444 anchorencode encodes like the TOC generator: (bug 18431)
14445 !! input
14446 === _ +:.3A%3A&&amp;]] ===
14447 {{anchorencode: _ +:.3A%3A&&amp;]] }}
14448 __NOEDITSECTION__
14449 !! result
14450 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
14451 <p>.2B:.3A.253A.26.26.5D.5D
14452 </p>
14453 !! end
14454
14455 !! test
14456 Bug 6200: blockquotes and paragraph formatting
14457 !! input
14458 <blockquote>
14459 foo
14460 </blockquote>
14461
14462 bar
14463
14464 baz
14465 !! result
14466 <blockquote>
14467 <p>foo
14468 </p>
14469 </blockquote>
14470 <p>bar
14471 </p>
14472 <pre>baz
14473 </pre>
14474 !! end
14475
14476 !! test
14477 Bug 8293: Use of center tag ruins paragraph formatting
14478 !! input
14479 <center>
14480 foo
14481 </center>
14482
14483 bar
14484
14485 baz
14486 !! result
14487 <center>
14488 <p>foo
14489 </p>
14490 </center>
14491 <p>bar
14492 </p>
14493 <pre>baz
14494 </pre>
14495 !! end
14496
14497 !!test
14498 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
14499 !!options
14500 php
14501 !!input
14502 <span><s>x</span></s>
14503 !!result
14504 <p><span><s>x&lt;/span&gt;</s></span>
14505 </p>
14506 !!end
14507
14508 !!test
14509 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
14510 !!options
14511 parsoid
14512 !!input
14513 <span><s>x</span></s>
14514 !!result
14515 <p><span><s>x</s></span><s></s>
14516 </p>
14517 !!end
14518
14519 ###
14520 ### Language variants related tests
14521 ###
14522 !! test
14523 Self-link in language variants
14524 !! options
14525 title=[[Dunav]] language=sr
14526 !! input
14527 Both [[Dunav]] and [[Дунав]] are names for this river.
14528 !! result
14529 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
14530 </p>
14531 !!end
14532
14533 !! article
14534 Дуна
14535 !! text
14536 content
14537 !! endarticle
14538
14539 !! test
14540 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
14541 !! options
14542 title=[[Duna]] language=sr
14543 !! input
14544 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
14545 !! result
14546 <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.
14547 </p>
14548 !! end
14549
14550 !! test
14551 Link to a section of a variant of this title shouldn't be parsed as self-link
14552 !! options
14553 title=[[Duna]] language=sr
14554 !! input
14555 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
14556 !! result
14557 <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.
14558 </p>
14559 !! end
14560
14561 !! test
14562 Link to pages in language variants
14563 !! options
14564 language=sr
14565 !! input
14566 Main Page can be written as [[Маин Паге]]
14567 !! result
14568 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
14569 </p>
14570 !!end
14571
14572
14573 !! test
14574 Multiple links to pages in language variants
14575 !! options
14576 language=sr
14577 !! input
14578 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
14579 !! result
14580 <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>.
14581 </p>
14582 !!end
14583
14584
14585 !! test
14586 Simple template in language variants
14587 !! options
14588 language=sr
14589 !! input
14590 {{тест}}
14591 !! result
14592 <p>This is a test template
14593 </p>
14594 !! end
14595
14596
14597 !! test
14598 Template with explicit namespace in language variants
14599 !! options
14600 language=sr
14601 !! input
14602 {{Template:тест}}
14603 !! result
14604 <p>This is a test template
14605 </p>
14606 !! end
14607
14608
14609 !! test
14610 Basic test for template parameter in language variants
14611 !! options
14612 language=sr
14613 !! input
14614 {{парамтест|param=foo}}
14615 !! result
14616 <p>This is a test template with parameter foo
14617 </p>
14618 !! end
14619
14620
14621 !! test
14622 Simple category in language variants
14623 !! options
14624 language=sr cat
14625 !! input
14626 [[Category:МедиаWики Усер'с Гуиде]]
14627 !! result
14628 <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>
14629 !! end
14630
14631
14632 !! article
14633 Category:分类
14634 !! text
14635 blah
14636 !! endarticle
14637
14638 !! article
14639 Category:分類
14640 !! text
14641 blah
14642 !! endarticle
14643
14644 !! test
14645 Don't convert blue categorylinks to another variant (bug 33210)
14646 !! options
14647 language=zh cat
14648 !! input
14649 [[A]][[Category:分类]]
14650 !! result
14651 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
14652 !! end
14653
14654
14655 !! test
14656 Stripping -{}- tags (language variants)
14657 !! options
14658 language=sr
14659 !! input
14660 Latin proverb: -{Ne nuntium necare}-
14661 !! result
14662 <p>Latin proverb: Ne nuntium necare
14663 </p>
14664 !! end
14665
14666
14667 !! test
14668 Prevent conversion with -{}- tags (language variants)
14669 !! options
14670 language=sr variant=sr-ec
14671 !! input
14672 Latinski: -{Ne nuntium necare}-
14673 !! result
14674 <p>Латински: Ne nuntium necare
14675 </p>
14676 !! end
14677
14678
14679 !! test
14680 Prevent conversion of text with -{}- tags (language variants)
14681 !! options
14682 language=sr variant=sr-ec
14683 !! input
14684 Latinski: -{Ne nuntium necare}-
14685 !! result
14686 <p>Латински: Ne nuntium necare
14687 </p>
14688 !! end
14689
14690
14691 !! test
14692 Prevent conversion of links with -{}- tags (language variants)
14693 !! options
14694 language=sr variant=sr-ec
14695 !! input
14696 -{[[Main Page]]}-
14697 !! result
14698 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
14699 </p>
14700 !! end
14701
14702
14703 !! test
14704 -{}- tags within headlines (within html for parserConvert())
14705 !! options
14706 language=sr variant=sr-ec
14707 !! input
14708 == -{Naslov}- ==
14709 !! result
14710 <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>
14711
14712 !! end
14713
14714
14715 !! test
14716 Explicit definition of language variant alternatives
14717 !! options
14718 language=zh variant=zh-tw
14719 !! input
14720 -{zh:China;zh-tw:Taiwan}-, not China
14721 !! result
14722 <p>Taiwan, not China
14723 </p>
14724 !! end
14725
14726
14727 !! test
14728 Conversion around HTML tags
14729 !! options
14730 language=sr variant=sr-ec
14731 !! input
14732 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
14733 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
14734 !! result
14735 <p>
14736 <span title="ЛаCтин">ски</span>
14737 </p>
14738 !! end
14739
14740
14741 !! test
14742 Explicit session-wise language variant mapping (A flag and - flag)
14743 !! options
14744 language=zh variant=zh-tw
14745 !! input
14746 Taiwan is not China.
14747 But -{A|zh:China;zh-tw:Taiwan}- is China,
14748 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
14749 and -{China}- is China.
14750 !! result
14751 <p>Taiwan is not China.
14752 But Taiwan is Taiwan,
14753 (This should be stripped!)
14754 and China is China.
14755 </p>
14756 !! end
14757
14758 !! test
14759 Explicit session-wise language variant mapping (H flag for hide)
14760 !! options
14761 language=zh variant=zh-tw
14762 !! input
14763 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
14764 Taiwan is China.
14765 !! result
14766 <p>(This should be stripped!)
14767 Taiwan is Taiwan.
14768 </p>
14769 !! end
14770
14771 !! test
14772 Adding explicit conversion rule for title (T flag)
14773 !! options
14774 language=zh variant=zh-tw showtitle
14775 !! input
14776 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
14777 !! result
14778 Taiwan
14779 <p>Should be stripped!
14780 </p>
14781 !! end
14782
14783 !! test
14784 Testing that changing the language variant here in the tests actually works
14785 !! options
14786 language=zh variant=zh showtitle
14787 !! input
14788 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
14789 !! result
14790 China
14791 <p>Should be stripped!
14792 </p>
14793 !! end
14794
14795 !! test
14796 Recursive conversion of alt and title attrs shouldn't clear converter state
14797 !! options
14798 language=zh variant=zh-cn showtitle
14799 !! input
14800 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
14801 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
14802 !! result
14803 China
14804 <p>
14805 Should be stripped<span title="Exclamation">!</span>
14806 </p>
14807 !! end
14808
14809 !! test
14810 Bug 24072: more test on conversion rule for title
14811 !! options
14812 language=zh variant=zh-tw showtitle
14813 !! input
14814 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
14815 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
14816 !! result
14817 Taiwan
14818 <p>This should be stripped!
14819 This won't take interferes with the title rule.
14820 </p>
14821 !! end
14822
14823 !! test
14824 Partly disable title conversion if variant == main language code
14825 !! options
14826 language=zh variant=zh title=[[ZH]] showtitle
14827 !! input
14828 -{T|zh-cn:CN;zh-tw:TW}-
14829 !! result
14830 ZH
14831 <p>
14832 </p>
14833 !! end
14834
14835 !! test
14836 Partly disable title conversion if variant == main language code, more
14837 !! options
14838 language=zh variant=zh title=[[ZH]] showtitle
14839 !! input
14840 -{T|TW}-
14841 !! result
14842 ZH
14843 <p>
14844 </p>
14845 !! end
14846
14847 !! test
14848 Raw output of variant escape tags (R flag)
14849 !! options
14850 language=zh variant=zh-tw
14851 !! input
14852 Raw: -{R|zh:China;zh-tw:Taiwan}-
14853 !! result
14854 <p>Raw: zh:China;zh-tw:Taiwan
14855 </p>
14856 !! end
14857
14858 !! test
14859 Nested using of manual convert syntax
14860 !! options
14861 language=zh variant=zh-hk
14862 !! input
14863 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
14864 !! result
14865 <p>Nested: Hello Hong Kong!
14866 </p>
14867 !! end
14868
14869 !! test
14870 Proper conversion of text in external links
14871 !! options
14872 language=sr variant=sr-ec
14873 !! input
14874 http://www.google.com
14875 gopher://www.google.com
14876 [http://www.google.com http://www.google.com]
14877 [gopher://www.google.com gopher://www.google.com]
14878 [https://www.google.com irc://www.google.com]
14879 [ftp://www.google.com www.google.com/ftp://dir]
14880 [//www.google.com www.google.com]
14881 !! result
14882 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
14883 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
14884 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
14885 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
14886 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
14887 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
14888 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
14889 </p>
14890 !! end
14891
14892 !! test
14893 Do not convert roman numbers to language variants
14894 !! options
14895 language=sr variant=sr-ec
14896 !! input
14897 Fridrih IV je car.
14898 !! result
14899 <p>Фридрих IV је цар.
14900 </p>
14901 !! end
14902
14903 !! test
14904 Unclosed language converter markup "-{"
14905 !! options
14906 language=sr
14907 !! input
14908 -{T|hello
14909 !! result
14910 <p>-{T|hello
14911 </p>
14912 !! end
14913
14914 !! test
14915 Don't convert raw rule "-{R|=&gt;}-" to "=>"
14916 !! options
14917 language=sr
14918 !! input
14919 -{R|=&gt;}-
14920 !! result
14921 <p>=&gt;
14922 </p>
14923 !!end
14924
14925 !! test
14926 Bug 529: Uncovered bullet
14927 !! input
14928 * Foo {{bullet}}
14929 !! result
14930 <ul>
14931 <li> Foo
14932 </li>
14933 <li> Bar
14934 </li>
14935 </ul>
14936
14937 !! end
14938
14939 # Plain MediaWiki does not remove empty lists, but tidy actually does.
14940 # Templates in Wikipedia rely on this behavior, as tidy has always been
14941 # enabled there. These tests are normally run *without* tidy, so specify the
14942 # full output here.
14943 # To test realistic parsing behavior, apply a tidy-like transformation to both
14944 # the expected output and your parser's output.
14945 !! test
14946 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
14947 !! input
14948 ******* Foo {{bullet}}
14949 !! result
14950 <ul>
14951 <li><ul>
14952 <li><ul>
14953 <li><ul>
14954 <li><ul>
14955 <li><ul>
14956 <li><ul>
14957 <li> Foo
14958 </li>
14959 </ul>
14960 </li>
14961 </ul>
14962 </li>
14963 </ul>
14964 </li>
14965 </ul>
14966 </li>
14967 </ul>
14968 </li>
14969 </ul>
14970 </li>
14971 <li> Bar
14972 </li>
14973 </ul>
14974
14975 !! end
14976
14977 !! test
14978 Bug 529: Uncovered table already at line-start
14979 !! input
14980 x
14981
14982 {{table}}
14983 y
14984 !! result
14985 <p>x
14986 </p>
14987 <table>
14988 <tr>
14989 <td> 1 </td>
14990 <td> 2
14991 </td></tr>
14992 <tr>
14993 <td> 3 </td>
14994 <td> 4
14995 </td></tr></table>
14996 <p>y
14997 </p>
14998 !! end
14999
15000 !! test
15001 Bug 529: Uncovered bullet in parser function result
15002 !! input
15003 * Foo {{lc:{{bullet}} }}
15004 !! result
15005 <ul>
15006 <li> Foo
15007 </li>
15008 <li> bar
15009 </li>
15010 </ul>
15011
15012 !! end
15013
15014 !! test
15015 Bug 5678: Double-parsed template argument
15016 !! input
15017 {{lc:{{{1}}}|hello}}
15018 !! result
15019 <p>{{{1}}}
15020 </p>
15021 !! end
15022
15023 !! test
15024 Bug 5678: Double-parsed template invocation
15025 !! input
15026 {{lc:{{paramtest {{!}} param = hello }} }}
15027 !! result
15028 <p>{{paramtest | param = hello }}
15029 </p>
15030 !! end
15031
15032 !! test
15033 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
15034 !! options
15035 language=cs
15036 title=[[Main Page]]
15037 !! input
15038 {{PRVNÍVELKÉ:ěščř}}
15039 {{prvnívelké:ěščř}}
15040 {{PRVNÍMALÉ:ěščř}}
15041 {{prvnímalé:ěščř}}
15042 {{MALÁ:ěščř}}
15043 {{malá:ěščř}}
15044 {{VELKÁ:ěščř}}
15045 {{velká:ěščř}}
15046 !! result
15047 <p>Ěščř
15048 Ěščř
15049 ěščř
15050 ěščř
15051 ěščř
15052 ěščř
15053 ĚŠČŘ
15054 ĚŠČŘ
15055 </p>
15056 !! end
15057
15058 !! test
15059 Morwen/13: Unclosed link followed by heading
15060 !! input
15061 [[link
15062 ==heading==
15063 !! result
15064 <p>[[link
15065 </p>
15066 <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>
15067
15068 !! end
15069
15070 !! test
15071 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
15072 !! input
15073 {{foo|
15074 =heading=
15075 !! result
15076 <p>{{foo|
15077 </p>
15078 <h1><span class="mw-headline" id="heading">heading</span></h1>
15079
15080 !! end
15081
15082 !! test
15083 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
15084 !! input
15085 {{foo|
15086 ==heading==
15087 !! result
15088 <p>{{foo|
15089 </p>
15090 <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>
15091
15092 !! end
15093
15094 !! test
15095 Tildes in comments
15096 !! options
15097 pst
15098 !! input
15099 <!-- ~~~~ -->
15100 !! result
15101 <!-- ~~~~ -->
15102 !! end
15103
15104 !! test
15105 Paragraphs inside divs (no extra line breaks)
15106 !! input
15107 <div>Line one
15108
15109 Line two</div>
15110 !! result
15111 <div>Line one
15112 Line two</div>
15113
15114 !! end
15115
15116 !! test
15117 Paragraphs inside divs (extra line break on open)
15118 !! input
15119 <div>
15120 Line one
15121
15122 Line two</div>
15123 !! result
15124 <div>
15125 <p>Line one
15126 </p>
15127 Line two</div>
15128
15129 !! end
15130
15131 !! test
15132 Paragraphs inside divs (extra line break on close)
15133 !! input
15134 <div>Line one
15135
15136 Line two
15137 </div>
15138 !! result
15139 <div>Line one
15140 <p>Line two
15141 </p>
15142 </div>
15143
15144 !! end
15145
15146 !! test
15147 Paragraphs inside divs (extra line break on open and close)
15148 !! input
15149 <div>
15150 Line one
15151
15152 Line two
15153 </div>
15154 !! result
15155 <div>
15156 <p>Line one
15157 </p><p>Line two
15158 </p>
15159 </div>
15160
15161 !! end
15162
15163 !! test
15164 Nesting tags, paragraphs on lines which begin with <div>
15165 !! options
15166 disabled
15167 !! input
15168 <div></div><strong>A
15169 B</strong>
15170 !! result
15171 <div></div>
15172 <p><strong>A
15173 B</strong>
15174 </p>
15175 !! end
15176
15177 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
15178 !! test
15179 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
15180 !! input
15181 <blockquote>Line one
15182
15183 Line two</blockquote>
15184 !! result
15185 <blockquote>Line one
15186 Line two</blockquote>
15187
15188 !! end
15189
15190 !! test
15191 Bug 6200: paragraphs inside blockquotes (extra line break on open)
15192 !! input
15193 <blockquote>
15194 Line one
15195
15196 Line two</blockquote>
15197 !! result
15198 <blockquote>
15199 <p>Line one
15200 </p>
15201 Line two</blockquote>
15202
15203 !! end
15204
15205 !! test
15206 Bug 6200: paragraphs inside blockquotes (extra line break on close)
15207 !! input
15208 <blockquote>Line one
15209
15210 Line two
15211 </blockquote>
15212 !! result
15213 <blockquote>Line one
15214 <p>Line two
15215 </p>
15216 </blockquote>
15217
15218 !! end
15219
15220 !! test
15221 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
15222 !! input
15223 <blockquote>
15224 Line one
15225
15226 Line two
15227 </blockquote>
15228 !! result
15229 <blockquote>
15230 <p>Line one
15231 </p><p>Line two
15232 </p>
15233 </blockquote>
15234
15235 !! end
15236
15237 !! test
15238 Paragraphs inside blockquotes/divs (no extra line breaks)
15239 !! input
15240 <blockquote><div>Line one
15241
15242 Line two</div></blockquote>
15243 !! result
15244 <blockquote><div>Line one
15245 Line two</div></blockquote>
15246
15247 !! end
15248
15249 !! test
15250 Paragraphs inside blockquotes/divs (extra line break on open)
15251 !! input
15252 <blockquote><div>
15253 Line one
15254
15255 Line two</div></blockquote>
15256 !! result
15257 <blockquote><div>
15258 <p>Line one
15259 </p>
15260 Line two</div></blockquote>
15261
15262 !! end
15263
15264 !! test
15265 Paragraphs inside blockquotes/divs (extra line break on close)
15266 !! input
15267 <blockquote><div>Line one
15268
15269 Line two
15270 </div></blockquote>
15271 !! result
15272 <blockquote><div>Line one
15273 <p>Line two
15274 </p>
15275 </div></blockquote>
15276
15277 !! end
15278
15279 !! test
15280 Paragraphs inside blockquotes/divs (extra line break on open and close)
15281 !! input
15282 <blockquote><div>
15283 Line one
15284
15285 Line two
15286 </div></blockquote>
15287 !! result
15288 <blockquote><div>
15289 <p>Line one
15290 </p><p>Line two
15291 </p>
15292 </div></blockquote>
15293
15294 !! end
15295
15296 !! test
15297 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
15298 !! options
15299 wgLinkHolderBatchSize=0
15300 !! input
15301 [[meatball:1]]
15302 [[meatball:2]]
15303 [[meatball:3]]
15304 !! result
15305 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
15306 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
15307 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
15308 </p>
15309 !! end
15310
15311 !! test
15312 Free external link invading image caption
15313 !! input
15314 [[Image:Foobar.jpg|thumb|http://x|hello]]
15315 !! result
15316 <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>
15317
15318 !! end
15319
15320 !! test
15321 Bug 15196: localised external link numbers
15322 !! options
15323 language=fa
15324 !! input
15325 [http://en.wikipedia.org/]
15326 !! result
15327 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
15328 </p>
15329 !! end
15330
15331 !! test
15332 Multibyte character in padleft
15333 !! input
15334 {{padleft:-Hello|7|Æ}}
15335 !! result
15336 <p>Æ-Hello
15337 </p>
15338 !! end
15339
15340 !! test
15341 Multibyte character in padright
15342 !! input
15343 {{padright:Hello-|7|Æ}}
15344 !! result
15345 <p>Hello-Æ
15346 </p>
15347 !! end
15348
15349 !!test
15350 formatdate parser function
15351 !!input
15352 {{#formatdate:2009-03-24}}
15353 !! result
15354 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
15355 </p>
15356 !! end
15357
15358 !!test
15359 formatdate parser function, with default format
15360 !!input
15361 {{#formatdate:2009-03-24|mdy}}
15362 !! result
15363 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
15364 </p>
15365 !! end
15366
15367 !! test
15368 Spacing of numbers in formatted dates
15369 !! input
15370 {{#formatdate:January 15}}
15371 !! result
15372 <p><span class="mw-formatted-date" title="01-15">January 15</span>
15373 </p>
15374 !! end
15375
15376 !! test
15377 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
15378 !! options
15379 language=nl title=[[MediaWiki:Common.css]]
15380 !! input
15381 {{#formatdate:2009-03-24|dmy}}
15382 !! result
15383 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
15384 </p>
15385 !! end
15386
15387 #
15388 #
15389 #
15390
15391 #
15392 # Edit comments
15393 #
15394
15395 !! test
15396 Edit comment with link
15397 !! options
15398 comment
15399 !! input
15400 I like the [[Main Page]] a lot
15401 !! result
15402 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
15403 !!end
15404
15405 !! test
15406 Edit comment with link and link text
15407 !! options
15408 comment
15409 !! input
15410 I like the [[Main Page|best pages]] a lot
15411 !! result
15412 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
15413 !!end
15414
15415 !! test
15416 Edit comment with link and link text with suffix
15417 !! options
15418 comment
15419 !! input
15420 I like the [[Main Page|best page]]s a lot
15421 !! result
15422 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
15423 !!end
15424
15425 !! test
15426 Edit comment with section link (non-local, eg in history list)
15427 !! options
15428 comment title=[[Main Page]]
15429 !! input
15430 /* External links */ removed bogus entries
15431 !! result
15432 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
15433 !!end
15434
15435 !! test
15436 Edit comment with section link and text before it (non-local, eg in history list)
15437 !! options
15438 comment title=[[Main Page]]
15439 !! input
15440 pre-comment text /* External links */ removed bogus entries
15441 !! result
15442 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>
15443 !!end
15444
15445 !! test
15446 Edit comment with section link (local, eg in diff view)
15447 !! options
15448 comment local title=[[Main Page]]
15449 !! input
15450 /* External links */ removed bogus entries
15451 !! result
15452 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
15453 !!end
15454
15455 !! test
15456 Edit comment with subpage link (bug 14080)
15457 !! options
15458 comment
15459 subpage
15460 title=[[Subpage test]]
15461 !! input
15462 Poked at a [[/subpage]] here...
15463 !! result
15464 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
15465 !!end
15466
15467 !! test
15468 Edit comment with subpage link and link text (bug 14080)
15469 !! options
15470 comment
15471 subpage
15472 title=[[Subpage test]]
15473 !! input
15474 Poked at a [[/subpage|neat little page]] here...
15475 !! result
15476 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
15477 !!end
15478
15479 !! test
15480 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
15481 !! options
15482 comment
15483 title=[[Subpage test]]
15484 !! input
15485 Poked at a [[/subpage]] here...
15486 !! result
15487 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...
15488 !!end
15489
15490 !! test
15491 Edit comment with bare anchor link (local, as on diff)
15492 !! options
15493 comment
15494 local
15495 title=[[Main Page]]
15496 !!input
15497 [[#section]]
15498 !! result
15499 <a href="#section">#section</a>
15500 !! end
15501
15502 !! test
15503 Edit comment with bare anchor link (non-local, as on history)
15504 !! options
15505 comment
15506 title=[[Main Page]]
15507 !!input
15508 [[#section]]
15509 !! result
15510 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
15511 !! end
15512
15513 !! test
15514 Anchor starting with underscore
15515 !!input
15516 [[#_ref|One]]
15517 !! result
15518 <p><a href="#_ref">One</a>
15519 </p>
15520 !! end
15521
15522 !! test
15523 Id starting with underscore
15524 !!input
15525 <div id="_ref"></div>
15526 !! result
15527 <div id="_ref"></div>
15528
15529 !! end
15530
15531 !! test
15532 Space normalisation on autocomment (bug 22784)
15533 !! options
15534 comment
15535 title=[[Main Page]]
15536 !!input
15537 /* __hello__world__ */
15538 !! result
15539 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
15540 !! end
15541
15542 !! test
15543 percent-encoding and + signs in comments (Bug 26410)
15544 !! options
15545 comment
15546 !!input
15547 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
15548 !! result
15549 <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>
15550 !! end
15551
15552 !! test
15553 Bad images - basic functionality
15554 !! options
15555 disabled
15556 !! input
15557 [[File:Bad.jpg]]
15558 !! result
15559 !! end
15560
15561 !! test
15562 Bad images - bug 16039: text after bad image disappears
15563 !! options
15564 disabled
15565 !! input
15566 Foo bar
15567 [[File:Bad.jpg]]
15568 Bar foo
15569 !! result
15570 <p>Foo bar
15571 </p><p>Bar foo
15572 </p>
15573 !! end
15574
15575 !! test
15576 Verify that displaytitle works (bug #22501) no displaytitle
15577 !! options
15578 showtitle
15579 !! config
15580 wgAllowDisplayTitle=true
15581 wgRestrictDisplayTitle=false
15582 !! input
15583 this is not the the title
15584 !! result
15585 Parser test
15586 <p>this is not the the title
15587 </p>
15588 !! end
15589
15590 !! test
15591 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
15592 !! options
15593 showtitle
15594 title=[[Screen]]
15595 !! config
15596 wgAllowDisplayTitle=true
15597 wgRestrictDisplayTitle=false
15598 !! input
15599 this is not the the title
15600 {{DISPLAYTITLE:whatever}}
15601 !! result
15602 whatever
15603 <p>this is not the the title
15604 </p>
15605 !! end
15606
15607 !! test
15608 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
15609 !! options
15610 showtitle
15611 title=[[Screen]]
15612 !! config
15613 wgAllowDisplayTitle=true
15614 wgRestrictDisplayTitle=true
15615 !! input
15616 this is not the the title
15617 {{DISPLAYTITLE:whatever}}
15618 !! result
15619 Screen
15620 <p>this is not the the title
15621 </p>
15622 !! end
15623
15624 !! test
15625 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
15626 !! options
15627 showtitle
15628 title=[[Screen]]
15629 !! config
15630 wgAllowDisplayTitle=true
15631 wgRestrictDisplayTitle=true
15632 !! input
15633 this is not the the title
15634 {{DISPLAYTITLE:screen}}
15635 !! result
15636 screen
15637 <p>this is not the the title
15638 </p>
15639 !! end
15640
15641 !! test
15642 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
15643 !! options
15644 showtitle
15645 title=[[Screen]]
15646 !! config
15647 wgAllowDisplayTitle=false
15648 !! input
15649 this is not the the title
15650 {{DISPLAYTITLE:screen}}
15651 !! result
15652 Screen
15653 <p>this is not the the title
15654 <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>
15655 </p>
15656 !! end
15657
15658 !! test
15659 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
15660 !! options
15661 showtitle
15662 title=[[Screen]]
15663 !! config
15664 wgAllowDisplayTitle=false
15665 !! input
15666 this is not the the title
15667 !! result
15668 Screen
15669 <p>this is not the the title
15670 </p>
15671 !! end
15672
15673 !! test
15674 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
15675 !! options
15676 showtitle
15677 title=[[Screen]]
15678 !! config
15679 wgAllowDisplayTitle=true
15680 wgRestrictDisplayTitle=true
15681 !! input
15682 this is not the the title
15683 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
15684 !! result
15685 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
15686 <p>this is not the the title
15687 </p>
15688 !! end
15689
15690 !! test
15691 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
15692 !! options
15693 showtitle
15694 title=[[Screen]]
15695 !! config
15696 wgAllowDisplayTitle=true
15697 wgRestrictDisplayTitle=true
15698 !! input
15699 this is not the the title
15700 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
15701 !! result
15702 <span style="color: red;">s</span>creen
15703 <p>this is not the the title
15704 </p>
15705 !! end
15706
15707 !! test
15708 preload: check <noinclude> and <includeonly>
15709 !! options
15710 preload
15711 !! input
15712 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
15713 !! result
15714 Hello kind world.
15715 !! end
15716
15717 !! test
15718 preload: check <onlyinclude>
15719 !! options
15720 preload
15721 !! input
15722 Goodbye <onlyinclude>Hello world</onlyinclude>
15723 !! result
15724 Hello world
15725 !! end
15726
15727 !! test
15728 preload: can pass tags through if we want to
15729 !! options
15730 preload
15731 !! input
15732 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
15733 !! result
15734 <includeonly>Hello world</includeonly>
15735 !! end
15736
15737 !! test
15738 preload: check that it doesn't try to do tricks
15739 !! options
15740 preload
15741 !! input
15742 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
15743 !! result
15744 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
15745 !! end
15746
15747 !! test
15748 Play a bit with r67090 and bug 3158
15749 !! options
15750 disabled
15751 !! input
15752 <div style="width:50% !important">&nbsp;</div>
15753 <div style="width:50%&nbsp;!important">&nbsp;</div>
15754 <div style="width:50%&#160;!important">&nbsp;</div>
15755 <div style="border : solid;">&nbsp;</div>
15756 !! result
15757 <div style="width:50% !important">&nbsp;</div>
15758 <div style="width:50% !important">&nbsp;</div>
15759 <div style="width:50% !important">&nbsp;</div>
15760 <div style="border&#160;: solid;">&nbsp;</div>
15761
15762 !! end
15763
15764 !! test
15765 HTML5 data attributes
15766 !! input
15767 <span data-foo="bar">Baz</span>
15768 <p data-abc-def_hij="">Quuz</p>
15769 !! result
15770 <p><span data-foo="bar">Baz</span>
15771 </p>
15772 <p data-abc-def_hij="">Quuz</p>
15773
15774 !! end
15775
15776 !! test
15777 percent-encoding and + signs in internal links (Bug 26410)
15778 !! input
15779 [[User:+%]] [[Page+title%]]
15780 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
15781 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
15782 [[%33%45]] [[%33%45+]]
15783 !! result
15784 <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>
15785 <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>
15786 <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>
15787 <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>
15788 </p>
15789 !! end
15790
15791 !! test
15792 Special characters in embedded file links (bug 27679)
15793 !! input
15794 [[File:Contains & ampersand.jpg]]
15795 [[File:Does not exist.jpg|Title with & ampersand]]
15796 !! result
15797 <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>
15798 <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>
15799 </p>
15800 !! end
15801
15802
15803 !! test
15804 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
15805 !! input
15806 Text&apos;s been normalized?
15807 !! result
15808 <p>Text&#39;s been normalized?
15809 </p>
15810 !! end
15811
15812 !! test
15813 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
15814 !! input
15815 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
15816 !! result
15817 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
15818 </p>
15819 !! end
15820
15821 !! test
15822 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
15823 !! input
15824 [http://www.example.org/ ideograms]
15825 !! result
15826 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
15827 </p>
15828 !! end
15829
15830 !! test
15831 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
15832 !! input
15833 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
15834 !! result
15835 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
15836 </p>
15837 !! end
15838
15839 !! article
15840 Mediawiki:loop1
15841 !! text
15842 {{Identical|A}}
15843 !! endarticle
15844
15845 !! article
15846 Mediawiki:loop2
15847 !! text
15848 {{Identical|B}}
15849 !! endarticle
15850
15851 !! article
15852 Template:Identical
15853 !! text
15854 {{int:loop1}}
15855 {{int:loop2}}
15856 !! endarticle
15857
15858 !! test
15859 Bug 31098 Template which includes system messages which includes the template
15860 !! input
15861 {{Identical}}
15862 !! result
15863 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
15864 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
15865 </p>
15866 !! end
15867
15868 !! test
15869 Bug31490 Turkish: ucfirst 'blah'
15870 !! options
15871 language=tr
15872 !! input
15873 {{ucfirst:blah}}
15874 !! result
15875 <p>Blah
15876 </p>
15877 !! end
15878
15879 !! test
15880 Bug31490 Turkish: ucfirst 'ix'
15881 !! options
15882 language=tr
15883 !! input
15884 {{ucfirst:ix}}
15885 !! result
15886 <p>İx
15887 </p>
15888 !! end
15889
15890 !! test
15891 Bug31490 Turkish: lcfirst 'BLAH'
15892 !! options
15893 language=tr
15894 !! input
15895 {{lcfirst:BLAH}}
15896 !! result
15897 <p>bLAH
15898 </p>
15899 !! end
15900
15901 !! test
15902 Bug31490 Turkish: ucfırst (with a dotless i)
15903 !! options
15904 language=tr
15905 !! input
15906 {{ucfırst:blah}}
15907 !! result
15908 <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>
15909 </p>
15910 !! end
15911
15912 !! test
15913 Bug31490 ucfırst (with a dotless i) with English language
15914 !! options
15915 language=en
15916 !! input
15917 {{ucfırst:blah}}
15918 !! result
15919 <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>
15920 </p>
15921 !! end
15922
15923 !! test
15924 Bug 26375: TOC with italics
15925 !! options
15926 title=[[Main Page]]
15927 !! input
15928 __TOC__
15929 == ''Lost'' episodes ==
15930 !! result
15931 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15932 <ul>
15933 <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>
15934 </ul>
15935 </div>
15936
15937 <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>
15938
15939 !! end
15940
15941 !! test
15942 Bug 26375: TOC with bold
15943 !! options
15944 title=[[Main Page]]
15945 !! input
15946 __TOC__
15947 == '''should be bold''' then normal text ==
15948 !! result
15949 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15950 <ul>
15951 <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>
15952 </ul>
15953 </div>
15954
15955 <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>
15956
15957 !! end
15958
15959 !! test
15960 Bug 33845: Headings become cursive in TOC when they contain an image
15961 !! options
15962 title=[[Main Page]]
15963 !! input
15964 __TOC__
15965 == Image [[Image:foobar.jpg]] ==
15966 !! result
15967 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15968 <ul>
15969 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
15970 </ul>
15971 </div>
15972
15973 <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>
15974
15975 !! end
15976
15977 !! test
15978 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
15979 !! options
15980 title=[[Main Page]]
15981 !! input
15982 __TOC__
15983 == <blockquote>Quote</blockquote> ==
15984 !! result
15985 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15986 <ul>
15987 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
15988 </ul>
15989 </div>
15990
15991 <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>
15992
15993 !! end
15994
15995 !! test
15996 Unclosed tags in TOC
15997 !! options
15998 title=[[Main Page]]
15999 !! input
16000 __TOC__
16001 == Proof: 2 < 3 ==
16002 <small>Hanc marginis exiguitas non caperet.</small>
16003 QED
16004 !! result
16005 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16006 <ul>
16007 <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>
16008 </ul>
16009 </div>
16010
16011 <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>
16012 <p><small>Hanc marginis exiguitas non caperet.</small>
16013 QED
16014 </p>
16015 !! end
16016
16017 !! test
16018 Multiple tags in TOC
16019 !! input
16020 __TOC__
16021 == <i>Foo</i> <b>Bar</b> ==
16022
16023 == <i>Foo</i> <blockquote>Bar</blockquote> ==
16024 !! result
16025 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16026 <ul>
16027 <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>
16028 <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>
16029 </ul>
16030 </div>
16031
16032 <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>
16033 <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>
16034
16035 !! end
16036
16037 !! test
16038 Tags with parameters in TOC
16039 !! input
16040 __TOC__
16041 == <sup class="in-h2">Hello</sup> ==
16042
16043 == <sup class="a > b">Evilbye</sup> ==
16044 !! result
16045 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16046 <ul>
16047 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
16048 <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>
16049 </ul>
16050 </div>
16051
16052 <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>
16053 <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>
16054
16055 !! end
16056
16057 !! test
16058 span tags with directionality in TOC
16059 !! input
16060 __TOC__
16061 == <span dir="ltr">C++</span> ==
16062
16063 == <span dir="rtl">זבנג!</span> ==
16064
16065 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
16066
16067 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
16068
16069 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
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="#C.2B.2B"><span class="tocnumber">1</span> <span class="toctext"><span dir="ltr">C++</span></span></a></li>
16074 <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>
16075 <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>
16076 <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>
16077 <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>
16078 </ul>
16079 </div>
16080
16081 <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>
16082 <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>
16083 <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>
16084 <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>
16085 <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>
16086
16087 !! end
16088
16089 !! article
16090 MediaWiki:Bug32057
16091 !! text
16092 == {{int:headline_sample}} ==
16093 !! endarticle
16094
16095 !! test
16096 Bug 32057: Title needed when expanding <h> nodes.
16097 !! options
16098 title=[[Main Page]]
16099 !! input
16100 {{int:Bug32057}}
16101 !! result
16102 <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>
16103
16104 !! end
16105
16106 !! test
16107 Strip marker in urlencode
16108 !! input
16109 {{urlencode:x<nowiki/>y}}
16110 {{urlencode:x<nowiki/>y|wiki}}
16111 {{urlencode:x<nowiki/>y|path}}
16112 !! result
16113 <p>xy
16114 xy
16115 xy
16116 </p>
16117 !! end
16118
16119 !! test
16120 Strip marker in lc
16121 !! input
16122 {{lc:x<nowiki/>y}}
16123 !! result
16124 <p>xy
16125 </p>
16126 !! end
16127
16128 !! test
16129 Strip marker in uc
16130 !! input
16131 {{uc:x<nowiki/>y}}
16132 !! result
16133 <p>XY
16134 </p>
16135 !! end
16136
16137 !! test
16138 Strip marker in formatNum
16139 !! input
16140 {{formatnum:1<nowiki/>2}}
16141 {{formatnum:1<nowiki/>2|R}}
16142 !! result
16143 <p>12
16144 12
16145 </p>
16146 !! end
16147
16148 !! test
16149 Check noCommafy in formatNum
16150 !! options
16151 language=be-tarask
16152 !! input
16153 {{formatnum:123456.78}}
16154 {{formatnum:123456.78|NOSEP}}
16155 !! result
16156 <p>123 456,78
16157 123456.78
16158 </p>
16159 !! end
16160
16161 !! test
16162 Strip marker in grammar
16163 !! options
16164 language=fi
16165 !! input
16166 {{grammar:elative|foo<nowiki/>bar}}
16167 !! result
16168 <p>foobarista
16169 </p>
16170 !! end
16171
16172 !! test
16173 Strip marker in padleft
16174 !! input
16175 {{padleft:|2|x<nowiki/>y}}
16176 !! result
16177 <p>xy
16178 </p>
16179 !! end
16180
16181 !! test
16182 Strip marker in padright
16183 !! input
16184 {{padright:|2|x<nowiki/>y}}
16185 !! result
16186 <p>xy
16187 </p>
16188 !! end
16189
16190 !! test
16191 Strip marker in anchorencode
16192 !! input
16193 {{anchorencode:x<nowiki/>y}}
16194 !! result
16195 <p>xy
16196 </p>
16197 !! end
16198
16199 !! test
16200 nowiki inside link inside heading (bug 18295)
16201 !! input
16202 ==[[foo|x<nowiki>y</nowiki>z]]==
16203 !! result
16204 <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>
16205
16206 !! end
16207
16208 !! test
16209 new support for bdi element (bug 31817)
16210 !! input
16211 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
16212 !! result
16213 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
16214
16215 !!end
16216
16217 !! test
16218 Ignore pipe between table row attributes
16219 !! input
16220 {|
16221 | quux
16222 |- id=foo | style='color: red'
16223 | bar
16224 |}
16225 !! result
16226 <table>
16227 <tr>
16228 <td> quux
16229 </td></tr>
16230 <tr id="foo" style="color: red">
16231 <td> bar
16232 </td></tr></table>
16233
16234 !! end
16235
16236 !!test
16237 Gallery override link with WikiLink (bug 34852)
16238 !! input
16239 <gallery>
16240 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
16241 </gallery>
16242 !! result
16243 <ul class="gallery mw-gallery-traditional">
16244 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16245 <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>
16246 <div class="gallerytext">
16247 <p>caption
16248 </p>
16249 </div>
16250 </div></li>
16251 </ul>
16252
16253 !! end
16254
16255 !!test
16256 Gallery override link with absolute external link (bug 34852)
16257 !! input
16258 <gallery>
16259 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
16260 </gallery>
16261 !! result
16262 <ul class="gallery mw-gallery-traditional">
16263 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16264 <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>
16265 <div class="gallerytext">
16266 <p>caption
16267 </p>
16268 </div>
16269 </div></li>
16270 </ul>
16271
16272 !! end
16273
16274 !!test
16275 Gallery override link with malicious javascript (bug 34852)
16276 !! input
16277 <gallery>
16278 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
16279 </gallery>
16280 !! result
16281 <ul class="gallery mw-gallery-traditional">
16282 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16283 <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>
16284 <div class="gallerytext">
16285 <p>caption
16286 </p>
16287 </div>
16288 </div></li>
16289 </ul>
16290
16291 !! end
16292
16293 !!test
16294 Gallery with invalid title as link (bug 43964)
16295 !! input
16296 <gallery>
16297 File:foobar.jpg|link=<
16298 </gallery>
16299 !! result
16300 <ul class="gallery mw-gallery-traditional">
16301 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16302 <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>
16303 <div class="gallerytext">
16304 </div>
16305 </div></li>
16306 </ul>
16307
16308 !! end
16309
16310 !!test
16311 Language parser function
16312 !! input
16313 {{#language:ar}}
16314 !! result
16315 <p>العربية
16316 </p>
16317 !! end
16318
16319 !!test
16320 Padleft and padright as substr
16321 !! input
16322 {{padleft:|3|abcde}}
16323 {{padright:|3|abcde}}
16324 !! result
16325 <p>abc
16326 abc
16327 </p>
16328 !! end
16329
16330 !!test
16331 Special parser function
16332 !! input
16333 {{#special:RandomPage}}
16334 {{#special:BaDtItLe}}
16335 {{#special:Foobar}}
16336 !! result
16337 <p>Special:Random
16338 Special:Badtitle
16339 Special:Foobar
16340 </p>
16341 !! end
16342
16343 !!test
16344 Bug 34939 - Case insensitive link parsing ([HttP://])
16345 !! input
16346 [HttP://MediaWiki.Org/]
16347 !! result
16348 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
16349 </p>
16350 !! end
16351
16352 !!test
16353 Bug 34939 - Case insensitive link parsing ([HttP:// title])
16354 !! input
16355 [HttP://MediaWiki.Org/ MediaWiki]
16356 !! result
16357 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
16358 </p>
16359 !! end
16360
16361 !!test
16362 Bug 34939 - Case insensitive link parsing (HttP://)
16363 !! input
16364 HttP://MediaWiki.Org/
16365 !! result
16366 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
16367 </p>
16368 !! end
16369
16370 !!test
16371 Disable TOC
16372 !! options
16373 notoc
16374 !! input
16375 Lead
16376 == Section 1 ==
16377 == Section 2 ==
16378 == Section 3 ==
16379 == Section 4 ==
16380 == Section 5 ==
16381 !! result
16382 <p>Lead
16383 </p>
16384
16385 <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>
16386 <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>
16387 <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>
16388 <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>
16389 <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>
16390
16391 !! end
16392
16393
16394 ###
16395 ### Parsoids-specific tests
16396 ### Parsoid-PHP parser incompatibilities
16397 ###
16398 !!test
16399 1. SOL-sensitive wikitext tokens as template-args
16400 !!options
16401 parsoid=wt2html,wt2wt
16402 !!input
16403 {{echo|*a}}
16404 {{echo|#a}}
16405 {{echo|:a}}
16406 !!result
16407 <span about="#mwt1" typeof="mw:Transclusion">
16408 </span><ul about="#mwt1"><li>a</li>
16409 </ul>
16410 <span about="#mwt2" typeof="mw:Transclusion">
16411 </span><ol about="#mwt2"><li>a</li>
16412 </ol>
16413 <span about="#mwt3" typeof="mw:Transclusion">
16414 </span><dl about="#mwt3"><dd>a</dd>
16415 </dl>
16416 !!end
16417
16418 #### ----------------------------------------------------------------
16419 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
16420 #### tags. Parsoid's output for these tags differs from that of the
16421 #### PHP parser.
16422 #### ----------------------------------------------------------------
16423
16424 !!test
16425 Ref: 1. ref-location should be replaced with an index span
16426 !!options
16427 parsoid
16428 !!input
16429 A <ref>foo</ref>
16430 B <ref name="x">foo</ref>
16431 C <ref name="y" />
16432 !!result
16433 <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>
16434 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>
16435 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>
16436 !!end
16437
16438 !!test
16439 Ref: 2. ref-tags with identical names should all get the same index
16440 !!options
16441 parsoid
16442 !!input
16443 A <ref name="x">foo</ref>
16444 B <ref name="x" />
16445 !!result
16446 <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>
16447 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>
16448 !!end
16449
16450 !!test
16451 Ref: 3. spaces in ref-names should be ignored
16452 !!options
16453 parsoid
16454 !!input
16455 A <ref name="x">foo</ref>
16456 B <ref name=" x " />
16457 C <ref name= x />
16458 !!result
16459 <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>
16460 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>
16461 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>
16462 !!end
16463
16464 !!test
16465 Ref: 4. 'constructor' should be accepted as a valid ref-name
16466 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
16467 !!options
16468 parsoid
16469 !!input
16470 A <ref name="constructor">foo</ref>
16471 !!result
16472 <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>
16473 !!end
16474
16475 !!test
16476 Ref: 5. body should accept generic wikitext
16477 !!options
16478 parsoid
16479 !!input
16480 A <ref>
16481 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
16482 </ref>
16483
16484 <references />
16485 !!result
16486 <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>
16487
16488 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
16489 <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>
16490 </li>
16491 </ol>
16492 !!end
16493
16494 !!test
16495 Ref: 6. indent-pres should not be output in ref-body
16496 !!options
16497 parsoid
16498 !!input
16499 A <ref>
16500 foo
16501 bar
16502 baz
16503 </ref>
16504
16505 <references />
16506 !!result
16507 <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>
16508
16509 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
16510 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
16511 bar
16512 baz
16513 </li>
16514 </ol>
16515 !!end
16516
16517 !!test
16518 Ref: 7. No p-wrapping in ref-body
16519 !!options
16520 parsoid
16521 !!input
16522 A <ref>
16523 foo
16524
16525 bar
16526
16527
16528 baz
16529
16530
16531
16532 booz
16533 </ref>
16534
16535 <references />
16536 !!result
16537 <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>
16538
16539 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
16540 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
16541
16542 bar
16543
16544
16545 baz
16546
16547
16548
16549 booz
16550 </li>
16551 </ol>
16552 !!end
16553
16554 !!test
16555 Ref: 8. transclusion wikitext has lower precedence
16556 !!options
16557 parsoid
16558 !!input
16559 A <ref> foo {{echo|</ref> B C}}
16560
16561 <references />
16562 !!result
16563 <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>
16564 <ol class="references" typeof="mw:Extension/references" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
16565 <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>
16566 </ol>
16567 !!end
16568
16569 !!test
16570 Ref: 9. unclosed comments should not leak out of ref-body
16571 !!options
16572 parsoid
16573 !!input
16574 A <ref> foo <!--</ref> B C
16575 <references />
16576 !!result
16577 <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>
16578 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
16579 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo </li>
16580 </ol>
16581 !!end
16582
16583 !!test
16584 Ref: 10. Unclosed HTML tags should not leak out of ref-body
16585 !!options
16586 parsoid
16587 !!input
16588 A <ref> <b> foo </ref> B C
16589
16590 <references />
16591 !!result
16592 <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>
16593
16594
16595 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references />","dsr":[28,42,2,2]}' data-mw='{"name":"references","attrs":{}}'>
16596 <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>
16597 </ol>
16598 !!end
16599
16600 !!test
16601 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
16602 !!options
16603 parsoid
16604 !!input
16605 A <ref>foo</ref> B
16606 C <ref>bar</ref> D
16607 !!result
16608 <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
16609 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>
16610 !!end
16611
16612 !!test
16613 Ref: 12. ref-tags act as trailing newline migration barrier
16614 !!options
16615 parsoid
16616 !!input
16617 <!--the newline at the end of this line moves out of the p-tag-->a
16618
16619 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
16620 <ref />
16621
16622 c
16623 !!result
16624 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
16625
16626
16627 <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>
16628 <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>
16629
16630
16631 <p>c</p>
16632 !!end
16633
16634 !!test
16635 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
16636 !!options
16637 parsoid
16638 !!input
16639 <ref>foo</ref> A
16640 <ref>bar
16641 </ref> B
16642 !!result
16643 <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
16644 <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>
16645 !!end
16646
16647 !!test
16648 Ref: 14. A nested ref-tag should be emitted as plain text
16649 !!options
16650 parsoid
16651 !!input
16652 <ref>foo <ref>bar</ref> baz</ref>
16653
16654 <references />
16655 !!result
16656 <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>
16657
16658 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-parsoid='{"src":"&lt;references />","dsr":[35,49,2,2]}' data-mw='{"name":"references","attrs":{}}'>
16659 <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>
16660 </ol>
16661 !!end
16662
16663 !!test
16664 Ref: 15. ref-tags with identical names should get identical indexes
16665 !!options
16666 parsoid
16667 !!input
16668 A1 <ref name="a">foo</ref> A2 <ref name="a" />
16669 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
16670
16671 <references />
16672 !!result
16673 <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>
16674 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>
16675
16676 <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>
16677 </ol>
16678 !!end
16679
16680 !!test
16681 References: 1. references tag without any refs should be handled properly
16682 !!options
16683 parsoid
16684 !!input
16685 <references />
16686 !!result
16687 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
16688 !!end
16689
16690 !!test
16691 References: 2. references tag with group only outputs references from that group
16692 !!options
16693 parsoid
16694 !!input
16695 A <ref group="a">foo</ref>
16696 B <ref group="b">bar</ref>
16697
16698 <references group='a' />
16699 !!result
16700 <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>
16701 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>
16702
16703 <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>
16704 </ol>
16705 !!end
16706
16707 !!test
16708 References: 3. ref list should be cleared after processing references
16709 !!options
16710 parsoid
16711 !!input
16712 A <ref>foo</ref>
16713
16714 <references />
16715
16716 B <ref>bar</ref>
16717
16718 <references />
16719 !!result
16720 <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>
16721
16722 <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>
16723 </ol>
16724
16725 <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>
16726
16727 <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>
16728 </ol>
16729 !!end
16730
16731 !!test
16732 References: 4. only referenced group should be cleared after processing references
16733 !!options
16734 parsoid
16735 !!input
16736 A <ref group="a">afoo</ref>
16737 B <ref>bfoo</ref>
16738
16739 <references group="a"/>
16740
16741 C <ref>cfoo</ref>
16742
16743 <references />
16744 !!result
16745 <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>
16746 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>
16747
16748 <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>
16749 </ol>
16750
16751 <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>
16752
16753 <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>
16754 </ol>
16755 !!end
16756
16757 !!test
16758 References: 5. ref tags in references should be processed while ignoring all other content
16759 !!options
16760 parsoid
16761 !!input
16762 A <ref name="a" />
16763 B <ref name="b">bar</ref>
16764
16765 <references>
16766 <ref name="a">foo</ref>
16767 This should just get lost.
16768 </references>
16769 !!result
16770 <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>
16771 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>
16772
16773
16774 <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":{}}'>
16775 <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>
16776 <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>
16777 </ol>
16778 !!end
16779
16780 !!test
16781 References: 6. <references /> from a transclusion
16782 !!options
16783 parsoid
16784 !!input
16785 {{echo|<references />}}
16786 !!result
16787 <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>
16788 !!end
16789
16790 !! test
16791 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
16792 !! options
16793 parsoid
16794 !! input
16795 A <ref>foo bar for a</ref>
16796 B <ref name="b" />
16797
16798 <references />
16799
16800 <references>
16801 <ref name="b">foo</ref>
16802 </references>
16803 !! result
16804 <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>
16805 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>
16806
16807
16808 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-parsoid='{"src":"&lt;references />","dsr":[47,61,2,2]}' data-mw='{"name":"references","attrs":{}}'>
16809 <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>
16810 <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>
16811
16812
16813 <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":{}}'>
16814 <li about="#cite_note-b-1" id="cite_note-b-1" data-parsoid="{}"><span rel="mw:referencedBy">↑</span> foo</li>
16815 </ol>
16816 !! end
16817
16818 #### ----------------------------------------------------------------
16819 #### The following section of tests are primarily to test
16820 #### wikitext escaping capabilities of Parsoid. Given that
16821 #### escaping can be done any number of ways, the wikitext (input)
16822 #### is always adjusted to reflect how Parsoid adds nowiki
16823 #### escape tags.
16824 ####
16825 #### We are marking several tests as parsoid-only since the
16826 #### HTML in the result section is different from what the
16827 #### PHP parser generates for it.
16828 #### ----------------------------------------------------------------
16829
16830
16831 #### --------------- Headings ---------------
16832 #### 0. Unnested
16833 #### 1. Nested inside html <h1>=foo=</h1>
16834 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
16835 #### 3. Nested inside html with wikitext split by html tags
16836 #### 4. No escape needed
16837 #### 5. Empty headings <h1></h1>
16838 #### 6. Heading chars in SOL context
16839 #### ----------------------------------------
16840 !! test
16841 Headings: 0. Unnested
16842 !! options
16843 parsoid
16844 !! input
16845 <nowiki>=foo=</nowiki>
16846
16847 <nowiki> =foo= </nowiki>
16848 <!--cmt-->
16849 <nowiki>=foo=</nowiki>
16850
16851 =foo''a''<nowiki>=</nowiki>
16852 !! result
16853 <p><span typeof="mw:Nowiki">=foo=</span></p>
16854
16855 <p><span typeof="mw:Nowiki"> =foo= </span>
16856 <!--cmt-->
16857 <span typeof="mw:Nowiki">=foo=</span></p>
16858
16859 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
16860 !!end
16861
16862 !! test
16863 Headings: 1. Nested inside html
16864 !! options
16865 parsoid
16866 !! input
16867 =<nowiki>=foo=</nowiki>=
16868
16869 ==<nowiki>=foo=</nowiki>==
16870
16871 ===<nowiki>=foo=</nowiki>===
16872
16873 ====<nowiki>=foo=</nowiki>====
16874
16875 =====<nowiki>=foo=</nowiki>=====
16876
16877 ======<nowiki>=foo=</nowiki>======
16878 !! result
16879 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
16880 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
16881 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
16882 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
16883 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
16884 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
16885 !!end
16886
16887 !! test
16888 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
16889 !! options
16890 parsoid
16891 !! input
16892 =foo=
16893 <nowiki>*</nowiki>bar
16894
16895 =foo=
16896 =bar
16897
16898 =foo=
16899 <nowiki>=bar=</nowiki>
16900 !! result
16901 <h1>foo</h1>*bar
16902 <h1>foo</h1>=bar
16903 <h1>foo</h1>=bar=
16904 !!end
16905
16906 !! test
16907 Headings: 3. Nested inside html with wikitext split by html tags
16908 !! options
16909 parsoid
16910 !! input
16911 =='''bold'''<nowiki>foo=</nowiki>=
16912 !! result
16913 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
16914 !!end
16915
16916 !! test
16917 Headings: 4a. No escaping needed (testing just h1 and h2)
16918 !! options
16919 parsoid
16920 !! input
16921 ==foo=
16922
16923 =foo==
16924
16925 = =foo= =
16926
16927 ==foo= bar=
16928
16929 ===foo==
16930
16931 ==foo===
16932
16933 =''=''foo==
16934
16935 =<nowiki>=</nowiki>=
16936 !! result
16937 <h1>=foo</h1>
16938 <h1>foo=</h1>
16939 <h1> =foo= </h1>
16940 <h1>=foo= bar</h1>
16941 <h2>=foo</h2>
16942 <h2>foo=</h2>
16943 <h1><i>=</i>foo=</h1>
16944 <h1><span typeof="mw:Nowiki">=</span></h1>
16945 !!end
16946
16947 !! test
16948 Headings: 4b. No escaping needed (inside p-tags)
16949 !! options
16950 parsoid
16951 !! input
16952 ===
16953 =foo= x
16954 =foo= <s></s>
16955 !! result
16956 <p>===
16957 =foo= x
16958 =foo= <s></s>
16959 </p>
16960 !!end
16961
16962 !! test
16963 Headings: 5. Empty headings
16964 !! options
16965 parsoid
16966 !! input
16967 =<nowiki/>=
16968
16969 ==<nowiki/>==
16970
16971 ===<nowiki/>===
16972
16973 ====<nowiki/>====
16974
16975 =====<nowiki/>=====
16976
16977 ======<nowiki/>======
16978 !! result
16979 <h1></h1>
16980 <h2></h2>
16981 <h3></h3>
16982 <h4></h4>
16983 <h5></h5>
16984 <h6></h6>
16985 !!end
16986
16987 !! test
16988 Headings: 6a. Heading chars in SOL context (with trailing spaces)
16989 !! options
16990 parsoid
16991 !! input
16992 <nowiki>=a=</nowiki>
16993
16994 <nowiki>=a=</nowiki>
16995
16996 <nowiki>=a=</nowiki>
16997
16998 <nowiki>=a=</nowiki>
16999 !! result
17000 <p>=a=</p>
17001 <p>=a= </p>
17002 <p>=a= </p>
17003 <p>=a= </p>
17004 !!end
17005
17006 !! test
17007 Headings: 6b. Heading chars in SOL context (with trailing newlines)
17008 !! options
17009 parsoid
17010 !! input
17011 <nowiki>=a=
17012 b</nowiki>
17013
17014 <nowiki>=a=
17015 b</nowiki>
17016
17017 <nowiki>=a=
17018 b</nowiki>
17019
17020 <nowiki>=a=
17021 b</nowiki>
17022 !! result
17023 <p>=a=
17024 b</p>
17025 <p>=a=
17026 b</p>
17027 <p>=a=
17028 b</p>
17029 <p>=a=
17030 b</p>
17031 </p>
17032 !!end
17033
17034 !! test
17035 Headings: 6c. Heading chars in SOL context (leading newline break)
17036 !! options
17037 parsoid
17038 !! input
17039 a
17040 <nowiki>=b=</nowiki>
17041 !! result
17042 <p>a
17043 =b=</p>
17044 !!end
17045
17046 !! test
17047 Headings: 6d. Heading chars in SOL context (with interspersed comments)
17048 !! options
17049 parsoid
17050 !! input
17051 <!--c0--><nowiki>=a=</nowiki>
17052 <!--c1-->
17053 <nowiki>=a=</nowiki> <!--c2--> <!--c3-->
17054 !! result
17055 <p><!--c0-->=a=</p>
17056 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
17057 !!end
17058
17059 !! test
17060 Headings: 6d. Heading chars in SOL context (No escaping needed)
17061 !! options
17062 parsoid=html2wt
17063 !! input
17064 =a=<div>b</div>
17065 !! result
17066 =a=<div>b</div>
17067 !!end
17068
17069 #### --------------- Lists ---------------
17070 #### 0. Outside nests (*foo, etc.)
17071 #### 1. Nested inside html <ul><li>*foo</li></ul>
17072 #### 2. Inside definition lists
17073 #### 3. Only bullets at start should be escaped
17074 #### 4. No escapes needed
17075 #### 5. No unnecessary escapes
17076 #### 6. Escape bullets in SOL position
17077 #### 7. Escape bullets in a multi-line context
17078 #### ----------------------------------------
17079
17080 !! test
17081 Lists: 0. Outside nests
17082 !! input
17083 <nowiki>*</nowiki>foo
17084
17085 <nowiki>#</nowiki>foo
17086 !! result
17087 <p>*foo
17088 </p><p>#foo
17089 </p>
17090 !!end
17091
17092 !! test
17093 Lists: 1. Nested inside html
17094 !! input
17095 *<nowiki>*foo</nowiki>
17096
17097 *<nowiki>#foo</nowiki>
17098
17099 *<nowiki>:foo</nowiki>
17100
17101 *<nowiki>;foo</nowiki>
17102
17103 #<nowiki>*foo</nowiki>
17104
17105 #<nowiki>#foo</nowiki>
17106
17107 #<nowiki>:foo</nowiki>
17108
17109 #<nowiki>;foo</nowiki>
17110 !! result
17111 <ul>
17112 <li>*foo
17113 </li>
17114 </ul>
17115 <ul>
17116 <li>#foo
17117 </li>
17118 </ul>
17119 <ul>
17120 <li>:foo
17121 </li>
17122 </ul>
17123 <ul>
17124 <li>;foo
17125 </li>
17126 </ul>
17127 <ol>
17128 <li>*foo
17129 </li>
17130 </ol>
17131 <ol>
17132 <li>#foo
17133 </li>
17134 </ol>
17135 <ol>
17136 <li>:foo
17137 </li>
17138 </ol>
17139 <ol>
17140 <li>;foo
17141 </li>
17142 </ol>
17143
17144 !!end
17145
17146 !! test
17147 Lists: 2. Inside definition lists
17148 !! input
17149 ;<nowiki>;foo</nowiki>
17150
17151 ;<nowiki>:foo</nowiki>
17152
17153 ;<nowiki>:foo</nowiki>
17154 :bar
17155
17156 :<nowiki>:foo</nowiki>
17157 !! result
17158 <dl>
17159 <dt>;foo
17160 </dt>
17161 </dl>
17162 <dl>
17163 <dt>:foo
17164 </dt>
17165 </dl>
17166 <dl>
17167 <dt>:foo
17168 </dt>
17169 <dd>bar
17170 </dd>
17171 </dl>
17172 <dl>
17173 <dd>:foo
17174 </dd>
17175 </dl>
17176
17177 !!end
17178
17179 !! test
17180 Lists: 3. Only bullets at start of text should be escaped
17181 !! input
17182 *<nowiki>*foo*bar</nowiki>
17183
17184 *<nowiki>*foo</nowiki>''it''*bar
17185 !! result
17186 <ul>
17187 <li>*foo*bar
17188 </li>
17189 </ul>
17190 <ul>
17191 <li>*foo<i>it</i>*bar
17192 </li>
17193 </ul>
17194
17195 !!end
17196
17197 !! test
17198 Lists: 4. No escapes needed
17199 !! options
17200 parsoid
17201 !! input
17202 *foo*bar
17203
17204 *''foo''*bar
17205
17206 *[[Foo]]: bar
17207 !! result
17208 <ul>
17209 <li>foo*bar
17210 </li>
17211 </ul>
17212 <ul>
17213 <li><i>foo</i>*bar
17214 </li>
17215 </ul>
17216 <ul>
17217 <li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
17218 </li>
17219 </ul>
17220 !!end
17221
17222 !! test
17223 Lists: 5. No unnecessary escapes
17224 !! input
17225 * bar <span><nowiki>[[foo]]</nowiki></span>
17226
17227 *=bar <span><nowiki>[[foo]]</nowiki></span>
17228
17229 *[[bar <span><nowiki>[[foo]]</nowiki></span>
17230
17231 *]]bar <span><nowiki>[[foo]]</nowiki></span>
17232
17233 *=bar <span>foo]]</span>=
17234
17235 * <s></s>: a
17236 !! result
17237 <ul>
17238 <li> bar <span>[[foo]]</span>
17239 </li>
17240 </ul>
17241 <ul>
17242 <li>=bar <span>[[foo]]</span>
17243 </li>
17244 </ul>
17245 <ul>
17246 <li>[[bar <span>[[foo]]</span>
17247 </li>
17248 </ul>
17249 <ul>
17250 <li>]]bar <span>[[foo]]</span>
17251 </li>
17252 </ul>
17253 <ul>
17254 <li>=bar <span>foo]]</span>=
17255 </li>
17256 </ul>
17257 <ul>
17258 <li> <s></s>: a
17259 </li>
17260 </ul>
17261
17262 !!end
17263
17264 !! test
17265 Lists: 6. Escape bullets in SOL position
17266 !! options
17267 parsoid
17268 !! input
17269 <!--cmt--><nowiki>*foo</nowiki>
17270 !! result
17271 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
17272 !!end
17273
17274 !! test
17275 Lists: 7. Escape bullets in a multi-line context
17276 !! input
17277 a
17278 <nowiki>*</nowiki>b
17279 !! result
17280 <p>a
17281 *b
17282 </p>
17283 !!end
17284
17285 #### --------------- HRs ---------------
17286 #### 1. Single line
17287 #### -----------------------------------
17288
17289 !! test
17290 HRs: 1. Single line
17291 !! options
17292 parsoid
17293 !! input
17294 ----<nowiki>----</nowiki>
17295 ----=foo=
17296 ----*foo
17297 !! result
17298 <hr><span typeof="mw:Nowiki">----</span>
17299 <hr>=foo=
17300 <hr>*foo
17301 !! end
17302
17303 #### --------------- Tables ---------------
17304 #### 1a. Simple example
17305 #### 1b. No escaping needed (!foo)
17306 #### 1c. No escaping needed (|foo)
17307 #### 1d. No escaping needed (|}foo)
17308 ####
17309 #### 2a. Nested in td (<td>foo|bar</td>)
17310 #### 2b. Nested in td (<td>foo||bar</td>)
17311 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
17312 ####
17313 #### 3a. Nested in th (<th>foo!bar</th>)
17314 #### 3b. Nested in th (<th>foo!!bar</th>)
17315 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
17316 ####
17317 #### 4a. Escape -
17318 #### 4b. Escape +
17319 #### 4c. No escaping needed
17320 #### --------------------------------------
17321
17322 !! test
17323 Tables: 1a. Simple example
17324 !! input
17325 <nowiki>{|
17326 |}</nowiki>
17327 !! result
17328 <p>{|
17329 |}
17330 </p>
17331 !! end
17332
17333 !! test
17334 Tables: 1b. No escaping needed
17335 !! input
17336 !foo
17337 !! result
17338 <p>!foo
17339 </p>
17340 !! end
17341
17342 !! test
17343 Tables: 1c. No escaping needed
17344 !! input
17345 |foo
17346 !! result
17347 <p>|foo
17348 </p>
17349 !! end
17350
17351 !! test
17352 Tables: 1d. No escaping needed
17353 !! input
17354 |}foo
17355 !! result
17356 <p>|}foo
17357 </p>
17358 !! end
17359
17360 !! test
17361 Tables: 2a. Nested in td
17362 !! options
17363 parsoid
17364 !! input
17365 {|
17366 |<nowiki>foo|bar</nowiki>
17367 |}
17368 !! result
17369 <table><tbody><tr>
17370 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
17371 !! end
17372
17373 !! test
17374 Tables: 2b. Nested in td
17375 !! options
17376 parsoid
17377 !! input
17378 {|
17379 |<nowiki>foo||bar</nowiki>
17380 |''it''<nowiki>foo||bar</nowiki>
17381 |}
17382 !! result
17383 <table><tbody><tr>
17384 <td><span typeof="mw:Nowiki">foo||bar</span></td>
17385 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
17386 !! end
17387
17388 !! test
17389 Tables: 2c. Nested in td -- no escaping needed
17390 !! options
17391 parsoid
17392 !! input
17393 {|
17394 |foo!!bar
17395 |}
17396 !! result
17397 <table><tbody><tr><td>foo!!bar
17398 </td></tr></tbody></table>
17399
17400 !! end
17401
17402 !! test
17403 Tables: 3a. Nested in th
17404 !! options
17405 parsoid
17406 !! input
17407 {|
17408 !foo!bar
17409 |}
17410 !! result
17411 <table><tbody><tr><th>foo!bar
17412 </th></tr></tbody></table>
17413
17414 !! end
17415
17416 !! test
17417 Tables: 3b. Nested in th
17418 !! options
17419 parsoid
17420 !! input
17421 {|
17422 !<nowiki>foo!!bar</nowiki>
17423 |}
17424 !! result
17425 <table>
17426 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
17427 </tbody></table>
17428 !! end
17429
17430 !! test
17431 Tables: 3c. Nested in th -- no escaping needed
17432 !! options
17433 parsoid
17434 !! input
17435 {|
17436 !<nowiki>foo||bar</nowiki>
17437 |}
17438 !! result
17439 <table><tbody><tr>
17440 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
17441 !! end
17442
17443 !! test
17444 Tables: 4a. Escape -
17445 !! options
17446 parsoid
17447 !! input
17448 {|
17449 !-bar
17450 |-
17451 |<nowiki>-bar</nowiki>
17452 |}
17453 !! result
17454 <table><tbody>
17455 <tr><th>-bar</th></tr>
17456 <tr>
17457 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
17458 !! end
17459
17460 !! test
17461 Tables: 4b. Escape +
17462 !! options
17463 parsoid
17464 !! input
17465 {|
17466 !+bar
17467 |-
17468 |<nowiki>+bar</nowiki>
17469 |}
17470 !! result
17471 <table><tbody>
17472 <tr><th>+bar</th></tr>
17473 <tr>
17474 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
17475 !! end
17476
17477 !! test
17478 Tables: 4c. No escaping needed
17479 !! options
17480 parsoid
17481 !! input
17482 {|
17483 |foo-bar
17484 |foo+bar
17485 |-
17486 |''foo''-bar
17487 |''foo''+bar
17488 |-
17489 |foo
17490 bar|baz
17491 +bar
17492 -bar
17493 |}
17494 !! result
17495 <table><tbody>
17496 <tr><td>foo-bar</td><td>foo+bar</td></tr>
17497 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
17498 <tr><td>foo
17499 <p>bar|baz
17500 +bar
17501 -bar</p></td></tr>
17502 </tbody></table>
17503 !! end
17504
17505 ### SSS FIXME: Disabled right now because accurate html2wt
17506 ### on this snippet requires data-parsoid flags that we've
17507 ### stripped out of these tests. We should scheme how we
17508 ### we want to handle these kind of tests that require
17509 ### data-parsoid flags for accurate html2wt serialization
17510
17511 !! test
17512 Tables: 4d. No escaping needed
17513 !! options
17514 disabled
17515 !! input
17516 {|
17517 ||+1
17518 ||-2
17519 |}
17520 !! result
17521 <table>
17522 <tr>
17523 <td>+1
17524 </td>
17525 <td>-2
17526 </td></tr></table>
17527
17528 !! end
17529
17530 #### --------------- Links ----------------
17531 #### 1. Quote marks in link text
17532 #### 2. Wikilinks: Escapes needed
17533 #### 3. Wikilinks: No escapes needed
17534 #### 4. Extlinks: Escapes needed
17535 #### 5. Extlinks: No escapes needed
17536 #### --------------------------------------
17537 !! test
17538 Links 1. Quote marks in link text
17539 !! options
17540 parsoid
17541 !! input
17542 [[Foo|Foo<nowiki>''boo''</nowiki>]]
17543 !! result
17544 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
17545 !! end
17546
17547 !! test
17548 Links 2. WikiLinks: Escapes needed
17549 !! options
17550 parsoid
17551 !! input
17552 [[Foo|<nowiki>[Foobar]</nowiki>]]
17553 [[Foo|<nowiki>Foobar]</nowiki>]]
17554 [[Foo|x [Foobar] x]]
17555 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
17556 [[Foo|<nowiki>[[Bar]]</nowiki>]]
17557 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
17558 [[Foo|<nowiki>|Bar</nowiki>]]
17559 [[Foo|<nowiki>]]bar</nowiki>]]
17560 [[Foo|<nowiki>[[bar</nowiki>]]
17561 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
17562 !! result
17563 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
17564 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
17565 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
17566 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
17567 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
17568 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
17569 <a href="Foo" rel="mw:WikiLink">|Bar</a>
17570 <a href="Foo" rel="mw:WikiLink">]]bar</a>
17571 <a href="Foo" rel="mw:WikiLink">[[bar</a>
17572 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
17573 !! end
17574
17575 !! test
17576 Links 3. WikiLinks: No escapes needed
17577 !! options
17578 parsoid
17579 !! input
17580 [[Foo|[Foobar]]
17581 [[Foo|foo|bar]]
17582 !! result
17583 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
17584 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
17585 !! end
17586
17587 !! test
17588 Links 4. ExtLinks: Escapes needed
17589 !! options
17590 parsoid
17591 !! input
17592 [http://google.com <nowiki>[google]</nowiki>]
17593 [http://google.com <nowiki>google]</nowiki>]
17594 !! result
17595 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
17596 <a href="http://google.com" rel="mw:ExtLink">google]</a>
17597 !! end
17598
17599 !! test
17600 Links 5. ExtLinks: No escapes needed
17601 !! options
17602 parsoid
17603 !! input
17604 [http://google.com [google]
17605 !! result
17606 <a href="http://google.com" rel="mw:ExtLink">[google</a>
17607 !! end
17608
17609 #### --------------- Quotes ---------------
17610 #### 1. Quotes inside <b> and <i>
17611 #### 2. Link fragments separated by <i> and <b> tags
17612 #### 3. Link fragments inside <i> and <b>
17613 #### 4. No escaping needed
17614 #### --------------------------------------
17615 !! test
17616 1. Quotes inside <b> and <i>
17617 !! options
17618 parsoid=html2wt,wt2wt
17619 !! input
17620 ''<nowiki>'foo'</nowiki>''
17621 ''<nowiki>''foo''</nowiki>''
17622 ''<nowiki>'''foo'''</nowiki>''
17623 ''foo''<nowiki/>'s
17624 '''<nowiki>'foo'</nowiki>'''
17625 '''<nowiki>''foo''</nowiki>'''
17626 '''<nowiki>'''foo'''</nowiki>'''
17627 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
17628 '''foo'''<nowiki/>'s
17629 '''foo''
17630 ''foo''<nowiki/>'
17631 '<nowiki/>''foo''<nowiki/>'
17632 ''''foo'''
17633 '''foo'''<nowiki/>'
17634 '<nowiki/>'''foo'''<nowiki/>'
17635 !! result
17636 <p><i>'foo'</i>
17637 <i>''foo''</i>
17638 <i>'''foo'''</i>
17639 <i>foo</i>'s
17640 <b>'foo'</b>
17641 <b>''foo''</b>
17642 <b>'''foo'''</b>
17643 <b>foo'<i>bar'</i>baz</b>
17644 <b>foo</b>'s
17645 '<i>foo</i>
17646 <i>foo</i>'
17647 '<i>foo</i>'
17648 '<b>foo</b>
17649 <b>foo</b>'
17650 '<b>foo</b>'</p>
17651 !! end
17652
17653 !! test
17654 2. Link fragments separated by <i> and <b> tags
17655 !! input
17656 [[''foo''<nowiki>hello]]</nowiki>
17657
17658 [['''foo'''<nowiki>hello]]</nowiki>
17659 !! result
17660 <p>[[<i>foo</i>hello]]
17661 </p><p>[[<b>foo</b>hello]]
17662 </p>
17663 !! end
17664
17665 !! test
17666 3. Link fragments inside <i> and <b>
17667 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
17668 this is one of the shortcomings of this format)
17669 !! input
17670 ''[[foo''<nowiki>]]</nowiki>
17671
17672 '''[[foo'''<nowiki>]]</nowiki>
17673 !! result
17674 <p><i>[[foo</i>]]
17675 </p><p><b>[[foo</b>]]
17676 </p>
17677 !! end
17678
17679 !! test
17680 4. No escaping needed
17681 !! input
17682 '<span>''bar''</span>'
17683 '<span>'''bar'''</span>'
17684 !! result
17685 <p>'<span><i>bar</i></span>'
17686 '<span><b>bar</b></span>'
17687 </p>
17688 !! end
17689
17690 #### ----------- Paragraphs ---------------
17691 #### 1. No unnecessary escapes
17692 #### --------------------------------------
17693
17694 !! test
17695 1. No unnecessary escapes
17696 !! input
17697 bar <span><nowiki>[[foo]]</nowiki></span>
17698
17699 =bar <span><nowiki>[[foo]]</nowiki></span>
17700
17701 [[bar <span><nowiki>[[foo]]</nowiki></span>
17702
17703 ]]bar <span><nowiki>[[foo]]</nowiki></span>
17704
17705 =bar <span>foo]]</span><nowiki>=</nowiki>
17706 !! result
17707 <p>bar <span>[[foo]]</span>
17708 </p><p>=bar <span>[[foo]]</span>
17709 </p><p>[[bar <span>[[foo]]</span>
17710 </p><p>]]bar <span>[[foo]]</span>
17711 </p><p>=bar <span>foo]]</span>=
17712 </p>
17713 !!end
17714
17715 #### ----------------------- PRE --------------------------
17716 #### 1. Leading whitespace in SOL context should be escaped
17717 #### ------------------------------------------------------
17718 !! test
17719 1. Leading whitespace in SOL context should be escaped
17720 !! options
17721 parsoid
17722 !! input
17723 <nowiki> </nowiki>a
17724
17725 <nowiki> </nowiki> a
17726
17727 <nowiki> </nowiki>a(tab)
17728
17729 <nowiki> </nowiki> a
17730 <!--cmt-->
17731 <nowiki> </nowiki> a
17732
17733 a
17734 <nowiki> </nowiki>b
17735
17736 a
17737 <nowiki> </nowiki>b
17738
17739 a
17740 <nowiki> </nowiki> b
17741 !! result
17742 <p> a</p>
17743 <p> a</p>
17744 <p> a(tab)</p>
17745 <p> a</p>
17746 <p><!--cmt--> a</p>
17747 <p>a
17748 b</p>
17749 <p>a
17750 b</p>
17751 <p>a
17752 b</p>
17753 !! end
17754
17755 #### --------------- Behavior Switches --------------------
17756 !! test
17757 1. Valid behavior switches should be escaped
17758 !! options
17759 parsoid=html2wt
17760 !! input
17761 <nowiki>__TOC__</nowiki>
17762 !! result
17763 __TOC__
17764 !! end
17765
17766 !! test
17767 2. Invalid behavior switches should not be escaped
17768 !! options
17769 parsoid=html2wt
17770 !! input
17771 __TOO__
17772 __|__
17773 !! result
17774 __TOO__
17775 __|__
17776 !! end
17777
17778 #### --------------- HTML tags ---------------
17779 #### 1. a tags
17780 #### 2. other tags
17781 #### 3. multi-line html tag
17782 #### -----------------------------------------
17783 !! test
17784 1. a tags
17785 !! options
17786 parsoid
17787 !! input
17788 <a href="http://google.com">google</a>
17789 !! result
17790 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
17791 !! end
17792
17793 !! test
17794 2. other tags
17795 !! input
17796 <nowiki><div>foo</div>
17797 <div style="color:red">foo</div></nowiki>
17798 !! result
17799 <p>&lt;div&gt;foo&lt;/div&gt;
17800 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
17801 </p>
17802 !! end
17803
17804 !! test
17805 3. multi-line html tag
17806 !! input
17807 <nowiki><div
17808 >foo</div
17809 ></nowiki>
17810 !! result
17811 <p>&lt;div
17812 &gt;foo&lt;/div
17813 &gt;
17814 </p>
17815 !! end
17816
17817 !! test
17818 4. extension tags
17819 !! input
17820 <nowiki><ref>foo</ref></nowiki>
17821 !! result
17822 <p>&lt;ref&gt;foo&lt;/ref&gt;
17823 </p>
17824 !! end
17825
17826 #### --------------- Others ---------------
17827 !! test
17828 Escaping nowikis
17829 !! input
17830 &lt;nowiki&gt;foo&lt;/nowiki&gt;
17831 !! result
17832 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
17833 </p>
17834 !! end
17835
17836 ## The quote-char in the input is necessary for triggering the bug
17837 !! test
17838 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
17839 !! options
17840 parsoid=wt2wt,html2wt
17841 !! input
17842 foo's bar :
17843 !! result
17844 <p>foo's bar :</p>
17845 !! end
17846
17847 !! test
17848
17849 Tag-like HTML structures are passed through as text
17850 !! input
17851 <x y>
17852
17853 <x.y>
17854
17855 <x-y>
17856
17857 1>2
17858
17859 x<y
17860
17861 a>b
17862
17863 1<d e>f
17864 !! result
17865 <p>&lt;x y&gt;
17866 </p><p>&lt;x.y&gt;
17867 </p><p>&lt;x-y&gt;
17868 </p><p>1&gt;2
17869 </p><p>x&lt;y
17870 </p><p>a&gt;b
17871 </p><p>1&lt;d e&gt;f
17872 </p>
17873 !! end
17874
17875
17876 # This was a bug in the PHP parser (see bug 17663 and its dups,
17877 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
17878 !! test
17879 Tag names followed by punctuation should not be recognized as tags
17880 !! input
17881 <s.ome> text
17882 !! result
17883 <p>&lt;s.ome&gt; text
17884 </p>
17885 !! end
17886
17887 !! test
17888 HTML tag with necessary entities in attributes
17889 !! input
17890 <span title="&amp;amp;">foo</span>
17891 !! result
17892 <p><span title="&amp;amp;">foo</span>
17893 </p>
17894 !! end
17895
17896 !! test
17897 HTML tag with 'unnecessary' entity encoding in attributes
17898 !! input
17899 <span title="&amp;">foo</span>
17900 !! result
17901 <p><span title="&amp;">foo</span>
17902 </p>
17903 !! end
17904
17905 !! test
17906 HTML tag with broken attribute value quoting
17907 !! input
17908 <span title="Hello world>Foo</span>
17909 !! result
17910 <p><span>Foo</span>
17911 </p>
17912 !! end
17913
17914 !! test
17915 Parsoid-only: HTML tag with broken attribute value quoting
17916 !! options
17917 parsoid
17918 !! input
17919 <span title="Hello world>Foo</span>
17920 !! result
17921 <p><span title="Hello world">Foo</span>
17922 </p>
17923 !! end
17924
17925 !! test
17926 Table with broken attribute value quoting
17927 !! input
17928 {|
17929 | title="Hello world|Foo
17930 |}
17931 !! result
17932 <table>
17933 <tr>
17934 <td>Foo
17935 </td></tr></table>
17936
17937 !! end
17938
17939 !! test
17940 Table with broken attribute value quoting on consecutive lines
17941 !! input
17942 {|
17943 | title="Hello world|Foo
17944 | style="color:red|Bar
17945 |}
17946 !! result
17947 <table>
17948 <tr>
17949 <td>Foo
17950 </td>
17951 <td>Bar
17952 </td></tr></table>
17953
17954 !! end
17955
17956 !! test
17957 Parsoid-only: Table with broken attribute value quoting on consecutive lines
17958 !! options
17959 parsoid
17960 !! input
17961 {|
17962 | title="Hello world|Foo
17963 | style="color:red|Bar
17964 |}
17965 !! result
17966 <table><tbody>
17967 <tr>
17968 <td title="Hello world">Foo
17969 </td><td style="color: red">Bar
17970 </td></tr></tbody></table>
17971
17972 !! end
17973
17974 !! test
17975 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
17976 !! options
17977 parsoid
17978 !! input
17979 {{}}
17980 !! result
17981 {{}}
17982 !! end
17983
17984 !! test
17985 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
17986 !! options
17987 parsoid
17988 !! input
17989 }}{{
17990 !! result
17991 }}{{
17992 !! end
17993
17994 !!test
17995 Accept empty td cell attribute
17996 !!input
17997 {|
17998 | align="center" | foo || |
17999 |}
18000 !!result
18001 <table>
18002 <tr>
18003 <td align="center"> foo </td>
18004 <td>
18005 </td></tr></table>
18006
18007 !!end
18008
18009 !!test
18010 Non-empty attributes in th-cells
18011 !!input
18012 {|
18013 ! Foo !! style="color: red" | Bar
18014 |}
18015 !!result
18016 <table>
18017 <tr>
18018 <th> Foo </th>
18019 <th style="color: red"> Bar
18020 </th></tr></table>
18021
18022 !!end
18023
18024 !!test
18025 Accept empty attributes in th-cells
18026 !!input
18027 {|
18028 !| foo !!| bar
18029 |}
18030 !!result
18031 <table>
18032 <tr>
18033 <th> foo </th>
18034 <th> bar
18035 </th></tr></table>
18036
18037 !!end
18038
18039 !!test
18040 Empty table rows go away
18041 !!input
18042 {|
18043 | Hello
18044 | there
18045 |- class="foo"
18046 |-
18047 |}
18048 !! result
18049 <table>
18050 <tr>
18051 <td> Hello
18052 </td>
18053 <td> there
18054 </td></tr>
18055
18056 </table>
18057
18058 !! end
18059
18060 ###
18061 ### Parsoid-centric tests for testing RTing of inter-element separators
18062 ### Edge cases not tested by existing parser tests and specific to
18063 ### Parsoid-specific serialization strategies.
18064 ###
18065
18066 !!test
18067 RT-ed inter-element separators should be valid separators
18068 !!input
18069 {|
18070 |- [[foo]]
18071 |}
18072 !!result
18073 <table>
18074
18075 </table>
18076
18077 !!end
18078
18079 !!test
18080 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
18081 (Parsoid-only since PHP parser relies on Tidy for correct output)
18082 !!options
18083 parsoid
18084 !!input
18085 {|
18086 |<small>foo
18087 bar
18088 |}
18089
18090 {|
18091 |<small>foo<small>
18092 |}
18093 !!result
18094 !!end
18095
18096 !!test
18097 Empty TD followed by TD with tpl-generated attribute
18098 !!input
18099 {|
18100 |-
18101 |
18102 |{{echo|style='color:red'}}|foo
18103 |}
18104 !!result
18105 <table>
18106
18107 <tr>
18108 <td>
18109 </td>
18110 <td>foo
18111 </td></tr></table>
18112
18113 !!end
18114
18115 !!test
18116 Indented table with an empty td
18117 !!input
18118 {|
18119 |-
18120 |
18121 |foo
18122 |}
18123 !!result
18124 <table>
18125
18126 <tr>
18127 <td>
18128 </td>
18129 <td>foo
18130 </td></tr></table>
18131
18132 !!end
18133
18134 !!test
18135 Empty TR followed by a template-generated TR
18136 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
18137 !!options
18138 parsoid
18139 !!input
18140 {|
18141 |-
18142 {{echo|<tr><td>foo</td></tr>}}
18143 |}
18144 !!result
18145 <table>
18146 <tbody>
18147 <tr></tr>
18148 <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}}]}'>
18149 <td>foo</td></tr>
18150 </tbody></table>
18151 !!end
18152
18153 ## PHP and parsoid output differ for this, and since this is primarily
18154 ## for testing Parsoid's serializer, marking this Parsoid only
18155 !!test
18156 Empty TR followed by mixed-ws-comment line should RT correctly
18157 !!options
18158 parsoid
18159 !!input
18160 {|
18161 |-
18162 <!--c-->
18163 |-
18164 <!--c--> <!--d-->
18165 |}
18166 !!result
18167 <table>
18168 <tbody>
18169 <tr></tr>
18170 <!--c-->
18171 <tr>
18172 <!--c--> </tr><!--d-->
18173 </tbody></table>
18174
18175 !!end
18176
18177 !!test
18178 Multi-line image caption generated by templates with/without trailing newlines
18179 !!options
18180 parsoid
18181 !!input
18182 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
18183 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
18184 !!result
18185 <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>
18186 <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>
18187
18188 !!end
18189
18190 ## PHP emits broken html for this, and since this is primarily
18191 ## a Parsoid serializer test, marking this Parsoid only
18192 !!test
18193 Improperly nested inline or quotes tags with whitespace in between
18194 !!options
18195 parsoid
18196 !!input
18197 <span> <s>x</span> </s>
18198 ''' ''x''' ''
18199 !!result
18200 <p><span> <s>x</s></span><s> </s>
18201 <b> <i>x</i></b><i> </i>
18202 </p>
18203 !!end
18204
18205 !!test
18206 Encapsulate protected attributes from wt
18207 !!options
18208 parsoid
18209 !!input
18210 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
18211 !!result
18212 <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>
18213 </body>
18214 !!end
18215
18216 ## Currently the p-wrapper is fragile in how adds / removes transformations.
18217 ## Having nested or stray pre tags results in the attempt to add duplicates,
18218 ## causing an assertion fail. This test tries to prevent that situation.
18219 !!test
18220 Ensure ParagraphWrapper can deal with stray closing pre tags
18221 !!options
18222 parsoid=wt2html
18223 !!input
18224 plain text</pre>
18225 !!result
18226 plain text
18227 !!end
18228
18229 !!test
18230 Ensure fostered text content is wrapped in spans
18231 !!options
18232 parsoid=wt2html
18233 !!input
18234 <table>hi</table><table>ho</table>
18235 !!result
18236 <span>hi</span>
18237 <table></table>
18238 <span>ho</span>
18239 <table></table>
18240 !!end
18241
18242 !!test
18243 Encapsulation properly handles null DSR information from foster box
18244 !!options
18245 parsoid=wt2html,wt2wt
18246 !!input
18247 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
18248 !!result
18249 <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;
18250 <table>foo
18251 <tr>
18252 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
18253 <table>
18254 <tbody>
18255 <tr>
18256 <td>bar</td></tr></tbody></table>
18257 !!end
18258
18259 !!test
18260 1. Encapsulate foster-parented transclusion content
18261 !!options
18262 parsoid=wt2wt,wt2html
18263 !!input
18264 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
18265 !!result
18266 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
18267 <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
18268 <tr>
18269 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
18270 <table>
18271 <tbody>
18272 <tr>
18273 <td>bar</td></tr></tbody></table>
18274 !!end
18275
18276 !!test
18277 2. Encapsulate foster-parented transclusion content
18278 !!options
18279 parsoid=wt2wt,wt2html
18280 !!input
18281 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
18282 !!result
18283 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
18284 <table>
18285 <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>
18286 <tr>
18287 <td>bar</td></tr></table>&quot;]}">foo</div>
18288 <table>
18289 <tbody>
18290 <tr>
18291 <td>bar</td></tr></tbody></table>
18292 !!end
18293
18294 !!test
18295 3. Encapsulate foster-parented transclusion content
18296 !!options
18297 parsoid=wt2wt,wt2html
18298 !!input
18299 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
18300 !!result
18301 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
18302 <table>
18303 <div>
18304 <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>
18305 <tr>
18306 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
18307 <p>foo</p></div>
18308 <table>
18309 <tbody>
18310 <tr>
18311 <td>bar</td></tr></tbody></table>
18312 !!end
18313
18314 !!test
18315 4. Encapsulate foster-parented transclusion content
18316 !!options
18317 parsoid=wt2wt,wt2html
18318 !!input
18319 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
18320 !!result
18321 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
18322 <table>
18323 <div>
18324 <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>
18325 <tr>
18326 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
18327 <p>foo</p></div>
18328 <table>
18329 <tbody>
18330 <tr>
18331 <td>bar</td></tr></tbody></table>
18332 !!end
18333
18334 !!test
18335 5. Encapsulate foster-parented transclusion content
18336 !!options
18337 parsoid=wt2wt,wt2html
18338 !!input
18339 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
18340 !!result
18341 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
18342 <table>
18343 <tr>
18344 <td>
18345 <div>
18346 <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>
18347 <table>
18348 <tbody>
18349 <tr>
18350 <td>
18351 <div>
18352 <p>foo</p></div></td></tr></tbody></table>
18353 !!end
18354
18355 !!test
18356 6. Encapsulate foster-parented transclusion content
18357 !!options
18358 parsoid=wt2wt,wt2html
18359 !!input
18360 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
18361 !!result
18362 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
18363 <table>
18364 <tr>
18365 <td>
18366 <div>
18367 <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>
18368 <table>
18369 <tbody>
18370 <tr>
18371 <td>
18372 <div>
18373 <p>foo</p></div></td></tr></tbody></table>
18374 <p>ok</p>
18375 !!end
18376
18377 !!test
18378 7. Encapsulate foster-parented transclusion content
18379 !!options
18380 parsoid=wt2wt,wt2html
18381 !!input
18382 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
18383 !!result
18384 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
18385 <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;
18386 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
18387 <td>bar</td></table>&quot;]}">foo</p>
18388 <table>
18389 <tbody>
18390 <tr>
18391 <td>bar</td></tr></tbody></table>
18392 !!end
18393
18394 !!test
18395 8. Encapsulate foster-parented transclusion content
18396 !!options
18397 parsoid=wt2wt,wt2html
18398 !!input
18399 {{echo|a
18400 }}{|{{echo|style='color:red'}}
18401 |-
18402 |b
18403 |}
18404 !!result
18405 <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>
18406 <table>
18407 <tbody>
18408 <tr>
18409 <td>b</td></tr></tbody></table>
18410 !!end
18411
18412 # -----------------------------------------------------------------
18413 # The following section of tests are primarily to spec requirements
18414 # around serialization of new/edited content.
18415 #
18416 # All these tests are marked Parsoid html2wt and html2html only
18417 # ----------------------------------------------------------------
18418
18419 !! test
18420 Image: Modifying size of an image
18421 !! options
18422 parsoid=html2wt
18423 !! input
18424 [[Image:Wiki.png|230x230px]]
18425 !! result
18426 <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>
18427 !!end
18428
18429 !! test
18430 Image: New block level image should have \n before and after
18431 !! options
18432 parsoid=html2wt
18433 !! input
18434 123
18435 [[File:Wiki.png|right|thumb|150x150px]]
18436 456
18437 !! result
18438 <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>
18439 !!end
18440
18441 # Wacky -- the leading newline in input is required because
18442 # that is what the serializer emits. To be fixed. Not fixing
18443 # the test because this test is required to test serialization of
18444 # new content and preferred whitespace style.
18445 !! test
18446 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
18447 !! options
18448 parsoid=html2wt
18449 !! input
18450
18451 * foo
18452 !! result
18453 <ul>
18454 <li><p>foo</p></li>
18455 </ul>
18456 !! end
18457
18458 !! test
18459 Don't strip leading whitespace when handling indent-pre suppressing tags
18460 !! options
18461 parsoid=html2wt
18462 !! input
18463 {|
18464 | indented row
18465 |}
18466 <blockquote>
18467 '''This is very bold of you!'''
18468
18469 {|
18470 |
18471 indented cell (no pre-wrapping!)
18472 |}
18473 </blockquote>
18474 foo
18475 <div>bar</div>
18476 !! result
18477 <table>
18478 <tr><td> indented row</td></tr>
18479 </table>
18480 <blockquote><p>
18481 <b>This is very bold of you!</b>
18482 </p>
18483 <table><tr><td>
18484 indented cell (no pre-wrapping!)
18485 </td></tr></table>
18486 </blockquote>
18487 <p>foo</p>
18488 <div>bar</div>
18489 !! end
18490
18491 !! test
18492 Strip leading whitespace when handling indent-pre inducing tags
18493 !! options
18494 parsoid=html2wt
18495 !! input
18496 foo
18497 <span>bar</span>
18498
18499 <span>foo2
18500 </span>bar2
18501
18502 <div>foo</div>
18503 <span>bar</span>
18504 !! result
18505 <p>foo</p>
18506 <span>bar</span>
18507
18508 <span>foo2
18509 </span>bar2
18510
18511 <div>foo</div>
18512 <span>bar</span>
18513 !! end
18514
18515 # Wacky -- the leading newline in input is required because
18516 # that is what the serializer emits. To be fixed. Not fixing
18517 # the test because this test is required to test serialization of
18518 # new content and preferred whitespace style.
18519 !! test
18520 Lists: Add space after bullets
18521 !! options
18522 parsoid=html2wt
18523 !! input
18524
18525 * foo
18526 * bar
18527 * <span> baz</span>
18528 !! result
18529 <ul>
18530 <li>foo</li>
18531 <li> bar</li>
18532 <li><span> baz</span></li>
18533 </ul>
18534 !! end
18535
18536 !! test
18537 Parsoid: Serialize positional parameters with = in them as named parameter
18538 !! options
18539 parsoid=html2wt
18540 !! input
18541 {{echo|1 = f=oo}}
18542
18543 {{echo|1 = f=oo|2 = bar}}
18544
18545 <!--Orig params with data-parsoid has heuristics for handling = chars-->
18546 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
18547 {{echo|<nowiki>f=oo</nowiki>|bar}}
18548 !! result
18549 <p about="#mwt1" typeof="mw:Transclusion"
18550 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
18551
18552 <p about="#mwt1" typeof="mw:Transclusion"
18553 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
18554
18555 <!--Orig params with data-parsoid has heuristics for handling = chars-->
18556 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
18557 <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>
18558 !! end
18559
18560 !! test
18561 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
18562 !! options
18563 parsoid=html2wt
18564 !! input
18565 <div>a
18566 b
18567 </div>
18568 <div>a
18569 b
18570 </div>
18571 <div>
18572 a
18573
18574 b
18575 </div>
18576 !! result
18577 <div>a<p>b</p></div>
18578 <div>a
18579 <p>b</p></div>
18580 <div>
18581 a
18582 <p>b</p></div>
18583 !! end
18584
18585 #-----------------------------
18586 # I/B quote minimization tests
18587 #-----------------------------
18588
18589 !! test
18590 1. I/B quote minimization: wikitext-only tags should be combined
18591 !! options
18592 parsoid=html2wt
18593 !! input
18594 ''AB''
18595
18596 '''AB'''
18597
18598 ''A'''B'''''
18599
18600 '''A''B'''''
18601
18602 '''A''BC''D'''
18603
18604 '''''AB'''''
18605
18606 '''''AB'''''
18607
18608 '''''AB'''''
18609 !! result
18610 <p><i>A</i><i>B</i></p>
18611 <p><b>A</b><b>B</b></p>
18612 <p><i>A</i><b><i>B</i></b></p>
18613 <p><b>A</b><i><b>B</b></i></p>
18614 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
18615 <p><i><b>A</b></i><i><b>B</b></i></p>
18616 <p><i><b>A</b></i><b><i>B</i></b></p>
18617 <p><b><i>A</i></b><i><b>B</b></i></p>
18618 !! end
18619
18620 !! test
18621 2. I/B quote minimization: wikitext and html tags should not be combined
18622 !! options
18623 parsoid=html2wt
18624 !! input
18625 ''A''<i>B</i>
18626
18627 ''A'''''<i>B</i>'''
18628 !! result
18629 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
18630 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
18631 !! end
18632
18633 !! test
18634 3. I/B quote minimization: templated content stops minimization
18635 !! options
18636 parsoid=html2wt
18637 !! input
18638 ''A''{{echo|''B''}}
18639
18640 ''A''{{echo|'''''B'''''}}
18641 !! result
18642 <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>
18643 <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>
18644 !! end
18645
18646 !! test
18647 4. I/B quote minimization: new content should be mimimized with adjacent old content
18648 !! options
18649 parsoid=html2wt
18650 !! input
18651 ''AB''
18652
18653 '''AB'''
18654
18655 ''A'''B'''''
18656 !! result
18657 <p><i>A</i><i data-parsoid='{}'>B</i></p>
18658 <p><b data-parsoid='{}'>A</b><b>B</b></p>
18659 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
18660 !! end
18661
18662 !!test
18663 5. Bug 54262: New entities
18664 !! options
18665 parsoid=html2wt
18666 !! input
18667 foo
18668 !! result
18669 <span typeof="mw:Entity">foo</span>
18670 !! end
18671
18672 # -----------------------------------------------------------------
18673 # End of section for Parsoid-only html2wt tests for serialization
18674 # of new content
18675 # -----------------------------------------------------------------
18676
18677 TODO:
18678 more images
18679 more tables
18680 character entities
18681 and much more
18682 Try for 100% code coverage