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