Merge "CSSJanus: Account for attribute selectors in brace lookahead"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-only test (not run by PHP parser)
25 # php php-only test (not run by the parsoid parser)
26 # showtitle make the first line the title
27 # comment run through Linker::formatComment() instead of main parser
28 # local format section links in edit comment text as local links
29 # notoc disable table of contents
30 #
31 # You can also set the following parser properties via test options:
32 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
33 # wgLinkHolderBatchSize, wgRawHtml
34 #
35 # For testing purposes, temporary articles can created:
36 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
37 # where '/' denotes a newline.
38
39 # This is the standard article assumed to exist.
40 !! article
41 Main Page
42 !! text
43 blah blah
44 !! endarticle
45
46 !!article
47 Template:Foo
48 !!text
49 FOO
50 !!endarticle
51
52 !! article
53 Template:Blank
54 !! text
55 !! endarticle
56
57 !! article
58 Template:pipe
59 !! text
60 |
61 !! endarticle
62
63 !!article
64 MediaWiki:bad image list
65 !!text
66 * [[File:Bad.jpg]] except [[Nasty page]]
67 !!endarticle
68
69 !! article
70 Template:inner list
71 !! text
72 * item 1
73 !! endarticle
74
75 !! article
76 Template:tbl-start
77 !! text
78 {|
79 !! endarticle
80
81 !! article
82 Template:tbl-end
83 !! text
84 |}
85 !! endarticle
86
87 !! article
88 Template:!
89 !! text
90 |
91 !! endarticle
92
93 !! article
94 Template:echo
95 !! text
96 {{{1}}}
97 !! endarticle
98
99 !! article
100 Template:echo_with_span
101 !! text
102 <span>{{{1}}}</span>
103 !! endarticle
104
105 !! article
106 Template:echo_with_div
107 !! text
108 <div>{{{1}}}</div>
109 !! endarticle
110
111 !! article
112 Template:attr_str
113 !! text
114 {{{1}}}="{{{2}}}"
115 !! endarticle
116
117 !! article
118 Template:table_attribs
119 !! text
120 <noinclude>
121 |</noinclude>style="color: red"| Foo
122 !! endarticle
123
124 !! article
125 Template:table_cells
126 !! text
127 {{table_attribs}} || Bar || Baz
128 !! endarticle
129
130 !! article
131 Template:image_attribs
132 !! text
133 <noinclude>
134 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
135 !! endarticle
136
137 !! article
138 A?b
139 !! text
140 Weirdo titles!
141 !! endarticle
142
143 !!article
144 Template:Bullet
145 !!text
146 * Bar
147 !!endarticle
148
149 !!article
150 Template:OpenTable
151 !!text
152 {|
153 !!endarticle
154
155 ###
156 ### Basic tests
157 ###
158 !! test
159 Blank input
160 !! input
161 !! result
162 !! end
163
164
165 !! test
166 Simple paragraph
167 !! input
168 This is a simple paragraph.
169 !! result
170 <p>This is a simple paragraph.
171 </p>
172 !! end
173
174 !! test
175 Paragraphs with extra newline spacing
176 !! input
177 foo
178
179 bar
180
181
182 baz
183
184
185
186 booz
187 !! result
188 <p>foo
189 </p><p>bar
190 </p><p><br />
191 baz
192 </p><p><br />
193 </p><p>booz
194 </p>
195 !! end
196
197 !! test
198 Paragraphs with newline spacing with comment lines in between
199 !! input
200 ----
201 a
202 <!--foo-->
203 b
204 ----
205 a
206 <!--foo--><!--More than 1 comment, still stripped-->
207 b
208 ----
209 a
210 <!--foo--> <!----> <!-- bar -->
211 b
212 ----
213 a
214 <!--foo-->
215
216 b
217 ----
218 a
219
220 <!--foo-->
221 b
222 ----
223 a
224 <!--foo-->
225
226
227 b
228 ----
229 a
230
231
232 <!--foo-->
233 b
234 ----
235 !! result
236 <hr />
237 <p>a
238 b
239 </p>
240 <hr />
241 <p>a
242 b
243 </p>
244 <hr />
245 <p>a
246 b
247 </p>
248 <hr />
249 <p>a
250 </p><p>b
251 </p>
252 <hr />
253 <p>a
254 </p><p>b
255 </p>
256 <hr />
257 <p>a
258 </p><p><br />
259 b
260 </p>
261 <hr />
262 <p>a
263 </p><p><br />
264 b
265 </p>
266 <hr />
267
268 !! end
269
270 !! test
271 Paragraphs with newline spacing with non-empty white-space lines in between
272 !! input
273 ----
274 a
275
276 b
277 ----
278 a
279
280
281 b
282 ----
283 !! result
284 <hr />
285 <p>a
286 </p><p>b
287 </p>
288 <hr />
289 <p>a
290 </p><p><br />
291 b
292 </p>
293 <hr />
294
295 !! end
296
297 !! test
298 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
299 !! input
300 ----
301 a
302 <!--foo-->
303 b
304 ----
305 a
306 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
307 b
308 ----
309 a
310
311 <!--foo-->
312 <!--bar-->
313 b
314 ----
315 a
316
317 <!--foo-->
318 <!--bar-->
319
320 b
321 ----
322 !! result
323 <hr />
324 <p>a
325 b
326 </p>
327 <hr />
328 <p>a
329 b
330 </p>
331 <hr />
332 <p>a
333 </p><p>b
334 </p>
335 <hr />
336 <p>a
337 </p><p><br />
338 b
339 </p>
340 <hr />
341
342 !! end
343
344 !! test
345 Extra newlines: More paragraphs with indented comment
346 !! input
347 a
348
349 <!--boo-->
350
351 b
352 !!result
353 <p>a
354 </p><p><br />
355 b
356 </p>
357 !!end
358
359 !! test
360 Extra newlines followed by heading
361 !! input
362 a
363
364
365
366 =b=
367 [[a]]
368
369
370 =b=
371 !! result
372 <p>a
373 </p><p><br />
374 </p>
375 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
376 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
377 </p><p><br />
378 </p>
379 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
380
381 !! end
382
383 !! test
384 Extra newlines between heading and content are swallowed
385 !! input
386 =b=
387
388
389
390 [[a]]
391 !! result
392 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
393 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
394 </p>
395 !! end
396
397 !! test
398 Parsing an URL
399 !! input
400 http://fr.wikipedia.org/wiki/🍺
401 <!-- EasterEgg we love beer, better be able be able to link to it -->
402 !! result
403 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
404 </p>
405 !! end
406
407 !! test
408 Simple list
409 !! input
410 * Item 1
411 * Item 2
412 !! result
413 <ul>
414 <li> Item 1
415 </li>
416 <li> Item 2
417 </li>
418 </ul>
419
420 !! end
421
422 !! test
423 Italics and bold
424 !! input
425 * plain
426 * plain''italic''plain
427 * plain''italic''plain''italic''plain
428 * plain'''bold'''plain
429 * plain'''bold'''plain'''bold'''plain
430 * plain''italic''plain'''bold'''plain
431 * plain'''bold'''plain''italic''plain
432 * plain''italic'''bold-italic'''italic''plain
433 * plain'''bold''bold-italic''bold'''plain
434 * plain'''''bold-italic'''italic''plain
435 * plain'''''bold-italic''bold'''plain
436 * plain''italic'''bold-italic'''''plain
437 * plain'''bold''bold-italic'''''plain
438 * plain l'''italic''plain
439 * plain l''''bold''' plain
440 !! result
441 <ul>
442 <li> plain
443 </li>
444 <li> plain<i>italic</i>plain
445 </li>
446 <li> plain<i>italic</i>plain<i>italic</i>plain
447 </li>
448 <li> plain<b>bold</b>plain
449 </li>
450 <li> plain<b>bold</b>plain<b>bold</b>plain
451 </li>
452 <li> plain<i>italic</i>plain<b>bold</b>plain
453 </li>
454 <li> plain<b>bold</b>plain<i>italic</i>plain
455 </li>
456 <li> plain<i>italic<b>bold-italic</b>italic</i>plain
457 </li>
458 <li> plain<b>bold<i>bold-italic</i>bold</b>plain
459 </li>
460 <li> plain<i><b>bold-italic</b>italic</i>plain
461 </li>
462 <li> plain<b><i>bold-italic</i>bold</b>plain
463 </li>
464 <li> plain<i>italic<b>bold-italic</b></i>plain
465 </li>
466 <li> plain<b>bold<i>bold-italic</i></b>plain
467 </li>
468 <li> plain l'<i>italic</i>plain
469 </li>
470 <li> plain l'<b>bold</b> plain
471 </li>
472 </ul>
473
474 !! end
475
476 # this example taken from the [[simple:Moon]] article (bug 47326)
477 !! test
478 Italics and possessives (1)
479 !! input
480 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
481 !! result
482 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
483 </p>
484 !! end
485
486 # this example taken from [[en:Flaming Pie]] (bug 49926)
487 !! test
488 Italics and possessives (2)
489 !! input
490 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
491 !! result
492 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
493 </p>
494 !! end
495
496 # this example taken from [[en:Dictionary]] (bug 49926)
497 !! test
498 Italics and possessives (3)
499 !! input
500 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
501 !! result
502 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
503 </p>
504 !! end
505
506
507 ###
508 ### 2-quote opening sequence tests
509 ###
510 !! test
511 Italics and bold: 2-quote opening sequence: (2,2)
512 !! input
513 ''foo''
514 !! result
515 <p><i>foo</i>
516 </p>
517 !!end
518
519
520 !! test
521 Italics and bold: 2-quote opening sequence: (2,3)
522 !! input
523 ''foo'''
524 !! result
525 <p><i>foo'</i>
526 </p>
527 !!end
528
529
530 !! test
531 Italics and bold: 2-quote opening sequence: (2,4)
532 !! input
533 ''foo''''
534 !! result
535 <p><i>foo''</i>
536 </p>
537 !!end
538
539
540 !! test
541 Italics and bold: 2-quote opening sequence: (2,5) (php)
542 !! options
543 php
544 !! input
545 ''foo'''''
546 !! result
547 <p><i>foo</i>
548 </p>
549 !!end
550 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
551 !! test
552 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
553 !! options
554 parsoid
555 !! input
556 ''foo'''''
557 !! result
558 <p><i>foo</i><b></b>
559 </p>
560 !!end
561
562
563 ###
564 ### 3-quote opening sequence tests
565 ###
566
567 !! test
568 Italics and bold: 3-quote opening sequence: (3,2)
569 !! input
570 '''foo''
571 !! result
572 <p>'<i>foo</i>
573 </p>
574 !!end
575
576
577 !! test
578 Italics and bold: 3-quote opening sequence: (3,3)
579 !! input
580 '''foo'''
581 !! result
582 <p><b>foo</b>
583 </p>
584 !!end
585
586
587 !! test
588 Italics and bold: 3-quote opening sequence: (3,4)
589 !! input
590 '''foo''''
591 !! result
592 <p><b>foo'</b>
593 </p>
594 !!end
595
596
597 !! test
598 Italics and bold: 3-quote opening sequence: (3,5) (php)
599 !! options
600 php
601 !! input
602 '''foo'''''
603 !! result
604 <p><b>foo</b>
605 </p>
606 !!end
607 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
608 !! test
609 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
610 !! options
611 parsoid
612 !! input
613 '''foo'''''
614 !! result
615 <p><b>foo</b><i></i>
616 </p>
617 !!end
618
619
620 ###
621 ### 4-quote opening sequence tests
622 ###
623
624 !! test
625 Italics and bold: 4-quote opening sequence: (4,2)
626 !! input
627 ''''foo''
628 !! result
629 <p>''<i>foo</i>
630 </p>
631 !!end
632
633
634 !! test
635 Italics and bold: 4-quote opening sequence: (4,3)
636 !! input
637 ''''foo'''
638 !! result
639 <p>'<b>foo</b>
640 </p>
641 !!end
642
643
644 !! test
645 Italics and bold: 4-quote opening sequence: (4,4)
646 !! input
647 ''''foo''''
648 !! result
649 <p>'<b>foo'</b>
650 </p>
651 !!end
652
653
654 !! test
655 Italics and bold: 4-quote opening sequence: (4,5) (php)
656 !! options
657 php
658 !! input
659 ''''foo'''''
660 !! result
661 <p>'<b>foo</b>
662 </p>
663 !!end
664 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
665 !! test
666 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
667 !! options
668 parsoid
669 !! input
670 ''''foo'''''
671 !! result
672 <p>'<b>foo</b><i></i>
673 </p>
674 !!end
675
676
677 ###
678 ### 5-quote opening sequence tests
679 ###
680
681 !! test
682 Italics and bold: 5-quote opening sequence: (5,2)
683 !! options
684 !! input
685 '''''foo''
686 !! result
687 <p><b><i>foo</i></b>
688 </p>
689 !!end
690
691
692 !! test
693 Italics and bold: 5-quote opening sequence: (5,3)
694 !! input
695 '''''foo'''
696 !! result
697 <p><i><b>foo</b></i>
698 </p>
699 !!end
700
701
702 !! test
703 Italics and bold: 5-quote opening sequence: (5,4)
704 !! input
705 '''''foo''''
706 !! result
707 <p><i><b>foo'</b></i>
708 </p>
709 !!end
710
711
712 !! test
713 Italics and bold: 5-quote opening sequence: (5,5)
714 !! input
715 '''''foo'''''
716 !! result
717 <p><i><b>foo</b></i>
718 </p>
719 !!end
720
721 ###
722 ### multiple quote sequences in a line
723 ###
724 !! test
725 Italics and bold: multiple quote sequences: (2,4,2)
726 !! input
727 ''foo''''bar''
728 !! result
729 <p><i>foo'<b>bar</b></i>
730 </p>
731 !!end
732
733
734 !! test
735 Italics and bold: multiple quote sequences: (2,4,3)
736 !! input
737 ''foo''''bar'''
738 !! result
739 <p><i>foo'<b>bar</b></i>
740 </p>
741 !!end
742
743
744 !! test
745 Italics and bold: multiple quote sequences: (2,4,4)
746 !! input
747 ''foo''''bar''''
748 !! result
749 <p><i>foo'<b>bar'</b></i>
750 </p>
751 !!end
752
753
754 !! test
755 Italics and bold: multiple quote sequences: (3,4,2) (php)
756 !! options
757 php
758 !! input
759 '''foo''''bar''
760 !! result
761 <p><b>foo'</b>bar
762 </p>
763 !!end
764 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
765 !! test
766 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
767 !! options
768 parsoid
769 !! input
770 '''foo''''bar''
771 !! result
772 <p><b>foo'</b>bar<i></i>
773 </p>
774 !!end
775
776
777 !! test
778 Italics and bold: multiple quote sequences: (3,4,3) (php)
779 !! options
780 php
781 !! input
782 '''foo''''bar'''
783 !! result
784 <p><b>foo'</b>bar
785 </p>
786 !!end
787 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
788 !! test
789 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
790 !! options
791 parsoid
792 !! input
793 '''foo''''bar'''
794 !! result
795 <p><b>foo'</b>bar<b></b>
796 </p>
797 !!end
798
799 ###
800 ### other quote tests
801 ###
802 !! test
803 Italics and bold: other quote tests: (2,3,5)
804 !! input
805 ''this is about '''foo's family'''''
806 !! result
807 <p><i>this is about <b>foo's family</b></i>
808 </p>
809 !!end
810
811
812 !! test
813 Italics and bold: other quote tests: (2,(3,3),2)
814 !! input
815 ''this is about '''foo's''' family''
816 !! result
817 <p><i>this is about <b>foo's</b> family</i>
818 </p>
819 !!end
820
821
822 !! test
823 Italics and bold: other quote tests: (3,2,3,2)
824 !! input
825 '''this is about ''foo'''s family''
826 !! result
827 <p><b>this is about <i>foo</i></b><i>s family</i>
828 </p>
829 !!end
830
831
832 !! test
833 Italics and bold: other quote tests: (3,2,3,3)
834 !! options
835 !! input
836 '''this is about ''foo'''s family'''
837 !! result
838 <p>'<i>this is about </i>foo<b>s family</b>
839 </p>
840 !!end
841
842
843 !! test
844 Italics and bold: other quote tests: (3,(2,2),3)
845 !! input
846 '''this is about ''foo's'' family'''
847 !! result
848 <p><b>this is about <i>foo's</i> family</b>
849 </p>
850 !!end
851
852
853 !! test
854 Italicized possessive
855 !! input
856 The ''[[Main Page]]'''s talk page.
857 !! result
858 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
859 </p>
860 !! end
861
862 !! test
863 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
864 (Requires tidy for PHP parser output to be fixed up)
865 !! options
866 parsoid=wt2html,wt2wt
867 !! input
868 {|
869 !''a!!''b
870 |''a||''b
871 |}
872 !! result
873 <table>
874 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
875 <td><i>a</i></td><td><i>b</i></td></tr>
876 </tbody></table>
877 !! end
878
879 ###
880 ### Non-html5 tags
881 ###
882
883 !! test
884 Non-html5 tags should be accepted
885 !! input
886 <center>''foo''</center>
887 <big>''foo''</big>
888 <font>''foo''</font>
889 <strike>''foo''</strike>
890 <tt>''foo''</tt>
891 !! result
892 <center><i>foo</i></center>
893 <p><big><i>foo</i></big>
894 <font><i>foo</i></font>
895 <strike><i>foo</i></strike>
896 <tt><i>foo</i></tt>
897 </p>
898 !! end
899
900 !! test
901 <wbr> is valid wikitext (bug 52468)
902 !! input
903 <wbr>
904 !! result
905 <p><wbr />
906 </p>
907 !! end
908
909 # <strike> is HTML4, <s> is HTML4/5.
910 !! test
911 <s> or <strike> for strikethrough
912 !! input
913 <strike>strike</strike>
914
915 <s>s</s>
916 !! result
917 <p><strike>strike</strike>
918 </p><p><s>s</s>
919 </p>
920 !! end
921
922 !! test
923 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
924 !! input
925 <b→> doesn't work! </b→>
926
927 <bä> doesn't work! </bä>
928
929 <boo> works fine </boo>
930
931 <s.foo>s.foo</s.foo>
932
933 <sub-ID#1>
934 !! result
935 <p>&lt;b→&gt; doesn't work! &lt;/b→&gt;
936 </p><p>&lt;bä&gt; doesn't work! &lt;/bä&gt;
937 </p><p>&lt;boo&gt; works fine &lt;/boo&gt;
938 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
939 </p><p>&lt;sub-ID#1&gt;
940 </p>
941 !! end
942
943 !! test
944 Isolated close tags should be treated as literal text (bug 52760)
945 !! input
946 </b>
947
948 <s.foo>s</s>
949 !! result
950 <p>&lt;/b&gt;
951 </p><p>&lt;s.foo&gt;s&lt;/s&gt;
952 </p>
953 !! end
954
955 ###
956 ### Special characters
957 ###
958
959 !! test
960 Bare pipe character (bug 52363)
961 !! input
962 |
963 !! result
964 <p>|
965 </p>
966 !! end
967
968 !! test
969 Bare pipe character from a template (bug 52363)
970 !! input
971 {{pipe}}
972 !! result
973 <p>|
974 </p>
975 !! end
976
977 ###
978 ### <nowiki> test cases
979 ###
980
981 !! test
982 <nowiki> unordered list
983 !! input
984 <nowiki>* This is not an unordered list item.</nowiki>
985 !! result
986 <p>* This is not an unordered list item.
987 </p>
988 !! end
989
990 !! test
991 <nowiki> spacing
992 !! input
993 <nowiki>Lorem ipsum dolor
994
995 sed abit.
996 sed nullum.
997
998 :and a colon
999 </nowiki>
1000 !! result
1001 <p>Lorem ipsum dolor
1002
1003 sed abit.
1004 sed nullum.
1005
1006 :and a colon
1007
1008 </p>
1009 !! end
1010
1011 !! test
1012 nowiki 3
1013 !! input
1014 :There is not nowiki.
1015 :There is <nowiki>nowiki</nowiki>.
1016
1017 #There is not nowiki.
1018 #There is <nowiki>nowiki</nowiki>.
1019
1020 *There is not nowiki.
1021 *There is <nowiki>nowiki</nowiki>.
1022 !! result
1023 <dl>
1024 <dd>There is not nowiki.
1025 </dd>
1026 <dd>There is nowiki.
1027 </dd>
1028 </dl>
1029 <ol>
1030 <li>There is not nowiki.
1031 </li>
1032 <li>There is nowiki.
1033 </li>
1034 </ol>
1035 <ul>
1036 <li>There is not nowiki.
1037 </li>
1038 <li>There is nowiki.
1039 </li>
1040 </ul>
1041
1042 !! end
1043
1044 !! test
1045 Entities inside <nowiki>
1046 !! input
1047 <nowiki>&lt;</nowiki>
1048 !! result
1049 <p>&lt;
1050 </p>
1051 !! end
1052
1053 !! test
1054 Entities inside template parameters
1055 !! options
1056 parsoid
1057 !! input
1058 {{echo|&ndash;}}
1059 !! result
1060 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span>
1061 </p>
1062 !! end
1063
1064 ###
1065 ### Comments
1066 ###
1067 !! test
1068 Comments and Indent-Pre
1069 !! input
1070 <!-- comment 1 --> asdf
1071
1072 <!-- comment 1 --> asdf
1073 <!-- comment 2 -->
1074
1075 <!-- comment 1 --> asdf
1076 <!-- comment 2 -->xyz
1077
1078 <!-- comment 1 --> asdf
1079 <!-- comment 2 --> xyz
1080 !! result
1081 <pre>asdf
1082 </pre>
1083 <pre>asdf
1084 </pre>
1085 <pre>asdf
1086 </pre>
1087 <p>xyz
1088 </p>
1089 <pre>asdf
1090 xyz
1091 </pre>
1092 !! end
1093
1094 !! test
1095 Comment test 2a
1096 !! input
1097 asdf
1098 <!-- comment 1 -->
1099 jkl
1100 !! result
1101 <p>asdf
1102 jkl
1103 </p>
1104 !! end
1105
1106 !! test
1107 Comment test 2b
1108 !! input
1109 asdf
1110 <!-- comment 1 -->
1111
1112 jkl
1113 !! result
1114 <p>asdf
1115 </p><p>jkl
1116 </p>
1117 !! end
1118
1119 !! test
1120 Comment test 3
1121 !! input
1122 asdf
1123 <!-- comment 1 -->
1124 <!-- comment 2 -->
1125 jkl
1126 !! result
1127 <p>asdf
1128 jkl
1129 </p>
1130 !! end
1131
1132 !! test
1133 Comment test 4
1134 !! input
1135 asdf<!-- comment 1 -->jkl
1136 !! result
1137 <p>asdfjkl
1138 </p>
1139 !! end
1140
1141 !! test
1142 Comment spacing
1143 !! input
1144 a
1145 <!-- foo --> b <!-- bar -->
1146 c
1147 !! result
1148 <p>a
1149 </p>
1150 <pre> b
1151 </pre>
1152 <p>c
1153 </p>
1154 !! end
1155
1156 !! test
1157 Comment whitespace
1158 !! input
1159 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1160 !! result
1161
1162 !! end
1163
1164 !! test
1165 Comment semantics and delimiters
1166 !! input
1167 <!-- --><!----><!-----><!------>
1168 !! result
1169
1170 !! end
1171
1172 !! test
1173 Comment semantics and delimiters, redux
1174 !! input
1175 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1176 -- foo -- funky huh? ... -->
1177 !! result
1178
1179 !! end
1180
1181 !! test
1182 Comment semantics and delimiters: directors cut
1183 !! input
1184 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1185 everything starting with < followed by !-- until the first -- and > we see,
1186 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1187 -->-->
1188 !! result
1189 <p>--&gt;
1190 </p>
1191 !! end
1192
1193 !! test
1194 Comment semantics: nesting
1195 !! input
1196 <!--<!-- no, we're not going to do anything fancy here -->-->
1197 !! result
1198 <p>--&gt;
1199 </p>
1200 !! end
1201
1202 !! test
1203 Comment semantics: unclosed comment at end
1204 !! input
1205 <!--This comment will run out to the end of the document
1206 !! result
1207
1208 !! end
1209
1210 !! test
1211 Comment in template title
1212 !! input
1213 {{f<!---->oo}}
1214 !! result
1215 <p>FOO
1216 </p>
1217 !! end
1218
1219 !! test
1220 Comment on its own line post-expand
1221 !! input
1222 a
1223 {{blank}}<!---->
1224 b
1225 !! result
1226 <p>a
1227 </p><p>b
1228 </p>
1229 !! end
1230
1231 !! test
1232 Comment on its own line post-expand with non-significant whitespace
1233 !! input
1234 a
1235 {{blank}} <!---->
1236 b
1237 !! result
1238 <p>a
1239 </p><p>b
1240 </p>
1241 !! end
1242
1243 ###
1244 ### paragraph wrapping tests
1245 ###
1246 !! test
1247 No block tags
1248 !! input
1249 a
1250
1251 b
1252 !! result
1253 <p>a
1254 </p><p>b
1255 </p>
1256 !! end
1257
1258 !! test
1259 Block tag on one line (<div>)
1260 !! input
1261 a <div>foo</div>
1262
1263 b
1264 !! result
1265 a <div>foo</div>
1266 <p>b
1267 </p>
1268 !! end
1269
1270 !! test
1271 Block tag on one line (<blockquote>)
1272 !! input
1273 a <blockquote>foo</blockquote>
1274
1275 b
1276 !! result
1277 a <blockquote>foo</blockquote>
1278 <p>b
1279 </p>
1280 !! end
1281
1282 !! test
1283 Block tag on both lines (<div>)
1284 !! input
1285 a <div>foo</div>
1286
1287 b <div>foo</div>
1288 !! result
1289 a <div>foo</div>
1290 b <div>foo</div>
1291
1292 !! end
1293
1294 !! test
1295 Block tag on both lines (<blockquote>)
1296 !! input
1297 a <blockquote>foo</blockquote>
1298
1299 b <blockquote>foo</blockquote>
1300 !! result
1301 a <blockquote>foo</blockquote>
1302 b <blockquote>foo</blockquote>
1303
1304 !! end
1305
1306 !! test
1307 Multiple lines without block tags
1308 !! input
1309 <div>foo</div> a
1310 b
1311 c
1312 d<!--foo--> e
1313 x <div>foo</div> z
1314 !! result
1315 <div>foo</div> a
1316 <p>b
1317 c
1318 d e
1319 </p>
1320 x <div>foo</div> z
1321
1322 !! end
1323
1324 !! test
1325 Empty lines between lines with block tags
1326 !! input
1327 <div></div>
1328
1329
1330 <div></div>a
1331
1332 b
1333 <div>a</div>b
1334
1335 <div>b</div>d
1336
1337
1338 <div>e</div>
1339 !! result
1340 <div></div>
1341 <p><br />
1342 </p>
1343 <div></div>a
1344 <p>b
1345 </p>
1346 <div>a</div>b
1347 <div>b</div>d
1348 <p><br />
1349 </p>
1350 <div>e</div>
1351
1352 !! end
1353
1354 ## PHP parser emits output which is broken
1355 !! test
1356 Unclosed HTML p-tags should be handled properly
1357 !! options
1358 parsoid
1359 !! input
1360 <div><p>foo</div>
1361 a
1362
1363 b
1364 !! result
1365 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1366 <p>a</p>
1367 <p>b</p>
1368 !! end
1369
1370 ###
1371 ### Preformatted text
1372 ###
1373 !! test
1374 Preformatted text
1375 !! input
1376 This is some
1377 Preformatted text
1378 With ''italic''
1379 And '''bold'''
1380 And a [[Main Page|link]]
1381 !! result
1382 <pre>This is some
1383 Preformatted text
1384 With <i>italic</i>
1385 And <b>bold</b>
1386 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1387 </pre>
1388 !! end
1389
1390 !! test
1391 Tabs don't trigger preformatted text
1392 !! input
1393 This is not
1394 preformatted text.
1395 This is preformatted text.
1396 So is this.
1397 !! result
1398 <p> This is not
1399 preformatted text.
1400 </p>
1401 <pre>This is preformatted text.
1402 So is this.
1403 </pre>
1404 !! end
1405
1406 !! test
1407 Ident preformatting with inline content
1408 !! input
1409 a
1410 ''b''
1411 !! result
1412 <pre>a
1413 <i>b</i>
1414 </pre>
1415 !! end
1416
1417 !! test
1418 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1419 !! input
1420 <pre><nowiki>
1421 <b>
1422 <cite>
1423 <em>
1424 </nowiki></pre>
1425 !! result
1426 <pre>
1427 &lt;b&gt;
1428 &lt;cite&gt;
1429 &lt;em&gt;
1430 </pre>
1431
1432 !! end
1433
1434 !! test
1435 Regression with preformatted in <center>
1436 !! input
1437 <center>
1438 Blah
1439 </center>
1440 !! result
1441 <center>
1442 <pre>Blah
1443 </pre>
1444 </center>
1445
1446 !! end
1447
1448 !! test
1449 Bug 52763: Preformatted in <blockquote>
1450 !! input
1451 <blockquote>
1452 Blah
1453 {|
1454 |
1455 indented cell (no pre-wrapping!)
1456 |}
1457 </blockquote>
1458 !! result
1459 <blockquote>
1460 <p> Blah
1461 </p>
1462 <table>
1463 <tr>
1464 <td>
1465 <p> indented cell (no pre-wrapping!)
1466 </p>
1467 </td></tr></table>
1468 </blockquote>
1469
1470 !! end
1471
1472 !! test
1473 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1474 !! input
1475 <blockquote>
1476 Foo
1477
1478 Bar
1479 </blockquote>
1480 !! result
1481 <blockquote>
1482 <p>Foo
1483 </p><p>Bar
1484 </p>
1485 </blockquote>
1486
1487 !! end
1488
1489 !! test
1490 Bug 15491: <ins>/<del> in blockquote
1491 !! input
1492 <blockquote>
1493 Foo <del>bar</del> <ins>baz</ins> quux
1494 </blockquote>
1495 !! result
1496 <blockquote>
1497 <p>Foo <del>bar</del> <ins>baz</ins> quux
1498 </p>
1499 </blockquote>
1500
1501 !! end
1502
1503 # Note that the p-wrapping is newline sensitive, which could be
1504 # considered a bug: tidy will wrap only the 'Foo' in the example
1505 # below in a <p> tag. (see comment 23-25 of bug #6200)
1506 !! test
1507 Bug 15491: <ins>/<del> in blockquote (2)
1508 !! input
1509 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1510 </blockquote>
1511 !! result
1512 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1513 </blockquote>
1514
1515 !! end
1516
1517 !! test
1518 <pre> with attributes (bug 3202)
1519 !! input
1520 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1521 !! result
1522 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1523
1524 !! end
1525
1526 !! test
1527 <pre> with width attribute (bug 3202)
1528 !! input
1529 <pre width="8">Narrow screen goodies</pre>
1530 !! result
1531 <pre width="8">Narrow screen goodies</pre>
1532
1533 !! end
1534
1535 !! test
1536 <pre> with forbidden attribute (bug 3202)
1537 !! input
1538 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1539 !! result
1540 <pre width="8">Narrow screen goodies</pre>
1541
1542 !! end
1543
1544 !! test
1545 Entities inside <pre>
1546 !! input
1547 <pre>&lt;</pre>
1548 !! result
1549 <pre>&lt;</pre>
1550
1551 !! end
1552
1553 !! test
1554 <pre> with forbidden attribute values (bug 3202)
1555 !! input
1556 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1557 !! result
1558 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1559
1560 !! end
1561
1562 !! test
1563 <nowiki> inside <pre> (bug 13238)
1564 !! input
1565 <pre>
1566 <nowiki>
1567 </pre>
1568 <pre>
1569 <nowiki></nowiki>
1570 </pre>
1571 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1572 !! result
1573 <pre>
1574 &lt;nowiki&gt;
1575 </pre>
1576 <pre>
1577
1578 </pre>
1579 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1580
1581 !! end
1582
1583 !! test
1584 <nowiki> and <pre> preference (first one wins)
1585 !! input
1586 <pre>
1587 <nowiki>
1588 </pre>
1589 </nowiki>
1590 </pre>
1591
1592 <nowiki>
1593 <pre>
1594 <nowiki>
1595 </pre>
1596 </nowiki>
1597 </pre>
1598
1599 !! result
1600 <pre>
1601 &lt;nowiki&gt;
1602 </pre>
1603 <p>&lt;/nowiki&gt;
1604 &lt;/pre&gt;
1605 </p><p>
1606 &lt;pre&gt;
1607 &lt;nowiki&gt;
1608 &lt;/pre&gt;
1609
1610 &lt;/pre&gt;
1611 </p>
1612 !! end
1613
1614 !! test
1615 </pre> inside nowiki
1616 !! input
1617 <nowiki></pre></nowiki>
1618 !! result
1619 <p>&lt;/pre&gt;
1620 </p>
1621 !! end
1622
1623 !! test
1624 Empty pre; pre inside other HTML tags (bug 54946)
1625 !! input
1626 a
1627
1628 <div><pre>
1629 foo
1630 </pre></div>
1631 <pre></pre>
1632 !! result
1633 <p>a
1634 </p>
1635 <div><pre>
1636 foo
1637 </pre></div>
1638 <pre></pre>
1639
1640 !! end
1641
1642 !! test
1643 HTML pre followed by indent-pre
1644 !! input
1645 <pre>foo</pre>
1646 bar
1647 !! result
1648 <pre>foo</pre>
1649 <pre>bar
1650 </pre>
1651 !! end
1652
1653 !!test
1654 Block tag pre
1655 !!options
1656 parsoid
1657 !!input
1658 <p><pre>foo</pre></p>
1659 !!result
1660 <p data-parsoid='{"stx":"html","autoInsertedEnd":true,"dsr":[0,3,3,0]}'></p><pre data-parsoid='{"stx":"html","dsr":[3,17,5,6]}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html","dsr":[17,21,0,null]}'></p>
1661 !!end
1662
1663 !!test
1664 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1665 !!input
1666 {{echo|}}
1667 !!result
1668
1669 !!end
1670
1671 !!test
1672 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1673 !!input
1674 {{echo|
1675 foo}}
1676 !!result
1677 <p>foo
1678 </p>
1679 !!end
1680
1681 !! test
1682 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1683 !! input
1684 {{echo|a
1685 b}}
1686 !!result
1687 <pre>a
1688 </pre>
1689 <p>b
1690 </p>
1691 !!end
1692
1693 !! test
1694 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1695 !! input
1696 {{echo|a
1697 b
1698 c
1699 d
1700 e
1701 }}
1702 !!result
1703 <pre>a
1704 </pre>
1705 <p>b
1706 c
1707 </p>
1708 <pre>d
1709 </pre>
1710 <p>e
1711 </p>
1712 !!end
1713
1714 !!test
1715 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1716 !!input
1717 {{echo| foo}}
1718
1719 {{echo| foo}}{{echo| bar}}
1720
1721 {{echo| foo}}
1722 {{echo| bar}}
1723
1724 {{echo|<!--cmt--> foo}}
1725
1726 <!--cmt-->{{echo| foo}}
1727
1728 {{echo|{{echo| }}bar}}
1729 !!result
1730 <pre>foo
1731 </pre>
1732 <pre>foo bar
1733 </pre>
1734 <pre>foo
1735 bar
1736 </pre>
1737 <pre>foo
1738 </pre>
1739 <pre>foo
1740 </pre>
1741 <pre>bar
1742 </pre>
1743 !!end
1744
1745 !! test
1746 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1747 !! input
1748 {{echo| }}a
1749
1750 {{echo|
1751 }}a
1752
1753 {{echo|
1754 b}}
1755
1756 {{echo|a
1757 }}b
1758
1759 {{echo|a
1760 }} b
1761 !!result
1762 <pre>a
1763 </pre>
1764 <p><br />
1765 </p>
1766 <pre>a
1767 </pre>
1768 <p><br />
1769 </p>
1770 <pre>b
1771 </pre>
1772 <p>a
1773 </p>
1774 <pre>b
1775 </pre>
1776 <p>a
1777 </p>
1778 <pre>b
1779 </pre>
1780 !!end
1781
1782 !! test
1783 Things that look like <pre> tags aren't treated as such
1784 !! input
1785 Barack Obama <President> of the United States
1786 !! result
1787 <p>Barack Obama &lt;President&gt; of the United States
1788 </p>
1789 !! end
1790
1791 !! test
1792 Parsoid: handle pre with space after attribute
1793 !! options
1794 parsoid=wt2html
1795 !! input
1796 <pre style="width:50%;" >{{echo|foo}}</pre>
1797 !! result
1798 <pre style="width:50%;">{{echo|foo}}</pre>
1799 !! end
1800
1801 # TODO / maybe: fix wt2wt for this
1802 !! test
1803 Parsoid: Don't paragraph-wrap fosterable content
1804 !! options
1805 parsoid=wt2html
1806 !! input
1807 {|
1808 <td></td>
1809 <td></td>
1810
1811
1812
1813 |}
1814 !! result
1815 <table>
1816
1817 <tbody>
1818 <tr>
1819 <td></td>
1820
1821 <td></td></tr>
1822
1823
1824
1825 </tbody></table>
1826 !! end
1827
1828 !! test
1829 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
1830 !! options
1831 parsoid=wt2html
1832 !! input
1833 {|
1834 <td>
1835 <td>
1836 </td>
1837
1838
1839
1840 |}
1841 !! result
1842 <table>
1843
1844 <tbody>
1845 <tr>
1846 <td></td>
1847
1848 <td>
1849 </td></tr>
1850
1851
1852
1853 </tbody></table>
1854 !! end
1855
1856
1857 #--------------------------------------------------------------------
1858 # Transclusion parameter whitespace stripping tests
1859 # Behavior is different for positional and named parameters
1860 #--------------------------------------------------------------------
1861 !! test
1862 Templates: Strip leading and trailing whitespace from named-param values
1863 !! input
1864 {{echo|1= a }}
1865
1866 {{echo|1= {{echo|b}} }}
1867
1868 {{echo| 1 =
1869 c }}
1870
1871 {{echo| 1 =
1872 * d
1873 }}
1874 !! result
1875 <p>a
1876 </p><p>b
1877 </p><p>c
1878 </p>
1879 <ul>
1880 <li> d
1881 </li>
1882 </ul>
1883
1884 !! end
1885
1886 !! test
1887 Templates: Don't strip whitespace from positional-param values
1888 !! input
1889 {{echo|a }}
1890
1891 {{echo|{{echo|b}} }}
1892
1893 {{echo| c
1894 }}
1895
1896 {{echo| {{echo|d}}
1897 }}
1898
1899 {{echo|
1900 e}}
1901
1902 {{echo|
1903 * f}}
1904
1905 {{echo|
1906 }}g
1907 !! result
1908 <p>a
1909 </p><p>b
1910 </p>
1911 <pre>c
1912 </pre>
1913 <p><br />
1914 </p>
1915 <pre>d
1916 </pre>
1917 <p><br />
1918 </p>
1919 <pre>e
1920 </pre>
1921 <p><br />
1922 </p>
1923 <ul>
1924 <li> f
1925 </li>
1926 </ul>
1927 <p><br />
1928 </p>
1929 <pre>g
1930 </pre>
1931 !! end
1932
1933 !! test
1934 Templates: Handle empty comment-and-ws-only lines correctly
1935 !! input
1936 {{echo|foo
1937 <!--should be ignored-->
1938 <!--should be ignored as well-->
1939 bar}}
1940 !! result
1941 <p>foo
1942 bar
1943 </p>
1944 !! end
1945
1946 #--------------------------------------------------------------------
1947 # Transclusion parameter escaping tests
1948 #--------------------------------------------------------------------
1949 !! test
1950 Templates: Parsoid parameter escaping test 1
1951 !! options
1952 parsoid
1953 !! input
1954 {{echo|[foo]|{{echo|[bar]}}}}
1955 !! result
1956 <p about="#mwt1" typeof="mw:Transclusion"
1957 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
1958 !! end
1959
1960 !! test
1961 Parsoid: Pipes in external links in template parameter
1962 !! options
1963 parsoid
1964 !! input
1965 {{echo|[{{echo|http://example.com}} link]}}
1966 !! result
1967 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
1968 !! end
1969
1970 !! test
1971 Parsoid: pipe in transclusion parameter
1972 !! options
1973 parsoid
1974 !! input
1975 {{echo|http://foo.com/a&#124;b}}
1976 !! result
1977 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1978 typeof="mw:Transclusion"
1979 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a|b</a></p>
1980 !! end
1981
1982 !! test
1983 Parsoid: Pipe in external link target and content in template parameter
1984 !! options
1985 parsoid=html2wt,wt2wt
1986 !! input
1987 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
1988 !! result
1989 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1990 typeof="mw:Transclusion"
1991 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
1992 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
1993 !! end
1994
1995 !! test
1996 Templates: Don't escape already nowiki-escaped text in template parameters
1997 !! options
1998 parsoid=html2wt,wt2wt
1999 !! input
2000 {{echo|foo<nowiki>|</nowiki>bar}}
2001 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2002 {{echo|<nowiki></nowiki>}}
2003 !! result
2004 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
2005 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
2006 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
2007 </p>
2008 !! end
2009
2010 ## Bug 52824
2011 !! test
2012 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2013 !! options
2014 parsoid=html2wt,wt2wt
2015 !! input
2016 {{echo|{{echo|1=bar}}}}
2017 !! result
2018 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
2019 !! end
2020
2021 ## Bug 56733
2022 !! test
2023 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2024 !! options
2025 parsoid
2026 !! input
2027 {{echo|a : b}}
2028 !! result
2029 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
2030 !! end
2031
2032 ###
2033 ### Parsoid-centric tests for testing RT edge cases for pre
2034 ###
2035
2036 !!test
2037 1a. Indent-Pre and Comments
2038 !!input
2039 a
2040 <!--a-->
2041 c
2042 !!result
2043 <pre>a
2044 </pre>
2045 <p>c
2046 </p>
2047 !!end
2048
2049 !!test
2050 1b. Indent-Pre and Comments
2051 !!input
2052 a
2053 <!--a-->
2054 c
2055 !!result
2056 <pre>a
2057 </pre>
2058 <p>c
2059 </p>
2060 !!end
2061
2062 !!test
2063 1c. Indent-Pre and Comments
2064 !!input
2065 <!--a--> a
2066
2067 <!--a--> a
2068 !!result
2069 <pre> a
2070 </pre>
2071 <pre> a
2072 </pre>
2073 !!end
2074
2075 !!test
2076 1d. Indent-Pre and Comments
2077 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2078 !!input
2079 <!--a--> a
2080
2081 <!--b-->b
2082 !!result
2083 <pre>a
2084 </pre>
2085 <pre>b
2086 </pre>
2087 !!end
2088
2089 !!test
2090 2a. Indent-Pre and tables
2091 !!input
2092 {|
2093 |-
2094 !h1!!h2
2095 |foo||bar
2096 |}
2097 !!result
2098 <table>
2099
2100 <tr>
2101 <th>h1</th>
2102 <th>h2
2103 </th>
2104 <td>foo</td>
2105 <td>bar
2106 </td></tr></table>
2107
2108 !!end
2109
2110 !!test
2111 2b. Indent-Pre and tables
2112 !!input
2113 {|
2114 |-
2115 |foo
2116 |}
2117 !!result
2118 <table>
2119
2120 <tr>
2121 <td>foo
2122 </td></tr></table>
2123
2124 !!end
2125
2126 !!test
2127 2c. Indent-Pre and tables (bug 42252)
2128 !!input
2129 {|
2130 |+ foo
2131 ! | bar
2132 |}
2133 !!result
2134 <table>
2135 <caption> foo
2136 </caption>
2137 <tr>
2138 <th> bar
2139 </th></tr></table>
2140
2141 !!end
2142
2143 !!test
2144 3a. Indent-Pre and block tags (single-line html)
2145 !!input
2146 a <p> foo </p>
2147 b <div> foo </div>
2148 c <blockquote> foo </blockquote>
2149 <span> foo </span>
2150 !!result
2151 a <p> foo </p>
2152 b <div> foo </div>
2153 c <blockquote> foo </blockquote>
2154 <pre><span> foo </span>
2155 </pre>
2156 !!end
2157
2158 !!test
2159 3c. Indent-Pre and block tags (multi-line html)
2160 !!input
2161 a <span>foo</span>
2162 b <div> foo </div>
2163 !!result
2164 <pre>a <span>foo</span>
2165 </pre>
2166 b <div> foo </div>
2167
2168 !!end
2169
2170 !!test
2171 3b. Indent-Pre and block tags (pre-content on separate line)
2172 !!input
2173 <p>
2174 foo
2175 </p>
2176
2177 <div>
2178 foo
2179 </div>
2180
2181 <center>
2182 foo
2183 </center>
2184
2185 <blockquote>
2186 foo
2187 </blockquote>
2188
2189 <blockquote>
2190 <pre>
2191 foo
2192 </pre>
2193 </blockquote>
2194
2195 <table><tr><td>
2196 foo
2197 </td></tr></table>
2198
2199 <ul><li>
2200 foo
2201 </li></ul>
2202
2203 !!result
2204 <p>
2205 foo
2206 </p>
2207 <div>
2208 <pre>foo
2209 </pre>
2210 </div>
2211 <center>
2212 <pre>foo
2213 </pre>
2214 </center>
2215 <blockquote>
2216 <p> foo
2217 </p>
2218 </blockquote>
2219 <blockquote>
2220 <pre>
2221 foo
2222 </pre>
2223 </blockquote>
2224 <table><tr><td>
2225 <pre>foo
2226 </pre>
2227 </td></tr></table>
2228 <ul><li>
2229 foo
2230 </li></ul>
2231
2232 !!end
2233
2234 !!test
2235 4. Multiple spaces at start-of-line
2236 !!input
2237 <p> foo </p>
2238 foo
2239 {|
2240 |foo
2241 |}
2242 !!result
2243 <p> foo </p>
2244 <pre> foo
2245 </pre>
2246 <table>
2247 <tr>
2248 <td>foo
2249 </td></tr></table>
2250
2251 !!end
2252
2253 ## NOTE: the leading white-space chars on empty line are significant
2254 !! test
2255 5a. White-space in indent-pre
2256 !! input
2257 a<br />
2258
2259 b
2260 !! result
2261 <pre>a<br />
2262
2263 b
2264 </pre>
2265 !! end
2266
2267 ## NOTE: the leading white-space chars on empty line are significant
2268 !! test
2269 5b. White-space in indent-pre
2270 !! input
2271 a
2272
2273 b
2274
2275
2276 c
2277 !! result
2278 <pre>a
2279
2280 b
2281
2282
2283 c
2284 </pre>
2285 !! end
2286
2287 !! test
2288 5c. White-space in indent-pre
2289 !! input
2290 ''a''
2291 ''b''
2292 ''c''
2293 !! result
2294 <pre><i>a</i>
2295 <i>b</i>
2296 <i>c</i>
2297 </pre>
2298 !! end
2299
2300 !! test
2301 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2302 !! input
2303 a
2304
2305 <!-- continue -->
2306 b
2307
2308 c
2309
2310 d
2311 !! result
2312 <pre>a
2313
2314 b
2315 </pre>
2316 <pre>c
2317
2318 </pre>
2319 <p>d
2320 </p>
2321 !! end
2322
2323 !! test
2324 7a. Indent-pre and category links
2325 !! options
2326 parsoid=wt2html,wt2wt
2327 !! input
2328 [[Category:foo]] <!-- No pre-wrapping -->
2329 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2330 !! result
2331 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
2332 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span>
2333 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
2334 !! end
2335
2336 !! test
2337 7b. Indent-pre and category links
2338 !! options
2339 parsoid=wt2html,wt2wt
2340 !! input
2341 [[Category:foo]] a
2342 [[Category:foo]] {{echo|b}}
2343 !! result
2344 <pre>
2345 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
2346
2347 <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>
2348 !! end
2349
2350 ###
2351 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2352 ###
2353
2354 !!test
2355 HTML-pre: 1. embedded newlines
2356 !!input
2357 <pre>foo</pre>
2358
2359 <pre>
2360 foo
2361 </pre>
2362
2363 <pre>
2364
2365 foo
2366 </pre>
2367
2368 <pre>
2369
2370
2371 foo
2372 </pre>
2373 !!result
2374 <pre>foo</pre>
2375 <pre>
2376 foo
2377 </pre>
2378 <pre>
2379
2380 foo
2381 </pre>
2382 <pre>
2383
2384
2385 foo
2386 </pre>
2387
2388 !!end
2389
2390 !!test
2391 HTML-pre: 2: indented text
2392 !!input
2393 <pre>
2394 foo
2395 </pre>
2396 !!result
2397 <pre>
2398 foo
2399 </pre>
2400
2401 !!end
2402
2403 !!test
2404 HTML-pre: 3: other wikitext
2405 !!input
2406 <pre>
2407 * foo
2408 # bar
2409 = no-h =
2410 '' no-italic ''
2411 [[ NoLink ]]
2412 </pre>
2413 !!result
2414 <pre>
2415 * foo
2416 # bar
2417 = no-h =
2418 '' no-italic ''
2419 [[ NoLink ]]
2420 </pre>
2421
2422 !!end
2423
2424 ###
2425 ### Definition lists
2426 ###
2427 !! test
2428 Simple definition
2429 !! input
2430 ; name : Definition
2431 !! result
2432 <dl>
2433 <dt> name&#160;</dt>
2434 <dd> Definition
2435 </dd>
2436 </dl>
2437
2438 !! end
2439
2440 !! test
2441 Definition list for indentation only
2442 !! input
2443 : Indented text
2444 !! result
2445 <dl>
2446 <dd> Indented text
2447 </dd>
2448 </dl>
2449
2450 !! end
2451
2452 !! test
2453 Definition list with no space
2454 !! input
2455 ;name:Definition
2456 !! result
2457 <dl>
2458 <dt>name</dt>
2459 <dd>Definition
2460 </dd>
2461 </dl>
2462
2463 !!end
2464
2465 !! test
2466 Definition list with URL link
2467 !! input
2468 ; http://example.com/ : definition
2469 !! result
2470 <dl>
2471 <dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
2472 <dd> definition
2473 </dd>
2474 </dl>
2475
2476 !! end
2477
2478 !! test
2479 Definition list with bracketed URL link
2480 !! input
2481 ;[http://www.example.com/ Example]:Something about it
2482 !! result
2483 <dl>
2484 <dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
2485 <dd>Something about it
2486 </dd>
2487 </dl>
2488
2489 !! end
2490
2491 !! test
2492 Definition list with wikilink containing colon
2493 !! input
2494 ; [[Help:FAQ]]: The least-read page on Wikipedia
2495 !! result
2496 <dl>
2497 <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>
2498 <dd> The least-read page on Wikipedia
2499 </dd>
2500 </dl>
2501
2502 !! end
2503
2504 # At Brion's and JeLuF's insistence... :)
2505 !! test
2506 Definition list with news link containing colon
2507 !! input
2508 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
2509 !! result
2510 <dl>
2511 <dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
2512 <dd> This isn't even a real newsgroup!
2513 </dd>
2514 </dl>
2515
2516 !! end
2517
2518 !! test
2519 Malformed definition list with colon
2520 !! input
2521 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2522 !! result
2523 <dl>
2524 <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
2525 </dt>
2526 </dl>
2527
2528 !! end
2529
2530 !! test
2531 Definition lists: colon in external link text
2532 !! input
2533 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2534 !! result
2535 <dl>
2536 <dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
2537 <dd> OK, I made that up
2538 </dd>
2539 </dl>
2540
2541 !! end
2542
2543 !! test
2544 Definition lists: colon in HTML attribute
2545 !! input
2546 ;<b style="display: inline">bold</b>
2547 !! result
2548 <dl>
2549 <dt><b style="display: inline">bold</b>
2550 </dt>
2551 </dl>
2552
2553 !! end
2554
2555 !! test
2556 Definition lists: self-closed tag
2557 !! input
2558 ;one<br/>two : two-line fun
2559 !! result
2560 <dl>
2561 <dt>one<br />two&#160;</dt>
2562 <dd> two-line fun
2563 </dd>
2564 </dl>
2565
2566 !! end
2567
2568 !! test
2569 Bug 11748: Literal closing tags
2570 !! input
2571 <dl>
2572 <dt>test 1</dt>
2573 <dd>test test test test test</dd>
2574 <dt>test 2</dt>
2575 <dd>test test test test test</dd>
2576 </dl>
2577 !! result
2578 <dl>
2579 <dt>test 1</dt>
2580 <dd>test test test test test</dd>
2581 <dt>test 2</dt>
2582 <dd>test test test test test</dd>
2583 </dl>
2584
2585 !! end
2586
2587 !! test
2588 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2589 !! input
2590 <ul><li>
2591 ; term : description
2592 * unordered
2593 </li></ul>
2594 !! result
2595 <ul><li>
2596 <dl>
2597 <dt> term&#160;</dt>
2598 <dd> description
2599 </dd>
2600 </dl>
2601 <ul>
2602 <li> unordered
2603 </li>
2604 </ul>
2605 </li></ul>
2606
2607 !! end
2608
2609 !! test
2610
2611 Definition list with empty definition and following paragraph
2612 !! input
2613 ; term:
2614 Paragraph text
2615 !! result
2616 <dl>
2617 <dt> term</dt>
2618 <dd>
2619 </dd>
2620 </dl>
2621 <p>Paragraph text
2622 </p>
2623 !! end
2624
2625 !! test
2626 Nested definition lists using html syntax
2627 !! input
2628 <dl><dd>
2629 <dl>
2630 <dd>Foo</dd>
2631 </dl>
2632 </dd></dl>
2633 !! result
2634 <dl><dd>
2635 <dl>
2636 <dd>Foo</dd>
2637 </dl>
2638 </dd></dl>
2639
2640 !! end
2641
2642 !! test
2643 Definition Lists: No nesting: Multiple dd's
2644 !! input
2645 ;x
2646 :a
2647 :b
2648 !! result
2649 <dl>
2650 <dt>x
2651 </dt>
2652 <dd>a
2653 </dd>
2654 <dd>b
2655 </dd>
2656 </dl>
2657
2658 !! end
2659
2660 !! test
2661 Definition Lists: Indentation: Regular
2662 !! input
2663 :i1
2664 ::i2
2665 :::i3
2666 !! result
2667 <dl>
2668 <dd>i1
2669 <dl>
2670 <dd>i2
2671 <dl>
2672 <dd>i3
2673 </dd>
2674 </dl>
2675 </dd>
2676 </dl>
2677 </dd>
2678 </dl>
2679
2680 !! end
2681
2682 !! test
2683 Definition Lists: Indentation: Missing 1st level
2684 !! input
2685 ::i2
2686 :::i3
2687 !! result
2688 <dl>
2689 <dd><dl>
2690 <dd>i2
2691 <dl>
2692 <dd>i3
2693 </dd>
2694 </dl>
2695 </dd>
2696 </dl>
2697 </dd>
2698 </dl>
2699
2700 !! end
2701
2702 !! test
2703 Definition Lists: Indentation: Multi-level indent
2704 !! input
2705 :::i3
2706 !! result
2707 <dl>
2708 <dd><dl>
2709 <dd><dl>
2710 <dd>i3
2711 </dd>
2712 </dl>
2713 </dd>
2714 </dl>
2715 </dd>
2716 </dl>
2717
2718 !! end
2719
2720 !! test
2721 Definition Lists: Hacky use to indent tables
2722 !! input
2723 ::{|
2724 |foo
2725 |bar
2726 |}
2727 this text
2728 should be left alone
2729 !! result
2730 <dl><dd><dl><dd><table>
2731 <tr>
2732 <td>foo
2733 </td>
2734 <td>bar
2735 </td></tr></table></dd></dl></dd></dl>
2736 <p>this text
2737 should be left alone
2738 </p>
2739 !! end
2740
2741 # Bug 52473
2742 !! test
2743 Definition Lists: Hacky use to indent tables (WS-insensitive)
2744 !! options
2745 parsoid
2746 !! input
2747 : {|
2748 |a
2749 |}
2750 !! result
2751 <dl>
2752 <dd> <table><tr><td>a</td></tr></table> </dd>
2753 </dl>
2754 !! end
2755 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2756 ## as an empty dt item. It also ignores all but the last ";" when followed
2757 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2758 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2759 ## ";"s.
2760 ##
2761 ## Ex: ";;t2 ::d2" is transformed into:
2762 ##
2763 ## <dl>
2764 ## <dt>t2 </dt>
2765 ## <dd>
2766 ## <dl>
2767 ## <dt></dt>
2768 ## <dd>d2</dd>
2769 ## </dl>
2770 ## </dd>
2771 ## </dl>
2772 ##
2773 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2774 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2775 ##
2776 ## <dl>
2777 ## <dt>
2778 ## <dl>
2779 ## <dt>t2 </dt>
2780 ## <dd>:d2</dd>
2781 ## </dl>
2782 ## </dt>
2783 ## </dl>
2784 ##
2785 ## All Parsoid only definition list tests have this difference.
2786 ##
2787 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2788 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2789
2790 !! test
2791 Table / list interaction: indented table with lists in table contents
2792 !! input
2793 :{|
2794 |-
2795 | a
2796 * b
2797 |-
2798 | c
2799 * d
2800 |}
2801 !! result
2802 <dl><dd><table>
2803
2804 <tr>
2805 <td> a
2806 <ul>
2807 <li> b
2808 </li>
2809 </ul>
2810 </td></tr>
2811 <tr>
2812 <td> c
2813 <ul>
2814 <li> d
2815 </li>
2816 </ul>
2817 </td></tr></table></dd></dl>
2818
2819 !! end
2820
2821 !!test
2822 Table / list interaction: lists nested in tables nested in indented lists
2823 !!input
2824 :{|
2825 |
2826 :a
2827 :b
2828 |
2829 *c
2830 *d
2831 |}
2832
2833 *e
2834 *f
2835 !!result
2836 <dl><dd><table>
2837 <tr>
2838 <td>
2839 <dl>
2840 <dd>a
2841 </dd>
2842 <dd>b
2843 </dd>
2844 </dl>
2845 </td>
2846 <td>
2847 <ul>
2848 <li>c
2849 </li>
2850 <li>d
2851 </li>
2852 </ul>
2853 </td></tr></table></dd></dl>
2854 <ul>
2855 <li>e
2856 </li>
2857 <li>f
2858 </li>
2859 </ul>
2860
2861 !!end
2862
2863 !! test
2864 Definition Lists: Nesting: Multi-level (Parsoid only)
2865 !! options
2866 parsoid
2867 !! input
2868 ;t1 :d1
2869 ;;t2 ::d2
2870 ;;;t3 :::d3
2871 !! result
2872 <dl>
2873 <dt>t1 </dt>
2874 <dd>d1</dd>
2875 <dt>
2876 <dl>
2877 <dt>t2 </dt>
2878 <dd>:d2</dd>
2879 <dt>
2880 <dl>
2881 <dt>t3 </dt>
2882 <dd>::d3</dd>
2883 </dl>
2884 </dt>
2885 </dl>
2886 </dt>
2887 </dl>
2888
2889
2890 !! end
2891
2892
2893 !! test
2894 Definition Lists: Nesting: Test 2 (Parsoid only)
2895 !! options
2896 parsoid
2897 !! input
2898 ;t1
2899 ::d2
2900 !! result
2901 <dl>
2902 <dt>t1</dt>
2903 <dd>
2904 <dl>
2905 <dd>d2</dd>
2906 </dl>
2907 </dd>
2908 </dl>
2909
2910 !! end
2911
2912
2913 !! test
2914 Definition Lists: Nesting: Test 3 (Parsoid only)
2915 !! options
2916 parsoid
2917 !! input
2918 :;t1
2919 ::::d2
2920 !! result
2921 <dl>
2922 <dd>
2923 <dl>
2924 <dt>t1</dt>
2925 <dd>
2926 <dl>
2927 <dd>
2928 <dl>
2929 <dd>d2</dd>
2930 </dl>
2931 </dd>
2932 </dl>
2933 </dd>
2934 </dl>
2935 </dd>
2936 </dl>
2937
2938 !! end
2939
2940
2941 !! test
2942 Definition Lists: Nesting: Test 4
2943 !! input
2944 ::;t3
2945 :::d3
2946 !! result
2947 <dl>
2948 <dd><dl>
2949 <dd><dl>
2950 <dt>t3
2951 </dt>
2952 <dd>d3
2953 </dd>
2954 </dl>
2955 </dd>
2956 </dl>
2957 </dd>
2958 </dl>
2959
2960 !! end
2961
2962
2963 ## The Parsoid team believes the following three test exposes a
2964 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2965 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2966 !! test
2967 Definition Lists: Mixed Lists: Test 1 (php)
2968 !! options
2969 php
2970 !! input
2971 :;* foo
2972 ::* bar
2973 :; baz
2974 !! result
2975 <dl>
2976 <dd><dl>
2977 <dt><ul>
2978 <li> foo
2979 </li>
2980 <li> bar
2981 </li>
2982 </ul>
2983 </dt>
2984 </dl>
2985 <dl>
2986 <dt> baz
2987 </dt>
2988 </dl>
2989 </dd>
2990 </dl>
2991
2992 !! end
2993 !! test
2994 Definition Lists: Mixed Lists: Test 1 (parsoid)
2995 !! options
2996 parsoid
2997 !! input
2998 :;* foo
2999 ::* bar
3000 :; baz
3001 !! result
3002 <dl>
3003 <dd><dl>
3004 <dt><ul>
3005 <li> foo
3006 </li>
3007 </ul></dt>
3008 <dd><ul>
3009 <li> bar
3010 </li>
3011 </ul></dd>
3012 <dt> baz</dt>
3013 </dl></dd>
3014 </dl>
3015 !! end
3016
3017 !! test
3018 Definition Lists: Mixed Lists: Test 2
3019 !! input
3020 *: d1
3021 *: d2
3022 !! result
3023 <ul>
3024 <li><dl>
3025 <dd> d1
3026 </dd>
3027 <dd> d2
3028 </dd>
3029 </dl>
3030 </li>
3031 </ul>
3032
3033 !! end
3034
3035
3036 !! test
3037 Definition Lists: Mixed Lists: Test 3
3038 !! input
3039 *::: d1
3040 *::: d2
3041 !! result
3042 <ul>
3043 <li><dl>
3044 <dd><dl>
3045 <dd><dl>
3046 <dd> d1
3047 </dd>
3048 <dd> d2
3049 </dd>
3050 </dl>
3051 </dd>
3052 </dl>
3053 </dd>
3054 </dl>
3055 </li>
3056 </ul>
3057
3058 !! end
3059
3060
3061 !! test
3062 Definition Lists: Mixed Lists: Test 4
3063 !! input
3064 *;d1 :d2
3065 *;d3 :d4
3066 !! result
3067 <ul>
3068 <li><dl>
3069 <dt>d1&#160;</dt>
3070 <dd>d2
3071 </dd>
3072 <dt>d3&#160;</dt>
3073 <dd>d4
3074 </dd>
3075 </dl>
3076 </li>
3077 </ul>
3078
3079 !! end
3080
3081
3082 !! test
3083 Definition Lists: Mixed Lists: Test 5
3084 !! input
3085 *:d1
3086 *:: d2
3087 !! result
3088 <ul>
3089 <li><dl>
3090 <dd>d1
3091 <dl>
3092 <dd> d2
3093 </dd>
3094 </dl>
3095 </dd>
3096 </dl>
3097 </li>
3098 </ul>
3099
3100 !! end
3101
3102
3103 !! test
3104 Definition Lists: Mixed Lists: Test 6
3105 !! input
3106 #*:d1
3107 #*::: d3
3108 !! result
3109 <ol>
3110 <li><ul>
3111 <li><dl>
3112 <dd>d1
3113 <dl>
3114 <dd><dl>
3115 <dd> d3
3116 </dd>
3117 </dl>
3118 </dd>
3119 </dl>
3120 </dd>
3121 </dl>
3122 </li>
3123 </ul>
3124 </li>
3125 </ol>
3126
3127 !! end
3128
3129
3130 !! test
3131 Definition Lists: Mixed Lists: Test 7
3132 !! input
3133 :* d1
3134 :* d2
3135 !! result
3136 <dl>
3137 <dd><ul>
3138 <li> d1
3139 </li>
3140 <li> d2
3141 </li>
3142 </ul>
3143 </dd>
3144 </dl>
3145
3146 !! end
3147
3148
3149 !! test
3150 Definition Lists: Mixed Lists: Test 8
3151 !! input
3152 :* d1
3153 ::* d2
3154 !! result
3155 <dl>
3156 <dd><ul>
3157 <li> d1
3158 </li>
3159 </ul>
3160 <dl>
3161 <dd><ul>
3162 <li> d2
3163 </li>
3164 </ul>
3165 </dd>
3166 </dl>
3167 </dd>
3168 </dl>
3169
3170 !! end
3171
3172
3173 !! test
3174 Definition Lists: Mixed Lists: Test 9
3175 !! input
3176 *;foo :bar
3177 !! result
3178 <ul>
3179 <li><dl>
3180 <dt>foo&#160;</dt>
3181 <dd>bar
3182 </dd>
3183 </dl>
3184 </li>
3185 </ul>
3186
3187 !! end
3188
3189
3190 !! test
3191 Definition Lists: Mixed Lists: Test 10
3192 !! input
3193 *#;foo :bar
3194 !! result
3195 <ul>
3196 <li><ol>
3197 <li><dl>
3198 <dt>foo&#160;</dt>
3199 <dd>bar
3200 </dd>
3201 </dl>
3202 </li>
3203 </ol>
3204 </li>
3205 </ul>
3206
3207 !! end
3208
3209 # The Parsoid team disagrees with the PHP parser's seemingly-random
3210 # rules regarding dd/dt on the next two tests. Parsoid is more
3211 # consistent, and recognizes the shared nesting and keeps the
3212 # still-open tags around until the nesting is complete.
3213
3214 !! test
3215 Definition Lists: Mixed Lists: Test 11 (php)
3216 !! options
3217 php
3218 !! input
3219 *#*#;*;;foo :bar
3220 *#*#;boo :baz
3221 !! result
3222 <ul>
3223 <li><ol>
3224 <li><ul>
3225 <li><ol>
3226 <li><dl>
3227 <dt>foo&#160;</dt>
3228 <dd><ul>
3229 <li><dl>
3230 <dt><dl>
3231 <dt>bar
3232 </dt>
3233 </dl>
3234 </dd>
3235 </dl>
3236 </li>
3237 </ul>
3238 </dd>
3239 </dl>
3240 <dl>
3241 <dt>boo&#160;</dt>
3242 <dd>baz
3243 </dd>
3244 </dl>
3245 </li>
3246 </ol>
3247 </li>
3248 </ul>
3249 </li>
3250 </ol>
3251 </li>
3252 </ul>
3253
3254 !! end
3255 !! test
3256 Definition Lists: Mixed Lists: Test 11 (parsoid)
3257 !! options
3258 parsoid
3259 !! input
3260 *#*#;*;;foo :bar
3261 *#*#;boo :baz
3262 !! result
3263 <ul>
3264 <li>
3265 <ol>
3266 <li>
3267 <ul>
3268 <li>
3269 <ol>
3270 <li>
3271 <dl>
3272 <dt>
3273 <ul>
3274 <li>
3275 <dl>
3276 <dt>
3277 <dl>
3278 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3279 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3280 </dl></dt>
3281 </dl></li>
3282 </ul></dt>
3283 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3284 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3285 </dl></li>
3286 </ol></li>
3287 </ul></li>
3288 </ol></li>
3289 </ul>
3290 !! end
3291
3292
3293 !! test
3294 Definition Lists: Weird Ones: Test 1 (php)
3295 !! options
3296 php
3297 !! input
3298 *#;*::;; foo : bar (who uses this?)
3299 !! result
3300 <ul>
3301 <li><ol>
3302 <li><dl>
3303 <dt> foo&#160;</dt>
3304 <dd><ul>
3305 <li><dl>
3306 <dd><dl>
3307 <dd><dl>
3308 <dt><dl>
3309 <dt> bar (who uses this?)
3310 </dt>
3311 </dl>
3312 </dd>
3313 </dl>
3314 </dd>
3315 </dl>
3316 </dd>
3317 </dl>
3318 </li>
3319 </ul>
3320 </dd>
3321 </dl>
3322 </li>
3323 </ol>
3324 </li>
3325 </ul>
3326
3327 !! end
3328 !! test
3329 Definition Lists: Weird Ones: Test 1 (parsoid)
3330 !! options
3331 parsoid
3332 !! input
3333 *#;*::;; foo : bar (who uses this?)
3334 !! result
3335 <ul>
3336 <li>
3337 <ol>
3338 <li>
3339 <dl>
3340 <dt>
3341 <ul>
3342 <li>
3343 <dl>
3344 <dd>
3345 <dl>
3346 <dd>
3347 <dl>
3348 <dt>
3349 <dl>
3350 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3351 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3352 </dl></dt>
3353 </dl></dd>
3354 </dl></dd>
3355 </dl></li>
3356 </ul></dt>
3357 </dl></li>
3358 </ol></li>
3359 </ul>
3360 !! end
3361
3362 ###
3363 ### External links
3364 ###
3365 !! test
3366 External links: non-bracketed
3367 !! input
3368 Non-bracketed: http://example.com
3369 !! result
3370 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3371 </p>
3372 !! end
3373
3374 !! test
3375 External links: numbered
3376 !! input
3377 Numbered: [http://example.com]
3378 Numbered: [http://example.net]
3379 Numbered: [http://example.com]
3380 !! result
3381 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
3382 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
3383 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
3384 </p>
3385 !!end
3386
3387 !! test
3388 External links: specified text
3389 !! input
3390 Specified text: [http://example.com link]
3391 !! result
3392 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
3393 </p>
3394 !!end
3395
3396 !! test
3397 External links: trail
3398 !! input
3399 Linktrails should not work for external links: [http://example.com link]s
3400 !! result
3401 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
3402 </p>
3403 !! end
3404
3405 !! test
3406 External links: dollar sign in URL
3407 !! input
3408 http://example.com/1$2345
3409 !! result
3410 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
3411 </p>
3412 !! end
3413
3414 !! test
3415 External links: dollar sign in URL (named)
3416 !! input
3417 [http://example.com/1$2345]
3418 !! result
3419 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
3420 </p>
3421 !!end
3422
3423 !! test
3424 External links: open square bracket forbidden in URL (bug 4377)
3425 !! input
3426 http://example.com/1[2345
3427 !! result
3428 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
3429 </p>
3430 !! end
3431
3432 !! test
3433 External links: open square bracket forbidden in URL (named) (bug 4377)
3434 !! input
3435 [http://example.com/1[2345]
3436 !! result
3437 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3438 </p>
3439 !!end
3440
3441 !! test
3442 External links: nowiki in URL link text (bug 6230)
3443 !!input
3444 [http://example.com/ <nowiki>''example site''</nowiki>]
3445 !! result
3446 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
3447 </p>
3448 !! end
3449
3450 !! test
3451 External links: newline forbidden in text (bug 6230 regression check)
3452 !! input
3453 [http://example.com/ first
3454 second]
3455 !! result
3456 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
3457 second]
3458 </p>
3459 !!end
3460
3461 !! test
3462 External links: Pipe char between url and text
3463 !! input
3464 [http://example.com | link]
3465 !! result
3466 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
3467 </p>
3468 !!end
3469
3470 !! test
3471 External links: protocol-relative URL in brackets
3472 !! input
3473 [//example.com/ Test]
3474 !! result
3475 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
3476 </p>
3477 !! end
3478
3479 !! test
3480 External links: protocol-relative URL in brackets without text
3481 !! input
3482 [//example.com]
3483 !! result
3484 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
3485 </p>
3486 !! end
3487
3488 !! test
3489 External links: protocol-relative URL in free text is left alone
3490 !! input
3491 //example.com/Foo
3492 !! result
3493 <p>//example.com/Foo
3494 </p>
3495 !!end
3496
3497 !! test
3498 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
3499 !! input
3500 foo//example.com/Foo
3501 !! result
3502 <p>foo//example.com/Foo
3503 </p>
3504 !! end
3505
3506 !! test
3507 External image
3508 !! input
3509 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3510 !! result
3511 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3512 </p>
3513 !! end
3514
3515 !! test
3516 External image from https
3517 !! input
3518 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3519 !! result
3520 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3521 </p>
3522 !! end
3523
3524 !! test
3525 External image (when not allowed)
3526 !! options
3527 wgAllowExternalImages=0
3528 !! input
3529 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3530 !! result
3531 <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>
3532 </p>
3533 !! end
3534
3535 !! test
3536 Link to non-http image, no img tag
3537 !! input
3538 Link to non-http image, no img tag: ftp://example.com/test.jpg
3539 !! result
3540 <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>
3541 </p>
3542 !! end
3543
3544 !! test
3545 External links: terminating separator
3546 !! input
3547 Terminating separator: http://example.com/thing,
3548 !! result
3549 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
3550 </p>
3551 !! end
3552
3553 !! test
3554 External links: intervening separator
3555 !! input
3556 Intervening separator: http://example.com/1,2,3
3557 !! result
3558 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
3559 </p>
3560 !! end
3561
3562 !! test
3563 External links: old bug with URL in query
3564 !! input
3565 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
3566 !! result
3567 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
3568 </p>
3569 !! end
3570
3571 !! test
3572 External links: old URL-in-URL bug, mixed protocols
3573 !! input
3574 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
3575 !! result
3576 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
3577 </p>
3578 !!end
3579
3580 !! test
3581 External links: URL in text
3582 !! input
3583 URL in text: [http://example.com http://example.com]
3584 !! result
3585 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3586 </p>
3587 !! end
3588
3589 !! test
3590 External links: Clickable images
3591 !! input
3592 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
3593 !! result
3594 <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>
3595 </p>
3596 !!end
3597
3598 !! test
3599 External links: raw ampersand
3600 !! input
3601 Old &amp; use: http://x&y
3602 !! result
3603 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3604 </p>
3605 !! end
3606
3607 !! test
3608 External links: encoded ampersand
3609 !! input
3610 Old &amp; use: http://x&amp;y
3611 !! result
3612 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3613 </p>
3614 !! end
3615
3616 !! test
3617 External links: encoded equals (bug 6102)
3618 !! input
3619 http://example.com/?foo&#61;bar
3620 !! result
3621 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
3622 </p>
3623 !! end
3624
3625 !! test
3626 External links: [raw ampersand]
3627 !! input
3628 Old &amp; use: [http://x&y]
3629 !! result
3630 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3631 </p>
3632 !! end
3633
3634 !! test
3635 External links: [encoded ampersand]
3636 !! input
3637 Old &amp; use: [http://x&amp;y]
3638 !! result
3639 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3640 </p>
3641 !! end
3642
3643 !! test
3644 External links: [encoded equals] (bug 6102)
3645 !! input
3646 [http://example.com/?foo&#61;bar]
3647 !! result
3648 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3649 </p>
3650 !! end
3651
3652 !! test
3653 External links: [IDN ignored character reference in hostname; strip it right off]
3654 !! input
3655 [http://e&zwnj;xample.com/]
3656 !! result
3657 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
3658 </p>
3659 !! end
3660
3661 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
3662 # Where an external link could easily circumvent the sanitization of the text of
3663 # a link like this (where an IDN-ignore character is in the URL somewhere), this
3664 # test demands a higher standard. That's a bit strange.
3665 #
3666 # Example:
3667 #
3668 # http://e‌xample.com -> [http://example.com|http://example.com]
3669 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
3670 #
3671 # The first example is sanitized, but the second is not. Any security benefits
3672 # from this production are trivial to circumvent. Either remove this test and
3673 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
3674 # the test accordingly.
3675 #
3676 # All our love,
3677 # The Parsoid team.
3678 !! test
3679 External links: IDN ignored character reference in hostname; strip it right off
3680 !! input
3681 http://e&zwnj;xample.com/
3682 !! result
3683 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
3684 </p>
3685 !! end
3686
3687 !! test
3688 External links: www.jpeg.org (bug 554)
3689 !! input
3690 http://www.jpeg.org
3691 !!result
3692 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
3693 </p>
3694 !! end
3695
3696 !! test
3697 External links: URL within URL (original bug 2)
3698 !! input
3699 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
3700 !! result
3701 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
3702 </p>
3703 !! end
3704
3705 !! test
3706 BUG 361: URL inside bracketed URL
3707 !! input
3708 [http://www.example.com/foo http://www.example.com/bar]
3709 !! result
3710 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
3711 </p>
3712 !! end
3713
3714 !! test
3715 BUG 361: URL within URL, not bracketed
3716 !! input
3717 http://www.example.com/foo?=http://www.example.com/bar
3718 !! result
3719 <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>
3720 </p>
3721 !! end
3722
3723 !! test
3724 BUG 289: ">"-token in URL-tail
3725 !! input
3726 http://www.example.com/<hello>
3727 !! result
3728 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
3729 </p>
3730 !!end
3731
3732 !! test
3733 BUG 289: literal ">"-token in URL-tail
3734 !! input
3735 http://www.example.com/<b>html</b>
3736 !! result
3737 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
3738 </p>
3739 !!end
3740
3741 !! test
3742 BUG 289: ">"-token in bracketed URL
3743 !! input
3744 [http://www.example.com/<hello> stuff]
3745 !! result
3746 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
3747 </p>
3748 !!end
3749
3750 !! test
3751 BUG 289: literal ">"-token in bracketed URL
3752 !! input
3753 [http://www.example.com/<b>html</b> stuff]
3754 !! result
3755 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
3756 </p>
3757 !!end
3758
3759 !! test
3760 BUG 289: literal double quote at end of URL
3761 !! input
3762 http://www.example.com/"hello"
3763 !! result
3764 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
3765 </p>
3766 !!end
3767
3768 !! test
3769 BUG 289: literal double quote in bracketed URL
3770 !! input
3771 [http://www.example.com/"hello" stuff]
3772 !! result
3773 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
3774 </p>
3775 !!end
3776
3777 !! test
3778 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
3779 !! input
3780 [http://www.example.com test]
3781 !! result
3782 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3783 </p>
3784 !! end
3785
3786 !! test
3787 External links: link text with spaces
3788 !! input
3789 [http://www.example.com a b c]
3790 [http://www.example.com ''a'' ''b'']
3791 !! result
3792 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3793 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3794 </p>
3795 !! end
3796
3797 !! test
3798 External links: wiki links within external link (Bug 3695)
3799 !! options
3800 php
3801 !! input
3802 [http://example.com [[wikilink]] embedded in ext link]
3803 !! result
3804 <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>
3805 </p>
3806 !! end
3807
3808 !! test
3809 Parsoid: External links: wiki links within external link (Bug 3695)
3810 !! options
3811 parsoid
3812 !! input
3813 [http://example.com [[wikilink]] embedded in ext link]
3814 !! result
3815 <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>
3816 !! end
3817
3818 !! test
3819 BUG 787: Links with one slash after the url protocol are invalid
3820 !! input
3821 http:/example.com
3822
3823 [http:/example.com title]
3824 !! result
3825 <p>http:/example.com
3826 </p><p>[http:/example.com title]
3827 </p>
3828 !! end
3829
3830 !! test
3831 Bracketed external links with template-generated invalid target
3832 !! input
3833 [{{echo|http:/example.com}} title]
3834 !! result
3835 <p>[http:/example.com title]
3836 </p>
3837 !! end
3838
3839 !! test
3840 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3841 !! input
3842 ''[http://example.com text'']
3843 [http://example.com '''text]'''
3844 ''Something [http://example.com in italic'']
3845 ''Something [http://example.com mixed''''', even bold]'''
3846 '''''Now [http://example.com both''''']
3847 !! result
3848 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3849 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3850 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3851 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3852 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3853 </p>
3854 !! end
3855
3856
3857 !! test
3858 Bug 4781: %26 in URL
3859 !! input
3860 http://www.example.com/?title=AT%26T
3861 !! result
3862 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3863 </p>
3864 !! end
3865
3866 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3867 # % is actually legal in HTML5. Any change in output would need testing though.
3868 !! test
3869 Bug 4781, 5267: %25 in URL
3870 !! input
3871 http://www.example.com/?title=100%25_Bran
3872 !! result
3873 <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>
3874 </p>
3875 !! end
3876
3877 !! test
3878 Bug 4781, 5267: %28, %29 in URL
3879 !! input
3880 http://www.example.com/?title=Ben-Hur_%281959_film%29
3881 !! result
3882 <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>
3883 </p>
3884 !! end
3885
3886
3887 !! test
3888 Bug 4781: %26 in autonumber URL
3889 !! input
3890 [http://www.example.com/?title=AT%26T]
3891 !! result
3892 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3893 </p>
3894 !! end
3895
3896 !! test
3897 Bug 4781, 5267: %26 in autonumber URL
3898 !! input
3899 [http://www.example.com/?title=100%25_Bran]
3900 !! result
3901 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3902 </p>
3903 !! end
3904
3905 !! test
3906 Bug 4781, 5267: %28, %29 in autonumber URL
3907 !! input
3908 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3909 !! result
3910 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3911 </p>
3912 !! end
3913
3914
3915 !! test
3916 Bug 4781: %26 in bracketed URL
3917 !! input
3918 [http://www.example.com/?title=AT%26T link]
3919 !! result
3920 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3921 </p>
3922 !! end
3923
3924 !! test
3925 Bug 4781, 5267: %26 in bracketed URL
3926 !! input
3927 [http://www.example.com/?title=100%25_Bran link]
3928 !! result
3929 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3930 </p>
3931 !! end
3932
3933 !! test
3934 Bug 4781, 5267: %28, %29 in bracketed URL
3935 !! input
3936 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3937 !! result
3938 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3939 </p>
3940 !! end
3941
3942 !! test
3943 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3944 !! input
3945 Some [http://example.com/ pretty ''italics'' and stuff]!
3946 !! result
3947 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3948 </p>
3949 !! end
3950
3951 !! test
3952 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3953 !! input
3954 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3955 !! result
3956 <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>
3957 </p>
3958 !! end
3959
3960 !! test
3961 External link containing double-single-quotes with no space separating the url from text in italics
3962 !! options
3963 php
3964 !! input
3965 [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]].]
3966 !! result
3967 <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>
3968 </p>
3969 !! end
3970
3971 !! test
3972 Parsoid:External link containing double-single-quotes with no space separating the url from text in italics
3973 !! options
3974 parsoid
3975 !! input
3976 [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]].]
3977 !! result
3978 <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>
3979 !! end
3980
3981 !! test
3982 External link with comments in link text
3983 !! input
3984 [http://www.google.com Google <!-- comment -->]
3985 !! result
3986 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3987 </p>
3988 !! end
3989
3990 !! test
3991 URL-encoding in URL functions (single parameter)
3992 !! input
3993 {{localurl:Some page|amp=&}}
3994 !! result
3995 <p>/index.php?title=Some_page&amp;amp=&amp;
3996 </p>
3997 !! end
3998
3999 !! test
4000 URL-encoding in URL functions (multiple parameters)
4001 !! input
4002 {{localurl:Some page|q=?&amp=&}}
4003 !! result
4004 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
4005 </p>
4006 !! end
4007
4008 !! test
4009 Brackets in urls
4010 !! input
4011 http://example.com/index.php?foozoid%5B%5D=bar
4012
4013 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
4014 !! result
4015 <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>
4016 </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>
4017 </p>
4018 !! end
4019
4020 !! test
4021 IPv6 urls (bug 21261)
4022 !! options
4023 disabled
4024 !! input
4025 http://[2404:130:0:1000::187:2]/index.php
4026 !! result
4027 <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>
4028 </p>
4029 !! end
4030
4031 !! test
4032 Non-extlinks in brackets
4033 !! input
4034 [foo]
4035 [foo bar]
4036 [foo ''bar'']
4037 [fool's] errand
4038 [fool's errand]
4039 [{{echo|foo}}]
4040 [{{echo|foo}} bar]
4041 [{{echo|foo}} ''bar'']
4042 [{{echo|foo}}l's] errand
4043 [{{echo|foo}}l's errand]
4044 [url={{echo|foo}}]
4045 [url=http://example.com]
4046 !! result
4047 <p>[foo]
4048 [foo bar]
4049 [foo <i>bar</i>]
4050 [fool's] errand
4051 [fool's errand]
4052 [foo]
4053 [foo bar]
4054 [foo <i>bar</i>]
4055 [fool's] errand
4056 [fool's errand]
4057 [url=foo]
4058 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4059 </p>
4060 !! end
4061
4062 !! test
4063 Parsoid: Percent encoding in external links
4064 !! options
4065 parsoid
4066 !! input
4067 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4068 !! result
4069 <p><a rel="mw:ExtLink"
4070 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4071 !! end
4072
4073 !! test
4074 Parsoid: use url link syntax for links where the content is equal the link
4075 target
4076 !! options
4077 parsoid
4078 !! input
4079 http://example.com
4080 !! result
4081 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4082 !! end
4083
4084 !! test
4085 Parenthesis in external links, especially URL links
4086 !! options
4087 php
4088 !! input
4089 http://example.com)
4090
4091 http://example.com/test)
4092
4093 http://example.com/(test)
4094
4095 http://example.com/((test)
4096
4097 (http://example.com/(test))
4098
4099 (http://example.com/(test)))))
4100
4101 http://example.com/a)b
4102
4103 [http://example.com) foo]
4104 !! result
4105 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4106 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
4107 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
4108 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
4109 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
4110 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
4111 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
4112 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
4113 </p>
4114 !! end
4115
4116 !! test
4117 Parenthesis in external links, especially URL links (Parsoid)
4118 !! options
4119 parsoid
4120 !! input
4121 http://example.com)
4122
4123 http://example.com/test)
4124
4125 http://example.com/(test)
4126
4127 http://example.com/((test)
4128
4129 (http://example.com/(test))
4130
4131 (http://example.com/(test)))))
4132
4133 http://example.com/a)b
4134
4135 [http://example.com) foo]
4136 !! result
4137 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
4138 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
4139 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
4140 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
4141 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
4142 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
4143 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
4144 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
4145 !! end
4146
4147 !! test
4148 Parenthesis in external links, w/ transclusion or comment
4149 !! options
4150 parsoid
4151 !! input
4152 (http://example.com/{{echo|hi}})
4153
4154 (http://example.com<!-- hi -->)
4155 !! result
4156 <p>(<a data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;hi&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[20,31,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]]}\">hi&lt;/span>"}]]}' typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"},"dsr":[1,31,0,0]}'>http://example.com/hi</a>)</p>
4157
4158 <p>(<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com&lt;!-- hi -->"},"dsr":[35,64,0,0]}'>http://example.com</a>)</p>
4159 !! end
4160
4161 ###
4162 ### Quotes
4163 ###
4164
4165 !! test
4166 Quotes
4167 !! input
4168 Normal text. '''Bold text.''' Normal text. ''Italic text.''
4169
4170 Normal text. '''''Bold italic text.''''' Normal text.
4171 !!result
4172 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
4173 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
4174 </p>
4175 !! end
4176
4177
4178 !! test
4179 Unclosed and unmatched quotes (php)
4180 !! options
4181 php
4182 !! input
4183 '''''Bold italic text '''with bold deactivated''' in between.'''''
4184
4185 '''''Bold italic text ''with italic deactivated'' in between.'''''
4186
4187 '''Bold text..
4188
4189 ..spanning two paragraphs (should not work).'''
4190
4191 '''Bold tag left open
4192
4193 ''Italic tag left open
4194
4195 Normal text.
4196
4197 <!-- Unmatching number of opening, closing tags: -->
4198 '''This year''''s election ''should'' beat '''last year''''s.
4199
4200 ''Tom'''s car is bigger than ''Susan'''s.
4201
4202 Plain ''italic'''s plain
4203 !! result
4204 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4205 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4206 </p><p><b>Bold text..</b>
4207 </p><p>..spanning two paragraphs (should not work).
4208 </p><p><b>Bold tag left open</b>
4209 </p><p><i>Italic tag left open</i>
4210 </p><p>Normal text.
4211 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4212 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4213 </p><p>Plain <i>italic'</i>s plain
4214 </p>
4215 !! end
4216 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
4217 # parser strips. The wikitext contains just the first half of the bold
4218 # quote pair.
4219 !! test
4220 Unclosed and unmatched quotes (parsoid)
4221 !! options
4222 parsoid
4223 !! input
4224 '''''Bold italic text '''with bold deactivated''' in between.'''''
4225
4226 '''''Bold italic text ''with italic deactivated'' in between.'''''
4227
4228 '''Bold text..
4229
4230 ..spanning two paragraphs (should not work).'''
4231
4232 '''Bold tag left open
4233
4234 ''Italic tag left open
4235
4236 Normal text.
4237
4238 <!-- Unmatching number of opening, closing tags: -->
4239 '''This year''''s election ''should'' beat '''last year''''s.
4240
4241 ''Tom'''s car is bigger than ''Susan'''s.
4242
4243 Plain ''italic'''s plain
4244 !! result
4245 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4246 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4247 </p><p><b>Bold text..</b>
4248 </p><p>..spanning two paragraphs (should not work).<b></b>
4249 </p><p><b>Bold tag left open</b>
4250 </p><p><i>Italic tag left open</i>
4251 </p><p>Normal text.
4252 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4253 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4254 </p><p>Plain <i>italic'</i>s plain
4255 </p>
4256 !! end
4257
4258 ###
4259 ### Tables
4260 ###
4261 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
4262 ###
4263
4264 # This should not produce <table></table> as <table><tr><td></td></tr></table>
4265 # is the bare minimum required by the spec, see:
4266 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
4267 !! test
4268 A table with no data. (php)
4269 !! options
4270 php
4271 !! input
4272 {||}
4273 !! result
4274
4275 !! end
4276
4277 # Parsoid team replies: empty table tags are legal in HTML5
4278 !! test
4279 A table with no data. (parsoid)
4280 !! options
4281 parsoid=wt2html
4282 !! input
4283 {||}
4284 !! result
4285 <table></table>
4286
4287 !! end
4288
4289 !! test
4290 A table with stray table end tags on start tag line (wt2html)
4291 !! options
4292 parsoid=wt2html
4293 !! input
4294 {|style="color: red;"|}
4295
4296 {|style="color: red;" |}
4297 |foo
4298 |}
4299
4300 {|style="color: red;"|} id="foo"
4301 |foo
4302 |}
4303
4304 {|style="color: red;" |} id="foo"
4305 |foo
4306 |}
4307 !! result
4308 <table style="color: red;"></table>
4309
4310 <table style="color: red;">
4311 <tbody><tr>
4312 <td>foo</td>
4313 </tr></tbody>
4314 </table>
4315
4316 <table style="color: red;" id="foo">
4317 <tbody><tr>
4318 <td>foo</td>
4319 </tr></tbody>
4320 </table>
4321
4322 <table style="color: red;" id="foo">
4323 <tbody><tr>
4324 <td>foo</td>
4325 </tr></tbody>
4326 </table>
4327
4328 !! end
4329
4330 !! test
4331 A table with no data (take 2) (parsoid)
4332 !! options
4333 parsoid
4334 !! input
4335 {|
4336 |}
4337 !! result
4338 <table></table>
4339 !! end
4340
4341 # A table with nothing but a caption is invalid XHTML, we might want to render
4342 # this as <p>caption</p>
4343 !! test
4344 A table with nothing but a caption (php)
4345 !! options
4346 php
4347 !! input
4348 {|
4349 |+ caption
4350 |}
4351 !! result
4352 <table>
4353 <caption> caption
4354 </caption><tr><td></td></tr></table>
4355
4356 !! end
4357 # Parsoid team replies: table with only a caption is legal in HTML5
4358 !! test
4359 A table with nothing but a caption (parsoid)
4360 !! options
4361 parsoid
4362 !! input
4363 {|
4364 |+ caption
4365 |}
4366 !! result
4367 <table><caption> caption</caption></table>
4368 !! end
4369
4370 !! test
4371 A table with caption with default-spaced attributes and a table row
4372 !! input
4373 {|
4374 |+ style="color: red;" | caption1
4375 |-
4376 | foo
4377 |}
4378 !! result
4379 <table>
4380 <caption style="color: red;"> caption1
4381 </caption>
4382 <tr>
4383 <td> foo
4384 </td></tr></table>
4385
4386 !! end
4387
4388 !! test
4389 A table with captions with non-default spaced attributes and a table row
4390 !! input
4391 {|
4392 |+style="color: red;"|caption2
4393 |+ style="color: red;"| caption3
4394 |-
4395 | foo
4396 |}
4397 !! result
4398 <table>
4399 <caption style="color: red;">caption2
4400 </caption>
4401 <caption style="color: red;"> caption3
4402 </caption>
4403 <tr>
4404 <td> foo
4405 </td></tr></table>
4406
4407 !! end
4408
4409 !! test
4410 Table td-cell syntax variations
4411 !! input
4412 {|
4413 | foo bar foo | baz
4414 | foo bar foo || baz
4415 | style='color:red;' | baz
4416 | style='color:red;' || baz
4417 |}
4418 !! result
4419 <table>
4420 <tr>
4421 <td> baz
4422 </td>
4423 <td> foo bar foo </td>
4424 <td> baz
4425 </td>
4426 <td style="color:red;"> baz
4427 </td>
4428 <td> style='color:red;' </td>
4429 <td> baz
4430 </td></tr></table>
4431
4432 !! end
4433
4434 !! test
4435 Simple table
4436 !! input
4437 {|
4438 | 1 || 2
4439 |-
4440 | 3 || 4
4441 |}
4442 !! result
4443 <table>
4444 <tr>
4445 <td> 1 </td>
4446 <td> 2
4447 </td></tr>
4448 <tr>
4449 <td> 3 </td>
4450 <td> 4
4451 </td></tr></table>
4452
4453 !! end
4454
4455 !! test
4456 Simple table but with multiple dashes for row wikitext
4457 !! input
4458 {|
4459 | foo
4460 |-----
4461 | bar
4462 |}
4463 !! result
4464 <table>
4465 <tr>
4466 <td> foo
4467 </td></tr>
4468 <tr>
4469 <td> bar
4470 </td></tr></table>
4471
4472 !! end
4473 !! test
4474 Multiplication table
4475 !! input
4476 {| border="1" cellpadding="2"
4477 |+Multiplication table
4478 |-
4479 ! &times; !! 1 !! 2 !! 3
4480 |-
4481 ! 1
4482 | 1 || 2 || 3
4483 |-
4484 ! 2
4485 | 2 || 4 || 6
4486 |-
4487 ! 3
4488 | 3 || 6 || 9
4489 |-
4490 ! 4
4491 | 4 || 8 || 12
4492 |-
4493 ! 5
4494 | 5 || 10 || 15
4495 |}
4496 !! result
4497 <table border="1" cellpadding="2">
4498 <caption>Multiplication table
4499 </caption>
4500 <tr>
4501 <th> &#215; </th>
4502 <th> 1 </th>
4503 <th> 2 </th>
4504 <th> 3
4505 </th></tr>
4506 <tr>
4507 <th> 1
4508 </th>
4509 <td> 1 </td>
4510 <td> 2 </td>
4511 <td> 3
4512 </td></tr>
4513 <tr>
4514 <th> 2
4515 </th>
4516 <td> 2 </td>
4517 <td> 4 </td>
4518 <td> 6
4519 </td></tr>
4520 <tr>
4521 <th> 3
4522 </th>
4523 <td> 3 </td>
4524 <td> 6 </td>
4525 <td> 9
4526 </td></tr>
4527 <tr>
4528 <th> 4
4529 </th>
4530 <td> 4 </td>
4531 <td> 8 </td>
4532 <td> 12
4533 </td></tr>
4534 <tr>
4535 <th> 5
4536 </th>
4537 <td> 5 </td>
4538 <td> 10 </td>
4539 <td> 15
4540 </td></tr></table>
4541
4542 !! end
4543
4544 !! test
4545 Accept "||" in table headings
4546 !! input
4547 {|
4548 !h1 || h2
4549 |}
4550 !! result
4551 <table>
4552 <tr>
4553 <th>h1 </th>
4554 <th> h2
4555 </th></tr></table>
4556
4557 !! end
4558
4559 !! test
4560 Accept "||" in indented table headings
4561 !! input
4562 :{|
4563 !h1 || h2
4564 |}
4565 !! result
4566 <dl><dd><table>
4567 <tr>
4568 <th>h1 </th>
4569 <th> h2
4570 </th></tr></table></dd></dl>
4571
4572 !! end
4573
4574 !! test
4575 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
4576 !! input
4577 {|
4578 !| h1
4579 || a
4580 |}
4581 !! result
4582 <table>
4583 <tr>
4584 <th> h1
4585 </th>
4586 <td> a
4587 </td></tr></table>
4588
4589 !! end
4590
4591 !!test
4592 Accept "| !" at start of line in tables (ignore !-attribute)
4593 !!input
4594 {|
4595 |-
4596 | !style="color:red" | bar
4597 |}
4598 !!result
4599 <table>
4600
4601 <tr>
4602 <td> bar
4603 </td></tr></table>
4604
4605 !!end
4606
4607 !!test
4608 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 +/-
4609 !!input
4610 {|
4611 |-
4612 |style='color:red;'|+1
4613 |style='color:blue;'|-1
4614 |-
4615 | 1 || 2 || 3
4616 | 1 ||+2 ||-3
4617 |-
4618 | +1
4619 | -1
4620 |}
4621 !!result
4622 <table>
4623
4624 <tr>
4625 <td style="color:red;">+1
4626 </td>
4627 <td style="color:blue;">-1
4628 </td></tr>
4629 <tr>
4630 <td> 1 </td>
4631 <td> 2 </td>
4632 <td> 3
4633 </td>
4634 <td> 1 </td>
4635 <td>+2 </td>
4636 <td>-3
4637 </td></tr>
4638 <tr>
4639 <td> +1
4640 </td>
4641 <td> -1
4642 </td></tr></table>
4643
4644 !!end
4645
4646 !! test
4647 Table rowspan
4648 !! input
4649 {| border=1
4650 | Cell 1, row 1
4651 |rowspan=2| Cell 2, row 1 (and 2)
4652 | Cell 3, row 1
4653 |-
4654 | Cell 1, row 2
4655 | Cell 3, row 2
4656 |}
4657 !! result
4658 <table border="1">
4659 <tr>
4660 <td> Cell 1, row 1
4661 </td>
4662 <td rowspan="2"> Cell 2, row 1 (and 2)
4663 </td>
4664 <td> Cell 3, row 1
4665 </td></tr>
4666 <tr>
4667 <td> Cell 1, row 2
4668 </td>
4669 <td> Cell 3, row 2
4670 </td></tr></table>
4671
4672 !! end
4673
4674 !! test
4675 Nested table
4676 !! input
4677 {| border=1
4678 | &alpha;
4679 |
4680 {| bgcolor=#ABCDEF border=2
4681 |nested
4682 |-
4683 |table
4684 |}
4685 |the original table again
4686 |}
4687 !! result
4688 <table border="1">
4689 <tr>
4690 <td> &#945;
4691 </td>
4692 <td>
4693 <table bgcolor="#ABCDEF" border="2">
4694 <tr>
4695 <td>nested
4696 </td></tr>
4697 <tr>
4698 <td>table
4699 </td></tr></table>
4700 </td>
4701 <td>the original table again
4702 </td></tr></table>
4703
4704 !! end
4705
4706 !! test
4707 Invalid attributes in table cell (bug 1830)
4708 !! input
4709 {|
4710 |Cell:|broken
4711 |}
4712 !! result
4713 <table>
4714 <tr>
4715 <td>broken
4716 </td></tr></table>
4717
4718 !! end
4719
4720
4721 !! test
4722 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
4723 !! input
4724 {|
4725 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
4726 !! result
4727 <table>
4728 <tr>
4729 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
4730 <td>]" onmouseover="alert(document.cookie)"&gt;test
4731 </td>
4732 </tr>
4733 </table>
4734
4735 !! end
4736
4737
4738 !! test
4739 Indented table markup mixed with indented pre content (proposed in bug 6200)
4740 !! input
4741 <table>
4742 <tr>
4743 <td>
4744 Text that should be rendered preformatted
4745 </td>
4746 </tr>
4747 </table>
4748 !! result
4749 <table>
4750 <tr>
4751 <td>
4752 <pre>Text that should be rendered preformatted
4753 </pre>
4754 </td>
4755 </tr>
4756 </table>
4757
4758 !! end
4759
4760 !! test
4761 Template-generated table cell attributes and cell content
4762 !! input
4763 {|
4764 |{{table_attribs}}
4765 | {{table_attribs}}
4766 |}
4767 !! result
4768 <table>
4769 <tr>
4770 <td style="color: red"> Foo
4771 </td>
4772 <td style="color: red"> Foo
4773 </td></tr></table>
4774
4775 !! end
4776
4777 !! test
4778 Template-generated table cell attributes and cell content (2)
4779 !! input
4780 {|
4781 |align=center {{table_attribs}}
4782 |}
4783 !! result
4784 <table>
4785 <tr>
4786 <td align="center" style="color: red"> Foo
4787 </td></tr></table>
4788
4789 !! end
4790
4791 !! test
4792 Template-generated table cell attributes and cell content (3)
4793 !! input
4794 {|
4795 |align=center {{table_cells}}
4796 |}
4797 !! result
4798 <table>
4799 <tr>
4800 <td align="center" style="color: red"> Foo </td>
4801 <td> Bar </td>
4802 <td> Baz
4803 </td></tr></table>
4804
4805 !! end
4806
4807 !! test
4808 Table with row followed by newlines and table heading
4809 !! input
4810 {|
4811 |-
4812
4813 ! foo
4814 |}
4815 !! result
4816 <table>
4817
4818
4819 <tr>
4820 <th> foo
4821 </th></tr></table>
4822
4823 !! end
4824
4825 !! test
4826 Table with empty line following the start tag
4827 !! input
4828 {|
4829
4830 |-
4831 | foo
4832 |}
4833 !! result
4834 <table>
4835
4836
4837 <tr>
4838 <td> foo
4839 </td></tr></table>
4840
4841 !! end
4842
4843 # FIXME: Preserve the attribute properly (with an empty string as value) in
4844 # the PHP parser. Parsoid implements the behavior below.
4845 !! test
4846 Table attributes with empty value
4847 !! options
4848 parsoid
4849 !! input
4850 {|
4851 | style=| hello
4852 |}
4853 !! result
4854 <table>
4855 <tbody>
4856 <tr>
4857 <td style=""> hello
4858 </td></tr></tbody></table>
4859
4860 !! end
4861
4862 !! test
4863 Wikitext table with a lot of comments
4864 !! input
4865 {|
4866 <!-- c0 -->
4867 | foo
4868 <!-- c1 -->
4869 |- <!-- c2 -->
4870 <!-- c3 -->
4871 |<!-- c4 -->
4872 <!-- c5 -->
4873 |}
4874 !! result
4875 <table>
4876 <tr>
4877 <td> foo
4878 </td></tr>
4879 <tr>
4880 <td>
4881 </td></tr></table>
4882
4883 !! end
4884
4885 !! test
4886 Wikitext table with double-line table cell
4887 !! input
4888 {|
4889 |a
4890 b
4891 |}
4892 !! result
4893 <table>
4894 <tr>
4895 <td>a
4896 <p>b
4897 </p>
4898 </td></tr></table>
4899
4900 !! end
4901
4902 !! test
4903 Table cell with a single comment
4904 !! input
4905 {|
4906 | <!-- c1 -->
4907 | a
4908 |}
4909 !! result
4910 <table>
4911 <tr>
4912 <td>
4913 </td>
4914 <td> a
4915 </td></tr></table>
4916
4917 !! end
4918
4919 # The expected HTML structure in this test is debatable. The PHP parser does
4920 # not parse this kind of table at all. The main focus for Parsoid is on
4921 # round-tripping, so this output is ok for now. TODO: revisit!
4922 !! test
4923 Wikitext table with html-syntax row (Parsoid)
4924 !! options
4925 parsoid
4926 !! input
4927 {|
4928 |-
4929 <td>foo</td>
4930 |}
4931 !! result
4932 <table>
4933 <tbody>
4934 <tr>
4935 <td>foo</td></tr></tbody></table>
4936 !! end
4937
4938 !! test
4939 Implicit <td> after a |-
4940 (PHP parser relies on Tidy to add the missing <td> tags)
4941 !! options
4942 parsoid=wt2html,wt2wt
4943 !! input
4944 {|
4945 |-
4946 a
4947 |}
4948 !! result
4949 <table>
4950 <tr><td>a</td></tr>
4951 </table>
4952 !! end
4953
4954 !! test
4955 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
4956 (PHP parser relies on Tidy to add the missing <td> tags)
4957 !! options
4958 parsoid=wt2html,wt2wt
4959 !! input
4960 {|
4961 |-
4962 |
4963 a
4964 |-
4965 b
4966 |}
4967 !! result
4968 <table>
4969 <tbody>
4970 <tr><td><pre>a</pre></td></tr>
4971 <tr><td> b</td></tr>
4972 </tbody>
4973 </table>
4974 !! end
4975
4976 !! test
4977 Lists should be recognized in an implicit <td> context
4978 (PHP parser relies on Tidy to add the missing <td> tags)
4979 !! options
4980 parsoid=wt2html,wt2wt
4981 !! input
4982 {|
4983 |-
4984 *a
4985 |}
4986 !! result
4987 <table>
4988 <tr>
4989 <td><ul>
4990 <li>a</li>
4991 </ul></td>
4992 </tr>
4993 </table>
4994 !! end
4995
4996 !! test
4997 Parsoid: Round-trip tables directly followed by content (bug 51219)
4998 !! options
4999 parsoid=wt2html,wt2wt
5000 !! input
5001 {|
5002 |foo
5003 |} bar
5004
5005 {|
5006 |baz
5007 |}<b>quux</b>
5008 !! result
5009 <table><tbody>
5010 <tr>
5011 <td>foo</td></tr></tbody></table> bar
5012 <table>
5013 <tbody>
5014 <tr>
5015 <td>baz</td></tr></tbody></table><b>quux</b>
5016 !! end
5017
5018 !! test
5019 Parsoid: Default to a newline after tables in new content (bug 51219)
5020 !! options
5021 parsoid=html2wt
5022 !! input
5023 {|
5024 |foo
5025 |}
5026 <nowiki> </nowiki>bar
5027 {|
5028 |baz
5029 |}
5030 '''quux'''
5031 !! result
5032 <table><tbody>
5033 <tr><td>foo</td></tr></tbody></table> bar
5034 <table><tbody>
5035 <tr><td>baz</td></tr></tbody></table><b>quux</b>
5036 !! end
5037
5038 !! test
5039 Parsoid: newline inducing block nodes don't suppress <nowiki>
5040 !! options
5041 parsoid=html2wt
5042 !! input
5043 <nowiki> </nowiki>a
5044
5045 = foo =
5046 !! result
5047 a<h1>foo</h1>
5048 !! end
5049
5050 ###
5051 ### Internal links
5052 ###
5053 !! test
5054 Plain link, capitalized
5055 !! input
5056 [[Main Page]]
5057 !! result
5058 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5059 </p>
5060 !! end
5061
5062 !! test
5063 Plain link, uncapitalized
5064 !! input
5065 [[main Page]]
5066 !! result
5067 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
5068 </p>
5069 !! end
5070
5071 !! test
5072 Piped link
5073 !! input
5074 [[Main Page|The Main Page]]
5075 !! result
5076 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5077 </p>
5078 !! end
5079
5080 !! test
5081 Piped link with comment in link text
5082 !! input
5083 [[Main Page|The Main<!--front--> Page]]
5084 !! result
5085 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5086 </p>
5087 !! end
5088
5089 !! test
5090 Broken link
5091 !! input
5092 [[Zigzagzogzagzig]]
5093 !! result
5094 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
5095 </p>
5096 !! end
5097
5098 !! test
5099 Broken link with fragment
5100 !! input
5101 [[Zigzagzogzagzig#zug]]
5102 !! result
5103 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
5104 </p>
5105 !! end
5106
5107 !! test
5108 Special page link with fragment
5109 !! input
5110 [[Special:Version#anchor]]
5111 !! result
5112 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
5113 </p>
5114 !! end
5115
5116 !! test
5117 Nonexistent special page link with fragment
5118 !! input
5119 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
5120 !! result
5121 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
5122 </p>
5123 !! end
5124
5125 !! test
5126 Link with prefix
5127 !! input
5128 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
5129 !! result
5130 <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>
5131 </p>
5132 !! end
5133
5134 !! test
5135 Link with suffix
5136 !! input
5137 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
5138 !! result
5139 <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>!!!
5140 </p>
5141 !! end
5142
5143 !! article
5144 prefixed article
5145 !! text
5146 Some text
5147 !! endarticle
5148
5149 !! test
5150 Bug 43661: Piped links with identical prefixes
5151 !! input
5152 [[prefixed article|prefixed articles with spaces]]
5153
5154 [[prefixed article|prefixed articlesaoeu]]
5155
5156 [[Main Page|Main Page test]]
5157 !! result
5158 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
5159 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
5160 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
5161 </p>
5162 !! end
5163
5164
5165 !! test
5166 Link with HTML entity in suffix / tail
5167 !! input
5168 [[Main Page]]&quot;, [[Main Page]]&#97;
5169 !! result
5170 <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;
5171 </p>
5172 !! end
5173
5174 !! test
5175 Link with 3 brackets
5176 !! input
5177 [[[main page]]]
5178 !! result
5179 <p>[[[main page]]]
5180 </p>
5181 !! end
5182
5183 !! test
5184 Piped link with 3 brackets
5185 !! input
5186 [[[main page|the main page]]]
5187 !! result
5188 <p>[[[main page|the main page]]]
5189 </p>
5190 !! end
5191
5192 !! test
5193 Piped link with extlink-like text
5194 !! input
5195 [[Main Page|[bar]]]
5196 [[Main Page|This is a [bar]]]
5197 !! result
5198 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
5199 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
5200 </p>
5201 !! end
5202
5203 !! test
5204 Link with multiple pipes
5205 !! input
5206 [[Main Page|The|Main|Page]]
5207 !! result
5208 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
5209 </p>
5210 !! end
5211
5212 !! test
5213 Link to namespaces
5214 !! input
5215 [[Talk:Parser testing]], [[Meta:Disclaimers]]
5216 !! result
5217 <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>
5218 </p>
5219 !! end
5220
5221 !! article
5222 MemoryAlpha:AlphaTest
5223 !! text
5224 This is an article in the MemoryAlpha namespace
5225 (which shadows the memoryalpha interwiki link).
5226 !! endarticle
5227
5228 !! test
5229 Namespace takes precedence over interwiki link (bug 51680)
5230 !! input
5231 [[MemoryAlpha:AlphaTest]]
5232 !! result
5233 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5234 </p>
5235 !! end
5236
5237 # The previous test doesn't work correctly in html2*, due to not recognizing the
5238 # link as an internal one. This one checks for the correct behavior.
5239 !! test
5240 Link to namespace preferred over interwiki with correct rel attribute
5241 !! options
5242 parsoid=html2wt,html2html
5243 !! input
5244 [[MemoryAlpha:AlphaTest]]
5245 !! result
5246 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5247 </p>
5248 !! end
5249
5250 !! test
5251 Piped link to namespace
5252 !! input
5253 [[Meta:Disclaimers|The disclaimers]]
5254 !! result
5255 <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>
5256 </p>
5257 !! end
5258
5259 !! test
5260 Link containing }
5261 !! input
5262 [[Usually caused by a typo (oops}]]
5263 !! result
5264 <p>[[Usually caused by a typo (oops}]]
5265 </p>
5266 !! end
5267
5268 !! test
5269 Link containing % (not as a hex sequence)
5270 !! input
5271 [[7% Solution]]
5272 !! result
5273 <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>
5274 </p>
5275 !! end
5276
5277 !! test
5278 Link containing % as a single hex sequence interpreted to char
5279 !! input
5280 [[7%25 Solution]]
5281 !! result
5282 <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>
5283 </p>
5284 !!end
5285
5286 !! test
5287 Link containing % as a double hex sequence interpreted to hex sequence
5288 !! input
5289 [[7%2525 Solution]]
5290 !! result
5291 <p>[[7%2525 Solution]]
5292 </p>
5293 !!end
5294
5295 !! test
5296 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
5297 Example for such a section: == < ==
5298 !! input
5299 [[%23%3c]][[%23%3e]]
5300 !! result
5301 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
5302 </p>
5303 !! end
5304
5305 !! test
5306 Link containing "<#" and ">#" as a hex sequences
5307 !! input
5308 [[%3c%23]][[%3e%23]]
5309 !! result
5310 <p>[[%3c%23]][[%3e%23]]
5311 </p>
5312 !! end
5313
5314 !! test
5315 Link containing an equals sign
5316 !! input
5317 [[Special:BookSources/isbn=4-00-026157-6]]
5318 !! result
5319 <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>
5320 </p>
5321 !! end
5322
5323 !! article
5324 Foo~bar
5325 !! text
5326 Just a test of an article title containing a tilde.
5327 !! endarticle
5328
5329 # note that links containing signatures, like [[Foo~~~~]], are
5330 # massaged by the pre-save transform (PST) and so the tildes are never
5331 # seen by the parser.
5332 !! test
5333 Link containing a tilde
5334 !! input
5335 [[Foo~bar]]
5336 !! result
5337 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
5338 </p>
5339 !! end
5340
5341 !! test
5342 Link containing double-single-quotes '' (bug 4598)
5343 !! input
5344 [[Lista d''e paise d''o munno]]
5345 !! result
5346 <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>
5347 </p>
5348 !! end
5349
5350 !! test
5351 Link containing double-single-quotes '' in text (bug 4598 sanity check)
5352 !! input
5353 Some [[Link|pretty ''italics'' and stuff]]!
5354 !! result
5355 <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>!
5356 </p>
5357 !! end
5358
5359 !! test
5360 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
5361 !! input
5362 ''Some [[Link|pretty ''italics'' and stuff]]!
5363 !! result
5364 <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>
5365 </p>
5366 !! end
5367
5368 !! test
5369 Link with double quotes in title part (literal) and alternate part (interpreted)
5370 !! input
5371 [[File:Denys Savchenko ''Pentecoste''.jpg]]
5372
5373 [[''Pentecoste'']]
5374
5375 [[''Pentecoste''|Pentecoste]]
5376
5377 [[''Pentecoste''|''Pentecoste'']]
5378 !! result
5379 <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>
5380 </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>
5381 </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>
5382 </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>
5383 </p>
5384 !! end
5385
5386 !! test
5387 Broken image links with HTML captions (bug 39700)
5388 !! input
5389 [[File:Nonexistent|<script></script>]]
5390 [[File:Nonexistent|100px|<script></script>]]
5391 [[File:Nonexistent|&lt;]]
5392 [[File:Nonexistent|a<i>b</i>c]]
5393 !! result
5394 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5395 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5396 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
5397 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
5398 </p>
5399 !! end
5400
5401 !! test
5402 Plain link to URL
5403 !! input
5404 [[http://www.example.com]]
5405 !! result
5406 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
5407 </p>
5408 !! end
5409
5410 !! test
5411 Plain link to URL with link text
5412 !! input
5413 [[http://www.example.com Link text]]
5414 !! result
5415 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
5416 </p>
5417 !! end
5418
5419 !! test
5420 Plain link to protocol-relative URL
5421 !! input
5422 [[//www.example.com]]
5423 !! result
5424 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
5425 </p>
5426 !! end
5427
5428 !! test
5429 Plain link to protocol-relative URL with link text
5430 !! input
5431 [[//www.example.com Link text]]
5432 !! result
5433 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
5434 </p>
5435 !! end
5436
5437 !! test
5438 Plain link to page with question mark in title
5439 !! input
5440 [[A?b]]
5441
5442 [[A?b|Baz]]
5443 !! result
5444 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
5445 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
5446 </p>
5447 !! end
5448
5449
5450 # I'm fairly sure the expected result here is wrong.
5451 # We want these to be URL links, not pseudo-pages with URLs for titles....
5452 # However the current output is also pretty screwy.
5453 #
5454 # ----
5455 # I'm changing it to match the current output--it arguably makes more
5456 # sense in the light of the test above. Old expected result was:
5457 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
5458 #</p>
5459 # But I think this test is bordering on "garbage in, garbage out" anyway.
5460 # -- wtm
5461 !! test
5462 Piped link to URL
5463 !! input
5464 Piped link to URL: [[http://www.example.com|an example URL]]
5465 !! result
5466 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
5467 </p>
5468 !! end
5469
5470 !! test
5471 BUG 2: [[page|http://url/]] should link to page, not http://url/
5472 !! input
5473 [[Main Page|http://url/]]
5474 !! result
5475 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
5476 </p>
5477 !! end
5478
5479 !! test
5480 BUG 337: Escaped self-links should be bold
5481 !! options
5482 title=[[Bug462]]
5483 !! input
5484 [[Bu&#103;462]] [[Bug462]]
5485 !! result
5486 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
5487 </p>
5488 !! end
5489
5490 !! test
5491 Self-link to section should not be bold
5492 !! options
5493 title=[[Main Page]]
5494 !! input
5495 [[Main Page#section]]
5496 !! result
5497 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
5498 </p>
5499 !! end
5500
5501 !! article
5502 00
5503 !! text
5504 This is 00.
5505 !! endarticle
5506
5507 !!test
5508 Self-link to numeric title
5509 !!options
5510 title=[[0]]
5511 !!input
5512 [[0]]
5513 !!result
5514 <p><strong class="selflink">0</strong>
5515 </p>
5516 !!end
5517
5518 !!test
5519 Link to numeric-equivalent title
5520 !!options
5521 title=[[0]]
5522 !!input
5523 [[00]]
5524 !!result
5525 <p><a href="/wiki/00" title="00">00</a>
5526 </p>
5527 !!end
5528
5529 !! test
5530 <nowiki> inside a link
5531 !! input
5532 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
5533 !! result
5534 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
5535 </p>
5536 !! end
5537
5538 !! test
5539 Non-breaking spaces in title
5540 !! input
5541 [[&nbsp; Main &nbsp; Page &nbsp;]]
5542 !! result
5543 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
5544 </p>
5545 !!end
5546
5547 !! test
5548 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
5549 !! options
5550 language=ca
5551 !! input
5552 '''[[Main Page]]'''
5553 !! result
5554 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
5555 </p>
5556 !! end
5557
5558 !! test
5559 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
5560 !! options
5561 language=ca
5562 !! input
5563 ''[[Main Page]]''
5564 !! result
5565 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
5566 </p>
5567 !! end
5568
5569 !! test
5570 Internal link with en linktrail: no apostrophes (bug 27473)
5571 !! options
5572 language=en
5573 !! input
5574 [[Something]]'nice
5575 !! result
5576 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
5577 </p>
5578 !! end
5579
5580 !! test
5581 Internal link with ca linktrail with apostrophes (bug 27473)
5582 !! options
5583 language=ca
5584 !! input
5585 [[Something]]'nice
5586 !! result
5587 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
5588 </p>
5589 !! end
5590
5591 !! test
5592 Internal link with kaa linktrail with apostrophes (bug 27473)
5593 !! options
5594 language=kaa
5595 !! input
5596 [[Something]]'nice
5597 !! result
5598 <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>
5599 </p>
5600 !! end
5601
5602 !! article
5603 Söfnuður
5604 !! text
5605 Test.
5606 !! endarticle
5607
5608 !! test
5609 Internal link with is link prefix
5610 !! options
5611 language=is
5612 !! input
5613 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
5614 !! result
5615 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
5616 </p>
5617 !! end
5618
5619 !! article
5620 Mótmælendatrú
5621 !! text
5622 Test.
5623 !! endarticle
5624
5625 !! test
5626 Internal link with is link trail and link prefix
5627 !! options
5628 language=is
5629 !! input
5630 [[mótmælendatrú|xxx]]ar
5631 [[mótmælendatrú]]ar
5632 mótmælenda[[söfnuður]]
5633 mótmælenda[[söfnuður|söfnuðir]]
5634 mótmælenda[[söfnuður|söfnuðir]]xxx
5635 !! result
5636 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
5637 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
5638 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
5639 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
5640 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
5641 </p>
5642 !! end
5643
5644 !! test
5645 Parsoid link trail escaping
5646 !! options
5647 parsoid=html2wt,html2html
5648 !! input
5649 [[apple]]<nowiki/>s
5650 !! result
5651 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
5652 !! end
5653
5654 !! test
5655 Parsoid link prefix escaping
5656 !! options
5657 language=is
5658 parsoid=html2wt,html2html
5659 !! input
5660 Aðrir mótmælenda<nowiki/>[[söfnuður]]
5661 !! result
5662 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
5663 !! end
5664
5665 !! test
5666 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
5667 !! input
5668 [[Foo| bar]]
5669
5670 [[Foo| ''bar'']]
5671
5672 [http://wp.org foo]
5673
5674 [http://wp.org ''foo'']
5675 !! result
5676 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
5677 </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>
5678 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
5679 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
5680 </p>
5681 !! end
5682
5683 !! test
5684 Parsoid: Scoped parsing should handle mixed transclusions and plain text
5685 !! options
5686 parsoid
5687 !! input
5688 [[Foo|{{echo|a}} b {{echo|c}}]]
5689 !! result
5690 <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>
5691 !! end
5692
5693 ###
5694 ### Interwiki links (see maintenance/interwiki.sql)
5695 ###
5696
5697 !! test
5698 Inline interwiki link
5699 !! input
5700 [[MeatBall:SoftSecurity]]
5701 !! result
5702 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
5703 </p>
5704 !! end
5705
5706 !! test
5707 Inline interwiki link with empty title (bug 2372)
5708 !! input
5709 [[MeatBall:]]
5710 !! result
5711 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
5712 </p>
5713 !! end
5714
5715 !! test
5716 Interwiki link encoding conversion (bug 1636)
5717 !! input
5718 *[[Wikipedia:ro:Olteni&#0355;a]]
5719 *[[Wikipedia:ro:Olteni&#355;a]]
5720 !! result
5721 <ul>
5722 <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>
5723 </li>
5724 <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>
5725 </li>
5726 </ul>
5727
5728 !! end
5729
5730 !! test
5731 Interwiki link with fragment (bug 2130)
5732 !! input
5733 [[MeatBall:SoftSecurity#foo]]
5734 !! result
5735 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
5736 </p>
5737 !! end
5738
5739 # Ideally the wikipedia: prefix here should be proto-relative too
5740 !! test
5741 Different interwiki prefixes mapping to the same URL
5742 !! options
5743 parsoid
5744 !! input
5745 [[wikipedia:Foo]]
5746
5747 [[:en:Foo]]
5748 !! result
5749 <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>
5750
5751
5752 <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>
5753 !! end
5754
5755 !! test
5756 Interwiki links that cannot be represented in wiki syntax
5757 !! options
5758 parsoid
5759 !! input
5760 [[meatball:ok]]
5761 [[meatball:ok#foo|ok with fragment]]
5762 [[meatball:ok_as_well?|ok ending with ? mark]]
5763 [http://de.wikipedia.org/wiki/Foo?action=history has query]
5764 [http://de.wikipedia.org/wiki/#foo is just fragment]
5765
5766 !! result
5767 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok">meatball:ok</a>
5768 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo">ok with fragment</a>
5769 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F">ok ending with ? mark</a>
5770 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
5771 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
5772 !! end
5773
5774
5775 ###
5776 ### Interlanguage links
5777 ### Language links (so that searching for '### language' matches..)
5778 ###
5779
5780 !! test
5781 Interlanguage link
5782 !! input
5783 Blah blah blah
5784 [[zh:Chinese]]
5785 !!result
5786 <p>Blah blah blah
5787 </p>
5788 !! end
5789
5790 !! test
5791 Double interlanguage link
5792 !! input
5793 Blah blah blah
5794 [[es:Spanish]]
5795 [[zh:Chinese]]
5796 !!result
5797 <p>Blah blah blah
5798 </p>
5799 !! end
5800
5801 !! test
5802 Interlanguage link, with prefix links
5803 !! options
5804 language=ln
5805 !! input
5806 Blah blah blah
5807 [[zh:Chinese]]
5808 !!result
5809 <p>Blah blah blah
5810 </p>
5811 !! end
5812
5813 !! test
5814 Double interlanguage link, with prefix links (bug 8897)
5815 !! options
5816 language=ln
5817 !! input
5818 Blah blah blah
5819 [[es:Spanish]]
5820 [[zh:Chinese]]
5821 !!result
5822 <p>Blah blah blah
5823 </p>
5824 !! end
5825
5826 !! test
5827 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
5828 !! options
5829 language=ln
5830 !! input
5831 [[WW&nbsp;II]]
5832 !!result
5833 <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>
5834 </p>
5835 !! end
5836
5837 !! test
5838 Parsoid bug 53221: Wikilinks should be properly entity-escaped
5839 !! options
5840 parsoid=html2wt
5841 !! input
5842 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
5843
5844 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
5845 !!result
5846 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
5847 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
5848 !! end
5849
5850 !! test
5851 Parsoid: handle constructor well
5852 !! options
5853 parsoid
5854 !! input
5855 [[constructor]]
5856
5857 [[constructor:foo]]
5858 !! result
5859 <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>
5860
5861
5862 <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>
5863 !! end
5864
5865 !! test
5866 Parsoid: recognize interlanguage links without a target page
5867 !! options
5868 parsoid
5869 !! input
5870 [[ko:]]
5871 !! result
5872 <p>
5873 <link rel="mw:PageProp/Language" href="http://ko.wikipedia.org/wiki/"></p>
5874 !! end
5875
5876 !! test
5877 Parsoid: recognize interwiki links without a target page
5878 !! options
5879 parsoid
5880 !! input
5881 [[:ko:]]
5882 !! result
5883 <p><a rel="mw:ExtLink" href="//ko.wikipedia.org/wiki/">ko:</a></p>
5884 !! end
5885
5886 ###
5887 ### Redirects, Parsoid-only
5888 ###
5889 !! test
5890 Simple redirect to page
5891 !! options
5892 parsoid
5893 !! input
5894 #REDIRECT [[Main Page]]
5895 !! result
5896 <link rel="mw:PageProp/redirect" href="./Main_Page">
5897 !! end
5898
5899 !! test
5900 Optional colon in #REDIRECT
5901 !! options
5902 # the colon is archaic syntax. we support it for wt2html, but we
5903 # don't care that it roundtrips back to the modern syntax.
5904 parsoid=wt2html,html2html
5905 !! input
5906 #REDIRECT:[[Main Page]]
5907 !! result
5908 <link rel="mw:PageProp/redirect" href="./Main_Page">
5909 !! end
5910
5911 !! test
5912 Whitespace in #REDIRECT with optional colon
5913 !! options
5914 # the colon and gratuitous whitespace is archaic syntax. we support
5915 # it for wt2html, but we don't care that it roundtrips back to the
5916 # modern syntax (without extra whitespace)
5917 parsoid=wt2html,html2html
5918 !! input
5919
5920 #REDIRECT
5921 :
5922 [[Main Page]]
5923 !! result
5924 <link rel="mw:PageProp/redirect" href="./Main_Page">
5925 !! end
5926
5927 !! test
5928 Piped link in #REDIRECT
5929 !! options
5930 # content after piped link is ignored. we support this syntax,
5931 # but don't care that the piped link is lost when we roundtrip this.
5932 parsoid=wt2html
5933 !! input
5934 #REDIRECT [[Main Page|bar]]
5935 !! result
5936 <link rel="mw:PageProp/redirect" href="./Main_Page">
5937 !! end
5938
5939 !! test
5940 Redirect to category
5941 !! options
5942 parsoid=wt2html
5943 !! input
5944 #REDIRECT [[Category:Foo]]
5945 !! result
5946 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
5947 !! end
5948
5949 !! test
5950 Redirect to category with URL encoding
5951 !! options
5952 parsoid=wt2html
5953 !! input
5954 #REDIRECT [[Category%3AFoo]]
5955 !! result
5956 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
5957 !! end
5958
5959 !! test
5960 Redirect to category page
5961 !! options
5962 parsoid=wt2html,html2html
5963 !! input
5964 #REDIRECT [[:Category:Foo]]
5965 !! result
5966 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
5967 !! end
5968
5969 !! test
5970 Redirect to image page (1)
5971 !! options
5972 parsoid
5973 !! input
5974 #REDIRECT [[File:Wiki.png]]
5975 !! result
5976 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5977 !! end
5978
5979 !! test
5980 Redirect to image page (2)
5981 !! options
5982 parsoid
5983 !! input
5984 #REDIRECT [[Image:Wiki.png]]
5985 !! result
5986 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5987 !! end
5988
5989 !! test
5990 Redirect to language
5991 !! options
5992 parsoid
5993 !! input
5994 #REDIRECT [[en:File:Wiki.png]]
5995 !! result
5996 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5997 !! end
5998
5999 !! test
6000 Redirect to interwiki
6001 !! options
6002 parsoid
6003 !! input
6004 #REDIRECT [[meatball:File:Wiki.png]]
6005 !! result
6006 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
6007 !! end
6008
6009 !! test
6010 Non-English #REDIRECT
6011 !! options
6012 parsoid
6013 language=is
6014 !! input
6015 #TILVÍSUN [[Main Page]]
6016 !! result
6017 <link rel="mw:PageProp/redirect" href="./Main_Page">
6018 !! end
6019
6020 ##
6021 ## XHTML tidiness
6022 ###
6023
6024 !! test
6025 <br> to <br />
6026 !! input
6027 1<br>2<br />3
6028 !! result
6029 <p>1<br />2<br />3
6030 </p>
6031 !! end
6032
6033 !! test
6034 Broken br tag sanitization
6035 !! options
6036 php
6037 !! input
6038 </br>
6039 !! result
6040 <p>&lt;/br&gt;
6041 </p>
6042 !! end
6043
6044 # TODO: Fix html2html mode (bug 51055)!
6045 !! test
6046 Parsoid: Broken br tag recognition
6047 !! options
6048 parsoid=wt2html
6049 !! input
6050 </br>
6051 !! result
6052 <p><br></p>
6053 !! end
6054
6055 !! test
6056 Incorrecly removing closing slashes from correctly formed XHTML
6057 !! input
6058 <br style="clear:both;" />
6059 !! result
6060 <p><br style="clear:both;" />
6061 </p>
6062 !! end
6063
6064 !! test
6065 Failing to transform badly formed HTML into correct XHTML
6066 !! input
6067 <br style="clear: left;">
6068 <br style="clear: right;">
6069 <br style="clear: both;">
6070 !! result
6071 <p><br style="clear: left;" />
6072 <br style="clear: right;" />
6073 <br style="clear: both;" />
6074 </p>
6075 !!end
6076
6077 !! test
6078 Handling html with a div self-closing tag
6079 !! input
6080 <div title />
6081 <div title/>
6082 <div title/ >
6083 <div title=bar />
6084 <div title=bar/>
6085 <div title=bar/ >
6086 !! result
6087 <p>&lt;div title /&gt;
6088 &lt;div title/&gt;
6089 </p>
6090 <div>
6091 <p>&lt;div title=bar /&gt;
6092 &lt;div title=bar/&gt;
6093 </p>
6094 <div title="bar/"></div>
6095 </div>
6096
6097 !! end
6098
6099 !! test
6100 Handling html with a br self-closing tag
6101 !! input
6102 <br title />
6103 <br title/>
6104 <br title/ >
6105 <br title=bar />
6106 <br title=bar/>
6107 <br title=bar/ >
6108 !! result
6109 <p><br title="title" />
6110 <br title="title" />
6111 <br />
6112 <br title="bar" />
6113 <br title="bar" />
6114 <br title="bar/" />
6115 </p>
6116 !! end
6117
6118 !! test
6119 Horizontal ruler (should it add that extra space?)
6120 !! input
6121 <hr>
6122 <hr >
6123 foo <hr
6124 > bar
6125 !! result
6126 <hr />
6127 <hr />
6128 foo <hr /> bar
6129
6130 !! end
6131
6132 !! test
6133 Horizontal ruler -- 4+ dashes render hr
6134 !! input
6135 ----
6136 !! result
6137 <hr />
6138
6139 !! end
6140
6141 !! test
6142 Horizontal ruler -- eats additional dashes on the same line
6143 !! input
6144 ---------
6145 !! result
6146 <hr />
6147
6148 !! end
6149
6150 !! test
6151 Horizontal ruler -- does not collapse dashes on consecutive lines
6152 !! input
6153 ----
6154 ----
6155 !! result
6156 <hr />
6157 <hr />
6158
6159 !! end
6160
6161 !! test
6162 Horizontal ruler -- <4 dashes render as plain text
6163 !! input
6164 ---
6165 !! result
6166 <p>---
6167 </p>
6168 !! end
6169
6170 !! test
6171 Horizontal ruler -- Supports content following dashes on same line
6172 !! input
6173 ---- Foo
6174 !! result
6175 <hr /> Foo
6176
6177 !! end
6178
6179 ###
6180 ### Block-level elements
6181 ###
6182 !! test
6183 Common list
6184 !! input
6185 *Common list
6186 * item 2
6187 *item 3
6188 !! result
6189 <ul>
6190 <li>Common list
6191 </li>
6192 <li> item 2
6193 </li>
6194 <li>item 3
6195 </li>
6196 </ul>
6197
6198 !! end
6199
6200 !! test
6201 Numbered list
6202 !! input
6203 #Numbered list
6204 #item 2
6205 # item 3
6206 !! result
6207 <ol>
6208 <li>Numbered list
6209 </li>
6210 <li>item 2
6211 </li>
6212 <li> item 3
6213 </li>
6214 </ol>
6215
6216 !! end
6217
6218 !! test
6219 Mixed list
6220 !! input
6221 *Mixed list
6222 *# with numbers
6223 ** and bullets
6224 *# and numbers
6225 *bullets again
6226 **bullet level 2
6227 ***bullet level 3
6228 ***#Number on level 4
6229 **bullet level 2
6230 **#Number on level 3
6231 **#Number on level 3
6232 *#number level 2
6233 *Level 1
6234 *** Level 3
6235 #** Level 3, but ordered
6236 !! result
6237 <ul>
6238 <li>Mixed list
6239 <ol>
6240 <li> with numbers
6241 </li>
6242 </ol>
6243 <ul>
6244 <li> and bullets
6245 </li>
6246 </ul>
6247 <ol>
6248 <li> and numbers
6249 </li>
6250 </ol>
6251 </li>
6252 <li>bullets again
6253 <ul>
6254 <li>bullet level 2
6255 <ul>
6256 <li>bullet level 3
6257 <ol>
6258 <li>Number on level 4
6259 </li>
6260 </ol>
6261 </li>
6262 </ul>
6263 </li>
6264 <li>bullet level 2
6265 <ol>
6266 <li>Number on level 3
6267 </li>
6268 <li>Number on level 3
6269 </li>
6270 </ol>
6271 </li>
6272 </ul>
6273 <ol>
6274 <li>number level 2
6275 </li>
6276 </ol>
6277 </li>
6278 <li>Level 1
6279 <ul>
6280 <li><ul>
6281 <li> Level 3
6282 </li>
6283 </ul>
6284 </li>
6285 </ul>
6286 </li>
6287 </ul>
6288 <ol>
6289 <li><ul>
6290 <li><ul>
6291 <li> Level 3, but ordered
6292 </li>
6293 </ul>
6294 </li>
6295 </ul>
6296 </li>
6297 </ol>
6298
6299 !! end
6300
6301 !! test
6302 Nested lists 1
6303 !! input
6304 *foo
6305 **bar
6306 !! result
6307 <ul>
6308 <li>foo
6309 <ul>
6310 <li>bar
6311 </li>
6312 </ul>
6313 </li>
6314 </ul>
6315
6316 !! end
6317
6318 !! test
6319 Nested lists 2
6320 !! input
6321 **foo
6322 *bar
6323 !! result
6324 <ul>
6325 <li><ul>
6326 <li>foo
6327 </li>
6328 </ul>
6329 </li>
6330 <li>bar
6331 </li>
6332 </ul>
6333
6334 !! end
6335
6336 !! test
6337 Nested lists 3 (first element empty)
6338 !! input
6339 *
6340 **bar
6341 !! result
6342 <ul>
6343 <li>
6344 <ul>
6345 <li>bar
6346 </li>
6347 </ul>
6348 </li>
6349 </ul>
6350
6351 !! end
6352
6353 !! test
6354 Nested lists 4 (first element empty)
6355 !! input
6356 **
6357 *bar
6358 !! result
6359 <ul>
6360 <li><ul>
6361 <li>
6362 </li>
6363 </ul>
6364 </li>
6365 <li>bar
6366 </li>
6367 </ul>
6368
6369 !! end
6370
6371 !! test
6372 Nested lists 5 (both elements empty)
6373 !! input
6374 **
6375 *
6376 !! result
6377 <ul>
6378 <li><ul>
6379 <li>
6380 </li>
6381 </ul>
6382 </li>
6383 <li>
6384 </li>
6385 </ul>
6386
6387 !! end
6388
6389 !! test
6390 Nested lists 6 (both elements empty)
6391 !! input
6392 *
6393 **
6394 !! result
6395 <ul>
6396 <li>
6397 <ul>
6398 <li>
6399 </li>
6400 </ul>
6401 </li>
6402 </ul>
6403
6404 !! end
6405
6406 !! test
6407 Nested lists 7 (skip initial nesting levels)
6408 !! input
6409 *** foo
6410 !! result
6411 <ul>
6412 <li><ul>
6413 <li><ul>
6414 <li> foo
6415 </li>
6416 </ul>
6417 </li>
6418 </ul>
6419 </li>
6420 </ul>
6421
6422 !! end
6423
6424 !! test
6425 Nested lists 8 (multiple nesting transitions)
6426 !! input
6427 * foo
6428 *** bar
6429 ** baz
6430 * boo
6431 !! result
6432 <ul>
6433 <li> foo
6434 <ul>
6435 <li><ul>
6436 <li> bar
6437 </li>
6438 </ul>
6439 </li>
6440 <li> baz
6441 </li>
6442 </ul>
6443 </li>
6444 <li> boo
6445 </li>
6446 </ul>
6447
6448 !! end
6449
6450 !! test
6451 1. Lists with start-of-line-transparent tokens before bullets: Comments
6452 !! input
6453 *foo
6454 *<!--cmt-->bar
6455 <!--cmt-->*baz
6456 !! result
6457 <ul>
6458 <li>foo
6459 </li>
6460 <li>bar
6461 </li>
6462 <li>baz
6463 </li>
6464 </ul>
6465
6466 !! end
6467
6468 !! test
6469 2. Lists with start-of-line-transparent tokens before bullets: Template close
6470 !! input
6471 *foo {{echo|bar
6472 }}*baz
6473 !! result
6474 <ul>
6475 <li>foo bar
6476 </li>
6477 <li>baz
6478 </li>
6479 </ul>
6480
6481 !! end
6482
6483 !! test
6484 List items are not parsed correctly following a <pre> block (bug 785)
6485 !! input
6486 * <pre>foo</pre>
6487 * <pre>bar</pre>
6488 * zar
6489 !! result
6490 <ul>
6491 <li> <pre>foo</pre>
6492 </li>
6493 <li> <pre>bar</pre>
6494 </li>
6495 <li> zar
6496 </li>
6497 </ul>
6498
6499 !! end
6500
6501 !! test
6502 List items from template
6503 !! input
6504
6505 {{inner list}}
6506 * item 2
6507
6508 * item 0
6509 {{inner list}}
6510 * item 2
6511
6512 * item 0
6513 * notSOL{{inner list}}
6514 * item 2
6515 !! result
6516 <ul>
6517 <li> item 1
6518 </li>
6519 <li> item 2
6520 </li>
6521 </ul>
6522 <ul>
6523 <li> item 0
6524 </li>
6525 <li> item 1
6526 </li>
6527 <li> item 2
6528 </li>
6529 </ul>
6530 <ul>
6531 <li> item 0
6532 </li>
6533 <li> notSOL
6534 </li>
6535 <li> item 1
6536 </li>
6537 <li> item 2
6538 </li>
6539 </ul>
6540
6541 !! end
6542
6543 !! test
6544 List interrupted by empty line or heading
6545 !! input
6546 * foo
6547
6548 ** bar
6549 == A heading ==
6550 * Another list item
6551 !! result
6552 <ul>
6553 <li> foo
6554 </li>
6555 </ul>
6556 <ul>
6557 <li><ul>
6558 <li> bar
6559 </li>
6560 </ul>
6561 </li>
6562 </ul>
6563 <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>
6564 <ul>
6565 <li> Another list item
6566 </li>
6567 </ul>
6568
6569 !!end
6570
6571 !!test
6572 Multiple list tags generated by templates
6573 !!input
6574 {{echo|<li>}}a
6575 {{echo|<li>}}b
6576 {{echo|<li>}}c
6577 !!result
6578 <li>a
6579 <li>b
6580 <li>c</li>
6581 </li>
6582 </li>
6583
6584 !!end
6585
6586 !!test
6587 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
6588 !!input
6589 *a
6590 <!--This line will NOT split the list-->
6591 *b
6592 <!--This line will NOT split the list either-->
6593 *c
6594 <!--foo--> <!----> <!--This line NOT split the list either-->
6595 *d
6596 !!result
6597 <ul>
6598 <li>a
6599 </li>
6600 <li>b
6601 </li>
6602 <li>c
6603 </li>
6604 <li>d
6605 </li>
6606 </ul>
6607
6608 !!end
6609
6610 !!test
6611 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
6612 !!input
6613 *a
6614 <!--This line will NOT split the list-->
6615 *b
6616 <!--This line will NOT split the list either-->
6617 *c
6618 <!--foo--> <!----> <!--This line NOT split the list
6619 either-->
6620 *d
6621 !!result
6622 <ul>
6623 <li>a
6624 </li>
6625 <li>b
6626 </li>
6627 <li>c
6628 </li>
6629 <li>d
6630 </li>
6631 </ul>
6632
6633 !!end
6634
6635 !!test
6636 Test the li-hack
6637 (Cannot test this with PHP parser since it relies on Tidy for the hack)
6638 !!options
6639 parsoid=wt2html,wt2wt
6640 !!input
6641 * foo
6642 * <li>li-hack
6643 * {{echo|<li>templated li-hack}}
6644 * <!--foo--> <li> unsupported li-hack with preceding comments
6645
6646 <ul>
6647 <li><li>not a li-hack
6648 </li>
6649 </ul>
6650 !!result
6651 <ul>
6652 <li> foo</li>
6653 <li>li-hack</li>
6654 <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>
6655 <li> <!--foo--> </li>
6656 <li> li-hack with preceding comments</li>
6657 </ul>
6658
6659 <ul>
6660 <li></li>
6661 <li>not a li-hack
6662 </li>
6663 </ul>
6664 !!end
6665
6666 !! test
6667 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
6668 !! options
6669 parsoid
6670 !! input
6671 # foo
6672 ## bar
6673 * foo
6674 ** bar
6675 : foo
6676 :: bar
6677 !! result
6678 <ol>
6679 <li> foo<ol>
6680 <li> bar</li>
6681 </ol></li>
6682 </ol><ul>
6683 <li> foo<ul>
6684 <li> bar</li>
6685 </ul></li>
6686 </ul><dl>
6687 <dd> foo<dl>
6688 <dd> bar</dd>
6689 </dl></dd>
6690 </dl>
6691 !! end
6692
6693 !! test
6694 Parsoid: Test of whitespace serialization with Templated bullets
6695 !! options
6696 parsoid
6697 !! input
6698 * {{bullet}}
6699 !! result
6700 <ul>
6701 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
6702 </ul>
6703 !! end
6704
6705 # ------------------------------------------------------------------------
6706 # The next set of tests are about Parsoid's ability to handle badly nested
6707 # tags (parse, minimize scope of fixup, and roundtrip back)
6708 # ------------------------------------------------------------------------
6709
6710 !! test
6711 Unbalanced closing block tags break a list
6712 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6713 !! options
6714 parsoid
6715 !! input
6716 <div>
6717 *a</div><div>
6718 *b</div>
6719 !! result
6720 <div>
6721 <ul>
6722 <li>a
6723 </li>
6724 </ul></div><div>
6725 <ul>
6726 <li>b
6727 </li>
6728 </ul></div>
6729 !! end
6730
6731 !! test
6732 Unbalanced closing non-block tags don't break a list
6733 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6734 !! options
6735 parsoid
6736 !! input
6737 <span>
6738 *a</span><span>
6739 *b</span>
6740 !! result
6741 <p><span></span>
6742 </p>
6743 <ul>
6744 <li>a<span></span>
6745 </li>
6746 <li>b
6747 </li>
6748 </ul>
6749 !! end
6750
6751 !! test
6752 Unclosed formatting tags that straddle lists are closed and reopened
6753 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6754 !! options
6755 parsoid
6756 !! input
6757 # <s> a
6758 # b </s>
6759 !! result
6760 <ol>
6761 <li> <s> a </s>
6762 </li>
6763 <li> <s> b </s>
6764 </li>
6765 </ol>
6766 !! end
6767
6768 !!test
6769 List embedded in a non-block tag
6770 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
6771 !! options
6772 parsoid
6773 !!input
6774 <small>
6775 * foo
6776 </small>
6777 !!result
6778 <p><small></small></p>
6779 <small>
6780 <ul>
6781 <li> foo</li>
6782 </ul>
6783 </small>
6784 <p><small></small></p>
6785 !!end
6786
6787 !! test
6788 Table with missing opening <tr> tag
6789 !! options
6790 parsoid=wt2html,wt2wt
6791 !! input
6792 <table>
6793 <td>foo</td>
6794 </tr>
6795 </table>
6796 !! result
6797 <table>
6798 <tr>
6799 <td>foo</td>
6800 </tr>
6801 </table>
6802 !! end
6803
6804 ###
6805 ### Magic Words
6806 ###
6807
6808 # Note that the current date is hard-coded as
6809 # 1970-01-01T00:02:03Z (a Thursday)
6810 # when running parser tests. The timezone is also fixed to GMT, so
6811 # local date will be identical to current date.
6812
6813 !! test
6814 Magic Word: {{CURRENTDAY}}
6815 !! input
6816 {{CURRENTDAY}}
6817 !! result
6818 <p>1
6819 </p>
6820 !! end
6821
6822 !! test
6823 Magic Word: {{CURRENTDAY2}}
6824 !! input
6825 {{CURRENTDAY2}}
6826 !! result
6827 <p>01
6828 </p>
6829 !! end
6830
6831 !! test
6832 Magic Word: {{CURRENTDAYNAME}}
6833 !! input
6834 {{CURRENTDAYNAME}}
6835 !! result
6836 <p>Thursday
6837 </p>
6838 !! end
6839
6840 !! test
6841 Magic Word: {{CURRENTDOW}}
6842 !! input
6843 {{CURRENTDOW}}
6844 !! result
6845 <p>4
6846 </p>
6847 !! end
6848
6849 !! test
6850 Magic Word: {{CURRENTMONTH}}
6851 !! input
6852 {{CURRENTMONTH}}
6853 !! result
6854 <p>01
6855 </p>
6856 !! end
6857
6858 !! test
6859 Magic Word: {{CURRENTMONTH1}}
6860 !! input
6861 {{CURRENTMONTH1}}
6862 !! result
6863 <p>1
6864 </p>
6865 !! end
6866
6867 !! test
6868 Magic Word: {{CURRENTMONTHABBREV}}
6869 !! input
6870 {{CURRENTMONTHABBREV}}
6871 !! result
6872 <p>Jan
6873 </p>
6874 !! end
6875
6876 !! test
6877 Magic Word: {{CURRENTMONTHNAME}}
6878 !! input
6879 {{CURRENTMONTHNAME}}
6880 !! result
6881 <p>January
6882 </p>
6883 !! end
6884
6885 !! test
6886 Magic Word: {{CURRENTMONTHNAMEGEN}}
6887 !! input
6888 {{CURRENTMONTHNAMEGEN}}
6889 !! result
6890 <p>January
6891 </p>
6892 !! end
6893
6894 !! test
6895 Magic Word: {{CURRENTTIME}}
6896 !! input
6897 {{CURRENTTIME}}
6898 !! result
6899 <p>00:02
6900 </p>
6901 !! end
6902
6903 !! test
6904 Magic Word: {{CURRENTHOUR}}
6905 !! input
6906 {{CURRENTHOUR}}
6907 !! result
6908 <p>00
6909 </p>
6910 !! end
6911
6912 !! test
6913 Magic Word: {{CURRENTWEEK}} (@bug 4594)
6914 !! input
6915 {{CURRENTWEEK}}
6916 !! result
6917 <p>1
6918 </p>
6919 !! end
6920
6921 !! test
6922 Magic Word: {{CURRENTYEAR}}
6923 !! input
6924 {{CURRENTYEAR}}
6925 !! result
6926 <p>1970
6927 </p>
6928 !! end
6929
6930 !! test
6931 Magic Word: {{CURRENTTIMESTAMP}}
6932 !! input
6933 {{CURRENTTIMESTAMP}}
6934 !! result
6935 <p>19700101000203
6936 </p>
6937 !! end
6938
6939 !! test
6940 Magic Words LOCAL (UTC)
6941 !! input
6942 * {{LOCALMONTH}}
6943 * {{LOCALMONTH1}}
6944 * {{LOCALMONTHNAME}}
6945 * {{LOCALMONTHNAMEGEN}}
6946 * {{LOCALMONTHABBREV}}
6947 * {{LOCALDAY}}
6948 * {{LOCALDAY2}}
6949 * {{LOCALDAYNAME}}
6950 * {{LOCALYEAR}}
6951 * {{LOCALTIME}}
6952 * {{LOCALHOUR}}
6953 * {{LOCALWEEK}}
6954 * {{LOCALDOW}}
6955 * {{LOCALTIMESTAMP}}
6956 !! result
6957 <ul>
6958 <li> 01
6959 </li>
6960 <li> 1
6961 </li>
6962 <li> January
6963 </li>
6964 <li> January
6965 </li>
6966 <li> Jan
6967 </li>
6968 <li> 1
6969 </li>
6970 <li> 01
6971 </li>
6972 <li> Thursday
6973 </li>
6974 <li> 1970
6975 </li>
6976 <li> 00:02
6977 </li>
6978 <li> 00
6979 </li>
6980 <li> 1
6981 </li>
6982 <li> 4
6983 </li>
6984 <li> 19700101000203
6985 </li>
6986 </ul>
6987
6988 !! end
6989
6990 !! test
6991 Magic Word: {{FULLPAGENAME}}
6992 !! options
6993 title=[[User:Ævar Arnfjörð Bjarmason]]
6994 !! input
6995 {{FULLPAGENAME}}
6996 !! result
6997 <p>User:Ævar Arnfjörð Bjarmason
6998 </p>
6999 !! end
7000
7001 !! test
7002 Magic Word: {{FULLPAGENAMEE}}
7003 !! options
7004 title=[[User:Ævar Arnfjörð Bjarmason]]
7005 !! input
7006 {{FULLPAGENAMEE}}
7007 !! result
7008 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7009 </p>
7010 !! end
7011
7012 !! test
7013 Magic Word: {{TALKSPACE}}
7014 !! options
7015 title=[[User:Ævar Arnfjörð Bjarmason]]
7016 !! input
7017 {{TALKSPACE}}
7018 !! result
7019 <p>User talk
7020 </p>
7021 !! end
7022
7023 !! test
7024 Magic Word: {{TALKSPACE}}, same namespace
7025 !! options
7026 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7027 !! input
7028 {{TALKSPACE}}
7029 !! result
7030 <p>User talk
7031 </p>
7032 !! end
7033
7034 !! test
7035 Magic Word: {{TALKSPACE}}, main namespace
7036 !! options
7037 title=[[Parser Test]]
7038 !! input
7039 {{TALKSPACE}}
7040 !! result
7041 <p>Talk
7042 </p>
7043 !! end
7044
7045 !! test
7046 Magic Word: {{TALKSPACEE}}
7047 !! options
7048 title=[[User:Ævar Arnfjörð Bjarmason]]
7049 !! input
7050 {{TALKSPACEE}}
7051 !! result
7052 <p>User_talk
7053 </p>
7054 !! end
7055
7056 !! test
7057 Magic Word: {{SUBJECTSPACE}}
7058 !! options
7059 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7060 !! input
7061 {{SUBJECTSPACE}}
7062 !! result
7063 <p>User
7064 </p>
7065 !! end
7066
7067 !! test
7068 Magic Word: {{SUBJECTSPACE}}, same namespace
7069 !! options
7070 title=[[User:Ævar Arnfjörð Bjarmason]]
7071 !! input
7072 {{SUBJECTSPACE}}
7073 !! result
7074 <p>User
7075 </p>
7076 !! end
7077
7078 !! test
7079 Magic Word: {{SUBJECTSPACE}}, main namespace
7080 !! options
7081 title=[[Parser Test]]
7082 !! input
7083 {{SUBJECTSPACE}}
7084 !! result
7085
7086 !! end
7087
7088 !! test
7089 Magic Word: {{SUBJECTSPACEE}}
7090 !! options
7091 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7092 !! input
7093 {{SUBJECTSPACEE}}
7094 !! result
7095 <p>User
7096 </p>
7097 !! end
7098
7099 !! test
7100 Magic Word: {{NAMESPACE}}
7101 !! options
7102 title=[[User:Ævar Arnfjörð Bjarmason]]
7103 !! input
7104 {{NAMESPACE}}
7105 !! result
7106 <p>User
7107 </p>
7108 !! end
7109
7110 !! test
7111 Magic Word: {{NAMESPACEE}}
7112 !! options
7113 title=[[User:Ævar Arnfjörð Bjarmason]]
7114 !! input
7115 {{NAMESPACEE}}
7116 !! result
7117 <p>User
7118 </p>
7119 !! end
7120
7121 !! test
7122 Magic Word: {{NAMESPACENUMBER}}
7123 !! options
7124 title=[[User:Ævar Arnfjörð Bjarmason]]
7125 !! input
7126 {{NAMESPACENUMBER}}
7127 !! result
7128 <p>2
7129 </p>
7130 !! end
7131
7132 !! test
7133 Magic Word: {{SUBPAGENAME}}
7134 !! options
7135 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7136 !! input
7137 {{SUBPAGENAME}}
7138 !! result
7139 <p>sub ö
7140 </p>
7141 !! end
7142
7143 !! test
7144 Magic Word: {{SUBPAGENAMEE}}
7145 !! options
7146 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7147 !! input
7148 {{SUBPAGENAMEE}}
7149 !! result
7150 <p>sub_%C3%B6
7151 </p>
7152 !! end
7153
7154 !! test
7155 Magic Word: {{ROOTPAGENAME}}
7156 !! options
7157 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7158 !! input
7159 {{ROOTPAGENAME}}
7160 !! result
7161 <p>Ævar Arnfjörð Bjarmason
7162 </p>
7163 !! end
7164
7165 !! test
7166 Magic Word: {{ROOTPAGENAMEE}}
7167 !! options
7168 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7169 !! input
7170 {{ROOTPAGENAMEE}}
7171 !! result
7172 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7173 </p>
7174 !! end
7175
7176 !! test
7177 Magic Word: {{BASEPAGENAME}}
7178 !! options
7179 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7180 !! input
7181 {{BASEPAGENAME}}
7182 !! result
7183 <p>Ævar Arnfjörð Bjarmason
7184 </p>
7185 !! end
7186
7187 !! test
7188 Magic Word: {{BASEPAGENAMEE}}
7189 !! options
7190 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7191 !! input
7192 {{BASEPAGENAMEE}}
7193 !! result
7194 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7195 </p>
7196 !! end
7197
7198 !! test
7199 Magic Word: {{TALKPAGENAME}}
7200 !! options
7201 title=[[User:Ævar Arnfjörð Bjarmason]]
7202 !! input
7203 {{TALKPAGENAME}}
7204 !! result
7205 <p>User talk:Ævar Arnfjörð Bjarmason
7206 </p>
7207 !! end
7208
7209 !! test
7210 Magic Word: {{TALKPAGENAMEE}}
7211 !! options
7212 title=[[User:Ævar Arnfjörð Bjarmason]]
7213 !! input
7214 {{TALKPAGENAMEE}}
7215 !! result
7216 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7217 </p>
7218 !! end
7219
7220 !! test
7221 Magic Word: {{SUBJECTPAGENAME}}
7222 !! options
7223 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7224 !! input
7225 {{SUBJECTPAGENAME}}
7226 !! result
7227 <p>User:Ævar Arnfjörð Bjarmason
7228 </p>
7229 !! end
7230
7231 !! test
7232 Magic Word: {{SUBJECTPAGENAMEE}}
7233 !! options
7234 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7235 !! input
7236 {{SUBJECTPAGENAMEE}}
7237 !! result
7238 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7239 </p>
7240 !! end
7241
7242 !! test
7243 Magic Word: {{NUMBEROFFILES}}
7244 !! input
7245 {{NUMBEROFFILES}}
7246 !! result
7247 <p>4
7248 </p>
7249 !! end
7250
7251 !! test
7252 Magic Word: {{PAGENAME}}
7253 !! options
7254 title=[[User:Ævar Arnfjörð Bjarmason]]
7255 !! input
7256 {{PAGENAME}}
7257 !! result
7258 <p>Ævar Arnfjörð Bjarmason
7259 </p>
7260 !! end
7261
7262 !! test
7263 Magic Word: {{PAGENAME}} with metacharacters
7264 !! options
7265 title=[['foo & bar = baz']]
7266 !! input
7267 ''{{PAGENAME}}''
7268 !! result
7269 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
7270 </p>
7271 !! end
7272
7273 !! test
7274 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
7275 !! options
7276 title=[[*RFC 1234 http://example.com/]]
7277 !! input
7278 {{PAGENAME}}
7279 !! result
7280 <p>&#42;RFC&#32;1234 http&#58;//example.com/
7281 </p>
7282 !! end
7283
7284 !! test
7285 Magic Word: {{PAGENAMEE}}
7286 !! options
7287 title=[[User:Ævar Arnfjörð Bjarmason]]
7288 !! input
7289 {{PAGENAMEE}}
7290 !! result
7291 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7292 </p>
7293 !! end
7294
7295 !! test
7296 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
7297 !! options
7298 title=[[*RFC 1234 http://example.com/]]
7299 !! input
7300 {{PAGENAMEE}}
7301 !! result
7302 <p>&#42;RFC_1234_http&#58;//example.com/
7303 </p>
7304 !! end
7305
7306 !! test
7307 Magic Word: {{REVISIONID}}
7308 !! input
7309 {{REVISIONID}}
7310 !! result
7311 <p>1337
7312 </p>
7313 !! end
7314
7315 !! test
7316 Magic Word: {{SCRIPTPATH}}
7317 !! input
7318 {{SCRIPTPATH}}
7319 !! result
7320 <p>/
7321 </p>
7322 !! end
7323
7324 !! test
7325 Magic Word: {{STYLEPATH}}
7326 !! input
7327 {{STYLEPATH}}
7328 !! result
7329 <p>/skins
7330 </p>
7331 !! end
7332
7333 !! test
7334 Magic Word: {{SERVER}}
7335 !! input
7336 {{SERVER}}
7337 !! result
7338 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7339 </p>
7340 !! end
7341
7342 !! test
7343 Magic Word: {{SERVERNAME}}
7344 !! input
7345 {{SERVERNAME}}
7346 !! result
7347 <p>example.org
7348 </p>
7349 !! end
7350
7351 !! test
7352 Magic Word: {{SITENAME}}
7353 !! input
7354 {{SITENAME}}
7355 !! result
7356 <p>MediaWiki
7357 </p>
7358 !! end
7359
7360 !! test
7361 Case-sensitive magic words, when cased differently, should just be template transclusions
7362 !! input
7363 {{CurrentMonth}}
7364 {{currentday}}
7365 {{cURreNTweEK}}
7366 {{currentHour}}
7367 !! result
7368 <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>
7369 <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>
7370 <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>
7371 <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>
7372 </p>
7373 !! end
7374
7375 !! test
7376 Case-insensitive magic words should still work with weird casing.
7377 !! input
7378 {{sErVeRNaMe}}
7379 {{LCFirst:AOEU}}
7380 {{ucFIRST:aoeu}}
7381 {{SERver}}
7382 !! result
7383 <p>example.org
7384 aOEU
7385 Aoeu
7386 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7387 </p>
7388 !! end
7389
7390 !! test
7391 Namespace 1 {{ns:1}}
7392 !! input
7393 {{ns:1}}
7394 !! result
7395 <p>Talk
7396 </p>
7397 !! end
7398
7399 !! test
7400 Namespace 1 {{ns:01}}
7401 !! input
7402 {{ns:01}}
7403 !! result
7404 <p>Talk
7405 </p>
7406 !! end
7407
7408 !! test
7409 Namespace 0 {{ns:0}} (bug 4783)
7410 !! input
7411 {{ns:0}}
7412 !! result
7413
7414 !! end
7415
7416 !! test
7417 Namespace 0 {{ns:00}} (bug 4783)
7418 !! input
7419 {{ns:00}}
7420 !! result
7421
7422 !! end
7423
7424 !! test
7425 Namespace -1 {{ns:-1}}
7426 !! input
7427 {{ns:-1}}
7428 !! result
7429 <p>Special
7430 </p>
7431 !! end
7432
7433 !! test
7434 Namespace User {{ns:User}}
7435 !! input
7436 {{ns:User}}
7437 !! result
7438 <p>User
7439 </p>
7440 !! end
7441
7442 !! test
7443 Namespace User talk {{ns:User_talk}}
7444 !! input
7445 {{ns:User_talk}}
7446 !! result
7447 <p>User talk
7448 </p>
7449 !! end
7450
7451 !! test
7452 Namespace User talk {{ns:uSeR tAlK}}
7453 !! input
7454 {{ns:uSeR tAlK}}
7455 !! result
7456 <p>User talk
7457 </p>
7458 !! end
7459
7460 !! test
7461 Namespace File {{ns:File}}
7462 !! input
7463 {{ns:File}}
7464 !! result
7465 <p>File
7466 </p>
7467 !! end
7468
7469 !! test
7470 Namespace File {{ns:Image}}
7471 !! input
7472 {{ns:Image}}
7473 !! result
7474 <p>File
7475 </p>
7476 !! end
7477
7478 !! test
7479 Namespace (lang=de) Benutzer {{ns:User}}
7480 !! options
7481 language=de
7482 !! input
7483 {{ns:User}}
7484 !! result
7485 <p>Benutzer
7486 </p>
7487 !! end
7488
7489 !! test
7490 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
7491 !! options
7492 language=de
7493 !! input
7494 {{ns:3}}
7495 !! result
7496 <p>Benutzer Diskussion
7497 </p>
7498 !! end
7499
7500
7501 !! test
7502 Urlencode
7503 !! input
7504 {{urlencode:hi world?!}}
7505 {{urlencode:hi world?!|WIKI}}
7506 {{urlencode:hi world?!|PATH}}
7507 {{urlencode:hi world?!|QUERY}}
7508 !! result
7509 <p>hi+world%3F%21
7510 hi_world%3F!
7511 hi%20world%3F%21
7512 hi+world%3F%21
7513 </p>
7514 !! end
7515
7516 ###
7517 ### Magic links
7518 ###
7519 !! test
7520 Magic links: internal link to RFC (bug 479)
7521 !! input
7522 [[RFC 123]]
7523 !! result
7524 <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>
7525 </p>
7526 !! end
7527
7528 !! test
7529 Magic links: RFC (bug 479)
7530 !! input
7531 RFC 822
7532 !! result
7533 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
7534 </p>
7535 !! end
7536
7537 !! test
7538 Magic links: ISBN (bug 1937)
7539 !! input
7540 ISBN 0-306-40615-2
7541 !! result
7542 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
7543 </p>
7544 !! end
7545
7546 !! test
7547 Magic links: PMID incorrectly converts space to underscore
7548 !! input
7549 PMID 1234
7550 !! result
7551 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
7552 </p>
7553 !! end
7554
7555 ###
7556 ### Templates
7557 ####
7558
7559 !! test
7560 Nonexistent template
7561 !! input
7562 {{thistemplatedoesnotexist}}
7563 !! result
7564 <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>
7565 </p>
7566 !! end
7567
7568 !! test
7569 Template with invalid target containing tags
7570 !! input
7571 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
7572 !! result
7573 <p>{{a<b>b</b>|foo|a=b|a = b}}
7574 </p>
7575 !! end
7576
7577 !! test
7578 Template with invalid target containing unclosed tag
7579 !! input
7580 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
7581 !! result
7582 <p>{{a<b>|foo|a=b|a = b}}</b>
7583 </p>
7584 !! end
7585
7586 !! article
7587 Template:test
7588 !! text
7589 This is a test template
7590 !! endarticle
7591
7592 !! test
7593 Simple template
7594 !! input
7595 {{test}}
7596 !! result
7597 <p>This is a test template
7598 </p>
7599 !! end
7600
7601 !! test
7602 Template with explicit namespace
7603 !! input
7604 {{Template:test}}
7605 !! result
7606 <p>This is a test template
7607 </p>
7608 !! end
7609
7610
7611 !! article
7612 Template:paramtest
7613 !! text
7614 This is a test template with parameter {{{param}}}
7615 !! endarticle
7616
7617 !! test
7618 Template parameter
7619 !! input
7620 {{paramtest|param=foo}}
7621 !! result
7622 <p>This is a test template with parameter foo
7623 </p>
7624 !! end
7625
7626 !! article
7627 Template:paramtestnum
7628 !! text
7629 [[{{{1}}}|{{{2}}}]]
7630 !! endarticle
7631
7632 !! test
7633 Template unnamed parameter
7634 !! input
7635 {{paramtestnum|Main Page|the main page}}
7636 !! result
7637 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
7638 </p>
7639 !! end
7640
7641 !! article
7642 Template:templatesimple
7643 !! text
7644 (test)
7645 !! endarticle
7646
7647 !! article
7648 Template:templateredirect
7649 !! text
7650 #redirect [[Template:templatesimple]]
7651 !! endarticle
7652
7653 !! article
7654 Template:templateasargtestnum
7655 !! text
7656 {{{{{1}}}}}
7657 !! endarticle
7658
7659 !! article
7660 Template:templateasargtest
7661 !! text
7662 {{template{{{templ}}}}}
7663 !! endarticle
7664
7665 !! article
7666 Template:templateasargtest2
7667 !! text
7668 {{{{{templ}}}}}
7669 !! endarticle
7670
7671 !! test
7672 Template with template name as unnamed argument
7673 !! input
7674 {{templateasargtestnum|templatesimple}}
7675 !! result
7676 <p>(test)
7677 </p>
7678 !! end
7679
7680 !! test
7681 Template with template name as argument
7682 !! input
7683 {{templateasargtest|templ=simple}}
7684 !! result
7685 <p>(test)
7686 </p>
7687 !! end
7688
7689 !! test
7690 Template with template name as argument (2)
7691 !! input
7692 {{templateasargtest2|templ=templatesimple}}
7693 !! result
7694 <p>(test)
7695 </p>
7696 !! end
7697
7698 !! article
7699 Template:templateasargtestdefault
7700 !! text
7701 {{{{{templ|templatesimple}}}}}
7702 !! endarticle
7703
7704 !! article
7705 Template:templa
7706 !! text
7707 '''templ'''
7708 !! endarticle
7709
7710 !! test
7711 Template with default value
7712 !! input
7713 {{templateasargtestdefault}}
7714 !! result
7715 <p>(test)
7716 </p>
7717 !! end
7718
7719 !! test
7720 Template with default value (value set)
7721 !! input
7722 {{templateasargtestdefault|templ=templa}}
7723 !! result
7724 <p><b>templ</b>
7725 </p>
7726 !! end
7727
7728 !! test
7729 Template redirect
7730 !! input
7731 {{templateredirect}}
7732 !! result
7733 <p>(test)
7734 </p>
7735 !! end
7736
7737 !! test
7738 Template with argument in separate line
7739 !! input
7740 {{ templateasargtest |
7741 templ = simple }}
7742 !! result
7743 <p>(test)
7744 </p>
7745 !! end
7746
7747 !! test
7748 Template with complex template as argument
7749 !! input
7750 {{paramtest|
7751 param ={{ templateasargtest |
7752 templ = simple }}}}
7753 !! result
7754 <p>This is a test template with parameter (test)
7755 </p>
7756 !! end
7757
7758 !! test
7759 Template with thumb image (with link in description)
7760 !! input
7761 {{paramtest|
7762 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
7763 !! result
7764 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>
7765
7766 !! end
7767
7768 !! article
7769 Template:complextemplate
7770 !! text
7771 {{{1}}} {{paramtest|
7772 param ={{{param}}}}}
7773 !! endarticle
7774
7775 !! test
7776 Template with complex arguments
7777 !! input
7778 {{complextemplate|
7779 param ={{ templateasargtest |
7780 templ = simple }}|[[Template:complextemplate|link]]}}
7781 !! result
7782 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
7783 </p>
7784 !! end
7785
7786 !! test
7787 BUG 553: link with two variables in a piped link
7788 !! input
7789 {|
7790 |[[{{{1}}}|{{{2}}}]]
7791 |}
7792 !! result
7793 <table>
7794 <tr>
7795 <td>[[{{{1}}}|{{{2}}}]]
7796 </td></tr></table>
7797
7798 !! end
7799
7800 !! test
7801 Magic variable as template parameter
7802 !! input
7803 {{paramtest|param={{SITENAME}}}}
7804 !! result
7805 <p>This is a test template with parameter MediaWiki
7806 </p>
7807 !! end
7808
7809 !! article
7810 Template:linktest
7811 !! text
7812 [[{{{param}}}|link]]
7813 !! endarticle
7814
7815 !! test
7816 Template parameter as link source
7817 !! input
7818 {{linktest|param=Main Page}}
7819 !! result
7820 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
7821 </p>
7822 !! end
7823
7824 !!test
7825 Template-generated attribute string (k='v')
7826 !!input
7827 <span {{attr_str|id|v1}}>bar</span>
7828 !!result
7829 <p><span id="v1">bar</span>
7830 </p>
7831 !!end
7832
7833 !!article
7834 Template:paramtest2
7835 !! text
7836 including another template, {{paramtest|param={{{arg}}}}}
7837 !! endarticle
7838
7839 !! test
7840 Template passing argument to another template
7841 !! input
7842 {{paramtest2|arg='hmm'}}
7843 !! result
7844 <p>including another template, This is a test template with parameter 'hmm'
7845 </p>
7846 !! end
7847
7848 !! article
7849 Template:Linktest2
7850 !! text
7851 Main Page
7852 !! endarticle
7853
7854 !! test
7855 Template as link source
7856 !! input
7857 [[{{linktest2}}]]
7858
7859 [[{{linktest2}}|Main Page]]
7860
7861 [[{{linktest2}}]]Page
7862 !! result
7863 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7864 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7865 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
7866 </p>
7867 !! end
7868
7869
7870 !! article
7871 Template:loop1
7872 !! text
7873 {{loop2}}
7874 !! endarticle
7875
7876 !! article
7877 Template:loop2
7878 !! text
7879 {{loop1}}
7880 !! endarticle
7881
7882 !! test
7883 Template infinite loop
7884 !! input
7885 {{loop1}}
7886 !! result
7887 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
7888 </p>
7889 !! end
7890
7891 !! test
7892 Template from main namespace
7893 !! input
7894 {{:Main Page}}
7895 !! result
7896 <p>blah blah
7897 </p>
7898 !! end
7899
7900 !! article
7901 Template:table
7902 !! text
7903 {|
7904 | 1 || 2
7905 |-
7906 | 3 || 4
7907 |}
7908 !! endarticle
7909
7910 !! test
7911 BUG 529: Template with table, not included at beginning of line
7912 !! input
7913 foo {{table}}
7914 !! result
7915 <p>foo
7916 </p>
7917 <table>
7918 <tr>
7919 <td> 1 </td>
7920 <td> 2
7921 </td></tr>
7922 <tr>
7923 <td> 3 </td>
7924 <td> 4
7925 </td></tr></table>
7926
7927 !! end
7928
7929 !! test
7930 BUG 523: Template shouldn't eat newline (or add an extra one before table)
7931 !! input
7932 foo
7933 {{table}}
7934 !! result
7935 <p>foo
7936 </p>
7937 <table>
7938 <tr>
7939 <td> 1 </td>
7940 <td> 2
7941 </td></tr>
7942 <tr>
7943 <td> 3 </td>
7944 <td> 4
7945 </td></tr></table>
7946
7947 !! end
7948
7949 !! test
7950 BUG 41: Template parameters shown as broken links
7951 !! input
7952 {{{parameter}}}
7953 !! result
7954 <p>{{{parameter}}}
7955 </p>
7956 !! end
7957
7958 !! test
7959 Template with targets containing wikilinks
7960 !! input
7961 {{[[foo]]}}
7962
7963 {{[[{{echo|foo}}]]}}
7964
7965 {{{{echo|[[foo}}]]}}
7966 !! result
7967 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
7968 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
7969 </p><p>{{[[foo}}]]
7970 </p>
7971 !! end
7972
7973 !! article
7974 Template:MSGNW test
7975 !! text
7976 ''None'' of '''this''' should be
7977 * interpreted
7978 but rather passed unmodified
7979 {{test}}
7980 !! endarticle
7981
7982 # hmm, fix this or just deprecate msgnw and document its behavior?
7983 !! test
7984 msgnw keyword
7985 !! options
7986 disabled
7987 !! input
7988 {{msgnw:MSGNW test}}
7989 !! result
7990 <p>''None'' of '''this''' should be
7991 * interpreted
7992 but rather passed unmodified
7993 {{test}}
7994 </p>
7995 !! end
7996
7997 !! test
7998 int keyword
7999 !! input
8000 {{int:youhavenewmessages|lots of money|not!}}
8001 !! result
8002 <p>You have lots of money (not!).
8003 </p>
8004 !! end
8005
8006 !! article
8007 Template:Includes
8008 !! text
8009 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8010 !! endarticle
8011
8012 !! test
8013 <includeonly> and <noinclude> being included
8014 !! input
8015 {{Includes}}
8016 !! result
8017 <p>Foobar
8018 </p>
8019 !! end
8020
8021 !! article
8022 Template:Includes2
8023 !! text
8024 <onlyinclude>Foo</onlyinclude>bar
8025 !! endarticle
8026
8027 !! test
8028 <onlyinclude> being included
8029 !! input
8030 {{Includes2}}
8031 !! result
8032 <p>Foo
8033 </p>
8034 !! end
8035
8036
8037 !! article
8038 Template:Includes3
8039 !! text
8040 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
8041 !! endarticle
8042
8043 !! test
8044 <onlyinclude> and <includeonly> being included
8045 !! input
8046 {{Includes3}}
8047 !! result
8048 <p>Foo
8049 </p>
8050 !! end
8051
8052 !! test
8053 <includeonly> and <noinclude> on a page
8054 !! input
8055 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8056 !! result
8057 <p>Foozar
8058 </p>
8059 !! end
8060
8061 !! test
8062 Un-closed <noinclude>
8063 !! input
8064 <noinclude>
8065 !! result
8066 !! end
8067
8068 !! test
8069 <onlyinclude> on a page
8070 !! input
8071 <onlyinclude>Foo</onlyinclude>bar
8072 !! result
8073 <p>Foobar
8074 </p>
8075 !! end
8076
8077 !! test
8078 Un-closed <onlyinclude>
8079 !! input
8080 <onlyinclude>
8081 !! result
8082 !! end
8083
8084 !!test
8085 Self-closed noinclude, includeonly, onlyinclude tags
8086 !!input
8087 <noinclude />
8088 <includeonly />
8089 <onlyinclude />
8090 !!result
8091 <p><br />
8092 </p>
8093 !!end
8094
8095 !!test
8096 Unbalanced includeonly and noinclude tags
8097 !!input
8098 {|
8099 |a</noinclude>
8100 |b</noinclude></noinclude>
8101 |c</noinclude></includeonly>
8102 |d</includeonly></includeonly>
8103 |}
8104 !!result
8105 <table>
8106 <tr>
8107 <td>a
8108 </td>
8109 <td>b
8110 </td>
8111 <td>c&lt;/includeonly&gt;
8112 </td>
8113 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
8114 </td></tr></table>
8115
8116 !!end
8117
8118 !! article
8119 Template:Includeonly section
8120 !! text
8121 <includeonly>
8122 ==Includeonly section==
8123 </includeonly>
8124 ==Section T-1==
8125 !!endarticle
8126
8127 !! test
8128 Bug 6563: Edit link generation for section shown by <includeonly>
8129 !! input
8130 {{includeonly section}}
8131 !! result
8132 <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>
8133 <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>
8134
8135 !! end
8136
8137 # Uses same input as the contents of [[Template:Includeonly section]]
8138 !! test
8139 Bug 6563: Section extraction for section shown by <includeonly>
8140 !! options
8141 section=T-2
8142 !! input
8143 <includeonly>
8144 ==Includeonly section==
8145 </includeonly>
8146 ==Section T-2==
8147 !! result
8148 ==Section T-2==
8149 !! end
8150
8151 !! test
8152 Bug 6563: Edit link generation for section suppressed by <includeonly>
8153 !! input
8154 <includeonly>
8155 ==Includeonly section==
8156 </includeonly>
8157 ==Section 1==
8158 !! result
8159 <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>
8160
8161 !! end
8162
8163 !! test
8164 Bug 6563: Section extraction for section suppressed by <includeonly>
8165 !! options
8166 section=1
8167 !! input
8168 <includeonly>
8169 ==Includeonly section==
8170 </includeonly>
8171 ==Section 1==
8172 !! result
8173 ==Section 1==
8174 !! end
8175
8176 !! test
8177 Un-closed <includeonly>
8178 !! input
8179 <includeonly>
8180 !! result
8181 !! end
8182
8183 # TODO: test with DOM fragment reuse!
8184 !! test
8185 Parsoid: DOM fragment reuse
8186 !! options
8187 parsoid=wt2wt,wt2html
8188 !! input
8189 a{{echo|b<table></table>c}}d
8190
8191 a{{echo|b
8192 <table></table>
8193 c}}d
8194
8195 {{echo|a
8196
8197 <table></table>
8198
8199 b}}
8200 !! result
8201 a<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b
8202 <table></table>c"}},"i":0}}]}'>b</span>
8203 <table about="#mwt1"></table><span about="#mwt1">c</span>d
8204
8205
8206 <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">
8207 </span>
8208 <table about="#mwt2"></table><span about="#mwt2">
8209 </span>
8210 <p about="#mwt2">cd</p>
8211
8212
8213 <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">
8214
8215 </span>
8216 <table about="#mwt3"></table><span about="#mwt3">
8217
8218 </span>
8219 <p about="#mwt3">b</p>
8220 !! end
8221
8222 !! test
8223 Parsoid: Merge double tds (bug 50603)
8224 !! options
8225 parsoid
8226 !! input
8227 {|
8228 |{{echo|{{!}} foo}}
8229 |}
8230 !! result
8231 <table><tbody>
8232 <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>
8233 </tbody></table>
8234 !! end
8235
8236 !! test
8237 Parsoid: Merge double tds in nested transclusion content (bug 50603)
8238 !! options
8239 parsoid
8240 !! input
8241 {{echo|<div>}}
8242 {|
8243 |{{echo|{{!}} foo}}
8244 |}
8245 {{echo|</div>}}
8246 !! result
8247 <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}}]}'>
8248 <table><tbody>
8249 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
8250 </tbody></table>
8251 </div>
8252 !! end
8253
8254 ###
8255 ### <includeonly> and <noinclude> in attributes
8256 ###
8257 !!test
8258 0. includeonly around the entire attribute
8259 !!input
8260 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
8261 !!result
8262 <p><span id="v2">bar</span>
8263 </p>
8264 !!end
8265
8266 !!test
8267 1. includeonly in html attr key
8268 !!input
8269 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
8270 !!result
8271 <p><span id="foo">bar</span>
8272 </p>
8273 !!end
8274
8275 !!test
8276 2. includeonly in html attr value
8277 !!input
8278 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
8279 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
8280 !!result
8281 <p><span id="v1">bar</span>
8282 <span id="v1">bar</span>
8283 </p>
8284 !!end
8285
8286 !!test
8287 3. includeonly in part of an attr value
8288 !!input
8289 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
8290 !!result
8291 <p><span style="color:red;">bar</span>
8292 </p>
8293 !!end
8294
8295 !!test
8296 4. includeonly in table attributes
8297 !!input
8298 {|
8299 |- <noinclude>
8300 |-
8301 |a
8302 </noinclude>
8303 |- <includeonly>
8304 |-
8305 |b
8306 </includeonly>
8307 |}
8308 !!result
8309 <table>
8310
8311
8312 <tr>
8313 <td>a
8314 </td></tr>
8315 </table>
8316
8317 !!end
8318
8319 ###
8320 ### Testing parsing of templates where a template arg
8321 ### has the same name as the template itself.
8322 ###
8323
8324 !! article
8325 Template:quote
8326 !! text
8327 {{{quote|{{{1}}}}}}
8328 !! endarticle
8329
8330 !!test
8331 Templates: Template Name/Arg clash: 1. Use of positional param
8332 !!input
8333 {{quote|foo}}
8334 !!result
8335 <p>foo
8336 </p>
8337 !!end
8338
8339 !!test
8340 Templates: Template Name/Arg clash: 2. Use of named param
8341 !!input
8342 {{quote|quote=foo}}
8343 !!result
8344 <p>foo
8345 </p>
8346 !!end
8347
8348 !!test
8349 Templates: Template Name/Arg clash: 3. Use of named param with empty input
8350 !!input
8351 {{quote|quote}}
8352 !!result
8353 <p>quote
8354 </p>
8355 !!end
8356
8357 ###
8358 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
8359 ###
8360
8361 !!test
8362 Templates: 1. Simple use
8363 !!input
8364 {{echo|Foo}}
8365 !!result
8366 <p>Foo
8367 </p>
8368 !!end
8369
8370 !!test
8371 Templates: 2. Inside a block tag
8372 !!input
8373 <div>{{echo|Foo}}</div>
8374 <blockquote>{{echo|Foo}}</blockquote>
8375 !!result
8376 <div>Foo</div>
8377 <blockquote>Foo</blockquote>
8378
8379 !!end
8380
8381 !!test
8382 Templates: P-wrapping: 1a. Templates on consecutive lines
8383 !!input
8384 {{echo|Foo}}
8385 {{echo|bar}}
8386 !!result
8387 <p>Foo
8388 bar
8389 </p>
8390 !!end
8391
8392 !!test
8393 Templates: P-wrapping: 1b. Templates on consecutive lines
8394 !!input
8395 Foo
8396
8397 {{echo|bar}}
8398 {{echo|baz}}
8399 !!result
8400 <p>Foo
8401 </p><p>bar
8402 baz
8403 </p>
8404 !!end
8405
8406 !!test
8407 Templates: P-wrapping: 1c. Templates on consecutive lines
8408 !!input
8409 {{echo|Foo}}
8410 {{echo|bar}} <div>baz</div>
8411 !!result
8412 <p>Foo
8413 </p>
8414 bar <div>baz</div>
8415
8416 !!end
8417
8418 !!test
8419 Templates: P-wrapping: 1d. Template preceded by comment-only line
8420 !!options
8421 parsoid
8422 !!input
8423 <!-- foo -->
8424 {{echo|Bar}}
8425 !!result
8426 <!-- foo -->
8427
8428 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
8429 !!end
8430
8431 !!test
8432 Templates: Inline Text: 1. Multiple tmeplate uses
8433 !!input
8434 {{echo|Foo}}bar{{echo|baz}}
8435 !!result
8436 <p>Foobarbaz
8437 </p>
8438 !!end
8439
8440 !!test
8441 Templates: Inline Text: 2. Back-to-back template uses
8442 !!input
8443 {{echo|Foo}}{{echo|bar}}
8444 !!result
8445 <p>Foobar
8446 </p>
8447 !!end
8448
8449 !!test
8450 Templates: Block Tags: 1. Multiple template uses
8451 !!input
8452 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
8453 !!result
8454 <div>Foo</div><div>bar</div><div>baz</div>
8455
8456 !!end
8457
8458 !!test
8459 Templates: Block Tags: 2. Back-to-back template uses
8460 !!input
8461 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
8462 !!result
8463 <div>Foo</div><div>bar</div>
8464
8465 !!end
8466
8467 !!test
8468 Templates: Links: 1. Simple example
8469 !!input
8470 {{echo|[[Foo|bar]]}}
8471 !!result
8472 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8473 </p>
8474 !!end
8475
8476 !!test
8477 Templates: Links: 2. Generation of link href
8478 !!input
8479 [[{{echo|Foo}}|bar]]
8480 !!result
8481 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8482 </p>
8483 !!end
8484
8485 !!test
8486 Templates: Links: 3. Generation of part of a link href
8487 !!input
8488 [[Fo{{echo|o}}|bar]]
8489
8490 [[Foo{{echo|bar}}]]
8491
8492 [[Foo{{echo|bar}}baz]]
8493
8494 [[Foo{{echo|bar}}|bar]]
8495
8496 [[:Foo{{echo|bar}}]]
8497
8498 [[:Foo{{echo|bar}}|bar]]
8499 !!result
8500 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8501 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8502 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
8503 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
8504 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8505 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
8506 </p>
8507 !!end
8508
8509 !!test
8510 Templates: Links: 4. Multiple templates generating link href
8511 !!input
8512 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
8513 !!result
8514 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8515 </p>
8516 !!end
8517
8518 !!test
8519 Templates: Links: 5. Generation of link text
8520 !!input
8521 [[Foo|{{echo|bar}}]]
8522 !!result
8523 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8524 </p>
8525 !!end
8526
8527 !!test
8528 Templates: Links: 5. Nested templates (only outermost template should be marked)
8529 !!input
8530 {{echo|[[{{echo|Foo}}|bar]]}}
8531 !!result
8532 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8533 </p>
8534 !!end
8535
8536 !!test
8537 Templates: HTML Tag: 1. Generation of HTML attr. key
8538 !!input
8539 <div {{echo|style}}="color:red;">foo</div>
8540 !!result
8541 <div style="color:red;">foo</div>
8542
8543 !!end
8544
8545 !!test
8546 Templates: HTML Tag: 2. Generation of HTML attr. value
8547 !!input
8548 <div style={{echo|'color:red;'}}>foo</div>
8549 !!result
8550 <div style="color:red;">foo</div>
8551
8552 !!end
8553
8554 !!test
8555 Templates: HTML Tag: 3. Generation of HTML attr key and value
8556 !!input
8557 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
8558 !!result
8559 <div style="color:red;">foo</div>
8560
8561 !!end
8562
8563 !!test
8564 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
8565 !!input
8566 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
8567 !!result
8568 <div title="This is a long title with just one piece templated">foo</div>
8569
8570 !!end
8571
8572 !!test
8573 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
8574 !!input
8575 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
8576 !!result
8577 <div title="This is a long title with just one piece templated">foo</div>
8578
8579 !!end
8580
8581 !!test
8582 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
8583 !!input
8584 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
8585 !!result
8586 <div title="This is a long title with just one piece templated">foo</div>
8587
8588 !!end
8589
8590 !!test
8591 Templates: HTML Tag: 7. Generation of partial attribute key string
8592 !!input
8593 <div st{{echo|yle}}="color:red;">foo</div>
8594 !!result
8595 <div style="color:red;">foo</div>
8596
8597 !!end
8598
8599 !!test
8600 Templates: HTML Tables: 1. Generating start of a HTML table
8601 !!input
8602 {{echo|<table><tr><td>foo</td>}}</tr></table>
8603 !!result
8604 <table><tr><td>foo</td></tr></table>
8605
8606 !!end
8607
8608 !!test
8609 Templates: HTML Tables: 2a. Generating middle of a HTML table
8610 !!input
8611 <table><tr>{{echo|<td>foo</td>}}</tr></table>
8612 !!result
8613 <table><tr><td>foo</td></tr></table>
8614
8615 !!end
8616
8617 !!test
8618 Templates: HTML Tables: 2b. Generating middle of a HTML table
8619 !!input
8620 <table>{{echo|<tr><td>foo</td></tr>}}</table>
8621 !!result
8622 <table><tr><td>foo</td></tr></table>
8623
8624 !!end
8625
8626 !!test
8627 Templates: HTML Tables: 3. Generating end of a HTML table
8628 !!input
8629 <table><tr>{{echo|<td>foo</td></tr></table>}}
8630 !!result
8631 <table><tr><td>foo</td></tr></table>
8632
8633 !!end
8634
8635 !!test
8636 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
8637 !!input
8638 {{echo|<table>}}<tr><td>foo</td></tr></table>
8639 !!result
8640 <table><tr><td>foo</td></tr></table>
8641
8642 !!end
8643
8644 !!test
8645 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
8646 !!input
8647 <table>{{echo|<tr>}}<td>foo</td></tr></table>
8648 !!result
8649 <table><tr><td>foo</td></tr></table>
8650
8651 !!end
8652
8653 !!test
8654 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
8655 !!input
8656 <table><tr>{{echo|<td>}}foo</td></tr></table>
8657 !!result
8658 <table><tr><td>foo</td></tr></table>
8659
8660 !!end
8661
8662 !!test
8663 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
8664 !!input
8665 <table><tr><td>foo{{echo|</td>}}</tr></table>
8666 !!result
8667 <table><tr><td>foo</td></tr></table>
8668
8669 !!end
8670
8671 !!test
8672 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
8673 !!input
8674 <table><tr><td>foo</td>{{echo|</tr>}}</table>
8675 !!result
8676 <table><tr><td>foo</td></tr></table>
8677
8678 !!end
8679
8680 !!test
8681 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
8682 !!input
8683 <table><tr><td>foo</td></tr>{{echo|</table>}}
8684 !!result
8685 <table><tr><td>foo</td></tr></table>
8686
8687 !!end
8688
8689 !!test
8690 Templates: HTML Tables: 5. Proper fostering of categories from inside
8691 !!options
8692 parsoid=wt2html,wt2wt
8693 !!input
8694 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
8695 <!--Two categories (Bug 50330)-->
8696 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
8697 !!result
8698 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
8699 <!--Two categories (Bug 50330)-->
8700 <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>
8701 !!end
8702
8703 !!test
8704 Templates: Wiki Tables: 1a. Fostering of entire template content
8705 !!input
8706 {|
8707 {{echo|a}}
8708 |}
8709 !!result
8710 <table>
8711 a
8712 <tr><td></td></tr></table>
8713
8714 !!end
8715
8716 !!test
8717 Templates: Wiki Tables: 1b. Fostering of entire template content
8718 !!input
8719 {|
8720 {{echo|<div>}}
8721 foo
8722 {{echo|</div>}}
8723 |}
8724 !!result
8725 <table>
8726 <div>
8727 <p>foo
8728 </p>
8729 </div>
8730 <tr><td></td></tr></table>
8731
8732 !!end
8733
8734 !!test
8735 Templates: Wiki Tables: 2. Fostering of partial template content
8736 !!input
8737 {|
8738 {{echo|a
8739 <div>b</div>}}
8740 |}
8741 !!result
8742 <table>
8743 a
8744 <div>b</div>
8745 <tr><td></td></tr></table>
8746
8747 !!end
8748
8749 !!test
8750 Templates: Wiki Tables: 3. td-content via multiple templates
8751 !!input
8752 {|
8753 {{echo|{{pipe}}a}}{{echo|b}}
8754 |}
8755 !!result
8756 <table>
8757 <tr>
8758 <td>ab
8759 </td></tr></table>
8760
8761 !!end
8762
8763 !!test
8764 Templates: Wiki Tables: 4. Templated tags, no content
8765 !!input
8766 {{tbl-start}}
8767 {{tbl-end}}
8768 !!result
8769 <table>
8770 <tr><td></td></tr></table>
8771
8772 !!end
8773
8774 !!test
8775 Templates: Wiki Tables: 5. Templated tags, regular td-tags
8776 !!input
8777 {{tbl-start}}
8778 |foo
8779 {{tbl-end}}
8780 !!result
8781 <table>
8782 <tr>
8783 <td>foo
8784 </td></tr></table>
8785
8786 !!end
8787
8788 !!test
8789 Templates: Wiki Tables: 6. Templated tags, templated td-tags
8790 !!input
8791 {{tbl-start}}
8792 {{!}}foo
8793 {{tbl-end}}
8794 !!result
8795 <table>
8796 <tr>
8797 <td>foo
8798 </td></tr></table>
8799
8800 !!end
8801
8802 !!test
8803 Templates: Lists: Multi-line list-items via templates
8804 !!input
8805 *{{echo|a {{nonexistent|
8806 unused}}}}
8807 *{{echo|b {{nonexistent|
8808 unused}}}}
8809 !!result
8810 <ul>
8811 <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>
8812 </li>
8813 <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>
8814 </li>
8815 </ul>
8816
8817 !!end
8818
8819 !!test
8820 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
8821 !!input
8822 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
8823 !!result
8824 <p><i>ab</i>c<i>d</i>e
8825 </p>
8826 !!end
8827
8828 !!test
8829 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
8830 (PHP parser generates misnested html)
8831 !! options
8832 parsoid
8833 !!input
8834 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
8835 !!result
8836 <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>
8837 !!end
8838
8839 !!test
8840 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
8841 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
8842 !! options
8843 parsoid=wt2html,wt2wt
8844 !!input
8845 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
8846 !!result
8847 <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>
8848 <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>
8849 <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>
8850 !!end
8851
8852 !!test
8853 Templates: Ugly nesting: 4. Divs opened/closed across templates
8854 !!input
8855 a<div>b{{echo|c</div>d}}e
8856 !!result
8857 a<div>bc</div>de
8858
8859 !!end
8860
8861 !!test
8862 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
8863 (Parsoid-centric)
8864 !! options
8865 parsoid
8866 !!input
8867 {|
8868 |{{echo|foo</table>}}
8869 |bar
8870 |}
8871 !!result
8872 <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|}"]}'>
8873
8874 <tbody>
8875 <tr>
8876 <td>foo</td></tr></tbody></table><span about="#mwt1">
8877 </span><span about="#mwt1">bar</span><span about="#mwt1">
8878 </span>
8879 !!end
8880
8881 !!test
8882 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
8883 (Parsoid-centric)
8884 !! options
8885 parsoid
8886 !!input
8887 <table>
8888 <tr>
8889 <td>
8890 <table>
8891 <tr>
8892 <td>1. {{echo|foo </table>}}</td>
8893 <td> bar </td>
8894 <td>2. {{echo|baz </table>}}</td>
8895 </tr>
8896 <tr>
8897 <td>abc</td>
8898 </tr>
8899 </table>
8900 </td>
8901 </tr>
8902 <tr>
8903 <td>xyz</td>
8904 </tr>
8905 </table>
8906 !!result
8907 <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>"]}'>
8908 <tbody><tr>
8909 <td>
8910 <table>
8911 <tbody><tr>
8912 <td>1. foo </td></tr></tbody></table></td>
8913 <td> bar </td>
8914 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
8915 </span><span about="#mwt2">
8916 </span><span about="#mwt2">
8917 </span><span about="#mwt2">abc</span><span about="#mwt2">
8918 </span><span about="#mwt2">
8919 </span><span about="#mwt2">
8920 </span><span about="#mwt2">
8921 </span><span about="#mwt2">
8922 </span><span about="#mwt2">
8923 </span><span about="#mwt2">xyz</span><span about="#mwt2">
8924 </span><span about="#mwt2">
8925 </span>
8926 !!end
8927
8928 !! test
8929 Templates: Ugly templates: 3. newline-only template parameter
8930 !! input
8931 foo {{echo|
8932 }}
8933 !! result
8934 <p>foo
8935 </p>
8936 !! end
8937
8938 # This looks like a bug: a single newline triggers p/br for some reason.
8939 !! test
8940 Templates: Ugly templates: 4. newline-only template parameter inconsistency
8941 !! input
8942 {{echo|
8943 }}
8944 !! result
8945 <p><br />
8946 </p>
8947 !! end
8948
8949
8950 !!test
8951 Parser Functions: 1. Simple example
8952 !!input
8953 {{uc:foo}}
8954 !!result
8955 <p>FOO
8956 </p>
8957 !!end
8958
8959 !!test
8960 Parser Functions: 2. Nested use (only outermost should be marked up)
8961 !!input
8962 {{uc:{{lc:FOO}}}}
8963 !!result
8964 <p>FOO
8965 </p>
8966 !!end
8967
8968 ###
8969 ### Pre-save transform tests
8970 ###
8971 !! test
8972 pre-save transform: subst:
8973 !! options
8974 PST
8975 !! input
8976 {{subst:test}}
8977 !! result
8978 This is a test template
8979 !! end
8980
8981 !! test
8982 pre-save transform: normal template
8983 !! options
8984 PST
8985 !! input
8986 {{test}}
8987 !! result
8988 {{test}}
8989 !! end
8990
8991 !! test
8992 pre-save transform: nonexistent template
8993 !! options
8994 PST
8995 !! input
8996 {{thistemplatedoesnotexist}}
8997 !! result
8998 {{thistemplatedoesnotexist}}
8999 !! end
9000
9001
9002 !! test
9003 pre-save transform: subst magic variables
9004 !! options
9005 PST
9006 !! input
9007 {{subst:SITENAME}}
9008 !! result
9009 MediaWiki
9010 !! end
9011
9012 # This is bug 89, which I fixed. -- wtm
9013 !! test
9014 pre-save transform: subst: templates with parameters
9015 !! options
9016 pst
9017 !! input
9018 {{subst:paramtest|param="something else"}}
9019 !! result
9020 This is a test template with parameter "something else"
9021 !! end
9022
9023 !! article
9024 Template:nowikitest
9025 !! text
9026 <nowiki>'''not wiki'''</nowiki>
9027 !! endarticle
9028
9029 !! test
9030 pre-save transform: nowiki in subst (bug 1188)
9031 !! options
9032 pst
9033 !! input
9034 {{subst:nowikitest}}
9035 !! result
9036 <nowiki>'''not wiki'''</nowiki>
9037 !! end
9038
9039
9040 !! article
9041 Template:commenttest
9042 !! text
9043 This template has <!-- a comment --> in it.
9044 !! endarticle
9045
9046 !! test
9047 pre-save transform: comment in subst (bug 1936)
9048 !! options
9049 pst
9050 !! input
9051 {{subst:commenttest}}
9052 !! result
9053 This template has <!-- a comment --> in it.
9054 !! end
9055
9056 !! test
9057 pre-save transform: unclosed tag
9058 !! options
9059 pst noxml
9060 !! input
9061 <nowiki>'''not wiki'''
9062 !! result
9063 <nowiki>'''not wiki'''
9064 !! end
9065
9066 !! test
9067 pre-save transform: mixed tag case
9068 !! options
9069 pst noxml
9070 !! input
9071 <NOwiki>'''not wiki'''</noWIKI>
9072 !! result
9073 <NOwiki>'''not wiki'''</noWIKI>
9074 !! end
9075
9076 !! test
9077 pre-save transform: unclosed comment in <nowiki>
9078 !! options
9079 pst noxml
9080 !! input
9081 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9082 !! result
9083 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9084 !!end
9085
9086 # Leading @ in this template definition works around a limitation
9087 # in parsoid's parserTests which otherwise strips the <span> from the
9088 # result (confusing it for a template wrapper)
9089 !! article
9090 Template:dangerous
9091 !!text
9092 @<span onmouseover="alert('crap')">Oh no</span>
9093 !!endarticle
9094
9095 !!test
9096 (confirming safety of fix for subst bug 1936)
9097 !! input
9098 {{Template:dangerous}}
9099 !! result
9100 <p>@<span>Oh no</span>
9101 </p>
9102 !! end
9103
9104 !! test
9105 pre-save transform: comment containing gallery (bug 5024)
9106 !! options
9107 pst
9108 !! input
9109 <!-- <gallery>data</gallery> -->
9110 !!result
9111 <!-- <gallery>data</gallery> -->
9112 !!end
9113
9114 !! test
9115 pre-save transform: comment containing extension
9116 !! options
9117 pst
9118 !! input
9119 <!-- <tag>data</tag> -->
9120 !!result
9121 <!-- <tag>data</tag> -->
9122 !!end
9123
9124 !! test
9125 pre-save transform: comment containing nowiki
9126 !! options
9127 pst
9128 !! input
9129 <!-- <nowiki>data</nowiki> -->
9130 !!result
9131 <!-- <nowiki>data</nowiki> -->
9132 !!end
9133
9134 !! test
9135 pre-save transform: <noinclude> in subst (bug 3298)
9136 !! options
9137 pst
9138 !! input
9139 {{subst:Includes}}
9140 !! result
9141 Foobar
9142 !! end
9143
9144 !! test
9145 pre-save transform: <onlyinclude> in subst (bug 3298)
9146 !! options
9147 pst
9148 !! input
9149 {{subst:Includes2}}
9150 !! result
9151 Foo
9152 !! end
9153
9154 !! article
9155 Template:SubstTest
9156 !!text
9157 {{<includeonly>subst:</includeonly>Includes}}
9158 !! endarticle
9159
9160 !! article
9161 Template:SafeSubstTest
9162 !! text
9163 {{<includeonly>safesubst:</includeonly>Includes}}
9164 !! endarticle
9165
9166 !! test
9167 bug 22297: safesubst: works during PST
9168 !! options
9169 pst
9170 !! input
9171 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
9172 !! result
9173 FoobarFoobar
9174 !! end
9175
9176 !! test
9177 bug 22297: safesubst: works during normal parse
9178 !! input
9179 {{SafeSubstTest}}
9180 !! result
9181 <p>Foobar
9182 </p>
9183 !! end
9184
9185 !! test:
9186 subst: does not work during normal parse
9187 !! input
9188 {{SubstTest}}
9189 !! result
9190 <p>{{subst:Includes}}
9191 </p>
9192 !! end
9193
9194 !! test
9195 pre-save transform: context links ("pipe trick")
9196 !! options
9197 pst
9198 !! input
9199 [[Article (context)|]]
9200 [[Bar:Article|]]
9201 [[:Bar:Article|]]
9202 [[Bar:Article (context)|]]
9203 [[:Bar:Article (context)|]]
9204 [[|Article]]
9205 [[|Article (context)]]
9206 [[Bar:X (Y) Z|]]
9207 [[:Bar:X (Y) Z|]]
9208 !! result
9209 [[Article (context)|Article]]
9210 [[Bar:Article|Article]]
9211 [[:Bar:Article|Article]]
9212 [[Bar:Article (context)|Article]]
9213 [[:Bar:Article (context)|Article]]
9214 [[Article]]
9215 [[Article (context)]]
9216 [[Bar:X (Y) Z|X (Y) Z]]
9217 [[:Bar:X (Y) Z|X (Y) Z]]
9218 !! end
9219
9220 !! test
9221 pre-save transform: context links ("pipe trick") with interwiki prefix
9222 !! options
9223 pst
9224 !! input
9225 [[interwiki:Article|]]
9226 [[:interwiki:Article|]]
9227 [[interwiki:Bar:Article|]]
9228 [[:interwiki:Bar:Article|]]
9229 !! result
9230 [[interwiki:Article|Article]]
9231 [[:interwiki:Article|Article]]
9232 [[interwiki:Bar:Article|Bar:Article]]
9233 [[:interwiki:Bar:Article|Bar:Article]]
9234 !! end
9235
9236 !! test
9237 pre-save transform: context links ("pipe trick") with parens in title
9238 !! options
9239 pst title=[[Somearticle (context)]]
9240 !! input
9241 [[|Article]]
9242 !! result
9243 [[Article (context)|Article]]
9244 !! end
9245
9246 !! test
9247 pre-save transform: context links ("pipe trick") with comma in title
9248 !! options
9249 pst title=[[Someplace, Somewhere]]
9250 !! input
9251 [[|Otherplace]]
9252 [[Otherplace, Elsewhere|]]
9253 [[Otherplace, Elsewhere, Anywhere|]]
9254 !! result
9255 [[Otherplace, Somewhere|Otherplace]]
9256 [[Otherplace, Elsewhere|Otherplace]]
9257 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
9258 !! end
9259
9260 !! test
9261 pre-save transform: context links ("pipe trick") with parens and comma
9262 !! options
9263 pst title=[[Someplace (IGNORED), Somewhere]]
9264 !! input
9265 [[|Otherplace]]
9266 [[Otherplace (place), Elsewhere|]]
9267 !! result
9268 [[Otherplace, Somewhere|Otherplace]]
9269 [[Otherplace (place), Elsewhere|Otherplace]]
9270 !! end
9271
9272 !! test
9273 pre-save transform: context links ("pipe trick") with comma and parens
9274 !! options
9275 pst title=[[Who, me? (context)]]
9276 !! input
9277 [[|Yes, you.]]
9278 [[Me, Myself, and I (1937 song)|]]
9279 !! result
9280 [[Yes, you. (context)|Yes, you.]]
9281 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
9282 !! end
9283
9284 !! test
9285 pre-save transform: context links ("pipe trick") with namespace
9286 !! options
9287 pst title=[[Ns:Somearticle]]
9288 !! input
9289 [[|Article]]
9290 !! result
9291 [[Ns:Article|Article]]
9292 !! end
9293
9294 !! test
9295 pre-save transform: context links ("pipe trick") with namespace and parens
9296 !! options
9297 pst title=[[Ns:Somearticle (context)]]
9298 !! input
9299 [[|Article]]
9300 !! result
9301 [[Ns:Article (context)|Article]]
9302 !! end
9303
9304 !! test
9305 pre-save transform: context links ("pipe trick") with namespace and comma
9306 !! options
9307 pst title=[[Ns:Somearticle, Context, Whatever]]
9308 !! input
9309 [[|Article]]
9310 !! result
9311 [[Ns:Article, Context, Whatever|Article]]
9312 !! end
9313
9314 !! test
9315 pre-save transform: context links ("pipe trick") with namespace, comma and parens
9316 !! options
9317 pst title=[[Ns:Somearticle, Context (context)]]
9318 !! input
9319 [[|Article]]
9320 !! result
9321 [[Ns:Article (context)|Article]]
9322 !! end
9323
9324 !! test
9325 pre-save transform: context links ("pipe trick") with namespace, parens and comma
9326 !! options
9327 pst title=[[Ns:Somearticle (IGNORED), Context]]
9328 !! input
9329 [[|Article]]
9330 !! result
9331 [[Ns:Article, Context|Article]]
9332 !! end
9333
9334 !! test
9335 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
9336 !! options
9337 pst
9338 !! input
9339 [[Article(context)|]]
9340 [[Bar:Article(context)|]]
9341 [[:Bar:Article(context)|]]
9342 [[|Article(context)]]
9343 [[Bar:X(Y)Z|]]
9344 [[:Bar:X(Y)Z|]]
9345 !! result
9346 [[Article(context)|Article]]
9347 [[Bar:Article(context)|Article]]
9348 [[:Bar:Article(context)|Article]]
9349 [[Article(context)]]
9350 [[Bar:X(Y)Z|X(Y)Z]]
9351 [[:Bar:X(Y)Z|X(Y)Z]]
9352 !! end
9353
9354 !! test
9355 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
9356 !! options
9357 pst
9358 !! input
9359 [[Article (context)|]]
9360 [[Bar:Article (context)|]]
9361 [[:Bar:Article (context)|]]
9362 [[|Article (context)]]
9363 [[Bar:X (Y) Z|]]
9364 [[:Bar:X (Y) Z|]]
9365 !! result
9366 [[Article (context)|Article]]
9367 [[Bar:Article (context)|Article]]
9368 [[:Bar:Article (context)|Article]]
9369 [[Article (context)]]
9370 [[Bar:X (Y) Z|X (Y) Z]]
9371 [[:Bar:X (Y) Z|X (Y) Z]]
9372 !! end
9373
9374 !! test
9375 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
9376 !! options
9377 pst
9378 !! input
9379 [[Article(context)|]]
9380 [[Bar:Article(context)|]]
9381 [[:Bar:Article(context)|]]
9382 [[|Article(context)]]
9383 [[Bar:X(Y)Z|]]
9384 [[:Bar:X(Y)Z|]]
9385 !! result
9386 [[Article(context)|Article]]
9387 [[Bar:Article(context)|Article]]
9388 [[:Bar:Article(context)|Article]]
9389 [[Article(context)]]
9390 [[Bar:X(Y)Z|X(Y)Z]]
9391 [[:Bar:X(Y)Z|X(Y)Z]]
9392 !! end
9393
9394 !! test
9395 pre-save transform: context links ("pipe trick") with commas (bug 21660)
9396 !! options
9397 pst
9398 !! input
9399 [[Article (context), context|]]
9400 [[Article (context),context|]]
9401 [[Bar:Article (context), context|]]
9402 [[Bar:Article (context),context|]]
9403 [[:Bar:Article (context), context|]]
9404 [[:Bar:Article (context),context|]]
9405 !! result
9406 [[Article (context), context|Article]]
9407 [[Article (context),context|Article]]
9408 [[Bar:Article (context), context|Article]]
9409 [[Bar:Article (context),context|Article]]
9410 [[:Bar:Article (context), context|Article]]
9411 [[:Bar:Article (context),context|Article]]
9412 !! end
9413
9414 !! test
9415 pre-save transform: trim trailing empty lines
9416 !! options
9417 pst
9418 !! input
9419 Empty lines are trimmed
9420
9421
9422
9423
9424 !! result
9425 Empty lines are trimmed
9426 !! end
9427
9428 !! test
9429 pre-save transform: Signature expansion
9430 !! options
9431 pst
9432 !! input
9433 * ~~~
9434 * <noinclude>~~~</noinclude>
9435 * <includeonly>~~~</includeonly>
9436 * <onlyinclude>~~~</onlyinclude>
9437 !! result
9438 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
9439 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
9440 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
9441 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
9442 !! end
9443
9444
9445 !! test
9446 pre-save transform: Signature expansion in nowiki tags (bug 93)
9447 !! options
9448 pst disabled
9449 !! input
9450 Shall not expand:
9451
9452 <nowiki>~~~~</nowiki>
9453
9454 <includeonly><nowiki>~~~~</nowiki></includeonly>
9455
9456 <noinclude><nowiki>~~~~</nowiki></noinclude>
9457
9458 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
9459
9460 {{subst:Foo}} shall be converted to FOO
9461
9462 As well as inside noinclude/onlyinclude
9463 <noinclude>{{subst:Foo}}</noinclude>
9464 <onlyinclude>{{subst:Foo}}</onlyinclude>
9465
9466 But not inside includeonly
9467 <includeonly>{{subst:Foo}}</includeonly>
9468 !! result
9469 Shall not expand:
9470
9471 <nowiki>~~~~</nowiki>
9472
9473 <includeonly><nowiki>~~~~</nowiki></includeonly>
9474
9475 <noinclude><nowiki>~~~~</nowiki></noinclude>
9476
9477 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
9478
9479 FOO shall be converted to FOO
9480
9481 As well as inside noinclude/onlyinclude
9482 <noinclude>FOO</noinclude>
9483 <onlyinclude>FOO</onlyinclude>
9484
9485 But not inside includeonly
9486 <includeonly>{{subst:Foo}}</includeonly>
9487 !! end
9488
9489 !! test
9490 Parsoid: Recognize nowiki with trailing space in tags
9491 !! options
9492 parsoid=wt2html
9493 !! input
9494 <nowiki ><div>[[foo]]</nowiki >
9495
9496 a<nowiki / >b
9497
9498 c<nowiki />d
9499
9500 e<nowiki/ >f
9501 !! result
9502 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
9503 <p>ab</p>
9504 <p>cd</p>
9505 <p>ef</p>
9506 !! end
9507
9508 !! test
9509 Parsoid: Recognize nowiki with odd capitalization
9510 !! options
9511 parsoid=wt2html
9512 !! input
9513 <noWikI ><div>[[foo]]</Nowiki >
9514 !! result
9515 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
9516 !! end
9517
9518
9519 !! test
9520 Parsoid: Escape nowiki with trailing space in tags
9521 !! options
9522 parsoid=html2wt
9523 !! input
9524 &lt;nowiki &gt; foo &lt;/nowiki &gt;
9525
9526 a&lt;nowiki /&gt;b
9527
9528 c&lt;nowiki/ &gt;d
9529 !! result
9530 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
9531 <p>a&lt;nowiki /&gt;b</p>
9532 <p>c&lt;nowiki/ &gt;d</p>
9533 !! end
9534
9535 !! test
9536 Parsoid: Escape weird noWikI capitalizations
9537 !! options
9538 parsoid=html2wt
9539 !! input
9540 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
9541 !! result
9542 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
9543 !! end
9544
9545 ###
9546 ### Message transform tests
9547 ###
9548 !! test
9549 message transform: magic variables
9550 !! options
9551 msg
9552 !! input
9553 {{SITENAME}}
9554 !! result
9555 MediaWiki
9556 !! end
9557
9558 !! test
9559 message transform: should not transform wiki markup
9560 !! options
9561 msg
9562 !! input
9563 ''test''
9564 !! result
9565 ''test''
9566 !! end
9567
9568 !! test
9569 message transform: <noinclude> in transcluded template (bug 4926)
9570 !! options
9571 msg
9572 !! input
9573 {{Includes}}
9574 !! result
9575 Foobar
9576 !! end
9577
9578 !! test
9579 message transform: <onlyinclude> in transcluded template (bug 4926)
9580 !! options
9581 msg
9582 !! input
9583 {{Includes2}}
9584 !! result
9585 Foo
9586 !! end
9587
9588 !! test
9589 {{#special:}} page name, known
9590 !! options
9591 msg
9592 !! input
9593 {{#special:Recentchanges}}
9594 !! result
9595 Special:RecentChanges
9596 !! end
9597
9598 !! test
9599 {{#special:}} page name with subpage, known
9600 !! options
9601 msg
9602 !! input
9603 {{#special:Recentchanges/param}}
9604 !! result
9605 Special:RecentChanges/param
9606 !! end
9607
9608 !! test
9609 {{#special:}} page name, unknown
9610 !! options
9611 msg
9612 !! input
9613 {{#special:foobar nonexistent}}
9614 !! result
9615 Special:Foobar nonexistent
9616 !! end
9617
9618 !! test
9619 {{#speciale:}} page name, known
9620 !! options
9621 msg
9622 !! input
9623 {{#speciale:Recentchanges}}
9624 !! result
9625 Special:RecentChanges
9626 !! end
9627
9628 !! test
9629 {{#speciale:}} page name with subpage, known
9630 !! options
9631 msg
9632 !! input
9633 {{#speciale:Recentchanges/param}}
9634 !! result
9635 Special:RecentChanges/param
9636 !! end
9637
9638 !! test
9639 {{#speciale:}} page name, unknown
9640 !! options
9641 msg
9642 !! input
9643 {{#speciale:foobar nonexistent}}
9644 !! result
9645 Special:Foobar_nonexistent
9646 !! end
9647
9648 ###
9649 ### Images
9650 ###
9651 ### For Parsoid-specific tests, see
9652 #### http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
9653
9654 !! test
9655 Simple image (php)
9656 !! options
9657 php
9658 !! input
9659 [[Image:foobar.jpg]]
9660 !! result
9661 <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>
9662 </p>
9663 !! end
9664
9665 !! test
9666 Simple image (parsoid)
9667 !! options
9668 parsoid=wt2html
9669 !! input
9670 [[Image:foobar.jpg]]
9671 !! result
9672 <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>
9673 </p>
9674 !! end
9675
9676 !! test
9677 Simple image (using File: namespace, now canonical) (php)
9678 !! options
9679 php
9680 !! input
9681 [[File:foobar.jpg]]
9682 !! result
9683 <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>
9684 </p>
9685 !! end
9686
9687 !! test
9688 Simple image (using File: namespace, now canonical) (parsoid)
9689 !! options
9690 parsoid
9691 !! input
9692 [[File:Foobar.jpg]]
9693 !! result
9694 <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>
9695 </p>
9696 !! end
9697
9698 !! test
9699 Right-aligned image (php)
9700 !! options
9701 php
9702 !! input
9703 [[Image:foobar.jpg|right]]
9704 !! result
9705 <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>
9706
9707 !! end
9708
9709 !! test
9710 Right-aligned image (parsoid)
9711 !! options
9712 parsoid
9713 !! input
9714 [[File:Foobar.jpg|right]]
9715 !! result
9716 <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>
9717 !! end
9718
9719 !! test
9720 Image with caption (php)
9721 !! options
9722 php
9723 !! input
9724 [[File:Foobar.jpg|right|Caption text]]
9725 !! result
9726 <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>
9727
9728 !! end
9729
9730 !! test
9731 Image with caption (parsoid)
9732 !! options
9733 parsoid
9734 !! input
9735 [[File:Foobar.jpg|right|Caption text]]
9736 !! result
9737 <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>
9738 !! end
9739
9740 !! test
9741 Image with caption, bug 53312 #1 (parsoid)
9742 !! options
9743 parsoid
9744 !! input
9745 [[File:Foobar.jpg|right|Caption page stuff]]
9746 !! result
9747 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption page stuff</figcaption></figure>
9748 !! end
9749
9750 !! test
9751 Image with caption, bug 53312 #2 (parsoid)
9752 !! options
9753 parsoid
9754 !! input
9755 [[File:Foobar.jpg|right|Caption page=]]
9756 !! result
9757 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption page=</figcaption></figure>
9758 !! end
9759
9760 !! test
9761 Image with caption, bug 53312 #3 (parsoid)
9762 !! options
9763 parsoid
9764 !! input
9765 [[File:Foobar.jpg|right|Caption page=stuff]]
9766 !! result
9767 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption page=stuff</figcaption></figure>
9768 !! end
9769
9770 !! test
9771 Image with empty attribute (php)
9772 !! options
9773 php
9774 !! input
9775 [[File:Foobar.jpg|right||Caption text]]
9776 !! result
9777 <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>
9778
9779 !! end
9780
9781 !! test
9782 Image with empty attribute (parsoid)
9783 !! options
9784 parsoid=wt2html
9785 !! input
9786 [[File:Foobar.jpg|right||Caption text]]
9787 !! result
9788 <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>
9789 !! end
9790
9791 !! test
9792 Image with attributes from template (php)
9793 !! options
9794 php
9795 !! input
9796 [[File:Foobar.jpg|{{image_attribs}}]]
9797 !! result
9798 <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>
9799
9800 !! end
9801
9802 !! test
9803 Image with attributes from template (parsoid)
9804 !! options
9805 parsoid
9806 !! input
9807 [[File:Foobar.jpg|{{image_attribs}}]]
9808 !! result
9809 <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>
9810 !! end
9811
9812 !! test
9813 Image with link tails (php)
9814 !! options
9815 php
9816 !! input
9817 123[[File:Foobar.jpg]]456
9818 123[[File:Foobar.jpg|right]]456
9819 123[[File:Foobar.jpg|thumb]]456
9820 !! result
9821 <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
9822 </p>
9823 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
9824 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
9825
9826 !! end
9827
9828 !! test
9829 Image with link tails (parsoid)
9830 !! options
9831 parsoid
9832 !! input
9833 123[[File:Foobar.jpg]]456
9834 123[[File:Foobar.jpg|right]]456
9835 123[[File:Foobar.jpg|thumb]]456
9836 !! result
9837 <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>
9838 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
9839 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
9840 !! end
9841
9842 !! test
9843 Image with multiple captions -- only last one is accepted (php)
9844 !! options
9845 php
9846 !! input
9847 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
9848 !! result
9849 <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>
9850
9851 !! end
9852
9853 !! test
9854 Image with multiple captions -- only last one is accepted (parsoid)
9855 !! options
9856 parsoid
9857 !! input
9858 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
9859 !! result
9860 <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>
9861 !! end
9862
9863 !! test
9864 Image with width attribute at different positions (php)
9865 !! options
9866 php
9867 !! input
9868 [[File:Foobar.jpg|200px|right|Caption]]
9869 [[File:Foobar.jpg|right|200px|Caption]]
9870 [[File:Foobar.jpg|right|Caption|200px]]
9871 !! result
9872 <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>
9873 <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>
9874 <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>
9875
9876 !! end
9877
9878 !! test
9879 Image with width attribute at different positions (parsoid)
9880 !! options
9881 parsoid
9882 !! input
9883 [[File:Foobar.jpg|200px|right|Caption]]
9884 [[File:Foobar.jpg|right|200px|Caption]]
9885 [[File:Foobar.jpg|right|Caption|200px]]
9886 !! result
9887 <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>
9888 <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>
9889 <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>
9890 !! end
9891
9892 !! test
9893 Image with link parameter, wiki target (php)
9894 !! options
9895 php
9896 !! input
9897 [[File:Foobar.jpg|link=Main Page]]
9898 !! result
9899 <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>
9900 </p>
9901 !! end
9902
9903 !! test
9904 Image with link parameter, wiki target (parsoid)
9905 !! options
9906 parsoid
9907 !! input
9908 [[File:Foobar.jpg|link=Main Page]]
9909 !! result
9910 <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>
9911 !! end
9912
9913 !! test
9914 Image with link parameter, URL target (php)
9915 !! options
9916 php
9917 !! input
9918 [[File:Foobar.jpg|link=http://example.com/]]
9919 !! result
9920 <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>
9921 </p>
9922 !! end
9923
9924 # parsoid bug 49293 (part 1)
9925 !! test
9926 Image with link parameter, URL target (parsoid)
9927 !! options
9928 parsoid
9929 !! input
9930 [[File:Foobar.jpg|link=http://example.com/]]
9931 !! result
9932 <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>
9933 !! end
9934
9935 !! test
9936 Image with link parameter, protocol-less URL target (php)
9937 !! options
9938 php
9939 !! input
9940 [[File:Foobar.jpg|link=//example.com/]]
9941 !! result
9942 <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>
9943 </p>
9944 !! end
9945
9946 # parsoid bug 49293 (part 2)
9947 !! test
9948 Image with link parameter, protocol-less URL target (parsoid)
9949 !! options
9950 parsoid
9951 !! input
9952 [[File:Foobar.jpg|link=//example.com/]]
9953 !! result
9954 <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>
9955 !! end
9956
9957 !! test
9958 Image with link parameter, wgExternalLinkTarget
9959 !! input
9960 [[Image:foobar.jpg|link=http://example.com/]]
9961 !! config
9962 wgExternalLinkTarget='foobar'
9963 !! result
9964 <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>
9965 </p>
9966 !! end
9967
9968 !! test
9969 Image with link parameter, wgNoFollowLinks set to false
9970 !! input
9971 [[Image:foobar.jpg|link=http://example.com/]]
9972 !! config
9973 wgNoFollowLinks=false
9974 !! result
9975 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9976 </p>
9977 !! end
9978
9979 !! test
9980 Image with link parameter, wgNoFollowDomainExceptions
9981 !! input
9982 [[Image:foobar.jpg|link=http://example.com/]]
9983 !! config
9984 wgNoFollowDomainExceptions='example.com'
9985 !! result
9986 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9987 </p>
9988 !! end
9989
9990 !! test
9991 Image with link parameter, wgExternalLinkTarget, unnamed parameter
9992 !! input
9993 [[Image:foobar.jpg|link=http://example.com/|Title]]
9994 !! config
9995 wgExternalLinkTarget='foobar'
9996 !! result
9997 <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>
9998 </p>
9999 !! end
10000
10001 !! test
10002 Image with empty link parameter (php)
10003 !! options
10004 php
10005 !! input
10006 [[File:Foobar.jpg|link=]]
10007 !! result
10008 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
10009 </p>
10010 !! end
10011
10012 !! test
10013 Image with empty link parameter (parsoid)
10014 !! options
10015 parsoid
10016 !! input
10017 [[File:Foobar.jpg|link=]]
10018 !! result
10019 <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>
10020 !! end
10021
10022 !! test
10023 Image with link parameter (wiki target) and unnamed parameter (php)
10024 !! options
10025 php
10026 !! input
10027 [[File:Foobar.jpg|link=Main Page|Title]]
10028 !! result
10029 <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>
10030 </p>
10031 !! end
10032
10033 !! test
10034 Image with link parameter (wiki target) and unnamed parameter (parsoid)
10035 !! options
10036 parsoid
10037 !! input
10038 [[File:Foobar.jpg|link=Main Page|Title]]
10039 !! result
10040 <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>
10041 !! end
10042
10043 !! test
10044 Image with link parameter (URL target) and unnamed parameter (php)
10045 !! options
10046 php
10047 !! input
10048 [[File:Foobar.jpg|link=http://example.com/|Title]]
10049 !! result
10050 <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>
10051 </p>
10052 !! end
10053
10054 !! test
10055 Image with link parameter (URL target) and unnamed parameter (parsoid)
10056 !! options
10057 parsoid
10058 !! input
10059 [[File:Foobar.jpg|link=http://example.com/|Title]]
10060 !! result
10061 <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>
10062 !! end
10063
10064 !! test
10065 Thumbnail image with link parameter
10066 !! options
10067 php
10068 !! input
10069 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
10070 !! result
10071 <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>
10072
10073 !! end
10074
10075 !! test
10076 Manually-specified thumbnail image
10077 !! options
10078 php
10079 !! input
10080 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
10081 !! result
10082 <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>
10083
10084 !! end
10085
10086 !! test
10087 Manually-specified thumbnail image with explicit link to wiki page
10088 !! options
10089 php
10090 !! input
10091 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
10092 !! result
10093 <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>
10094
10095 !! end
10096
10097 !! test
10098 Manually-specified thumbnail image with explicit link to url
10099 !! options
10100 php
10101 !! input
10102 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
10103 !! result
10104 <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>
10105
10106 !! end
10107
10108 !! test
10109 Manually-specified thumbnail image with explicit no link
10110 !! options
10111 php
10112 !! input
10113 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
10114 !! result
10115 <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>
10116
10117 !! end
10118
10119 !! test
10120 Manually-specified thumbnail image with explicit link and alt text
10121 !! options
10122 php
10123 !! input
10124 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
10125 !! result
10126 <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>
10127
10128 !! end
10129
10130 !! test
10131 Image with frame and link
10132 !! input
10133 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
10134 !! result
10135 <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>
10136
10137 !! end
10138
10139 !! test
10140 Image with frame and link and explicit alt
10141 !! input
10142 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
10143 !! result
10144 <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>
10145
10146 !! end
10147
10148 !! test
10149 Image with wiki markup in implicit alt
10150 !! input
10151 [[Image:Foobar.jpg|testing '''bold''' in alt]]
10152 !! result
10153 <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>
10154 </p>
10155 !! end
10156
10157 !! test
10158 Image with wiki markup in explicit alt
10159 !! input
10160 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
10161 !! result
10162 <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>
10163 </p>
10164 !! end
10165
10166 !! test
10167 Link to image page- image page normally doesn't exists, hence edit link
10168 Add test with existing image page
10169 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
10170 !! input
10171 [[:Image:test]]
10172 !! result
10173 <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>
10174 </p>
10175 !! end
10176
10177 !! test
10178 bug 18784 Link to non-existent image page with caption should use caption as link text
10179 !! input
10180 [[:Image:test|caption]]
10181 !! result
10182 <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>
10183 </p>
10184 !! end
10185
10186 !! test
10187 Frameless image caption with a free URL
10188 !! input
10189 [[Image:foobar.jpg|http://example.com]]
10190 !! result
10191 <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>
10192 </p>
10193 !! end
10194
10195 !! test
10196 Thumbnail image caption with a free URL
10197 !! input
10198 [[Image:foobar.jpg|thumb|http://example.com]]
10199 !! result
10200 <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>
10201
10202 !! end
10203
10204 !! test
10205 Thumbnail image caption with a free URL and explicit alt
10206 !! input
10207 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
10208 !! result
10209 <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>
10210
10211 !! end
10212
10213 !! test
10214 SVG thumbnails with no language set
10215 !! options
10216 !! input
10217 [[File:Foobar.svg|thumb|caption]]
10218 !! result
10219 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="180" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10220
10221 !! end
10222
10223 !! test
10224 SVG thumbnails with language de
10225 !! options
10226 !! input
10227 [[File:Foobar.svg|thumb|caption|lang=de]]
10228 !! result
10229 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=File:Foobar.svg&amp;lang=de" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/langde-180px-Foobar.svg.png" width="180" height="180" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/langde-270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/langde-360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10230
10231 !! end
10232
10233 !! test
10234 SVG thumbnails with invalid language code
10235 !! options
10236 !! input
10237 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
10238 !! result
10239 <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>
10240
10241 !! end
10242
10243 !! test
10244 BUG 1887: A ISBN with a thumbnail
10245 !! input
10246 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
10247 !! result
10248 <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>
10249
10250 !! end
10251
10252 !! test
10253 BUG 1887: A RFC with a thumbnail
10254 !! input
10255 [[Image:foobar.jpg|thumb|This is RFC 12354]]
10256 !! result
10257 <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>
10258
10259 !! end
10260
10261 !! test
10262 BUG 1887: A mailto link with a thumbnail
10263 !! input
10264 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
10265 !! result
10266 <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>
10267
10268 !! end
10269
10270 # Pending resolution to bug 368
10271 !! test
10272 BUG 648: Frameless image caption with a link
10273 !! input
10274 [[Image:foobar.jpg|text with a [[link]] in it]]
10275 !! result
10276 <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>
10277 </p>
10278 !! end
10279
10280 !! test
10281 BUG 648: Frameless image caption with a link (suffix)
10282 !! input
10283 [[Image:foobar.jpg|text with a [[link]]foo in it]]
10284 !! result
10285 <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>
10286 </p>
10287 !! end
10288
10289 !! test
10290 BUG 648: Frameless image caption with an interwiki link
10291 !! input
10292 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
10293 !! result
10294 <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>
10295 </p>
10296 !! end
10297
10298 !! test
10299 BUG 648: Frameless image caption with a piped interwiki link
10300 !! input
10301 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
10302 !! result
10303 <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>
10304 </p>
10305 !! end
10306
10307 !! test
10308 Escape HTML special chars in image alt text
10309 !! input
10310 [[Image:foobar.jpg|& < > "]]
10311 !! result
10312 <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>
10313 </p>
10314 !! end
10315
10316 !! test
10317 BUG 499: Alt text should have &#1234;, not &amp;1234;
10318 !! input
10319 [[Image:foobar.jpg|&#9792;]]
10320 !! result
10321 <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>
10322 </p>
10323 !! end
10324
10325 !! test
10326 Broken image caption with link
10327 !! input
10328 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
10329 !! result
10330 <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.
10331 </p>
10332 !! end
10333
10334 !! test
10335 Image caption containing another image
10336 !! input
10337 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
10338 !! result
10339 <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>
10340
10341 !! end
10342
10343 !! test
10344 Image caption containing a newline
10345 !! input
10346 [[Image:Foobar.jpg|This
10347 *is some text]]
10348 !! result
10349 <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>
10350 </p>
10351 !!end
10352
10353 !!test
10354 Parsoid: Image caption containing leading space
10355 (The leading space should not trigger nowiki escaping in wt2wt mode)
10356 !! input
10357 [[Image:Foobar.jpg|thumb| bar]]
10358 !! result
10359 <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>
10360
10361 !!end
10362
10363 !! test
10364 Bug 3090: External links other than http: in image captions
10365 !! input
10366 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
10367 !! result
10368 <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>
10369
10370 !! end
10371
10372 !! test
10373 Custom class
10374 !! input
10375 [[Image:foobar.jpg|a|class=b]]
10376 !! result
10377 <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>
10378 </p>
10379 !! end
10380
10381 !! test
10382 Localized image handling (1).
10383 !! options
10384 language=es
10385 !! input
10386 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
10387 !! result
10388 <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>
10389
10390 !! end
10391
10392 !! test
10393 Localized image handling (2).
10394 !! options
10395 language=es
10396 !! input
10397 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
10398 !! result
10399 <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>
10400
10401 !! end
10402
10403 !! test
10404 "border", "frameless" and "class" attributes on an image.
10405 !! input
10406 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
10407 !! result
10408 <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>
10409 </p>
10410 !! end
10411
10412 !! article
10413 File:Barfoo.jpg
10414 !! text
10415 #REDIRECT [[File:Barfoo.jpg]]
10416 !! endarticle
10417
10418 !! test
10419 Redirected image
10420 !! input
10421 [[Image:Barfoo.jpg]]
10422 !! result
10423 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
10424 </p>
10425 !! end
10426
10427 !! test
10428 Missing image with uploads disabled
10429 !! options
10430 wgEnableUploads=0
10431 !! input
10432 [[Image:Foobaz.jpg]]
10433 !! result
10434 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
10435 </p>
10436 !! end
10437
10438 # Parsoid-specific testing for images
10439 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
10440 # Currently imperfect due to a flaw in the Parsoid testrunner
10441 # Work in progress
10442 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
10443 # image tests.
10444
10445 !! test
10446 Parsoid-specific image handling - simple image with size and middle alignment
10447 !! options
10448 parsoid
10449 !! input
10450 [[Image:Foobar.jpg|50px|middle]]
10451 !! result
10452 <p>
10453 <span class="mw-valign-middle" typeof="mw:Image">
10454 <a href="File:Foobar.jpg">
10455 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
10456 </a>
10457 </span>
10458 </p>
10459 !! end
10460
10461 !! test
10462 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
10463 !! options
10464 parsoid
10465 !! input
10466 [[Image:Foobar.jpg|500x10px|baseline|caption]]
10467 !! result
10468 <p>
10469 <span class="mw-valign-baseline" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
10470 <a href="File:Foobar.jpg">
10471 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89">
10472 </a>
10473 </span>
10474 </p>
10475 !! end
10476
10477 !! test
10478 Parsoid-specific image handling - simple image with border and size spec
10479 !! options
10480 parsoid
10481 !! input
10482 [[Image:Foobar.jpg|50px|border|caption]]
10483 !! result
10484 <p>
10485 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
10486 <a href="File:Foobar.jpg">
10487 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
10488 </a>
10489 </span>
10490 </p>
10491 !! end
10492
10493 !! test
10494 Parsoid-specific image handling - thumbnail with halign, valign, and caption
10495 !! options
10496 parsoid
10497 !! input
10498 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
10499 !! result
10500 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
10501 <a href="File:Foobar.jpg">
10502 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="21" width="180" />
10503 </a>
10504 <figcaption>caption content</figcaption>
10505 </figure>
10506 !! end
10507
10508 !! test
10509 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
10510 !! options
10511 parsoid
10512 !! input
10513 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
10514 !! result
10515 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
10516 <a href="File:Foobar.jpg">
10517 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
10518 </a>
10519 <figcaption>caption</figcaption>
10520 </figure>
10521 !! end
10522
10523 !! test
10524 Parsoid-specific image handling - framed image with specific size and caption
10525 !! options
10526 parsoid
10527 !! input
10528 [[Image:Foobar.jpg|500x50px|frame|caption]]
10529 !! result
10530 <figure typeof="mw:Image/Frame">
10531 <a href="File:Foobar.jpg">
10532 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
10533 </a>
10534 <figcaption>caption</figcaption>
10535 </figure>
10536 !! end
10537
10538 !! test
10539 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
10540 !! options
10541 parsoid
10542 !! input
10543 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
10544 !! result
10545 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
10546 <a href="File:Foobar.jpg">
10547 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
10548 </a>
10549 <figcaption>caption</figcaption>
10550 </figure>
10551 !! end
10552
10553 !! test
10554 Parsoid-specific image handling - frameless image with specific size, border, and caption
10555 !! options
10556 parsoid
10557 !! input
10558 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
10559 !! result
10560 <p>
10561 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
10562 <a href="File:Foobar.jpg">
10563 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
10564 </a>
10565 </p>
10566 !! end
10567
10568 #!! test
10569 #Parsoid-specific image handling - simple image with a formatted caption
10570 #!! options
10571 #parsoid
10572 #!! input
10573 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
10574 #!! result
10575 #<p>
10576 #<span typeof="mw:Image">
10577 #<a class="mw-default-size" href="Image:Foobar.jpg">
10578 #<img alt="Foobar.jpg" class="mw-default-size" src="http://example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
10579 #</a>
10580 #<span>abc</span>
10581 #</span>
10582 #</p>
10583
10584 !! test
10585 Parsoid-specific image handling - caption with a template in it
10586 !! options
10587 parsoid
10588 !! input
10589 [[File:Foobar.jpg|thumb|200x200px|This caption has a {{echo|transclusion}} in it.]]
10590 !! result
10591 <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>
10592 !! end
10593
10594 !! test
10595 Parsoid-specific image handling - caption with unbalanced tags in it
10596 !! options
10597 parsoid=wt2html,wt2wt,html2html
10598 !! input
10599 foo
10600 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
10601 bar
10602 !! result
10603 <p>foo</p>
10604 <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>
10605 <p>bar</p>
10606 !! end
10607
10608
10609 ###
10610 ### Subpages
10611 ###
10612 !! article
10613 Subpage test/subpage
10614 !! text
10615 foo
10616 !! endarticle
10617
10618 !! test
10619 Subpage link
10620 !! options
10621 subpage title=[[Subpage test]]
10622 !! input
10623 [[/subpage]]
10624 !! result
10625 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
10626 </p>
10627 !! end
10628
10629 !! test
10630 Subpage noslash link
10631 !! options
10632 subpage title=[[Subpage test]]
10633 !!input
10634 [[/subpage/]]
10635 !! result
10636 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
10637 </p>
10638 !! end
10639
10640 # TODO: make this PHP-parser compatible!
10641 !! test
10642 Relative subpage noslash link
10643 !! options
10644 parsoid=wt2wt,wt2html,html2html
10645 subpage title=[[Subpage test/1/2/3/4]]
10646 !!input
10647 [[../../subpage/]]
10648
10649 [[../../subpage]]
10650 !! result
10651 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
10652 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
10653 !! end
10654
10655 # TODO: make this PHP-parser compatible!
10656 !! test
10657 Parsoid: dot-slash prefixed wikilinks
10658 !! options
10659 parsoid=wt2wt,wt2html,html2html
10660 !!input
10661 [[./foo]]
10662
10663 [[././bar]]
10664
10665 [[././baz/]]
10666 !! result
10667 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
10668 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
10669 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
10670 !! end
10671
10672 !! test
10673 Disabled subpages
10674 !! input
10675 [[/subpage]]
10676 !! result
10677 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
10678 </p>
10679 !! end
10680
10681 !! test
10682 BUG 561: {{/Subpage}}
10683 !! options
10684 subpage title=[[Page]]
10685 !! input
10686 {{/Subpage}}
10687 !! result
10688 <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>
10689 </p>
10690 !! end
10691
10692 ###
10693 ### Categories
10694 ###
10695 !! article
10696 Category:MediaWiki User's Guide
10697 !! text
10698 blah
10699 !! endarticle
10700
10701 !! test
10702 Link to category
10703 !! input
10704 [[:Category:MediaWiki User's Guide]]
10705 !! result
10706 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
10707 </p>
10708 !! end
10709
10710 !! test
10711 Simple category
10712 !! options
10713 cat
10714 !! input
10715 [[Category:MediaWiki User's Guide]]
10716 !! result
10717 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
10718 !! end
10719
10720 !! test
10721 PAGESINCATEGORY invalid title fatal (r33546 fix)
10722 !! input
10723 {{PAGESINCATEGORY:<bogus>}}
10724 !! result
10725 <p>0
10726 </p>
10727 !! end
10728
10729 !! test
10730 Category with different sort key
10731 !! options
10732 cat
10733 !! input
10734 [[Category:MediaWiki User's Guide|Foo]]
10735 !! result
10736 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
10737 !! end
10738
10739 !! test
10740 Category with identical sort key
10741 !! options
10742 cat
10743 !! input
10744 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
10745 !! result
10746 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
10747 !! end
10748
10749 !! test
10750 Category with empty sort key
10751 !! options
10752 cat
10753 pst
10754 !! input
10755 [[Category:MediaWiki User's Guide|]]
10756 !! result
10757 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
10758 !! end
10759
10760 !! test
10761 Category with empty sort key and parentheses
10762 !! options
10763 cat
10764 pst
10765 !! input
10766 [[Category:Foo (bar)|]]
10767 !! result
10768 [[Category:Foo (bar)|Foo]]
10769 !! end
10770
10771 !! test
10772 Category with link tail
10773 !! options
10774 cat
10775 pst
10776 !! input
10777 123[[Category:Foo]]456
10778 !! result
10779 123[[Category:Foo]]456
10780 !! end
10781
10782 !! test
10783 Category with template
10784 !! options
10785 cat
10786 pst
10787 !! input
10788 [[Category:{{echo|Foo}}]]
10789 !! result
10790 [[Category:{{echo|Foo}}]]
10791 !! end
10792
10793 !! test
10794 Category with template in sort key
10795 !! options
10796 cat
10797 pst
10798 !! input
10799 [[Category:Foo|{{echo|Bar}}]]
10800 !! result
10801 [[Category:Foo|{{echo|Bar}}]]
10802 !! end
10803
10804 !! test
10805 Category with template in sort key and title
10806 !! options
10807 cat
10808 pst
10809 !! input
10810 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
10811 !! result
10812 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
10813 !! end
10814
10815 !! test
10816 Category / paragraph interactions
10817 !! input
10818 Foo [[Category:Baz]] Bar
10819
10820 Foo [[Category:Baz]]
10821 Bar
10822
10823 Foo
10824 [[Category:Baz]]
10825 Bar
10826
10827 Foo
10828 [[Category:Baz]] Bar
10829
10830 Foo
10831 [[Category:Baz]]
10832 [[Category:Baz]]
10833 [[Category:Baz]]
10834 Bar
10835
10836 [[Category:Baz]]
10837 [[Category:Baz]]
10838 [[Category:Baz]]
10839
10840 [[Category:Baz]]
10841 {{echo|[[Category:Baz]]}}
10842 [[Category:Baz]]
10843 !! result
10844 <p>Foo Bar
10845 </p><p>Foo
10846 Bar
10847 </p><p>Foo
10848 Bar
10849 </p><p>Foo Bar
10850 </p><p>Foo
10851 Bar
10852 </p>
10853 !! end
10854
10855 !! test
10856 Parsoid: Serialize link to category page with colon escape
10857 !! options
10858 parsoid
10859 !! input
10860
10861 [[:Category:Foo]]
10862 [[:Category:Foo|Bar]]
10863 !! result
10864 <p>
10865 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
10866 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
10867 </p>
10868 !! end
10869
10870 !! test
10871 Parsoid: Link prefix/suffixes aren't applied to category links
10872 !! options
10873 parsoid=wt2html,wt2wt,html2html
10874 language=is
10875 !! input
10876 x[[Category:Foo]]y
10877 !! result
10878 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
10879 !! end
10880
10881 !! test
10882 Parsoid: Serialize link to file page with colon escape
10883 !! options
10884 parsoid
10885 !! input
10886
10887 [[:File:Foo.png]]
10888 [[:File:Foo.png|Bar]]
10889 !! result
10890 <p>
10891 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
10892 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
10893 </p>
10894 !! end
10895
10896 !! test
10897 Parsoid: Serialize a genuine category link without colon escape
10898 !! options
10899 parsoid
10900 !! input
10901 [[Category:Foo]]
10902 [[Category:Foo|Bar]]
10903 !! result
10904 <link rel="mw:PageProp/Category" href="Category:Foo">
10905 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
10906 !! end
10907
10908 !! test
10909 Parsoid: Defaultsort
10910 !! options
10911 parsoid
10912 !! input
10913 {{DEFAULTSORT:Foo}}
10914 !! result
10915 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
10916 !! end
10917
10918 ###
10919 ### Inter-language links
10920 ###
10921 !! test
10922 Inter-language links
10923 !! options
10924 ill
10925 !! input
10926 [[es:Alimento]]
10927 [[fr:Nourriture]]
10928 [[zh:&#39135;&#21697;]]
10929 !! result
10930 es:Alimento fr:Nourriture zh:食品
10931 !! end
10932
10933 !! test
10934 Duplicate interlanguage links (bug 24502)
10935 !! options
10936 ill
10937 !! input
10938 [[es:1]]
10939 [[es:2]]
10940 [[fr:1]]
10941 [[fr:2]]
10942 !! result
10943 es:1 fr:1
10944 !! end
10945
10946 ###
10947 ### Sections
10948 ###
10949 !! test
10950 Basic section headings
10951 !! input
10952 == Headline 1 ==
10953 Some text
10954
10955 ==Headline 2==
10956 More
10957 ===Smaller headline===
10958 Blah blah
10959 !! result
10960 <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>
10961 <p>Some text
10962 </p>
10963 <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>
10964 <p>More
10965 </p>
10966 <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>
10967 <p>Blah blah
10968 </p>
10969 !! end
10970
10971 !! test
10972 Section headings with TOC
10973 !! input
10974 == Headline 1 ==
10975 === Subheadline 1 ===
10976 ===== Skipping a level =====
10977 ====== Skipping a level ======
10978
10979 == Headline 2 ==
10980 Some text
10981 ===Another headline===
10982 !! result
10983 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10984 <ul>
10985 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
10986 <ul>
10987 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
10988 <ul>
10989 <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>
10990 <ul>
10991 <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>
10992 </ul>
10993 </li>
10994 </ul>
10995 </li>
10996 </ul>
10997 </li>
10998 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
10999 <ul>
11000 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
11001 </ul>
11002 </li>
11003 </ul>
11004 </div>
11005
11006 <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>
11007 <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>
11008 <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>
11009 <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>
11010 <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>
11011 <p>Some text
11012 </p>
11013 <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>
11014
11015 !! end
11016
11017 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
11018 !! test
11019 Handling of sections up to level 6 and beyond
11020 !! input
11021 = Level 1 Heading=
11022 == Level 2 Heading==
11023 === Level 3 Heading===
11024 ==== Level 4 Heading====
11025 ===== Level 5 Heading=====
11026 ====== Level 6 Heading======
11027 ======= Level 7 Heading=======
11028 ======== Level 8 Heading========
11029 ========= Level 9 Heading=========
11030 ========== Level 10 Heading==========
11031 !! result
11032 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11033 <ul>
11034 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
11035 <ul>
11036 <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>
11037 <ul>
11038 <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>
11039 <ul>
11040 <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>
11041 <ul>
11042 <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>
11043 <ul>
11044 <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>
11045 <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>
11046 <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>
11047 <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>
11048 <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>
11049 </ul>
11050 </li>
11051 </ul>
11052 </li>
11053 </ul>
11054 </li>
11055 </ul>
11056 </li>
11057 </ul>
11058 </li>
11059 </ul>
11060 </div>
11061
11062 <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>
11063 <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>
11064 <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>
11065 <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>
11066 <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>
11067 <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>
11068 <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>
11069 <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>
11070 <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>
11071 <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>
11072
11073 !! end
11074
11075 !! test
11076 TOC regression (bug 9764)
11077 !! input
11078 == title 1 ==
11079 === title 1.1 ===
11080 ==== title 1.1.1 ====
11081 === title 1.2 ===
11082 == title 2 ==
11083 === title 2.1 ===
11084 !! result
11085 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11086 <ul>
11087 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11088 <ul>
11089 <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>
11090 <ul>
11091 <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>
11092 </ul>
11093 </li>
11094 <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>
11095 </ul>
11096 </li>
11097 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
11098 <ul>
11099 <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>
11100 </ul>
11101 </li>
11102 </ul>
11103 </div>
11104
11105 <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>
11106 <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>
11107 <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>
11108 <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>
11109 <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>
11110 <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>
11111
11112 !! end
11113
11114 !! test
11115 TOC with wgMaxTocLevel=3 (bug 6204)
11116 !! options
11117 wgMaxTocLevel=3
11118 !! input
11119 == title 1 ==
11120 === title 1.1 ===
11121 ==== title 1.1.1 ====
11122 === title 1.2 ===
11123 == title 2 ==
11124 === title 2.1 ===
11125 !! result
11126 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11127 <ul>
11128 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11129 <ul>
11130 <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>
11131 <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>
11132 </ul>
11133 </li>
11134 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
11135 <ul>
11136 <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>
11137 </ul>
11138 </li>
11139 </ul>
11140 </div>
11141
11142 <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>
11143 <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>
11144 <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>
11145 <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>
11146 <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>
11147 <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>
11148
11149 !! end
11150
11151 !! test
11152 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
11153 !! options
11154 wgMaxTocLevel=3
11155 !! input
11156 ==Section 1==
11157 ===Section 1.1===
11158 ====Section 1.1.1====
11159 ====Section 1.1.1.1====
11160 ==Section 2==
11161 !! result
11162 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11163 <ul>
11164 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
11165 <ul>
11166 <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>
11167 </ul>
11168 </li>
11169 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
11170 </ul>
11171 </div>
11172
11173 <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>
11174 <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>
11175 <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>
11176 <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>
11177 <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>
11178
11179 !! end
11180
11181
11182 !! test
11183 Resolving duplicate section names
11184 !! input
11185 == Foo bar ==
11186 == Foo bar ==
11187 !! result
11188 <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>
11189 <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>
11190
11191 !! end
11192
11193 !! test
11194 Resolving duplicate section names with differing case (bug 10721)
11195 !! input
11196 == Foo bar ==
11197 == Foo Bar ==
11198 !! result
11199 <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>
11200 <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>
11201
11202 !! end
11203
11204 !! article
11205 Template:sections
11206 !! text
11207 ===Section 1===
11208 ==Section 2==
11209 !! endarticle
11210
11211 !! test
11212 Template with sections, __NOTOC__
11213 !! input
11214 __NOTOC__
11215 ==Section 0==
11216 {{sections}}
11217 ==Section 4==
11218 !! result
11219 <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>
11220 <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>
11221 <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>
11222 <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>
11223
11224 !! end
11225
11226 !! test
11227 __NOEDITSECTION__ keyword
11228 !! input
11229 __NOEDITSECTION__
11230 ==Section 1==
11231 ==Section 2==
11232 !! result
11233 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
11234 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
11235
11236 !! end
11237
11238 !! test
11239 Link inside a section heading
11240 !! input
11241 ==Section with a [[Main Page|link]] in it==
11242 !! result
11243 <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>
11244
11245 !! end
11246
11247 !! test
11248 TOC regression (bug 12077)
11249 !! input
11250 __TOC__
11251 == title 1 ==
11252 === title 1.1 ===
11253 == title 2 ==
11254 !! result
11255 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11256 <ul>
11257 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11258 <ul>
11259 <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>
11260 </ul>
11261 </li>
11262 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
11263 </ul>
11264 </div>
11265
11266 <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>
11267 <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>
11268 <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>
11269
11270 !! end
11271
11272 !! test
11273 BUG 1219 URL next to image (good)
11274 !! input
11275 http://example.com [[Image:foobar.jpg]]
11276 !! result
11277 <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>
11278 </p>
11279 !!end
11280
11281 !! test
11282 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
11283 !! input
11284 ===
11285 The line above must have a trailing space!
11286 === <!--
11287 --> <!-- -->
11288 But just in case it doesn't...
11289 !! result
11290 <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>
11291 <p>The line above must have a trailing space!
11292 </p>
11293 <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>
11294 <p>But just in case it doesn't...
11295 </p>
11296 !! end
11297
11298 !! test
11299 Header with special characters (bug 25462)
11300 !! input
11301 The tooltips shall not show entities to the user (ie. be double escaped)
11302
11303 == text > text ==
11304 section 1
11305
11306 == text < text ==
11307 section 2
11308
11309 == text & text ==
11310 section 3
11311
11312 == text ' text ==
11313 section 4
11314
11315 == text " text ==
11316 section 5
11317 !! result
11318 <p>The tooltips shall not show entities to the user (ie. be double escaped)
11319 </p>
11320 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11321 <ul>
11322 <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>
11323 <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>
11324 <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>
11325 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
11326 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
11327 </ul>
11328 </div>
11329
11330 <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>
11331 <p>section 1
11332 </p>
11333 <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>
11334 <p>section 2
11335 </p>
11336 <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>
11337 <p>section 3
11338 </p>
11339 <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>
11340 <p>section 4
11341 </p>
11342 <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>
11343 <p>section 5
11344 </p>
11345 !! end
11346
11347 !! test
11348 Headers with excess '=' characters
11349 (Are similar tests necessary beyond the 1st level?)
11350 !! input
11351 =foo==
11352 ==foo=
11353 =''italic'' heading==
11354 ==''italic'' heading=
11355 !! result
11356 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11357 <ul>
11358 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
11359 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
11360 <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>
11361 <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>
11362 </ul>
11363 </div>
11364
11365 <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>
11366 <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>
11367 <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>
11368 <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>
11369
11370 !! end
11371
11372 !! test
11373 HTML headers vs TOC (bug 23393)
11374 (__NOEDITSECTION__ for clearer output, doesn't matter here)
11375 !! input
11376 <h1>Header 1</h1>
11377 == Header 1.1 ==
11378 == Header 1.2 ==
11379
11380 <h1>Header 2
11381 </h1>
11382 == Header 2.1 ==
11383 == Header 2.2 ==
11384 __NOEDITSECTION__
11385 !! result
11386 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11387 <ul>
11388 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
11389 <ul>
11390 <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>
11391 <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>
11392 </ul>
11393 </li>
11394 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
11395 <ul>
11396 <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>
11397 <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>
11398 </ul>
11399 </li>
11400 </ul>
11401 </div>
11402
11403 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
11404 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
11405 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
11406 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
11407 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
11408 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
11409
11410 !! end
11411
11412 !! test
11413 BUG 1219 URL next to image (broken)
11414 !! input
11415 http://example.com[[Image:foobar.jpg]]
11416 !! result
11417 <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>
11418 </p>
11419 !!end
11420
11421 !! test
11422 Bug 1186 news: in the middle of text
11423 !! input
11424 http://en.wikinews.org/wiki/Wikinews:Workplace
11425 !! result
11426 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
11427 </p>
11428 !!end
11429
11430
11431 !! test
11432 Namespaced link must have a title
11433 !! input
11434 [[Project:]]
11435 !! result
11436 <p>[[Project:]]
11437 </p>
11438 !!end
11439
11440 !! test
11441 Namespaced link must have a title (bad fragment version)
11442 !! input
11443 [[Project:#fragment]]
11444 !! result
11445 <p>[[Project:#fragment]]
11446 </p>
11447 !!end
11448
11449
11450 ###
11451 ### HTML tags and HTML attributes
11452 ###
11453
11454 !! test
11455 div with no attributes
11456 !! input
11457 <div>HTML rocks</div>
11458 !! result
11459 <div>HTML rocks</div>
11460
11461 !! end
11462
11463 !! test
11464 div with double-quoted attribute
11465 !! input
11466 <div id="rock">HTML rocks</div>
11467 !! result
11468 <div id="rock">HTML rocks</div>
11469
11470 !! end
11471
11472 !! test
11473 div with single-quoted attribute
11474 !! input
11475 <div id='rock'>HTML rocks</div>
11476 !! result
11477 <div id="rock">HTML rocks</div>
11478
11479 !! end
11480
11481 !! test
11482 div with unquoted attribute
11483 !! input
11484 <div id=rock>HTML rocks</div>
11485 !! result
11486 <div id="rock">HTML rocks</div>
11487
11488 !! end
11489
11490 !! test
11491 div with illegal double attributes
11492 !! input
11493 <div id="a" id="b">HTML rocks</div>
11494 !! result
11495 <div id="b">HTML rocks</div>
11496
11497 !!end
11498
11499 # FIXME: produce empty string instead of "class" in the PHP parser, following
11500 # the HTML5 spec.
11501 !! test
11502 div with empty attribute value, space before equals
11503 !! options
11504 parsoid
11505 !! input
11506 <div class =>HTML rocks</div>
11507 !! result
11508 <div class="">HTML rocks</div>
11509
11510 !! end
11511
11512 # The PHP parser escapes the opening brace to &#123; for some reason, so
11513 # disabled this test for it.
11514 !! test
11515 div with braces in attribute value
11516 !! options
11517 parsoid
11518 !! input
11519 <div title="{}">Foo</div>
11520 !! result
11521 <div title="{}">Foo</div>
11522 !! end
11523
11524 # This it very inconsistent in the PHP parser: it returns
11525 # class="class" if there is a space between the name and the equal sign (see
11526 # 'div with empty attribute value, space before equals'), but strips the
11527 # attribute completely if the space is missing. We hope that not much content
11528 # depends on this, so are implementing the behavior below in Parsoid for
11529 # consistencies' sake. Disabled for the PHP parser.
11530 # FIXME: fix this behavior in the PHP parser?
11531 !! test
11532 div with empty attribute value, no space before equals
11533 !! options
11534 parsoid
11535 !! input
11536 <div class=>HTML rocks</div>
11537 !! result
11538 <div class="">HTML rocks</div>
11539
11540 !! end
11541
11542 !! test
11543 HTML multiple attributes correction
11544 !! input
11545 <p class="error" class="awesome">Awesome!</p>
11546 !! result
11547 <p class="awesome">Awesome!</p>
11548
11549 !!end
11550
11551 !! test
11552 Table multiple attributes correction
11553 !! input
11554 {|
11555 !+ class="error" class="awesome"| status
11556 |}
11557 !! result
11558 <table>
11559 <tr>
11560 <th class="awesome"> status
11561 </th></tr></table>
11562
11563 !!end
11564
11565 !! test
11566 DIV IN UPPERCASE
11567 !! input
11568 <DIV ID="x">HTML ROCKS</DIV>
11569 !! result
11570 <div id="x">HTML ROCKS</div>
11571
11572 !!end
11573
11574 !! test
11575 Non-ASCII pseudo-tags are rendered as text
11576 !! input
11577 <khyô>
11578 !! result
11579 <p>&lt;khyô&gt;
11580 </p>
11581 !! end
11582
11583 !! test
11584 Pseudo-tag with URL 'name' renders as url link
11585 !! input
11586 <http://example.com/>
11587 !! result
11588 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
11589 </p>
11590 !! end
11591
11592 !! test
11593 text with amp in the middle of nowhere
11594 !! input
11595 Remember AT&T?
11596 !!result
11597 <p>Remember AT&amp;T?
11598 </p>
11599 !! end
11600
11601 !! test
11602 text with character entity: eacute
11603 !! input
11604 I always thought &eacute; was a cute letter.
11605 !! result
11606 <p>I always thought &#233; was a cute letter.
11607 </p>
11608 !! end
11609
11610 !! test
11611 text with entity-escaped character entity-like string: eacute
11612 !! input
11613 I always thought &amp;eacute; was a cute letter.
11614 !! result
11615 <p>I always thought &amp;eacute; was a cute letter.
11616 </p>
11617 !! end
11618
11619 !! test
11620 text with undefined character entity: xacute
11621 !! input
11622 I always thought &xacute; was a cute letter.
11623 !! result
11624 <p>I always thought &amp;xacute; was a cute letter.
11625 </p>
11626 !! end
11627
11628 # TODO: generalize to PHP parser?
11629 !! test
11630 HTML5 tags
11631 !! options
11632 parsoid
11633 !! input
11634 <data value="5">five</data>
11635 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
11636 <mark>This highlighted text</mark>
11637 !! result
11638 <p><data value="5">five</data>
11639 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
11640 <mark>This highlighted text</mark></p>
11641 !! end
11642
11643 !! test
11644 HTML tag with leading space is parsed as text
11645 !! input
11646 < div>foo< /div>
11647 !! result
11648 <p>&lt; div&gt;foo&lt; /div&gt;
11649 </p>
11650 !! end
11651
11652 ###
11653 ### Nesting tests (see bug 41545, 50604, 51081)
11654 ###
11655
11656 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
11657 # Note that html2wt is considerably more difficult if we use <b> in
11658 # the test case, instead of <big>
11659 !! test
11660 Ensure that HTML adoption agency algorithm is properly implemented.
11661 !! input
11662 <big>X<big>Y</big>Z</big>
11663 !! result
11664 <p><big>X<big>Y</big>Z</big>
11665 </p>
11666 !! end
11667
11668 # This was bug 41545 in the PHP parser.
11669 !! test
11670 Nesting of <kbd>
11671 !! input
11672 <kbd>X<kbd>Y</kbd>Z</kbd>
11673 !! result
11674 <p><kbd>X<kbd>Y</kbd>Z</kbd>
11675 </p>
11676 !! end
11677
11678 # The following cases were bug 51081 in the PHP parser.
11679 # Note that there are some other nestable tags (b, i, etc) which are
11680 # not covered; see bug 51081 for discussion.
11681 !! test
11682 Nesting of <em>
11683 !! input
11684 <em>X<em>Y</em>Z</em>
11685 !! result
11686 <p><em>X<em>Y</em>Z</em>
11687 </p>
11688 !! end
11689
11690 !! test
11691 Nesting of <strong>
11692 !! input
11693 <strong>X<strong>Y</strong>Z</strong>
11694 !! result
11695 <p><strong>X<strong>Y</strong>Z</strong>
11696 </p>
11697 !! end
11698
11699 !! test
11700 Nesting of <q>
11701 !! input
11702 <q>X<q>Y</q>Z</q>
11703 !! result
11704 <p><q>X<q>Y</q>Z</q>
11705 </p>
11706 !! end
11707
11708 !! test
11709 Nesting of <ruby>
11710 !! input
11711 <ruby>X<ruby>Y</ruby>Z</ruby>
11712 !! result
11713 <p><ruby>X<ruby>Y</ruby>Z</ruby>
11714 </p>
11715 !! end
11716
11717 !! test
11718 Nesting of <bdo>
11719 !! input
11720 <bdo>X<bdo>Y</bdo>Z</bdo>
11721 !! result
11722 <p><bdo>X<bdo>Y</bdo>Z</bdo>
11723 </p>
11724 !! end
11725
11726
11727 ###
11728 ### Media links
11729 ###
11730
11731 !! test
11732 Media link
11733 !! input
11734 [[Media:Foobar.jpg]]
11735 !! result
11736 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
11737 </p>
11738 !! end
11739
11740 !! test
11741 Media link with text
11742 !! input
11743 [[Media:Foobar.jpg|A neat file to look at]]
11744 !! result
11745 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
11746 </p>
11747 !! end
11748
11749 # FIXME: this is still bad HTML tag nesting
11750 !! test
11751 Media link with nasty text
11752 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
11753 !! input
11754 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
11755 !! result
11756 <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>
11757
11758 !! end
11759
11760 !! test
11761 Media link to nonexistent file (bug 1702)
11762 !! input
11763 [[Media:No such.jpg]]
11764 !! result
11765 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
11766 </p>
11767 !! end
11768
11769 !! test
11770 Image link to nonexistent file (bug 1850 - good)
11771 !! input
11772 [[Image:No such.jpg]]
11773 !! result
11774 <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>
11775 </p>
11776 !! end
11777
11778 !! test
11779 :Image link to nonexistent file (bug 1850 - bad)
11780 !! input
11781 [[:Image:No such.jpg]]
11782 !! result
11783 <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>
11784 </p>
11785 !! end
11786
11787
11788
11789 !! test
11790 Character reference normalization in link text (bug 1938)
11791 !! input
11792 [[Main Page|this&that]]
11793 !! result
11794 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
11795 </p>
11796 !!end
11797
11798 !! article
11799 אַ
11800 !! text
11801 Test for unicode normalization
11802
11803 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
11804 !! endarticle
11805
11806 !! test
11807 (bug 19451) Links should refer to the normalized form.
11808 !! input
11809 [[&#xFB2E;]]
11810 [[&#x5d0;&#x5b7;]]
11811 [[&#x5d0;ַ]]
11812 [[א&#x5b7;]]
11813 [[אַ]]
11814 !! result
11815 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
11816 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
11817 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
11818 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
11819 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
11820 </p>
11821 !! end
11822
11823 !! test
11824 Empty attribute crash test (bug 2067)
11825 !! input
11826 <font color="">foo</font>
11827 !! result
11828 <p><font color="">foo</font>
11829 </p>
11830 !! end
11831
11832 !! test
11833 Empty attribute crash test single-quotes (bug 2067)
11834 !! input
11835 <font color=''>foo</font>
11836 !! result
11837 <p><font color="">foo</font>
11838 </p>
11839 !! end
11840
11841 !! test
11842 Attribute test: equals, then nothing
11843 !! input
11844 <font color=>foo</font>
11845 !! result
11846 <p><font>foo</font>
11847 </p>
11848 !! end
11849
11850 !! test
11851 Attribute test: unquoted value
11852 !! input
11853 <font color=x>foo</font>
11854 !! result
11855 <p><font color="x">foo</font>
11856 </p>
11857 !! end
11858
11859 !! test
11860 Attribute test: unquoted but illegal value (hash)
11861 !! input
11862 <font color=#x>foo</font>
11863 !! result
11864 <p><font color="#x">foo</font>
11865 </p>
11866 !! end
11867
11868 !! test
11869 Attribute test: no value
11870 !! input
11871 <font color>foo</font>
11872 !! result
11873 <p><font color="color">foo</font>
11874 </p>
11875 !! end
11876
11877 !! test
11878 Bug 2095: link with three closing brackets
11879 !! input
11880 [[Main Page]]]
11881 !! result
11882 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
11883 </p>
11884 !! end
11885
11886 !! test
11887 Bug 2095: link with pipe and three closing brackets
11888 !! input
11889 [[Main Page|link]]]
11890 !! result
11891 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
11892 </p>
11893 !! end
11894
11895 !! test
11896 Bug 2095: link with pipe and three closing brackets, version 2
11897 !! input
11898 [[Main Page|[http://example.com/]]]
11899 !! result
11900 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
11901 </p>
11902 !! end
11903
11904
11905 ###
11906 ### Safety
11907 ###
11908
11909 !! article
11910 Template:Dangerous attribute
11911 !! text
11912 " onmouseover="alert(document.cookie)
11913 !! endarticle
11914
11915 !! article
11916 Template:Dangerous style attribute
11917 !! text
11918 border-size: expression(alert(document.cookie))
11919 !! endarticle
11920
11921 !! article
11922 Template:Div style
11923 !! text
11924 <div style="float: right; {{{1}}}">Magic div</div>
11925 !! endarticle
11926
11927 !! test
11928 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
11929 !! input
11930 <div title="{{test}}"></div>
11931 !! result
11932 <div title="This is a test template"></div>
11933
11934 !! end
11935
11936 !! test
11937 Bug 2304: HTML attribute safety (dangerous template; 2309)
11938 !! input
11939 <div title="{{dangerous attribute}}"></div>
11940 !! result
11941 <div title=""></div>
11942
11943 !! end
11944
11945 !! test
11946 Bug 2304: HTML attribute safety (dangerous style template; 2309)
11947 !! input
11948 <div style="{{dangerous style attribute}}"></div>
11949 !! result
11950 <div style="/* insecure input */"></div>
11951
11952 !! end
11953
11954 !! test
11955 Bug 2304: HTML attribute safety (safe parameter; 2309)
11956 !! input
11957 {{div style|width: 200px}}
11958 !! result
11959 <div style="float: right; width: 200px">Magic div</div>
11960
11961 !! end
11962
11963 !! test
11964 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
11965 !! input
11966 {{div style|width: expression(alert(document.cookie))}}
11967 !! result
11968 <div style="/* insecure input */">Magic div</div>
11969
11970 !! end
11971
11972 !! test
11973 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
11974 !! input
11975 {{div style|"><script>alert(document.cookie)</script>}}
11976 !! result
11977 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
11978
11979 !! end
11980
11981 !! test
11982 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
11983 !! input
11984 {{div style|" ><script>alert(document.cookie)</script>}}
11985 !! result
11986 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
11987
11988 !! end
11989
11990 !! test
11991 Bug 2304: HTML attribute safety (link)
11992 !! input
11993 <div title="[[Main Page]]"></div>
11994 !! result
11995 <div title="&#91;&#91;Main Page]]"></div>
11996
11997 !! end
11998
11999 !! test
12000 Bug 2304: HTML attribute safety (italics)
12001 !! input
12002 <div title="''foobar''"></div>
12003 !! result
12004 <div title="&#39;&#39;foobar&#39;&#39;"></div>
12005
12006 !! end
12007
12008 !! test
12009 Bug 2304: HTML attribute safety (bold)
12010 !! input
12011 <div title="'''foobar'''"></div>
12012 !! result
12013 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
12014
12015 !! end
12016
12017
12018 !! test
12019 Bug 2304: HTML attribute safety (ISBN)
12020 !! input
12021 <div title="ISBN 1234567890"></div>
12022 !! result
12023 <div title="&#73;SBN 1234567890"></div>
12024
12025 !! end
12026
12027 !! test
12028 Bug 2304: HTML attribute safety (RFC)
12029 !! input
12030 <div title="RFC 1234"></div>
12031 !! result
12032 <div title="&#82;FC 1234"></div>
12033
12034 !! end
12035
12036 !! test
12037 Bug 2304: HTML attribute safety (PMID)
12038 !! input
12039 <div title="PMID 1234567890"></div>
12040 !! result
12041 <div title="&#80;MID 1234567890"></div>
12042
12043 !! end
12044
12045 !! test
12046 Bug 2304: HTML attribute safety (web link)
12047 !! input
12048 <div title="http://example.com/"></div>
12049 !! result
12050 <div title="http&#58;//example.com/"></div>
12051
12052 !! end
12053
12054 !! test
12055 Bug 2304: HTML attribute safety (named web link)
12056 !! input
12057 <div title="[http://example.com/ link]"></div>
12058 !! result
12059 <div title="&#91;http&#58;//example.com/ link]"></div>
12060
12061 !! end
12062
12063 !! test
12064 Bug 3244: HTML attribute safety (extension; safe)
12065 !! input
12066 <div style="<nowiki>background:blue</nowiki>"></div>
12067 !! result
12068 <div style="background:blue"></div>
12069
12070 !! end
12071
12072 !! test
12073 Bug 3244: HTML attribute safety (extension; unsafe)
12074 !! input
12075 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
12076 !! result
12077 <div style="/* insecure input */"></div>
12078
12079 !! end
12080
12081 # More MSIE fun discovered by Tom Gilder
12082
12083 !! test
12084 MSIE CSS safety test: spurious slash
12085 !! input
12086 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
12087 !! result
12088 <div style="/* insecure input */">evil</div>
12089
12090 !! end
12091
12092 !! test
12093 MSIE CSS safety test: hex code
12094 !! input
12095 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
12096 !! result
12097 <div style="/* insecure input */">evil</div>
12098
12099 !! end
12100
12101 !! test
12102 MSIE CSS safety test: comment in url
12103 !! input
12104 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
12105 !! result
12106 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
12107
12108 !! end
12109
12110 !! test
12111 MSIE CSS safety test: comment in expression
12112 !! input
12113 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
12114 !! result
12115 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
12116
12117 !! end
12118
12119 !! test
12120 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
12121 !! input
12122 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
12123 !! result
12124 <p style="/* invalid control char */">A</p>
12125
12126 !! end
12127
12128 !! test
12129 MSIE 6 CSS safety test: Fullwidth (bug 55332)
12130 !! input
12131 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
12132 <div style="top:EXPRESSION(alert())">B</div>
12133 !! result
12134 <p style="/* insecure input */">A</p>
12135 <div style="/* insecure input */">B</div>
12136
12137 !! end
12138
12139 !! test
12140 MSIE 6 CSS safety test: IPA extensions (bug 55332)
12141 !! input
12142 <div style="background-image:uʀʟ(javascript:alert())">A</div>
12143 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
12144 !! result
12145 <div style="/* insecure input */">A</div>
12146 <p style="/* insecure input */">B</p>
12147
12148 !! end
12149
12150 !! test
12151 MSIE 6 CSS safety test: sup/sub script (bug 55332)
12152 !! input
12153 <div style="background-image:url⁽javascript:alert())">A</div>
12154 <div style="background-image:url₍javascript:alert())">B</div>
12155 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
12156 !! result
12157 <div style="/* insecure input */">A</div>
12158 <div style="/* insecure input */">B</div>
12159 <p style="/* insecure input */">C</p>
12160
12161 !! end
12162
12163 !! test
12164 Opera -o-link CSS
12165 !! input
12166 <div
12167 title="&#100;&#97;&#116;&#97;&#58;&#116;&#101;&#120;&#116;&#47;&#104;&#116;&#109;&#108;&#44;&#60;&#105;&#109;&#103;&#32;&#115;&#114;&#99;&#61;&#49;&#32;&#111;&#110;&#101;&#114;&#114;&#111;&#114;&#61;&#97;&#108;&#101;&#114;&#116;&#40;&#49;&#41;&#62;"
12168 style="-o-link:attr(title);-o-link-source:current">X</div>
12169 !! result
12170 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
12171
12172 !! end
12173
12174 !! test
12175 MSIE 6 CSS safety test: Repetition markers (bug 55332)
12176 !! input
12177 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
12178 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
12179 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
12180 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
12181 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
12182 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
12183 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
12184 !! result
12185 <p style="/* insecure input */">A</p>
12186 <p style="/* insecure input */">B</p>
12187 <p style="/* insecure input */">C</p>
12188 <p style="/* insecure input */">D</p>
12189 <p style="/* insecure input */">E</p>
12190 <p style="/* insecure input */">F</p>
12191 <p style="/* insecure input */">G</p>
12192
12193 !! end
12194
12195 !! test
12196 Table attribute legitimate extension
12197 !! input
12198 {|
12199 !+ style="<nowiki>color:blue</nowiki>"| status
12200 |}
12201 !! result
12202 <table>
12203 <tr>
12204 <th style="color:blue"> status
12205 </th></tr></table>
12206
12207 !!end
12208
12209 !! test
12210 Table attribute safety
12211 !! input
12212 {|
12213 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
12214 |}
12215 !! result
12216 <table>
12217 <tr>
12218 <th style="/* insecure input */"> status
12219 </th></tr></table>
12220
12221 !! end
12222
12223 !! test
12224 CSS line continuation 1
12225 !! input
12226 <div style="background-image: u\&#10;rl(test.jpg);"></div>
12227 !! result
12228 <div style="/* insecure input */"></div>
12229
12230 !! end
12231
12232 !! test
12233 CSS line continuation 2
12234 !! input
12235 <div style="background-image: u\&#13;rl(test.jpg); "></div>
12236 !! result
12237 <div style="/* insecure input */"></div>
12238
12239 !! end
12240
12241 !! article
12242 Template:Identity
12243 !! text
12244 {{{1}}}
12245 !! endarticle
12246
12247 !! test
12248 Expansion of multi-line templates in attribute values (bug 6255)
12249 !! input
12250 <div style="background: {{identity|#00FF00}}">-</div>
12251 !! result
12252 <div style="background: #00FF00">-</div>
12253
12254 !! end
12255
12256
12257 !! test
12258 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
12259 !! input
12260 <div style="background:
12261 #00FF00">-</div>
12262 !! result
12263 <div style="background: #00FF00">-</div>
12264
12265 !! end
12266
12267 !! test
12268 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
12269 !! input
12270 <div style="background: &#10;#00FF00">-</div>
12271 !! result
12272 <div style="background: &#10;#00FF00">-</div>
12273
12274 !! end
12275
12276 ###
12277 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
12278 ###
12279 !! test
12280 Parser hook: empty input
12281 !! input
12282 <tag></tag>
12283 !! result
12284 <pre>
12285 ''
12286 array (
12287 )
12288 </pre>
12289
12290 !! end
12291
12292 !! test
12293 Parser hook: empty input using terminated empty elements
12294 !! input
12295 <tag/>
12296 !! result
12297 <pre>
12298 NULL
12299 array (
12300 )
12301 </pre>
12302
12303 !! end
12304
12305 !! test
12306 Parser hook: empty input using terminated empty elements (space before)
12307 !! input
12308 <tag />
12309 !! result
12310 <pre>
12311 NULL
12312 array (
12313 )
12314 </pre>
12315
12316 !! end
12317
12318 !! test
12319 Parser hook: basic input
12320 !! input
12321 <tag>input</tag>
12322 !! result
12323 <pre>
12324 'input'
12325 array (
12326 )
12327 </pre>
12328
12329 !! end
12330
12331
12332 !! test
12333 Parser hook: case insensitive
12334 !! input
12335 <TAG>input</TAG>
12336 !! result
12337 <pre>
12338 'input'
12339 array (
12340 )
12341 </pre>
12342
12343 !! end
12344
12345
12346 !! test
12347 Parser hook: case insensitive, redux
12348 !! input
12349 <TaG>input</TAg>
12350 !! result
12351 <pre>
12352 'input'
12353 array (
12354 )
12355 </pre>
12356
12357 !! end
12358
12359 !! test
12360 Parser hook: nested tags
12361 !! options
12362 noxml
12363 !! input
12364 <tag><tag></tag></tag>
12365 !! result
12366 <pre>
12367 '<tag>'
12368 array (
12369 )
12370 </pre>&lt;/tag&gt;
12371
12372 !! end
12373
12374 !! test
12375 Parser hook: basic arguments
12376 !! input
12377 <tag width=200 height = "100" depth = '50' square></tag>
12378 !! result
12379 <pre>
12380 ''
12381 array (
12382 'width' => '200',
12383 'height' => '100',
12384 'depth' => '50',
12385 'square' => 'square',
12386 )
12387 </pre>
12388
12389 !! end
12390
12391 !! test
12392 Parser hook: argument containing a forward slash (bug 5344)
12393 !! input
12394 <tag filename='/tmp/bla'></tag>
12395 !! result
12396 <pre>
12397 ''
12398 array (
12399 'filename' => '/tmp/bla',
12400 )
12401 </pre>
12402
12403 !! end
12404
12405 !! test
12406 Parser hook: empty input using terminated empty elements (bug 2374)
12407 !! input
12408 <tag foo=bar/>text
12409 !! result
12410 <pre>
12411 NULL
12412 array (
12413 'foo' => 'bar',
12414 )
12415 </pre>text
12416
12417 !! end
12418
12419 # </tag> should be output literally since there is no matching tag that begins it
12420 !! test
12421 Parser hook: basic arguments using terminated empty elements (bug 2374)
12422 !! input
12423 <tag width=200 height = "100" depth = '50' square/>
12424 other stuff
12425 </tag>
12426 !! result
12427 <pre>
12428 NULL
12429 array (
12430 'width' => '200',
12431 'height' => '100',
12432 'depth' => '50',
12433 'square' => 'square',
12434 )
12435 </pre>
12436 <p>other stuff
12437 &lt;/tag&gt;
12438 </p>
12439 !! end
12440
12441 ###
12442 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
12443 ###
12444
12445 !! test
12446 Parser hook: static parser hook not inside a comment
12447 !! input
12448 <statictag>hello, world</statictag>
12449 <statictag action=flush/>
12450 !! result
12451 <p>hello, world
12452 </p>
12453 !! end
12454
12455
12456 !! test
12457 Parser hook: static parser hook inside a comment
12458 !! input
12459 <!-- <statictag>hello, world</statictag> -->
12460 <statictag action=flush/>
12461 !! result
12462 <p><br />
12463 </p>
12464 !! end
12465
12466 # Nested template calls; this case was broken by Parser.php rev 1.506,
12467 # since reverted.
12468
12469 !! article
12470 Template:One-parameter
12471 !! text
12472 (My parameter is: {{{1}}})
12473 !! endarticle
12474
12475 !! article
12476 Template:Map-one-parameter
12477 !! text
12478 {{{{{1}}}|{{{2}}}}}
12479 !! endarticle
12480
12481 !! test
12482 Nested template calls
12483 !! input
12484 {{Map-one-parameter|One-parameter|param}}
12485 !! result
12486 <p>(My parameter is: param)
12487 </p>
12488 !! end
12489
12490
12491 ###
12492 ### Sanitizer
12493 ###
12494 !! test
12495 Sanitizer: Closing of open tags
12496 !! input
12497 <s></s><table></table>
12498 !! result
12499 <s></s><table></table>
12500
12501 !! end
12502
12503 !! test
12504 Sanitizer: Closing of open but not closed tags
12505 !! input
12506 <s>foo
12507 !! result
12508 <p><s>foo</s>
12509 </p>
12510 !! end
12511
12512 !! test
12513 Sanitizer: Closing of closed but not open tags
12514 !! input
12515 </s>
12516 !! result
12517 <p>&lt;/s&gt;
12518 </p>
12519 !! end
12520
12521 !! test
12522 Sanitizer: Closing of closed but not open table tags
12523 !! input
12524 Table not started</td></tr></table>
12525 !! result
12526 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
12527 </p>
12528 !! end
12529
12530 !! test
12531 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
12532 !! input
12533 <span id="æ: v">byte</span>[[#æ: v|backlink]]
12534 !! result
12535 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
12536 </p>
12537 !! end
12538
12539 !! test
12540 Sanitizer: Validating the contents of the id attribute (bug 4515)
12541 !! options
12542 disabled
12543 !! input
12544 <br id=9 />
12545 !! result
12546 Something, but definitely not <br id="9" />...
12547 !! end
12548
12549 !! test
12550 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
12551 !! options
12552 disabled
12553 !! input
12554 <br id="foo" /><br id="foo" />
12555 !! result
12556 Something need to be done. foo-2 ?
12557 !! end
12558
12559 !! test
12560 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
12561 !! input
12562 <div itemscope>
12563 <meta itemprop="hello" content="world">
12564 <meta http-equiv="refresh" content="5">
12565 <meta itemprop="hello" http-equiv="refresh" content="5">
12566 <link itemprop="hello" href="{{SERVER}}">
12567 <link rel="stylesheet" href="{{SERVER}}">
12568 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
12569 </div>
12570 !! result
12571 <div itemscope="itemscope">
12572 <p> <meta itemprop="hello" content="world" />
12573 &lt;meta http-equiv="refresh" content="5"&gt;
12574 <meta itemprop="hello" content="5" />
12575 </p>
12576 <link itemprop="hello" href="http&#58;//example.org" />
12577 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
12578 <link itemprop="hello" href="http&#58;//example.org" />
12579 </div>
12580
12581 !! end
12582
12583 !! test
12584 Language converter: output gets cut off unexpectedly (bug 5757)
12585 !! options
12586 language=zh
12587 !! input
12588 this bit is safe: }-
12589
12590 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
12591
12592 then we get cut off here: }-
12593
12594 all additional text is vanished
12595 !! result
12596 <p>this bit is safe: }-
12597 </p><p>but if we add a conversion instance: xxx
12598 </p><p>then we get cut off here: }-
12599 </p><p>all additional text is vanished
12600 </p>
12601 !! end
12602
12603 !! test
12604 Self closed html pairs (bug 5487)
12605 !! options
12606 !! input
12607 <center><font id="bug" />Centered text</center>
12608 <div><font id="bug2" />In div text</div>
12609 !! result
12610 <center>&lt;font id="bug" /&gt;Centered text</center>
12611 <div>&lt;font id="bug2" /&gt;In div text</div>
12612
12613 !! end
12614
12615 #
12616 #
12617 #
12618
12619 !! test
12620 Punctuation: nbsp before exclamation
12621 !! input
12622 C'est grave !
12623 !! result
12624 <p>C'est grave&#160;!
12625 </p>
12626 !! end
12627
12628 !! test
12629 Punctuation: CSS !important (bug 11874)
12630 !! input
12631 <div style="width:50% !important">important</div>
12632 !! result
12633 <div style="width:50% !important">important</div>
12634
12635 !!end
12636
12637 !! test
12638 Punctuation: CSS ! important (bug 11874; with space after)
12639 !! input
12640 <div style="width:50% ! important">important</div>
12641 !! result
12642 <div style="width:50% ! important">important</div>
12643
12644 !!end
12645
12646
12647 !! test
12648 HTML bullet list, closed tags (bug 5497)
12649 !! input
12650 <ul>
12651 <li>One</li>
12652 <li>Two</li>
12653 </ul>
12654 !! result
12655 <ul>
12656 <li>One</li>
12657 <li>Two</li>
12658 </ul>
12659
12660 !! end
12661
12662 !! test
12663 HTML bullet list, unclosed tags (bug 5497)
12664 !! options
12665 disabled
12666 !! input
12667 <ul>
12668 <li>One
12669 <li>Two
12670 </ul>
12671 !! result
12672 <ul>
12673 <li>One
12674 </li>
12675 <li>Two
12676 </li>
12677 </ul>
12678
12679 !! end
12680
12681 !! test
12682 HTML ordered list, closed tags (bug 5497)
12683 !! input
12684 <ol>
12685 <li>One</li>
12686 <li>Two</li>
12687 </ol>
12688 !! result
12689 <ol>
12690 <li>One</li>
12691 <li>Two</li>
12692 </ol>
12693
12694 !! end
12695
12696 !! test
12697 HTML ordered list, unclosed tags (bug 5497)
12698 !! options
12699 disabled
12700 !! input
12701 <ol>
12702 <li>One
12703 <li>Two
12704 </ol>
12705 !! result
12706 <ol>
12707 <li>One
12708 </li>
12709 <li>Two
12710 </li>
12711 </ol>
12712
12713 !! end
12714
12715 !! test
12716 HTML nested bullet list, closed tags (bug 5497)
12717 !! input
12718 <ul>
12719 <li>One</li>
12720 <li>Two:
12721 <ul>
12722 <li>Sub-one</li>
12723 <li>Sub-two</li>
12724 </ul>
12725 </li>
12726 </ul>
12727 !! result
12728 <ul>
12729 <li>One</li>
12730 <li>Two:
12731 <ul>
12732 <li>Sub-one</li>
12733 <li>Sub-two</li>
12734 </ul>
12735 </li>
12736 </ul>
12737
12738 !! end
12739
12740 !! test
12741 HTML nested bullet list, open tags (bug 5497)
12742 !! options
12743 disabled
12744 !! input
12745 <ul>
12746 <li>One
12747 <li>Two:
12748 <ul>
12749 <li>Sub-one
12750 <li>Sub-two
12751 </ul>
12752 </ul>
12753 !! result
12754 <ul>
12755 <li>One
12756 </li>
12757 <li>Two:
12758 <ul>
12759 <li>Sub-one
12760 </li>
12761 <li>Sub-two
12762 </li>
12763 </ul>
12764 </li>
12765 </ul>
12766
12767 !! end
12768
12769 !! test
12770 HTML nested ordered list, closed tags (bug 5497)
12771 !! input
12772 <ol>
12773 <li>One</li>
12774 <li>Two:
12775 <ol>
12776 <li>Sub-one</li>
12777 <li>Sub-two</li>
12778 </ol>
12779 </li>
12780 </ol>
12781 !! result
12782 <ol>
12783 <li>One</li>
12784 <li>Two:
12785 <ol>
12786 <li>Sub-one</li>
12787 <li>Sub-two</li>
12788 </ol>
12789 </li>
12790 </ol>
12791
12792 !! end
12793
12794 !! test
12795 HTML nested ordered list, open tags (bug 5497)
12796 !! options
12797 disabled
12798 !! input
12799 <ol>
12800 <li>One
12801 <li>Two:
12802 <ol>
12803 <li>Sub-one
12804 <li>Sub-two
12805 </ol>
12806 </ol>
12807 !! result
12808 <ol>
12809 <li>One
12810 </li>
12811 <li>Two:
12812 <ol>
12813 <li>Sub-one
12814 </li>
12815 <li>Sub-two
12816 </li>
12817 </ol>
12818 </li>
12819 </ol>
12820
12821 !! end
12822
12823 !! test
12824 HTML ordered list item with parameters oddity
12825 !! input
12826 <ol><li id="fragment">One</li>
12827 </ol>
12828 !! result
12829 <ol><li id="fragment">One</li>
12830 </ol>
12831
12832 !! end
12833
12834 !!test
12835 bug 5918: autonumbering
12836 !! input
12837 [http://first/] [http://second] [ftp://ftp]
12838
12839 ftp://inlineftp
12840
12841 [mailto:enclosed@mail.tld With target]
12842
12843 [mailto:enclosed@mail.tld]
12844
12845 mailto:inline@mail.tld
12846 !! result
12847 <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>
12848 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
12849 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
12850 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
12851 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
12852 </p>
12853 !! end
12854
12855
12856 #
12857 # Security and HTML correctness
12858 # From Nick Jenkins' fuzz testing
12859 #
12860
12861 !! test
12862 Fuzz testing: Parser13
12863 !! input
12864 {|
12865 | http://a|
12866 !! result
12867 <table>
12868 <tr>
12869 <td>
12870 </td>
12871 </tr>
12872 </table>
12873
12874 !! end
12875
12876 !! test
12877 Fuzz testing: Parser14
12878 !! input
12879 == onmouseover= ==
12880 http://__TOC__
12881 !! result
12882 <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>
12883 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12884 <ul>
12885 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
12886 </ul>
12887 </div>
12888
12889
12890 !! end
12891
12892 !! test
12893 Fuzz testing: Parser14-table
12894 !! input
12895 ==a==
12896 {| STYLE=__TOC__
12897 !! result
12898 <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>
12899 <table style="&#95;_TOC&#95;_">
12900 <tr><td></td></tr>
12901 </table>
12902
12903 !! end
12904
12905 # Known to produce bogus xml (extra </td>)
12906 !! test
12907 Fuzz testing: Parser16
12908 !! options
12909 noxml
12910 !! input
12911 {|
12912 !https://||||||
12913 !! result
12914 <table>
12915 <tr>
12916 <th>https://</th>
12917 <th></th>
12918 <th></th>
12919 <th>
12920 </td>
12921 </tr>
12922 </table>
12923
12924 !! end
12925
12926 !! test
12927 Fuzz testing: Parser21
12928 !! input
12929 {|
12930 ! irc://{{ftp://a" onmouseover="alert('hello world');"
12931 |
12932 !! result
12933 <table>
12934 <tr>
12935 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
12936 </th>
12937 <td>
12938 </td>
12939 </tr>
12940 </table>
12941
12942 !! end
12943
12944 !! test
12945 Fuzz testing: Parser22
12946 !! input
12947 http://===r:::https://b
12948
12949 {|
12950 !!result
12951 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
12952 </p>
12953 <table>
12954 <tr><td></td></tr>
12955 </table>
12956
12957 !! end
12958
12959 # Known to produce bad XML for now
12960 !! test
12961 Fuzz testing: Parser24
12962 !! options
12963 noxml
12964 !! input
12965 {|
12966 {{{|
12967 <u CLASS=
12968 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
12969 <br style="onmouseover='alert(document.cookie);' " />
12970
12971 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
12972 |
12973 !! result
12974 <table>
12975 {{{|
12976 <u class="&#124;">}}}} &gt;
12977 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
12978
12979 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
12980 <tr>
12981 <td></u>
12982 </td>
12983 </tr>
12984 </table>
12985
12986 !! end
12987
12988 # Note: the current result listed for this is not what the original one was,
12989 # but the original bug was JavaScript injection, which is fixed in any case.
12990 # It's not clear that the original result listed was any more correct than the
12991 # current one. Original result:
12992 # <p>{{{|
12993 # </p>
12994 # <li class="&#124;&#124;">
12995 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
12996 !!test
12997 Fuzz testing: Parser25 (bug 6055)
12998 !! input
12999 {{{
13000 |
13001 <LI CLASS=||
13002 >
13003 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
13004 !! result
13005 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
13006 </p>
13007 !! end
13008
13009 !!test
13010 Fuzz testing: URL adjacent extension (with space, clean)
13011 !! options
13012 !! input
13013 http://example.com <nowiki>junk</nowiki>
13014 !! result
13015 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
13016 </p>
13017 !!end
13018
13019 !!test
13020 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
13021 !! options
13022 !! input
13023 http://example.com<nowiki>junk</nowiki>
13024 !! result
13025 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
13026 </p>
13027 !!end
13028
13029 !!test
13030 Fuzz testing: URL adjacent extension (no space, dirty; pre)
13031 !! options
13032 !! input
13033 http://example.com<pre>junk</pre>
13034 !! result
13035 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
13036
13037 !!end
13038
13039 !!test
13040 Fuzz testing: image with bogus manual thumbnail
13041 !!input
13042 [[Image:foobar.jpg|thumbnail= ]]
13043 !!result
13044 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
13045
13046 !!end
13047
13048 !! test
13049 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
13050 !! input
13051 <pre dir="&#10;"></pre>
13052 !! result
13053 <pre dir="&#10;"></pre>
13054
13055 !! end
13056
13057 !! test
13058 Parsing optional HTML elements (Bug 6171)
13059 !! options
13060 !! input
13061 <table>
13062 <tr>
13063 <td> Some tabular data</td>
13064 <td> More tabular data ...
13065 <td> And yet som tabular data</td>
13066 </tr>
13067 </table>
13068 !! result
13069 <table>
13070 <tr>
13071 <td> Some tabular data</td>
13072 <td> More tabular data ...
13073 </td><td> And yet som tabular data</td>
13074 </tr>
13075 </table>
13076
13077 !! end
13078
13079 !! test
13080 Correct handling of <td>, <tr> (Bug 6171)
13081 !! options
13082 !! input
13083 <table>
13084 <tr>
13085 <td> Some tabular data</td>
13086 <td> More tabular data ...</td>
13087 <td> And yet som tabular data</td>
13088 </tr>
13089 </table>
13090 !! result
13091 <table>
13092 <tr>
13093 <td> Some tabular data</td>
13094 <td> More tabular data ...</td>
13095 <td> And yet som tabular data</td>
13096 </tr>
13097 </table>
13098
13099 !! end
13100
13101
13102 !! test
13103 Parsing crashing regression (fr:JavaScript)
13104 !! input
13105 </body></x>
13106 !! result
13107 <p>&lt;/body&gt;&lt;/x&gt;
13108 </p>
13109 !! end
13110
13111 !! test
13112 Inline wiki vs wiki block nesting
13113 !! input
13114 '''Bold paragraph
13115
13116 New wiki paragraph
13117 !! result
13118 <p><b>Bold paragraph</b>
13119 </p><p>New wiki paragraph
13120 </p>
13121 !! end
13122
13123 !! test
13124 Inline HTML vs wiki block nesting
13125 !! options
13126 disabled
13127 !! input
13128 <b>Bold paragraph
13129
13130 New wiki paragraph
13131 !! result
13132 <p><b>Bold paragraph</b>
13133 </p><p>New wiki paragraph
13134 </p>
13135 !! end
13136
13137 # Original result was this:
13138 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
13139 # </p>
13140 # While that might be marginally more intuitive, maybe, the six-apostrophe
13141 # construct is clearly pathological and the result stated here (which is what
13142 # the parser actually does) is about as reasonable as anything.
13143 !!test
13144 Mixing markup for italics and bold
13145 !! options
13146 !! input
13147 '''bold''''''bold''bolditalics'''''
13148 !! result
13149 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
13150 </p>
13151 !! end
13152
13153
13154 !! article
13155 Xyzzyx
13156 !! text
13157 Article for special page transclusion test
13158 !! endarticle
13159
13160 !! test
13161 Special page transclusion
13162 !! options
13163 !! input
13164 {{Special:Prefixindex/Xyzzyx}}
13165 !! result
13166 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13167
13168 !! end
13169
13170 !! test
13171 Special page transclusion twice (bug 5021)
13172 !! options
13173 !! input
13174 {{Special:Prefixindex/Xyzzyx}}
13175 {{Special:Prefixindex/Xyzzyx}}
13176 !! result
13177 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13178 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13179
13180 !! end
13181
13182 !! test
13183 Transclusion of default MediaWiki message
13184 !! input
13185 {{MediaWiki:Mainpage}}
13186 !!result
13187 <p>Main Page
13188 </p>
13189 !! end
13190
13191 !! test
13192 Transclusion of nonexistent MediaWiki message
13193 !! input
13194 {{MediaWiki:Mainpagexxx}}
13195 !!result
13196 <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>
13197 </p>
13198 !! end
13199
13200 !! test
13201 Transclusion of MediaWiki message with underscore
13202 !! input
13203 {{MediaWiki:history_short}}
13204 !! result
13205 <p>History
13206 </p>
13207 !! end
13208
13209 !! test
13210 Transclusion of MediaWiki message with space
13211 !! input
13212 {{MediaWiki:history short}}
13213 !! result
13214 <p>History
13215 </p>
13216 !! end
13217
13218 !! test
13219 Invalid header with following text
13220 !! input
13221 = x = y
13222 !! result
13223 <p>= x = y
13224 </p>
13225 !! end
13226
13227
13228 !! test
13229 Section extraction test (section 0)
13230 !! options
13231 section=0
13232 !! input
13233 start
13234 ==a==
13235 ===aa===
13236 ====aaa====
13237 ==b==
13238 ===ba===
13239 ===bb===
13240 ====bba====
13241 ===bc===
13242 ==c==
13243 ===ca===
13244 !! result
13245 start
13246 !! end
13247
13248 !! test
13249 Section extraction test (section 1)
13250 !! options
13251 section=1
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 ==a==
13266 ===aa===
13267 ====aaa====
13268 !! end
13269
13270 !! test
13271 Section extraction test (section 2)
13272 !! options
13273 section=2
13274 !! input
13275 start
13276 ==a==
13277 ===aa===
13278 ====aaa====
13279 ==b==
13280 ===ba===
13281 ===bb===
13282 ====bba====
13283 ===bc===
13284 ==c==
13285 ===ca===
13286 !! result
13287 ===aa===
13288 ====aaa====
13289 !! end
13290
13291 !! test
13292 Section extraction test (section 3)
13293 !! options
13294 section=3
13295 !! input
13296 start
13297 ==a==
13298 ===aa===
13299 ====aaa====
13300 ==b==
13301 ===ba===
13302 ===bb===
13303 ====bba====
13304 ===bc===
13305 ==c==
13306 ===ca===
13307 !! result
13308 ====aaa====
13309 !! end
13310
13311 !! test
13312 Section extraction test (section 4)
13313 !! options
13314 section=4
13315 !! input
13316 start
13317 ==a==
13318 ===aa===
13319 ====aaa====
13320 ==b==
13321 ===ba===
13322 ===bb===
13323 ====bba====
13324 ===bc===
13325 ==c==
13326 ===ca===
13327 !! result
13328 ==b==
13329 ===ba===
13330 ===bb===
13331 ====bba====
13332 ===bc===
13333 !! end
13334
13335 !! test
13336 Section extraction test (section 5)
13337 !! options
13338 section=5
13339 !! input
13340 start
13341 ==a==
13342 ===aa===
13343 ====aaa====
13344 ==b==
13345 ===ba===
13346 ===bb===
13347 ====bba====
13348 ===bc===
13349 ==c==
13350 ===ca===
13351 !! result
13352 ===ba===
13353 !! end
13354
13355 !! test
13356 Section extraction test (section 6)
13357 !! options
13358 section=6
13359 !! input
13360 start
13361 ==a==
13362 ===aa===
13363 ====aaa====
13364 ==b==
13365 ===ba===
13366 ===bb===
13367 ====bba====
13368 ===bc===
13369 ==c==
13370 ===ca===
13371 !! result
13372 ===bb===
13373 ====bba====
13374 !! end
13375
13376 !! test
13377 Section extraction test (section 7)
13378 !! options
13379 section=7
13380 !! input
13381 start
13382 ==a==
13383 ===aa===
13384 ====aaa====
13385 ==b==
13386 ===ba===
13387 ===bb===
13388 ====bba====
13389 ===bc===
13390 ==c==
13391 ===ca===
13392 !! result
13393 ====bba====
13394 !! end
13395
13396 !! test
13397 Section extraction test (section 8)
13398 !! options
13399 section=8
13400 !! input
13401 start
13402 ==a==
13403 ===aa===
13404 ====aaa====
13405 ==b==
13406 ===ba===
13407 ===bb===
13408 ====bba====
13409 ===bc===
13410 ==c==
13411 ===ca===
13412 !! result
13413 ===bc===
13414 !! end
13415
13416 !! test
13417 Section extraction test (section 9)
13418 !! options
13419 section=9
13420 !! input
13421 start
13422 ==a==
13423 ===aa===
13424 ====aaa====
13425 ==b==
13426 ===ba===
13427 ===bb===
13428 ====bba====
13429 ===bc===
13430 ==c==
13431 ===ca===
13432 !! result
13433 ==c==
13434 ===ca===
13435 !! end
13436
13437 !! test
13438 Section extraction test (section 10)
13439 !! options
13440 section=10
13441 !! input
13442 start
13443 ==a==
13444 ===aa===
13445 ====aaa====
13446 ==b==
13447 ===ba===
13448 ===bb===
13449 ====bba====
13450 ===bc===
13451 ==c==
13452 ===ca===
13453 !! result
13454 ===ca===
13455 !! end
13456
13457 !! test
13458 Section extraction test (nonexistent section 11)
13459 !! options
13460 section=11
13461 !! input
13462 start
13463 ==a==
13464 ===aa===
13465 ====aaa====
13466 ==b==
13467 ===ba===
13468 ===bb===
13469 ====bba====
13470 ===bc===
13471 ==c==
13472 ===ca===
13473 !! result
13474 !! end
13475
13476 !! test
13477 Section extraction test with bogus heading (section 1)
13478 !! options
13479 section=1
13480 !! input
13481 ==a==
13482 ==bogus== not a legal section
13483 ==b==
13484 !! result
13485 ==a==
13486 ==bogus== not a legal section
13487 !! end
13488
13489 !! test
13490 Section extraction test with bogus heading (section 2)
13491 !! options
13492 section=2
13493 !! input
13494 ==a==
13495 ==bogus== not a legal section
13496 ==b==
13497 !! result
13498 ==b==
13499 !! end
13500
13501 !! test
13502 Section extraction test with comment after heading (section 1)
13503 !! options
13504 section=1
13505 !! input
13506 ==a==
13507 ==b== <!-- -->
13508 ==c==
13509 !! result
13510 ==a==
13511 !! end
13512
13513 !! test
13514 Section extraction test with comment after heading (section 2)
13515 !! options
13516 section=2
13517 !! input
13518 ==a==
13519 ==b== <!-- -->
13520 ==c==
13521 !! result
13522 ==b== <!-- -->
13523 !! end
13524
13525 !! test
13526 Section extraction test with bogus <nowiki> heading (section 1)
13527 !! options
13528 section=1
13529 !! input
13530 ==a==
13531 ==bogus== <nowiki>not a legal section</nowiki>
13532 ==b==
13533 !! result
13534 ==a==
13535 ==bogus== <nowiki>not a legal section</nowiki>
13536 !! end
13537
13538 !! test
13539 Section extraction test with bogus <nowiki> heading (section 2)
13540 !! options
13541 section=2
13542 !! input
13543 ==a==
13544 ==bogus== <nowiki>not a legal section</nowiki>
13545 ==b==
13546 !! result
13547 ==b==
13548 !! end
13549
13550
13551 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
13552 # instead of respecting commented sections
13553 !! test
13554 Section extraction prefixed by comment (section 1)
13555 !! options
13556 section=1
13557 !! input
13558 <!-- -->==sec1==
13559 ==sec2==
13560 !!result
13561 ==sec2==
13562 !!end
13563
13564 !! test
13565 Section extraction prefixed by comment (section 2)
13566 !! options
13567 section=2
13568 !! input
13569 <!-- -->==sec1==
13570 ==sec2==
13571 !!result
13572
13573 !!end
13574
13575
13576 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
13577 # instead of respecting HTML-style headings
13578 !! test
13579 Section extraction, mixed wiki and html (section 1)
13580 !! options
13581 section=1
13582 !! input
13583 <h2>unmarked</h2>
13584 unmarked
13585 ==1==
13586 one
13587 ==2==
13588 two
13589 !! result
13590 ==1==
13591 one
13592 !! end
13593
13594 !! test
13595 Section extraction, mixed wiki and html (section 2)
13596 !! options
13597 section=2
13598 !! input
13599 <h2>unmarked</h2>
13600 unmarked
13601 ==1==
13602 one
13603 ==2==
13604 two
13605 !! result
13606 ==2==
13607 two
13608 !! end
13609
13610
13611 # Formerly testing for bug 3342
13612 !! test
13613 Section extraction, heading surrounded by <noinclude>
13614 !! options
13615 section=1
13616 !! input
13617 <noinclude>==unmarked==</noinclude>
13618 ==marked==
13619 !! result
13620 ==marked==
13621 !!end
13622
13623 # Test behavior of bug 19910
13624 !! test
13625 Sectiion with all-equals
13626 !! options
13627 section=2
13628 !! input
13629 ===
13630 The line above must have a trailing space
13631 === <!--
13632 --> <!-- -->
13633 But just in case it doesn't...
13634 !! result
13635 === <!--
13636 --> <!-- -->
13637 But just in case it doesn't...
13638 !! end
13639
13640 !! test
13641 Section replacement test (section 0)
13642 !! options
13643 replace=0,"xxx"
13644 !! input
13645 start
13646 ==a==
13647 ===aa===
13648 ====aaa====
13649 ==b==
13650 ===ba===
13651 ===bb===
13652 ====bba====
13653 ===bc===
13654 ==c==
13655 ===ca===
13656 !! result
13657 xxx
13658
13659 ==a==
13660 ===aa===
13661 ====aaa====
13662 ==b==
13663 ===ba===
13664 ===bb===
13665 ====bba====
13666 ===bc===
13667 ==c==
13668 ===ca===
13669 !! end
13670
13671 !! test
13672 Section replacement test (section 1)
13673 !! options
13674 replace=1,"xxx"
13675 !! input
13676 start
13677 ==a==
13678 ===aa===
13679 ====aaa====
13680 ==b==
13681 ===ba===
13682 ===bb===
13683 ====bba====
13684 ===bc===
13685 ==c==
13686 ===ca===
13687 !! result
13688 start
13689 xxx
13690
13691 ==b==
13692 ===ba===
13693 ===bb===
13694 ====bba====
13695 ===bc===
13696 ==c==
13697 ===ca===
13698 !! end
13699
13700 !! test
13701 Section replacement test (section 2)
13702 !! options
13703 replace=2,"xxx"
13704 !! input
13705 start
13706 ==a==
13707 ===aa===
13708 ====aaa====
13709 ==b==
13710 ===ba===
13711 ===bb===
13712 ====bba====
13713 ===bc===
13714 ==c==
13715 ===ca===
13716 !! result
13717 start
13718 ==a==
13719 xxx
13720
13721 ==b==
13722 ===ba===
13723 ===bb===
13724 ====bba====
13725 ===bc===
13726 ==c==
13727 ===ca===
13728 !! end
13729
13730 !! test
13731 Section replacement test (section 3)
13732 !! options
13733 replace=3,"xxx"
13734 !! input
13735 start
13736 ==a==
13737 ===aa===
13738 ====aaa====
13739 ==b==
13740 ===ba===
13741 ===bb===
13742 ====bba====
13743 ===bc===
13744 ==c==
13745 ===ca===
13746 !! result
13747 start
13748 ==a==
13749 ===aa===
13750 xxx
13751
13752 ==b==
13753 ===ba===
13754 ===bb===
13755 ====bba====
13756 ===bc===
13757 ==c==
13758 ===ca===
13759 !! end
13760
13761 !! test
13762 Section replacement test (section 4)
13763 !! options
13764 replace=4,"xxx"
13765 !! input
13766 start
13767 ==a==
13768 ===aa===
13769 ====aaa====
13770 ==b==
13771 ===ba===
13772 ===bb===
13773 ====bba====
13774 ===bc===
13775 ==c==
13776 ===ca===
13777 !! result
13778 start
13779 ==a==
13780 ===aa===
13781 ====aaa====
13782 xxx
13783
13784 ==c==
13785 ===ca===
13786 !! end
13787
13788 !! test
13789 Section replacement test (section 5)
13790 !! options
13791 replace=5,"xxx"
13792 !! input
13793 start
13794 ==a==
13795 ===aa===
13796 ====aaa====
13797 ==b==
13798 ===ba===
13799 ===bb===
13800 ====bba====
13801 ===bc===
13802 ==c==
13803 ===ca===
13804 !! result
13805 start
13806 ==a==
13807 ===aa===
13808 ====aaa====
13809 ==b==
13810 xxx
13811
13812 ===bb===
13813 ====bba====
13814 ===bc===
13815 ==c==
13816 ===ca===
13817 !! end
13818
13819 !! test
13820 Section replacement test (section 6)
13821 !! options
13822 replace=6,"xxx"
13823 !! input
13824 start
13825 ==a==
13826 ===aa===
13827 ====aaa====
13828 ==b==
13829 ===ba===
13830 ===bb===
13831 ====bba====
13832 ===bc===
13833 ==c==
13834 ===ca===
13835 !! result
13836 start
13837 ==a==
13838 ===aa===
13839 ====aaa====
13840 ==b==
13841 ===ba===
13842 xxx
13843
13844 ===bc===
13845 ==c==
13846 ===ca===
13847 !! end
13848
13849 !! test
13850 Section replacement test (section 7)
13851 !! options
13852 replace=7,"xxx"
13853 !! input
13854 start
13855 ==a==
13856 ===aa===
13857 ====aaa====
13858 ==b==
13859 ===ba===
13860 ===bb===
13861 ====bba====
13862 ===bc===
13863 ==c==
13864 ===ca===
13865 !! result
13866 start
13867 ==a==
13868 ===aa===
13869 ====aaa====
13870 ==b==
13871 ===ba===
13872 ===bb===
13873 xxx
13874
13875 ===bc===
13876 ==c==
13877 ===ca===
13878 !! end
13879
13880 !! test
13881 Section replacement test (section 8)
13882 !! options
13883 replace=8,"xxx"
13884 !! input
13885 start
13886 ==a==
13887 ===aa===
13888 ====aaa====
13889 ==b==
13890 ===ba===
13891 ===bb===
13892 ====bba====
13893 ===bc===
13894 ==c==
13895 ===ca===
13896 !! result
13897 start
13898 ==a==
13899 ===aa===
13900 ====aaa====
13901 ==b==
13902 ===ba===
13903 ===bb===
13904 ====bba====
13905 xxx
13906
13907 ==c==
13908 ===ca===
13909 !!end
13910
13911 !! test
13912 Section replacement test (section 9)
13913 !! options
13914 replace=9,"xxx"
13915 !! input
13916 start
13917 ==a==
13918 ===aa===
13919 ====aaa====
13920 ==b==
13921 ===ba===
13922 ===bb===
13923 ====bba====
13924 ===bc===
13925 ==c==
13926 ===ca===
13927 !! result
13928 start
13929 ==a==
13930 ===aa===
13931 ====aaa====
13932 ==b==
13933 ===ba===
13934 ===bb===
13935 ====bba====
13936 ===bc===
13937 xxx
13938 !! end
13939
13940 !! test
13941 Section replacement test (section 10)
13942 !! options
13943 replace=10,"xxx"
13944 !! input
13945 start
13946 ==a==
13947 ===aa===
13948 ====aaa====
13949 ==b==
13950 ===ba===
13951 ===bb===
13952 ====bba====
13953 ===bc===
13954 ==c==
13955 ===ca===
13956 !! result
13957 start
13958 ==a==
13959 ===aa===
13960 ====aaa====
13961 ==b==
13962 ===ba===
13963 ===bb===
13964 ====bba====
13965 ===bc===
13966 ==c==
13967 xxx
13968 !! end
13969
13970 !! test
13971 Section replacement test with initial whitespace (bug 13728)
13972 !! options
13973 replace=2,"xxx"
13974 !! input
13975 Preformatted initial line
13976 ==a==
13977 ===a===
13978 !! result
13979 Preformatted initial line
13980 ==a==
13981 xxx
13982 !! end
13983
13984
13985 !! test
13986 Section extraction, heading followed by pre with 20 spaces (bug 6398)
13987 !! options
13988 section=1
13989 !! input
13990 ==a==
13991 a
13992 !! result
13993 ==a==
13994 a
13995 !! end
13996
13997 !! test
13998 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
13999 !! options
14000 section=1
14001 !! input
14002 ==a==
14003 a
14004 !! result
14005 ==a==
14006 a
14007 !! end
14008
14009
14010 !! test
14011 Section extraction, <pre> around bogus header (bug 10309)
14012 !! options
14013 noxml section=2
14014 !! input
14015 == Section One ==
14016 <pre>
14017 =======
14018 </pre>
14019
14020 == Section Two ==
14021 stuff
14022 !! result
14023 == Section Two ==
14024 stuff
14025 !! end
14026
14027 !! test
14028 Section replacement, <pre> around bogus header (bug 10309)
14029 !! options
14030 noxml replace=2,"xxx"
14031 !! input
14032 == Section One ==
14033 <pre>
14034 =======
14035 </pre>
14036
14037 == Section Two ==
14038 stuff
14039 !! result
14040 == Section One ==
14041 <pre>
14042 =======
14043 </pre>
14044
14045 xxx
14046 !! end
14047
14048
14049
14050 !! test
14051 Handling of &#x0A; in URLs
14052 !! input
14053 **irc://&#x0A;a
14054 !! result
14055 <ul>
14056 <li><ul>
14057 <li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
14058 </li>
14059 </ul>
14060 </li>
14061 </ul>
14062
14063 !!end
14064
14065 !! test
14066 5 quotes, code coverage +1 line (php)
14067 !! options
14068 php
14069 !! input
14070 '''''
14071 !! result
14072 !! end
14073 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
14074 !! test
14075 5 quotes, code coverage +1 line (parsoid)
14076 !! options
14077 parsoid
14078 !! input
14079 '''''
14080 !! result
14081 <p><b><i></i></b></p>
14082 !! end
14083
14084 !! test
14085 Special:Search page linking.
14086 !! input
14087 {{Special:search}}
14088 !! result
14089 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
14090 </p>
14091 !! end
14092
14093 !! test
14094 Say the magic word
14095 !! options
14096 title=[[Parser test]]
14097 !! input
14098 * {{PAGENAME}}
14099 * {{PAGENAMEE}}
14100 * {{FULLPAGENAME}}
14101 * {{FULLPAGENAMEE}}
14102 * {{BASEPAGENAME}}
14103 * {{BASEPAGENAMEE}}
14104 * {{SUBPAGENAME}}
14105 * {{SUBPAGENAMEE}}
14106 * {{ROOTPAGENAME}}
14107 * {{ROOTPAGENAMEE}}
14108 * {{TALKPAGENAME}}
14109 * {{TALKPAGENAMEE}}
14110 * {{SUBJECTPAGENAME}}
14111 * {{SUBJECTPAGENAMEE}}
14112 * {{NAMESPACEE}}
14113 * {{NAMESPACE}}
14114 * {{NAMESPACENUMBER}}
14115 * {{TALKSPACE}}
14116 * {{TALKSPACEE}}
14117 * {{SUBJECTSPACE}}
14118 * {{SUBJECTSPACEE}}
14119 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
14120 !! result
14121 <ul>
14122 <li> Parser test
14123 </li>
14124 <li> Parser_test
14125 </li>
14126 <li> Parser test
14127 </li>
14128 <li> Parser_test
14129 </li>
14130 <li> Parser test
14131 </li>
14132 <li> Parser_test
14133 </li>
14134 <li> Parser test
14135 </li>
14136 <li> Parser_test
14137 </li>
14138 <li> Parser test
14139 </li>
14140 <li> Parser_test
14141 </li>
14142 <li> Talk:Parser test
14143 </li>
14144 <li> Talk:Parser_test
14145 </li>
14146 <li> Parser test
14147 </li>
14148 <li> Parser_test
14149 </li>
14150 <li>
14151 </li>
14152 <li>
14153 </li>
14154 <li> 0
14155 </li>
14156 <li> Talk
14157 </li>
14158 <li> Talk
14159 </li>
14160 <li>
14161 </li>
14162 <li>
14163 </li>
14164 <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>
14165 </li>
14166 </ul>
14167
14168 !! end
14169 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
14170
14171 !! test
14172 Gallery
14173 !! input
14174 <gallery>
14175 image1.png |
14176 image2.gif|||||
14177
14178 image3|
14179 image4 |300px| centre
14180 image5.svg| http://///////
14181 [[x|xx]]]]
14182 * image6
14183 </gallery>
14184 !! result
14185 <ul class="gallery mw-gallery-traditional">
14186 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14187 <div class="thumb" style="height: 150px;">Image1.png</div>
14188 <div class="gallerytext">
14189 </div>
14190 </div></li>
14191 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14192 <div class="thumb" style="height: 150px;">Image2.gif</div>
14193 <div class="gallerytext">
14194 <p>||||
14195 </p>
14196 </div>
14197 </div></li>
14198 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14199 <div class="thumb" style="height: 150px;">Image3</div>
14200 <div class="gallerytext">
14201 </div>
14202 </div></li>
14203 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14204 <div class="thumb" style="height: 150px;">Image4</div>
14205 <div class="gallerytext">
14206 <p>300px| centre
14207 </p>
14208 </div>
14209 </div></li>
14210 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14211 <div class="thumb" style="height: 150px;">Image5.svg</div>
14212 <div class="gallerytext">
14213 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
14214 </p>
14215 </div>
14216 </div></li>
14217 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14218 <div class="thumb" style="height: 150px;">* image6</div>
14219 <div class="gallerytext">
14220 </div>
14221 </div></li>
14222 </ul>
14223
14224 !! end
14225
14226 !! test
14227 Gallery (with options)
14228 !! input
14229 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
14230 File:Nonexistant.jpg|caption
14231 File:Nonexistant.jpg
14232 image:foobar.jpg|some '''caption''' [[Main Page]]
14233 image:foobar.jpg
14234 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
14235 </gallery>
14236 !! result
14237 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
14238 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
14239 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14240 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
14241 <div class="gallerytext">
14242 <p>caption
14243 </p>
14244 </div>
14245 </div></li>
14246 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14247 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
14248 <div class="gallerytext">
14249 </div>
14250 </div></li>
14251 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14252 <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>
14253 <div class="gallerytext">
14254 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
14255 </p>
14256 </div>
14257 </div></li>
14258 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14259 <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>
14260 <div class="gallerytext">
14261 </div>
14262 </div></li>
14263 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14264 <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>
14265 <div class="gallerytext">
14266 <p>Blabla|blabla.
14267 </p>
14268 </div>
14269 </div></li>
14270 </ul>
14271
14272 !! end
14273
14274 !! test
14275 Gallery with wikitext inside caption
14276 !! input
14277 <gallery>
14278 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
14279 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
14280 </gallery>
14281 !! result
14282 <ul class="gallery mw-gallery-traditional">
14283 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14284 <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>
14285 <div class="gallerytext">
14286 <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>
14287 </p>
14288 </div>
14289 </div></li>
14290 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14291 <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>
14292 <div class="gallerytext">
14293 <p>This is a test template
14294 </p>
14295 </div>
14296 </div></li>
14297 </ul>
14298
14299 !! end
14300
14301 !! test
14302 gallery (with showfilename option)
14303 !! input
14304 <gallery showfilename>
14305 File:Nonexistant.jpg|caption
14306 File:Nonexistant.jpg
14307 image:foobar.jpg|some '''caption''' [[Main Page]]
14308 File:Foobar.jpg
14309 </gallery>
14310 !! result
14311 <ul class="gallery mw-gallery-traditional">
14312 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14313 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14314 <div class="gallerytext">
14315 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
14316 caption
14317 </p>
14318 </div>
14319 </div></li>
14320 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14321 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14322 <div class="gallerytext">
14323 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
14324 </p>
14325 </div>
14326 </div></li>
14327 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14328 <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>
14329 <div class="gallerytext">
14330 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
14331 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
14332 </p>
14333 </div>
14334 </div></li>
14335 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14336 <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>
14337 <div class="gallerytext">
14338 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
14339 </p>
14340 </div>
14341 </div></li>
14342 </ul>
14343
14344 !! end
14345
14346 !! test
14347 Gallery (with namespace-less filenames)
14348 !! input
14349 <gallery>
14350 File:Nonexistant.jpg
14351 Nonexistant.jpg
14352 image:foobar.jpg
14353 foobar.jpg
14354 </gallery>
14355 !! result
14356 <ul class="gallery mw-gallery-traditional">
14357 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14358 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14359 <div class="gallerytext">
14360 </div>
14361 </div></li>
14362 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14363 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14364 <div class="gallerytext">
14365 </div>
14366 </div></li>
14367 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14368 <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>
14369 <div class="gallerytext">
14370 </div>
14371 </div></li>
14372 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14373 <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>
14374 <div class="gallerytext">
14375 </div>
14376 </div></li>
14377 </ul>
14378
14379 !! end
14380
14381 !! test
14382 HTML Hex character encoding (spells the word "JavaScript")
14383 !! input
14384 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
14385 !! result
14386 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
14387 </p>
14388 !! end
14389
14390 !! test
14391 HTML Hex character encoding bogus encoding (bug 26437 regression check)
14392 !! input
14393 &#xsee;&#XSEE;
14394 !! result
14395 <p>&amp;#xsee;&amp;#XSEE;
14396 </p>
14397 !! end
14398
14399 !! test
14400 HTML Hex character encoding mixed case
14401 !! input
14402 &#xEE;&#Xee;
14403 !! result
14404 <p>&#xee;&#xee;
14405 </p>
14406 !! end
14407
14408 !! test
14409 __FORCETOC__ override
14410 !! input
14411 __NEWSECTIONLINK__
14412 __FORCETOC__
14413 !! result
14414 <p><br />
14415 </p>
14416 !! end
14417
14418 !! test
14419 ISBN code coverage
14420 !! input
14421 ISBN 978-0-1234-56&#x20;789
14422 !! result
14423 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
14424 </p>
14425 !! end
14426
14427 !! test
14428 ISBN followed by 5 spaces
14429 !! input
14430 ISBN
14431 !! result
14432 <p>ISBN
14433 </p>
14434 !! end
14435
14436 !! test
14437 Double ISBN
14438 !! input
14439 ISBN ISBN 1234567890
14440 !! result
14441 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
14442 </p>
14443 !! end
14444
14445 !! test
14446 Bug 22905: <abbr> followed by ISBN followed by </a>
14447 !! input
14448 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
14449 !! result
14450 <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>
14451 </p>
14452 !! end
14453
14454 !! test
14455 Double RFC
14456 !! input
14457 RFC RFC 1234
14458 !! result
14459 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
14460 </p>
14461 !! end
14462
14463 !! test
14464 Double RFC with a wiki link
14465 !! input
14466 RFC [[RFC 1234]]
14467 !! result
14468 <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>
14469 </p>
14470 !! end
14471
14472 !! test
14473 RFC code coverage
14474 !! input
14475 RFC 983&#x20;987
14476 !! result
14477 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
14478 </p>
14479 !! end
14480
14481 !! test
14482 Centre-aligned image
14483 !! input
14484 [[Image:foobar.jpg|centre]]
14485 !! result
14486 <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>
14487
14488 !!end
14489
14490 !! test
14491 None-aligned image
14492 !! input
14493 [[Image:foobar.jpg|none]]
14494 !! result
14495 <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>
14496
14497 !!end
14498
14499 !! test
14500 Width + Height sized image (using px) (height is ignored)
14501 !! input
14502 [[Image:foobar.jpg|640x480px]]
14503 !! result
14504 <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>
14505 </p>
14506 !!end
14507
14508 !! test
14509 Width-sized image (using px, no following whitespace)
14510 !! input
14511 [[Image:foobar.jpg|640px]]
14512 !! result
14513 <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>
14514 </p>
14515 !!end
14516
14517 !! test
14518 Width-sized image (using px, with following whitespace - test regression from r39467)
14519 !! input
14520 [[Image:foobar.jpg|640px ]]
14521 !! result
14522 <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>
14523 </p>
14524 !!end
14525
14526 !! test
14527 Width-sized image (using px, with preceding whitespace - test regression from r39467)
14528 !! input
14529 [[Image:foobar.jpg| 640px]]
14530 !! result
14531 <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>
14532 </p>
14533 !!end
14534
14535 !! test
14536 Another italics / bold test
14537 !! input
14538 ''' ''x'
14539 !! result
14540 <pre>'<i> </i>x'
14541 </pre>
14542 !!end
14543
14544 # Note the results may be incorrect, as parserTest output included this:
14545 # XML error: Mismatched tag at byte 6120:
14546 # ...<dd> </dt></dl> </dd...
14547 !! test
14548 dt/dd/dl test
14549 !! options
14550 disabled
14551 !! input
14552 :;;;::
14553 !! result
14554 <dl>
14555 <dd><dl>
14556 <dt><dl>
14557 <dt><dl>
14558 <dt><dl>
14559 <dd><dl>
14560 <dd>
14561 </dd>
14562 </dl>
14563 </dd>
14564 </dl>
14565 </dt>
14566 </dl>
14567 </dt>
14568 </dl>
14569 </dt>
14570 </dl>
14571 </dd>
14572 </dl>
14573
14574 !!end
14575
14576
14577 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
14578 !! test
14579 Images with the "|" character in the comment
14580 !! input
14581 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
14582 !! result
14583 <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>
14584
14585 !!end
14586
14587 !! test
14588 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
14589 !! input
14590 <html><script>alert(1);</script></html>
14591 !! result
14592 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
14593 </p>
14594 !! end
14595
14596 !! test
14597 HTML with raw HTML ($wgRawHtml==true)
14598 !! options
14599 wgRawHtml=1
14600 !! input
14601 <html><script>alert(1);</script></html>
14602 !! result
14603 <p><script>alert(1);</script>
14604 </p>
14605 !! end
14606
14607 !! test
14608 Parents of subpages, one level up
14609 !! options
14610 subpage title=[[Subpage test/L1/L2/L3]]
14611 !! input
14612 [[../|L2]]
14613 !! result
14614 <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>
14615 </p>
14616 !! end
14617
14618
14619 !! test
14620 Parents of subpages, one level up, not named
14621 !! options
14622 subpage title=[[Subpage test/L1/L2/L3]]
14623 !! input
14624 [[../]]
14625 !! result
14626 <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>
14627 </p>
14628 !! end
14629
14630
14631
14632 !! test
14633 Parents of subpages, two levels up
14634 !! options
14635 subpage title=[[Subpage test/L1/L2/L3]]
14636 !! input
14637 [[../../|L1]]2
14638
14639 [[../../|L1]]l
14640 !! result
14641 <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
14642 </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>
14643 </p>
14644 !! end
14645
14646 !! test
14647 Parents of subpages, two levels up, without trailing slash or name.
14648 !! options
14649 subpage title=[[Subpage test/L1/L2/L3]]
14650 !! input
14651 [[../..]]
14652 !! result
14653 <p>[[../..]]
14654 </p>
14655 !! end
14656
14657 !! test
14658 Parents of subpages, two levels up, with lots of extra trailing slashes.
14659 !! options
14660 subpage title=[[Subpage test/L1/L2/L3]]
14661 !! input
14662 [[../../////]]
14663 !! result
14664 <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>
14665 </p>
14666 !! end
14667
14668 !! article
14669 Subpage test/L1/L2/L3Sibling
14670 !! text
14671 Sibling article
14672 !! endarticle
14673
14674 !! test
14675 Transclusion of a sibling page (one level up)
14676 !! options
14677 subpage title=[[Subpage test/L1/L2/L3]]
14678 !! input
14679 {{../L3Sibling}}
14680 !! result
14681 <p>Sibling article
14682 </p>
14683 !! end
14684
14685 !! test
14686 Transclusion of a child page
14687 !! options
14688 subpage title=[[Subpage test/L1/L2]]
14689 !! input
14690 {{/L3Sibling}}
14691 !! result
14692 <p>Sibling article
14693 </p>
14694 !! end
14695
14696 !! test
14697 Non-transclusion because of too many up levels
14698 !! options
14699 subpage title=[[Subpage test/L1/L2/L3]]
14700 !! input
14701 {{../../../../More than parent}}
14702 !! result
14703 <p>{{../../../../More than parent}}
14704 </p>
14705 !! end
14706
14707 !! test
14708 Definition list code coverage
14709 !! input
14710 ; title : def
14711 ; title : def
14712 ;title: def
14713 !! result
14714 <dl>
14715 <dt> title &#160;</dt>
14716 <dd> def
14717 </dd>
14718 <dt> title&#160;</dt>
14719 <dd> def
14720 </dd>
14721 <dt>title</dt>
14722 <dd> def
14723 </dd>
14724 </dl>
14725
14726 !! end
14727
14728 !! test
14729 Don't fall for the self-closing div
14730 !! input
14731 <div>hello world</div/>
14732 !! result
14733 <div>hello world</div>
14734
14735 !! end
14736
14737 !! test
14738 MSGNW magic word
14739 !! input
14740 {{MSGNW:msg}}
14741 !! result
14742 <p>&#91;&#91;:Template:Msg&#93;&#93;
14743 </p>
14744 !! end
14745
14746 !! test
14747 RAW magic word
14748 !! input
14749 {{RAW:QUERTY}}
14750 !! result
14751 <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>
14752 </p>
14753 !! end
14754
14755 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
14756 !! test
14757 Always escape literal '>' in output, not just after '<'
14758 !! input
14759 ><>
14760 !! result
14761 <p>&gt;&lt;&gt;
14762 </p>
14763 !! end
14764
14765 !! test
14766 Template caching
14767 !! input
14768 {{Test}}
14769 {{Test}}
14770 !! result
14771 <p>This is a test template
14772 This is a test template
14773 </p>
14774 !! end
14775
14776
14777 !! article
14778 MediaWiki:Fake
14779 !! text
14780 ==header==
14781 !! endarticle
14782
14783 !! test
14784 Inclusion of !userCanEdit() content
14785 !! input
14786 {{MediaWiki:Fake}}
14787 !! result
14788 <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>
14789
14790 !! end
14791
14792
14793 !! test
14794 Out-of-order TOC heading levels
14795 !! input
14796 ==2==
14797 ======6======
14798 ===3===
14799 =1=
14800 =====5=====
14801 ==2==
14802 !! result
14803 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14804 <ul>
14805 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
14806 <ul>
14807 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
14808 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
14809 </ul>
14810 </li>
14811 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
14812 <ul>
14813 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
14814 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
14815 </ul>
14816 </li>
14817 </ul>
14818 </div>
14819
14820 <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>
14821 <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>
14822 <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>
14823 <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>
14824 <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>
14825 <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>
14826
14827 !! end
14828
14829
14830 !! test
14831 ISBN with a dummy number
14832 !! input
14833 ISBN ---
14834 !! result
14835 <p>ISBN ---
14836 </p>
14837 !! end
14838
14839
14840 !! test
14841 ISBN with space-delimited number
14842 !! input
14843 ISBN 92 9017 032 8
14844 !! result
14845 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
14846 </p>
14847 !! end
14848
14849
14850 !! test
14851 ISBN with multiple spaces, no number
14852 !! input
14853 ISBN foo
14854 !! result
14855 <p>ISBN foo
14856 </p>
14857 !! end
14858
14859
14860 !! test
14861 ISBN length
14862 !! input
14863 ISBN 123456789
14864
14865 ISBN 1234567890
14866
14867 ISBN 12345678901
14868 !! result
14869 <p>ISBN 123456789
14870 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
14871 </p><p>ISBN 12345678901
14872 </p>
14873 !! end
14874
14875
14876 !! test
14877 ISBN with trailing year (bug 8110)
14878 !! input
14879 ISBN 1-234-56789-0 - 2006
14880
14881 ISBN 1 234 56789 0 - 2006
14882 !! result
14883 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
14884 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
14885 </p>
14886 !! end
14887
14888
14889 !! test
14890 anchorencode
14891 !! input
14892 {{anchorencode:foo bar©#%n}}
14893 !! result
14894 <p>foo_bar.C2.A9.23.25n
14895 </p>
14896 !! end
14897
14898 !! test
14899 anchorencode trims spaces
14900 !! input
14901 {{anchorencode: __pretty__please__}}
14902 !! result
14903 <p>pretty_please
14904 </p>
14905 !! end
14906
14907 !! test
14908 anchorencode deals with links
14909 !! input
14910 {{anchorencode: [[hello|world]] [[hi]]}}
14911 !! result
14912 <p>world_hi
14913 </p>
14914 !! end
14915
14916 !! test
14917 anchorencode deals with templates
14918 !! input
14919 {{anchorencode: {{Foo}} }}
14920 !! result
14921 <p>FOO
14922 </p>
14923 !! end
14924
14925 !! test
14926 anchorencode encodes like the TOC generator: (bug 18431)
14927 !! input
14928 === _ +:.3A%3A&&amp;]] ===
14929 {{anchorencode: _ +:.3A%3A&&amp;]] }}
14930 __NOEDITSECTION__
14931 !! result
14932 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
14933 <p>.2B:.3A.253A.26.26.5D.5D
14934 </p>
14935 !! end
14936
14937 !! test
14938 Bug 6200: blockquotes and paragraph formatting
14939 !! input
14940 <blockquote>
14941 foo
14942 </blockquote>
14943
14944 bar
14945
14946 baz
14947 !! result
14948 <blockquote>
14949 <p>foo
14950 </p>
14951 </blockquote>
14952 <p>bar
14953 </p>
14954 <pre>baz
14955 </pre>
14956 !! end
14957
14958 !! test
14959 Bug 8293: Use of center tag ruins paragraph formatting
14960 !! input
14961 <center>
14962 foo
14963 </center>
14964
14965 bar
14966
14967 baz
14968 !! result
14969 <center>
14970 <p>foo
14971 </p>
14972 </center>
14973 <p>bar
14974 </p>
14975 <pre>baz
14976 </pre>
14977 !! end
14978
14979 !!test
14980 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
14981 !!options
14982 php
14983 !!input
14984 <span><s>x</span></s>
14985 !!result
14986 <p><span><s>x&lt;/span&gt;</s></span>
14987 </p>
14988 !!end
14989
14990 !!test
14991 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
14992 !!options
14993 parsoid
14994 !!input
14995 <span><s>x</span></s>
14996 !!result
14997 <p><span><s>x</s></span><s></s>
14998 </p>
14999 !!end
15000
15001 ###
15002 ### Language variants related tests
15003 ###
15004 !! test
15005 Self-link in language variants
15006 !! options
15007 title=[[Dunav]] language=sr
15008 !! input
15009 Both [[Dunav]] and [[Дунав]] are names for this river.
15010 !! result
15011 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
15012 </p>
15013 !!end
15014
15015 !! article
15016 Дуна
15017 !! text
15018 content
15019 !! endarticle
15020
15021 !! test
15022 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
15023 !! options
15024 title=[[Duna]] language=sr
15025 !! input
15026 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
15027 !! result
15028 <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.
15029 </p>
15030 !! end
15031
15032 !! test
15033 Link to a section of a variant of this title shouldn't be parsed as self-link
15034 !! options
15035 title=[[Duna]] language=sr
15036 !! input
15037 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
15038 !! result
15039 <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.
15040 </p>
15041 !! end
15042
15043 !! test
15044 Link to pages in language variants
15045 !! options
15046 language=sr
15047 !! input
15048 Main Page can be written as [[Маин Паге]]
15049 !! result
15050 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
15051 </p>
15052 !!end
15053
15054
15055 !! test
15056 Multiple links to pages in language variants
15057 !! options
15058 language=sr
15059 !! input
15060 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
15061 !! result
15062 <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>.
15063 </p>
15064 !!end
15065
15066
15067 !! test
15068 Simple template in language variants
15069 !! options
15070 language=sr
15071 !! input
15072 {{тест}}
15073 !! result
15074 <p>This is a test template
15075 </p>
15076 !! end
15077
15078
15079 !! test
15080 Template with explicit namespace in language variants
15081 !! options
15082 language=sr
15083 !! input
15084 {{Template:тест}}
15085 !! result
15086 <p>This is a test template
15087 </p>
15088 !! end
15089
15090
15091 !! test
15092 Basic test for template parameter in language variants
15093 !! options
15094 language=sr
15095 !! input
15096 {{парамтест|param=foo}}
15097 !! result
15098 <p>This is a test template with parameter foo
15099 </p>
15100 !! end
15101
15102
15103 !! test
15104 Simple category in language variants
15105 !! options
15106 language=sr cat
15107 !! input
15108 [[Category:МедиаWики Усер'с Гуиде]]
15109 !! result
15110 <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>
15111 !! end
15112
15113
15114 !! article
15115 Category:分类
15116 !! text
15117 blah
15118 !! endarticle
15119
15120 !! article
15121 Category:分類
15122 !! text
15123 blah
15124 !! endarticle
15125
15126 !! test
15127 Don't convert blue categorylinks to another variant (bug 33210)
15128 !! options
15129 language=zh cat
15130 !! input
15131 [[A]][[Category:分类]]
15132 !! result
15133 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
15134 !! end
15135
15136
15137 !! test
15138 Stripping -{}- tags (language variants)
15139 !! options
15140 language=sr
15141 !! input
15142 Latin proverb: -{Ne nuntium necare}-
15143 !! result
15144 <p>Latin proverb: Ne nuntium necare
15145 </p>
15146 !! end
15147
15148
15149 !! test
15150 Prevent conversion with -{}- tags (language variants)
15151 !! options
15152 language=sr variant=sr-ec
15153 !! input
15154 Latinski: -{Ne nuntium necare}-
15155 !! result
15156 <p>Латински: Ne nuntium necare
15157 </p>
15158 !! end
15159
15160
15161 !! test
15162 Prevent conversion of text with -{}- tags (language variants)
15163 !! options
15164 language=sr variant=sr-ec
15165 !! input
15166 Latinski: -{Ne nuntium necare}-
15167 !! result
15168 <p>Латински: Ne nuntium necare
15169 </p>
15170 !! end
15171
15172
15173 !! test
15174 Prevent conversion of links with -{}- tags (language variants)
15175 !! options
15176 language=sr variant=sr-ec
15177 !! input
15178 -{[[Main Page]]}-
15179 !! result
15180 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15181 </p>
15182 !! end
15183
15184
15185 !! test
15186 -{}- tags within headlines (within html for parserConvert())
15187 !! options
15188 language=sr variant=sr-ec
15189 !! input
15190 == -{Naslov}- ==
15191 !! result
15192 <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>
15193
15194 !! end
15195
15196
15197 !! test
15198 Explicit definition of language variant alternatives
15199 !! options
15200 language=zh variant=zh-tw
15201 !! input
15202 -{zh:China;zh-tw:Taiwan}-, not China
15203 !! result
15204 <p>Taiwan, not China
15205 </p>
15206 !! end
15207
15208
15209 !! test
15210 Conversion around HTML tags
15211 !! options
15212 language=sr variant=sr-ec
15213 !! input
15214 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
15215 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
15216 !! result
15217 <p>
15218 <span title="ЛаCтин">ски</span>
15219 </p>
15220 !! end
15221
15222
15223 !! test
15224 Explicit session-wise language variant mapping (A flag and - flag)
15225 !! options
15226 language=zh variant=zh-tw
15227 !! input
15228 Taiwan is not China.
15229 But -{A|zh:China;zh-tw:Taiwan}- is China,
15230 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
15231 and -{China}- is China.
15232 !! result
15233 <p>Taiwan is not China.
15234 But Taiwan is Taiwan,
15235 (This should be stripped!)
15236 and China is China.
15237 </p>
15238 !! end
15239
15240 !! test
15241 Explicit session-wise language variant mapping (H flag for hide)
15242 !! options
15243 language=zh variant=zh-tw
15244 !! input
15245 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
15246 Taiwan is China.
15247 !! result
15248 <p>(This should be stripped!)
15249 Taiwan is Taiwan.
15250 </p>
15251 !! end
15252
15253 !! test
15254 Adding explicit conversion rule for title (T flag)
15255 !! options
15256 language=zh variant=zh-tw showtitle
15257 !! input
15258 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
15259 !! result
15260 Taiwan
15261 <p>Should be stripped!
15262 </p>
15263 !! end
15264
15265 !! test
15266 Testing that changing the language variant here in the tests actually works
15267 !! options
15268 language=zh variant=zh showtitle
15269 !! input
15270 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
15271 !! result
15272 China
15273 <p>Should be stripped!
15274 </p>
15275 !! end
15276
15277 !! test
15278 Recursive conversion of alt and title attrs shouldn't clear converter state
15279 !! options
15280 language=zh variant=zh-cn showtitle
15281 !! input
15282 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
15283 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
15284 !! result
15285 China
15286 <p>
15287 Should be stripped<span title="Exclamation">!</span>
15288 </p>
15289 !! end
15290
15291 !! test
15292 Bug 24072: more test on conversion rule for title
15293 !! options
15294 language=zh variant=zh-tw showtitle
15295 !! input
15296 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
15297 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
15298 !! result
15299 Taiwan
15300 <p>This should be stripped!
15301 This won't take interferes with the title rule.
15302 </p>
15303 !! end
15304
15305 !! test
15306 Partly disable title conversion if variant == main language code
15307 !! options
15308 language=zh variant=zh title=[[ZH]] showtitle
15309 !! input
15310 -{T|zh-cn:CN;zh-tw:TW}-
15311 !! result
15312 ZH
15313 <p>
15314 </p>
15315 !! end
15316
15317 !! test
15318 Partly disable title conversion if variant == main language code, more
15319 !! options
15320 language=zh variant=zh title=[[ZH]] showtitle
15321 !! input
15322 -{T|TW}-
15323 !! result
15324 ZH
15325 <p>
15326 </p>
15327 !! end
15328
15329 !! test
15330 Raw output of variant escape tags (R flag)
15331 !! options
15332 language=zh variant=zh-tw
15333 !! input
15334 Raw: -{R|zh:China;zh-tw:Taiwan}-
15335 !! result
15336 <p>Raw: zh:China;zh-tw:Taiwan
15337 </p>
15338 !! end
15339
15340 !! test
15341 Nested using of manual convert syntax
15342 !! options
15343 language=zh variant=zh-hk
15344 !! input
15345 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
15346 !! result
15347 <p>Nested: Hello Hong Kong!
15348 </p>
15349 !! end
15350
15351 !! test
15352 Proper conversion of text in external links
15353 !! options
15354 language=sr variant=sr-ec
15355 !! input
15356 http://www.google.com
15357 gopher://www.google.com
15358 [http://www.google.com http://www.google.com]
15359 [gopher://www.google.com gopher://www.google.com]
15360 [https://www.google.com irc://www.google.com]
15361 [ftp://www.google.com www.google.com/ftp://dir]
15362 [//www.google.com www.google.com]
15363 !! result
15364 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
15365 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
15366 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
15367 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
15368 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
15369 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
15370 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
15371 </p>
15372 !! end
15373
15374 !! test
15375 Do not convert roman numbers to language variants
15376 !! options
15377 language=sr variant=sr-ec
15378 !! input
15379 Fridrih IV je car.
15380 !! result
15381 <p>Фридрих IV је цар.
15382 </p>
15383 !! end
15384
15385 !! test
15386 Unclosed language converter markup "-{"
15387 !! options
15388 language=sr
15389 !! input
15390 -{T|hello
15391 !! result
15392 <p>-{T|hello
15393 </p>
15394 !! end
15395
15396 !! test
15397 Don't convert raw rule "-{R|=&gt;}-" to "=>"
15398 !! options
15399 language=sr
15400 !! input
15401 -{R|=&gt;}-
15402 !! result
15403 <p>=&gt;
15404 </p>
15405 !!end
15406
15407 !! test
15408 Don't break link parsing if language converter markup is in the caption.
15409 !! options
15410 language=sr variant=sr-ec
15411 !! input
15412 [[Main Page|-{R|main page}-]]
15413 !! result
15414 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
15415 </p>
15416 !! end
15417
15418 # This test is currently broken in the PHP parser (bug 52661)
15419 !! test
15420 Don't break image parsing if language converter markup is in the caption.
15421 !! options
15422 language=sr
15423 disabled
15424 !! input
15425 [[File:Foobar.jpg|-{R|caption}-]]
15426 !! result
15427 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15428 </p>
15429 !! end
15430
15431 # This test is currently broken in the PHP parser (bug 52661)
15432 !! test
15433 Don't break list handling if language converter markup is in the item.
15434 !! options
15435 language=zh variant=zh-cn
15436 disabled
15437 !! input
15438 ;-{zh-cn:AAA;zh-tw:BBB}-
15439 !! result
15440 <dl><dt>AAA
15441 </dt></dl>
15442
15443 !! end
15444
15445 # This test is currently broken in the PHP parser (bug 52661)
15446 !! test
15447 Don't break table handling if language converter markup is in the cell.
15448 !! options
15449 language=sr variant=sr-ec
15450 disabled
15451 !! input
15452 {|
15453 |-
15454 | -{R|B}-
15455 |}
15456 !! result
15457 <table>
15458
15459 <tr>
15460 <td> B
15461 </td></tr></table>
15462
15463 !! end
15464
15465 !! test
15466 Bug 529: Uncovered bullet
15467 !! input
15468 * Foo {{bullet}}
15469 !! result
15470 <ul>
15471 <li> Foo
15472 </li>
15473 <li> Bar
15474 </li>
15475 </ul>
15476
15477 !! end
15478
15479 # Plain MediaWiki does not remove empty lists, but tidy actually does.
15480 # Templates in Wikipedia rely on this behavior, as tidy has always been
15481 # enabled there. These tests are normally run *without* tidy, so specify the
15482 # full output here.
15483 # To test realistic parsing behavior, apply a tidy-like transformation to both
15484 # the expected output and your parser's output.
15485 !! test
15486 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
15487 !! input
15488 ******* Foo {{bullet}}
15489 !! result
15490 <ul>
15491 <li><ul>
15492 <li><ul>
15493 <li><ul>
15494 <li><ul>
15495 <li><ul>
15496 <li><ul>
15497 <li> Foo
15498 </li>
15499 </ul>
15500 </li>
15501 </ul>
15502 </li>
15503 </ul>
15504 </li>
15505 </ul>
15506 </li>
15507 </ul>
15508 </li>
15509 </ul>
15510 </li>
15511 <li> Bar
15512 </li>
15513 </ul>
15514
15515 !! end
15516
15517 !! test
15518 Bug 529: Uncovered table already at line-start
15519 !! input
15520 x
15521
15522 {{table}}
15523 y
15524 !! result
15525 <p>x
15526 </p>
15527 <table>
15528 <tr>
15529 <td> 1 </td>
15530 <td> 2
15531 </td></tr>
15532 <tr>
15533 <td> 3 </td>
15534 <td> 4
15535 </td></tr></table>
15536 <p>y
15537 </p>
15538 !! end
15539
15540 !! test
15541 Bug 529: Uncovered bullet in parser function result
15542 !! input
15543 * Foo {{lc:{{bullet}} }}
15544 !! result
15545 <ul>
15546 <li> Foo
15547 </li>
15548 <li> bar
15549 </li>
15550 </ul>
15551
15552 !! end
15553
15554 !! test
15555 Bug 5678: Double-parsed template argument
15556 !! input
15557 {{lc:{{{1}}}|hello}}
15558 !! result
15559 <p>{{{1}}}
15560 </p>
15561 !! end
15562
15563 !! test
15564 Bug 5678: Double-parsed template invocation
15565 !! input
15566 {{lc:{{paramtest {{!}} param = hello }} }}
15567 !! result
15568 <p>{{paramtest | param = hello }}
15569 </p>
15570 !! end
15571
15572 !! test
15573 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
15574 !! options
15575 language=cs
15576 title=[[Main Page]]
15577 !! input
15578 {{PRVNÍVELKÉ:ěščř}}
15579 {{prvnívelké:ěščř}}
15580 {{PRVNÍMALÉ:ěščř}}
15581 {{prvnímalé:ěščř}}
15582 {{MALÁ:ěščř}}
15583 {{malá:ěščř}}
15584 {{VELKÁ:ěščř}}
15585 {{velká:ěščř}}
15586 !! result
15587 <p>Ěščř
15588 Ěščř
15589 ěščř
15590 ěščř
15591 ěščř
15592 ěščř
15593 ĚŠČŘ
15594 ĚŠČŘ
15595 </p>
15596 !! end
15597
15598 !! test
15599 Morwen/13: Unclosed link followed by heading
15600 !! input
15601 [[link
15602 ==heading==
15603 !! result
15604 <p>[[link
15605 </p>
15606 <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>
15607
15608 !! end
15609
15610 !! test
15611 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
15612 !! input
15613 {{foo|
15614 =heading=
15615 !! result
15616 <p>{{foo|
15617 </p>
15618 <h1><span class="mw-headline" id="heading">heading</span></h1>
15619
15620 !! end
15621
15622 !! test
15623 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
15624 !! input
15625 {{foo|
15626 ==heading==
15627 !! result
15628 <p>{{foo|
15629 </p>
15630 <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>
15631
15632 !! end
15633
15634 !! test
15635 Tildes in comments
15636 !! options
15637 pst
15638 !! input
15639 <!-- ~~~~ -->
15640 !! result
15641 <!-- ~~~~ -->
15642 !! end
15643
15644 !! test
15645 Paragraphs inside divs (no extra line breaks)
15646 !! input
15647 <div>Line one
15648
15649 Line two</div>
15650 !! result
15651 <div>Line one
15652 Line two</div>
15653
15654 !! end
15655
15656 !! test
15657 Paragraphs inside divs (extra line break on open)
15658 !! input
15659 <div>
15660 Line one
15661
15662 Line two</div>
15663 !! result
15664 <div>
15665 <p>Line one
15666 </p>
15667 Line two</div>
15668
15669 !! end
15670
15671 !! test
15672 Paragraphs inside divs (extra line break on close)
15673 !! input
15674 <div>Line one
15675
15676 Line two
15677 </div>
15678 !! result
15679 <div>Line one
15680 <p>Line two
15681 </p>
15682 </div>
15683
15684 !! end
15685
15686 !! test
15687 Paragraphs inside divs (extra line break on open and close)
15688 !! input
15689 <div>
15690 Line one
15691
15692 Line two
15693 </div>
15694 !! result
15695 <div>
15696 <p>Line one
15697 </p><p>Line two
15698 </p>
15699 </div>
15700
15701 !! end
15702
15703 !! test
15704 Nesting tags, paragraphs on lines which begin with <div>
15705 !! options
15706 disabled
15707 !! input
15708 <div></div><strong>A
15709 B</strong>
15710 !! result
15711 <div></div>
15712 <p><strong>A
15713 B</strong>
15714 </p>
15715 !! end
15716
15717 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
15718 !! test
15719 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
15720 !! input
15721 <blockquote>Line one
15722
15723 Line two</blockquote>
15724 !! result
15725 <blockquote>Line one
15726 Line two</blockquote>
15727
15728 !! end
15729
15730 !! test
15731 Bug 6200: paragraphs inside blockquotes (extra line break on open)
15732 !! input
15733 <blockquote>
15734 Line one
15735
15736 Line two</blockquote>
15737 !! result
15738 <blockquote>
15739 <p>Line one
15740 </p>
15741 Line two</blockquote>
15742
15743 !! end
15744
15745 !! test
15746 Bug 6200: paragraphs inside blockquotes (extra line break on close)
15747 !! input
15748 <blockquote>Line one
15749
15750 Line two
15751 </blockquote>
15752 !! result
15753 <blockquote>Line one
15754 <p>Line two
15755 </p>
15756 </blockquote>
15757
15758 !! end
15759
15760 !! test
15761 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
15762 !! input
15763 <blockquote>
15764 Line one
15765
15766 Line two
15767 </blockquote>
15768 !! result
15769 <blockquote>
15770 <p>Line one
15771 </p><p>Line two
15772 </p>
15773 </blockquote>
15774
15775 !! end
15776
15777 !! test
15778 Paragraphs inside blockquotes/divs (no extra line breaks)
15779 !! input
15780 <blockquote><div>Line one
15781
15782 Line two</div></blockquote>
15783 !! result
15784 <blockquote><div>Line one
15785 Line two</div></blockquote>
15786
15787 !! end
15788
15789 !! test
15790 Paragraphs inside blockquotes/divs (extra line break on open)
15791 !! input
15792 <blockquote><div>
15793 Line one
15794
15795 Line two</div></blockquote>
15796 !! result
15797 <blockquote><div>
15798 <p>Line one
15799 </p>
15800 Line two</div></blockquote>
15801
15802 !! end
15803
15804 !! test
15805 Paragraphs inside blockquotes/divs (extra line break on close)
15806 !! input
15807 <blockquote><div>Line one
15808
15809 Line two
15810 </div></blockquote>
15811 !! result
15812 <blockquote><div>Line one
15813 <p>Line two
15814 </p>
15815 </div></blockquote>
15816
15817 !! end
15818
15819 !! test
15820 Paragraphs inside blockquotes/divs (extra line break on open and close)
15821 !! input
15822 <blockquote><div>
15823 Line one
15824
15825 Line two
15826 </div></blockquote>
15827 !! result
15828 <blockquote><div>
15829 <p>Line one
15830 </p><p>Line two
15831 </p>
15832 </div></blockquote>
15833
15834 !! end
15835
15836 !! test
15837 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
15838 !! options
15839 wgLinkHolderBatchSize=0
15840 !! input
15841 [[meatball:1]]
15842 [[meatball:2]]
15843 [[meatball:3]]
15844 !! result
15845 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
15846 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
15847 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
15848 </p>
15849 !! end
15850
15851 !! test
15852 Free external link invading image caption
15853 !! input
15854 [[Image:Foobar.jpg|thumb|http://x|hello]]
15855 !! result
15856 <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>
15857
15858 !! end
15859
15860 !! test
15861 Bug 15196: localised external link numbers
15862 !! options
15863 language=fa
15864 !! input
15865 [http://en.wikipedia.org/]
15866 !! result
15867 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
15868 </p>
15869 !! end
15870
15871 !! test
15872 Multibyte character in padleft
15873 !! input
15874 {{padleft:-Hello|7|Æ}}
15875 !! result
15876 <p>Æ-Hello
15877 </p>
15878 !! end
15879
15880 !! test
15881 Multibyte character in padright
15882 !! input
15883 {{padright:Hello-|7|Æ}}
15884 !! result
15885 <p>Hello-Æ
15886 </p>
15887 !! end
15888
15889 !!test
15890 formatdate parser function
15891 !!input
15892 {{#formatdate:2009-03-24}}
15893 !! result
15894 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
15895 </p>
15896 !! end
15897
15898 !!test
15899 formatdate parser function, with default format
15900 !!input
15901 {{#formatdate:2009-03-24|mdy}}
15902 !! result
15903 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
15904 </p>
15905 !! end
15906
15907 !! test
15908 Spacing of numbers in formatted dates
15909 !! input
15910 {{#formatdate:January 15}}
15911 !! result
15912 <p><span class="mw-formatted-date" title="01-15">January 15</span>
15913 </p>
15914 !! end
15915
15916 !! test
15917 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
15918 !! options
15919 language=nl title=[[MediaWiki:Common.css]]
15920 !! input
15921 {{#formatdate:2009-03-24|dmy}}
15922 !! result
15923 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
15924 </p>
15925 !! end
15926
15927 #
15928 #
15929 #
15930
15931 #
15932 # Edit comments
15933 #
15934
15935 !! test
15936 Edit comment with link
15937 !! options
15938 comment
15939 !! input
15940 I like the [[Main Page]] a lot
15941 !! result
15942 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
15943 !!end
15944
15945 !! test
15946 Edit comment with link and link text
15947 !! options
15948 comment
15949 !! input
15950 I like the [[Main Page|best pages]] a lot
15951 !! result
15952 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
15953 !!end
15954
15955 !! test
15956 Edit comment with link and link text with suffix
15957 !! options
15958 comment
15959 !! input
15960 I like the [[Main Page|best page]]s a lot
15961 !! result
15962 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
15963 !!end
15964
15965 !! test
15966 Edit comment with section link (non-local, eg in history list)
15967 !! options
15968 comment title=[[Main Page]]
15969 !! input
15970 /* External links */ removed bogus entries
15971 !! result
15972 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
15973 !!end
15974
15975 !! test
15976 Edit comment with section link and text before it (non-local, eg in history list)
15977 !! options
15978 comment title=[[Main Page]]
15979 !! input
15980 pre-comment text /* External links */ removed bogus entries
15981 !! result
15982 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>
15983 !!end
15984
15985 !! test
15986 Edit comment with section link (local, eg in diff view)
15987 !! options
15988 comment local title=[[Main Page]]
15989 !! input
15990 /* External links */ removed bogus entries
15991 !! result
15992 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
15993 !!end
15994
15995 !! test
15996 Edit comment with subpage link (bug 14080)
15997 !! options
15998 comment
15999 subpage
16000 title=[[Subpage test]]
16001 !! input
16002 Poked at a [[/subpage]] here...
16003 !! result
16004 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
16005 !!end
16006
16007 !! test
16008 Edit comment with subpage link and link text (bug 14080)
16009 !! options
16010 comment
16011 subpage
16012 title=[[Subpage test]]
16013 !! input
16014 Poked at a [[/subpage|neat little page]] here...
16015 !! result
16016 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
16017 !!end
16018
16019 !! test
16020 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
16021 !! options
16022 comment
16023 title=[[Subpage test]]
16024 !! input
16025 Poked at a [[/subpage]] here...
16026 !! result
16027 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...
16028 !!end
16029
16030 !! test
16031 Edit comment with bare anchor link (local, as on diff)
16032 !! options
16033 comment
16034 local
16035 title=[[Main Page]]
16036 !!input
16037 [[#section]]
16038 !! result
16039 <a href="#section">#section</a>
16040 !! end
16041
16042 !! test
16043 Edit comment with bare anchor link (non-local, as on history)
16044 !! options
16045 comment
16046 title=[[Main Page]]
16047 !!input
16048 [[#section]]
16049 !! result
16050 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
16051 !! end
16052
16053 !! test
16054 Anchor starting with underscore
16055 !!input
16056 [[#_ref|One]]
16057 !! result
16058 <p><a href="#_ref">One</a>
16059 </p>
16060 !! end
16061
16062 !! test
16063 Id starting with underscore
16064 !!input
16065 <div id="_ref"></div>
16066 !! result
16067 <div id="_ref"></div>
16068
16069 !! end
16070
16071 !! test
16072 Space normalisation on autocomment (bug 22784)
16073 !! options
16074 comment
16075 title=[[Main Page]]
16076 !!input
16077 /* __hello__world__ */
16078 !! result
16079 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
16080 !! end
16081
16082 !! test
16083 percent-encoding and + signs in comments (Bug 26410)
16084 !! options
16085 comment
16086 !!input
16087 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
16088 !! result
16089 <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>
16090 !! end
16091
16092 !! test
16093 Bad images - basic functionality
16094 !! options
16095 disabled
16096 !! input
16097 [[File:Bad.jpg]]
16098 !! result
16099 !! end
16100
16101 !! test
16102 Bad images - bug 16039: text after bad image disappears
16103 !! options
16104 disabled
16105 !! input
16106 Foo bar
16107 [[File:Bad.jpg]]
16108 Bar foo
16109 !! result
16110 <p>Foo bar
16111 </p><p>Bar foo
16112 </p>
16113 !! end
16114
16115 !! test
16116 Verify that displaytitle works (bug #22501) no displaytitle
16117 !! options
16118 showtitle
16119 !! config
16120 wgAllowDisplayTitle=true
16121 wgRestrictDisplayTitle=false
16122 !! input
16123 this is not the the title
16124 !! result
16125 Parser test
16126 <p>this is not the the title
16127 </p>
16128 !! end
16129
16130 !! test
16131 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
16132 !! options
16133 showtitle
16134 title=[[Screen]]
16135 !! config
16136 wgAllowDisplayTitle=true
16137 wgRestrictDisplayTitle=false
16138 !! input
16139 this is not the the title
16140 {{DISPLAYTITLE:whatever}}
16141 !! result
16142 whatever
16143 <p>this is not the the title
16144 </p>
16145 !! end
16146
16147 !! test
16148 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
16149 !! options
16150 showtitle
16151 title=[[Screen]]
16152 !! config
16153 wgAllowDisplayTitle=true
16154 wgRestrictDisplayTitle=true
16155 !! input
16156 this is not the the title
16157 {{DISPLAYTITLE:whatever}}
16158 !! result
16159 Screen
16160 <p>this is not the the title
16161 </p>
16162 !! end
16163
16164 !! test
16165 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
16166 !! options
16167 showtitle
16168 title=[[Screen]]
16169 !! config
16170 wgAllowDisplayTitle=true
16171 wgRestrictDisplayTitle=true
16172 !! input
16173 this is not the the title
16174 {{DISPLAYTITLE:screen}}
16175 !! result
16176 screen
16177 <p>this is not the the title
16178 </p>
16179 !! end
16180
16181 !! test
16182 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
16183 !! options
16184 showtitle
16185 title=[[Screen]]
16186 !! config
16187 wgAllowDisplayTitle=false
16188 !! input
16189 this is not the the title
16190 {{DISPLAYTITLE:screen}}
16191 !! result
16192 Screen
16193 <p>this is not the the title
16194 <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>
16195 </p>
16196 !! end
16197
16198 !! test
16199 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
16200 !! options
16201 showtitle
16202 title=[[Screen]]
16203 !! config
16204 wgAllowDisplayTitle=false
16205 !! input
16206 this is not the the title
16207 !! result
16208 Screen
16209 <p>this is not the the title
16210 </p>
16211 !! end
16212
16213 !! test
16214 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
16215 !! options
16216 showtitle
16217 title=[[Screen]]
16218 !! config
16219 wgAllowDisplayTitle=true
16220 wgRestrictDisplayTitle=true
16221 !! input
16222 this is not the the title
16223 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
16224 !! result
16225 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
16226 <p>this is not the the title
16227 </p>
16228 !! end
16229
16230 !! test
16231 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
16232 !! options
16233 showtitle
16234 title=[[Screen]]
16235 !! config
16236 wgAllowDisplayTitle=true
16237 wgRestrictDisplayTitle=true
16238 !! input
16239 this is not the the title
16240 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
16241 !! result
16242 <span style="color: red;">s</span>creen
16243 <p>this is not the the title
16244 </p>
16245 !! end
16246
16247 !! test
16248 preload: check <noinclude> and <includeonly>
16249 !! options
16250 preload
16251 !! input
16252 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
16253 !! result
16254 Hello kind world.
16255 !! end
16256
16257 !! test
16258 preload: check <onlyinclude>
16259 !! options
16260 preload
16261 !! input
16262 Goodbye <onlyinclude>Hello world</onlyinclude>
16263 !! result
16264 Hello world
16265 !! end
16266
16267 !! test
16268 preload: can pass tags through if we want to
16269 !! options
16270 preload
16271 !! input
16272 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
16273 !! result
16274 <includeonly>Hello world</includeonly>
16275 !! end
16276
16277 !! test
16278 preload: check that it doesn't try to do tricks
16279 !! options
16280 preload
16281 !! input
16282 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
16283 !! result
16284 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
16285 !! end
16286
16287 !! test
16288 Play a bit with r67090 and bug 3158
16289 !! options
16290 disabled
16291 !! input
16292 <div style="width:50% !important">&nbsp;</div>
16293 <div style="width:50%&nbsp;!important">&nbsp;</div>
16294 <div style="width:50%&#160;!important">&nbsp;</div>
16295 <div style="border : solid;">&nbsp;</div>
16296 !! result
16297 <div style="width:50% !important">&nbsp;</div>
16298 <div style="width:50% !important">&nbsp;</div>
16299 <div style="width:50% !important">&nbsp;</div>
16300 <div style="border&#160;: solid;">&nbsp;</div>
16301
16302 !! end
16303
16304 !! test
16305 HTML5 data attributes
16306 !! input
16307 <span data-foo="bar">Baz</span>
16308 <p data-abc-def_hij="">Quuz</p>
16309 !! result
16310 <p><span data-foo="bar">Baz</span>
16311 </p>
16312 <p data-abc-def_hij="">Quuz</p>
16313
16314 !! end
16315
16316 !! test
16317 percent-encoding and + signs in internal links (Bug 26410)
16318 !! input
16319 [[User:+%]] [[Page+title%]]
16320 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
16321 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
16322 [[%33%45]] [[%33%45+]]
16323 !! result
16324 <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>
16325 <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>
16326 <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>
16327 <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>
16328 </p>
16329 !! end
16330
16331 !! test
16332 Special characters in embedded file links (bug 27679)
16333 !! input
16334 [[File:Contains & ampersand.jpg]]
16335 [[File:Does not exist.jpg|Title with & ampersand]]
16336 !! result
16337 <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>
16338 <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>
16339 </p>
16340 !! end
16341
16342
16343 !! test
16344 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
16345 !! input
16346 Text&apos;s been normalized?
16347 !! result
16348 <p>Text&#39;s been normalized?
16349 </p>
16350 !! end
16351
16352 !! test
16353 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
16354 !! input
16355 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
16356 !! result
16357 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
16358 </p>
16359 !! end
16360
16361 !! test
16362 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
16363 !! input
16364 [http://www.example.org/ ideograms]
16365 !! result
16366 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
16367 </p>
16368 !! end
16369
16370 !! test
16371 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
16372 !! input
16373 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
16374 !! result
16375 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
16376 </p>
16377 !! end
16378
16379 !! article
16380 Mediawiki:loop1
16381 !! text
16382 {{Identical|A}}
16383 !! endarticle
16384
16385 !! article
16386 Mediawiki:loop2
16387 !! text
16388 {{Identical|B}}
16389 !! endarticle
16390
16391 !! article
16392 Template:Identical
16393 !! text
16394 {{int:loop1}}
16395 {{int:loop2}}
16396 !! endarticle
16397
16398 !! test
16399 Bug 31098 Template which includes system messages which includes the template
16400 !! input
16401 {{Identical}}
16402 !! result
16403 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
16404 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
16405 </p>
16406 !! end
16407
16408 !! test
16409 Bug31490 Turkish: ucfirst 'blah'
16410 !! options
16411 language=tr
16412 !! input
16413 {{ucfirst:blah}}
16414 !! result
16415 <p>Blah
16416 </p>
16417 !! end
16418
16419 !! test
16420 Bug31490 Turkish: ucfirst 'ix'
16421 !! options
16422 language=tr
16423 !! input
16424 {{ucfirst:ix}}
16425 !! result
16426 <p>İx
16427 </p>
16428 !! end
16429
16430 !! test
16431 Bug31490 Turkish: lcfirst 'BLAH'
16432 !! options
16433 language=tr
16434 !! input
16435 {{lcfirst:BLAH}}
16436 !! result
16437 <p>bLAH
16438 </p>
16439 !! end
16440
16441 !! test
16442 Bug31490 Turkish: ucfırst (with a dotless i)
16443 !! options
16444 language=tr
16445 !! input
16446 {{ucfırst:blah}}
16447 !! result
16448 <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>
16449 </p>
16450 !! end
16451
16452 !! test
16453 Bug31490 ucfırst (with a dotless i) with English language
16454 !! options
16455 language=en
16456 !! input
16457 {{ucfırst:blah}}
16458 !! result
16459 <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>
16460 </p>
16461 !! end
16462
16463 !! test
16464 Bug 26375: TOC with italics
16465 !! options
16466 title=[[Main Page]]
16467 !! input
16468 __TOC__
16469 == ''Lost'' episodes ==
16470 !! result
16471 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16472 <ul>
16473 <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>
16474 </ul>
16475 </div>
16476
16477 <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>
16478
16479 !! end
16480
16481 !! test
16482 Bug 26375: TOC with bold
16483 !! options
16484 title=[[Main Page]]
16485 !! input
16486 __TOC__
16487 == '''should be bold''' then normal text ==
16488 !! result
16489 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16490 <ul>
16491 <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>
16492 </ul>
16493 </div>
16494
16495 <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>
16496
16497 !! end
16498
16499 !! test
16500 Bug 33845: Headings become cursive in TOC when they contain an image
16501 !! options
16502 title=[[Main Page]]
16503 !! input
16504 __TOC__
16505 == Image [[Image:foobar.jpg]] ==
16506 !! result
16507 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16508 <ul>
16509 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
16510 </ul>
16511 </div>
16512
16513 <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>
16514
16515 !! end
16516
16517 !! test
16518 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
16519 !! options
16520 title=[[Main Page]]
16521 !! input
16522 __TOC__
16523 == <blockquote>Quote</blockquote> ==
16524 !! result
16525 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16526 <ul>
16527 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
16528 </ul>
16529 </div>
16530
16531 <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>
16532
16533 !! end
16534
16535 !! test
16536 Unclosed tags in TOC
16537 !! options
16538 title=[[Main Page]]
16539 !! input
16540 __TOC__
16541 == Proof: 2 < 3 ==
16542 <small>Hanc marginis exiguitas non caperet.</small>
16543 QED
16544 !! result
16545 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16546 <ul>
16547 <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>
16548 </ul>
16549 </div>
16550
16551 <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>
16552 <p><small>Hanc marginis exiguitas non caperet.</small>
16553 QED
16554 </p>
16555 !! end
16556
16557 !! test
16558 Multiple tags in TOC
16559 !! input
16560 __TOC__
16561 == <i>Foo</i> <b>Bar</b> ==
16562
16563 == <i>Foo</i> <blockquote>Bar</blockquote> ==
16564 !! result
16565 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16566 <ul>
16567 <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>
16568 <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>
16569 </ul>
16570 </div>
16571
16572 <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>
16573 <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>
16574
16575 !! end
16576
16577 !! test
16578 Tags with parameters in TOC
16579 !! input
16580 __TOC__
16581 == <sup class="in-h2">Hello</sup> ==
16582
16583 == <sup class="a > b">Evilbye</sup> ==
16584 !! result
16585 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16586 <ul>
16587 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
16588 <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>
16589 </ul>
16590 </div>
16591
16592 <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>
16593 <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>
16594
16595 !! end
16596
16597 !! test
16598 span tags with directionality in TOC
16599 !! input
16600 __TOC__
16601 == <span dir="ltr">C++</span> ==
16602
16603 == <span dir="rtl">זבנג!</span> ==
16604
16605 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
16606
16607 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
16608
16609 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
16610 !! result
16611 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16612 <ul>
16613 <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>
16614 <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>
16615 <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>
16616 <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>
16617 <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>
16618 </ul>
16619 </div>
16620
16621 <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>
16622 <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>
16623 <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>
16624 <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>
16625 <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>
16626
16627 !! end
16628
16629 !! article
16630 MediaWiki:Bug32057
16631 !! text
16632 == {{int:headline_sample}} ==
16633 !! endarticle
16634
16635 !! test
16636 Bug 32057: Title needed when expanding <h> nodes.
16637 !! options
16638 title=[[Main Page]]
16639 !! input
16640 {{int:Bug32057}}
16641 !! result
16642 <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>
16643
16644 !! end
16645
16646 !! test
16647 Strip marker in urlencode
16648 !! input
16649 {{urlencode:x<nowiki/>y}}
16650 {{urlencode:x<nowiki/>y|wiki}}
16651 {{urlencode:x<nowiki/>y|path}}
16652 !! result
16653 <p>xy
16654 xy
16655 xy
16656 </p>
16657 !! end
16658
16659 !! test
16660 Strip marker in lc
16661 !! input
16662 {{lc:x<nowiki/>y}}
16663 !! result
16664 <p>xy
16665 </p>
16666 !! end
16667
16668 !! test
16669 Strip marker in uc
16670 !! input
16671 {{uc:x<nowiki/>y}}
16672 !! result
16673 <p>XY
16674 </p>
16675 !! end
16676
16677 !! test
16678 Strip marker in formatNum
16679 !! input
16680 {{formatnum:1<nowiki/>2}}
16681 {{formatnum:1<nowiki/>2|R}}
16682 !! result
16683 <p>12
16684 12
16685 </p>
16686 !! end
16687
16688 !! test
16689 Check noCommafy in formatNum
16690 !! options
16691 language=be-tarask
16692 !! input
16693 {{formatnum:123456.78}}
16694 {{formatnum:123456.78|NOSEP}}
16695 !! result
16696 <p>123 456,78
16697 123456.78
16698 </p>
16699 !! end
16700
16701 !! test
16702 Wrong option for formatNum (bug 56199)
16703 !! input
16704 {{formatnum:1,234.56|Random}}
16705 {{formatnum:1,234.56|EVERYTHING}}
16706 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
16707 !! result
16708 <p>1,234.56
16709 1,234.56
16710 1,234.56
16711 </p>
16712 !! end
16713
16714 !! test
16715 Strip marker in grammar
16716 !! options
16717 language=fi
16718 !! input
16719 {{grammar:elative|foo<nowiki/>bar}}
16720 !! result
16721 <p>foobarista
16722 </p>
16723 !! end
16724
16725 !! test
16726 Strip marker in padleft
16727 !! input
16728 {{padleft:|2|x<nowiki/>y}}
16729 !! result
16730 <p>xy
16731 </p>
16732 !! end
16733
16734 !! test
16735 Strip marker in padright
16736 !! input
16737 {{padright:|2|x<nowiki/>y}}
16738 !! result
16739 <p>xy
16740 </p>
16741 !! end
16742
16743 !! test
16744 Strip marker in anchorencode
16745 !! input
16746 {{anchorencode:x<nowiki/>y}}
16747 !! result
16748 <p>xy
16749 </p>
16750 !! end
16751
16752 !! test
16753 nowiki inside link inside heading (bug 18295)
16754 !! input
16755 ==[[foo|x<nowiki>y</nowiki>z]]==
16756 !! result
16757 <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>
16758
16759 !! end
16760
16761 !! test
16762 new support for bdi element (bug 31817)
16763 !! input
16764 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
16765 !! result
16766 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
16767
16768 !!end
16769
16770 !! test
16771 Ignore pipe between table row attributes
16772 !! input
16773 {|
16774 | quux
16775 |- id=foo | style='color: red'
16776 | bar
16777 |}
16778 !! result
16779 <table>
16780 <tr>
16781 <td> quux
16782 </td></tr>
16783 <tr id="foo" style="color: red">
16784 <td> bar
16785 </td></tr></table>
16786
16787 !! end
16788
16789 !!test
16790 Gallery override link with WikiLink (bug 34852)
16791 !! input
16792 <gallery>
16793 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
16794 </gallery>
16795 !! result
16796 <ul class="gallery mw-gallery-traditional">
16797 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16798 <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>
16799 <div class="gallerytext">
16800 <p>caption
16801 </p>
16802 </div>
16803 </div></li>
16804 </ul>
16805
16806 !! end
16807
16808 !!test
16809 Gallery override link with absolute external link (bug 34852)
16810 !! input
16811 <gallery>
16812 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
16813 </gallery>
16814 !! result
16815 <ul class="gallery mw-gallery-traditional">
16816 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16817 <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>
16818 <div class="gallerytext">
16819 <p>caption
16820 </p>
16821 </div>
16822 </div></li>
16823 </ul>
16824
16825 !! end
16826
16827 !!test
16828 Gallery override link with malicious javascript (bug 34852)
16829 !! input
16830 <gallery>
16831 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
16832 </gallery>
16833 !! result
16834 <ul class="gallery mw-gallery-traditional">
16835 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16836 <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>
16837 <div class="gallerytext">
16838 <p>caption
16839 </p>
16840 </div>
16841 </div></li>
16842 </ul>
16843
16844 !! end
16845
16846 !!test
16847 Gallery with invalid title as link (bug 43964)
16848 !! input
16849 <gallery>
16850 File:foobar.jpg|link=<
16851 </gallery>
16852 !! result
16853 <ul class="gallery mw-gallery-traditional">
16854 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16855 <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>
16856 <div class="gallerytext">
16857 </div>
16858 </div></li>
16859 </ul>
16860
16861 !! end
16862
16863 !!test
16864 Language parser function
16865 !! input
16866 {{#language:ar}}
16867 !! result
16868 <p>العربية
16869 </p>
16870 !! end
16871
16872 !!test
16873 Padleft and padright as substr
16874 !! input
16875 {{padleft:|3|abcde}}
16876 {{padright:|3|abcde}}
16877 !! result
16878 <p>abc
16879 abc
16880 </p>
16881 !! end
16882
16883 !!test
16884 Special parser function
16885 !! input
16886 {{#special:RandomPage}}
16887 {{#special:BaDtItLe}}
16888 {{#special:Foobar}}
16889 !! result
16890 <p>Special:Random
16891 Special:Badtitle
16892 Special:Foobar
16893 </p>
16894 !! end
16895
16896 !!test
16897 Bug 34939 - Case insensitive link parsing ([HttP://])
16898 !! input
16899 [HttP://MediaWiki.Org/]
16900 !! result
16901 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
16902 </p>
16903 !! end
16904
16905 !!test
16906 Bug 34939 - Case insensitive link parsing ([HttP:// title])
16907 !! input
16908 [HttP://MediaWiki.Org/ MediaWiki]
16909 !! result
16910 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
16911 </p>
16912 !! end
16913
16914 !!test
16915 Bug 34939 - Case insensitive link parsing (HttP://)
16916 !! input
16917 HttP://MediaWiki.Org/
16918 !! result
16919 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
16920 </p>
16921 !! end
16922
16923 !!test
16924 Disable TOC
16925 !! options
16926 notoc
16927 !! input
16928 Lead
16929 == Section 1 ==
16930 == Section 2 ==
16931 == Section 3 ==
16932 == Section 4 ==
16933 == Section 5 ==
16934 !! result
16935 <p>Lead
16936 </p>
16937
16938 <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>
16939 <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>
16940 <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>
16941 <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>
16942 <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>
16943
16944 !! end
16945
16946
16947 ###
16948 ### Parsoids-specific tests
16949 ### Parsoid-PHP parser incompatibilities
16950 ###
16951 !!test
16952 1. SOL-sensitive wikitext tokens as template-args
16953 !!options
16954 parsoid=wt2html,wt2wt
16955 !!input
16956 {{echo|*a}}
16957 {{echo|#a}}
16958 {{echo|:a}}
16959 !!result
16960 <span about="#mwt1" typeof="mw:Transclusion">
16961 </span><ul about="#mwt1"><li>a</li>
16962 </ul>
16963 <span about="#mwt2" typeof="mw:Transclusion">
16964 </span><ol about="#mwt2"><li>a</li>
16965 </ol>
16966 <span about="#mwt3" typeof="mw:Transclusion">
16967 </span><dl about="#mwt3"><dd>a</dd>
16968 </dl>
16969 !!end
16970
16971 #### ----------------------------------------------------------------
16972 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
16973 #### tags. Parsoid's output for these tags differs from that of the
16974 #### PHP parser.
16975 #### ----------------------------------------------------------------
16976
16977 !!test
16978 Ref: 1. ref-location should be replaced with an index span
16979 !!options
16980 parsoid
16981 !!input
16982 A <ref>foo</ref>
16983 B <ref name="x">foo</ref>
16984 C <ref name="y" />
16985 !!result
16986 <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>
16987 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>
16988 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>
16989 !!end
16990
16991 !!test
16992 Ref: 2. ref-tags with identical names should all get the same index
16993 !!options
16994 parsoid
16995 !!input
16996 A <ref name="x">foo</ref>
16997 B <ref name="x" />
16998 !!result
16999 <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>
17000 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>
17001 !!end
17002
17003 !!test
17004 Ref: 3. spaces in ref-names should be ignored
17005 !!options
17006 parsoid
17007 !!input
17008 A <ref name="x">foo</ref>
17009 B <ref name=" x " />
17010 C <ref name= x />
17011 !!result
17012 <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>
17013 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>
17014 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>
17015 !!end
17016
17017 !!test
17018 Ref: 4. 'constructor' should be accepted as a valid ref-name
17019 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
17020 !!options
17021 parsoid
17022 !!input
17023 A <ref name="constructor">foo</ref>
17024 !!result
17025 <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>
17026 !!end
17027
17028 !!test
17029 Ref: 5. body should accept generic wikitext
17030 !!options
17031 parsoid
17032 !!input
17033 A <ref>
17034 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
17035 </ref>
17036
17037 <references />
17038 !!result
17039 <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>
17040
17041 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
17042 <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>
17043 </li>
17044 </ol>
17045 !!end
17046
17047 !!test
17048 Ref: 6. indent-pres should not be output in ref-body
17049 !!options
17050 parsoid
17051 !!input
17052 A <ref>
17053 foo
17054 bar
17055 baz
17056 </ref>
17057
17058 <references />
17059 !!result
17060 <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>
17061
17062 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
17063 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
17064 bar
17065 baz
17066 </li>
17067 </ol>
17068 !!end
17069
17070 !!test
17071 Ref: 7. No p-wrapping in ref-body
17072 !!options
17073 parsoid
17074 !!input
17075 A <ref>
17076 foo
17077
17078 bar
17079
17080
17081 baz
17082
17083
17084
17085 booz
17086 </ref>
17087
17088 <references />
17089 !!result
17090 <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>
17091
17092 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17093 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
17094
17095 bar
17096
17097
17098 baz
17099
17100
17101
17102 booz
17103 </li>
17104 </ol>
17105 !!end
17106
17107 !!test
17108 Ref: 8. transclusion wikitext has lower precedence
17109 !!options
17110 parsoid
17111 !!input
17112 A <ref> foo {{echo|</ref> B C}}
17113
17114 <references />
17115 !!result
17116 <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>
17117 <ol class="references" typeof="mw:Extension/references" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
17118 <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>
17119 </ol>
17120 !!end
17121
17122 !!test
17123 Ref: 9. unclosed comments should not leak out of ref-body
17124 !!options
17125 parsoid
17126 !!input
17127 A <ref> foo <!--</ref> B C
17128 <references />
17129 !!result
17130 <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>
17131 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17132 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo </li>
17133 </ol>
17134 !!end
17135
17136 !!test
17137 Ref: 10. Unclosed HTML tags should not leak out of ref-body
17138 !!options
17139 parsoid
17140 !!input
17141 A <ref> <b> foo </ref> B C
17142
17143 <references />
17144 !!result
17145 <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>
17146
17147
17148 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references />","dsr":[28,42,2,2]}' data-mw='{"name":"references","attrs":{}}'>
17149 <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>
17150 </ol>
17151 !!end
17152
17153 !!test
17154 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
17155 !!options
17156 parsoid
17157 !!input
17158 A <ref>foo</ref> B
17159 C <ref>bar</ref> D
17160 !!result
17161 <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
17162 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>
17163 !!end
17164
17165 !!test
17166 Ref: 12. ref-tags act as trailing newline migration barrier
17167 !!options
17168 parsoid
17169 !!input
17170 <!--the newline at the end of this line moves out of the p-tag-->a
17171
17172 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
17173 <ref />
17174
17175 c
17176 !!result
17177 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
17178
17179
17180 <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>
17181 <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>
17182
17183
17184 <p>c</p>
17185 !!end
17186
17187 !!test
17188 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
17189 !!options
17190 parsoid
17191 !!input
17192 <ref>foo</ref> A
17193 <ref>bar
17194 </ref> B
17195 !!result
17196 <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
17197 <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>
17198 !!end
17199
17200 !!test
17201 Ref: 14. A nested ref-tag should be emitted as plain text
17202 !!options
17203 parsoid
17204 !!input
17205 <ref>foo <ref>bar</ref> baz</ref>
17206
17207 <references />
17208 !!result
17209 <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>
17210
17211 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-parsoid='{"src":"&lt;references />","dsr":[35,49,2,2]}' data-mw='{"name":"references","attrs":{}}'>
17212 <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>
17213 </ol>
17214 !!end
17215
17216 !!test
17217 Ref: 15. ref-tags with identical names should get identical indexes
17218 !!options
17219 parsoid
17220 !!input
17221 A1 <ref name="a">foo</ref> A2 <ref name="a" />
17222 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
17223
17224 <references />
17225 !!result
17226 <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>
17227 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>
17228
17229 <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>
17230 </ol>
17231 !!end
17232
17233 ## We don't bother wt2wt-ing non-standard whitespace
17234 !!test
17235 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
17236 !!options
17237 parsoid=wt2html
17238 !!input
17239 A <ref >foo</ref >
17240
17241 <references />
17242 !!result
17243 <p>A <span class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
17244
17245 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17246 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
17247 !!end
17248
17249 !!test
17250 References: 1. references tag without any refs should be handled properly
17251 !!options
17252 parsoid
17253 !!input
17254 <references />
17255 !!result
17256 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
17257 !!end
17258
17259 !!test
17260 References: 2. references tag with group only outputs references from that group
17261 !!options
17262 parsoid
17263 !!input
17264 A <ref group="a">foo</ref>
17265 B <ref group="b">bar</ref>
17266
17267 <references group="a" />
17268 !!result
17269 <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>
17270 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>
17271
17272 <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>
17273 </ol>
17274 !!end
17275
17276 !!test
17277 References: 3. ref list should be cleared after processing references
17278 !!options
17279 parsoid
17280 !!input
17281 A <ref>foo</ref>
17282
17283 <references />
17284
17285 B <ref>bar</ref>
17286
17287 <references />
17288 !!result
17289 <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>
17290
17291 <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>
17292 </ol>
17293
17294 <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>
17295
17296 <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>
17297 </ol>
17298 !!end
17299
17300 !!test
17301 References: 4. only referenced group should be cleared after processing references
17302 !!options
17303 parsoid
17304 !!input
17305 A <ref group="a">afoo</ref>
17306 B <ref>bfoo</ref>
17307
17308 <references group="a" />
17309
17310 C <ref>cfoo</ref>
17311
17312 <references />
17313 !!result
17314 <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>
17315 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>
17316
17317 <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>
17318 </ol>
17319
17320 <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>
17321
17322 <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>
17323 </ol>
17324 !!end
17325
17326 !!test
17327 References: 5. ref tags in references should be processed while ignoring all other content
17328 !!options
17329 parsoid
17330 !!input
17331 A <ref name="a" />
17332 B <ref name="b">bar</ref>
17333
17334 <references>
17335 <ref name="a">foo</ref>
17336 This should just get lost.
17337 </references>
17338 !!result
17339 <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>
17340 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>
17341
17342
17343 <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":{}}'>
17344 <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>
17345 <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>
17346 </ol>
17347 !!end
17348
17349 !!test
17350 References: 6. <references /> from a transclusion
17351 !!options
17352 parsoid
17353 !!input
17354 <ref>Foo</ref> {{echo|<references />}}
17355 !!result
17356 <span about="#mwt3" class="reference" data-mw='{"name":"ref","body":{"html":"Foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> <ol class="references" typeof="mw:Extension/references mw:Transclusion" about="#mwt4" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;references />"}},"i":0}}]}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> Foo</li></ol>
17357 !!end
17358
17359 !! test
17360 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
17361 !! options
17362 parsoid
17363 !! input
17364 A <ref>foo bar for a</ref>
17365 B <ref name="b" />
17366
17367 <references />
17368
17369 <references>
17370 <ref name="b">foo</ref>
17371 </references>
17372 !! result
17373 <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>
17374 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>
17375
17376
17377 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-parsoid='{"src":"&lt;references />","dsr":[47,61,2,2]}' data-mw='{"name":"references","attrs":{}}'>
17378 <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>
17379 <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>
17380
17381
17382 <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":{}}'>
17383 <li about="#cite_note-b-1" id="cite_note-b-1" data-parsoid="{}"><span rel="mw:referencedBy">↑</span> foo</li>
17384 </ol>
17385 !! end
17386
17387 #### ----------------------------------------------------------------
17388 #### The following section of tests are primarily to test
17389 #### wikitext escaping capabilities of Parsoid. Given that
17390 #### escaping can be done any number of ways, the wikitext (input)
17391 #### is always adjusted to reflect how Parsoid adds nowiki
17392 #### escape tags.
17393 ####
17394 #### We are marking several tests as parsoid-only since the
17395 #### HTML in the result section is different from what the
17396 #### PHP parser generates for it.
17397 #### ----------------------------------------------------------------
17398
17399
17400 #### --------------- Headings ---------------
17401 #### 0. Unnested
17402 #### 1. Nested inside html <h1>=foo=</h1>
17403 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
17404 #### 3. Nested inside html with wikitext split by html tags
17405 #### 4. No escape needed
17406 #### 5. Empty headings <h1></h1>
17407 #### 6. Heading chars in SOL context
17408 #### ----------------------------------------
17409 !! test
17410 Headings: 0. Unnested
17411 !! options
17412 parsoid
17413 !! input
17414 <nowiki>=foo=</nowiki>
17415
17416 <nowiki> =foo= </nowiki>
17417 <!--cmt-->
17418 <nowiki>=foo=</nowiki>
17419
17420 =foo''a''<nowiki>=</nowiki>
17421 !! result
17422 <p><span typeof="mw:Nowiki">=foo=</span></p>
17423
17424 <p><span typeof="mw:Nowiki"> =foo= </span>
17425 <!--cmt-->
17426 <span typeof="mw:Nowiki">=foo=</span></p>
17427
17428 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
17429 !!end
17430
17431 !! test
17432 Headings: 1. Nested inside html
17433 (New headings and existing headings are handled differently)
17434 !! options
17435 parsoid=html2wt
17436 !! input
17437 = =foo= =
17438
17439 == =foo= ==
17440
17441 === =foo= ===
17442
17443 =<nowiki>=foo=</nowiki>=
17444 ==<nowiki>=foo=</nowiki>==
17445 ===<nowiki>=foo=</nowiki>===
17446 ====<nowiki>=foo=</nowiki>====
17447 =====<nowiki>=foo=</nowiki>=====
17448 ======<nowiki>=foo=</nowiki>======
17449
17450 !! result
17451 <h1>=foo=</h1>
17452 <h2>=foo=</h2>
17453 <h3>=foo=</h3>
17454
17455 <h1 data-parsoid='{}'>=foo=</h1>
17456 <h2 data-parsoid='{}'>=foo=</h2>
17457 <h3 data-parsoid='{}'>=foo=</h3>
17458 <h4 data-parsoid='{}'>=foo=</h4>
17459 <h5 data-parsoid='{}'>=foo=</h5>
17460 <h6 data-parsoid='{}'>=foo=</h6>
17461 !!end
17462
17463 !! test
17464 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
17465 !! options
17466 parsoid=html2wt
17467 !! input
17468 = foo =
17469 <nowiki>*</nowiki>bar
17470
17471 = foo =
17472 =bar
17473
17474 = foo =
17475 <nowiki>=bar=</nowiki>
17476 !! result
17477 <h1>foo</h1>*bar
17478 <h1>foo</h1>=bar
17479 <h1>foo</h1>=bar=
17480 !!end
17481
17482 !! test
17483 Headings: 3. Nested inside html with wikitext split by html tags
17484 !! options
17485 parsoid=html2wt
17486 !! input
17487 = ='''bold'''<nowiki>foo=</nowiki> =
17488 !! result
17489 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
17490 !!end
17491
17492 !! test
17493 Headings: 4a. No escaping needed (testing just h1 and h2)
17494 !! options
17495 parsoid=html2wt
17496 !! input
17497 = =foo =
17498
17499 = foo= =
17500
17501 = =foo= =
17502
17503 = =foo= bar =
17504
17505 == =foo ==
17506
17507 == foo= ==
17508
17509 = ''=''foo= =
17510
17511 = <nowiki>=</nowiki> =
17512 !! result
17513 <h1>=foo</h1>
17514 <h1>foo=</h1>
17515 <h1> =foo= </h1>
17516 <h1>=foo= bar</h1>
17517 <h2>=foo</h2>
17518 <h2>foo=</h2>
17519 <h1><i>=</i>foo=</h1>
17520 <h1><span typeof="mw:Nowiki">=</span></h1>
17521 !!end
17522
17523 !! test
17524 Headings: 4b. No escaping needed (inside p-tags)
17525 !! options
17526 parsoid=html2wt
17527 !! input
17528 ===
17529 =foo= x
17530 =foo= <s></s>
17531 !! result
17532 <p>===
17533 =foo= x
17534 =foo= <s></s>
17535 </p>
17536 !!end
17537
17538 !! test
17539 Headings: 5. Empty headings
17540 !! options
17541 parsoid
17542 !! input
17543 =<nowiki/>=
17544
17545 ==<nowiki/>==
17546
17547 ===<nowiki/>===
17548
17549 ====<nowiki/>====
17550
17551 =====<nowiki/>=====
17552
17553 ======<nowiki/>======
17554 !! result
17555 <h1></h1>
17556 <h2></h2>
17557 <h3></h3>
17558 <h4></h4>
17559 <h5></h5>
17560 <h6></h6>
17561 !!end
17562
17563 !! test
17564 Headings: 6a. Heading chars in SOL context (with trailing spaces)
17565 !! options
17566 parsoid
17567 !! input
17568 <nowiki>=a=</nowiki>
17569
17570 <nowiki>=a=</nowiki>
17571
17572 <nowiki>=a=</nowiki>
17573
17574 <nowiki>=a=</nowiki>
17575 !! result
17576 <p>=a=</p>
17577 <p>=a= </p>
17578 <p>=a= </p>
17579 <p>=a= </p>
17580 !!end
17581
17582 !! test
17583 Headings: 6b. Heading chars in SOL context (with trailing newlines)
17584 !! options
17585 parsoid
17586 !! input
17587 <nowiki>=a=
17588 b</nowiki>
17589
17590 <nowiki>=a=
17591 b</nowiki>
17592
17593 <nowiki>=a=
17594 b</nowiki>
17595
17596 <nowiki>=a=
17597 b</nowiki>
17598 !! result
17599 <p>=a=
17600 b</p>
17601 <p>=a=
17602 b</p>
17603 <p>=a=
17604 b</p>
17605 <p>=a=
17606 b</p>
17607 </p>
17608 !!end
17609
17610 !! test
17611 Headings: 6c. Heading chars in SOL context (leading newline break)
17612 !! options
17613 parsoid
17614 !! input
17615 a
17616 <nowiki>=b=</nowiki>
17617 !! result
17618 <p>a
17619 =b=</p>
17620 !!end
17621
17622 !! test
17623 Headings: 6d. Heading chars in SOL context (with interspersed comments)
17624 !! options
17625 parsoid
17626 !! input
17627 <!--c0--><nowiki>=a=</nowiki>
17628
17629 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
17630 !! result
17631 <p><!--c0-->=a=</p>
17632 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
17633 !!end
17634
17635 !! test
17636 Headings: 6d. Heading chars in SOL context (No escaping needed)
17637 !! options
17638 parsoid=html2wt
17639 !! input
17640 =a=<div>b</div>
17641 !! result
17642 =a=<div>b</div>
17643 !!end
17644
17645 #### --------------- Lists ---------------
17646 #### 0. Outside nests (*foo, etc.)
17647 #### 1. Nested inside html <ul><li>*foo</li></ul>
17648 #### 2. Inside definition lists
17649 #### 3. Only bullets at start should be escaped
17650 #### 4. No escapes needed
17651 #### 5. No unnecessary escapes
17652 #### 6. Escape bullets in SOL position
17653 #### 7. Escape bullets in a multi-line context
17654 #### ----------------------------------------
17655
17656 !! test
17657 Lists: 0. Outside nests
17658 !! input
17659 <nowiki>*</nowiki>foo
17660
17661 <nowiki>#</nowiki>foo
17662 !! result
17663 <p>*foo
17664 </p><p>#foo
17665 </p>
17666 !!end
17667
17668 !! test
17669 Lists: 1. Nested inside html
17670 !! input
17671 *<nowiki>*foo</nowiki>
17672
17673 *<nowiki>#foo</nowiki>
17674
17675 *<nowiki>:foo</nowiki>
17676
17677 *<nowiki>;foo</nowiki>
17678
17679 #<nowiki>*foo</nowiki>
17680
17681 #<nowiki>#foo</nowiki>
17682
17683 #<nowiki>:foo</nowiki>
17684
17685 #<nowiki>;foo</nowiki>
17686 !! result
17687 <ul>
17688 <li>*foo
17689 </li>
17690 </ul>
17691 <ul>
17692 <li>#foo
17693 </li>
17694 </ul>
17695 <ul>
17696 <li>:foo
17697 </li>
17698 </ul>
17699 <ul>
17700 <li>;foo
17701 </li>
17702 </ul>
17703 <ol>
17704 <li>*foo
17705 </li>
17706 </ol>
17707 <ol>
17708 <li>#foo
17709 </li>
17710 </ol>
17711 <ol>
17712 <li>:foo
17713 </li>
17714 </ol>
17715 <ol>
17716 <li>;foo
17717 </li>
17718 </ol>
17719
17720 !!end
17721
17722 !! test
17723 Lists: 2. Inside definition lists
17724 !! input
17725 ;<nowiki>;foo</nowiki>
17726
17727 ;<nowiki>:foo</nowiki>
17728
17729 ;<nowiki>:foo</nowiki>
17730 :bar
17731
17732 :<nowiki>:foo</nowiki>
17733 !! result
17734 <dl>
17735 <dt>;foo
17736 </dt>
17737 </dl>
17738 <dl>
17739 <dt>:foo
17740 </dt>
17741 </dl>
17742 <dl>
17743 <dt>:foo
17744 </dt>
17745 <dd>bar
17746 </dd>
17747 </dl>
17748 <dl>
17749 <dd>:foo
17750 </dd>
17751 </dl>
17752
17753 !!end
17754
17755 !! test
17756 Lists: 3. Only bullets at start of text should be escaped
17757 !! input
17758 *<nowiki>*foo*bar</nowiki>
17759
17760 *<nowiki>*foo</nowiki>''it''*bar
17761 !! result
17762 <ul>
17763 <li>*foo*bar
17764 </li>
17765 </ul>
17766 <ul>
17767 <li>*foo<i>it</i>*bar
17768 </li>
17769 </ul>
17770
17771 !!end
17772
17773 !! test
17774 Lists: 4. No escapes needed
17775 !! options
17776 parsoid
17777 !! input
17778 *foo*bar
17779
17780 *''foo''*bar
17781
17782 *[[Foo]]: bar
17783
17784 *[[Foo]]*bar
17785 !! result
17786 <ul>
17787 <li>foo*bar
17788 </li>
17789 </ul>
17790 <ul>
17791 <li><i>foo</i>*bar
17792 </li>
17793 </ul>
17794 <ul>
17795 <li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
17796 </li>
17797 </ul>
17798 <ul>
17799 <li><a rel="mw:WikiLink" href="Foo">Foo</a>*bar
17800 </li>
17801 </ul>
17802 !!end
17803
17804 !! test
17805 Lists: 5. No unnecessary escapes
17806 !! input
17807 * bar <span><nowiki>[[foo]]</nowiki></span>
17808
17809 *=bar <span><nowiki>[[foo]]</nowiki></span>
17810
17811 *[[bar <span><nowiki>[[foo]]</nowiki></span>
17812
17813 *]]bar <span><nowiki>[[foo]]</nowiki></span>
17814
17815 *=bar <span>foo]]</span>=
17816
17817 * <s></s>: a
17818 !! result
17819 <ul>
17820 <li> bar <span>[[foo]]</span>
17821 </li>
17822 </ul>
17823 <ul>
17824 <li>=bar <span>[[foo]]</span>
17825 </li>
17826 </ul>
17827 <ul>
17828 <li>[[bar <span>[[foo]]</span>
17829 </li>
17830 </ul>
17831 <ul>
17832 <li>]]bar <span>[[foo]]</span>
17833 </li>
17834 </ul>
17835 <ul>
17836 <li>=bar <span>foo]]</span>=
17837 </li>
17838 </ul>
17839 <ul>
17840 <li> <s></s>: a
17841 </li>
17842 </ul>
17843
17844 !!end
17845
17846 !! test
17847 Lists: 6. Escape bullets in SOL position
17848 !! options
17849 parsoid
17850 !! input
17851 <!--cmt--><nowiki>*foo</nowiki>
17852 !! result
17853 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
17854 !!end
17855
17856 !! test
17857 Lists: 7. Escape bullets in a multi-line context
17858 !! input
17859 a
17860 <nowiki>*</nowiki>b
17861 !! result
17862 <p>a
17863 *b
17864 </p>
17865 !!end
17866
17867 #### --------------- HRs ---------------
17868 #### 1. Single line
17869 #### -----------------------------------
17870
17871 !! test
17872 HRs: 1. Single line
17873 !! options
17874 parsoid
17875 !! input
17876 ----<nowiki>----</nowiki>
17877 ----=foo=
17878 ----*foo
17879 !! result
17880 <hr><span typeof="mw:Nowiki">----</span>
17881 <hr>=foo=
17882 <hr>*foo
17883 !! end
17884
17885 #### --------------- Tables ---------------
17886 #### 1a. Simple example
17887 #### 1b. No escaping needed (!foo)
17888 #### 1c. No escaping needed (|foo)
17889 #### 1d. No escaping needed (|}foo)
17890 ####
17891 #### 2a. Nested in td (<td>foo|bar</td>)
17892 #### 2b. Nested in td (<td>foo||bar</td>)
17893 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
17894 ####
17895 #### 3a. Nested in th (<th>foo!bar</th>)
17896 #### 3b. Nested in th (<th>foo!!bar</th>)
17897 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
17898 ####
17899 #### 4a. Escape -
17900 #### 4b. Escape +
17901 #### 4c. No escaping needed
17902 #### --------------------------------------
17903
17904 !! test
17905 Tables: 1a. Simple example
17906 !! input
17907 <nowiki>{|
17908 |}</nowiki>
17909 !! result
17910 <p>{|
17911 |}
17912 </p>
17913 !! end
17914
17915 !! test
17916 Tables: 1b. No escaping needed
17917 !! input
17918 !foo
17919 !! result
17920 <p>!foo
17921 </p>
17922 !! end
17923
17924 !! test
17925 Tables: 1c. No escaping needed
17926 !! input
17927 |foo
17928 !! result
17929 <p>|foo
17930 </p>
17931 !! end
17932
17933 !! test
17934 Tables: 1d. No escaping needed
17935 !! input
17936 |}foo
17937 !! result
17938 <p>|}foo
17939 </p>
17940 !! end
17941
17942 !! test
17943 Tables: 2a. Nested in td
17944 !! options
17945 parsoid=html2wt
17946 !! input
17947 {|
17948 |<nowiki>foo|bar</nowiki>
17949 |-
17950 |x<div><nowiki>a|b</nowiki></div>
17951 |}
17952 !! result
17953 <table><tbody><tr>
17954 <td>foo|bar</td></tr>
17955 <tr><td>x<div>a|b</div></td>
17956 </tbody></table>
17957 !! end
17958
17959 !! test
17960 Tables: 2b. Nested in td
17961 !! options
17962 parsoid
17963 !! input
17964 {|
17965 |<nowiki>foo||bar</nowiki>
17966 |''it''<nowiki>foo||bar</nowiki>
17967 |}
17968 !! result
17969 <table><tbody><tr>
17970 <td><span typeof="mw:Nowiki">foo||bar</span></td>
17971 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
17972 !! end
17973
17974 !! test
17975 Tables: 2c. Nested in td -- no escaping needed
17976 !! options
17977 parsoid
17978 !! input
17979 {|
17980 |foo!!bar
17981 |}
17982 !! result
17983 <table><tbody><tr><td>foo!!bar
17984 </td></tr></tbody></table>
17985
17986 !! end
17987
17988 !! test
17989 Tables: 3a. Nested in th
17990 !! options
17991 parsoid
17992 !! input
17993 {|
17994 !foo!bar
17995 |}
17996 !! result
17997 <table><tbody><tr><th>foo!bar
17998 </th></tr></tbody></table>
17999
18000 !! end
18001
18002 !! test
18003 Tables: 3b. Nested in th
18004 !! options
18005 parsoid
18006 !! input
18007 {|
18008 !<nowiki>foo!!bar</nowiki>
18009 |}
18010 !! result
18011 <table>
18012 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
18013 </tbody></table>
18014 !! end
18015
18016 !! test
18017 Tables: 3c. Nested in th -- no escaping needed
18018 !! options
18019 parsoid
18020 !! input
18021 {|
18022 !<nowiki>foo||bar</nowiki>
18023 |}
18024 !! result
18025 <table><tbody><tr>
18026 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
18027 !! end
18028
18029 !! test
18030 Tables: 4a. Escape -
18031 !! options
18032 parsoid
18033 !! input
18034 {|
18035 !-bar
18036 |-
18037 |<nowiki>-bar</nowiki>
18038 |}
18039 !! result
18040 <table><tbody>
18041 <tr><th>-bar</th></tr>
18042 <tr>
18043 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
18044 !! end
18045
18046 !! test
18047 Tables: 4b. Escape +
18048 !! options
18049 parsoid
18050 !! input
18051 {|
18052 !+bar
18053 |-
18054 |<nowiki>+bar</nowiki>
18055 |}
18056 !! result
18057 <table><tbody>
18058 <tr><th>+bar</th></tr>
18059 <tr>
18060 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
18061 !! end
18062
18063 !! test
18064 Tables: 4c. No escaping needed
18065 !! options
18066 parsoid
18067 !! input
18068 {|
18069 |foo-bar
18070 |foo+bar
18071 |-
18072 |''foo''-bar
18073 |''foo''+bar
18074 |-
18075 |foo
18076 bar|baz
18077 +bar
18078 -bar
18079 |-
18080 |x
18081 <div>a|b</div>
18082 |}
18083 !! result
18084 <table><tbody>
18085 <tr><td>foo-bar</td><td>foo+bar</td></tr>
18086 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
18087 <tr><td>foo
18088 <p>bar|baz
18089 +bar
18090 -bar</p></td></tr>
18091 <tr><td>x
18092 <div>a|b</div></td>
18093 </tbody></table>
18094 !! end
18095
18096 !! test
18097 Tables: 4d. No escaping needed
18098 !! options
18099 parsoid
18100 !! input
18101 {|
18102 |[[Foo]]-bar
18103 ||+1
18104 ||-2
18105 |}
18106 !! result
18107 <table>
18108 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo">Foo</a>-bar</td>
18109 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
18110 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
18111 </tbody></table>
18112 !! end
18113
18114 #### --------------- Links ----------------
18115 #### 1. Quote marks in link text
18116 #### 2. Wikilinks: Escapes needed
18117 #### 3. Wikilinks: No escapes needed
18118 #### 4. Extlinks: Escapes needed
18119 #### 5. Extlinks: No escapes needed
18120 #### --------------------------------------
18121 !! test
18122 Links 1. Quote marks in link text
18123 !! options
18124 parsoid
18125 !! input
18126 [[Foo|Foo<nowiki>''boo''</nowiki>]]
18127 !! result
18128 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
18129 !! end
18130
18131 !! test
18132 Links 2. WikiLinks: Escapes needed
18133 !! options
18134 parsoid
18135 !! input
18136 [[Foo|<nowiki>[Foobar]</nowiki>]]
18137 [[Foo|<nowiki>Foobar]</nowiki>]]
18138 [[Foo|x [Foobar] x]]
18139 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
18140 [[Foo|<nowiki>[[Bar]]</nowiki>]]
18141 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
18142 [[Foo|<nowiki>|Bar</nowiki>]]
18143 [[Foo|<nowiki>]]bar</nowiki>]]
18144 [[Foo|<nowiki>[[bar</nowiki>]]
18145 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
18146 !! result
18147 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
18148 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
18149 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
18150 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
18151 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
18152 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
18153 <a href="Foo" rel="mw:WikiLink">|Bar</a>
18154 <a href="Foo" rel="mw:WikiLink">]]bar</a>
18155 <a href="Foo" rel="mw:WikiLink">[[bar</a>
18156 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
18157 !! end
18158
18159 !! test
18160 Links 3. WikiLinks: No escapes needed
18161 !! options
18162 parsoid
18163 !! input
18164 [[Foo|[Foobar]]
18165 [[Foo|foo|bar]]
18166 !! result
18167 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
18168 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
18169 !! end
18170
18171 !! test
18172 Links 4. ExtLinks: Escapes needed
18173 !! options
18174 parsoid
18175 !! input
18176 [http://google.com <nowiki>[google]</nowiki>]
18177 [http://google.com <nowiki>google]</nowiki>]
18178
18179 <nowiki>[http://google.com]</nowiki>
18180
18181 <nowiki>[http://google.com google]</nowiki>
18182
18183 !! result
18184 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
18185 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
18186 <p>[http://google.com]</p>
18187 <p>[http://google.com google]</p>
18188 !! end
18189
18190 !! test
18191 Links 5. ExtLinks: No escapes needed
18192 !! options
18193 parsoid
18194 !! input
18195 [http://google.com [google]
18196 !! result
18197 <a href="http://google.com" rel="mw:ExtLink">[google</a>
18198 !! end
18199
18200 #### --------------- Quotes ---------------
18201 #### 1. Quotes inside <b> and <i>
18202 #### 2. Link fragments separated by <i> and <b> tags
18203 #### 3. Link fragments inside <i> and <b>
18204 #### 4. No escaping needed
18205 #### --------------------------------------
18206 !! test
18207 1. Quotes inside <b> and <i>
18208 !! options
18209 parsoid=html2wt,wt2wt
18210 !! input
18211 ''<nowiki>'foo'</nowiki>''
18212 ''<nowiki>''foo''</nowiki>''
18213 ''<nowiki>'''foo'''</nowiki>''
18214 ''foo''<nowiki/>'s
18215 '''<nowiki>'foo'</nowiki>'''
18216 '''<nowiki>''foo''</nowiki>'''
18217 '''<nowiki>'''foo'''</nowiki>'''
18218 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
18219 '''foo'''<nowiki/>'s
18220 '''foo''
18221 ''foo''<nowiki/>'
18222 '<nowiki/>''foo''<nowiki/>'
18223 ''''foo'''
18224 '''foo'''<nowiki/>'
18225 '<nowiki/>'''foo'''<nowiki/>'
18226 ''fools'<span> errand</span>''
18227 ''<span>fool</span>'s errand''
18228 !! result
18229 <p><i>'foo'</i>
18230 <i>''foo''</i>
18231 <i>'''foo'''</i>
18232 <i>foo</i>'s
18233 <b>'foo'</b>
18234 <b>''foo''</b>
18235 <b>'''foo'''</b>
18236 <b>foo'<i>bar'</i>baz</b>
18237 <b>foo</b>'s
18238 '<i>foo</i>
18239 <i>foo</i>'
18240 '<i>foo</i>'
18241 '<b>foo</b>
18242 <b>foo</b>'
18243 '<b>foo</b>'</p>
18244 <i>fools'<span> errand</span></i>
18245 <i><span>fool</span>'s errand</i>
18246 !! end
18247
18248 !! test
18249 2. Link fragments separated by <i> and <b> tags
18250 !! input
18251 [[''foo''<nowiki>hello]]</nowiki>
18252
18253 [['''foo'''<nowiki>hello]]</nowiki>
18254 !! result
18255 <p>[[<i>foo</i>hello]]
18256 </p><p>[[<b>foo</b>hello]]
18257 </p>
18258 !! end
18259
18260 !! test
18261 3. Link fragments inside <i> and <b>
18262 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
18263 this is one of the shortcomings of this format)
18264 !! input
18265 ''[[foo''<nowiki>]]</nowiki>
18266
18267 '''[[foo'''<nowiki>]]</nowiki>
18268 !! result
18269 <p><i>[[foo</i>]]
18270 </p><p><b>[[foo</b>]]
18271 </p>
18272 !! end
18273
18274 !! test
18275 4. No escaping needed
18276 !! input
18277 '<span>''bar''</span>'
18278 '<span>'''bar'''</span>'
18279 !! result
18280 <p>'<span><i>bar</i></span>'
18281 '<span><b>bar</b></span>'
18282 </p>
18283 !! end
18284
18285 #### ----------- Paragraphs ---------------
18286 #### 1. No unnecessary escapes
18287 #### --------------------------------------
18288
18289 !! test
18290 1. No unnecessary escapes
18291 !! input
18292 bar <span><nowiki>[[foo]]</nowiki></span>
18293
18294 =bar <span><nowiki>[[foo]]</nowiki></span>
18295
18296 [[bar <span><nowiki>[[foo]]</nowiki></span>
18297
18298 ]]bar <span><nowiki>[[foo]]</nowiki></span>
18299
18300 =bar <span>foo]]</span><nowiki>=</nowiki>
18301 !! result
18302 <p>bar <span>[[foo]]</span>
18303 </p><p>=bar <span>[[foo]]</span>
18304 </p><p>[[bar <span>[[foo]]</span>
18305 </p><p>]]bar <span>[[foo]]</span>
18306 </p><p>=bar <span>foo]]</span>=
18307 </p>
18308 !!end
18309
18310 #### ----------------------- PRE --------------------------
18311 #### 1. Leading whitespace in SOL context should be escaped
18312 #### ------------------------------------------------------
18313 !! test
18314 1. Leading whitespace in SOL context should be escaped
18315 !! options
18316 parsoid
18317 !! input
18318 <nowiki> </nowiki>a
18319
18320 <nowiki> </nowiki> a
18321
18322 <nowiki> </nowiki>a(tab)
18323
18324 <nowiki> </nowiki> a
18325 <!--cmt-->
18326 <nowiki> </nowiki> a
18327
18328 a
18329 <nowiki> </nowiki>b
18330
18331 a
18332 <nowiki> </nowiki>b
18333
18334 a
18335 <nowiki> </nowiki> b
18336 !! result
18337 <p> a</p>
18338 <p> a</p>
18339 <p> a(tab)</p>
18340 <p> a</p>
18341 <p><!--cmt--> a</p>
18342 <p>a
18343 b</p>
18344 <p>a
18345 b</p>
18346 <p>a
18347 b</p>
18348 !! end
18349
18350 #### --------------- Behavior Switches --------------------
18351 !! test
18352 1. Valid behavior switches should be escaped
18353 !! options
18354 parsoid=html2wt
18355 !! input
18356 <nowiki>__TOC__</nowiki>
18357 !! result
18358 __TOC__
18359 !! end
18360
18361 !! test
18362 2. Invalid behavior switches should not be escaped
18363 !! options
18364 parsoid=html2wt
18365 !! input
18366 __TOO__
18367 __|__
18368 !! result
18369 __TOO__
18370 __|__
18371 !! end
18372
18373 #### --------------- HTML tags ---------------
18374 #### 1. a tags
18375 #### 2. other tags
18376 #### 3. multi-line html tag
18377 #### 4. extension tags
18378 #### -----------------------------------------
18379 !! test
18380 1. a tags
18381 !! options
18382 parsoid
18383 !! input
18384 <a href="http://google.com">google</a>
18385 !! result
18386 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
18387 !! end
18388
18389 !! test
18390 2. other tags
18391 !! input
18392 <nowiki><div>foo</div>
18393 <div style="color:red">foo</div></nowiki>
18394 !! result
18395 <p>&lt;div&gt;foo&lt;/div&gt;
18396 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
18397 </p>
18398 !! end
18399
18400 !! test
18401 3. multi-line html tag
18402 !! input
18403 <nowiki><div
18404 >foo</div
18405 ></nowiki>
18406 !! result
18407 <p>&lt;div
18408 &gt;foo&lt;/div
18409 &gt;
18410 </p>
18411 !! end
18412
18413 !! test
18414 4. extension tags
18415 !! input
18416 <nowiki><ref>foo</ref></nowiki>
18417
18418 <nowiki><ref>bar</nowiki>
18419
18420 baz<nowiki></ref></nowiki>
18421 !! result
18422 <p>&lt;ref&gt;foo&lt;/ref&gt;
18423 </p><p>&lt;ref&gt;bar
18424 </p><p>baz&lt;/ref&gt;
18425 </p>
18426 !! end
18427
18428 #### --------------- Others ---------------
18429 !! test
18430 Escaping nowikis
18431 !! input
18432 &lt;nowiki&gt;foo&lt;/nowiki&gt;
18433 !! result
18434 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
18435 </p>
18436 !! end
18437
18438 ## The quote-char in the input is necessary for triggering the bug
18439 !! test
18440 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
18441 !! options
18442 parsoid=wt2wt,html2wt
18443 !! input
18444 foo's bar :
18445 !! result
18446 <p>foo's bar :</p>
18447 !! end
18448
18449 !! test
18450
18451 Tag-like HTML structures are passed through as text
18452 !! input
18453 <x y>
18454
18455 <x.y>
18456
18457 <x-y>
18458
18459 1>2
18460
18461 x<y
18462
18463 a>b
18464
18465 1<d e>f
18466 !! result
18467 <p>&lt;x y&gt;
18468 </p><p>&lt;x.y&gt;
18469 </p><p>&lt;x-y&gt;
18470 </p><p>1&gt;2
18471 </p><p>x&lt;y
18472 </p><p>a&gt;b
18473 </p><p>1&lt;d e&gt;f
18474 </p>
18475 !! end
18476
18477
18478 # This was a bug in the PHP parser (see bug 17663 and its dups,
18479 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
18480 !! test
18481 Tag names followed by punctuation should not be recognized as tags
18482 !! input
18483 <s.ome> text
18484 !! result
18485 <p>&lt;s.ome&gt; text
18486 </p>
18487 !! end
18488
18489 !! test
18490 HTML tag with necessary entities in attributes
18491 !! input
18492 <span title="&amp;amp;">foo</span>
18493 !! result
18494 <p><span title="&amp;amp;">foo</span>
18495 </p>
18496 !! end
18497
18498 !! test
18499 HTML tag with 'unnecessary' entity encoding in attributes
18500 !! input
18501 <span title="&amp;">foo</span>
18502 !! result
18503 <p><span title="&amp;">foo</span>
18504 </p>
18505 !! end
18506
18507 !! test
18508 HTML tag with broken attribute value quoting
18509 !! input
18510 <span title="Hello world>Foo</span>
18511 !! result
18512 <p><span>Foo</span>
18513 </p>
18514 !! end
18515
18516 !! test
18517 Parsoid-only: HTML tag with broken attribute value quoting
18518 !! options
18519 parsoid
18520 !! input
18521 <span title="Hello world>Foo</span>
18522 !! result
18523 <p><span title="Hello world">Foo</span>
18524 </p>
18525 !! end
18526
18527 !! test
18528 Table with broken attribute value quoting
18529 !! input
18530 {|
18531 | title="Hello world|Foo
18532 |}
18533 !! result
18534 <table>
18535 <tr>
18536 <td>Foo
18537 </td></tr></table>
18538
18539 !! end
18540
18541 !! test
18542 Table with broken attribute value quoting on consecutive lines
18543 !! input
18544 {|
18545 | title="Hello world|Foo
18546 | style="color:red|Bar
18547 |}
18548 !! result
18549 <table>
18550 <tr>
18551 <td>Foo
18552 </td>
18553 <td>Bar
18554 </td></tr></table>
18555
18556 !! end
18557
18558 !! test
18559 Parsoid-only: Table with broken attribute value quoting on consecutive lines
18560 !! options
18561 parsoid
18562 !! input
18563 {|
18564 | title="Hello world|Foo
18565 | style="color:red|Bar
18566 |}
18567 !! result
18568 <table><tbody>
18569 <tr>
18570 <td title="Hello world">Foo
18571 </td><td style="color: red">Bar
18572 </td></tr></tbody></table>
18573
18574 !! end
18575
18576 !! test
18577 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
18578 !! options
18579 parsoid
18580 !! input
18581 {{}}
18582 !! result
18583 {{}}
18584 !! end
18585
18586 !! test
18587 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
18588 !! options
18589 parsoid
18590 !! input
18591 }}{{
18592 !! result
18593 }}{{
18594 !! end
18595
18596 !!test
18597 Accept empty td cell attribute
18598 !!input
18599 {|
18600 | align="center" | foo || |
18601 |}
18602 !!result
18603 <table>
18604 <tr>
18605 <td align="center"> foo </td>
18606 <td>
18607 </td></tr></table>
18608
18609 !!end
18610
18611 !!test
18612 Non-empty attributes in th-cells
18613 !!input
18614 {|
18615 ! Foo !! style="color: red" | Bar
18616 |}
18617 !!result
18618 <table>
18619 <tr>
18620 <th> Foo </th>
18621 <th style="color: red"> Bar
18622 </th></tr></table>
18623
18624 !!end
18625
18626 !!test
18627 Accept empty attributes in th-cells
18628 !!input
18629 {|
18630 !| foo !!| bar
18631 |}
18632 !!result
18633 <table>
18634 <tr>
18635 <th> foo </th>
18636 <th> bar
18637 </th></tr></table>
18638
18639 !!end
18640
18641 !!test
18642 Empty table rows go away
18643 !!input
18644 {|
18645 | Hello
18646 | there
18647 |- class="foo"
18648 |-
18649 |}
18650 !! result
18651 <table>
18652 <tr>
18653 <td> Hello
18654 </td>
18655 <td> there
18656 </td></tr>
18657
18658 </table>
18659
18660 !! end
18661
18662 ###
18663 ### Parsoid-centric tests for testing RTing of inter-element separators
18664 ### Edge cases not tested by existing parser tests and specific to
18665 ### Parsoid-specific serialization strategies.
18666 ###
18667
18668 !!test
18669 RT-ed inter-element separators should be valid separators
18670 !!input
18671 {|
18672 |- [[foo]]
18673 |}
18674 !!result
18675 <table>
18676
18677 </table>
18678
18679 !!end
18680
18681 !!test
18682 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
18683 (Parsoid-only since PHP parser relies on Tidy for correct output)
18684 !!options
18685 parsoid
18686 !!input
18687 {|
18688 |<small>foo
18689 bar
18690 |}
18691
18692 {|
18693 |<small>foo<small>
18694 |}
18695 !!result
18696 !!end
18697
18698 !!test
18699 Empty TD followed by TD with tpl-generated attribute
18700 !!input
18701 {|
18702 |-
18703 |
18704 |{{echo|style='color:red'}}|foo
18705 |}
18706 !!result
18707 <table>
18708
18709 <tr>
18710 <td>
18711 </td>
18712 <td>foo
18713 </td></tr></table>
18714
18715 !!end
18716
18717 !!test
18718 Indented table with an empty td
18719 !!input
18720 {|
18721 |-
18722 |
18723 |foo
18724 |}
18725 !!result
18726 <table>
18727
18728 <tr>
18729 <td>
18730 </td>
18731 <td>foo
18732 </td></tr></table>
18733
18734 !!end
18735
18736 !!test
18737 Empty TR followed by a template-generated TR
18738 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
18739 !!options
18740 parsoid
18741 !!input
18742 {|
18743 |-
18744 {{echo|<tr><td>foo</td></tr>}}
18745 |}
18746 !!result
18747 <table>
18748 <tbody>
18749 <tr></tr>
18750 <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}}]}'>
18751 <td>foo</td></tr>
18752 </tbody></table>
18753 !!end
18754
18755 ## PHP and parsoid output differ for this, and since this is primarily
18756 ## for testing Parsoid's serializer, marking this Parsoid only
18757 !!test
18758 Empty TR followed by mixed-ws-comment line should RT correctly
18759 !!options
18760 parsoid
18761 !!input
18762 {|
18763 |-
18764 <!--c-->
18765 |-
18766 <!--c--> <!--d-->
18767 |}
18768 !!result
18769 <table>
18770 <tbody>
18771 <tr></tr>
18772 <!--c-->
18773 <tr>
18774 <!--c--> </tr><!--d-->
18775 </tbody></table>
18776
18777 !!end
18778
18779 !!test
18780 Multi-line image caption generated by templates with/without trailing newlines
18781 !!options
18782 parsoid
18783 !!input
18784 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
18785 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
18786 !!result
18787 <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>
18788 <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>
18789
18790 !!end
18791
18792 ## PHP emits broken html for this, and since this is primarily
18793 ## a Parsoid serializer test, marking this Parsoid only
18794 !!test
18795 Improperly nested inline or quotes tags with whitespace in between
18796 !!options
18797 parsoid
18798 !!input
18799 <span> <s>x</span> </s>
18800 ''' ''x''' ''
18801 !!result
18802 <p><span> <s>x</s></span><s> </s>
18803 <b> <i>x</i></b><i> </i>
18804 </p>
18805 !!end
18806
18807 !!test
18808 Encapsulate protected attributes from wt
18809 !!options
18810 parsoid
18811 !!input
18812 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
18813 !!result
18814 <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>
18815 </body>
18816 !!end
18817
18818 ## Currently the p-wrapper is fragile in how adds / removes transformations.
18819 ## Having nested or stray pre tags results in the attempt to add duplicates,
18820 ## causing an assertion fail. This test tries to prevent that situation.
18821 !!test
18822 Ensure ParagraphWrapper can deal with stray closing pre tags
18823 !!options
18824 parsoid=wt2html
18825 !!input
18826 plain text</pre>
18827 !!result
18828 plain text
18829 !!end
18830
18831 !!test
18832 Ensure fostered text content is wrapped in spans
18833 !!options
18834 parsoid=wt2html
18835 !!input
18836 <table>hi</table><table>ho</table>
18837 !!result
18838 <span>hi</span>
18839 <table></table>
18840 <span>ho</span>
18841 <table></table>
18842 !!end
18843
18844 !!test
18845 Encapsulation properly handles null DSR information from foster box
18846 !!options
18847 parsoid=wt2html,wt2wt
18848 !!input
18849 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
18850 !!result
18851 <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;
18852 <table>foo
18853 <tr>
18854 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
18855 <table>
18856 <tbody>
18857 <tr>
18858 <td>bar</td></tr></tbody></table>
18859 !!end
18860
18861 !!test
18862 1. Encapsulate foster-parented transclusion content
18863 !!options
18864 parsoid=wt2wt,wt2html
18865 !!input
18866 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
18867 !!result
18868 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
18869 <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
18870 <tr>
18871 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
18872 <table>
18873 <tbody>
18874 <tr>
18875 <td>bar</td></tr></tbody></table>
18876 !!end
18877
18878 !!test
18879 2. Encapsulate foster-parented transclusion content
18880 !!options
18881 parsoid=wt2wt,wt2html
18882 !!input
18883 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
18884 !!result
18885 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
18886 <table>
18887 <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>
18888 <tr>
18889 <td>bar</td></tr></table>&quot;]}">foo</div>
18890 <table>
18891 <tbody>
18892 <tr>
18893 <td>bar</td></tr></tbody></table>
18894 !!end
18895
18896 !!test
18897 3. Encapsulate foster-parented transclusion content
18898 !!options
18899 parsoid=wt2wt,wt2html
18900 !!input
18901 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
18902 !!result
18903 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
18904 <table>
18905 <div>
18906 <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>
18907 <tr>
18908 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
18909 <p>foo</p></div>
18910 <table>
18911 <tbody>
18912 <tr>
18913 <td>bar</td></tr></tbody></table>
18914 !!end
18915
18916 !!test
18917 4. Encapsulate foster-parented transclusion content
18918 !!options
18919 parsoid=wt2wt,wt2html
18920 !!input
18921 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
18922 !!result
18923 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
18924 <table>
18925 <div>
18926 <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>
18927 <tr>
18928 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
18929 <p>foo</p></div>
18930 <table>
18931 <tbody>
18932 <tr>
18933 <td>bar</td></tr></tbody></table>
18934 !!end
18935
18936 !!test
18937 5. Encapsulate foster-parented transclusion content
18938 !!options
18939 parsoid=wt2wt,wt2html
18940 !!input
18941 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
18942 !!result
18943 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
18944 <table>
18945 <tr>
18946 <td>
18947 <div>
18948 <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>
18949 <table>
18950 <tbody>
18951 <tr>
18952 <td>
18953 <div>
18954 <p>foo</p></div></td></tr></tbody></table>
18955 !!end
18956
18957 !!test
18958 6. Encapsulate foster-parented transclusion content
18959 !!options
18960 parsoid=wt2wt,wt2html
18961 !!input
18962 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
18963 !!result
18964 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
18965 <table>
18966 <tr>
18967 <td>
18968 <div>
18969 <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>
18970 <table>
18971 <tbody>
18972 <tr>
18973 <td>
18974 <div>
18975 <p>foo</p></div></td></tr></tbody></table>
18976 <p>ok</p>
18977 !!end
18978
18979 !!test
18980 7. Encapsulate foster-parented transclusion content
18981 !!options
18982 parsoid=wt2wt,wt2html
18983 !!input
18984 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
18985 !!result
18986 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
18987 <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;
18988 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
18989 <td>bar</td></table>&quot;]}">foo</p>
18990 <table>
18991 <tbody>
18992 <tr>
18993 <td>bar</td></tr></tbody></table>
18994 !!end
18995
18996 !!test
18997 8. Encapsulate foster-parented transclusion content
18998 !!options
18999 parsoid=wt2wt,wt2html
19000 !!input
19001 {{echo|a
19002 }}{|{{echo|style='color:red'}}
19003 |-
19004 |b
19005 |}
19006 !!result
19007 <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>
19008 <table>
19009 <tbody>
19010 <tr>
19011 <td>b</td></tr></tbody></table>
19012 !!end
19013
19014 !!test
19015 Table in fosterable position
19016 !!options
19017 parsoid=wt2html,wt2wt
19018 !!input
19019 {{OpenTable}}
19020 <div>
19021 {|
19022 |}
19023 </div>
19024 |}
19025 !!result
19026 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"OpenTable","href":"./Template:OpenTable"},"params":{},"i":0}},"\n&lt;div>"]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"dsr":[0,19,null,null],"src":"{{OpenTable}}\n&lt;div>","pi":[[]]}'></div><span about="#mwt1" data-parsoid="{}">
19027 </span>
19028 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"dsr":[null,19,2,0]}'></table>
19029
19030 <table data-parsoid='{"dsr":[20,25,2,2]}'>
19031 </table>
19032 !!end
19033
19034 # -----------------------------------------------------------------
19035 # The following section of tests are primarily to spec requirements
19036 # around serialization of new/edited content.
19037 #
19038 # All these tests are marked Parsoid html2wt and html2html only
19039 # ----------------------------------------------------------------
19040
19041 !! test
19042 Image: Modifying size of an image
19043 !! options
19044 parsoid=html2wt
19045 !! input
19046 [[Image:Wiki.png|230x230px]]
19047 !! result
19048 <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>
19049 !!end
19050
19051 !! test
19052 Image: New block level image should have \n before and after
19053 !! options
19054 parsoid=html2wt
19055 !! input
19056 123
19057 [[File:Wiki.png|right|thumb|150x150px]]
19058 456
19059 !! result
19060 <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>
19061 !!end
19062
19063 !! test
19064 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
19065 !! options
19066 parsoid=html2wt
19067 !! input
19068 * foo
19069 !! result
19070 <ul>
19071 <li><p>foo</p></li>
19072 </ul>
19073 !! end
19074
19075 !! test
19076 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
19077 !! options
19078 parsoid=html2wt
19079 !! input
19080 * foo
19081 !! result
19082 <ul> <li>foo</li></ul>
19083 !! end
19084
19085 !! test
19086 Don't strip leading whitespace when handling indent-pre suppressing tags
19087 !! options
19088 parsoid=html2wt
19089 !! input
19090 {|
19091 | indented row
19092 |}
19093 <blockquote>
19094 '''This is very bold of you!'''
19095
19096 {|
19097 |
19098 indented cell (no pre-wrapping!)
19099 |}
19100 </blockquote>
19101 foo
19102 <div>bar</div>
19103 !! result
19104 <table>
19105 <tr><td> indented row</td></tr>
19106 </table>
19107 <blockquote><p>
19108 <b>This is very bold of you!</b>
19109 </p>
19110 <table><tr><td>
19111 indented cell (no pre-wrapping!)
19112 </td></tr></table>
19113 </blockquote>
19114 <p>foo</p>
19115 <div>bar</div>
19116 !! end
19117
19118 !! test
19119 Strip leading whitespace when handling indent-pre inducing tags
19120 !! options
19121 parsoid=html2wt
19122 !! input
19123 foo
19124 <span>bar</span>
19125
19126 <span>foo2
19127 </span>bar2
19128
19129 <div>foo</div>
19130 <span>bar</span>
19131
19132 <div>
19133 <span>foo</span>
19134 </div>
19135 !! result
19136 <p>foo</p>
19137 <span>bar</span>
19138
19139 <span>foo2
19140 </span>bar2
19141
19142 <div>foo</div>
19143 <span>bar</span>
19144
19145 <div>
19146 <span>foo</span>
19147 </div>
19148 !! end
19149
19150 !! test
19151 Lists: Add space after bullets
19152 !! options
19153 parsoid=html2wt
19154 !! input
19155 * foo
19156 * bar
19157 * <span> baz</span>
19158 !! result
19159 <ul>
19160 <li>foo</li>
19161 <li> bar</li>
19162 <li><span> baz</span></li>
19163 </ul>
19164 !! end
19165
19166 !! test
19167 Headings: Add space before/after == (Bug 51744)
19168 !! options
19169 parsoid=html2wt
19170 !! input
19171 == foo ==
19172
19173 == bar ==
19174
19175 == baz ==
19176
19177 == <span> baz</span> ==
19178 !! result
19179 <h2>foo</h2>
19180 <h2> bar</h2>
19181 <h2>baz </h2>
19182 <h2><span> baz</span></h2>
19183 !! end
19184
19185 !! test
19186 Parsoid: Serialize positional parameters with = in them as named parameter
19187 !! options
19188 parsoid=html2wt
19189 !! input
19190 {{echo|1 = f=oo}}
19191
19192 {{echo|1 = f=oo|2 = bar}}
19193
19194 <!--Orig params with data-parsoid has heuristics for handling = chars-->
19195 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
19196 {{echo|<nowiki>f=oo</nowiki>|bar}}
19197 !! result
19198 <p about="#mwt1" typeof="mw:Transclusion"
19199 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
19200
19201 <p about="#mwt1" typeof="mw:Transclusion"
19202 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
19203
19204 <!--Orig params with data-parsoid has heuristics for handling = chars-->
19205 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
19206 <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>
19207 !! end
19208
19209 !! test
19210 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
19211 !! options
19212 parsoid=html2wt
19213 !! input
19214 <div>a
19215 b
19216 </div>
19217 <div>a
19218 b
19219 </div>
19220 <div>
19221 a
19222
19223 b
19224 </div>
19225 !! result
19226 <div>a<p>b</p></div>
19227 <div>a
19228 <p>b</p></div>
19229 <div>
19230 a
19231 <p>b</p></div>
19232 !! end
19233
19234 #-----------------------------
19235 # I/B quote minimization tests
19236 #-----------------------------
19237
19238 !! test
19239 1. I/B quote minimization: wikitext-only tags should be combined
19240 !! options
19241 parsoid=html2wt
19242 !! input
19243 ''AB''
19244
19245 '''AB'''
19246
19247 ''A'''B'''''
19248
19249 '''A''B'''''
19250
19251 '''A''BC''D'''
19252
19253 '''''AB'''''
19254
19255 '''''AB'''''
19256
19257 '''''AB'''''
19258 !! result
19259 <p><i>A</i><i>B</i></p>
19260 <p><b>A</b><b>B</b></p>
19261 <p><i>A</i><b><i>B</i></b></p>
19262 <p><b>A</b><i><b>B</b></i></p>
19263 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
19264 <p><i><b>A</b></i><i><b>B</b></i></p>
19265 <p><i><b>A</b></i><b><i>B</i></b></p>
19266 <p><b><i>A</i></b><i><b>B</b></i></p>
19267 !! end
19268
19269 !! test
19270 2. I/B quote minimization: wikitext and html tags should not be combined
19271 !! options
19272 parsoid=html2wt
19273 !! input
19274 ''A''<i>B</i>
19275
19276 ''A'''''<i>B</i>'''
19277 !! result
19278 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
19279 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
19280 !! end
19281
19282 !! test
19283 3. I/B quote minimization: templated content stops minimization
19284 !! options
19285 parsoid=html2wt
19286 !! input
19287 ''A''{{echo|''B''}}
19288
19289 ''A''{{echo|'''''B'''''}}
19290 !! result
19291 <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>
19292 <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>
19293 !! end
19294
19295 !! test
19296 4. I/B quote minimization: new content should be mimimized with adjacent old content
19297 !! options
19298 parsoid=html2wt
19299 !! input
19300 ''AB''
19301
19302 '''AB'''
19303
19304 ''A'''B'''''
19305 !! result
19306 <p><i>A</i><i data-parsoid='{}'>B</i></p>
19307 <p><b data-parsoid='{}'>A</b><b>B</b></p>
19308 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
19309 !! end
19310
19311 #------------------------------------
19312 # End of I/B quote minimization tests
19313 #------------------------------------
19314
19315 !!test
19316 Bug 54262: New entities
19317 !! options
19318 parsoid=html2wt
19319 !! input
19320 foo
19321 !! result
19322 <span typeof="mw:Entity">foo</span>
19323 !! end
19324
19325 ## Note that there is no wikitext output for 'unknownproperty' ##
19326 ## Unknown magic words are silently dropped ##
19327
19328 !! test
19329 Magic words
19330 !! options
19331 parsoid=html2wt
19332 !! input
19333 __TOC__
19334 __NOTOC__
19335 __FORCETOC__
19336 __INDEX__
19337 __NOINDEX__
19338 __NOGALLERY__
19339 __NOEDITSECTION__
19340 __NOTITLECONVERT__
19341 __NOCONTENTCONVERT__
19342 !! result
19343 <meta property='mw:PageProp/toc' />
19344 <meta property='mw:PageProp/notoc' />
19345 <meta property='mw:PageProp/forcetoc' />
19346 <meta property='mw:PageProp/index' />
19347 <meta property='mw:PageProp/noindex' />
19348 <meta property='mw:PageProp/nogallery' />
19349 <meta property='mw:PageProp/noeditsection' />
19350 <meta property='mw:PageProp/notitleconvert' />
19351 <meta property='mw:PageProp/nocontentconvert' />
19352 <meta property='mw:PageProp/unknownproperty' />
19353 !! end
19354
19355 !! test
19356 Consecutive <pre>s should not get merged
19357 !! options
19358 parsoid=html2wt,html2html
19359 !! input
19360 a
19361
19362 b
19363
19364 c
19365
19366 d
19367
19368 e
19369
19370
19371
19372 f
19373 !! result
19374 <pre>a</pre><pre>b</pre>
19375
19376 <pre>c
19377 </pre><pre>
19378 d</pre>
19379
19380 <pre>e
19381
19382 </pre><pre>
19383
19384 f</pre>
19385 !! end
19386
19387 !! test
19388 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
19389 !! options
19390 parsoid=html2wt
19391 !! input
19392 [[Special:BookSources/1234567890|ISBN 1234567895]]
19393 !! result
19394 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
19395 !! end
19396
19397 !! test
19398 Edited RFC links not serializable as RFC links should serialize as extlinks
19399 !! options
19400 parsoid=html2wt
19401 !! input
19402 [//tools.ietf.org/html/rfc123 New RFC]
19403 !! result
19404 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
19405 !! end
19406
19407 !! test
19408 Edited PMID links not serializable as PMID links should serialize as extlinks
19409 !! options
19410 parsoid=html2wt
19411 !! input
19412 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
19413 !! result
19414 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
19415 !! end
19416
19417 # -----------------------------------------------------------------
19418 # End of section for Parsoid-only html2wt tests for serialization
19419 # of new content
19420 # -----------------------------------------------------------------
19421
19422 TODO:
19423 more images
19424 more tables
19425 character entities
19426 and much more
19427 Try for 100% code coverage