Make TOC hideable
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-only test (not run by PHP parser)
25 # php php-only test (not run by the parsoid parser)
26 # showtitle make the first line the title
27 # comment run through Linker::formatComment() instead of main parser
28 # local format section links in edit comment text as local links
29 # notoc disable table of contents
30 #
31 # You can also set the following parser properties via test options:
32 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
33 # wgLinkHolderBatchSize, wgRawHtml
34 #
35 # For testing purposes, temporary articles can created:
36 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
37 # where '/' denotes a newline.
38
39 # This is the standard article assumed to exist.
40 !! article
41 Main Page
42 !! text
43 blah blah
44 !! endarticle
45
46 !!article
47 Template:Foo
48 !!text
49 FOO
50 !!endarticle
51
52 !! article
53 Template:Blank
54 !! text
55 !! endarticle
56
57 !! article
58 Template:pipe
59 !! text
60 |
61 !! endarticle
62
63 !!article
64 MediaWiki:bad image list
65 !!text
66 * [[File:Bad.jpg]] except [[Nasty page]]
67 !!endarticle
68
69 !! article
70 Template:inner list
71 !! text
72 * item 1
73 !! endarticle
74
75 !! article
76 Template:tbl-start
77 !! text
78 {|
79 !! endarticle
80
81 !! article
82 Template:tbl-end
83 !! text
84 |}
85 !! endarticle
86
87 !! article
88 Template:!
89 !! text
90 |
91 !! endarticle
92
93 !! article
94 Template:echo
95 !! text
96 {{{1}}}
97 !! endarticle
98
99 !! article
100 Template:echo_with_span
101 !! text
102 <span>{{{1}}}</span>
103 !! endarticle
104
105 !! article
106 Template:echo_with_div
107 !! text
108 <div>{{{1}}}</div>
109 !! endarticle
110
111 !! article
112 Template:attr_str
113 !! text
114 {{{1}}}="{{{2}}}"
115 !! endarticle
116
117 !! article
118 Template:table_attribs
119 !! text
120 <noinclude>
121 |</noinclude>style="color: red"| Foo
122 !! endarticle
123
124 !! article
125 Template:table_cells
126 !! text
127 {{table_attribs}} || Bar || Baz
128 !! endarticle
129
130 !! article
131 Template:image_attribs
132 !! text
133 <noinclude>
134 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
135 !! endarticle
136
137 !! article
138 A?b
139 !! text
140 Weirdo titles!
141 !! endarticle
142
143 !!article
144 Template:Bullet
145 !!text
146 * Bar
147 !!endarticle
148
149 ###
150 ### Basic tests
151 ###
152 !! test
153 Blank input
154 !! input
155 !! result
156 !! end
157
158
159 !! test
160 Simple paragraph
161 !! input
162 This is a simple paragraph.
163 !! result
164 <p>This is a simple paragraph.
165 </p>
166 !! end
167
168 !! test
169 Paragraphs with extra newline spacing
170 !! input
171 foo
172
173 bar
174
175
176 baz
177
178
179
180 booz
181 !! result
182 <p>foo
183 </p><p>bar
184 </p><p><br />
185 baz
186 </p><p><br />
187 </p><p>booz
188 </p>
189 !! end
190
191 !! test
192 Paragraphs with newline spacing with comment lines in between
193 !! input
194 ----
195 a
196 <!--foo-->
197 b
198 ----
199 a
200 <!--foo--><!--More than 1 comment, still stripped-->
201 b
202 ----
203 a
204 <!--foo--> <!----> <!-- bar -->
205 b
206 ----
207 a
208 <!--foo-->
209
210 b
211 ----
212 a
213
214 <!--foo-->
215 b
216 ----
217 a
218 <!--foo-->
219
220
221 b
222 ----
223 a
224
225
226 <!--foo-->
227 b
228 ----
229 !! result
230 <hr />
231 <p>a
232 b
233 </p>
234 <hr />
235 <p>a
236 b
237 </p>
238 <hr />
239 <p>a
240 b
241 </p>
242 <hr />
243 <p>a
244 </p><p>b
245 </p>
246 <hr />
247 <p>a
248 </p><p>b
249 </p>
250 <hr />
251 <p>a
252 </p><p><br />
253 b
254 </p>
255 <hr />
256 <p>a
257 </p><p><br />
258 b
259 </p>
260 <hr />
261
262 !! end
263
264 !! test
265 Paragraphs with newline spacing with non-empty white-space lines in between
266 !! input
267 ----
268 a
269
270 b
271 ----
272 a
273
274
275 b
276 ----
277 !! result
278 <hr />
279 <p>a
280 </p><p>b
281 </p>
282 <hr />
283 <p>a
284 </p><p><br />
285 b
286 </p>
287 <hr />
288
289 !! end
290
291 !! test
292 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
293 !! input
294 ----
295 a
296 <!--foo-->
297 b
298 ----
299 a
300 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
301 b
302 ----
303 a
304
305 <!--foo-->
306 <!--bar-->
307 b
308 ----
309 a
310
311 <!--foo-->
312 <!--bar-->
313
314 b
315 ----
316 !! result
317 <hr />
318 <p>a
319 b
320 </p>
321 <hr />
322 <p>a
323 b
324 </p>
325 <hr />
326 <p>a
327 </p><p>b
328 </p>
329 <hr />
330 <p>a
331 </p><p><br />
332 b
333 </p>
334 <hr />
335
336 !! end
337
338 !! test
339 Extra newlines: More paragraphs with indented comment
340 !! input
341 a
342
343 <!--boo-->
344
345 b
346 !!result
347 <p>a
348 </p><p><br />
349 b
350 </p>
351 !!end
352
353 !! test
354 Extra newlines followed by heading
355 !! input
356 a
357
358
359
360 =b=
361 [[a]]
362
363
364 =b=
365 !! result
366 <p>a
367 </p><p><br />
368 </p>
369 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
370 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
371 </p><p><br />
372 </p>
373 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
374
375 !! end
376
377 !! test
378 Extra newlines between heading and content are swallowed
379 !! input
380 =b=
381
382
383
384 [[a]]
385 !! result
386 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
387 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
388 </p>
389 !! end
390
391 !! test
392 Parsing an URL
393 !! input
394 http://fr.wikipedia.org/wiki/🍺
395 <!-- EasterEgg we love beer, better be able be able to link to it -->
396 !! result
397 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
398 </p>
399 !! end
400
401 !! test
402 Simple list
403 !! input
404 * Item 1
405 * Item 2
406 !! result
407 <ul><li> Item 1
408 </li><li> Item 2
409 </li></ul>
410
411 !! end
412
413 !! test
414 Italics and bold
415 !! input
416 * plain
417 * plain''italic''plain
418 * plain''italic''plain''italic''plain
419 * plain'''bold'''plain
420 * plain'''bold'''plain'''bold'''plain
421 * plain''italic''plain'''bold'''plain
422 * plain'''bold'''plain''italic''plain
423 * plain''italic'''bold-italic'''italic''plain
424 * plain'''bold''bold-italic''bold'''plain
425 * plain'''''bold-italic'''italic''plain
426 * plain'''''bold-italic''bold'''plain
427 * plain''italic'''bold-italic'''''plain
428 * plain'''bold''bold-italic'''''plain
429 * plain l'''italic''plain
430 * plain l''''bold''' plain
431 !! result
432 <ul><li> plain
433 </li><li> plain<i>italic</i>plain
434 </li><li> plain<i>italic</i>plain<i>italic</i>plain
435 </li><li> plain<b>bold</b>plain
436 </li><li> plain<b>bold</b>plain<b>bold</b>plain
437 </li><li> plain<i>italic</i>plain<b>bold</b>plain
438 </li><li> plain<b>bold</b>plain<i>italic</i>plain
439 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
440 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
441 </li><li> plain<i><b>bold-italic</b>italic</i>plain
442 </li><li> plain<b><i>bold-italic</i>bold</b>plain
443 </li><li> plain<i>italic<b>bold-italic</b></i>plain
444 </li><li> plain<b>bold<i>bold-italic</i></b>plain
445 </li><li> plain l'<i>italic</i>plain
446 </li><li> plain l'<b>bold</b> plain
447 </li></ul>
448
449 !! end
450
451 # this example taken from the [[simple:Moon]] article (bug 47326)
452 !! test
453 Italics and possessives (1)
454 !! input
455 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
456 !! result
457 <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
458 </p>
459 !! end
460
461 # this example taken from [[en:Flaming Pie]] (bug 49926)
462 !! test
463 Italics and possessives (2)
464 !! input
465 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
466 !! result
467 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
468 </p>
469 !! end
470
471 # this example taken from [[en:Dictionary]] (bug 49926)
472 !! test
473 Italics and possessives (3)
474 !! input
475 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''.
476 !! result
477 <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>.
478 </p>
479 !! end
480
481
482 ###
483 ### 2-quote opening sequence tests
484 ###
485 !! test
486 Italics and bold: 2-quote opening sequence: (2,2)
487 !! input
488 ''foo''
489 !! result
490 <p><i>foo</i>
491 </p>
492 !!end
493
494
495 !! test
496 Italics and bold: 2-quote opening sequence: (2,3)
497 !! input
498 ''foo'''
499 !! result
500 <p><i>foo'</i>
501 </p>
502 !!end
503
504
505 !! test
506 Italics and bold: 2-quote opening sequence: (2,4)
507 !! input
508 ''foo''''
509 !! result
510 <p><i>foo''</i>
511 </p>
512 !!end
513
514
515 !! test
516 Italics and bold: 2-quote opening sequence: (2,5) (php)
517 !! options
518 php
519 !! input
520 ''foo'''''
521 !! result
522 <p><i>foo</i>
523 </p>
524 !!end
525 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
526 !! test
527 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
528 !! options
529 parsoid
530 !! input
531 ''foo'''''
532 !! result
533 <p><i>foo</i><b></b>
534 </p>
535 !!end
536
537
538 ###
539 ### 3-quote opening sequence tests
540 ###
541
542 !! test
543 Italics and bold: 3-quote opening sequence: (3,2)
544 !! input
545 '''foo''
546 !! result
547 <p>'<i>foo</i>
548 </p>
549 !!end
550
551
552 !! test
553 Italics and bold: 3-quote opening sequence: (3,3)
554 !! input
555 '''foo'''
556 !! result
557 <p><b>foo</b>
558 </p>
559 !!end
560
561
562 !! test
563 Italics and bold: 3-quote opening sequence: (3,4)
564 !! input
565 '''foo''''
566 !! result
567 <p><b>foo'</b>
568 </p>
569 !!end
570
571
572 !! test
573 Italics and bold: 3-quote opening sequence: (3,5) (php)
574 !! options
575 php
576 !! input
577 '''foo'''''
578 !! result
579 <p><b>foo</b>
580 </p>
581 !!end
582 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
583 !! test
584 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
585 !! options
586 parsoid
587 !! input
588 '''foo'''''
589 !! result
590 <p><b>foo</b><i></i>
591 </p>
592 !!end
593
594
595 ###
596 ### 4-quote opening sequence tests
597 ###
598
599 !! test
600 Italics and bold: 4-quote opening sequence: (4,2)
601 !! input
602 ''''foo''
603 !! result
604 <p>''<i>foo</i>
605 </p>
606 !!end
607
608
609 !! test
610 Italics and bold: 4-quote opening sequence: (4,3)
611 !! input
612 ''''foo'''
613 !! result
614 <p>'<b>foo</b>
615 </p>
616 !!end
617
618
619 !! test
620 Italics and bold: 4-quote opening sequence: (4,4)
621 !! input
622 ''''foo''''
623 !! result
624 <p>'<b>foo'</b>
625 </p>
626 !!end
627
628
629 !! test
630 Italics and bold: 4-quote opening sequence: (4,5) (php)
631 !! options
632 php
633 !! input
634 ''''foo'''''
635 !! result
636 <p>'<b>foo</b>
637 </p>
638 !!end
639 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
640 !! test
641 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
642 !! options
643 parsoid
644 !! input
645 ''''foo'''''
646 !! result
647 <p>'<b>foo</b><i></i>
648 </p>
649 !!end
650
651
652 ###
653 ### 5-quote opening sequence tests
654 ###
655
656 !! test
657 Italics and bold: 5-quote opening sequence: (5,2)
658 !! options
659 !! input
660 '''''foo''
661 !! result
662 <p><b><i>foo</i></b>
663 </p>
664 !!end
665
666
667 !! test
668 Italics and bold: 5-quote opening sequence: (5,3)
669 !! input
670 '''''foo'''
671 !! result
672 <p><i><b>foo</b></i>
673 </p>
674 !!end
675
676
677 !! test
678 Italics and bold: 5-quote opening sequence: (5,4)
679 !! input
680 '''''foo''''
681 !! result
682 <p><i><b>foo'</b></i>
683 </p>
684 !!end
685
686
687 !! test
688 Italics and bold: 5-quote opening sequence: (5,5)
689 !! input
690 '''''foo'''''
691 !! result
692 <p><i><b>foo</b></i>
693 </p>
694 !!end
695
696 ###
697 ### multiple quote sequences in a line
698 ###
699 !! test
700 Italics and bold: multiple quote sequences: (2,4,2)
701 !! input
702 ''foo''''bar''
703 !! result
704 <p><i>foo'<b>bar</b></i>
705 </p>
706 !!end
707
708
709 !! test
710 Italics and bold: multiple quote sequences: (2,4,3)
711 !! input
712 ''foo''''bar'''
713 !! result
714 <p><i>foo'<b>bar</b></i>
715 </p>
716 !!end
717
718
719 !! test
720 Italics and bold: multiple quote sequences: (2,4,4)
721 !! input
722 ''foo''''bar''''
723 !! result
724 <p><i>foo'<b>bar'</b></i>
725 </p>
726 !!end
727
728
729 !! test
730 Italics and bold: multiple quote sequences: (3,4,2) (php)
731 !! options
732 php
733 !! input
734 '''foo''''bar''
735 !! result
736 <p><b>foo'</b>bar
737 </p>
738 !!end
739 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
740 !! test
741 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
742 !! options
743 parsoid
744 !! input
745 '''foo''''bar''
746 !! result
747 <p><b>foo'</b>bar<i></i>
748 </p>
749 !!end
750
751
752 !! test
753 Italics and bold: multiple quote sequences: (3,4,3) (php)
754 !! options
755 php
756 !! input
757 '''foo''''bar'''
758 !! result
759 <p><b>foo'</b>bar
760 </p>
761 !!end
762 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
763 !! test
764 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
765 !! options
766 parsoid
767 !! input
768 '''foo''''bar'''
769 !! result
770 <p><b>foo'</b>bar<b></b>
771 </p>
772 !!end
773
774 ###
775 ### other quote tests
776 ###
777 !! test
778 Italics and bold: other quote tests: (2,3,5)
779 !! input
780 ''this is about '''foo's family'''''
781 !! result
782 <p><i>this is about <b>foo's family</b></i>
783 </p>
784 !!end
785
786
787 !! test
788 Italics and bold: other quote tests: (2,(3,3),2)
789 !! input
790 ''this is about '''foo's''' family''
791 !! result
792 <p><i>this is about <b>foo's</b> family</i>
793 </p>
794 !!end
795
796
797 !! test
798 Italics and bold: other quote tests: (3,2,3,2)
799 !! input
800 '''this is about ''foo'''s family''
801 !! result
802 <p><b>this is about <i>foo</i></b><i>s family</i>
803 </p>
804 !!end
805
806
807 !! test
808 Italics and bold: other quote tests: (3,2,3,3)
809 !! options
810 !! input
811 '''this is about ''foo'''s family'''
812 !! result
813 <p>'<i>this is about </i>foo<b>s family</b>
814 </p>
815 !!end
816
817
818 !! test
819 Italics and bold: other quote tests: (3,(2,2),3)
820 !! input
821 '''this is about ''foo's'' family'''
822 !! result
823 <p><b>this is about <i>foo's</i> family</b>
824 </p>
825 !!end
826
827
828 !! test
829 Italicized possessive
830 !! input
831 The ''[[Main Page]]'''s talk page.
832 !! result
833 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
834 </p>
835 !! end
836
837 !! test
838 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
839 (Requires tidy for PHP parser output to be fixed up)
840 !! options
841 parsoid=wt2html,wt2wt
842 !! input
843 {|
844 !''a!!''b
845 |''a||''b
846 |}
847 !! result
848 <table>
849 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
850 <td><i>a</i></td><td><i>b</i></td></tr>
851 </tbody></table>
852 !! end
853
854 ###
855 ### Non-html5 tags
856 ###
857
858 !! test
859 Non-html5 tags should be accepted
860 !! input
861 <center>''foo''</center>
862 <big>''foo''</big>
863 <font>''foo''</font>
864 <strike>''foo''</strike>
865 <tt>''foo''</tt>
866 !! result
867 <center><i>foo</i></center>
868 <p><big><i>foo</i></big>
869 <font><i>foo</i></font>
870 <strike><i>foo</i></strike>
871 <tt><i>foo</i></tt>
872 </p>
873 !! end
874
875 !! test
876 <wbr> is valid wikitext (bug 52468)
877 !! input
878 <wbr>
879 !! result
880 <p><wbr />
881 </p>
882 !! end
883
884 # <strike> is HTML4, <s> is HTML4/5.
885 !! test
886 <s> or <strike> for strikethrough
887 !! input
888 <strike>strike</strike>
889
890 <s>s</s>
891 !! result
892 <p><strike>strike</strike>
893 </p><p><s>s</s>
894 </p>
895 !! end
896
897 !! test
898 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
899 !! input
900 <b→> doesn't work! </b>
901
902 <bä> doesn't work! </b>
903
904 <boo> works fine </b>
905
906 <s.foo>foo</s>
907
908 <s.foo>s.foo</s.foo>
909
910 <sub-ID#1>
911 !! result
912 <p>&lt;b→&gt; doesn't work! &lt;/b&gt;
913 </p><p>&lt;bä&gt; doesn't work! &lt;/b&gt;
914 </p><p>&lt;boo&gt; works fine &lt;/b&gt;
915 </p><p>&lt;s.foo&gt;foo&lt;/s&gt;
916 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
917 </p><p>&lt;sub-ID#1&gt;
918 </p>
919 !! end
920
921 ###
922 ### Special characters
923 ###
924
925 !! test
926 Bare pipe character (bug 52363)
927 !! input
928 |
929 !! result
930 <p>|
931 </p>
932 !! end
933
934 !! test
935 Bare pipe character from a template (bug 52363)
936 !! input
937 {{pipe}}
938 !! result
939 <p>|
940 </p>
941 !! end
942
943 ###
944 ### <nowiki> test cases
945 ###
946
947 !! test
948 <nowiki> unordered list
949 !! input
950 <nowiki>* This is not an unordered list item.</nowiki>
951 !! result
952 <p>* This is not an unordered list item.
953 </p>
954 !! end
955
956 !! test
957 <nowiki> spacing
958 !! input
959 <nowiki>Lorem ipsum dolor
960
961 sed abit.
962 sed nullum.
963
964 :and a colon
965 </nowiki>
966 !! result
967 <p>Lorem ipsum dolor
968
969 sed abit.
970 sed nullum.
971
972 :and a colon
973
974 </p>
975 !! end
976
977 !! test
978 nowiki 3
979 !! input
980 :There is not nowiki.
981 :There is <nowiki>nowiki</nowiki>.
982
983 #There is not nowiki.
984 #There is <nowiki>nowiki</nowiki>.
985
986 *There is not nowiki.
987 *There is <nowiki>nowiki</nowiki>.
988 !! result
989 <dl><dd>There is not nowiki.
990 </dd><dd>There is nowiki.
991 </dd></dl>
992 <ol><li>There is not nowiki.
993 </li><li>There is nowiki.
994 </li></ol>
995 <ul><li>There is not nowiki.
996 </li><li>There is nowiki.
997 </li></ul>
998
999 !! end
1000
1001 !! test
1002 Entities inside <nowiki>
1003 !! input
1004 <nowiki>&lt;</nowiki>
1005 !! result
1006 <p>&lt;
1007 </p>
1008 !! end
1009
1010 !! test
1011 Entities inside template parameters
1012 !! options
1013 parsoid
1014 !! input
1015 {{echo|&ndash;}}
1016 !! result
1017 <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>
1018 </p>
1019 !! end
1020
1021 ###
1022 ### Comments
1023 ###
1024 !! test
1025 Comments and Indent-Pre
1026 !! input
1027 <!-- comment 1 --> asdf
1028
1029 <!-- comment 1 --> asdf
1030 <!-- comment 2 -->
1031
1032 <!-- comment 1 --> asdf
1033 <!-- comment 2 -->xyz
1034
1035 <!-- comment 1 --> asdf
1036 <!-- comment 2 --> xyz
1037 !! result
1038 <pre>asdf
1039 </pre>
1040 <pre>asdf
1041 </pre>
1042 <pre>asdf
1043 </pre>
1044 <p>xyz
1045 </p>
1046 <pre>asdf
1047 xyz
1048 </pre>
1049 !! end
1050
1051 !! test
1052 Comment test 2a
1053 !! input
1054 asdf
1055 <!-- comment 1 -->
1056 jkl
1057 !! result
1058 <p>asdf
1059 jkl
1060 </p>
1061 !! end
1062
1063 !! test
1064 Comment test 2b
1065 !! input
1066 asdf
1067 <!-- comment 1 -->
1068
1069 jkl
1070 !! result
1071 <p>asdf
1072 </p><p>jkl
1073 </p>
1074 !! end
1075
1076 !! test
1077 Comment test 3
1078 !! input
1079 asdf
1080 <!-- comment 1 -->
1081 <!-- comment 2 -->
1082 jkl
1083 !! result
1084 <p>asdf
1085 jkl
1086 </p>
1087 !! end
1088
1089 !! test
1090 Comment test 4
1091 !! input
1092 asdf<!-- comment 1 -->jkl
1093 !! result
1094 <p>asdfjkl
1095 </p>
1096 !! end
1097
1098 !! test
1099 Comment spacing
1100 !! input
1101 a
1102 <!-- foo --> b <!-- bar -->
1103 c
1104 !! result
1105 <p>a
1106 </p>
1107 <pre> b
1108 </pre>
1109 <p>c
1110 </p>
1111 !! end
1112
1113 !! test
1114 Comment whitespace
1115 !! input
1116 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1117 !! result
1118
1119 !! end
1120
1121 !! test
1122 Comment semantics and delimiters
1123 !! input
1124 <!-- --><!----><!-----><!------>
1125 !! result
1126
1127 !! end
1128
1129 !! test
1130 Comment semantics and delimiters, redux
1131 !! input
1132 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1133 -- foo -- funky huh? ... -->
1134 !! result
1135
1136 !! end
1137
1138 !! test
1139 Comment semantics and delimiters: directors cut
1140 !! input
1141 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1142 everything starting with < followed by !-- until the first -- and > we see,
1143 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1144 -->-->
1145 !! result
1146 <p>--&gt;
1147 </p>
1148 !! end
1149
1150 !! test
1151 Comment semantics: nesting
1152 !! input
1153 <!--<!-- no, we're not going to do anything fancy here -->-->
1154 !! result
1155 <p>--&gt;
1156 </p>
1157 !! end
1158
1159 !! test
1160 Comment semantics: unclosed comment at end
1161 !! input
1162 <!--This comment will run out to the end of the document
1163 !! result
1164
1165 !! end
1166
1167 !! test
1168 Comment in template title
1169 !! input
1170 {{f<!---->oo}}
1171 !! result
1172 <p>FOO
1173 </p>
1174 !! end
1175
1176 !! test
1177 Comment on its own line post-expand
1178 !! input
1179 a
1180 {{blank}}<!---->
1181 b
1182 !! result
1183 <p>a
1184 </p><p>b
1185 </p>
1186 !! end
1187
1188 !! test
1189 Comment on its own line post-expand with non-significant whitespace
1190 !! input
1191 a
1192 {{blank}} <!---->
1193 b
1194 !! result
1195 <p>a
1196 </p><p>b
1197 </p>
1198 !! end
1199
1200 ###
1201 ### paragraph wrapping tests
1202 ###
1203 !! test
1204 No block tags
1205 !! input
1206 a
1207
1208 b
1209 !! result
1210 <p>a
1211 </p><p>b
1212 </p>
1213 !! end
1214
1215 !! test
1216 Block tag on one line (<div>)
1217 !! input
1218 a <div>foo</div>
1219
1220 b
1221 !! result
1222 a <div>foo</div>
1223 <p>b
1224 </p>
1225 !! end
1226
1227 !! test
1228 Block tag on one line (<blockquote>)
1229 !! input
1230 a <blockquote>foo</blockquote>
1231
1232 b
1233 !! result
1234 a <blockquote>foo</blockquote>
1235 <p>b
1236 </p>
1237 !! end
1238
1239 !! test
1240 Block tag on both lines (<div>)
1241 !! input
1242 a <div>foo</div>
1243
1244 b <div>foo</div>
1245 !! result
1246 a <div>foo</div>
1247 b <div>foo</div>
1248
1249 !! end
1250
1251 !! test
1252 Block tag on both lines (<blockquote>)
1253 !! input
1254 a <blockquote>foo</blockquote>
1255
1256 b <blockquote>foo</blockquote>
1257 !! result
1258 a <blockquote>foo</blockquote>
1259 b <blockquote>foo</blockquote>
1260
1261 !! end
1262
1263 !! test
1264 Multiple lines without block tags
1265 !! input
1266 <div>foo</div> a
1267 b
1268 c
1269 d<!--foo--> e
1270 x <div>foo</div> z
1271 !! result
1272 <div>foo</div> a
1273 <p>b
1274 c
1275 d e
1276 </p>
1277 x <div>foo</div> z
1278
1279 !! end
1280
1281 !! test
1282 Empty lines between lines with block tags
1283 !! input
1284 <div></div>
1285
1286
1287 <div></div>a
1288
1289 b
1290 <div>a</div>b
1291
1292 <div>b</div>d
1293
1294
1295 <div>e</div>
1296 !! result
1297 <div></div>
1298 <p><br />
1299 </p>
1300 <div></div>a
1301 <p>b
1302 </p>
1303 <div>a</div>b
1304 <div>b</div>d
1305 <p><br />
1306 </p>
1307 <div>e</div>
1308
1309 !! end
1310
1311 ###
1312 ### Preformatted text
1313 ###
1314 !! test
1315 Preformatted text
1316 !! input
1317 This is some
1318 Preformatted text
1319 With ''italic''
1320 And '''bold'''
1321 And a [[Main Page|link]]
1322 !! result
1323 <pre>This is some
1324 Preformatted text
1325 With <i>italic</i>
1326 And <b>bold</b>
1327 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1328 </pre>
1329 !! end
1330
1331 !! test
1332 Tabs don't trigger preformatted text
1333 !! input
1334 This is not
1335 preformatted text.
1336 This is preformatted text.
1337 So is this.
1338 !! result
1339 <p> This is not
1340 preformatted text.
1341 </p>
1342 <pre>This is preformatted text.
1343 So is this.
1344 </pre>
1345 !! end
1346
1347 !! test
1348 Ident preformatting with inline content
1349 !! input
1350 a
1351 ''b''
1352 !! result
1353 <pre>a
1354 <i>b</i>
1355 </pre>
1356 !! end
1357
1358 !! test
1359 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1360 !! input
1361 <pre><nowiki>
1362 <b>
1363 <cite>
1364 <em>
1365 </nowiki></pre>
1366 !! result
1367 <pre>
1368 &lt;b&gt;
1369 &lt;cite&gt;
1370 &lt;em&gt;
1371 </pre>
1372
1373 !! end
1374
1375 !! test
1376 Regression with preformatted in <center>
1377 !! input
1378 <center>
1379 Blah
1380 </center>
1381 !! result
1382 <center>
1383 <pre>Blah
1384 </pre>
1385 </center>
1386
1387 !! end
1388
1389 !! test
1390 Bug 52763: Preformatted in <blockquote>
1391 !! input
1392 <blockquote>
1393 Blah
1394 </blockquote>
1395 !! result
1396 <blockquote>
1397 <p> Blah
1398 </p>
1399 </blockquote>
1400
1401 !! end
1402
1403 !! test
1404 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1405 !! input
1406 <blockquote>
1407 Foo
1408
1409 Bar
1410 </blockquote>
1411 !! result
1412 <blockquote>
1413 <p>Foo
1414 </p><p>Bar
1415 </p>
1416 </blockquote>
1417
1418 !! end
1419
1420 !! test
1421 Bug 15491: <ins>/<del> in blockquote
1422 !! input
1423 <blockquote>
1424 Foo <del>bar</del> <ins>baz</ins> quux
1425 </blockquote>
1426 !! result
1427 <blockquote>
1428 <p>Foo <del>bar</del> <ins>baz</ins> quux
1429 </p>
1430 </blockquote>
1431
1432 !! end
1433
1434 # Note that the p-wrapping is newline sensitive, which could be
1435 # considered a bug: tidy will wrap only the 'Foo' in the example
1436 # below in a <p> tag. (see comment 23-25 of bug #6200)
1437 !! test
1438 Bug 15491: <ins>/<del> in blockquote (2)
1439 !! input
1440 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1441 </blockquote>
1442 !! result
1443 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1444 </blockquote>
1445
1446 !! end
1447
1448 !! test
1449 <pre> with attributes (bug 3202)
1450 !! input
1451 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1452 !! result
1453 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1454
1455 !! end
1456
1457 !! test
1458 <pre> with width attribute (bug 3202)
1459 !! input
1460 <pre width="8">Narrow screen goodies</pre>
1461 !! result
1462 <pre width="8">Narrow screen goodies</pre>
1463
1464 !! end
1465
1466 !! test
1467 <pre> with forbidden attribute (bug 3202)
1468 !! input
1469 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1470 !! result
1471 <pre width="8">Narrow screen goodies</pre>
1472
1473 !! end
1474
1475 !! test
1476 Entities inside <pre>
1477 !! input
1478 <pre>&lt;</pre>
1479 !! result
1480 <pre>&lt;</pre>
1481
1482 !! end
1483
1484 !! test
1485 <pre> with forbidden attribute values (bug 3202)
1486 !! input
1487 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1488 !! result
1489 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1490
1491 !! end
1492
1493 !! test
1494 <nowiki> inside <pre> (bug 13238)
1495 !! input
1496 <pre>
1497 <nowiki>
1498 </pre>
1499 <pre>
1500 <nowiki></nowiki>
1501 </pre>
1502 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1503 !! result
1504 <pre>
1505 &lt;nowiki&gt;
1506 </pre>
1507 <pre>
1508
1509 </pre>
1510 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1511
1512 !! end
1513
1514 !! test
1515 <nowiki> and <pre> preference (first one wins)
1516 !! input
1517 <pre>
1518 <nowiki>
1519 </pre>
1520 </nowiki>
1521 </pre>
1522
1523 <nowiki>
1524 <pre>
1525 <nowiki>
1526 </pre>
1527 </nowiki>
1528 </pre>
1529
1530 !! result
1531 <pre>
1532 &lt;nowiki&gt;
1533 </pre>
1534 <p>&lt;/nowiki&gt;
1535 &lt;/pre&gt;
1536 </p><p>
1537 &lt;pre&gt;
1538 &lt;nowiki&gt;
1539 &lt;/pre&gt;
1540
1541 &lt;/pre&gt;
1542 </p>
1543 !! end
1544
1545 !! test
1546 </pre> inside nowiki
1547 !! input
1548 <nowiki></pre></nowiki>
1549 !! result
1550 <p>&lt;/pre&gt;
1551 </p>
1552 !! end
1553
1554 !!test
1555 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1556 !!input
1557 {{echo|}}
1558 !!result
1559
1560 !!end
1561
1562 !!test
1563 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1564 !!input
1565 {{echo|
1566 foo}}
1567 !!result
1568 <p>foo
1569 </p>
1570 !!end
1571
1572 !! test
1573 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1574 !! input
1575 {{echo|a
1576 b}}
1577 !!result
1578 <pre>a
1579 </pre>
1580 <p>b
1581 </p>
1582 !!end
1583
1584 !! test
1585 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1586 !! input
1587 {{echo|a
1588 b
1589 c
1590 d
1591 e
1592 }}
1593 !!result
1594 <pre>a
1595 </pre>
1596 <p>b
1597 c
1598 </p>
1599 <pre>d
1600 </pre>
1601 <p>e
1602 </p>
1603 !!end
1604
1605 !!test
1606 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1607 !!input
1608 {{echo| foo}}
1609
1610 {{echo| foo}}{{echo| bar}}
1611
1612 {{echo| foo}}
1613 {{echo| bar}}
1614
1615 {{echo|<!--cmt--> foo}}
1616
1617 <!--cmt-->{{echo| foo}}
1618
1619 {{echo|{{echo| }}bar}}
1620 !!result
1621 <pre>foo
1622 </pre>
1623 <pre>foo bar
1624 </pre>
1625 <pre>foo
1626 bar
1627 </pre>
1628 <pre>foo
1629 </pre>
1630 <pre>foo
1631 </pre>
1632 <pre>bar
1633 </pre>
1634 !!end
1635
1636 !! test
1637 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1638 !! input
1639 {{echo| }}a
1640
1641 {{echo|
1642 }}a
1643
1644 {{echo|
1645 b}}
1646
1647 {{echo|a
1648 }}b
1649
1650 {{echo|a
1651 }} b
1652 !!result
1653 <pre>a
1654 </pre>
1655 <p><br />
1656 </p>
1657 <pre>a
1658 </pre>
1659 <p><br />
1660 </p>
1661 <pre>b
1662 </pre>
1663 <p>a
1664 </p>
1665 <pre>b
1666 </pre>
1667 <p>a
1668 </p>
1669 <pre>b
1670 </pre>
1671 !!end
1672
1673 # TODO / maybe: fix wt2wt for this
1674 !! test
1675 Parsoid: Don't paragraph-wrap fosterable content
1676 !! options
1677 parsoid=wt2html
1678 !! input
1679 {|
1680 <td></td>
1681 <td></td>
1682
1683
1684
1685 |}
1686 !! result
1687 <table>
1688
1689 <tbody>
1690 <tr>
1691 <td></td>
1692
1693 <td></td></tr>
1694
1695
1696
1697 </tbody></table>
1698 !! end
1699
1700 !! test
1701 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
1702 !! options
1703 parsoid=wt2html
1704 !! input
1705 {|
1706 <td>
1707 <td>
1708 </td>
1709
1710
1711
1712 |}
1713 !! result
1714 <table>
1715
1716 <tbody>
1717 <tr>
1718 <td></td>
1719
1720 <td>
1721 </td></tr>
1722
1723
1724
1725 </tbody></table>
1726 !! end
1727
1728
1729 #--------------------------------------------------------------------
1730 # Transclusion parameter whitespace stripping tests
1731 # Behavior is different for positional and named parameters
1732 #--------------------------------------------------------------------
1733 !! test
1734 Templates: Strip leading and trailing whitespace from named-param values
1735 !! input
1736 {{echo|1= a }}
1737
1738 {{echo|1= {{echo|b}} }}
1739
1740 {{echo| 1 =
1741 c }}
1742
1743 {{echo| 1 =
1744 * d
1745 }}
1746 !! result
1747 <p>a
1748 </p><p>b
1749 </p><p>c
1750 </p>
1751 <ul><li> d
1752 </li></ul>
1753
1754 !! end
1755
1756 !! test
1757 Templates: Don't strip whitespace from positional-param values
1758 !! input
1759 {{echo|a }}
1760
1761 {{echo|{{echo|b}} }}
1762
1763 {{echo| c
1764 }}
1765
1766 {{echo| {{echo|d}}
1767 }}
1768
1769 {{echo|
1770 e}}
1771
1772 {{echo|
1773 * f}}
1774
1775 {{echo|
1776 }}g
1777 !! result
1778 <p>a
1779 </p><p>b
1780 </p>
1781 <pre>c
1782 </pre>
1783 <p><br />
1784 </p>
1785 <pre>d
1786 </pre>
1787 <p><br />
1788 </p>
1789 <pre>e
1790 </pre>
1791 <p><br />
1792 </p>
1793 <ul><li> f
1794 </li></ul>
1795 <p><br />
1796 </p>
1797 <pre>g
1798 </pre>
1799 !! end
1800
1801 !! test
1802 Templates: Handle empty comment-and-ws-only lines correctly
1803 !! input
1804 {{echo|foo
1805 <!--should be ignored-->
1806 <!--should be ignored as well-->
1807 bar}}
1808 !! result
1809 <p>foo
1810 bar
1811 </p>
1812 !! end
1813
1814 #--------------------------------------------------------------------
1815 # Transclusion parameter escaping tests
1816 #--------------------------------------------------------------------
1817 !! test
1818 Templates: Parsoid parameter escaping test 1
1819 !! options
1820 parsoid
1821 !! input
1822 {{echo|[foo]|{{echo|[bar]}}}}
1823 !! result
1824 <p about="#mwt1" typeof="mw:Transclusion"
1825 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
1826 !! end
1827
1828 !! test
1829 Parsoid: Pipes in external links in template parameter
1830 !! options
1831 parsoid
1832 !! input
1833 {{echo|[{{echo|http://example.com}} link]}}
1834 !! result
1835 <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>
1836 !! end
1837
1838 !! test
1839 Parsoid: pipe in transclusion parameter
1840 !! options
1841 parsoid
1842 !! input
1843 {{echo|http://foo.com/a&#124;b}}
1844 !! result
1845 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1846 typeof="mw:Transclusion"
1847 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>
1848 !! end
1849
1850 !! test
1851 Parsoid: Pipe in external link target and content in template parameter
1852 !! options
1853 parsoid=html2wt,wt2wt
1854 !! input
1855 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
1856 !! result
1857 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1858 typeof="mw:Transclusion"
1859 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
1860 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
1861 !! end
1862
1863 !! test
1864 Templates: Dont escape already nowiki-escaped text in template parameters
1865 !! options
1866 parsoid=html2wt,wt2wt
1867 !! input
1868 {{echo|foo<nowiki>|</nowiki>bar}}
1869 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
1870 {{echo|<nowiki></nowiki>}}
1871 !! result
1872 <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>
1873 <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>
1874 <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>
1875 </p>
1876 !! end
1877
1878 ## Bug 52824
1879 !! test
1880 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
1881 !! options
1882 parsoid=html2wt,wt2wt
1883 !! input
1884 {{echo|{{echo|1=bar}}}}
1885 !! result
1886 <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>
1887 !! end
1888
1889 ###
1890 ### Parsoid-centric tests for testing RT edge cases for pre
1891 ###
1892
1893 !!test
1894 1a. Indent-Pre and Comments
1895 !!input
1896 a
1897 <!--a-->
1898 c
1899 !!result
1900 <pre>a
1901 </pre>
1902 <p>c
1903 </p>
1904 !!end
1905
1906 !!test
1907 1b. Indent-Pre and Comments
1908 !!input
1909 a
1910 <!--a-->
1911 c
1912 !!result
1913 <pre>a
1914 </pre>
1915 <p>c
1916 </p>
1917 !!end
1918
1919 !!test
1920 1c. Indent-Pre and Comments
1921 !!input
1922 <!--a--> a
1923
1924 <!--a--> a
1925 !!result
1926 <pre> a
1927 </pre>
1928 <pre> a
1929 </pre>
1930 !!end
1931
1932 !!test
1933 1d. Indent-Pre and Comments
1934 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
1935 !!input
1936 <!--a--> a
1937
1938 <!--b-->b
1939 !!result
1940 <pre>a
1941 </pre>
1942 <pre>b
1943 </pre>
1944 !!end
1945
1946 !!test
1947 2a. Indent-Pre and tables
1948 !!input
1949 {|
1950 |-
1951 !h1!!h2
1952 |foo||bar
1953 |}
1954 !!result
1955 <table>
1956
1957 <tr>
1958 <th>h1</th>
1959 <th>h2
1960 </th>
1961 <td>foo</td>
1962 <td>bar
1963 </td></tr></table>
1964
1965 !!end
1966
1967 !!test
1968 2b. Indent-Pre and tables
1969 !!input
1970 {|
1971 |-
1972 |foo
1973 |}
1974 !!result
1975 <table>
1976
1977 <tr>
1978 <td>foo
1979 </td></tr></table>
1980
1981 !!end
1982
1983 !!test
1984 2c. Indent-Pre and tables (bug 42252)
1985 !!input
1986 {|
1987 |+ foo
1988 ! | bar
1989 |}
1990 !!result
1991 <table>
1992 <caption> foo
1993 </caption>
1994 <tr>
1995 <th> bar
1996 </th></tr></table>
1997
1998 !!end
1999
2000 !!test
2001 3a. Indent-Pre and block tags (single-line html)
2002 !!input
2003 <p> foo </p>
2004 <div> foo </div>
2005 <blockquote> foo </blockquote>
2006 <span> foo </span>
2007 !!result
2008 <p> foo </p>
2009 <div> foo </div>
2010 <blockquote> foo </blockquote>
2011 <pre><span> foo </span>
2012 </pre>
2013 !!end
2014
2015 !!test
2016 3b. Indent-Pre and block tags (pre-content on separate line)
2017 !!input
2018 <p>
2019 foo
2020 </p>
2021
2022 <div>
2023 foo
2024 </div>
2025
2026 <center>
2027 foo
2028 </center>
2029
2030 <blockquote>
2031 foo
2032 </blockquote>
2033
2034 <blockquote>
2035 <pre>
2036 foo
2037 </pre>
2038 </blockquote>
2039
2040 <table><tr><td>
2041 foo
2042 </td></tr></table>
2043
2044 <ul><li>
2045 foo
2046 </li></ul>
2047
2048 !!result
2049 <p>
2050 foo
2051 </p>
2052 <div>
2053 <pre>foo
2054 </pre>
2055 </div>
2056 <center>
2057 <pre>foo
2058 </pre>
2059 </center>
2060 <blockquote>
2061 <p> foo
2062 </p>
2063 </blockquote>
2064 <blockquote>
2065 <pre>
2066 foo
2067 </pre>
2068 </blockquote>
2069 <table><tr><td>
2070 <pre>foo
2071 </pre>
2072 </td></tr></table>
2073 <ul><li>
2074 foo
2075 </li></ul>
2076
2077 !!end
2078
2079 !!test
2080 4. Multiple spaces at start-of-line
2081 !!input
2082 <p> foo </p>
2083 foo
2084 {|
2085 |foo
2086 |}
2087 !!result
2088 <p> foo </p>
2089 <pre> foo
2090 </pre>
2091 <table>
2092 <tr>
2093 <td>foo
2094 </td></tr></table>
2095
2096 !!end
2097
2098 !! test
2099 5. White-space in indent-pre
2100 NOTE: the white-space char on 2nd line is significant
2101 !! input
2102 a<br/>
2103
2104 b
2105 !! result
2106 <pre>a<br />
2107
2108 b
2109 </pre>
2110 !! end
2111
2112 !! test
2113 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2114 !! input
2115 a
2116
2117 <!-- continue -->
2118 b
2119
2120 c
2121
2122 d
2123 !! result
2124 <pre>a
2125
2126 b
2127 </pre>
2128 <pre>c
2129
2130 </pre>
2131 <p>d
2132 </p>
2133 !! end
2134
2135 !! test
2136 7a. Indent-pre and category links
2137 !! options
2138 parsoid=wt2html,wt2wt
2139 !! input
2140 [[Category:foo]] <!-- No pre-wrapping -->
2141 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2142 !! result
2143 <link rel="mw:WikiLink/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
2144 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span>
2145 <link rel="mw:WikiLink/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
2146 !! end
2147
2148 !! test
2149 7b. Indent-pre and category links
2150 !! options
2151 parsoid=wt2html,wt2wt
2152 !! input
2153 [[Category:foo]] a
2154 [[Category:foo]] {{echo|b}}
2155 !! result
2156 <pre>
2157 <link rel="mw:WikiLink/Category" href="./Category:Foo"> a
2158
2159 <link rel="mw:WikiLink/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>
2160 !! end
2161
2162 ###
2163 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2164 ###
2165
2166 !!test
2167 HTML-pre: 1. embedded newlines
2168 !!input
2169 <pre>foo</pre>
2170
2171 <pre>
2172 foo
2173 </pre>
2174
2175 <pre>
2176
2177 foo
2178 </pre>
2179
2180 <pre>
2181
2182
2183 foo
2184 </pre>
2185 !!result
2186 <pre>foo</pre>
2187 <pre>
2188 foo
2189 </pre>
2190 <pre>
2191
2192 foo
2193 </pre>
2194 <pre>
2195
2196
2197 foo
2198 </pre>
2199
2200 !!end
2201
2202 !!test
2203 HTML-pre: 2: indented text
2204 !!input
2205 <pre>
2206 foo
2207 </pre>
2208 !!result
2209 <pre>
2210 foo
2211 </pre>
2212
2213 !!end
2214
2215 !!test
2216 HTML-pre: 3: other wikitext
2217 !!input
2218 <pre>
2219 * foo
2220 # bar
2221 = no-h =
2222 '' no-italic ''
2223 [[ NoLink ]]
2224 </pre>
2225 !!result
2226 <pre>
2227 * foo
2228 # bar
2229 = no-h =
2230 '' no-italic ''
2231 [[ NoLink ]]
2232 </pre>
2233
2234 !!end
2235
2236 ###
2237 ### Definition lists
2238 ###
2239 !! test
2240 Simple definition
2241 !! input
2242 ; name : Definition
2243 !! result
2244 <dl><dt> name&#160;</dt><dd> Definition
2245 </dd></dl>
2246
2247 !! end
2248
2249 !! test
2250 Definition list for indentation only
2251 !! input
2252 : Indented text
2253 !! result
2254 <dl><dd> Indented text
2255 </dd></dl>
2256
2257 !! end
2258
2259 !! test
2260 Definition list with no space
2261 !! input
2262 ;name:Definition
2263 !! result
2264 <dl><dt>name</dt><dd>Definition
2265 </dd></dl>
2266
2267 !!end
2268
2269 !! test
2270 Definition list with URL link
2271 !! input
2272 ; http://example.com/ : definition
2273 !! result
2274 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
2275 </dd></dl>
2276
2277 !! end
2278
2279 !! test
2280 Definition list with bracketed URL link
2281 !! input
2282 ;[http://www.example.com/ Example]:Something about it
2283 !! result
2284 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
2285 </dd></dl>
2286
2287 !! end
2288
2289 !! test
2290 Definition list with wikilink containing colon
2291 !! input
2292 ; [[Help:FAQ]]: The least-read page on Wikipedia
2293 !! result
2294 <dl><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><dd> The least-read page on Wikipedia
2295 </dd></dl>
2296
2297 !! end
2298
2299 # At Brion's and JeLuF's insistence... :)
2300 !! test
2301 Definition list with news link containing colon
2302 !! input
2303 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
2304 !! result
2305 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt><dd> This isn't even a real newsgroup!
2306 </dd></dl>
2307
2308 !! end
2309
2310 !! test
2311 Malformed definition list with colon
2312 !! input
2313 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2314 !! result
2315 <dl><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
2316 </dt></dl>
2317
2318 !! end
2319
2320 !! test
2321 Definition lists: colon in external link text
2322 !! input
2323 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2324 !! result
2325 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt><dd> OK, I made that up
2326 </dd></dl>
2327
2328 !! end
2329
2330 !! test
2331 Definition lists: colon in HTML attribute
2332 !! input
2333 ;<b style="display: inline">bold</b>
2334 !! result
2335 <dl><dt><b style="display: inline">bold</b>
2336 </dt></dl>
2337
2338 !! end
2339
2340 !! test
2341 Definition lists: self-closed tag
2342 !! input
2343 ;one<br/>two : two-line fun
2344 !! result
2345 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
2346 </dd></dl>
2347
2348 !! end
2349
2350 !! test
2351 Bug 11748: Literal closing tags
2352 !! input
2353 <dl>
2354 <dt>test 1</dt>
2355 <dd>test test test test test</dd>
2356 <dt>test 2</dt>
2357 <dd>test test test test test</dd>
2358 </dl>
2359 !! result
2360 <dl>
2361 <dt>test 1</dt>
2362 <dd>test test test test test</dd>
2363 <dt>test 2</dt>
2364 <dd>test test test test test</dd>
2365 </dl>
2366
2367 !! end
2368
2369 !! test
2370 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2371 !! input
2372 <ul><li>
2373 ; term : description
2374 * unordered
2375 </li>
2376 </ul>
2377 !! result
2378 <ul><li>
2379 <dl><dt> term&#160;</dt><dd> description
2380 </dd></dl>
2381 <ul><li> unordered
2382 </li></ul>
2383 </li>
2384 </ul>
2385
2386 !! end
2387
2388 !! test
2389
2390 Definition list with empty definition and following paragraph
2391 !! input
2392 ; term:
2393 Paragraph text
2394 !! result
2395 <dl><dt> term</dt><dd>
2396 </dd></dl>
2397 <p>Paragraph text
2398 </p>
2399 !! end
2400
2401 !! test
2402 Nested definition lists using html syntax
2403 !! input
2404 <dl><dd>
2405 <dl>
2406 <dd>Foo</dd>
2407 </dl>
2408 </dd></dl>
2409 !! result
2410 <dl><dd>
2411 <dl>
2412 <dd>Foo</dd>
2413 </dl>
2414 </dd></dl>
2415
2416 !! end
2417
2418 !! test
2419 Definition Lists: No nesting: Multiple dd's
2420 !! input
2421 ;x
2422 :a
2423 :b
2424 !! result
2425 <dl><dt>x
2426 </dt><dd>a
2427 </dd><dd>b
2428 </dd></dl>
2429
2430 !! end
2431
2432 !! test
2433 Definition Lists: Indentation: Regular
2434 !! input
2435 :i1
2436 ::i2
2437 :::i3
2438 !! result
2439 <dl><dd>i1
2440 <dl><dd>i2
2441 <dl><dd>i3
2442 </dd></dl>
2443 </dd></dl>
2444 </dd></dl>
2445
2446 !! end
2447
2448 !! test
2449 Definition Lists: Indentation: Missing 1st level
2450 !! input
2451 ::i2
2452 :::i3
2453 !! result
2454 <dl><dd><dl><dd>i2
2455 <dl><dd>i3
2456 </dd></dl>
2457 </dd></dl>
2458 </dd></dl>
2459
2460 !! end
2461
2462 !! test
2463 Definition Lists: Indentation: Multi-level indent
2464 !! input
2465 :::i3
2466 !! result
2467 <dl><dd><dl><dd><dl><dd>i3
2468 </dd></dl>
2469 </dd></dl>
2470 </dd></dl>
2471
2472 !! end
2473
2474 !! test
2475 Definition Lists: Hacky use to indent tables
2476 !! input
2477 ::{|
2478 |foo
2479 |bar
2480 |}
2481 this text
2482 should be left alone
2483 !! result
2484 <dl><dd><dl><dd><table>
2485 <tr>
2486 <td>foo
2487 </td>
2488 <td>bar
2489 </td></tr></table></dd></dl></dd></dl>
2490 <p>this text
2491 should be left alone
2492 </p>
2493 !! end
2494
2495 # Bug 52473
2496 !! test
2497 Definition Lists: Hacky use to indent tables (WS-insensitive)
2498 !! options
2499 parsoid
2500 !! input
2501 : {|
2502 |a
2503 |}
2504 !! result
2505 <dl><dd> <table><tr><td>a</td></tr></table> </dd></dl>
2506 !! end
2507 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2508 ## as an empty dt item. It also ignores all but the last ";" when followed
2509 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2510 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2511 ## ";"s.
2512 ##
2513 ## Ex: ";;t2 ::d2" is transformed into:
2514 ##
2515 ## <dl>
2516 ## <dt>t2 </dt>
2517 ## <dd>
2518 ## <dl>
2519 ## <dt></dt>
2520 ## <dd>d2</dd>
2521 ## </dl>
2522 ## </dd>
2523 ## </dl>
2524 ##
2525 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2526 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2527 ##
2528 ## <dl>
2529 ## <dt>
2530 ## <dl>
2531 ## <dt>t2 </dt>
2532 ## <dd>:d2</dd>
2533 ## </dl>
2534 ## </dt>
2535 ## </dl>
2536 ##
2537 ## All Parsoid only definition list tests have this difference.
2538 ##
2539 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2540 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2541
2542 !! test
2543 Table / list interaction: indented table with lists in table contents
2544 !! input
2545 :{|
2546 |-
2547 | a
2548 * b
2549 |-
2550 | c
2551 * d
2552 |}
2553 !! result
2554 <dl><dd><table>
2555
2556 <tr>
2557 <td> a
2558 <ul><li> b
2559 </li></ul>
2560 </td></tr>
2561 <tr>
2562 <td> c
2563 <ul><li> d
2564 </li></ul>
2565 </td></tr></table></dd></dl>
2566
2567 !! end
2568
2569 !!test
2570 Table / list interaction: lists nested in tables nested in indented lists
2571 !!input
2572 :{|
2573 |
2574 :a
2575 :b
2576 |
2577 *c
2578 *d
2579 |}
2580
2581 *e
2582 *f
2583 !!result
2584 <dl><dd><table>
2585 <tr>
2586 <td>
2587 <dl><dd>a
2588 </dd><dd>b
2589 </dd></dl>
2590 </td>
2591 <td>
2592 <ul><li>c
2593 </li><li>d
2594 </li></ul>
2595 </td></tr></table></dd></dl>
2596 <ul><li>e
2597 </li><li>f
2598 </li></ul>
2599
2600 !!end
2601
2602 !! test
2603 Definition Lists: Nesting: Multi-level (Parsoid only)
2604 !! options
2605 parsoid
2606 !! input
2607 ;t1 :d1
2608 ;;t2 ::d2
2609 ;;;t3 :::d3
2610 !! result
2611 <dl>
2612 <dt>t1 </dt>
2613 <dd>d1</dd>
2614 <dt>
2615 <dl>
2616 <dt>t2 </dt>
2617 <dd>:d2</dd>
2618 <dt>
2619 <dl>
2620 <dt>t3 </dt>
2621 <dd>::d3</dd>
2622 </dl>
2623 </dt>
2624 </dl>
2625 </dt>
2626 </dl>
2627
2628
2629 !! end
2630
2631
2632 !! test
2633 Definition Lists: Nesting: Test 2 (Parsoid only)
2634 !! options
2635 parsoid
2636 !! input
2637 ;t1
2638 ::d2
2639 !! result
2640 <dl>
2641 <dt>t1</dt>
2642 <dd>
2643 <dl>
2644 <dd>d2</dd>
2645 </dl>
2646 </dd>
2647 </dl>
2648
2649 !! end
2650
2651
2652 !! test
2653 Definition Lists: Nesting: Test 3 (Parsoid only)
2654 !! options
2655 parsoid
2656 !! input
2657 :;t1
2658 ::::d2
2659 !! result
2660 <dl>
2661 <dd>
2662 <dl>
2663 <dt>t1</dt>
2664 <dd>
2665 <dl>
2666 <dd>
2667 <dl>
2668 <dd>d2</dd>
2669 </dl>
2670 </dd>
2671 </dl>
2672 </dd>
2673 </dl>
2674 </dd>
2675 </dl>
2676
2677 !! end
2678
2679
2680 !! test
2681 Definition Lists: Nesting: Test 4
2682 !! input
2683 ::;t3
2684 :::d3
2685 !! result
2686 <dl><dd><dl><dd><dl><dt>t3
2687 </dt><dd>d3
2688 </dd></dl>
2689 </dd></dl>
2690 </dd></dl>
2691
2692 !! end
2693
2694
2695 ## The Parsoid team believes the following three test exposes a
2696 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2697 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2698 !! test
2699 Definition Lists: Mixed Lists: Test 1 (php)
2700 !! options
2701 php
2702 !! input
2703 :;* foo
2704 ::* bar
2705 :; baz
2706 !! result
2707 <dl><dd><dl><dt><ul><li> foo
2708 </li><li> bar
2709 </li></ul>
2710 </dt></dl>
2711 <dl><dt> baz
2712 </dt></dl>
2713 </dd></dl>
2714
2715 !! end
2716 !! test
2717 Definition Lists: Mixed Lists: Test 1 (parsoid)
2718 !! options
2719 parsoid
2720 !! input
2721 :;* foo
2722 ::* bar
2723 :; baz
2724 !! result
2725 <dl><dd><dl><dt><ul><li> foo
2726 </li></ul></dt><dd><ul><li> bar
2727 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2728 !! end
2729
2730 !! test
2731 Definition Lists: Mixed Lists: Test 2
2732 !! input
2733 *: d1
2734 *: d2
2735 !! result
2736 <ul><li><dl><dd> d1
2737 </dd><dd> d2
2738 </dd></dl>
2739 </li></ul>
2740
2741 !! end
2742
2743
2744 !! test
2745 Definition Lists: Mixed Lists: Test 3
2746 !! input
2747 *::: d1
2748 *::: d2
2749 !! result
2750 <ul><li><dl><dd><dl><dd><dl><dd> d1
2751 </dd><dd> d2
2752 </dd></dl>
2753 </dd></dl>
2754 </dd></dl>
2755 </li></ul>
2756
2757 !! end
2758
2759
2760 !! test
2761 Definition Lists: Mixed Lists: Test 4
2762 !! input
2763 *;d1 :d2
2764 *;d3 :d4
2765 !! result
2766 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2767 </dd><dt>d3&#160;</dt><dd>d4
2768 </dd></dl>
2769 </li></ul>
2770
2771 !! end
2772
2773
2774 !! test
2775 Definition Lists: Mixed Lists: Test 5
2776 !! input
2777 *:d1
2778 *:: d2
2779 !! result
2780 <ul><li><dl><dd>d1
2781 <dl><dd> d2
2782 </dd></dl>
2783 </dd></dl>
2784 </li></ul>
2785
2786 !! end
2787
2788
2789 !! test
2790 Definition Lists: Mixed Lists: Test 6
2791 !! input
2792 #*:d1
2793 #*::: d3
2794 !! result
2795 <ol><li><ul><li><dl><dd>d1
2796 <dl><dd><dl><dd> d3
2797 </dd></dl>
2798 </dd></dl>
2799 </dd></dl>
2800 </li></ul>
2801 </li></ol>
2802
2803 !! end
2804
2805
2806 !! test
2807 Definition Lists: Mixed Lists: Test 7
2808 !! input
2809 :* d1
2810 :* d2
2811 !! result
2812 <dl><dd><ul><li> d1
2813 </li><li> d2
2814 </li></ul>
2815 </dd></dl>
2816
2817 !! end
2818
2819
2820 !! test
2821 Definition Lists: Mixed Lists: Test 8
2822 !! input
2823 :* d1
2824 ::* d2
2825 !! result
2826 <dl><dd><ul><li> d1
2827 </li></ul>
2828 <dl><dd><ul><li> d2
2829 </li></ul>
2830 </dd></dl>
2831 </dd></dl>
2832
2833 !! end
2834
2835
2836 !! test
2837 Definition Lists: Mixed Lists: Test 9
2838 !! input
2839 *;foo :bar
2840 !! result
2841 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2842 </dd></dl>
2843 </li></ul>
2844
2845 !! end
2846
2847
2848 !! test
2849 Definition Lists: Mixed Lists: Test 10
2850 !! input
2851 *#;foo :bar
2852 !! result
2853 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2854 </dd></dl>
2855 </li></ol>
2856 </li></ul>
2857
2858 !! end
2859
2860 # The Parsoid team disagrees with the PHP parser's seemingly-random
2861 # rules regarding dd/dt on the next two tests. Parsoid is more
2862 # consistent, and recognizes the shared nesting and keeps the
2863 # still-open tags around until the nesting is complete.
2864
2865 !! test
2866 Definition Lists: Mixed Lists: Test 11 (php)
2867 !! options
2868 php
2869 !! input
2870 *#*#;*;;foo :bar
2871 *#*#;boo :baz
2872 !! result
2873 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2874 </dt></dl>
2875 </dd></dl>
2876 </li></ul>
2877 </dd></dl>
2878 <dl><dt>boo&#160;</dt><dd>baz
2879 </dd></dl>
2880 </li></ol>
2881 </li></ul>
2882 </li></ol>
2883 </li></ul>
2884
2885 !! end
2886 !! test
2887 Definition Lists: Mixed Lists: Test 11 (parsoid)
2888 !! options
2889 parsoid
2890 !! input
2891 *#*#;*;;foo :bar
2892 *#*#;boo :baz
2893 !! result
2894 <ul>
2895 <li>
2896 <ol>
2897 <li>
2898 <ul>
2899 <li>
2900 <ol>
2901 <li>
2902 <dl>
2903 <dt>
2904 <ul>
2905 <li>
2906 <dl>
2907 <dt>
2908 <dl>
2909 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2910 <dd data-parsoid='{"stx":"row"}'>bar</dd></dl></dt></dl></li></ul></dt>
2911 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2912 <dd data-parsoid='{"stx":"row"}'>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2913 !! end
2914
2915
2916 !! test
2917 Definition Lists: Weird Ones: Test 1 (php)
2918 !! options
2919 php
2920 !! input
2921 *#;*::;; foo : bar (who uses this?)
2922 !! result
2923 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2924 </dt></dl>
2925 </dd></dl>
2926 </dd></dl>
2927 </dd></dl>
2928 </li></ul>
2929 </dd></dl>
2930 </li></ol>
2931 </li></ul>
2932
2933 !! end
2934 !! test
2935 Definition Lists: Weird Ones: Test 1 (parsoid)
2936 !! options
2937 parsoid
2938 !! input
2939 *#;*::;; foo : bar (who uses this?)
2940 !! result
2941 <ul>
2942 <li>
2943 <ol>
2944 <li>
2945 <dl>
2946 <dt>
2947 <ul>
2948 <li>
2949 <dl>
2950 <dd>
2951 <dl>
2952 <dd>
2953 <dl>
2954 <dt>
2955 <dl>
2956 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2957 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd></dl></dt></dl></dd></dl></dd></dl></li></ul></dt></dl></li></ol></li></ul>
2958 !! end
2959
2960 ###
2961 ### External links
2962 ###
2963 !! test
2964 External links: non-bracketed
2965 !! input
2966 Non-bracketed: http://example.com
2967 !! result
2968 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2969 </p>
2970 !! end
2971
2972 !! test
2973 External links: numbered
2974 !! input
2975 Numbered: [http://example.com]
2976 Numbered: [http://example.net]
2977 Numbered: [http://example.com]
2978 !! result
2979 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2980 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2981 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2982 </p>
2983 !!end
2984
2985 !! test
2986 External links: specified text
2987 !! input
2988 Specified text: [http://example.com link]
2989 !! result
2990 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2991 </p>
2992 !!end
2993
2994 !! test
2995 External links: trail
2996 !! input
2997 Linktrails should not work for external links: [http://example.com link]s
2998 !! result
2999 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
3000 </p>
3001 !! end
3002
3003 !! test
3004 External links: dollar sign in URL
3005 !! input
3006 http://example.com/1$2345
3007 !! result
3008 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
3009 </p>
3010 !! end
3011
3012 !! test
3013 External links: dollar sign in URL (named)
3014 !! input
3015 [http://example.com/1$2345]
3016 !! result
3017 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
3018 </p>
3019 !!end
3020
3021 !! test
3022 External links: open square bracket forbidden in URL (bug 4377)
3023 !! input
3024 http://example.com/1[2345
3025 !! result
3026 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
3027 </p>
3028 !! end
3029
3030 !! test
3031 External links: open square bracket forbidden in URL (named) (bug 4377)
3032 !! input
3033 [http://example.com/1[2345]
3034 !! result
3035 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3036 </p>
3037 !!end
3038
3039 !! test
3040 External links: nowiki in URL link text (bug 6230)
3041 !!input
3042 [http://example.com/ <nowiki>''example site''</nowiki>]
3043 !! result
3044 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
3045 </p>
3046 !! end
3047
3048 !! test
3049 External links: newline forbidden in text (bug 6230 regression check)
3050 !! input
3051 [http://example.com/ first
3052 second]
3053 !! result
3054 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
3055 second]
3056 </p>
3057 !!end
3058
3059 !! test
3060 External links: Pipe char between url and text
3061 !! input
3062 [http://example.com | link]
3063 !! result
3064 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
3065 </p>
3066 !!end
3067
3068 !! test
3069 External links: protocol-relative URL in brackets
3070 !! input
3071 [//example.com/ Test]
3072 !! result
3073 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
3074 </p>
3075 !! end
3076
3077 !! test
3078 External links: protocol-relative URL in brackets without text
3079 !! input
3080 [//example.com]
3081 !! result
3082 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
3083 </p>
3084 !! end
3085
3086 !! test
3087 External links: protocol-relative URL in free text is left alone
3088 !! input
3089 //example.com/Foo
3090 !! result
3091 <p>//example.com/Foo
3092 </p>
3093 !!end
3094
3095 !! test
3096 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
3097 !! input
3098 foo//example.com/Foo
3099 !! result
3100 <p>foo//example.com/Foo
3101 </p>
3102 !! end
3103
3104 !! test
3105 External image
3106 !! input
3107 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3108 !! result
3109 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3110 </p>
3111 !! end
3112
3113 !! test
3114 External image from https
3115 !! input
3116 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3117 !! result
3118 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3119 </p>
3120 !! end
3121
3122 !! test
3123 External image (when not allowed)
3124 !! options
3125 wgAllowExternalImages=0
3126 !! input
3127 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3128 !! result
3129 <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>
3130 </p>
3131 !! end
3132
3133 !! test
3134 Link to non-http image, no img tag
3135 !! input
3136 Link to non-http image, no img tag: ftp://example.com/test.jpg
3137 !! result
3138 <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>
3139 </p>
3140 !! end
3141
3142 !! test
3143 External links: terminating separator
3144 !! input
3145 Terminating separator: http://example.com/thing,
3146 !! result
3147 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
3148 </p>
3149 !! end
3150
3151 !! test
3152 External links: intervening separator
3153 !! input
3154 Intervening separator: http://example.com/1,2,3
3155 !! result
3156 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
3157 </p>
3158 !! end
3159
3160 !! test
3161 External links: old bug with URL in query
3162 !! input
3163 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
3164 !! result
3165 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
3166 </p>
3167 !! end
3168
3169 !! test
3170 External links: old URL-in-URL bug, mixed protocols
3171 !! input
3172 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
3173 !! result
3174 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
3175 </p>
3176 !!end
3177
3178 !! test
3179 External links: URL in text
3180 !! input
3181 URL in text: [http://example.com http://example.com]
3182 !! result
3183 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3184 </p>
3185 !! end
3186
3187 !! test
3188 External links: Clickable images
3189 !! input
3190 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
3191 !! result
3192 <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>
3193 </p>
3194 !!end
3195
3196 !! test
3197 External links: raw ampersand
3198 !! input
3199 Old &amp; use: http://x&y
3200 !! result
3201 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3202 </p>
3203 !! end
3204
3205 !! test
3206 External links: encoded ampersand
3207 !! input
3208 Old &amp; use: http://x&amp;y
3209 !! result
3210 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3211 </p>
3212 !! end
3213
3214 !! test
3215 External links: encoded equals (bug 6102)
3216 !! input
3217 http://example.com/?foo&#61;bar
3218 !! result
3219 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
3220 </p>
3221 !! end
3222
3223 !! test
3224 External links: [raw ampersand]
3225 !! input
3226 Old &amp; use: [http://x&y]
3227 !! result
3228 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3229 </p>
3230 !! end
3231
3232 !! test
3233 External links: [encoded ampersand]
3234 !! input
3235 Old &amp; use: [http://x&amp;y]
3236 !! result
3237 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3238 </p>
3239 !! end
3240
3241 !! test
3242 External links: [encoded equals] (bug 6102)
3243 !! input
3244 [http://example.com/?foo&#61;bar]
3245 !! result
3246 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3247 </p>
3248 !! end
3249
3250 !! test
3251 External links: [IDN ignored character reference in hostname; strip it right off]
3252 !! input
3253 [http://e&zwnj;xample.com/]
3254 !! result
3255 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
3256 </p>
3257 !! end
3258
3259 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
3260 # Where an external link could easily circumvent the sanitization of the text of
3261 # a link like this (where an IDN-ignore character is in the URL somewhere), this
3262 # test demands a higher standard. That's a bit strange.
3263 #
3264 # Example:
3265 #
3266 # http://e‌xample.com -> [http://example.com|http://example.com]
3267 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
3268 #
3269 # The first example is sanitized, but the second is not. Any security benefits
3270 # from this production are trivial to circumvent. Either remove this test and
3271 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
3272 # the test accordingly.
3273 #
3274 # All our love,
3275 # The Parsoid team.
3276 !! test
3277 External links: IDN ignored character reference in hostname; strip it right off
3278 !! input
3279 http://e&zwnj;xample.com/
3280 !! result
3281 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
3282 </p>
3283 !! end
3284
3285 !! test
3286 External links: www.jpeg.org (bug 554)
3287 !! input
3288 http://www.jpeg.org
3289 !!result
3290 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
3291 </p>
3292 !! end
3293
3294 !! test
3295 External links: URL within URL (original bug 2)
3296 !! input
3297 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
3298 !! result
3299 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
3300 </p>
3301 !! end
3302
3303 !! test
3304 BUG 361: URL inside bracketed URL
3305 !! input
3306 [http://www.example.com/foo http://www.example.com/bar]
3307 !! result
3308 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
3309 </p>
3310 !! end
3311
3312 !! test
3313 BUG 361: URL within URL, not bracketed
3314 !! input
3315 http://www.example.com/foo?=http://www.example.com/bar
3316 !! result
3317 <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>
3318 </p>
3319 !! end
3320
3321 !! test
3322 BUG 289: ">"-token in URL-tail
3323 !! input
3324 http://www.example.com/<hello>
3325 !! result
3326 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
3327 </p>
3328 !!end
3329
3330 !! test
3331 BUG 289: literal ">"-token in URL-tail
3332 !! input
3333 http://www.example.com/<b>html</b>
3334 !! result
3335 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
3336 </p>
3337 !!end
3338
3339 !! test
3340 BUG 289: ">"-token in bracketed URL
3341 !! input
3342 [http://www.example.com/<hello> stuff]
3343 !! result
3344 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
3345 </p>
3346 !!end
3347
3348 !! test
3349 BUG 289: literal ">"-token in bracketed URL
3350 !! input
3351 [http://www.example.com/<b>html</b> stuff]
3352 !! result
3353 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
3354 </p>
3355 !!end
3356
3357 !! test
3358 BUG 289: literal double quote at end of URL
3359 !! input
3360 http://www.example.com/"hello"
3361 !! result
3362 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
3363 </p>
3364 !!end
3365
3366 !! test
3367 BUG 289: literal double quote in bracketed URL
3368 !! input
3369 [http://www.example.com/"hello" stuff]
3370 !! result
3371 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
3372 </p>
3373 !!end
3374
3375 !! test
3376 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
3377 !! input
3378 [http://www.example.com test]
3379 !! result
3380 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3381 </p>
3382 !! end
3383
3384 !! test
3385 External links: link text with spaces
3386 !! input
3387 [http://www.example.com a b c]
3388 [http://www.example.com ''a'' ''b'']
3389 !! result
3390 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3391 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3392 </p>
3393 !! end
3394
3395 !! test
3396 External links: wiki links within external link (Bug 3695)
3397 !! input
3398 [http://example.com [[wikilink]] embedded in ext link]
3399 !! result
3400 <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>
3401 </p>
3402 !! end
3403
3404 !! test
3405 BUG 787: Links with one slash after the url protocol are invalid
3406 !! input
3407 http:/example.com
3408
3409 [http:/example.com title]
3410 !! result
3411 <p>http:/example.com
3412 </p><p>[http:/example.com title]
3413 </p>
3414 !! end
3415
3416 !! test
3417 Bracketed external links with template-generated invalid target
3418 !! input
3419 [{{echo|http:/example.com}} title]
3420 !! result
3421 <p>[http:/example.com title]
3422 </p>
3423 !! end
3424
3425 !! test
3426 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3427 !! input
3428 ''[http://example.com text'']
3429 [http://example.com '''text]'''
3430 ''Something [http://example.com in italic'']
3431 ''Something [http://example.com mixed''''', even bold]'''
3432 '''''Now [http://example.com both''''']
3433 !! result
3434 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3435 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3436 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3437 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3438 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3439 </p>
3440 !! end
3441
3442
3443 !! test
3444 Bug 4781: %26 in URL
3445 !! input
3446 http://www.example.com/?title=AT%26T
3447 !! result
3448 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3449 </p>
3450 !! end
3451
3452 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3453 # % is actually legal in HTML5. Any change in output would need testing though.
3454 !! test
3455 Bug 4781, 5267: %25 in URL
3456 !! input
3457 http://www.example.com/?title=100%25_Bran
3458 !! result
3459 <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>
3460 </p>
3461 !! end
3462
3463 !! test
3464 Bug 4781, 5267: %28, %29 in URL
3465 !! input
3466 http://www.example.com/?title=Ben-Hur_%281959_film%29
3467 !! result
3468 <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>
3469 </p>
3470 !! end
3471
3472
3473 !! test
3474 Bug 4781: %26 in autonumber URL
3475 !! input
3476 [http://www.example.com/?title=AT%26T]
3477 !! result
3478 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3479 </p>
3480 !! end
3481
3482 !! test
3483 Bug 4781, 5267: %26 in autonumber URL
3484 !! input
3485 [http://www.example.com/?title=100%25_Bran]
3486 !! result
3487 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3488 </p>
3489 !! end
3490
3491 !! test
3492 Bug 4781, 5267: %28, %29 in autonumber URL
3493 !! input
3494 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3495 !! result
3496 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3497 </p>
3498 !! end
3499
3500
3501 !! test
3502 Bug 4781: %26 in bracketed URL
3503 !! input
3504 [http://www.example.com/?title=AT%26T link]
3505 !! result
3506 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3507 </p>
3508 !! end
3509
3510 !! test
3511 Bug 4781, 5267: %26 in bracketed URL
3512 !! input
3513 [http://www.example.com/?title=100%25_Bran link]
3514 !! result
3515 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3516 </p>
3517 !! end
3518
3519 !! test
3520 Bug 4781, 5267: %28, %29 in bracketed URL
3521 !! input
3522 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3523 !! result
3524 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3525 </p>
3526 !! end
3527
3528 !! test
3529 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3530 !! input
3531 Some [http://example.com/ pretty ''italics'' and stuff]!
3532 !! result
3533 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3534 </p>
3535 !! end
3536
3537 !! test
3538 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3539 !! input
3540 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3541 !! result
3542 <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>
3543 </p>
3544 !! end
3545
3546 !! test
3547 External link containing double-single-quotes with no space separating the url from text in italics
3548 !! input
3549 [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]].]
3550 !! result
3551 <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>
3552 </p>
3553 !! end
3554
3555 !! test
3556 External link with comments in link text
3557 !! input
3558 [http://www.google.com Google <!-- comment -->]
3559 !! result
3560 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3561 </p>
3562 !! end
3563
3564 !! test
3565 URL-encoding in URL functions (single parameter)
3566 !! input
3567 {{localurl:Some page|amp=&}}
3568 !! result
3569 <p>/index.php?title=Some_page&amp;amp=&amp;
3570 </p>
3571 !! end
3572
3573 !! test
3574 URL-encoding in URL functions (multiple parameters)
3575 !! input
3576 {{localurl:Some page|q=?&amp=&}}
3577 !! result
3578 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3579 </p>
3580 !! end
3581
3582 !! test
3583 Brackets in urls
3584 !! input
3585 http://example.com/index.php?foozoid%5B%5D=bar
3586
3587 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3588 !! result
3589 <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>
3590 </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>
3591 </p>
3592 !! end
3593
3594 !! test
3595 IPv6 urls (bug 21261)
3596 !! options
3597 disabled
3598 !! input
3599 http://[2404:130:0:1000::187:2]/index.php
3600 !! result
3601 <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>
3602 </p>
3603 !! end
3604
3605 !! test
3606 Non-extlinks in brackets
3607 !! input
3608 [foo]
3609 [foo bar]
3610 [foo ''bar'']
3611 [fool's] errand
3612 [fool's errand]
3613 [{{echo|foo}}]
3614 [{{echo|foo}} bar]
3615 [{{echo|foo}} ''bar'']
3616 [{{echo|foo}}l's] errand
3617 [{{echo|foo}}l's errand]
3618 [url={{echo|foo}}]
3619 [url=http://example.com]
3620 !! result
3621 <p>[foo]
3622 [foo bar]
3623 [foo <i>bar</i>]
3624 [fool's] errand
3625 [fool's errand]
3626 [foo]
3627 [foo bar]
3628 [foo <i>bar</i>]
3629 [fool's] errand
3630 [fool's errand]
3631 [url=foo]
3632 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3633 </p>
3634 !! end
3635
3636 !! test
3637 Parsoid: Percent encoding in external links
3638 !! options
3639 parsoid
3640 !! input
3641 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
3642 !! result
3643 <p><a rel="mw:ExtLink"
3644 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
3645 !! end
3646
3647 !! test
3648 Parsoid: use url link syntax for links where the content is equal the link
3649 target
3650 !! options
3651 parsoid
3652 !! input
3653 http://example.com
3654 !! result
3655 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
3656 !! end
3657
3658 ###
3659 ### Quotes
3660 ###
3661
3662 !! test
3663 Quotes
3664 !! input
3665 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3666
3667 Normal text. '''''Bold italic text.''''' Normal text.
3668 !!result
3669 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3670 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3671 </p>
3672 !! end
3673
3674
3675 !! test
3676 Unclosed and unmatched quotes (php)
3677 !! options
3678 php
3679 !! input
3680 '''''Bold italic text '''with bold deactivated''' in between.'''''
3681
3682 '''''Bold italic text ''with italic deactivated'' in between.'''''
3683
3684 '''Bold text..
3685
3686 ..spanning two paragraphs (should not work).'''
3687
3688 '''Bold tag left open
3689
3690 ''Italic tag left open
3691
3692 Normal text.
3693
3694 <!-- Unmatching number of opening, closing tags: -->
3695 '''This year''''s election ''should'' beat '''last year''''s.
3696
3697 ''Tom'''s car is bigger than ''Susan'''s.
3698
3699 Plain ''italic'''s plain
3700 !! result
3701 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3702 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3703 </p><p><b>Bold text..</b>
3704 </p><p>..spanning two paragraphs (should not work).
3705 </p><p><b>Bold tag left open</b>
3706 </p><p><i>Italic tag left open</i>
3707 </p><p>Normal text.
3708 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3709 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3710 </p><p>Plain <i>italic'</i>s plain
3711 </p>
3712 !! end
3713 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3714 # parser strips. The wikitext contains just the first half of the bold
3715 # quote pair.
3716 !! test
3717 Unclosed and unmatched quotes (parsoid)
3718 !! options
3719 parsoid
3720 !! input
3721 '''''Bold italic text '''with bold deactivated''' in between.'''''
3722
3723 '''''Bold italic text ''with italic deactivated'' in between.'''''
3724
3725 '''Bold text..
3726
3727 ..spanning two paragraphs (should not work).'''
3728
3729 '''Bold tag left open
3730
3731 ''Italic tag left open
3732
3733 Normal text.
3734
3735 <!-- Unmatching number of opening, closing tags: -->
3736 '''This year''''s election ''should'' beat '''last year''''s.
3737
3738 ''Tom'''s car is bigger than ''Susan'''s.
3739
3740 Plain ''italic'''s plain
3741 !! result
3742 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3743 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3744 </p><p><b>Bold text..</b>
3745 </p><p>..spanning two paragraphs (should not work).<b></b>
3746 </p><p><b>Bold tag left open</b>
3747 </p><p><i>Italic tag left open</i>
3748 </p><p>Normal text.
3749 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3750 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3751 </p><p>Plain <i>italic'</i>s plain
3752 </p>
3753 !! end
3754
3755 ###
3756 ### Tables
3757 ###
3758 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3759 ###
3760
3761 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3762 # is the bare minimum required by the spec, see:
3763 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3764 !! test
3765 A table with no data. (php)
3766 !! options
3767 php
3768 !! input
3769 {||}
3770 !! result
3771 !! end
3772 # Parsoid team replies: empty table tags are legal in HTML5
3773 !! test
3774 A table with no data. (parsoid)
3775 !! options
3776 parsoid
3777 !! input
3778 {||}
3779 !! result
3780 <table></table>
3781 !! end
3782
3783 # A table with nothing but a caption is invalid XHTML, we might want to render
3784 # this as <p>caption</p>
3785 !! test
3786 A table with nothing but a caption (php)
3787 !! options
3788 php
3789 !! input
3790 {|
3791 |+ caption
3792 |}
3793 !! result
3794 <table>
3795 <caption> caption
3796 </caption><tr><td></td></tr></table>
3797
3798 !! end
3799 # Parsoid team replies: table with only a caption is legal in HTML5
3800 !! test
3801 A table with nothing but a caption (parsoid)
3802 !! options
3803 parsoid
3804 !! input
3805 {|
3806 |+ caption
3807 |}
3808 !! result
3809 <table><caption> caption</caption></table>
3810 !! end
3811
3812 !! test
3813 A table with caption with default-spaced attributes and a table row
3814 !! input
3815 {|
3816 |+ style="color: red;" | caption1
3817 |-
3818 | foo
3819 |}
3820 !! result
3821 <table>
3822 <caption style="color: red;"> caption1
3823 </caption>
3824 <tr>
3825 <td> foo
3826 </td></tr></table>
3827
3828 !! end
3829
3830 !! test
3831 A table with captions with non-default spaced attributes and a table row
3832 !! input
3833 {|
3834 |+style="color: red;"|caption2
3835 |+ style="color: red;"| caption3
3836 |-
3837 | foo
3838 |}
3839 !! result
3840 <table>
3841 <caption style="color: red;">caption2
3842 </caption>
3843 <caption style="color: red;"> caption3
3844 </caption>
3845 <tr>
3846 <td> foo
3847 </td></tr></table>
3848
3849 !! end
3850
3851 !! test
3852 Table td-cell syntax variations
3853 !! input
3854 {|
3855 | foo bar foo | baz
3856 | foo bar foo || baz
3857 | style='color:red;' | baz
3858 | style='color:red;' || baz
3859 |}
3860 !! result
3861 <table>
3862 <tr>
3863 <td> baz
3864 </td>
3865 <td> foo bar foo </td>
3866 <td> baz
3867 </td>
3868 <td style="color:red;"> baz
3869 </td>
3870 <td> style='color:red;' </td>
3871 <td> baz
3872 </td></tr></table>
3873
3874 !! end
3875
3876 !! test
3877 Simple table
3878 !! input
3879 {|
3880 | 1 || 2
3881 |-
3882 | 3 || 4
3883 |}
3884 !! result
3885 <table>
3886 <tr>
3887 <td> 1 </td>
3888 <td> 2
3889 </td></tr>
3890 <tr>
3891 <td> 3 </td>
3892 <td> 4
3893 </td></tr></table>
3894
3895 !! end
3896
3897 !! test
3898 Simple table but with multiple dashes for row wikitext
3899 !! input
3900 {|
3901 | foo
3902 |-----
3903 | bar
3904 |}
3905 !! result
3906 <table>
3907 <tr>
3908 <td> foo
3909 </td></tr>
3910 <tr>
3911 <td> bar
3912 </td></tr></table>
3913
3914 !! end
3915 !! test
3916 Multiplication table
3917 !! input
3918 {| border="1" cellpadding="2"
3919 |+Multiplication table
3920 |-
3921 ! &times; !! 1 !! 2 !! 3
3922 |-
3923 ! 1
3924 | 1 || 2 || 3
3925 |-
3926 ! 2
3927 | 2 || 4 || 6
3928 |-
3929 ! 3
3930 | 3 || 6 || 9
3931 |-
3932 ! 4
3933 | 4 || 8 || 12
3934 |-
3935 ! 5
3936 | 5 || 10 || 15
3937 |}
3938 !! result
3939 <table border="1" cellpadding="2">
3940 <caption>Multiplication table
3941 </caption>
3942 <tr>
3943 <th> &#215; </th>
3944 <th> 1 </th>
3945 <th> 2 </th>
3946 <th> 3
3947 </th></tr>
3948 <tr>
3949 <th> 1
3950 </th>
3951 <td> 1 </td>
3952 <td> 2 </td>
3953 <td> 3
3954 </td></tr>
3955 <tr>
3956 <th> 2
3957 </th>
3958 <td> 2 </td>
3959 <td> 4 </td>
3960 <td> 6
3961 </td></tr>
3962 <tr>
3963 <th> 3
3964 </th>
3965 <td> 3 </td>
3966 <td> 6 </td>
3967 <td> 9
3968 </td></tr>
3969 <tr>
3970 <th> 4
3971 </th>
3972 <td> 4 </td>
3973 <td> 8 </td>
3974 <td> 12
3975 </td></tr>
3976 <tr>
3977 <th> 5
3978 </th>
3979 <td> 5 </td>
3980 <td> 10 </td>
3981 <td> 15
3982 </td></tr></table>
3983
3984 !! end
3985
3986 !! test
3987 Accept "||" in table headings
3988 !! input
3989 {|
3990 !h1 || h2
3991 |}
3992 !! result
3993 <table>
3994 <tr>
3995 <th>h1 </th>
3996 <th> h2
3997 </th></tr></table>
3998
3999 !! end
4000
4001 !! test
4002 Accept "||" in indented table headings
4003 !! input
4004 :{|
4005 !h1 || h2
4006 |}
4007 !! result
4008 <dl><dd><table>
4009 <tr>
4010 <th>h1 </th>
4011 <th> h2
4012 </th></tr></table></dd></dl>
4013
4014 !! end
4015
4016 !! test
4017 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
4018 !! input
4019 {|
4020 !| h1
4021 || a
4022 |}
4023 !! result
4024 <table>
4025 <tr>
4026 <th> h1
4027 </th>
4028 <td> a
4029 </td></tr></table>
4030
4031 !! end
4032
4033 !!test
4034 Accept "| !" at start of line in tables (ignore !-attribute)
4035 !!input
4036 {|
4037 |-
4038 | !style="color:red" | bar
4039 |}
4040 !!result
4041 <table>
4042
4043 <tr>
4044 <td> bar
4045 </td></tr></table>
4046
4047 !!end
4048
4049 !!test
4050 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 +/-
4051 !!input
4052 {|
4053 |-
4054 |style='color:red;'|+1
4055 |style='color:blue;'|-1
4056 |-
4057 | 1 || 2 || 3
4058 | 1 ||+2 ||-3
4059 |-
4060 | +1
4061 | -1
4062 |}
4063 !!result
4064 <table>
4065
4066 <tr>
4067 <td style="color:red;">+1
4068 </td>
4069 <td style="color:blue;">-1
4070 </td></tr>
4071 <tr>
4072 <td> 1 </td>
4073 <td> 2 </td>
4074 <td> 3
4075 </td>
4076 <td> 1 </td>
4077 <td>+2 </td>
4078 <td>-3
4079 </td></tr>
4080 <tr>
4081 <td> +1
4082 </td>
4083 <td> -1
4084 </td></tr></table>
4085
4086 !!end
4087
4088 !! test
4089 Table rowspan
4090 !! input
4091 {| border=1
4092 | Cell 1, row 1
4093 |rowspan=2| Cell 2, row 1 (and 2)
4094 | Cell 3, row 1
4095 |-
4096 | Cell 1, row 2
4097 | Cell 3, row 2
4098 |}
4099 !! result
4100 <table border="1">
4101 <tr>
4102 <td> Cell 1, row 1
4103 </td>
4104 <td rowspan="2"> Cell 2, row 1 (and 2)
4105 </td>
4106 <td> Cell 3, row 1
4107 </td></tr>
4108 <tr>
4109 <td> Cell 1, row 2
4110 </td>
4111 <td> Cell 3, row 2
4112 </td></tr></table>
4113
4114 !! end
4115
4116 !! test
4117 Nested table
4118 !! input
4119 {| border=1
4120 | &alpha;
4121 |
4122 {| bgcolor=#ABCDEF border=2
4123 |nested
4124 |-
4125 |table
4126 |}
4127 |the original table again
4128 |}
4129 !! result
4130 <table border="1">
4131 <tr>
4132 <td> &#945;
4133 </td>
4134 <td>
4135 <table bgcolor="#ABCDEF" border="2">
4136 <tr>
4137 <td>nested
4138 </td></tr>
4139 <tr>
4140 <td>table
4141 </td></tr></table>
4142 </td>
4143 <td>the original table again
4144 </td></tr></table>
4145
4146 !! end
4147
4148 !! test
4149 Invalid attributes in table cell (bug 1830)
4150 !! input
4151 {|
4152 |Cell:|broken
4153 |}
4154 !! result
4155 <table>
4156 <tr>
4157 <td>broken
4158 </td></tr></table>
4159
4160 !! end
4161
4162
4163 !! test
4164 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
4165 !! input
4166 {|
4167 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
4168 !! result
4169 <table>
4170 <tr>
4171 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
4172 <td>]" onmouseover="alert(document.cookie)"&gt;test
4173 </td>
4174 </tr>
4175 </table>
4176
4177 !! end
4178
4179
4180 !! test
4181 Indented table markup mixed with indented pre content (proposed in bug 6200)
4182 !! input
4183 <table>
4184 <tr>
4185 <td>
4186 Text that should be rendered preformatted
4187 </td>
4188 </tr>
4189 </table>
4190 !! result
4191 <table>
4192 <tr>
4193 <td>
4194 <pre>Text that should be rendered preformatted
4195 </pre>
4196 </td>
4197 </tr>
4198 </table>
4199
4200 !! end
4201
4202 !! test
4203 Template-generated table cell attributes and cell content
4204 !! input
4205 {|
4206 |{{table_attribs}}
4207 | {{table_attribs}}
4208 |}
4209 !! result
4210 <table>
4211 <tr>
4212 <td style="color: red"> Foo
4213 </td>
4214 <td style="color: red"> Foo
4215 </td></tr></table>
4216
4217 !! end
4218
4219 !! test
4220 Template-generated table cell attributes and cell content (2)
4221 !! input
4222 {|
4223 |align=center {{table_attribs}}
4224 |}
4225 !! result
4226 <table>
4227 <tr>
4228 <td align="center" style="color: red"> Foo
4229 </td></tr></table>
4230
4231 !! end
4232
4233 !! test
4234 Template-generated table cell attributes and cell content (3)
4235 !! input
4236 {|
4237 |align=center {{table_cells}}
4238 |}
4239 !! result
4240 <table>
4241 <tr>
4242 <td align="center" style="color: red"> Foo </td>
4243 <td> Bar </td>
4244 <td> Baz
4245 </td></tr></table>
4246
4247 !! end
4248
4249 !! test
4250 Table with row followed by newlines and table heading
4251 !! input
4252 {|
4253 |-
4254
4255 ! foo
4256 |}
4257 !! result
4258 <table>
4259
4260
4261 <tr>
4262 <th> foo
4263 </th></tr></table>
4264
4265 !! end
4266
4267 !! test
4268 Table with empty line following the start tag
4269 !! input
4270 {|
4271
4272 |-
4273 | foo
4274 |}
4275 !! result
4276 <table>
4277
4278
4279 <tr>
4280 <td> foo
4281 </td></tr></table>
4282
4283 !! end
4284
4285 # FIXME: Preserve the attribute properly (with an empty string as value) in
4286 # the PHP parser. Parsoid implements the behavior below.
4287 !! test
4288 Table attributes with empty value
4289 !! options
4290 parsoid
4291 !! input
4292 {|
4293 | style=| hello
4294 |}
4295 !! result
4296 <table>
4297 <tbody>
4298 <tr>
4299 <td style=""> hello
4300 </td></tr></tbody></table>
4301
4302 !! end
4303
4304 !! test
4305 Wikitext table with a lot of comments
4306 !! input
4307 {|
4308 <!-- c0 -->
4309 | foo
4310 <!-- c1 -->
4311 |- <!-- c2 -->
4312 <!-- c3 -->
4313 |<!-- c4 -->
4314 <!-- c5 -->
4315 |}
4316 !! result
4317 <table>
4318 <tr>
4319 <td> foo
4320 </td></tr>
4321 <tr>
4322 <td>
4323 </td></tr></table>
4324
4325 !! end
4326
4327 !! test
4328 Wikitext table with double-line table cell
4329 !! input
4330 {|
4331 |a
4332 b
4333 |}
4334 !! result
4335 <table>
4336 <tr>
4337 <td>a
4338 <p>b
4339 </p>
4340 </td></tr></table>
4341
4342 !! end
4343
4344 !! test
4345 Table cell with a single comment
4346 !! input
4347 {|
4348 | <!-- c1 -->
4349 | a
4350 |}
4351 !! result
4352 <table>
4353 <tr>
4354 <td>
4355 </td>
4356 <td> a
4357 </td></tr></table>
4358
4359 !! end
4360
4361 # The expected HTML structure in this test is debatable. The PHP parser does
4362 # not parse this kind of table at all. The main focus for Parsoid is on
4363 # round-tripping, so this output is ok for now. TODO: revisit!
4364 !! test
4365 Wikitext table with html-syntax row (Parsoid)
4366 !! options
4367 parsoid
4368 !! input
4369 {|
4370 |-
4371 <td>foo</td>
4372 |}
4373 !! result
4374 <table>
4375 <tbody>
4376 <tr>
4377 <td>foo</td></tr></tbody></table>
4378 !! end
4379
4380 !! test
4381 Implicit <td> after a |-
4382 (PHP parser relies on Tidy to add the missing <td> tags)
4383 !! options
4384 parsoid=wt2html,wt2wt
4385 !! input
4386 {|
4387 |-
4388 a
4389 |}
4390 !! result
4391 <table>
4392 <tr><td>a</td></tr>
4393 </table>
4394 !! end
4395
4396 !! test
4397 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
4398 (PHP parser relies on Tidy to add the missing <td> tags)
4399 !! options
4400 parsoid=wt2html,wt2wt
4401 !! input
4402 {|
4403 |-
4404 |
4405 a
4406 |-
4407 b
4408 |}
4409 !! result
4410 <table>
4411 <tbody>
4412 <tr><td><pre>a</pre></td></tr>
4413 <tr><td> b</td></tr>
4414 </tbody>
4415 </table>
4416 !! end
4417
4418 !! test
4419 Lists should be recognized in an implicit <td> context
4420 (PHP parser relies on Tidy to add the missing <td> tags)
4421 !! options
4422 parsoid=wt2html,wt2wt
4423 !! input
4424 {|
4425 |-
4426 *a
4427 |}
4428 !! result
4429 <table>
4430 <tr>
4431 <td><ul><li>a</li></ul></td>
4432 </tr>
4433 </table>
4434 !! end
4435
4436 !! test
4437 Parsoid: Round-trip tables directly followed by content (bug 51219)
4438 !! options
4439 parsoid=wt2html,wt2wt
4440 !! input
4441 {|
4442 |foo
4443 |} bar
4444
4445 {|
4446 |baz
4447 |}<b>quux</b>
4448 !! result
4449 <table><tbody>
4450 <tr>
4451 <td>foo</td></tr></tbody></table> bar
4452 <table>
4453 <tbody>
4454 <tr>
4455 <td>baz</td></tr></tbody></table><b>quux</b>
4456 !! end
4457
4458 !! test
4459 Parsoid: Default to a newline after tables in new content (bug 51219)
4460 !! options
4461 parsoid=html2wt
4462 !! input
4463 {|
4464 |foo
4465 |}
4466 <nowiki> </nowiki>bar
4467 {|
4468 |baz
4469 |}
4470 '''quux'''
4471 !! result
4472 <table><tbody>
4473 <tr><td>foo</td></tr></tbody></table> bar
4474 <table><tbody>
4475 <tr><td>baz</td></tr></tbody></table><b>quux</b>
4476 !! end
4477
4478 ###
4479 ### Internal links
4480 ###
4481 !! test
4482 Plain link, capitalized
4483 !! input
4484 [[Main Page]]
4485 !! result
4486 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4487 </p>
4488 !! end
4489
4490 !! test
4491 Plain link, uncapitalized
4492 !! input
4493 [[main Page]]
4494 !! result
4495 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
4496 </p>
4497 !! end
4498
4499 !! test
4500 Piped link
4501 !! input
4502 [[Main Page|The Main Page]]
4503 !! result
4504 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4505 </p>
4506 !! end
4507
4508 !! test
4509 Piped link with comment in link text
4510 !! input
4511 [[Main Page|The Main<!--front--> Page]]
4512 !! result
4513 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4514 </p>
4515 !! end
4516
4517 !! test
4518 Broken link
4519 !! input
4520 [[Zigzagzogzagzig]]
4521 !! result
4522 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
4523 </p>
4524 !! end
4525
4526 !! test
4527 Broken link with fragment
4528 !! input
4529 [[Zigzagzogzagzig#zug]]
4530 !! result
4531 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
4532 </p>
4533 !! end
4534
4535 !! test
4536 Special page link with fragment
4537 !! input
4538 [[Special:Version#anchor]]
4539 !! result
4540 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
4541 </p>
4542 !! end
4543
4544 !! test
4545 Nonexistent special page link with fragment
4546 !! input
4547 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
4548 !! result
4549 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
4550 </p>
4551 !! end
4552
4553 !! test
4554 Link with prefix
4555 !! input
4556 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
4557 !! result
4558 <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>
4559 </p>
4560 !! end
4561
4562 !! test
4563 Link with suffix
4564 !! input
4565 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
4566 !! result
4567 <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>!!!
4568 </p>
4569 !! end
4570
4571 !! article
4572 prefixed article
4573 !! text
4574 Some text
4575 !! endarticle
4576
4577 !! test
4578 Bug 43661: Piped links with identical prefixes
4579 !! input
4580 [[prefixed article|prefixed articles with spaces]]
4581
4582 [[prefixed article|prefixed articlesaoeu]]
4583
4584 [[Main Page|Main Page test]]
4585 !! result
4586 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
4587 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
4588 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
4589 </p>
4590 !! end
4591
4592
4593 !! test
4594 Link with HTML entity in suffix / tail
4595 !! input
4596 [[Main Page]]&quot;, [[Main Page]]&#97;
4597 !! result
4598 <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;
4599 </p>
4600 !! end
4601
4602 !! test
4603 Link with 3 brackets
4604 !! input
4605 [[[main page]]]
4606 !! result
4607 <p>[[[main page]]]
4608 </p>
4609 !! end
4610
4611 !! test
4612 Piped link with 3 brackets
4613 !! input
4614 [[[main page|the main page]]]
4615 !! result
4616 <p>[[[main page|the main page]]]
4617 </p>
4618 !! end
4619
4620 !! test
4621 Link with multiple pipes
4622 !! input
4623 [[Main Page|The|Main|Page]]
4624 !! result
4625 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
4626 </p>
4627 !! end
4628
4629 !! test
4630 Link to namespaces
4631 !! input
4632 [[Talk:Parser testing]], [[Meta:Disclaimers]]
4633 !! result
4634 <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>
4635 </p>
4636 !! end
4637
4638 !! article
4639 MemoryAlpha:AlphaTest
4640 !! text
4641 This is an article in the MemoryAlpha namespace
4642 (which shadows the memoryalpha interwiki link).
4643 !! endarticle
4644
4645 !! test
4646 Namespace takes precedence over interwiki link (bug 51680)
4647 !! input
4648 [[MemoryAlpha:AlphaTest]]
4649 !! result
4650 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
4651 </p>
4652 !! end
4653
4654 !! test
4655 Piped link to namespace
4656 !! input
4657 [[Meta:Disclaimers|The disclaimers]]
4658 !! result
4659 <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>
4660 </p>
4661 !! end
4662
4663 !! test
4664 Link containing }
4665 !! input
4666 [[Usually caused by a typo (oops}]]
4667 !! result
4668 <p>[[Usually caused by a typo (oops}]]
4669 </p>
4670 !! end
4671
4672 !! test
4673 Link containing % (not as a hex sequence)
4674 !! input
4675 [[7% Solution]]
4676 !! result
4677 <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>
4678 </p>
4679 !! end
4680
4681 !! test
4682 Link containing % as a single hex sequence interpreted to char
4683 !! input
4684 [[7%25 Solution]]
4685 !! result
4686 <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>
4687 </p>
4688 !!end
4689
4690 !! test
4691 Link containing % as a double hex sequence interpreted to hex sequence
4692 !! input
4693 [[7%2525 Solution]]
4694 !! result
4695 <p>[[7%2525 Solution]]
4696 </p>
4697 !!end
4698
4699 !! test
4700 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
4701 Example for such a section: == < ==
4702 !! input
4703 [[%23%3c]][[%23%3e]]
4704 !! result
4705 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
4706 </p>
4707 !! end
4708
4709 !! test
4710 Link containing "<#" and ">#" as a hex sequences
4711 !! input
4712 [[%3c%23]][[%3e%23]]
4713 !! result
4714 <p>[[%3c%23]][[%3e%23]]
4715 </p>
4716 !! end
4717
4718 !! test
4719 Link containing an equals sign
4720 !! input
4721 [[Special:BookSources/isbn=4-00-026157-6]]
4722 !! result
4723 <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>
4724 </p>
4725 !! end
4726
4727 !! article
4728 Foo~bar
4729 !! text
4730 Just a test of an article title containing a tilde.
4731 !! endarticle
4732
4733 # note that links containing signatures, like [[Foo~~~~]], are
4734 # massaged by the pre-save transform (PST) and so the tildes are never
4735 # seen by the parser.
4736 !! test
4737 Link containing a tilde
4738 !! input
4739 [[Foo~bar]]
4740 !! result
4741 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
4742 </p>
4743 !! end
4744
4745 !! test
4746 Link containing double-single-quotes '' (bug 4598)
4747 !! input
4748 [[Lista d''e paise d''o munno]]
4749 !! result
4750 <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>
4751 </p>
4752 !! end
4753
4754 !! test
4755 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4756 !! input
4757 Some [[Link|pretty ''italics'' and stuff]]!
4758 !! result
4759 <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>!
4760 </p>
4761 !! end
4762
4763 !! test
4764 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4765 !! input
4766 ''Some [[Link|pretty ''italics'' and stuff]]!
4767 !! result
4768 <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>
4769 </p>
4770 !! end
4771
4772 !! test
4773 Link with double quotes in title part (literal) and alternate part (interpreted)
4774 !! input
4775 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4776
4777 [[''Pentecoste'']]
4778
4779 [[''Pentecoste''|Pentecoste]]
4780
4781 [[''Pentecoste''|''Pentecoste'']]
4782 !! result
4783 <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>
4784 </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>
4785 </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>
4786 </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>
4787 </p>
4788 !! end
4789
4790 !! test
4791 Broken image links with HTML captions (bug 39700)
4792 !! input
4793 [[File:Nonexistent|<script></script>]]
4794 [[File:Nonexistent|100px|<script></script>]]
4795 [[File:Nonexistent|&lt;]]
4796 [[File:Nonexistent|a<i>b</i>c]]
4797 !! result
4798 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4799 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4800 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4801 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4802 </p>
4803 !! end
4804
4805 !! test
4806 Plain link to URL
4807 !! input
4808 [[http://www.example.com]]
4809 !! result
4810 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4811 </p>
4812 !! end
4813
4814 !! test
4815 Plain link to URL with link text
4816 !! input
4817 [[http://www.example.com Link text]]
4818 !! result
4819 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4820 </p>
4821 !! end
4822
4823 !! test
4824 Plain link to protocol-relative URL
4825 !! input
4826 [[//www.example.com]]
4827 !! result
4828 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4829 </p>
4830 !! end
4831
4832 !! test
4833 Plain link to protocol-relative URL with link text
4834 !! input
4835 [[//www.example.com Link text]]
4836 !! result
4837 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4838 </p>
4839 !! end
4840
4841 !! test
4842 Plain link to page with question mark in title
4843 !! input
4844 [[A?b]]
4845
4846 [[A?b|Baz]]
4847 !! result
4848 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4849 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4850 </p>
4851 !! end
4852
4853
4854 # I'm fairly sure the expected result here is wrong.
4855 # We want these to be URL links, not pseudo-pages with URLs for titles....
4856 # However the current output is also pretty screwy.
4857 #
4858 # ----
4859 # I'm changing it to match the current output--it arguably makes more
4860 # sense in the light of the test above. Old expected result was:
4861 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4862 #</p>
4863 # But I think this test is bordering on "garbage in, garbage out" anyway.
4864 # -- wtm
4865 !! test
4866 Piped link to URL
4867 !! input
4868 Piped link to URL: [[http://www.example.com|an example URL]]
4869 !! result
4870 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4871 </p>
4872 !! end
4873
4874 !! test
4875 BUG 2: [[page|http://url/]] should link to page, not http://url/
4876 !! input
4877 [[Main Page|http://url/]]
4878 !! result
4879 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4880 </p>
4881 !! end
4882
4883 !! test
4884 BUG 337: Escaped self-links should be bold
4885 !! options
4886 title=[[Bug462]]
4887 !! input
4888 [[Bu&#103;462]] [[Bug462]]
4889 !! result
4890 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4891 </p>
4892 !! end
4893
4894 !! test
4895 Self-link to section should not be bold
4896 !! options
4897 title=[[Main Page]]
4898 !! input
4899 [[Main Page#section]]
4900 !! result
4901 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4902 </p>
4903 !! end
4904
4905 !! article
4906 00
4907 !! text
4908 This is 00.
4909 !! endarticle
4910
4911 !!test
4912 Self-link to numeric title
4913 !!options
4914 title=[[0]]
4915 !!input
4916 [[0]]
4917 !!result
4918 <p><strong class="selflink">0</strong>
4919 </p>
4920 !!end
4921
4922 !!test
4923 Link to numeric-equivalent title
4924 !!options
4925 title=[[0]]
4926 !!input
4927 [[00]]
4928 !!result
4929 <p><a href="/wiki/00" title="00">00</a>
4930 </p>
4931 !!end
4932
4933 !! test
4934 <nowiki> inside a link
4935 !! input
4936 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4937 !! result
4938 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4939 </p>
4940 !! end
4941
4942 !! test
4943 Non-breaking spaces in title
4944 !! input
4945 [[&nbsp; Main &nbsp; Page &nbsp;]]
4946 !! result
4947 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4948 </p>
4949 !!end
4950
4951 !! test
4952 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4953 !! options
4954 language=ca
4955 !! input
4956 '''[[Main Page]]'''
4957 !! result
4958 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4959 </p>
4960 !! end
4961
4962 !! test
4963 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4964 !! options
4965 language=ca
4966 !! input
4967 ''[[Main Page]]''
4968 !! result
4969 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4970 </p>
4971 !! end
4972
4973 !! test
4974 Internal link with en linktrail: no apostrophes (bug 27473)
4975 !! options
4976 language=en
4977 !! input
4978 [[Something]]'nice
4979 !! result
4980 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4981 </p>
4982 !! end
4983
4984 !! test
4985 Internal link with ca linktrail with apostrophes (bug 27473)
4986 !! options
4987 language=ca
4988 !! input
4989 [[Something]]'nice
4990 !! result
4991 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4992 </p>
4993 !! end
4994
4995 !! test
4996 Internal link with kaa linktrail with apostrophes (bug 27473)
4997 !! options
4998 language=kaa
4999 !! input
5000 [[Something]]'nice
5001 !! result
5002 <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>
5003 </p>
5004 !! end
5005
5006 !! article
5007 Söfnuður
5008 !! text
5009 Test.
5010 !! endarticle
5011
5012 !! test
5013 Internal link with is link prefix
5014 !! options
5015 language=is
5016 !! input
5017 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
5018 !! result
5019 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
5020 </p>
5021 !! end
5022
5023 !! article
5024 Mótmælendatrú
5025 !! text
5026 Test.
5027 !! endarticle
5028
5029 !! test
5030 Internal link with is link trail and link prefix
5031 !! options
5032 language=is
5033 !! input
5034 [[mótmælendatrú|xxx]]ar
5035 [[mótmælendatrú]]ar
5036 mótmælenda[[söfnuður]]
5037 mótmælenda[[söfnuður|söfnuðir]]
5038 mótmælenda[[söfnuður|söfnuðir]]xxx
5039 !! result
5040 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
5041 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
5042 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
5043 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
5044 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
5045 </p>
5046 !! end
5047
5048 !! test
5049 Parsoid link trail escaping
5050 !! options
5051 parsoid=html2wt,html2html
5052 !! input
5053 [[apple]]<nowiki/>s
5054 !! result
5055 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
5056 !! end
5057
5058 !! test
5059 Parsoid link prefix escaping
5060 !! options
5061 language=is
5062 parsoid=html2wt,html2html
5063 !! input
5064 Aðrir mótmælenda<nowiki/>[[söfnuður]]
5065 !! result
5066 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
5067 !! end
5068
5069 !! test
5070 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
5071 !! input
5072 [[Foo| bar]]
5073
5074 [[Foo| ''bar'']]
5075
5076 [http://wp.org foo]
5077
5078 [http://wp.org ''foo'']
5079 !! result
5080 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
5081 </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>
5082 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
5083 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
5084 </p>
5085 !! end
5086
5087 ###
5088 ### Interwiki links (see maintenance/interwiki.sql)
5089 ###
5090
5091 !! test
5092 Inline interwiki link
5093 !! input
5094 [[MeatBall:SoftSecurity]]
5095 !! result
5096 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
5097 </p>
5098 !! end
5099
5100 !! test
5101 Inline interwiki link with empty title (bug 2372)
5102 !! input
5103 [[MeatBall:]]
5104 !! result
5105 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
5106 </p>
5107 !! end
5108
5109 !! test
5110 Interwiki link encoding conversion (bug 1636)
5111 !! input
5112 *[[Wikipedia:ro:Olteni&#0355;a]]
5113 *[[Wikipedia:ro:Olteni&#355;a]]
5114 !! result
5115 <ul><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>
5116 </li><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>
5117 </li></ul>
5118
5119 !! end
5120
5121 !! test
5122 Interwiki link with fragment (bug 2130)
5123 !! input
5124 [[MeatBall:SoftSecurity#foo]]
5125 !! result
5126 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
5127 </p>
5128 !! end
5129
5130
5131 ###
5132 ### Interlanguage links
5133 ### Language links (so that searching for '### language' matches..)
5134 ###
5135
5136 !! test
5137 Interlanguage link
5138 !! input
5139 Blah blah blah
5140 [[zh:Chinese]]
5141 !!result
5142 <p>Blah blah blah
5143 </p>
5144 !! end
5145
5146 !! test
5147 Double interlanguage link
5148 !! input
5149 Blah blah blah
5150 [[es:Spanish]]
5151 [[zh:Chinese]]
5152 !!result
5153 <p>Blah blah blah
5154 </p>
5155 !! end
5156
5157 !! test
5158 Interlanguage link, with prefix links
5159 !! options
5160 language=ln
5161 !! input
5162 Blah blah blah
5163 [[zh:Chinese]]
5164 !!result
5165 <p>Blah blah blah
5166 </p>
5167 !! end
5168
5169 !! test
5170 Double interlanguage link, with prefix links (bug 8897)
5171 !! options
5172 language=ln
5173 !! input
5174 Blah blah blah
5175 [[es:Spanish]]
5176 [[zh:Chinese]]
5177 !!result
5178 <p>Blah blah blah
5179 </p>
5180 !! end
5181
5182 !! test
5183 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
5184 !! options
5185 language=ln
5186 !! input
5187 [[WW&nbsp;II]]
5188 !!result
5189 <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>
5190 </p>
5191 !! end
5192
5193 !! test
5194 Parsoid bug 53221: Wikilinks should be properly entity-escaped
5195 !! options
5196 parsoid=html2wt
5197 !! input
5198 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
5199
5200 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
5201 !!result
5202 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
5203 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
5204 !! end
5205
5206 !! test
5207 Parsoid: handle constructor well
5208 !! options
5209 parsoid
5210 !! input
5211 [[constructor]]
5212
5213 [[constructor:foo]]
5214 !! result
5215 <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>
5216
5217
5218 <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>
5219 !! end
5220
5221 !! test
5222 Parsoid: recognize interlanguage links without a target page
5223 !! options
5224 parsoid
5225 !! input
5226 [[ko:]]
5227 !! result
5228 <p>
5229 <link rel="mw:WikiLink/Language" href="http://ko.wikipedia.org/wiki/"></p>
5230 !! end
5231
5232 !! test
5233 Parsoid: recognize interwiki links without a target page
5234 !! options
5235 parsoid
5236 !! input
5237 [[:ko:]]
5238 !! result
5239 <p><a rel="mw:WikiLink/Interwiki" href="http://ko.wikipedia.org/wiki/">ko:</a></p>
5240 !! end
5241
5242 ###
5243 ### Redirects, Parsoid-only
5244 ###
5245 !! test
5246 Simple redirect to page
5247 !! options
5248 parsoid
5249 !! input
5250 #REDIRECT [[Main Page]]
5251 !! result
5252 <link rel="mw:PageProp/redirect" href="./Main_Page">
5253 !! end
5254
5255 !! test
5256 Optional colon in #REDIRECT
5257 !! options
5258 # the colon is archaic syntax. we support it for wt2html, but we
5259 # don't care that it roundtrips back to the modern syntax.
5260 parsoid=wt2html,html2html
5261 !! input
5262 #REDIRECT:[[Main Page]]
5263 !! result
5264 <link rel="mw:PageProp/redirect" href="./Main_Page">
5265 !! end
5266
5267 !! test
5268 Whitespace in #REDIRECT with optional colon
5269 !! options
5270 # the colon and gratuitous whitespace is archaic syntax. we support
5271 # it for wt2html, but we don't care that it roundtrips back to the
5272 # modern syntax (without extra whitespace)
5273 parsoid=wt2html,html2html
5274 !! input
5275
5276 #REDIRECT
5277 :
5278 [[Main Page]]
5279 !! result
5280 <link rel="mw:PageProp/redirect" href="./Main_Page">
5281 !! end
5282
5283 !! test
5284 Piped link in #REDIRECT
5285 !! options
5286 # content after piped link is ignored. we support this syntax,
5287 # but don't care that the piped link is lost when we roundtrip this.
5288 parsoid=wt2html
5289 !! input
5290 #REDIRECT [[Main Page|bar]]
5291 !! result
5292 <link rel="mw:PageProp/redirect" href="./Main_Page">
5293 !! end
5294
5295 !! test
5296 Redirect to category
5297 !! options
5298 parsoid=wt2html
5299 !! input
5300 #REDIRECT [[Category:Foo]]
5301 !! result
5302 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
5303 !! end
5304
5305 !! test
5306 Redirect to category with URL encoding
5307 !! options
5308 parsoid=wt2html
5309 !! input
5310 #REDIRECT [[Category%3AFoo]]
5311 !! result
5312 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
5313 !! end
5314
5315 !! test
5316 Redirect to category page
5317 !! options
5318 parsoid=wt2html,html2html
5319 !! input
5320 #REDIRECT [[:Category:Foo]]
5321 !! result
5322 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
5323 !! end
5324
5325 !! test
5326 Redirect to image page (1)
5327 !! options
5328 parsoid
5329 !! input
5330 #REDIRECT [[File:Wiki.png]]
5331 !! result
5332 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5333 !! end
5334
5335 !! test
5336 Redirect to image page (2)
5337 !! options
5338 parsoid
5339 !! input
5340 #REDIRECT [[Image:Wiki.png]]
5341 !! result
5342 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5343 !! end
5344
5345 !! test
5346 Redirect to language
5347 !! options
5348 parsoid
5349 !! input
5350 #REDIRECT [[en:File:Wiki.png]]
5351 !! result
5352 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5353 !! end
5354
5355 !! test
5356 Redirect to interwiki
5357 !! options
5358 parsoid
5359 !! input
5360 #REDIRECT [[meatball:File:Wiki.png]]
5361 !! result
5362 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5363 !! end
5364
5365 !! test
5366 Non-English #REDIRECT
5367 !! options
5368 parsoid
5369 language=is
5370 !! input
5371 #TILVÍSUN [[Main Page]]
5372 !! result
5373 <link rel="mw:PageProp/redirect" href="./Main_Page">
5374 !! end
5375
5376 ##
5377 ## XHTML tidiness
5378 ###
5379
5380 !! test
5381 <br> to <br />
5382 !! input
5383 1<br>2<br />3
5384 !! result
5385 <p>1<br />2<br />3
5386 </p>
5387 !! end
5388
5389 !! test
5390 Broken br tag sanitization
5391 !! options
5392 php
5393 !! input
5394 </br>
5395 !! result
5396 <p>&lt;/br&gt;
5397 </p>
5398 !! end
5399
5400 # TODO: Fix html2html mode (bug 51055)!
5401 !! test
5402 Parsoid: Broken br tag recognition
5403 !! options
5404 parsoid=wt2html
5405 !! input
5406 </br>
5407 !! result
5408 <p><br></p>
5409 !! end
5410
5411 !! test
5412 Incorrecly removing closing slashes from correctly formed XHTML
5413 !! input
5414 <br style="clear:both;" />
5415 !! result
5416 <p><br style="clear:both;" />
5417 </p>
5418 !! end
5419
5420 !! test
5421 Failing to transform badly formed HTML into correct XHTML
5422 !! input
5423 <br style="clear: left;">
5424 <br style="clear: right;">
5425 <br style="clear: both;">
5426 !! result
5427 <p><br style="clear: left;" />
5428 <br style="clear: right;" />
5429 <br style="clear: both;" />
5430 </p>
5431 !!end
5432
5433 !! test
5434 Handling html with a div self-closing tag
5435 !! input
5436 <div title />
5437 <div title/>
5438 <div title/ >
5439 <div title=bar />
5440 <div title=bar/>
5441 <div title=bar/ >
5442 !! result
5443 <p>&lt;div title /&gt;
5444 &lt;div title/&gt;
5445 </p>
5446 <div>
5447 <p>&lt;div title=bar /&gt;
5448 &lt;div title=bar/&gt;
5449 </p>
5450 <div title="bar/"></div>
5451 </div>
5452
5453 !! end
5454
5455 !! test
5456 Handling html with a br self-closing tag
5457 !! input
5458 <br title />
5459 <br title/>
5460 <br title/ >
5461 <br title=bar />
5462 <br title=bar/>
5463 <br title=bar/ >
5464 !! result
5465 <p><br title="title" />
5466 <br title="title" />
5467 <br />
5468 <br title="bar" />
5469 <br title="bar" />
5470 <br title="bar/" />
5471 </p>
5472 !! end
5473
5474 !! test
5475 Horizontal ruler (should it add that extra space?)
5476 !! input
5477 <hr>
5478 <hr >
5479 foo <hr
5480 > bar
5481 !! result
5482 <hr />
5483 <hr />
5484 foo <hr /> bar
5485
5486 !! end
5487
5488 !! test
5489 Horizontal ruler -- 4+ dashes render hr
5490 !! input
5491 ----
5492 !! result
5493 <hr />
5494
5495 !! end
5496
5497 !! test
5498 Horizontal ruler -- eats additional dashes on the same line
5499 !! input
5500 ---------
5501 !! result
5502 <hr />
5503
5504 !! end
5505
5506 !! test
5507 Horizontal ruler -- does not collapse dashes on consecutive lines
5508 !! input
5509 ----
5510 ----
5511 !! result
5512 <hr />
5513 <hr />
5514
5515 !! end
5516
5517 !! test
5518 Horizontal ruler -- <4 dashes render as plain text
5519 !! input
5520 ---
5521 !! result
5522 <p>---
5523 </p>
5524 !! end
5525
5526 !! test
5527 Horizontal ruler -- Supports content following dashes on same line
5528 !! input
5529 ---- Foo
5530 !! result
5531 <hr /> Foo
5532
5533 !! end
5534
5535 ###
5536 ### Block-level elements
5537 ###
5538 !! test
5539 Common list
5540 !! input
5541 *Common list
5542 * item 2
5543 *item 3
5544 !! result
5545 <ul><li>Common list
5546 </li><li> item 2
5547 </li><li>item 3
5548 </li></ul>
5549
5550 !! end
5551
5552 !! test
5553 Numbered list
5554 !! input
5555 #Numbered list
5556 #item 2
5557 # item 3
5558 !! result
5559 <ol><li>Numbered list
5560 </li><li>item 2
5561 </li><li> item 3
5562 </li></ol>
5563
5564 !! end
5565
5566 !! test
5567 Mixed list
5568 !! input
5569 *Mixed list
5570 *# with numbers
5571 ** and bullets
5572 *# and numbers
5573 *bullets again
5574 **bullet level 2
5575 ***bullet level 3
5576 ***#Number on level 4
5577 **bullet level 2
5578 **#Number on level 3
5579 **#Number on level 3
5580 *#number level 2
5581 *Level 1
5582 *** Level 3
5583 #** Level 3, but ordered
5584 !! result
5585 <ul><li>Mixed list
5586 <ol><li> with numbers
5587 </li></ol>
5588 <ul><li> and bullets
5589 </li></ul>
5590 <ol><li> and numbers
5591 </li></ol>
5592 </li><li>bullets again
5593 <ul><li>bullet level 2
5594 <ul><li>bullet level 3
5595 <ol><li>Number on level 4
5596 </li></ol>
5597 </li></ul>
5598 </li><li>bullet level 2
5599 <ol><li>Number on level 3
5600 </li><li>Number on level 3
5601 </li></ol>
5602 </li></ul>
5603 <ol><li>number level 2
5604 </li></ol>
5605 </li><li>Level 1
5606 <ul><li><ul><li> Level 3
5607 </li></ul>
5608 </li></ul>
5609 </li></ul>
5610 <ol><li><ul><li><ul><li> Level 3, but ordered
5611 </li></ul>
5612 </li></ul>
5613 </li></ol>
5614
5615 !! end
5616
5617 !! test
5618 Nested lists 1
5619 !! input
5620 *foo
5621 **bar
5622 !! result
5623 <ul><li>foo
5624 <ul><li>bar
5625 </li></ul>
5626 </li></ul>
5627
5628 !! end
5629
5630 !! test
5631 Nested lists 2
5632 !! input
5633 **foo
5634 *bar
5635 !! result
5636 <ul><li><ul><li>foo
5637 </li></ul>
5638 </li><li>bar
5639 </li></ul>
5640
5641 !! end
5642
5643 !! test
5644 Nested lists 3 (first element empty)
5645 !! input
5646 *
5647 **bar
5648 !! result
5649 <ul><li>
5650 <ul><li>bar
5651 </li></ul>
5652 </li></ul>
5653
5654 !! end
5655
5656 !! test
5657 Nested lists 4 (first element empty)
5658 !! input
5659 **
5660 *bar
5661 !! result
5662 <ul><li><ul><li>
5663 </li></ul>
5664 </li><li>bar
5665 </li></ul>
5666
5667 !! end
5668
5669 !! test
5670 Nested lists 5 (both elements empty)
5671 !! input
5672 **
5673 *
5674 !! result
5675 <ul><li><ul><li>
5676 </li></ul>
5677 </li><li>
5678 </li></ul>
5679
5680 !! end
5681
5682 !! test
5683 Nested lists 6 (both elements empty)
5684 !! input
5685 *
5686 **
5687 !! result
5688 <ul><li>
5689 <ul><li>
5690 </li></ul>
5691 </li></ul>
5692
5693 !! end
5694
5695 !! test
5696 Nested lists 7 (skip initial nesting levels)
5697 !! input
5698 *** foo
5699 !! result
5700 <ul><li><ul><li><ul><li> foo
5701 </li></ul>
5702 </li></ul>
5703 </li></ul>
5704
5705 !! end
5706
5707 !! test
5708 Nested lists 8 (multiple nesting transitions)
5709 !! input
5710 * foo
5711 *** bar
5712 ** baz
5713 * boo
5714 !! result
5715 <ul><li> foo
5716 <ul><li><ul><li> bar
5717 </li></ul>
5718 </li><li> baz
5719 </li></ul>
5720 </li><li> boo
5721 </li></ul>
5722
5723 !! end
5724
5725 !! test
5726 1. Lists with start-of-line-transparent tokens before bullets: Comments
5727 !! input
5728 *foo
5729 *<!--cmt-->bar
5730 <!--cmt-->*baz
5731 !! result
5732 <ul><li>foo
5733 </li><li>bar
5734 </li><li>baz
5735 </li></ul>
5736
5737 !! end
5738
5739 !! test
5740 2. Lists with start-of-line-transparent tokens before bullets: Template close
5741 !! input
5742 *foo {{echo|bar
5743 }}*baz
5744 !! result
5745 <ul><li>foo bar
5746 </li><li>baz
5747 </li></ul>
5748
5749 !! end
5750
5751 !! test
5752 List items are not parsed correctly following a <pre> block (bug 785)
5753 !! input
5754 * <pre>foo</pre>
5755 * <pre>bar</pre>
5756 * zar
5757 !! result
5758 <ul><li> <pre>foo</pre>
5759 </li><li> <pre>bar</pre>
5760 </li><li> zar
5761 </li></ul>
5762
5763 !! end
5764
5765 !! test
5766 List items from template
5767 !! input
5768
5769 {{inner list}}
5770 * item 2
5771
5772 * item 0
5773 {{inner list}}
5774 * item 2
5775
5776 * item 0
5777 * notSOL{{inner list}}
5778 * item 2
5779 !! result
5780 <ul><li> item 1
5781 </li><li> item 2
5782 </li></ul>
5783 <ul><li> item 0
5784 </li><li> item 1
5785 </li><li> item 2
5786 </li></ul>
5787 <ul><li> item 0
5788 </li><li> notSOL
5789 </li><li> item 1
5790 </li><li> item 2
5791 </li></ul>
5792
5793 !! end
5794
5795 !! test
5796 List interrupted by empty line or heading
5797 !! input
5798 * foo
5799
5800 ** bar
5801 == A heading ==
5802 * Another list item
5803 !! result
5804 <ul><li> foo
5805 </li></ul>
5806 <ul><li><ul><li> bar
5807 </li></ul>
5808 </li></ul>
5809 <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>
5810 <ul><li> Another list item
5811 </li></ul>
5812
5813 !!end
5814
5815 !!test
5816 Multiple list tags generated by templates
5817 !!input
5818 {{echo|<li>}}a
5819 {{echo|<li>}}b
5820 {{echo|<li>}}c
5821 !!result
5822 <li>a
5823 <li>b
5824 <li>c</li>
5825 </li>
5826 </li>
5827
5828 !!end
5829
5830 !!test
5831 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
5832 !!input
5833 *a
5834 <!--This line will NOT split the list-->
5835 *b
5836 <!--This line will NOT split the list either-->
5837 *c
5838 <!--foo--> <!----> <!--This line NOT split the list either-->
5839 *d
5840 !!result
5841 <ul><li>a
5842 </li><li>b
5843 </li><li>c
5844 </li><li>d
5845 </li></ul>
5846
5847 !!end
5848
5849 !!test
5850 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
5851 !!input
5852 *a
5853 <!--This line will NOT split the list-->
5854 *b
5855 <!--This line will NOT split the list either-->
5856 *c
5857 <!--foo--> <!----> <!--This line NOT split the list
5858 either-->
5859 *d
5860 !!result
5861 <ul><li>a
5862 </li><li>b
5863 </li><li>c
5864 </li><li>d
5865 </li></ul>
5866
5867 !!end
5868
5869 !!test
5870 Test the li-hack
5871 (Cannot test this with PHP parser since it relies on Tidy for the hack)
5872 !!options
5873 parsoid=wt2html,wt2wt
5874 !!input
5875 * foo
5876 * <li>li-hack
5877 * {{echo|<li>templated li-hack}}
5878 * <!--foo--> <li> unsupported li-hack with preceding comments
5879
5880 <ul>
5881 <li><li>not a li-hack
5882 </li>
5883 </ul>
5884 !!result
5885 <ul><li> foo</li>
5886 <li>li-hack</li>
5887 <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>
5888 <li> <!--foo--> </li><li> li-hack with preceding comments</li></ul>
5889
5890 <ul>
5891 <li></li><li>not a li-hack
5892 </li>
5893 </ul>
5894 !!end
5895
5896 !! test
5897 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
5898 !! options
5899 parsoid
5900 !! input
5901 # foo
5902 ## bar
5903 * foo
5904 ** bar
5905 : foo
5906 :: bar
5907 !! result
5908 <ol><li> foo<ol><li> bar</li></ol></li></ol><ul><li> foo<ul><li> bar</li></ul></li></ul><dl><dd> foo<dl><dd> bar</dd></dl></dd></dl>
5909 !! end
5910
5911 !! test
5912 Parsoid: Test of whitespace serialization with Templated bullets
5913 !! options
5914 parsoid
5915 !! input
5916 * {{bullet}}
5917 !! result
5918 <ul>
5919 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
5920 </ul>
5921 !! end
5922
5923 # ------------------------------------------------------------------------
5924 # The next set of tests are about Parsoid's ability to handle badly nested
5925 # tags (parse, minimize scope of fixup, and roundtrip back)
5926 # ------------------------------------------------------------------------
5927
5928 !! test
5929 Unbalanced closing block tags break a list
5930 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5931 !! options
5932 parsoid
5933 !! input
5934 <div>
5935 *a</div><div>
5936 *b</div>
5937 !! result
5938 <div>
5939 <ul><li>a
5940 </li></ul></div><div>
5941 <ul><li>b
5942 </li></ul></div>
5943 !! end
5944
5945 !! test
5946 Unbalanced closing non-block tags don't break a list
5947 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5948 !! options
5949 parsoid
5950 !! input
5951 <span>
5952 *a</span><span>
5953 *b</span>
5954 !! result
5955 <p><span></span>
5956 </p>
5957 <ul><li>a<span></span>
5958 </li><li>b
5959 </li></ul>
5960 !! end
5961
5962 !! test
5963 Unclosed formatting tags that straddle lists are closed and reopened
5964 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5965 !! options
5966 parsoid
5967 !! input
5968 # <s> a
5969 # b </s>
5970 !! result
5971 <ol><li> <s> a </s>
5972 </li><li> <s> b </s>
5973 </li></ol>
5974 !! end
5975
5976 !!test
5977 List embedded in a non-block tag
5978 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
5979 !! options
5980 parsoid
5981 !!input
5982 <small>
5983 * foo
5984 </small>
5985 !!result
5986 <p><small></small></p>
5987 <small>
5988 <ul>
5989 <li> foo</li>
5990 </ul>
5991 </small>
5992 <p><small></small></p>
5993 !!end
5994
5995 !! test
5996 Table with missing opening <tr> tag
5997 !! options
5998 parsoid=wt2html,wt2wt
5999 !! input
6000 <table>
6001 <td>foo</td>
6002 </tr>
6003 </table>
6004 !! result
6005 <table>
6006 <tr>
6007 <td>foo</td>
6008 </tr>
6009 </table>
6010 !! end
6011
6012 ###
6013 ### Magic Words
6014 ###
6015
6016 # Note that the current date is hard-coded as
6017 # 1970-01-01T00:02:03Z (a Thursday)
6018 # when running parser tests. The timezone is also fixed to GMT, so
6019 # local date will be identical to current date.
6020
6021 !! test
6022 Magic Word: {{CURRENTDAY}}
6023 !! input
6024 {{CURRENTDAY}}
6025 !! result
6026 <p>1
6027 </p>
6028 !! end
6029
6030 !! test
6031 Magic Word: {{CURRENTDAY2}}
6032 !! input
6033 {{CURRENTDAY2}}
6034 !! result
6035 <p>01
6036 </p>
6037 !! end
6038
6039 !! test
6040 Magic Word: {{CURRENTDAYNAME}}
6041 !! input
6042 {{CURRENTDAYNAME}}
6043 !! result
6044 <p>Thursday
6045 </p>
6046 !! end
6047
6048 !! test
6049 Magic Word: {{CURRENTDOW}}
6050 !! input
6051 {{CURRENTDOW}}
6052 !! result
6053 <p>4
6054 </p>
6055 !! end
6056
6057 !! test
6058 Magic Word: {{CURRENTMONTH}}
6059 !! input
6060 {{CURRENTMONTH}}
6061 !! result
6062 <p>01
6063 </p>
6064 !! end
6065
6066 !! test
6067 Magic Word: {{CURRENTMONTH1}}
6068 !! input
6069 {{CURRENTMONTH1}}
6070 !! result
6071 <p>1
6072 </p>
6073 !! end
6074
6075 !! test
6076 Magic Word: {{CURRENTMONTHABBREV}}
6077 !! input
6078 {{CURRENTMONTHABBREV}}
6079 !! result
6080 <p>Jan
6081 </p>
6082 !! end
6083
6084 !! test
6085 Magic Word: {{CURRENTMONTHNAME}}
6086 !! input
6087 {{CURRENTMONTHNAME}}
6088 !! result
6089 <p>January
6090 </p>
6091 !! end
6092
6093 !! test
6094 Magic Word: {{CURRENTMONTHNAMEGEN}}
6095 !! input
6096 {{CURRENTMONTHNAMEGEN}}
6097 !! result
6098 <p>January
6099 </p>
6100 !! end
6101
6102 !! test
6103 Magic Word: {{CURRENTTIME}}
6104 !! input
6105 {{CURRENTTIME}}
6106 !! result
6107 <p>00:02
6108 </p>
6109 !! end
6110
6111 !! test
6112 Magic Word: {{CURRENTHOUR}}
6113 !! input
6114 {{CURRENTHOUR}}
6115 !! result
6116 <p>00
6117 </p>
6118 !! end
6119
6120 !! test
6121 Magic Word: {{CURRENTWEEK}} (@bug 4594)
6122 !! input
6123 {{CURRENTWEEK}}
6124 !! result
6125 <p>1
6126 </p>
6127 !! end
6128
6129 !! test
6130 Magic Word: {{CURRENTYEAR}}
6131 !! input
6132 {{CURRENTYEAR}}
6133 !! result
6134 <p>1970
6135 </p>
6136 !! end
6137
6138 !! test
6139 Magic Word: {{CURRENTTIMESTAMP}}
6140 !! input
6141 {{CURRENTTIMESTAMP}}
6142 !! result
6143 <p>19700101000203
6144 </p>
6145 !! end
6146
6147 !! test
6148 Magic Words LOCAL (UTC)
6149 !! input
6150 * {{LOCALMONTH}}
6151 * {{LOCALMONTH1}}
6152 * {{LOCALMONTHNAME}}
6153 * {{LOCALMONTHNAMEGEN}}
6154 * {{LOCALMONTHABBREV}}
6155 * {{LOCALDAY}}
6156 * {{LOCALDAY2}}
6157 * {{LOCALDAYNAME}}
6158 * {{LOCALYEAR}}
6159 * {{LOCALTIME}}
6160 * {{LOCALHOUR}}
6161 * {{LOCALWEEK}}
6162 * {{LOCALDOW}}
6163 * {{LOCALTIMESTAMP}}
6164 !! result
6165 <ul><li> 01
6166 </li><li> 1
6167 </li><li> January
6168 </li><li> January
6169 </li><li> Jan
6170 </li><li> 1
6171 </li><li> 01
6172 </li><li> Thursday
6173 </li><li> 1970
6174 </li><li> 00:02
6175 </li><li> 00
6176 </li><li> 1
6177 </li><li> 4
6178 </li><li> 19700101000203
6179 </li></ul>
6180
6181 !! end
6182
6183 !! test
6184 Magic Word: {{FULLPAGENAME}}
6185 !! options
6186 title=[[User:Ævar Arnfjörð Bjarmason]]
6187 !! input
6188 {{FULLPAGENAME}}
6189 !! result
6190 <p>User:Ævar Arnfjörð Bjarmason
6191 </p>
6192 !! end
6193
6194 !! test
6195 Magic Word: {{FULLPAGENAMEE}}
6196 !! options
6197 title=[[User:Ævar Arnfjörð Bjarmason]]
6198 !! input
6199 {{FULLPAGENAMEE}}
6200 !! result
6201 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6202 </p>
6203 !! end
6204
6205 !! test
6206 Magic Word: {{TALKSPACE}}
6207 !! options
6208 title=[[User:Ævar Arnfjörð Bjarmason]]
6209 !! input
6210 {{TALKSPACE}}
6211 !! result
6212 <p>User talk
6213 </p>
6214 !! end
6215
6216 !! test
6217 Magic Word: {{TALKSPACE}}, same namespace
6218 !! options
6219 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6220 !! input
6221 {{TALKSPACE}}
6222 !! result
6223 <p>User talk
6224 </p>
6225 !! end
6226
6227 !! test
6228 Magic Word: {{TALKSPACE}}, main namespace
6229 !! options
6230 title=[[Parser Test]]
6231 !! input
6232 {{TALKSPACE}}
6233 !! result
6234 <p>Talk
6235 </p>
6236 !! end
6237
6238 !! test
6239 Magic Word: {{TALKSPACEE}}
6240 !! options
6241 title=[[User:Ævar Arnfjörð Bjarmason]]
6242 !! input
6243 {{TALKSPACEE}}
6244 !! result
6245 <p>User_talk
6246 </p>
6247 !! end
6248
6249 !! test
6250 Magic Word: {{SUBJECTSPACE}}
6251 !! options
6252 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6253 !! input
6254 {{SUBJECTSPACE}}
6255 !! result
6256 <p>User
6257 </p>
6258 !! end
6259
6260 !! test
6261 Magic Word: {{SUBJECTSPACE}}, same namespace
6262 !! options
6263 title=[[User:Ævar Arnfjörð Bjarmason]]
6264 !! input
6265 {{SUBJECTSPACE}}
6266 !! result
6267 <p>User
6268 </p>
6269 !! end
6270
6271 !! test
6272 Magic Word: {{SUBJECTSPACE}}, main namespace
6273 !! options
6274 title=[[Parser Test]]
6275 !! input
6276 {{SUBJECTSPACE}}
6277 !! result
6278
6279 !! end
6280
6281 !! test
6282 Magic Word: {{SUBJECTSPACEE}}
6283 !! options
6284 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6285 !! input
6286 {{SUBJECTSPACEE}}
6287 !! result
6288 <p>User
6289 </p>
6290 !! end
6291
6292 !! test
6293 Magic Word: {{NAMESPACE}}
6294 !! options
6295 title=[[User:Ævar Arnfjörð Bjarmason]]
6296 !! input
6297 {{NAMESPACE}}
6298 !! result
6299 <p>User
6300 </p>
6301 !! end
6302
6303 !! test
6304 Magic Word: {{NAMESPACEE}}
6305 !! options
6306 title=[[User:Ævar Arnfjörð Bjarmason]]
6307 !! input
6308 {{NAMESPACEE}}
6309 !! result
6310 <p>User
6311 </p>
6312 !! end
6313
6314 !! test
6315 Magic Word: {{NAMESPACENUMBER}}
6316 !! options
6317 title=[[User:Ævar Arnfjörð Bjarmason]]
6318 !! input
6319 {{NAMESPACENUMBER}}
6320 !! result
6321 <p>2
6322 </p>
6323 !! end
6324
6325 !! test
6326 Magic Word: {{SUBPAGENAME}}
6327 !! options
6328 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
6329 !! input
6330 {{SUBPAGENAME}}
6331 !! result
6332 <p>sub ö
6333 </p>
6334 !! end
6335
6336 !! test
6337 Magic Word: {{SUBPAGENAMEE}}
6338 !! options
6339 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
6340 !! input
6341 {{SUBPAGENAMEE}}
6342 !! result
6343 <p>sub_%C3%B6
6344 </p>
6345 !! end
6346
6347 !! test
6348 Magic Word: {{ROOTPAGENAME}}
6349 !! options
6350 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
6351 !! input
6352 {{ROOTPAGENAME}}
6353 !! result
6354 <p>Ævar Arnfjörð Bjarmason
6355 </p>
6356 !! end
6357
6358 !! test
6359 Magic Word: {{ROOTPAGENAMEE}}
6360 !! options
6361 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
6362 !! input
6363 {{ROOTPAGENAMEE}}
6364 !! result
6365 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6366 </p>
6367 !! end
6368
6369 !! test
6370 Magic Word: {{BASEPAGENAME}}
6371 !! options
6372 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
6373 !! input
6374 {{BASEPAGENAME}}
6375 !! result
6376 <p>Ævar Arnfjörð Bjarmason
6377 </p>
6378 !! end
6379
6380 !! test
6381 Magic Word: {{BASEPAGENAMEE}}
6382 !! options
6383 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
6384 !! input
6385 {{BASEPAGENAMEE}}
6386 !! result
6387 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6388 </p>
6389 !! end
6390
6391 !! test
6392 Magic Word: {{TALKPAGENAME}}
6393 !! options
6394 title=[[User:Ævar Arnfjörð Bjarmason]]
6395 !! input
6396 {{TALKPAGENAME}}
6397 !! result
6398 <p>User talk:Ævar Arnfjörð Bjarmason
6399 </p>
6400 !! end
6401
6402 !! test
6403 Magic Word: {{TALKPAGENAMEE}}
6404 !! options
6405 title=[[User:Ævar Arnfjörð Bjarmason]]
6406 !! input
6407 {{TALKPAGENAMEE}}
6408 !! result
6409 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6410 </p>
6411 !! end
6412
6413 !! test
6414 Magic Word: {{SUBJECTPAGENAME}}
6415 !! options
6416 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6417 !! input
6418 {{SUBJECTPAGENAME}}
6419 !! result
6420 <p>User:Ævar Arnfjörð Bjarmason
6421 </p>
6422 !! end
6423
6424 !! test
6425 Magic Word: {{SUBJECTPAGENAMEE}}
6426 !! options
6427 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6428 !! input
6429 {{SUBJECTPAGENAMEE}}
6430 !! result
6431 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6432 </p>
6433 !! end
6434
6435 !! test
6436 Magic Word: {{NUMBEROFFILES}}
6437 !! input
6438 {{NUMBEROFFILES}}
6439 !! result
6440 <p>4
6441 </p>
6442 !! end
6443
6444 !! test
6445 Magic Word: {{PAGENAME}}
6446 !! options
6447 title=[[User:Ævar Arnfjörð Bjarmason]]
6448 !! input
6449 {{PAGENAME}}
6450 !! result
6451 <p>Ævar Arnfjörð Bjarmason
6452 </p>
6453 !! end
6454
6455 !! test
6456 Magic Word: {{PAGENAME}} with metacharacters
6457 !! options
6458 title=[['foo & bar = baz']]
6459 !! input
6460 ''{{PAGENAME}}''
6461 !! result
6462 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
6463 </p>
6464 !! end
6465
6466 !! test
6467 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
6468 !! options
6469 title=[[*RFC 1234 http://example.com/]]
6470 !! input
6471 {{PAGENAME}}
6472 !! result
6473 <p>&#42;RFC&#32;1234 http&#58;//example.com/
6474 </p>
6475 !! end
6476
6477 !! test
6478 Magic Word: {{PAGENAMEE}}
6479 !! options
6480 title=[[User:Ævar Arnfjörð Bjarmason]]
6481 !! input
6482 {{PAGENAMEE}}
6483 !! result
6484 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6485 </p>
6486 !! end
6487
6488 !! test
6489 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
6490 !! options
6491 title=[[*RFC 1234 http://example.com/]]
6492 !! input
6493 {{PAGENAMEE}}
6494 !! result
6495 <p>&#42;RFC_1234_http&#58;//example.com/
6496 </p>
6497 !! end
6498
6499 !! test
6500 Magic Word: {{REVISIONID}}
6501 !! input
6502 {{REVISIONID}}
6503 !! result
6504 <p>1337
6505 </p>
6506 !! end
6507
6508 !! test
6509 Magic Word: {{SCRIPTPATH}}
6510 !! input
6511 {{SCRIPTPATH}}
6512 !! result
6513 <p>/
6514 </p>
6515 !! end
6516
6517 !! test
6518 Magic Word: {{STYLEPATH}}
6519 !! input
6520 {{STYLEPATH}}
6521 !! result
6522 <p>/skins
6523 </p>
6524 !! end
6525
6526 !! test
6527 Magic Word: {{SERVER}}
6528 !! input
6529 {{SERVER}}
6530 !! result
6531 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
6532 </p>
6533 !! end
6534
6535 !! test
6536 Magic Word: {{SERVERNAME}}
6537 !! input
6538 {{SERVERNAME}}
6539 !! result
6540 <p>example.org
6541 </p>
6542 !! end
6543
6544 !! test
6545 Magic Word: {{SITENAME}}
6546 !! input
6547 {{SITENAME}}
6548 !! result
6549 <p>MediaWiki
6550 </p>
6551 !! end
6552
6553 !! test
6554 Case-sensitive magic words, when cased differently, should just be template transclusions
6555 !! input
6556 {{CurrentMonth}}
6557 {{currentday}}
6558 {{cURreNTweEK}}
6559 {{currentHour}}
6560 !! result
6561 <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>
6562 <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>
6563 <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>
6564 <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>
6565 </p>
6566 !! end
6567
6568 !! test
6569 Case-insensitive magic words should still work with weird casing.
6570 !! input
6571 {{sErVeRNaMe}}
6572 {{LCFirst:AOEU}}
6573 {{ucFIRST:aoeu}}
6574 {{SERver}}
6575 !! result
6576 <p>example.org
6577 aOEU
6578 Aoeu
6579 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
6580 </p>
6581 !! end
6582
6583 !! test
6584 Namespace 1 {{ns:1}}
6585 !! input
6586 {{ns:1}}
6587 !! result
6588 <p>Talk
6589 </p>
6590 !! end
6591
6592 !! test
6593 Namespace 1 {{ns:01}}
6594 !! input
6595 {{ns:01}}
6596 !! result
6597 <p>Talk
6598 </p>
6599 !! end
6600
6601 !! test
6602 Namespace 0 {{ns:0}} (bug 4783)
6603 !! input
6604 {{ns:0}}
6605 !! result
6606
6607 !! end
6608
6609 !! test
6610 Namespace 0 {{ns:00}} (bug 4783)
6611 !! input
6612 {{ns:00}}
6613 !! result
6614
6615 !! end
6616
6617 !! test
6618 Namespace -1 {{ns:-1}}
6619 !! input
6620 {{ns:-1}}
6621 !! result
6622 <p>Special
6623 </p>
6624 !! end
6625
6626 !! test
6627 Namespace User {{ns:User}}
6628 !! input
6629 {{ns:User}}
6630 !! result
6631 <p>User
6632 </p>
6633 !! end
6634
6635 !! test
6636 Namespace User talk {{ns:User_talk}}
6637 !! input
6638 {{ns:User_talk}}
6639 !! result
6640 <p>User talk
6641 </p>
6642 !! end
6643
6644 !! test
6645 Namespace User talk {{ns:uSeR tAlK}}
6646 !! input
6647 {{ns:uSeR tAlK}}
6648 !! result
6649 <p>User talk
6650 </p>
6651 !! end
6652
6653 !! test
6654 Namespace File {{ns:File}}
6655 !! input
6656 {{ns:File}}
6657 !! result
6658 <p>File
6659 </p>
6660 !! end
6661
6662 !! test
6663 Namespace File {{ns:Image}}
6664 !! input
6665 {{ns:Image}}
6666 !! result
6667 <p>File
6668 </p>
6669 !! end
6670
6671 !! test
6672 Namespace (lang=de) Benutzer {{ns:User}}
6673 !! options
6674 language=de
6675 !! input
6676 {{ns:User}}
6677 !! result
6678 <p>Benutzer
6679 </p>
6680 !! end
6681
6682 !! test
6683 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
6684 !! options
6685 language=de
6686 !! input
6687 {{ns:3}}
6688 !! result
6689 <p>Benutzer Diskussion
6690 </p>
6691 !! end
6692
6693
6694 !! test
6695 Urlencode
6696 !! input
6697 {{urlencode:hi world?!}}
6698 {{urlencode:hi world?!|WIKI}}
6699 {{urlencode:hi world?!|PATH}}
6700 {{urlencode:hi world?!|QUERY}}
6701 !! result
6702 <p>hi+world%3F%21
6703 hi_world%3F!
6704 hi%20world%3F%21
6705 hi+world%3F%21
6706 </p>
6707 !! end
6708
6709 ###
6710 ### Magic links
6711 ###
6712 !! test
6713 Magic links: internal link to RFC (bug 479)
6714 !! input
6715 [[RFC 123]]
6716 !! result
6717 <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>
6718 </p>
6719 !! end
6720
6721 !! test
6722 Magic links: RFC (bug 479)
6723 !! input
6724 RFC 822
6725 !! result
6726 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
6727 </p>
6728 !! end
6729
6730 !! test
6731 Magic links: ISBN (bug 1937)
6732 !! input
6733 ISBN 0-306-40615-2
6734 !! result
6735 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
6736 </p>
6737 !! end
6738
6739 !! test
6740 Magic links: PMID incorrectly converts space to underscore
6741 !! input
6742 PMID 1234
6743 !! result
6744 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
6745 </p>
6746 !! end
6747
6748 ###
6749 ### Templates
6750 ####
6751
6752 !! test
6753 Nonexistent template
6754 !! input
6755 {{thistemplatedoesnotexist}}
6756 !! result
6757 <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>
6758 </p>
6759 !! end
6760
6761 !! test
6762 Template with invalid target containing tags
6763 !! input
6764 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
6765 !! result
6766 <p>{{a<b>b</b>|foo|a=b|a = b}}
6767 </p>
6768 !! end
6769
6770 !! test
6771 Template with invalid target containing unclosed tag
6772 !! input
6773 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
6774 !! result
6775 <p>{{a<b>|foo|a=b|a = b}}</b>
6776 </p>
6777 !! end
6778
6779 !! article
6780 Template:test
6781 !! text
6782 This is a test template
6783 !! endarticle
6784
6785 !! test
6786 Simple template
6787 !! input
6788 {{test}}
6789 !! result
6790 <p>This is a test template
6791 </p>
6792 !! end
6793
6794 !! test
6795 Template with explicit namespace
6796 !! input
6797 {{Template:test}}
6798 !! result
6799 <p>This is a test template
6800 </p>
6801 !! end
6802
6803
6804 !! article
6805 Template:paramtest
6806 !! text
6807 This is a test template with parameter {{{param}}}
6808 !! endarticle
6809
6810 !! test
6811 Template parameter
6812 !! input
6813 {{paramtest|param=foo}}
6814 !! result
6815 <p>This is a test template with parameter foo
6816 </p>
6817 !! end
6818
6819 !! article
6820 Template:paramtestnum
6821 !! text
6822 [[{{{1}}}|{{{2}}}]]
6823 !! endarticle
6824
6825 !! test
6826 Template unnamed parameter
6827 !! input
6828 {{paramtestnum|Main Page|the main page}}
6829 !! result
6830 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
6831 </p>
6832 !! end
6833
6834 !! article
6835 Template:templatesimple
6836 !! text
6837 (test)
6838 !! endarticle
6839
6840 !! article
6841 Template:templateredirect
6842 !! text
6843 #redirect [[Template:templatesimple]]
6844 !! endarticle
6845
6846 !! article
6847 Template:templateasargtestnum
6848 !! text
6849 {{{{{1}}}}}
6850 !! endarticle
6851
6852 !! article
6853 Template:templateasargtest
6854 !! text
6855 {{template{{{templ}}}}}
6856 !! endarticle
6857
6858 !! article
6859 Template:templateasargtest2
6860 !! text
6861 {{{{{templ}}}}}
6862 !! endarticle
6863
6864 !! test
6865 Template with template name as unnamed argument
6866 !! input
6867 {{templateasargtestnum|templatesimple}}
6868 !! result
6869 <p>(test)
6870 </p>
6871 !! end
6872
6873 !! test
6874 Template with template name as argument
6875 !! input
6876 {{templateasargtest|templ=simple}}
6877 !! result
6878 <p>(test)
6879 </p>
6880 !! end
6881
6882 !! test
6883 Template with template name as argument (2)
6884 !! input
6885 {{templateasargtest2|templ=templatesimple}}
6886 !! result
6887 <p>(test)
6888 </p>
6889 !! end
6890
6891 !! article
6892 Template:templateasargtestdefault
6893 !! text
6894 {{{{{templ|templatesimple}}}}}
6895 !! endarticle
6896
6897 !! article
6898 Template:templa
6899 !! text
6900 '''templ'''
6901 !! endarticle
6902
6903 !! test
6904 Template with default value
6905 !! input
6906 {{templateasargtestdefault}}
6907 !! result
6908 <p>(test)
6909 </p>
6910 !! end
6911
6912 !! test
6913 Template with default value (value set)
6914 !! input
6915 {{templateasargtestdefault|templ=templa}}
6916 !! result
6917 <p><b>templ</b>
6918 </p>
6919 !! end
6920
6921 !! test
6922 Template redirect
6923 !! input
6924 {{templateredirect}}
6925 !! result
6926 <p>(test)
6927 </p>
6928 !! end
6929
6930 !! test
6931 Template with argument in separate line
6932 !! input
6933 {{ templateasargtest |
6934 templ = simple }}
6935 !! result
6936 <p>(test)
6937 </p>
6938 !! end
6939
6940 !! test
6941 Template with complex template as argument
6942 !! input
6943 {{paramtest|
6944 param ={{ templateasargtest |
6945 templ = simple }}}}
6946 !! result
6947 <p>This is a test template with parameter (test)
6948 </p>
6949 !! end
6950
6951 !! test
6952 Template with thumb image (with link in description)
6953 !! input
6954 {{paramtest|
6955 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
6956 !! result
6957 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>
6958
6959 !! end
6960
6961 !! article
6962 Template:complextemplate
6963 !! text
6964 {{{1}}} {{paramtest|
6965 param ={{{param}}}}}
6966 !! endarticle
6967
6968 !! test
6969 Template with complex arguments
6970 !! input
6971 {{complextemplate|
6972 param ={{ templateasargtest |
6973 templ = simple }}|[[Template:complextemplate|link]]}}
6974 !! result
6975 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
6976 </p>
6977 !! end
6978
6979 !! test
6980 BUG 553: link with two variables in a piped link
6981 !! input
6982 {|
6983 |[[{{{1}}}|{{{2}}}]]
6984 |}
6985 !! result
6986 <table>
6987 <tr>
6988 <td>[[{{{1}}}|{{{2}}}]]
6989 </td></tr></table>
6990
6991 !! end
6992
6993 !! test
6994 Magic variable as template parameter
6995 !! input
6996 {{paramtest|param={{SITENAME}}}}
6997 !! result
6998 <p>This is a test template with parameter MediaWiki
6999 </p>
7000 !! end
7001
7002 !! article
7003 Template:linktest
7004 !! text
7005 [[{{{param}}}|link]]
7006 !! endarticle
7007
7008 !! test
7009 Template parameter as link source
7010 !! input
7011 {{linktest|param=Main Page}}
7012 !! result
7013 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
7014 </p>
7015 !! end
7016
7017 !!test
7018 Template-generated attribute string (k='v')
7019 !!input
7020 <span {{attr_str|id|v1}}>bar</span>
7021 !!result
7022 <p><span id="v1">bar</span>
7023 </p>
7024 !!end
7025
7026 !!article
7027 Template:paramtest2
7028 !! text
7029 including another template, {{paramtest|param={{{arg}}}}}
7030 !! endarticle
7031
7032 !! test
7033 Template passing argument to another template
7034 !! input
7035 {{paramtest2|arg='hmm'}}
7036 !! result
7037 <p>including another template, This is a test template with parameter 'hmm'
7038 </p>
7039 !! end
7040
7041 !! article
7042 Template:Linktest2
7043 !! text
7044 Main Page
7045 !! endarticle
7046
7047 !! test
7048 Template as link source
7049 !! input
7050 [[{{linktest2}}]]
7051
7052 [[{{linktest2}}|Main Page]]
7053
7054 [[{{linktest2}}]]Page
7055 !! result
7056 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7057 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7058 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
7059 </p>
7060 !! end
7061
7062
7063 !! article
7064 Template:loop1
7065 !! text
7066 {{loop2}}
7067 !! endarticle
7068
7069 !! article
7070 Template:loop2
7071 !! text
7072 {{loop1}}
7073 !! endarticle
7074
7075 !! test
7076 Template infinite loop
7077 !! input
7078 {{loop1}}
7079 !! result
7080 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
7081 </p>
7082 !! end
7083
7084 !! test
7085 Template from main namespace
7086 !! input
7087 {{:Main Page}}
7088 !! result
7089 <p>blah blah
7090 </p>
7091 !! end
7092
7093 !! article
7094 Template:table
7095 !! text
7096 {|
7097 | 1 || 2
7098 |-
7099 | 3 || 4
7100 |}
7101 !! endarticle
7102
7103 !! test
7104 BUG 529: Template with table, not included at beginning of line
7105 !! input
7106 foo {{table}}
7107 !! result
7108 <p>foo
7109 </p>
7110 <table>
7111 <tr>
7112 <td> 1 </td>
7113 <td> 2
7114 </td></tr>
7115 <tr>
7116 <td> 3 </td>
7117 <td> 4
7118 </td></tr></table>
7119
7120 !! end
7121
7122 !! test
7123 BUG 523: Template shouldn't eat newline (or add an extra one before table)
7124 !! input
7125 foo
7126 {{table}}
7127 !! result
7128 <p>foo
7129 </p>
7130 <table>
7131 <tr>
7132 <td> 1 </td>
7133 <td> 2
7134 </td></tr>
7135 <tr>
7136 <td> 3 </td>
7137 <td> 4
7138 </td></tr></table>
7139
7140 !! end
7141
7142 !! test
7143 BUG 41: Template parameters shown as broken links
7144 !! input
7145 {{{parameter}}}
7146 !! result
7147 <p>{{{parameter}}}
7148 </p>
7149 !! end
7150
7151 !! test
7152 Template with targets containing wikilinks
7153 !! input
7154 {{[[foo]]}}
7155
7156 {{[[{{echo|foo}}]]}}
7157
7158 {{{{echo|[[foo}}]]}}
7159 !! result
7160 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
7161 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
7162 </p><p>{{[[foo}}]]
7163 </p>
7164 !! end
7165
7166 !! article
7167 Template:MSGNW test
7168 !! text
7169 ''None'' of '''this''' should be
7170 * interpreted
7171 but rather passed unmodified
7172 {{test}}
7173 !! endarticle
7174
7175 # hmm, fix this or just deprecate msgnw and document its behavior?
7176 !! test
7177 msgnw keyword
7178 !! options
7179 disabled
7180 !! input
7181 {{msgnw:MSGNW test}}
7182 !! result
7183 <p>''None'' of '''this''' should be
7184 * interpreted
7185 but rather passed unmodified
7186 {{test}}
7187 </p>
7188 !! end
7189
7190 !! test
7191 int keyword
7192 !! input
7193 {{int:youhavenewmessages|lots of money|not!}}
7194 !! result
7195 <p>You have lots of money (not!).
7196 </p>
7197 !! end
7198
7199 !! article
7200 Template:Includes
7201 !! text
7202 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
7203 !! endarticle
7204
7205 !! test
7206 <includeonly> and <noinclude> being included
7207 !! input
7208 {{Includes}}
7209 !! result
7210 <p>Foobar
7211 </p>
7212 !! end
7213
7214 !! article
7215 Template:Includes2
7216 !! text
7217 <onlyinclude>Foo</onlyinclude>bar
7218 !! endarticle
7219
7220 !! test
7221 <onlyinclude> being included
7222 !! input
7223 {{Includes2}}
7224 !! result
7225 <p>Foo
7226 </p>
7227 !! end
7228
7229
7230 !! article
7231 Template:Includes3
7232 !! text
7233 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
7234 !! endarticle
7235
7236 !! test
7237 <onlyinclude> and <includeonly> being included
7238 !! input
7239 {{Includes3}}
7240 !! result
7241 <p>Foo
7242 </p>
7243 !! end
7244
7245 !! test
7246 <includeonly> and <noinclude> on a page
7247 !! input
7248 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
7249 !! result
7250 <p>Foozar
7251 </p>
7252 !! end
7253
7254 !! test
7255 Un-closed <noinclude>
7256 !! input
7257 <noinclude>
7258 !! result
7259 !! end
7260
7261 !! test
7262 <onlyinclude> on a page
7263 !! input
7264 <onlyinclude>Foo</onlyinclude>bar
7265 !! result
7266 <p>Foobar
7267 </p>
7268 !! end
7269
7270 !! test
7271 Un-closed <onlyinclude>
7272 !! input
7273 <onlyinclude>
7274 !! result
7275 !! end
7276
7277 !!test
7278 Self-closed noinclude, includeonly, onlyinclude tags
7279 !!input
7280 <noinclude />
7281 <includeonly />
7282 <onlyinclude />
7283 !!result
7284 <p><br />
7285 </p>
7286 !!end
7287
7288 !!test
7289 Unbalanced includeonly and noinclude tags
7290 !!input
7291 {|
7292 |a</noinclude>
7293 |b</noinclude></noinclude>
7294 |c</noinclude></includeonly>
7295 |d</includeonly></includeonly>
7296 |}
7297 !!result
7298 <table>
7299 <tr>
7300 <td>a
7301 </td>
7302 <td>b
7303 </td>
7304 <td>c&lt;/includeonly&gt;
7305 </td>
7306 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
7307 </td></tr></table>
7308
7309 !!end
7310
7311 !! article
7312 Template:Includeonly section
7313 !! text
7314 <includeonly>
7315 ==Includeonly section==
7316 </includeonly>
7317 ==Section T-1==
7318 !!endarticle
7319
7320 !! test
7321 Bug 6563: Edit link generation for section shown by <includeonly>
7322 !! input
7323 {{includeonly section}}
7324 !! result
7325 <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>
7326 <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>
7327
7328 !! end
7329
7330 # Uses same input as the contents of [[Template:Includeonly section]]
7331 !! test
7332 Bug 6563: Section extraction for section shown by <includeonly>
7333 !! options
7334 section=T-2
7335 !! input
7336 <includeonly>
7337 ==Includeonly section==
7338 </includeonly>
7339 ==Section T-2==
7340 !! result
7341 ==Section T-2==
7342 !! end
7343
7344 !! test
7345 Bug 6563: Edit link generation for section suppressed by <includeonly>
7346 !! input
7347 <includeonly>
7348 ==Includeonly section==
7349 </includeonly>
7350 ==Section 1==
7351 !! result
7352 <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>
7353
7354 !! end
7355
7356 !! test
7357 Bug 6563: Section extraction for section suppressed by <includeonly>
7358 !! options
7359 section=1
7360 !! input
7361 <includeonly>
7362 ==Includeonly section==
7363 </includeonly>
7364 ==Section 1==
7365 !! result
7366 ==Section 1==
7367 !! end
7368
7369 !! test
7370 Un-closed <includeonly>
7371 !! input
7372 <includeonly>
7373 !! result
7374 !! end
7375
7376 # TODO: test with DOM fragment reuse!
7377 !! test
7378 Parsoid: DOM fragment reuse
7379 !! options
7380 parsoid=wt2wt,wt2html
7381 !! input
7382 a{{echo|b<table></table>c}}d
7383
7384 a{{echo|b
7385 <table></table>
7386 c}}d
7387
7388 {{echo|a
7389
7390 <table></table>
7391
7392 b}}
7393 !! result
7394 a<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b
7395 <table></table>c"}},"i":0}}]}'>b</span>
7396 <table about="#mwt1"></table><span about="#mwt1">c</span>d
7397
7398
7399 <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">
7400 </span>
7401 <table about="#mwt2"></table><span about="#mwt2">
7402 </span>
7403 <p about="#mwt2">cd</p>
7404
7405
7406 <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">
7407
7408 </span>
7409 <table about="#mwt3"></table><span about="#mwt3">
7410
7411 </span>
7412 <p about="#mwt3">b</p>
7413 !! end
7414
7415 !! test
7416 Parsoid: Merge double tds (bug 50603)
7417 !! options
7418 parsoid
7419 !! input
7420 {|
7421 |{{echo|{{!}} foo}}
7422 |}
7423 !! result
7424 <table><tbody>
7425 <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>
7426 </tbody></table>
7427 !! end
7428
7429 !! test
7430 Parsoid: Merge double tds in nested transclusion content (bug 50603)
7431 !! options
7432 parsoid
7433 !! input
7434 {{echo|<div>}}
7435 {|
7436 |{{echo|{{!}} foo}}
7437 |}
7438 {{echo|</div>}}
7439 !! result
7440 <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}}]}'>
7441 <table><tbody>
7442 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
7443 </tbody></table>
7444 </div>
7445 !! end
7446
7447 ###
7448 ### <includeonly> and <noinclude> in attributes
7449 ###
7450 !!test
7451 0. includeonly around the entire attribute
7452 !!input
7453 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
7454 !!result
7455 <p><span id="v2">bar</span>
7456 </p>
7457 !!end
7458
7459 !!test
7460 1. includeonly in html attr key
7461 !!input
7462 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
7463 !!result
7464 <p><span id="foo">bar</span>
7465 </p>
7466 !!end
7467
7468 !!test
7469 2. includeonly in html attr value
7470 !!input
7471 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
7472 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
7473 !!result
7474 <p><span id="v1">bar</span>
7475 <span id="v1">bar</span>
7476 </p>
7477 !!end
7478
7479 !!test
7480 3. includeonly in part of an attr value
7481 !!input
7482 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
7483 !!result
7484 <p><span style="color:red;">bar</span>
7485 </p>
7486 !!end
7487
7488 ###
7489 ### Testing parsing of templates where a template arg
7490 ### has the same name as the template itself.
7491 ###
7492
7493 !! article
7494 Template:quote
7495 !! text
7496 {{{quote|{{{1}}}}}}
7497 !! endarticle
7498
7499 !!test
7500 Templates: Template Name/Arg clash: 1. Use of positional param
7501 !!input
7502 {{quote|foo}}
7503 !!result
7504 <p>foo
7505 </p>
7506 !!end
7507
7508 !!test
7509 Templates: Template Name/Arg clash: 2. Use of named param
7510 !!input
7511 {{quote|quote=foo}}
7512 !!result
7513 <p>foo
7514 </p>
7515 !!end
7516
7517 !!test
7518 Templates: Template Name/Arg clash: 3. Use of named param with empty input
7519 !!input
7520 {{quote|quote}}
7521 !!result
7522 <p>quote
7523 </p>
7524 !!end
7525
7526 ###
7527 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
7528 ###
7529
7530 !!test
7531 Templates: 1. Simple use
7532 !!input
7533 {{echo|Foo}}
7534 !!result
7535 <p>Foo
7536 </p>
7537 !!end
7538
7539 !!test
7540 Templates: 2. Inside a block tag
7541 !!input
7542 <div>{{echo|Foo}}</div>
7543 <blockquote>{{echo|Foo}}</blockquote>
7544 !!result
7545 <div>Foo</div>
7546 <blockquote>Foo</blockquote>
7547
7548 !!end
7549
7550 !!test
7551 Templates: P-wrapping: 1a. Templates on consecutive lines
7552 !!input
7553 {{echo|Foo}}
7554 {{echo|bar}}
7555 !!result
7556 <p>Foo
7557 bar
7558 </p>
7559 !!end
7560
7561 !!test
7562 Templates: P-wrapping: 1b. Templates on consecutive lines
7563 !!input
7564 Foo
7565
7566 {{echo|bar}}
7567 {{echo|baz}}
7568 !!result
7569 <p>Foo
7570 </p><p>bar
7571 baz
7572 </p>
7573 !!end
7574
7575 !!test
7576 Templates: P-wrapping: 1c. Templates on consecutive lines
7577 !!input
7578 {{echo|Foo}}
7579 {{echo|bar}} <div>baz</div>
7580 !!result
7581 <p>Foo
7582 </p>
7583 bar <div>baz</div>
7584
7585 !!end
7586
7587 !!test
7588 Templates: P-wrapping: 1d. Template preceded by comment-only line
7589 !!options
7590 parsoid
7591 !!input
7592 <!-- foo -->
7593 {{echo|Bar}}
7594 !!result
7595 <!-- foo -->
7596
7597 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
7598 !!end
7599
7600 !!test
7601 Templates: Inline Text: 1. Multiple tmeplate uses
7602 !!input
7603 {{echo|Foo}}bar{{echo|baz}}
7604 !!result
7605 <p>Foobarbaz
7606 </p>
7607 !!end
7608
7609 !!test
7610 Templates: Inline Text: 2. Back-to-back template uses
7611 !!input
7612 {{echo|Foo}}{{echo|bar}}
7613 !!result
7614 <p>Foobar
7615 </p>
7616 !!end
7617
7618 !!test
7619 Templates: Block Tags: 1. Multiple template uses
7620 !!input
7621 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
7622 !!result
7623 <div>Foo</div><div>bar</div><div>baz</div>
7624
7625 !!end
7626
7627 !!test
7628 Templates: Block Tags: 2. Back-to-back template uses
7629 !!input
7630 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
7631 !!result
7632 <div>Foo</div><div>bar</div>
7633
7634 !!end
7635
7636 !!test
7637 Templates: Links: 1. Simple example
7638 !!input
7639 {{echo|[[Foo|bar]]}}
7640 !!result
7641 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7642 </p>
7643 !!end
7644
7645 !!test
7646 Templates: Links: 2. Generation of link href
7647 !!input
7648 [[{{echo|Foo}}|bar]]
7649 !!result
7650 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7651 </p>
7652 !!end
7653
7654 !!test
7655 Templates: Links: 3. Generation of part of a link href
7656 !!input
7657 [[Fo{{echo|o}}|bar]]
7658
7659 [[Foo{{echo|bar}}]]
7660
7661 [[Foo{{echo|bar}}baz]]
7662
7663 [[Foo{{echo|bar}}|bar]]
7664
7665 [[:Foo{{echo|bar}}]]
7666
7667 [[:Foo{{echo|bar}}|bar]]
7668 !!result
7669 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7670 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7671 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
7672 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
7673 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7674 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
7675 </p>
7676 !!end
7677
7678 !!test
7679 Templates: Links: 4. Multiple templates generating link href
7680 !!input
7681 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
7682 !!result
7683 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7684 </p>
7685 !!end
7686
7687 !!test
7688 Templates: Links: 5. Generation of link text
7689 !!input
7690 [[Foo|{{echo|bar}}]]
7691 !!result
7692 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7693 </p>
7694 !!end
7695
7696 !!test
7697 Templates: Links: 5. Nested templates (only outermost template should be marked)
7698 !!input
7699 {{echo|[[{{echo|Foo}}|bar]]}}
7700 !!result
7701 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7702 </p>
7703 !!end
7704
7705 !!test
7706 Templates: HTML Tag: 1. Generation of HTML attr. key
7707 !!input
7708 <div {{echo|style}}="color:red;">foo</div>
7709 !!result
7710 <div style="color:red;">foo</div>
7711
7712 !!end
7713
7714 !!test
7715 Templates: HTML Tag: 2. Generation of HTML attr. value
7716 !!input
7717 <div style={{echo|'color:red;'}}>foo</div>
7718 !!result
7719 <div style="color:red;">foo</div>
7720
7721 !!end
7722
7723 !!test
7724 Templates: HTML Tag: 3. Generation of HTML attr key and value
7725 !!input
7726 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
7727 !!result
7728 <div style="color:red;">foo</div>
7729
7730 !!end
7731
7732 !!test
7733 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
7734 !!input
7735 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
7736 !!result
7737 <div title="This is a long title with just one piece templated">foo</div>
7738
7739 !!end
7740
7741 !!test
7742 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
7743 !!input
7744 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
7745 !!result
7746 <div title="This is a long title with just one piece templated">foo</div>
7747
7748 !!end
7749
7750 !!test
7751 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
7752 !!input
7753 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
7754 !!result
7755 <div title="This is a long title with just one piece templated">foo</div>
7756
7757 !!end
7758
7759 !!test
7760 Templates: HTML Tag: 7. Generation of partial attribute key string
7761 !!input
7762 <div st{{echo|yle}}="color:red;">foo</div>
7763 !!result
7764 <div style="color:red;">foo</div>
7765
7766 !!end
7767
7768 !!test
7769 Templates: HTML Tables: 1. Generating start of a HTML table
7770 !!input
7771 {{echo|<table><tr><td>foo</td>}}</tr></table>
7772 !!result
7773 <table><tr><td>foo</td></tr></table>
7774
7775 !!end
7776
7777 !!test
7778 Templates: HTML Tables: 2a. Generating middle of a HTML table
7779 !!input
7780 <table><tr>{{echo|<td>foo</td>}}</tr></table>
7781 !!result
7782 <table><tr><td>foo</td></tr></table>
7783
7784 !!end
7785
7786 !!test
7787 Templates: HTML Tables: 2b. Generating middle of a HTML table
7788 !!input
7789 <table>{{echo|<tr><td>foo</td></tr>}}</table>
7790 !!result
7791 <table><tr><td>foo</td></tr></table>
7792
7793 !!end
7794
7795 !!test
7796 Templates: HTML Tables: 3. Generating end of a HTML table
7797 !!input
7798 <table><tr>{{echo|<td>foo</td></tr></table>}}
7799 !!result
7800 <table><tr><td>foo</td></tr></table>
7801
7802 !!end
7803
7804 !!test
7805 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
7806 !!input
7807 {{echo|<table>}}<tr><td>foo</td></tr></table>
7808 !!result
7809 <table><tr><td>foo</td></tr></table>
7810
7811 !!end
7812
7813 !!test
7814 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
7815 !!input
7816 <table>{{echo|<tr>}}<td>foo</td></tr></table>
7817 !!result
7818 <table><tr><td>foo</td></tr></table>
7819
7820 !!end
7821
7822 !!test
7823 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
7824 !!input
7825 <table><tr>{{echo|<td>}}foo</td></tr></table>
7826 !!result
7827 <table><tr><td>foo</td></tr></table>
7828
7829 !!end
7830
7831 !!test
7832 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
7833 !!input
7834 <table><tr><td>foo{{echo|</td>}}</tr></table>
7835 !!result
7836 <table><tr><td>foo</td></tr></table>
7837
7838 !!end
7839
7840 !!test
7841 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
7842 !!input
7843 <table><tr><td>foo</td>{{echo|</tr>}}</table>
7844 !!result
7845 <table><tr><td>foo</td></tr></table>
7846
7847 !!end
7848
7849 !!test
7850 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
7851 !!input
7852 <table><tr><td>foo</td></tr>{{echo|</table>}}
7853 !!result
7854 <table><tr><td>foo</td></tr></table>
7855
7856 !!end
7857
7858 !!test
7859 Templates: HTML Tables: 5. Proper fostering of categories from inside
7860 !!options
7861 parsoid=wt2html,wt2wt
7862 !!input
7863 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
7864 <!--Two categories (Bug 50330)-->
7865 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
7866 !!result
7867 <link rel="mw:WikiLink/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
7868 <!--Two categories (Bug 50330)-->
7869 <link rel="mw:WikiLink/Category" href="./Category:Bar1"><link rel="mw:WikiLink/Category" href="./Category:Bar2"><table><tbody><tr><td>foo</td></tr></tbody></table>
7870 !!end
7871
7872 !!test
7873 Templates: Wiki Tables: 1a. Fostering of entire template content
7874 !!input
7875 {|
7876 {{echo|a}}
7877 |}
7878 !!result
7879 <table>
7880 a
7881 <tr><td></td></tr></table>
7882
7883 !!end
7884
7885 !!test
7886 Templates: Wiki Tables: 1b. Fostering of entire template content
7887 !!input
7888 {|
7889 {{echo|<div>}}
7890 foo
7891 {{echo|</div>}}
7892 |}
7893 !!result
7894 <table>
7895 <div>
7896 <p>foo
7897 </p>
7898 </div>
7899 <tr><td></td></tr></table>
7900
7901 !!end
7902
7903 !!test
7904 Templates: Wiki Tables: 2. Fostering of partial template content
7905 !!input
7906 {|
7907 {{echo|a
7908 <div>b</div>}}
7909 |}
7910 !!result
7911 <table>
7912 a
7913 <div>b</div>
7914 <tr><td></td></tr></table>
7915
7916 !!end
7917
7918 !!test
7919 Templates: Wiki Tables: 3. td-content via multiple templates
7920 !!input
7921 {|
7922 {{echo|{{pipe}}a}}{{echo|b}}
7923 |}
7924 !!result
7925 <table>
7926 <tr>
7927 <td>ab
7928 </td></tr></table>
7929
7930 !!end
7931
7932 !!test
7933 Templates: Wiki Tables: 4. Templated tags, no content
7934 !!input
7935 {{tbl-start}}
7936 {{tbl-end}}
7937 !!result
7938 <table>
7939 <tr><td></td></tr></table>
7940
7941 !!end
7942
7943 !!test
7944 Templates: Wiki Tables: 5. Templated tags, regular td-tags
7945 !!input
7946 {{tbl-start}}
7947 |foo
7948 {{tbl-end}}
7949 !!result
7950 <table>
7951 <tr>
7952 <td>foo
7953 </td></tr></table>
7954
7955 !!end
7956
7957 !!test
7958 Templates: Wiki Tables: 6. Templated tags, templated td-tags
7959 !!input
7960 {{tbl-start}}
7961 {{!}}foo
7962 {{tbl-end}}
7963 !!result
7964 <table>
7965 <tr>
7966 <td>foo
7967 </td></tr></table>
7968
7969 !!end
7970
7971 !!test
7972 Templates: Lists: Multi-line list-items via templates
7973 !!input
7974 *{{echo|a {{nonexistent|
7975 unused}}}}
7976 *{{echo|b {{nonexistent|
7977 unused}}}}
7978 !!result
7979 <ul><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>
7980 </li><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>
7981 </li></ul>
7982
7983 !!end
7984
7985 !!test
7986 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
7987 !!input
7988 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
7989 !!result
7990 <p><i>ab</i>c<i>d</i>e
7991 </p>
7992 !!end
7993
7994 !!test
7995 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
7996 (PHP parser generates misnested html)
7997 !! options
7998 parsoid
7999 !!input
8000 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
8001 !!result
8002 <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>
8003 !!end
8004
8005 !!test
8006 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
8007 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
8008 !! options
8009 parsoid=wt2html,wt2wt
8010 !!input
8011 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
8012 !!result
8013 <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>
8014 <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>
8015 <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>
8016 !!end
8017
8018 !!test
8019 Templates: Ugly nesting: 4. Divs opened/closed across templates
8020 !!input
8021 a<div>b{{echo|c</div>d}}e
8022 !!result
8023 a<div>bc</div>de
8024
8025 !!end
8026
8027 !!test
8028 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
8029 (Parsoid-centric)
8030 !! options
8031 parsoid
8032 !!input
8033 {|
8034 |{{echo|foo</table>}}
8035 |bar
8036 |}
8037 !!result
8038 <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|}"]}'>
8039
8040 <tbody>
8041 <tr>
8042 <td>foo</td></tr></tbody></table><span about="#mwt1">
8043 </span><span about="#mwt1">bar</span><span about="#mwt1">
8044 </span>
8045 !!end
8046
8047 !!test
8048 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
8049 (Parsoid-centric)
8050 !! options
8051 parsoid
8052 !!input
8053 <table>
8054 <tr>
8055 <td>
8056 <table>
8057 <tr>
8058 <td>1. {{echo|foo </table>}}</td>
8059 <td> bar </td>
8060 <td>2. {{echo|baz </table>}}</td>
8061 </tr>
8062 <tr>
8063 <td>abc</td>
8064 </tr>
8065 </table>
8066 </td>
8067 </tr>
8068 <tr>
8069 <td>xyz</td>
8070 </tr>
8071 </table>
8072 !!result
8073 <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>"]}'>
8074 <tbody><tr>
8075 <td>
8076 <table>
8077 <tbody><tr>
8078 <td>1. foo </td></tr></tbody></table></td>
8079 <td> bar </td>
8080 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
8081 </span><span about="#mwt2">
8082 </span><span about="#mwt2">
8083 </span><span about="#mwt2">abc</span><span about="#mwt2">
8084 </span><span about="#mwt2">
8085 </span><span about="#mwt2">
8086 </span><span about="#mwt2">
8087 </span><span about="#mwt2">
8088 </span><span about="#mwt2">
8089 </span><span about="#mwt2">xyz</span><span about="#mwt2">
8090 </span><span about="#mwt2">
8091 </span>
8092 !!end
8093
8094 !! test
8095 Templates: Ugly templates: 3. newline-only template parameter
8096 !! input
8097 foo {{echo|
8098 }}
8099 !! result
8100 <p>foo
8101 </p>
8102 !! end
8103
8104 # This looks like a bug: a single newline triggers p/br for some reason.
8105 !! test
8106 Templates: Ugly templates: 4. newline-only template parameter inconsistency
8107 !! input
8108 {{echo|
8109 }}
8110 !! result
8111 <p><br />
8112 </p>
8113 !! end
8114
8115
8116 !!test
8117 Parser Functions: 1. Simple example
8118 !!input
8119 {{uc:foo}}
8120 !!result
8121 <p>FOO
8122 </p>
8123 !!end
8124
8125 !!test
8126 Parser Functions: 2. Nested use (only outermost should be marked up)
8127 !!input
8128 {{uc:{{lc:FOO}}}}
8129 !!result
8130 <p>FOO
8131 </p>
8132 !!end
8133
8134 ###
8135 ### Pre-save transform tests
8136 ###
8137 !! test
8138 pre-save transform: subst:
8139 !! options
8140 PST
8141 !! input
8142 {{subst:test}}
8143 !! result
8144 This is a test template
8145 !! end
8146
8147 !! test
8148 pre-save transform: normal template
8149 !! options
8150 PST
8151 !! input
8152 {{test}}
8153 !! result
8154 {{test}}
8155 !! end
8156
8157 !! test
8158 pre-save transform: nonexistent template
8159 !! options
8160 PST
8161 !! input
8162 {{thistemplatedoesnotexist}}
8163 !! result
8164 {{thistemplatedoesnotexist}}
8165 !! end
8166
8167
8168 !! test
8169 pre-save transform: subst magic variables
8170 !! options
8171 PST
8172 !! input
8173 {{subst:SITENAME}}
8174 !! result
8175 MediaWiki
8176 !! end
8177
8178 # This is bug 89, which I fixed. -- wtm
8179 !! test
8180 pre-save transform: subst: templates with parameters
8181 !! options
8182 pst
8183 !! input
8184 {{subst:paramtest|param="something else"}}
8185 !! result
8186 This is a test template with parameter "something else"
8187 !! end
8188
8189 !! article
8190 Template:nowikitest
8191 !! text
8192 <nowiki>'''not wiki'''</nowiki>
8193 !! endarticle
8194
8195 !! test
8196 pre-save transform: nowiki in subst (bug 1188)
8197 !! options
8198 pst
8199 !! input
8200 {{subst:nowikitest}}
8201 !! result
8202 <nowiki>'''not wiki'''</nowiki>
8203 !! end
8204
8205
8206 !! article
8207 Template:commenttest
8208 !! text
8209 This template has <!-- a comment --> in it.
8210 !! endarticle
8211
8212 !! test
8213 pre-save transform: comment in subst (bug 1936)
8214 !! options
8215 pst
8216 !! input
8217 {{subst:commenttest}}
8218 !! result
8219 This template has <!-- a comment --> in it.
8220 !! end
8221
8222 !! test
8223 pre-save transform: unclosed tag
8224 !! options
8225 pst noxml
8226 !! input
8227 <nowiki>'''not wiki'''
8228 !! result
8229 <nowiki>'''not wiki'''
8230 !! end
8231
8232 !! test
8233 pre-save transform: mixed tag case
8234 !! options
8235 pst noxml
8236 !! input
8237 <NOwiki>'''not wiki'''</noWIKI>
8238 !! result
8239 <NOwiki>'''not wiki'''</noWIKI>
8240 !! end
8241
8242 !! test
8243 pre-save transform: unclosed comment in <nowiki>
8244 !! options
8245 pst noxml
8246 !! input
8247 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
8248 !! result
8249 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
8250 !!end
8251
8252 # Leading @ in this template definition works around a limitation
8253 # in parsoid's parserTests which otherwise strips the <span> from the
8254 # result (confusing it for a template wrapper)
8255 !! article
8256 Template:dangerous
8257 !!text
8258 @<span onmouseover="alert('crap')">Oh no</span>
8259 !!endarticle
8260
8261 !!test
8262 (confirming safety of fix for subst bug 1936)
8263 !! input
8264 {{Template:dangerous}}
8265 !! result
8266 <p>@<span>Oh no</span>
8267 </p>
8268 !! end
8269
8270 !! test
8271 pre-save transform: comment containing gallery (bug 5024)
8272 !! options
8273 pst
8274 !! input
8275 <!-- <gallery>data</gallery> -->
8276 !!result
8277 <!-- <gallery>data</gallery> -->
8278 !!end
8279
8280 !! test
8281 pre-save transform: comment containing extension
8282 !! options
8283 pst
8284 !! input
8285 <!-- <tag>data</tag> -->
8286 !!result
8287 <!-- <tag>data</tag> -->
8288 !!end
8289
8290 !! test
8291 pre-save transform: comment containing nowiki
8292 !! options
8293 pst
8294 !! input
8295 <!-- <nowiki>data</nowiki> -->
8296 !!result
8297 <!-- <nowiki>data</nowiki> -->
8298 !!end
8299
8300 !! test
8301 pre-save transform: <noinclude> in subst (bug 3298)
8302 !! options
8303 pst
8304 !! input
8305 {{subst:Includes}}
8306 !! result
8307 Foobar
8308 !! end
8309
8310 !! test
8311 pre-save transform: <onlyinclude> in subst (bug 3298)
8312 !! options
8313 pst
8314 !! input
8315 {{subst:Includes2}}
8316 !! result
8317 Foo
8318 !! end
8319
8320 !! article
8321 Template:SubstTest
8322 !!text
8323 {{<includeonly>subst:</includeonly>Includes}}
8324 !! endarticle
8325
8326 !! article
8327 Template:SafeSubstTest
8328 !! text
8329 {{<includeonly>safesubst:</includeonly>Includes}}
8330 !! endarticle
8331
8332 !! test
8333 bug 22297: safesubst: works during PST
8334 !! options
8335 pst
8336 !! input
8337 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
8338 !! result
8339 FoobarFoobar
8340 !! end
8341
8342 !! test
8343 bug 22297: safesubst: works during normal parse
8344 !! input
8345 {{SafeSubstTest}}
8346 !! result
8347 <p>Foobar
8348 </p>
8349 !! end
8350
8351 !! test:
8352 subst: does not work during normal parse
8353 !! input
8354 {{SubstTest}}
8355 !! result
8356 <p>{{subst:Includes}}
8357 </p>
8358 !! end
8359
8360 !! test
8361 pre-save transform: context links ("pipe trick")
8362 !! options
8363 pst
8364 !! input
8365 [[Article (context)|]]
8366 [[Bar:Article|]]
8367 [[:Bar:Article|]]
8368 [[Bar:Article (context)|]]
8369 [[:Bar:Article (context)|]]
8370 [[|Article]]
8371 [[|Article (context)]]
8372 [[Bar:X (Y) Z|]]
8373 [[:Bar:X (Y) Z|]]
8374 !! result
8375 [[Article (context)|Article]]
8376 [[Bar:Article|Article]]
8377 [[:Bar:Article|Article]]
8378 [[Bar:Article (context)|Article]]
8379 [[:Bar:Article (context)|Article]]
8380 [[Article]]
8381 [[Article (context)]]
8382 [[Bar:X (Y) Z|X (Y) Z]]
8383 [[:Bar:X (Y) Z|X (Y) Z]]
8384 !! end
8385
8386 !! test
8387 pre-save transform: context links ("pipe trick") with interwiki prefix
8388 !! options
8389 pst
8390 !! input
8391 [[interwiki:Article|]]
8392 [[:interwiki:Article|]]
8393 [[interwiki:Bar:Article|]]
8394 [[:interwiki:Bar:Article|]]
8395 !! result
8396 [[interwiki:Article|Article]]
8397 [[:interwiki:Article|Article]]
8398 [[interwiki:Bar:Article|Bar:Article]]
8399 [[:interwiki:Bar:Article|Bar:Article]]
8400 !! end
8401
8402 !! test
8403 pre-save transform: context links ("pipe trick") with parens in title
8404 !! options
8405 pst title=[[Somearticle (context)]]
8406 !! input
8407 [[|Article]]
8408 !! result
8409 [[Article (context)|Article]]
8410 !! end
8411
8412 !! test
8413 pre-save transform: context links ("pipe trick") with comma in title
8414 !! options
8415 pst title=[[Someplace, Somewhere]]
8416 !! input
8417 [[|Otherplace]]
8418 [[Otherplace, Elsewhere|]]
8419 [[Otherplace, Elsewhere, Anywhere|]]
8420 !! result
8421 [[Otherplace, Somewhere|Otherplace]]
8422 [[Otherplace, Elsewhere|Otherplace]]
8423 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
8424 !! end
8425
8426 !! test
8427 pre-save transform: context links ("pipe trick") with parens and comma
8428 !! options
8429 pst title=[[Someplace (IGNORED), Somewhere]]
8430 !! input
8431 [[|Otherplace]]
8432 [[Otherplace (place), Elsewhere|]]
8433 !! result
8434 [[Otherplace, Somewhere|Otherplace]]
8435 [[Otherplace (place), Elsewhere|Otherplace]]
8436 !! end
8437
8438 !! test
8439 pre-save transform: context links ("pipe trick") with comma and parens
8440 !! options
8441 pst title=[[Who, me? (context)]]
8442 !! input
8443 [[|Yes, you.]]
8444 [[Me, Myself, and I (1937 song)|]]
8445 !! result
8446 [[Yes, you. (context)|Yes, you.]]
8447 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
8448 !! end
8449
8450 !! test
8451 pre-save transform: context links ("pipe trick") with namespace
8452 !! options
8453 pst title=[[Ns:Somearticle]]
8454 !! input
8455 [[|Article]]
8456 !! result
8457 [[Ns:Article|Article]]
8458 !! end
8459
8460 !! test
8461 pre-save transform: context links ("pipe trick") with namespace and parens
8462 !! options
8463 pst title=[[Ns:Somearticle (context)]]
8464 !! input
8465 [[|Article]]
8466 !! result
8467 [[Ns:Article (context)|Article]]
8468 !! end
8469
8470 !! test
8471 pre-save transform: context links ("pipe trick") with namespace and comma
8472 !! options
8473 pst title=[[Ns:Somearticle, Context, Whatever]]
8474 !! input
8475 [[|Article]]
8476 !! result
8477 [[Ns:Article, Context, Whatever|Article]]
8478 !! end
8479
8480 !! test
8481 pre-save transform: context links ("pipe trick") with namespace, comma and parens
8482 !! options
8483 pst title=[[Ns:Somearticle, Context (context)]]
8484 !! input
8485 [[|Article]]
8486 !! result
8487 [[Ns:Article (context)|Article]]
8488 !! end
8489
8490 !! test
8491 pre-save transform: context links ("pipe trick") with namespace, parens and comma
8492 !! options
8493 pst title=[[Ns:Somearticle (IGNORED), Context]]
8494 !! input
8495 [[|Article]]
8496 !! result
8497 [[Ns:Article, Context|Article]]
8498 !! end
8499
8500 !! test
8501 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
8502 !! options
8503 pst
8504 !! input
8505 [[Article(context)|]]
8506 [[Bar:Article(context)|]]
8507 [[:Bar:Article(context)|]]
8508 [[|Article(context)]]
8509 [[Bar:X(Y)Z|]]
8510 [[:Bar:X(Y)Z|]]
8511 !! result
8512 [[Article(context)|Article]]
8513 [[Bar:Article(context)|Article]]
8514 [[:Bar:Article(context)|Article]]
8515 [[Article(context)]]
8516 [[Bar:X(Y)Z|X(Y)Z]]
8517 [[:Bar:X(Y)Z|X(Y)Z]]
8518 !! end
8519
8520 !! test
8521 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
8522 !! options
8523 pst
8524 !! input
8525 [[Article (context)|]]
8526 [[Bar:Article (context)|]]
8527 [[:Bar:Article (context)|]]
8528 [[|Article (context)]]
8529 [[Bar:X (Y) Z|]]
8530 [[:Bar:X (Y) Z|]]
8531 !! result
8532 [[Article (context)|Article]]
8533 [[Bar:Article (context)|Article]]
8534 [[:Bar:Article (context)|Article]]
8535 [[Article (context)]]
8536 [[Bar:X (Y) Z|X (Y) Z]]
8537 [[:Bar:X (Y) Z|X (Y) Z]]
8538 !! end
8539
8540 !! test
8541 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
8542 !! options
8543 pst
8544 !! input
8545 [[Article(context)|]]
8546 [[Bar:Article(context)|]]
8547 [[:Bar:Article(context)|]]
8548 [[|Article(context)]]
8549 [[Bar:X(Y)Z|]]
8550 [[:Bar:X(Y)Z|]]
8551 !! result
8552 [[Article(context)|Article]]
8553 [[Bar:Article(context)|Article]]
8554 [[:Bar:Article(context)|Article]]
8555 [[Article(context)]]
8556 [[Bar:X(Y)Z|X(Y)Z]]
8557 [[:Bar:X(Y)Z|X(Y)Z]]
8558 !! end
8559
8560 !! test
8561 pre-save transform: context links ("pipe trick") with commas (bug 21660)
8562 !! options
8563 pst
8564 !! input
8565 [[Article (context), context|]]
8566 [[Article (context),context|]]
8567 [[Bar:Article (context), context|]]
8568 [[Bar:Article (context),context|]]
8569 [[:Bar:Article (context), context|]]
8570 [[:Bar:Article (context),context|]]
8571 !! result
8572 [[Article (context), context|Article]]
8573 [[Article (context),context|Article]]
8574 [[Bar:Article (context), context|Article]]
8575 [[Bar:Article (context),context|Article]]
8576 [[:Bar:Article (context), context|Article]]
8577 [[:Bar:Article (context),context|Article]]
8578 !! end
8579
8580 !! test
8581 pre-save transform: trim trailing empty lines
8582 !! options
8583 pst
8584 !! input
8585 Empty lines are trimmed
8586
8587
8588
8589
8590 !! result
8591 Empty lines are trimmed
8592 !! end
8593
8594 !! test
8595 pre-save transform: Signature expansion
8596 !! options
8597 pst
8598 !! input
8599 * ~~~
8600 * <noinclude>~~~</noinclude>
8601 * <includeonly>~~~</includeonly>
8602 * <onlyinclude>~~~</onlyinclude>
8603 !! result
8604 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
8605 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
8606 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
8607 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
8608 !! end
8609
8610
8611 !! test
8612 pre-save transform: Signature expansion in nowiki tags (bug 93)
8613 !! options
8614 pst disabled
8615 !! input
8616 Shall not expand:
8617
8618 <nowiki>~~~~</nowiki>
8619
8620 <includeonly><nowiki>~~~~</nowiki></includeonly>
8621
8622 <noinclude><nowiki>~~~~</nowiki></noinclude>
8623
8624 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
8625
8626 {{subst:Foo}} shall be converted to FOO
8627
8628 As well as inside noinclude/onlyinclude
8629 <noinclude>{{subst:Foo}}</noinclude>
8630 <onlyinclude>{{subst:Foo}}</onlyinclude>
8631
8632 But not inside includeonly
8633 <includeonly>{{subst:Foo}}</includeonly>
8634 !! result
8635 Shall not expand:
8636
8637 <nowiki>~~~~</nowiki>
8638
8639 <includeonly><nowiki>~~~~</nowiki></includeonly>
8640
8641 <noinclude><nowiki>~~~~</nowiki></noinclude>
8642
8643 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
8644
8645 FOO shall be converted to FOO
8646
8647 As well as inside noinclude/onlyinclude
8648 <noinclude>FOO</noinclude>
8649 <onlyinclude>FOO</onlyinclude>
8650
8651 But not inside includeonly
8652 <includeonly>{{subst:Foo}}</includeonly>
8653 !! end
8654
8655 !! test
8656 Parsoid: Recognize nowiki with trailing space in tags
8657 !! options
8658 parsoid=wt2html
8659 !! input
8660 <nowiki ><div>[[foo]]</nowiki >
8661
8662 a<nowiki / >b
8663
8664 c<nowiki />d
8665
8666 e<nowiki/ >f
8667 !! result
8668 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
8669 <p>ab</p>
8670 <p>cd</p>
8671 <p>ef</p>
8672 !! end
8673
8674 !! test
8675 Parsoid: Recognize nowiki with odd capitalization
8676 !! options
8677 parsoid=wt2html
8678 !! input
8679 <noWikI ><div>[[foo]]</Nowiki >
8680 !! result
8681 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
8682 !! end
8683
8684
8685 !! test
8686 Parsoid: Escape nowiki with trailing space in tags
8687 !! options
8688 parsoid=html2wt
8689 !! input
8690 &lt;nowiki &gt; foo &lt;/nowiki &gt;
8691
8692 a&lt;nowiki /&gt;b
8693
8694 c&lt;nowiki/ &gt;d
8695 !! result
8696 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
8697 <p>a&lt;nowiki /&gt;b</p>
8698 <p>c&lt;nowiki/ &gt;d</p>
8699 !! end
8700
8701 !! test
8702 Parsoid: Escape weird noWikI capitalizations
8703 !! options
8704 parsoid=html2wt
8705 !! input
8706 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
8707 !! result
8708 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
8709 !! end
8710
8711 ###
8712 ### Message transform tests
8713 ###
8714 !! test
8715 message transform: magic variables
8716 !! options
8717 msg
8718 !! input
8719 {{SITENAME}}
8720 !! result
8721 MediaWiki
8722 !! end
8723
8724 !! test
8725 message transform: should not transform wiki markup
8726 !! options
8727 msg
8728 !! input
8729 ''test''
8730 !! result
8731 ''test''
8732 !! end
8733
8734 !! test
8735 message transform: <noinclude> in transcluded template (bug 4926)
8736 !! options
8737 msg
8738 !! input
8739 {{Includes}}
8740 !! result
8741 Foobar
8742 !! end
8743
8744 !! test
8745 message transform: <onlyinclude> in transcluded template (bug 4926)
8746 !! options
8747 msg
8748 !! input
8749 {{Includes2}}
8750 !! result
8751 Foo
8752 !! end
8753
8754 !! test
8755 {{#special:}} page name, known
8756 !! options
8757 msg
8758 !! input
8759 {{#special:Recentchanges}}
8760 !! result
8761 Special:RecentChanges
8762 !! end
8763
8764 !! test
8765 {{#special:}} page name with subpage, known
8766 !! options
8767 msg
8768 !! input
8769 {{#special:Recentchanges/param}}
8770 !! result
8771 Special:RecentChanges/param
8772 !! end
8773
8774 !! test
8775 {{#special:}} page name, unknown
8776 !! options
8777 msg
8778 !! input
8779 {{#special:foobar nonexistent}}
8780 !! result
8781 Special:Foobar nonexistent
8782 !! end
8783
8784 !! test
8785 {{#speciale:}} page name, known
8786 !! options
8787 msg
8788 !! input
8789 {{#speciale:Recentchanges}}
8790 !! result
8791 Special:RecentChanges
8792 !! end
8793
8794 !! test
8795 {{#speciale:}} page name with subpage, known
8796 !! options
8797 msg
8798 !! input
8799 {{#speciale:Recentchanges/param}}
8800 !! result
8801 Special:RecentChanges/param
8802 !! end
8803
8804 !! test
8805 {{#speciale:}} page name, unknown
8806 !! options
8807 msg
8808 !! input
8809 {{#speciale:foobar nonexistent}}
8810 !! result
8811 Special:Foobar_nonexistent
8812 !! end
8813
8814 ###
8815 ### Images
8816 ###
8817 ### For Parsoid-specific tests, see
8818 #### http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
8819
8820 !! test
8821 Simple image (php)
8822 !! options
8823 php
8824 !! input
8825 [[Image:foobar.jpg]]
8826 !! result
8827 <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>
8828 </p>
8829 !! end
8830
8831 !! test
8832 Simple image (parsoid)
8833 !! options
8834 parsoid=wt2html
8835 !! input
8836 [[Image:foobar.jpg]]
8837 !! result
8838 <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>
8839 </p>
8840 !! end
8841
8842 !! test
8843 Simple image (using File: namespace, now canonical) (php)
8844 !! options
8845 php
8846 !! input
8847 [[File:foobar.jpg]]
8848 !! result
8849 <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>
8850 </p>
8851 !! end
8852
8853 !! test
8854 Simple image (using File: namespace, now canonical) (parsoid)
8855 !! options
8856 parsoid
8857 !! input
8858 [[File:Foobar.jpg]]
8859 !! result
8860 <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>
8861 </p>
8862 !! end
8863
8864 !! test
8865 Right-aligned image (php)
8866 !! options
8867 php
8868 !! input
8869 [[Image:foobar.jpg|right]]
8870 !! result
8871 <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>
8872
8873 !! end
8874
8875 !! test
8876 Right-aligned image (parsoid)
8877 !! options
8878 parsoid
8879 !! input
8880 [[File:Foobar.jpg|right]]
8881 !! result
8882 <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>
8883 !! end
8884
8885 !! test
8886 Image with caption (php)
8887 !! options
8888 php
8889 !! input
8890 [[File:Foobar.jpg|right|Caption text]]
8891 !! result
8892 <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>
8893
8894 !! end
8895
8896 !! test
8897 Image with caption (parsoid)
8898 !! options
8899 parsoid
8900 !! input
8901 [[File:Foobar.jpg|right|Caption text]]
8902 !! result
8903 <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>
8904 !! end
8905
8906 !! test
8907 Image with empty attribute (php)
8908 !! options
8909 php
8910 !! input
8911 [[File:Foobar.jpg|right||Caption text]]
8912 !! result
8913 <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>
8914
8915 !! end
8916
8917 !! test
8918 Image with empty attribute (parsoid)
8919 !! options
8920 parsoid=wt2html
8921 !! input
8922 [[File:Foobar.jpg|right||Caption text]]
8923 !! result
8924 <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>
8925 !! end
8926
8927 !! test
8928 Image with attributes from template (php)
8929 !! options
8930 php
8931 !! input
8932 [[File:Foobar.jpg|{{image_attribs}}]]
8933 !! result
8934 <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>
8935
8936 !! end
8937
8938 !! test
8939 Image with attributes from template (parsoid)
8940 !! options
8941 parsoid
8942 !! input
8943 [[File:Foobar.jpg|{{image_attribs}}]]
8944 !! result
8945 <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>
8946 !! end
8947
8948 !! test
8949 Image with link tails (php)
8950 !! options
8951 php
8952 !! input
8953 123[[File:Foobar.jpg]]456
8954 123[[File:Foobar.jpg|right]]456
8955 123[[File:Foobar.jpg|thumb]]456
8956 !! result
8957 <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
8958 </p>
8959 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
8960 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
8961
8962 !! end
8963
8964 !! test
8965 Image with link tails (parsoid)
8966 !! options
8967 parsoid
8968 !! input
8969 123[[File:Foobar.jpg]]456
8970 123[[File:Foobar.jpg|right]]456
8971 123[[File:Foobar.jpg|thumb]]456
8972 !! result
8973 <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>
8974 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
8975 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
8976 !! end
8977
8978 !! test
8979 Image with multiple captions -- only last one is accepted (php)
8980 !! options
8981 php
8982 !! input
8983 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
8984 !! result
8985 <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>
8986
8987 !! end
8988
8989 !! test
8990 Image with multiple captions -- only last one is accepted (parsoid)
8991 !! options
8992 parsoid
8993 !! input
8994 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
8995 !! result
8996 <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>
8997 !! end
8998
8999 !! test
9000 Image with width attribute at different positions (php)
9001 !! options
9002 php
9003 !! input
9004 [[File:Foobar.jpg|200px|right|Caption]]
9005 [[File:Foobar.jpg|right|200px|Caption]]
9006 [[File:Foobar.jpg|right|Caption|200px]]
9007 !! result
9008 <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>
9009 <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>
9010 <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>
9011
9012 !! end
9013
9014 !! test
9015 Image with width attribute at different positions (parsoid)
9016 !! options
9017 parsoid
9018 !! input
9019 [[File:Foobar.jpg|200px|right|Caption]]
9020 [[File:Foobar.jpg|right|200px|Caption]]
9021 [[File:Foobar.jpg|right|Caption|200px]]
9022 !! result
9023 <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>
9024 <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>
9025 <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>
9026 !! end
9027
9028 !! test
9029 Image with link parameter, wiki target (php)
9030 !! options
9031 php
9032 !! input
9033 [[File:Foobar.jpg|link=Main Page]]
9034 !! result
9035 <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>
9036 </p>
9037 !! end
9038
9039 !! test
9040 Image with link parameter, wiki target (parsoid)
9041 !! options
9042 parsoid
9043 !! input
9044 [[File:Foobar.jpg|link=Main Page]]
9045 !! result
9046 <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>
9047 !! end
9048
9049 !! test
9050 Image with link parameter, URL target (php)
9051 !! options
9052 php
9053 !! input
9054 [[File:Foobar.jpg|link=http://example.com/]]
9055 !! result
9056 <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>
9057 </p>
9058 !! end
9059
9060 # parsoid bug 49293 (part 1)
9061 !! test
9062 Image with link parameter, URL target (parsoid)
9063 !! options
9064 parsoid
9065 !! input
9066 [[File:Foobar.jpg|link=http://example.com/]]
9067 !! result
9068 <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>
9069 !! end
9070
9071 !! test
9072 Image with link parameter, protocol-less URL target (php)
9073 !! options
9074 php
9075 !! input
9076 [[File:Foobar.jpg|link=//example.com/]]
9077 !! result
9078 <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>
9079 </p>
9080 !! end
9081
9082 # parsoid bug 49293 (part 2)
9083 !! test
9084 Image with link parameter, protocol-less URL target (parsoid)
9085 !! options
9086 parsoid
9087 !! input
9088 [[File:Foobar.jpg|link=//example.com/]]
9089 !! result
9090 <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>
9091 !! end
9092
9093 !! test
9094 Image with link parameter, wgExternalLinkTarget
9095 !! input
9096 [[Image:foobar.jpg|link=http://example.com/]]
9097 !! config
9098 wgExternalLinkTarget='foobar'
9099 !! result
9100 <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>
9101 </p>
9102 !! end
9103
9104 !! test
9105 Image with link parameter, wgNoFollowLinks set to false
9106 !! input
9107 [[Image:foobar.jpg|link=http://example.com/]]
9108 !! config
9109 wgNoFollowLinks=false
9110 !! result
9111 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9112 </p>
9113 !! end
9114
9115 !! test
9116 Image with link parameter, wgNoFollowDomainExceptions
9117 !! input
9118 [[Image:foobar.jpg|link=http://example.com/]]
9119 !! config
9120 wgNoFollowDomainExceptions='example.com'
9121 !! result
9122 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9123 </p>
9124 !! end
9125
9126 !! test
9127 Image with link parameter, wgExternalLinkTarget, unnamed parameter
9128 !! input
9129 [[Image:foobar.jpg|link=http://example.com/|Title]]
9130 !! config
9131 wgExternalLinkTarget='foobar'
9132 !! result
9133 <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>
9134 </p>
9135 !! end
9136
9137 !! test
9138 Image with empty link parameter (php)
9139 !! options
9140 php
9141 !! input
9142 [[File:Foobar.jpg|link=]]
9143 !! result
9144 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
9145 </p>
9146 !! end
9147
9148 !! test
9149 Image with empty link parameter (parsoid)
9150 !! options
9151 parsoid
9152 !! input
9153 [[File:Foobar.jpg|link=]]
9154 !! result
9155 <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>
9156 !! end
9157
9158 !! test
9159 Image with link parameter (wiki target) and unnamed parameter (php)
9160 !! options
9161 php
9162 !! input
9163 [[File:Foobar.jpg|link=Main Page|Title]]
9164 !! result
9165 <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>
9166 </p>
9167 !! end
9168
9169 !! test
9170 Image with link parameter (wiki target) and unnamed parameter (parsoid)
9171 !! options
9172 parsoid
9173 !! input
9174 [[File:Foobar.jpg|link=Main Page|Title]]
9175 !! result
9176 <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>
9177 !! end
9178
9179 !! test
9180 Image with link parameter (URL target) and unnamed parameter (php)
9181 !! options
9182 php
9183 !! input
9184 [[File:Foobar.jpg|link=http://example.com/|Title]]
9185 !! result
9186 <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>
9187 </p>
9188 !! end
9189
9190 !! test
9191 Image with link parameter (URL target) and unnamed parameter (parsoid)
9192 !! options
9193 parsoid
9194 !! input
9195 [[File:Foobar.jpg|link=http://example.com/|Title]]
9196 !! result
9197 <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>
9198 !! end
9199
9200 !! test
9201 Thumbnail image with link parameter
9202 !! options
9203 php
9204 !! input
9205 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
9206 !! result
9207 <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>
9208
9209 !! end
9210
9211 !! test
9212 Manually-specified thumbnail image
9213 !! options
9214 php
9215 !! input
9216 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
9217 !! result
9218 <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>
9219
9220 !! end
9221
9222 !! test
9223 Manually-specified thumbnail image with explicit link to wiki page
9224 !! options
9225 php
9226 !! input
9227 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
9228 !! result
9229 <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>
9230
9231 !! end
9232
9233 !! test
9234 Manually-specified thumbnail image with explicit link to url
9235 !! options
9236 php
9237 !! input
9238 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
9239 !! result
9240 <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>
9241
9242 !! end
9243
9244 !! test
9245 Manually-specified thumbnail image with explicit no link
9246 !! options
9247 php
9248 !! input
9249 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
9250 !! result
9251 <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>
9252
9253 !! end
9254
9255 !! test
9256 Manually-specified thumbnail image with explicit link and alt text
9257 !! options
9258 php
9259 !! input
9260 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
9261 !! result
9262 <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>
9263
9264 !! end
9265
9266 !! test
9267 Image with frame and link
9268 !! input
9269 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
9270 !! result
9271 <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>
9272
9273 !! end
9274
9275 !! test
9276 Image with frame and link and explicit alt
9277 !! input
9278 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
9279 !! result
9280 <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>
9281
9282 !! end
9283
9284 !! test
9285 Image with wiki markup in implicit alt
9286 !! input
9287 [[Image:Foobar.jpg|testing '''bold''' in alt]]
9288 !! result
9289 <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>
9290 </p>
9291 !! end
9292
9293 !! test
9294 Image with wiki markup in explicit alt
9295 !! input
9296 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
9297 !! result
9298 <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>
9299 </p>
9300 !! end
9301
9302 !! test
9303 Link to image page- image page normally doesn't exists, hence edit link
9304 Add test with existing image page
9305 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
9306 !! input
9307 [[:Image:test]]
9308 !! result
9309 <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>
9310 </p>
9311 !! end
9312
9313 !! test
9314 bug 18784 Link to non-existent image page with caption should use caption as link text
9315 !! input
9316 [[:Image:test|caption]]
9317 !! result
9318 <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>
9319 </p>
9320 !! end
9321
9322 !! test
9323 Frameless image caption with a free URL
9324 !! input
9325 [[Image:foobar.jpg|http://example.com]]
9326 !! result
9327 <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>
9328 </p>
9329 !! end
9330
9331 !! test
9332 Thumbnail image caption with a free URL
9333 !! input
9334 [[Image:foobar.jpg|thumb|http://example.com]]
9335 !! result
9336 <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>
9337
9338 !! end
9339
9340 !! test
9341 Thumbnail image caption with a free URL and explicit alt
9342 !! input
9343 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
9344 !! result
9345 <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>
9346
9347 !! end
9348
9349 !! test
9350 SVG thumbnails with no language set
9351 !! options
9352 !! input
9353 [[File:Foobar.svg|thumb|width=200]]
9354 !! result
9355 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="180" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>width=200</div></div></div>
9356
9357 !! end
9358
9359 !! test
9360 SVG thumbnails with language de
9361 !! options
9362 !! input
9363 [[File:Foobar.svg|thumb|width=200|lang=de]]
9364 !! result
9365 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=File:Foobar.svg&amp;lang=de" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/langde-180px-Foobar.svg.png" width="180" height="180" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/langde-270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/langde-360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>width=200</div></div></div>
9366
9367 !! end
9368
9369 !! test
9370 SVG thumbnails with invalid language code
9371 !! options
9372 !! input
9373 [[File:Foobar.svg|thumb|width=200|lang=invalid.language.code]]
9374 !! result
9375 <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>
9376
9377 !! end
9378
9379 !! test
9380 BUG 1887: A ISBN with a thumbnail
9381 !! input
9382 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
9383 !! result
9384 <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>
9385
9386 !! end
9387
9388 !! test
9389 BUG 1887: A RFC with a thumbnail
9390 !! input
9391 [[Image:foobar.jpg|thumb|This is RFC 12354]]
9392 !! result
9393 <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>
9394
9395 !! end
9396
9397 !! test
9398 BUG 1887: A mailto link with a thumbnail
9399 !! input
9400 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
9401 !! result
9402 <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>
9403
9404 !! end
9405
9406 # Pending resolution to bug 368
9407 !! test
9408 BUG 648: Frameless image caption with a link
9409 !! input
9410 [[Image:foobar.jpg|text with a [[link]] in it]]
9411 !! result
9412 <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>
9413 </p>
9414 !! end
9415
9416 !! test
9417 BUG 648: Frameless image caption with a link (suffix)
9418 !! input
9419 [[Image:foobar.jpg|text with a [[link]]foo in it]]
9420 !! result
9421 <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>
9422 </p>
9423 !! end
9424
9425 !! test
9426 BUG 648: Frameless image caption with an interwiki link
9427 !! input
9428 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
9429 !! result
9430 <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>
9431 </p>
9432 !! end
9433
9434 !! test
9435 BUG 648: Frameless image caption with a piped interwiki link
9436 !! input
9437 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
9438 !! result
9439 <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>
9440 </p>
9441 !! end
9442
9443 !! test
9444 Escape HTML special chars in image alt text
9445 !! input
9446 [[Image:foobar.jpg|& < > "]]
9447 !! result
9448 <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>
9449 </p>
9450 !! end
9451
9452 !! test
9453 BUG 499: Alt text should have &#1234;, not &amp;1234;
9454 !! input
9455 [[Image:foobar.jpg|&#9792;]]
9456 !! result
9457 <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>
9458 </p>
9459 !! end
9460
9461 !! test
9462 Broken image caption with link
9463 !! input
9464 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
9465 !! result
9466 <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.
9467 </p>
9468 !! end
9469
9470 !! test
9471 Image caption containing another image
9472 !! input
9473 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
9474 !! result
9475 <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>
9476
9477 !! end
9478
9479 !! test
9480 Image caption containing a newline
9481 !! input
9482 [[Image:Foobar.jpg|This
9483 *is some text]]
9484 !! result
9485 <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>
9486 </p>
9487 !!end
9488
9489 !!test
9490 Parsoid: Image caption containing leading space
9491 (The leading space should not trigger nowiki escaping in wt2wt mode)
9492 !! input
9493 [[Image:Foobar.jpg|thumb| bar]]
9494 !! result
9495 <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>
9496
9497 !!end
9498
9499 !! test
9500 Bug 3090: External links other than http: in image captions
9501 !! input
9502 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
9503 !! result
9504 <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>
9505
9506 !! end
9507
9508 !! test
9509 Custom class
9510 !! input
9511 [[Image:foobar.jpg|a|class=b]]
9512 !! result
9513 <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>
9514 </p>
9515 !! end
9516
9517 !! test
9518 Localized image handling (1).
9519 !! options
9520 language=es
9521 !! input
9522 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
9523 !! result
9524 <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>
9525
9526 !! end
9527
9528 !! test
9529 Localized image handling (2).
9530 !! options
9531 language=es
9532 !! input
9533 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
9534 !! result
9535 <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>
9536
9537 !! end
9538
9539 !! test
9540 "border", "frameless" and "class" attributes on an image.
9541 !! input
9542 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
9543 !! result
9544 <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>
9545 </p>
9546 !! end
9547
9548 !! article
9549 File:Barfoo.jpg
9550 !! text
9551 #REDIRECT [[File:Barfoo.jpg]]
9552 !! endarticle
9553
9554 !! test
9555 Redirected image
9556 !! input
9557 [[Image:Barfoo.jpg]]
9558 !! result
9559 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
9560 </p>
9561 !! end
9562
9563 !! test
9564 Missing image with uploads disabled
9565 !! options
9566 wgEnableUploads=0
9567 !! input
9568 [[Image:Foobaz.jpg]]
9569 !! result
9570 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
9571 </p>
9572 !! end
9573
9574 # Parsoid-specific testing for images
9575 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
9576 # Currently imperfect due to a flaw in the Parsoid testrunner
9577 # Work in progress
9578 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
9579 # image tests.
9580
9581 !! test
9582 Parsoid-specific image handling - simple image with size and middle alignment
9583 !! options
9584 parsoid
9585 !! input
9586 [[Image:Foobar.jpg|50px|middle]]
9587 !! result
9588 <p>
9589 <span class="mw-valign-middle" typeof="mw:Image">
9590 <a href="File:Foobar.jpg">
9591 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
9592 </a>
9593 </span>
9594 </p>
9595 !! end
9596
9597 !! test
9598 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
9599 !! options
9600 parsoid
9601 !! input
9602 [[Image:Foobar.jpg|500x10px|baseline|caption]]
9603 !! result
9604 <p>
9605 <span class="mw-valign-baseline" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
9606 <a href="File:Foobar.jpg">
9607 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89">
9608 </a>
9609 </span>
9610 </p>
9611 !! end
9612
9613 !! test
9614 Parsoid-specific image handling - simple image with border and size spec
9615 !! options
9616 parsoid
9617 !! input
9618 [[Image:Foobar.jpg|50px|border|caption]]
9619 !! result
9620 <p>
9621 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
9622 <a href="File:Foobar.jpg">
9623 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
9624 </a>
9625 </span>
9626 </p>
9627 !! end
9628
9629 !! test
9630 Parsoid-specific image handling - thumbnail with halign, valign, and caption
9631 !! options
9632 parsoid
9633 !! input
9634 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
9635 !! result
9636 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
9637 <a href="File:Foobar.jpg">
9638 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="21" width="180" />
9639 </a>
9640 <figcaption>caption content</figcaption>
9641 </figure>
9642 !! end
9643
9644 !! test
9645 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
9646 !! options
9647 parsoid
9648 !! input
9649 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
9650 !! result
9651 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
9652 <a href="File:Foobar.jpg">
9653 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
9654 </a>
9655 <figcaption>caption</figcaption>
9656 </figure>
9657 !! end
9658
9659 !! test
9660 Parsoid-specific image handling - framed image with specific size and caption
9661 !! options
9662 parsoid
9663 !! input
9664 [[Image:Foobar.jpg|500x50px|frame|caption]]
9665 !! result
9666 <figure typeof="mw:Image/Frame">
9667 <a href="File:Foobar.jpg">
9668 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9669 </a>
9670 <figcaption>caption</figcaption>
9671 </figure>
9672 !! end
9673
9674 !! test
9675 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
9676 !! options
9677 parsoid
9678 !! input
9679 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
9680 !! result
9681 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
9682 <a href="File:Foobar.jpg">
9683 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9684 </a>
9685 <figcaption>caption</figcaption>
9686 </figure>
9687 !! end
9688
9689 !! test
9690 Parsoid-specific image handling - frameless image with specific size, border, and caption
9691 !! options
9692 parsoid
9693 !! input
9694 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
9695 !! result
9696 <p>
9697 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
9698 <a href="File:Foobar.jpg">
9699 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9700 </a>
9701 </p>
9702 !! end
9703
9704 #!! test
9705 #Parsoid-specific image handling - simple image with a formatted caption
9706 #!! options
9707 #parsoid
9708 #!! input
9709 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
9710 #!! result
9711 #<p>
9712 #<span typeof="mw:Image">
9713 #<a class="mw-default-size" href="Image:Foobar.jpg">
9714 #<img alt="Foobar.jpg" class="mw-default-size" src="http://example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
9715 #</a>
9716 #<span>abc</span>
9717 #</span>
9718 #</p>
9719
9720
9721 ###
9722 ### Subpages
9723 ###
9724 !! article
9725 Subpage test/subpage
9726 !! text
9727 foo
9728 !! endarticle
9729
9730 !! test
9731 Subpage link
9732 !! options
9733 subpage title=[[Subpage test]]
9734 !! input
9735 [[/subpage]]
9736 !! result
9737 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
9738 </p>
9739 !! end
9740
9741 !! test
9742 Subpage noslash link
9743 !! options
9744 subpage title=[[Subpage test]]
9745 !!input
9746 [[/subpage/]]
9747 !! result
9748 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
9749 </p>
9750 !! end
9751
9752 # TODO: make this PHP-parser compatible!
9753 !! test
9754 Relative subpage noslash link
9755 !! options
9756 parsoid=wt2wt,wt2html,html2html
9757 subpage title=[[Subpage test/1/2/3/4]]
9758 !!input
9759 [[../../subpage/]]
9760
9761 [[../../subpage]]
9762 !! result
9763 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
9764 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
9765 !! end
9766
9767 # TODO: make this PHP-parser compatible!
9768 !! test
9769 Parsoid: dot-slash prefixed wikilinks
9770 !! options
9771 parsoid=wt2wt,wt2html,html2html
9772 !!input
9773 [[./foo]]
9774
9775 [[././bar]]
9776
9777 [[././baz/]]
9778 !! result
9779 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
9780 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
9781 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
9782 !! end
9783
9784 !! test
9785 Disabled subpages
9786 !! input
9787 [[/subpage]]
9788 !! result
9789 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
9790 </p>
9791 !! end
9792
9793 !! test
9794 BUG 561: {{/Subpage}}
9795 !! options
9796 subpage title=[[Page]]
9797 !! input
9798 {{/Subpage}}
9799 !! result
9800 <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>
9801 </p>
9802 !! end
9803
9804 ###
9805 ### Categories
9806 ###
9807 !! article
9808 Category:MediaWiki User's Guide
9809 !! text
9810 blah
9811 !! endarticle
9812
9813 !! test
9814 Link to category
9815 !! input
9816 [[:Category:MediaWiki User's Guide]]
9817 !! result
9818 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
9819 </p>
9820 !! end
9821
9822 !! test
9823 Simple category
9824 !! options
9825 cat
9826 !! input
9827 [[Category:MediaWiki User's Guide]]
9828 !! result
9829 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9830 !! end
9831
9832 !! test
9833 PAGESINCATEGORY invalid title fatal (r33546 fix)
9834 !! input
9835 {{PAGESINCATEGORY:<bogus>}}
9836 !! result
9837 <p>0
9838 </p>
9839 !! end
9840
9841 !! test
9842 Category with different sort key
9843 !! options
9844 cat
9845 !! input
9846 [[Category:MediaWiki User's Guide|Foo]]
9847 !! result
9848 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9849 !! end
9850
9851 !! test
9852 Category with identical sort key
9853 !! options
9854 cat
9855 !! input
9856 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
9857 !! result
9858 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9859 !! end
9860
9861 !! test
9862 Category with empty sort key
9863 !! options
9864 cat
9865 pst
9866 !! input
9867 [[Category:MediaWiki User's Guide|]]
9868 !! result
9869 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
9870 !! end
9871
9872 !! test
9873 Category with empty sort key and parentheses
9874 !! options
9875 cat
9876 pst
9877 !! input
9878 [[Category:Foo (bar)|]]
9879 !! result
9880 [[Category:Foo (bar)|Foo]]
9881 !! end
9882
9883 !! test
9884 Category with link tail
9885 !! options
9886 cat
9887 pst
9888 !! input
9889 123[[Category:Foo]]456
9890 !! result
9891 123[[Category:Foo]]456
9892 !! end
9893
9894 !! test
9895 Category with template
9896 !! options
9897 cat
9898 pst
9899 !! input
9900 [[Category:{{echo|Foo}}]]
9901 !! result
9902 [[Category:{{echo|Foo}}]]
9903 !! end
9904
9905 !! test
9906 Category with template in sort key
9907 !! options
9908 cat
9909 pst
9910 !! input
9911 [[Category:Foo|{{echo|Bar}}]]
9912 !! result
9913 [[Category:Foo|{{echo|Bar}}]]
9914 !! end
9915
9916 !! test
9917 Category with template in sort key and title
9918 !! options
9919 cat
9920 pst
9921 !! input
9922 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
9923 !! result
9924 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
9925 !! end
9926
9927 !! test
9928 Category / paragraph interactions
9929 !! input
9930 Foo [[Category:Baz]] Bar
9931
9932 Foo [[Category:Baz]]
9933 Bar
9934
9935 Foo
9936 [[Category:Baz]]
9937 Bar
9938
9939 Foo
9940 [[Category:Baz]] Bar
9941
9942 Foo
9943 [[Category:Baz]]
9944 [[Category:Baz]]
9945 [[Category:Baz]]
9946 Bar
9947
9948 [[Category:Baz]]
9949 [[Category:Baz]]
9950 [[Category:Baz]]
9951
9952 [[Category:Baz]]
9953 {{echo|[[Category:Baz]]}}
9954 [[Category:Baz]]
9955 !! result
9956 <p>Foo Bar
9957 </p><p>Foo
9958 Bar
9959 </p><p>Foo
9960 Bar
9961 </p><p>Foo Bar
9962 </p><p>Foo
9963 Bar
9964 </p>
9965 !! end
9966
9967 !! test
9968 Parsoid: Serialize link to category page with colon escape
9969 !! options
9970 parsoid
9971 !! input
9972
9973 [[:Category:Foo]]
9974 [[:Category:Foo|Bar]]
9975 !! result
9976 <p>
9977 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
9978 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
9979 </p>
9980 !! end
9981
9982 !! test
9983 Parsoid: Link prefix/suffixes aren't applied to category links
9984 !! options
9985 parsoid=wt2html,wt2wt,html2html
9986 language=is
9987 !! input
9988 x[[Category:Foo]]y
9989 !! result
9990 <p>x<link rel="mw:WikiLink/Category" href="Category:Foo">y</p>
9991 !! end
9992
9993 !! test
9994 Parsoid: Serialize link to file page with colon escape
9995 !! options
9996 parsoid
9997 !! input
9998
9999 [[:File:Foo.png]]
10000 [[:File:Foo.png|Bar]]
10001 !! result
10002 <p>
10003 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
10004 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
10005 </p>
10006 !! end
10007
10008 !! test
10009 Parsoid: Serialize a genuine category link without colon escape
10010 !! options
10011 parsoid
10012 !! input
10013 [[Category:Foo]]
10014 [[Category:Foo|Bar]]
10015 !! result
10016 <link rel="mw:WikiLink/Category" href="Category:Foo">
10017 <link rel="mw:WikiLink/Category" href="Category:Foo#Bar">
10018 !! end
10019
10020 ###
10021 ### Inter-language links
10022 ###
10023 !! test
10024 Inter-language links
10025 !! options
10026 ill
10027 !! input
10028 [[es:Alimento]]
10029 [[fr:Nourriture]]
10030 [[zh:&#39135;&#21697;]]
10031 !! result
10032 es:Alimento fr:Nourriture zh:食品
10033 !! end
10034
10035 !! test
10036 Duplicate interlanguage links (bug 24502)
10037 !! options
10038 ill
10039 !! input
10040 [[es:1]]
10041 [[es:2]]
10042 [[fr:1]]
10043 [[fr:2]]
10044 !! result
10045 es:1 fr:1
10046 !! end
10047
10048 ###
10049 ### Sections
10050 ###
10051 !! test
10052 Basic section headings
10053 !! input
10054 == Headline 1 ==
10055 Some text
10056
10057 ==Headline 2==
10058 More
10059 ===Smaller headline===
10060 Blah blah
10061 !! result
10062 <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>
10063 <p>Some text
10064 </p>
10065 <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>
10066 <p>More
10067 </p>
10068 <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>
10069 <p>Blah blah
10070 </p>
10071 !! end
10072
10073 !! test
10074 Section headings with TOC
10075 !! input
10076 == Headline 1 ==
10077 === Subheadline 1 ===
10078 ===== Skipping a level =====
10079 ====== Skipping a level ======
10080
10081 == Headline 2 ==
10082 Some text
10083 ===Another headline===
10084 !! result
10085 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10086 <ul>
10087 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
10088 <ul>
10089 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
10090 <ul>
10091 <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>
10092 <ul>
10093 <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>
10094 </ul>
10095 </li>
10096 </ul>
10097 </li>
10098 </ul>
10099 </li>
10100 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
10101 <ul>
10102 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
10103 </ul>
10104 </li>
10105 </ul>
10106 </div>
10107
10108 <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>
10109 <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>
10110 <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>
10111 <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>
10112 <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>
10113 <p>Some text
10114 </p>
10115 <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>
10116
10117 !! end
10118
10119 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
10120 !! test
10121 Handling of sections up to level 6 and beyond
10122 !! input
10123 = Level 1 Heading=
10124 == Level 2 Heading==
10125 === Level 3 Heading===
10126 ==== Level 4 Heading====
10127 ===== Level 5 Heading=====
10128 ====== Level 6 Heading======
10129 ======= Level 7 Heading=======
10130 ======== Level 8 Heading========
10131 ========= Level 9 Heading=========
10132 ========== Level 10 Heading==========
10133 !! result
10134 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10135 <ul>
10136 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
10137 <ul>
10138 <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>
10139 <ul>
10140 <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>
10141 <ul>
10142 <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>
10143 <ul>
10144 <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>
10145 <ul>
10146 <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>
10147 <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>
10148 <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>
10149 <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>
10150 <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>
10151 </ul>
10152 </li>
10153 </ul>
10154 </li>
10155 </ul>
10156 </li>
10157 </ul>
10158 </li>
10159 </ul>
10160 </li>
10161 </ul>
10162 </div>
10163
10164 <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>
10165 <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>
10166 <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>
10167 <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>
10168 <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>
10169 <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>
10170 <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>
10171 <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>
10172 <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>
10173 <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>
10174
10175 !! end
10176
10177 !! test
10178 TOC regression (bug 9764)
10179 !! input
10180 == title 1 ==
10181 === title 1.1 ===
10182 ==== title 1.1.1 ====
10183 === title 1.2 ===
10184 == title 2 ==
10185 === title 2.1 ===
10186 !! result
10187 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10188 <ul>
10189 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
10190 <ul>
10191 <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>
10192 <ul>
10193 <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>
10194 </ul>
10195 </li>
10196 <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>
10197 </ul>
10198 </li>
10199 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
10200 <ul>
10201 <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>
10202 </ul>
10203 </li>
10204 </ul>
10205 </div>
10206
10207 <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>
10208 <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>
10209 <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>
10210 <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>
10211 <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>
10212 <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>
10213
10214 !! end
10215
10216 !! test
10217 TOC with wgMaxTocLevel=3 (bug 6204)
10218 !! options
10219 wgMaxTocLevel=3
10220 !! input
10221 == title 1 ==
10222 === title 1.1 ===
10223 ==== title 1.1.1 ====
10224 === title 1.2 ===
10225 == title 2 ==
10226 === title 2.1 ===
10227 !! result
10228 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10229 <ul>
10230 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
10231 <ul>
10232 <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>
10233 <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>
10234 </ul>
10235 </li>
10236 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
10237 <ul>
10238 <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>
10239 </ul>
10240 </li>
10241 </ul>
10242 </div>
10243
10244 <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>
10245 <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>
10246 <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>
10247 <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>
10248 <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>
10249 <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>
10250
10251 !! end
10252
10253 !! test
10254 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
10255 !! options
10256 wgMaxTocLevel=3
10257 !! input
10258 ==Section 1==
10259 ===Section 1.1===
10260 ====Section 1.1.1====
10261 ====Section 1.1.1.1====
10262 ==Section 2==
10263 !! result
10264 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10265 <ul>
10266 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
10267 <ul>
10268 <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>
10269 </ul>
10270 </li>
10271 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
10272 </ul>
10273 </div>
10274
10275 <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>
10276 <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>
10277 <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>
10278 <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>
10279 <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>
10280
10281 !! end
10282
10283
10284 !! test
10285 Resolving duplicate section names
10286 !! input
10287 == Foo bar ==
10288 == Foo bar ==
10289 !! result
10290 <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>
10291 <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>
10292
10293 !! end
10294
10295 !! test
10296 Resolving duplicate section names with differing case (bug 10721)
10297 !! input
10298 == Foo bar ==
10299 == Foo Bar ==
10300 !! result
10301 <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>
10302 <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>
10303
10304 !! end
10305
10306 !! article
10307 Template:sections
10308 !! text
10309 ===Section 1===
10310 ==Section 2==
10311 !! endarticle
10312
10313 !! test
10314 Template with sections, __NOTOC__
10315 !! input
10316 __NOTOC__
10317 ==Section 0==
10318 {{sections}}
10319 ==Section 4==
10320 !! result
10321 <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>
10322 <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>
10323 <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>
10324 <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>
10325
10326 !! end
10327
10328 !! test
10329 __NOEDITSECTION__ keyword
10330 !! input
10331 __NOEDITSECTION__
10332 ==Section 1==
10333 ==Section 2==
10334 !! result
10335 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
10336 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
10337
10338 !! end
10339
10340 !! test
10341 Link inside a section heading
10342 !! input
10343 ==Section with a [[Main Page|link]] in it==
10344 !! result
10345 <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>
10346
10347 !! end
10348
10349 !! test
10350 TOC regression (bug 12077)
10351 !! input
10352 __TOC__
10353 == title 1 ==
10354 === title 1.1 ===
10355 == title 2 ==
10356 !! result
10357 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10358 <ul>
10359 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
10360 <ul>
10361 <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>
10362 </ul>
10363 </li>
10364 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
10365 </ul>
10366 </div>
10367
10368 <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>
10369 <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>
10370 <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>
10371
10372 !! end
10373
10374 !! test
10375 BUG 1219 URL next to image (good)
10376 !! input
10377 http://example.com [[Image:foobar.jpg]]
10378 !! result
10379 <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>
10380 </p>
10381 !!end
10382
10383 !! test
10384 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
10385 !! input
10386 ===
10387 The line above must have a trailing space!
10388 === <!--
10389 --> <!-- -->
10390 But just in case it doesn't...
10391 !! result
10392 <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>
10393 <p>The line above must have a trailing space!
10394 </p>
10395 <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>
10396 <p>But just in case it doesn't...
10397 </p>
10398 !! end
10399
10400 !! test
10401 Header with special characters (bug 25462)
10402 !! input
10403 The tooltips shall not show entities to the user (ie. be double escaped)
10404
10405 == text > text ==
10406 section 1
10407
10408 == text < text ==
10409 section 2
10410
10411 == text & text ==
10412 section 3
10413
10414 == text ' text ==
10415 section 4
10416
10417 == text " text ==
10418 section 5
10419 !! result
10420 <p>The tooltips shall not show entities to the user (ie. be double escaped)
10421 </p>
10422 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10423 <ul>
10424 <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>
10425 <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>
10426 <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>
10427 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
10428 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
10429 </ul>
10430 </div>
10431
10432 <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>
10433 <p>section 1
10434 </p>
10435 <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>
10436 <p>section 2
10437 </p>
10438 <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>
10439 <p>section 3
10440 </p>
10441 <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>
10442 <p>section 4
10443 </p>
10444 <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>
10445 <p>section 5
10446 </p>
10447 !! end
10448
10449 !! test
10450 Headers with excess '=' characters
10451 (Are similar tests necessary beyond the 1st level?)
10452 !! input
10453 =foo==
10454 ==foo=
10455 =''italic'' heading==
10456 ==''italic'' heading=
10457 !! result
10458 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10459 <ul>
10460 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
10461 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
10462 <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>
10463 <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>
10464 </ul>
10465 </div>
10466
10467 <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>
10468 <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>
10469 <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>
10470 <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>
10471
10472 !! end
10473
10474 !! test
10475 HTML headers vs TOC (bug 23393)
10476 (__NOEDITSECTION__ for clearer output, doesn't matter here)
10477 !! input
10478 <h1>Header 1</h1>
10479 == Header 1.1 ==
10480 == Header 1.2 ==
10481
10482 <h1>Header 2
10483 </h1>
10484 == Header 2.1 ==
10485 == Header 2.2 ==
10486 __NOEDITSECTION__
10487 !! result
10488 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10489 <ul>
10490 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
10491 <ul>
10492 <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>
10493 <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>
10494 </ul>
10495 </li>
10496 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
10497 <ul>
10498 <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>
10499 <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>
10500 </ul>
10501 </li>
10502 </ul>
10503 </div>
10504
10505 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
10506 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
10507 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
10508 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
10509 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
10510 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
10511
10512 !! end
10513
10514 !! test
10515 BUG 1219 URL next to image (broken)
10516 !! input
10517 http://example.com[[Image:foobar.jpg]]
10518 !! result
10519 <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>
10520 </p>
10521 !!end
10522
10523 !! test
10524 Bug 1186 news: in the middle of text
10525 !! input
10526 http://en.wikinews.org/wiki/Wikinews:Workplace
10527 !! result
10528 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
10529 </p>
10530 !!end
10531
10532
10533 !! test
10534 Namespaced link must have a title
10535 !! input
10536 [[Project:]]
10537 !! result
10538 <p>[[Project:]]
10539 </p>
10540 !!end
10541
10542 !! test
10543 Namespaced link must have a title (bad fragment version)
10544 !! input
10545 [[Project:#fragment]]
10546 !! result
10547 <p>[[Project:#fragment]]
10548 </p>
10549 !!end
10550
10551
10552 ###
10553 ### HTML tags and HTML attributes
10554 ###
10555
10556 !! test
10557 div with no attributes
10558 !! input
10559 <div>HTML rocks</div>
10560 !! result
10561 <div>HTML rocks</div>
10562
10563 !! end
10564
10565 !! test
10566 div with double-quoted attribute
10567 !! input
10568 <div id="rock">HTML rocks</div>
10569 !! result
10570 <div id="rock">HTML rocks</div>
10571
10572 !! end
10573
10574 !! test
10575 div with single-quoted attribute
10576 !! input
10577 <div id='rock'>HTML rocks</div>
10578 !! result
10579 <div id="rock">HTML rocks</div>
10580
10581 !! end
10582
10583 !! test
10584 div with unquoted attribute
10585 !! input
10586 <div id=rock>HTML rocks</div>
10587 !! result
10588 <div id="rock">HTML rocks</div>
10589
10590 !! end
10591
10592 !! test
10593 div with illegal double attributes
10594 !! input
10595 <div id="a" id="b">HTML rocks</div>
10596 !! result
10597 <div id="b">HTML rocks</div>
10598
10599 !!end
10600
10601 # FIXME: produce empty string instead of "class" in the PHP parser, following
10602 # the HTML5 spec.
10603 !! test
10604 div with empty attribute value, space before equals
10605 !! options
10606 parsoid
10607 !! input
10608 <div class =>HTML rocks</div>
10609 !! result
10610 <div class="">HTML rocks</div>
10611
10612 !! end
10613
10614 # The PHP parser escapes the opening brace to &#123; for some reason, so
10615 # disabled this test for it.
10616 !! test
10617 div with braces in attribute value
10618 !! options
10619 parsoid
10620 !! input
10621 <div title="{}">Foo</div>
10622 !! result
10623 <div title="{}">Foo</div>
10624 !! end
10625
10626 # This it very inconsistent in the PHP parser: it returns
10627 # class="class" if there is a space between the name and the equal sign (see
10628 # 'div with empty attribute value, space before equals'), but strips the
10629 # attribute completely if the space is missing. We hope that not much content
10630 # depends on this, so are implementing the behavior below in Parsoid for
10631 # consistencies' sake. Disabled for the PHP parser.
10632 # FIXME: fix this behavior in the PHP parser?
10633 !! test
10634 div with empty attribute value, no space before equals
10635 !! options
10636 parsoid
10637 !! input
10638 <div class=>HTML rocks</div>
10639 !! result
10640 <div class="">HTML rocks</div>
10641
10642 !! end
10643
10644 !! test
10645 HTML multiple attributes correction
10646 !! input
10647 <p class="error" class="awesome">Awesome!</p>
10648 !! result
10649 <p class="awesome">Awesome!</p>
10650
10651 !!end
10652
10653 !! test
10654 Table multiple attributes correction
10655 !! input
10656 {|
10657 !+ class="error" class="awesome"| status
10658 |}
10659 !! result
10660 <table>
10661 <tr>
10662 <th class="awesome"> status
10663 </th></tr></table>
10664
10665 !!end
10666
10667 !! test
10668 DIV IN UPPERCASE
10669 !! input
10670 <DIV ID="x">HTML ROCKS</DIV>
10671 !! result
10672 <div id="x">HTML ROCKS</div>
10673
10674 !!end
10675
10676 !! test
10677 Non-ASCII pseudo-tags are rendered as text
10678 !! input
10679 <khyô>
10680 !! result
10681 <p>&lt;khyô&gt;
10682 </p>
10683 !! end
10684
10685 !! test
10686 Pseudo-tag with URL 'name' renders as url link
10687 !! input
10688 <http://example.com/>
10689 !! result
10690 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
10691 </p>
10692 !! end
10693
10694 !! test
10695 text with amp in the middle of nowhere
10696 !! input
10697 Remember AT&T?
10698 !!result
10699 <p>Remember AT&amp;T?
10700 </p>
10701 !! end
10702
10703 !! test
10704 text with character entity: eacute
10705 !! input
10706 I always thought &eacute; was a cute letter.
10707 !! result
10708 <p>I always thought &#233; was a cute letter.
10709 </p>
10710 !! end
10711
10712 !! test
10713 text with entity-escaped character entity-like string: eacute
10714 !! input
10715 I always thought &amp;eacute; was a cute letter.
10716 !! result
10717 <p>I always thought &amp;eacute; was a cute letter.
10718 </p>
10719 !! end
10720
10721 !! test
10722 text with undefined character entity: xacute
10723 !! input
10724 I always thought &xacute; was a cute letter.
10725 !! result
10726 <p>I always thought &amp;xacute; was a cute letter.
10727 </p>
10728 !! end
10729
10730
10731 ###
10732 ### Nesting tests (see bug 41545, 50604, 51081)
10733 ###
10734
10735 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
10736 # Note that html2wt is considerably more difficult if we use <b> in
10737 # the test case, instead of <big>
10738 !! test
10739 Ensure that HTML adoption agency algorithm is properly implemented.
10740 !! input
10741 <big>X<big>Y</big>Z</big>
10742 !! result
10743 <p><big>X<big>Y</big>Z</big>
10744 </p>
10745 !! end
10746
10747 # This was bug 41545 in the PHP parser.
10748 !! test
10749 Nesting of <kbd>
10750 !! input
10751 <kbd>X<kbd>Y</kbd>Z</kbd>
10752 !! result
10753 <p><kbd>X<kbd>Y</kbd>Z</kbd>
10754 </p>
10755 !! end
10756
10757 # The following cases were bug 51081 in the PHP parser.
10758 # Note that there are some other nestable tags (b, i, etc) which are
10759 # not covered; see bug 51081 for discussion.
10760 !! test
10761 Nesting of <em>
10762 !! input
10763 <em>X<em>Y</em>Z</em>
10764 !! result
10765 <p><em>X<em>Y</em>Z</em>
10766 </p>
10767 !! end
10768
10769 !! test
10770 Nesting of <strong>
10771 !! input
10772 <strong>X<strong>Y</strong>Z</strong>
10773 !! result
10774 <p><strong>X<strong>Y</strong>Z</strong>
10775 </p>
10776 !! end
10777
10778 !! test
10779 Nesting of <q>
10780 !! input
10781 <q>X<q>Y</q>Z</q>
10782 !! result
10783 <p><q>X<q>Y</q>Z</q>
10784 </p>
10785 !! end
10786
10787 !! test
10788 Nesting of <ruby>
10789 !! input
10790 <ruby>X<ruby>Y</ruby>Z</ruby>
10791 !! result
10792 <p><ruby>X<ruby>Y</ruby>Z</ruby>
10793 </p>
10794 !! end
10795
10796 !! test
10797 Nesting of <bdo>
10798 !! input
10799 <bdo>X<bdo>Y</bdo>Z</bdo>
10800 !! result
10801 <p><bdo>X<bdo>Y</bdo>Z</bdo>
10802 </p>
10803 !! end
10804
10805
10806 ###
10807 ### Media links
10808 ###
10809
10810 !! test
10811 Media link
10812 !! input
10813 [[Media:Foobar.jpg]]
10814 !! result
10815 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
10816 </p>
10817 !! end
10818
10819 !! test
10820 Media link with text
10821 !! input
10822 [[Media:Foobar.jpg|A neat file to look at]]
10823 !! result
10824 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
10825 </p>
10826 !! end
10827
10828 # FIXME: this is still bad HTML tag nesting
10829 !! test
10830 Media link with nasty text
10831 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
10832 !! input
10833 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
10834 !! result
10835 <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>
10836
10837 !! end
10838
10839 !! test
10840 Media link to nonexistent file (bug 1702)
10841 !! input
10842 [[Media:No such.jpg]]
10843 !! result
10844 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
10845 </p>
10846 !! end
10847
10848 !! test
10849 Image link to nonexistent file (bug 1850 - good)
10850 !! input
10851 [[Image:No such.jpg]]
10852 !! result
10853 <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>
10854 </p>
10855 !! end
10856
10857 !! test
10858 :Image link to nonexistent file (bug 1850 - bad)
10859 !! input
10860 [[:Image:No such.jpg]]
10861 !! result
10862 <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>
10863 </p>
10864 !! end
10865
10866
10867
10868 !! test
10869 Character reference normalization in link text (bug 1938)
10870 !! input
10871 [[Main Page|this&that]]
10872 !! result
10873 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
10874 </p>
10875 !!end
10876
10877 !! article
10878 אַ
10879 !! text
10880 Test for unicode normalization
10881
10882 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
10883 !! endarticle
10884
10885 !! test
10886 (bug 19451) Links should refer to the normalized form.
10887 !! input
10888 [[&#xFB2E;]]
10889 [[&#x5d0;&#x5b7;]]
10890 [[&#x5d0;ַ]]
10891 [[א&#x5b7;]]
10892 [[אַ]]
10893 !! result
10894 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
10895 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
10896 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
10897 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
10898 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
10899 </p>
10900 !! end
10901
10902 !! test
10903 Empty attribute crash test (bug 2067)
10904 !! input
10905 <font color="">foo</font>
10906 !! result
10907 <p><font color="">foo</font>
10908 </p>
10909 !! end
10910
10911 !! test
10912 Empty attribute crash test single-quotes (bug 2067)
10913 !! input
10914 <font color=''>foo</font>
10915 !! result
10916 <p><font color="">foo</font>
10917 </p>
10918 !! end
10919
10920 !! test
10921 Attribute test: equals, then nothing
10922 !! input
10923 <font color=>foo</font>
10924 !! result
10925 <p><font>foo</font>
10926 </p>
10927 !! end
10928
10929 !! test
10930 Attribute test: unquoted value
10931 !! input
10932 <font color=x>foo</font>
10933 !! result
10934 <p><font color="x">foo</font>
10935 </p>
10936 !! end
10937
10938 !! test
10939 Attribute test: unquoted but illegal value (hash)
10940 !! input
10941 <font color=#x>foo</font>
10942 !! result
10943 <p><font color="#x">foo</font>
10944 </p>
10945 !! end
10946
10947 !! test
10948 Attribute test: no value
10949 !! input
10950 <font color>foo</font>
10951 !! result
10952 <p><font color="color">foo</font>
10953 </p>
10954 !! end
10955
10956 !! test
10957 Bug 2095: link with three closing brackets
10958 !! input
10959 [[Main Page]]]
10960 !! result
10961 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
10962 </p>
10963 !! end
10964
10965 !! test
10966 Bug 2095: link with pipe and three closing brackets
10967 !! input
10968 [[Main Page|link]]]
10969 !! result
10970 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
10971 </p>
10972 !! end
10973
10974 !! test
10975 Bug 2095: link with pipe and three closing brackets, version 2
10976 !! input
10977 [[Main Page|[http://example.com/]]]
10978 !! result
10979 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
10980 </p>
10981 !! end
10982
10983
10984 ###
10985 ### Safety
10986 ###
10987
10988 !! article
10989 Template:Dangerous attribute
10990 !! text
10991 " onmouseover="alert(document.cookie)
10992 !! endarticle
10993
10994 !! article
10995 Template:Dangerous style attribute
10996 !! text
10997 border-size: expression(alert(document.cookie))
10998 !! endarticle
10999
11000 !! article
11001 Template:Div style
11002 !! text
11003 <div style="float: right; {{{1}}}">Magic div</div>
11004 !! endarticle
11005
11006 !! test
11007 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
11008 !! input
11009 <div title="{{test}}"></div>
11010 !! result
11011 <div title="This is a test template"></div>
11012
11013 !! end
11014
11015 !! test
11016 Bug 2304: HTML attribute safety (dangerous template; 2309)
11017 !! input
11018 <div title="{{dangerous attribute}}"></div>
11019 !! result
11020 <div title=""></div>
11021
11022 !! end
11023
11024 !! test
11025 Bug 2304: HTML attribute safety (dangerous style template; 2309)
11026 !! input
11027 <div style="{{dangerous style attribute}}"></div>
11028 !! result
11029 <div style="/* insecure input */"></div>
11030
11031 !! end
11032
11033 !! test
11034 Bug 2304: HTML attribute safety (safe parameter; 2309)
11035 !! input
11036 {{div style|width: 200px}}
11037 !! result
11038 <div style="float: right; width: 200px">Magic div</div>
11039
11040 !! end
11041
11042 !! test
11043 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
11044 !! input
11045 {{div style|width: expression(alert(document.cookie))}}
11046 !! result
11047 <div style="/* insecure input */">Magic div</div>
11048
11049 !! end
11050
11051 !! test
11052 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
11053 !! input
11054 {{div style|"><script>alert(document.cookie)</script>}}
11055 !! result
11056 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
11057
11058 !! end
11059
11060 !! test
11061 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
11062 !! input
11063 {{div style|" ><script>alert(document.cookie)</script>}}
11064 !! result
11065 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
11066
11067 !! end
11068
11069 !! test
11070 Bug 2304: HTML attribute safety (link)
11071 !! input
11072 <div title="[[Main Page]]"></div>
11073 !! result
11074 <div title="&#91;&#91;Main Page]]"></div>
11075
11076 !! end
11077
11078 !! test
11079 Bug 2304: HTML attribute safety (italics)
11080 !! input
11081 <div title="''foobar''"></div>
11082 !! result
11083 <div title="&#39;&#39;foobar&#39;&#39;"></div>
11084
11085 !! end
11086
11087 !! test
11088 Bug 2304: HTML attribute safety (bold)
11089 !! input
11090 <div title="'''foobar'''"></div>
11091 !! result
11092 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
11093
11094 !! end
11095
11096
11097 !! test
11098 Bug 2304: HTML attribute safety (ISBN)
11099 !! input
11100 <div title="ISBN 1234567890"></div>
11101 !! result
11102 <div title="&#73;SBN 1234567890"></div>
11103
11104 !! end
11105
11106 !! test
11107 Bug 2304: HTML attribute safety (RFC)
11108 !! input
11109 <div title="RFC 1234"></div>
11110 !! result
11111 <div title="&#82;FC 1234"></div>
11112
11113 !! end
11114
11115 !! test
11116 Bug 2304: HTML attribute safety (PMID)
11117 !! input
11118 <div title="PMID 1234567890"></div>
11119 !! result
11120 <div title="&#80;MID 1234567890"></div>
11121
11122 !! end
11123
11124 !! test
11125 Bug 2304: HTML attribute safety (web link)
11126 !! input
11127 <div title="http://example.com/"></div>
11128 !! result
11129 <div title="http&#58;//example.com/"></div>
11130
11131 !! end
11132
11133 !! test
11134 Bug 2304: HTML attribute safety (named web link)
11135 !! input
11136 <div title="[http://example.com/ link]"></div>
11137 !! result
11138 <div title="&#91;http&#58;//example.com/ link]"></div>
11139
11140 !! end
11141
11142 !! test
11143 Bug 3244: HTML attribute safety (extension; safe)
11144 !! input
11145 <div style="<nowiki>background:blue</nowiki>"></div>
11146 !! result
11147 <div style="background:blue"></div>
11148
11149 !! end
11150
11151 !! test
11152 Bug 3244: HTML attribute safety (extension; unsafe)
11153 !! input
11154 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
11155 !! result
11156 <div style="/* insecure input */"></div>
11157
11158 !! end
11159
11160 # More MSIE fun discovered by Tom Gilder
11161
11162 !! test
11163 MSIE CSS safety test: spurious slash
11164 !! input
11165 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
11166 !! result
11167 <div style="/* insecure input */">evil</div>
11168
11169 !! end
11170
11171 !! test
11172 MSIE CSS safety test: hex code
11173 !! input
11174 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
11175 !! result
11176 <div style="/* insecure input */">evil</div>
11177
11178 !! end
11179
11180 !! test
11181 MSIE CSS safety test: comment in url
11182 !! input
11183 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
11184 !! result
11185 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
11186
11187 !! end
11188
11189 !! test
11190 MSIE CSS safety test: comment in expression
11191 !! input
11192 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
11193 !! result
11194 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
11195
11196 !! end
11197
11198
11199 !! test
11200 Table attribute legitimate extension
11201 !! input
11202 {|
11203 !+ style="<nowiki>color:blue</nowiki>"| status
11204 |}
11205 !! result
11206 <table>
11207 <tr>
11208 <th style="color:blue"> status
11209 </th></tr></table>
11210
11211 !!end
11212
11213 !! test
11214 Table attribute safety
11215 !! input
11216 {|
11217 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
11218 |}
11219 !! result
11220 <table>
11221 <tr>
11222 <th style="/* insecure input */"> status
11223 </th></tr></table>
11224
11225 !! end
11226
11227 !! test
11228 CSS line continuation 1
11229 !! input
11230 <div style="background-image: u\&#10;rl(test.jpg);"></div>
11231 !! result
11232 <div style="/* insecure input */"></div>
11233
11234 !! end
11235
11236 !! test
11237 CSS line continuation 2
11238 !! input
11239 <div style="background-image: u\&#13;rl(test.jpg); "></div>
11240 !! result
11241 <div style="/* insecure input */"></div>
11242
11243 !! end
11244
11245 !! article
11246 Template:Identity
11247 !! text
11248 {{{1}}}
11249 !! endarticle
11250
11251 !! test
11252 Expansion of multi-line templates in attribute values (bug 6255)
11253 !! input
11254 <div style="background: {{identity|#00FF00}}">-</div>
11255 !! result
11256 <div style="background: #00FF00">-</div>
11257
11258 !! end
11259
11260
11261 !! test
11262 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
11263 !! input
11264 <div style="background:
11265 #00FF00">-</div>
11266 !! result
11267 <div style="background: #00FF00">-</div>
11268
11269 !! end
11270
11271 !! test
11272 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
11273 !! input
11274 <div style="background: &#10;#00FF00">-</div>
11275 !! result
11276 <div style="background: &#10;#00FF00">-</div>
11277
11278 !! end
11279
11280 ###
11281 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
11282 ###
11283 !! test
11284 Parser hook: empty input
11285 !! input
11286 <tag></tag>
11287 !! result
11288 <pre>
11289 ''
11290 array (
11291 )
11292 </pre>
11293
11294 !! end
11295
11296 !! test
11297 Parser hook: empty input using terminated empty elements
11298 !! input
11299 <tag/>
11300 !! result
11301 <pre>
11302 NULL
11303 array (
11304 )
11305 </pre>
11306
11307 !! end
11308
11309 !! test
11310 Parser hook: empty input using terminated empty elements (space before)
11311 !! input
11312 <tag />
11313 !! result
11314 <pre>
11315 NULL
11316 array (
11317 )
11318 </pre>
11319
11320 !! end
11321
11322 !! test
11323 Parser hook: basic input
11324 !! input
11325 <tag>input</tag>
11326 !! result
11327 <pre>
11328 'input'
11329 array (
11330 )
11331 </pre>
11332
11333 !! end
11334
11335
11336 !! test
11337 Parser hook: case insensitive
11338 !! input
11339 <TAG>input</TAG>
11340 !! result
11341 <pre>
11342 'input'
11343 array (
11344 )
11345 </pre>
11346
11347 !! end
11348
11349
11350 !! test
11351 Parser hook: case insensitive, redux
11352 !! input
11353 <TaG>input</TAg>
11354 !! result
11355 <pre>
11356 'input'
11357 array (
11358 )
11359 </pre>
11360
11361 !! end
11362
11363 !! test
11364 Parser hook: nested tags
11365 !! options
11366 noxml
11367 !! input
11368 <tag><tag></tag></tag>
11369 !! result
11370 <pre>
11371 '<tag>'
11372 array (
11373 )
11374 </pre>&lt;/tag&gt;
11375
11376 !! end
11377
11378 !! test
11379 Parser hook: basic arguments
11380 !! input
11381 <tag width=200 height = "100" depth = '50' square></tag>
11382 !! result
11383 <pre>
11384 ''
11385 array (
11386 'width' => '200',
11387 'height' => '100',
11388 'depth' => '50',
11389 'square' => 'square',
11390 )
11391 </pre>
11392
11393 !! end
11394
11395 !! test
11396 Parser hook: argument containing a forward slash (bug 5344)
11397 !! input
11398 <tag filename='/tmp/bla'></tag>
11399 !! result
11400 <pre>
11401 ''
11402 array (
11403 'filename' => '/tmp/bla',
11404 )
11405 </pre>
11406
11407 !! end
11408
11409 !! test
11410 Parser hook: empty input using terminated empty elements (bug 2374)
11411 !! input
11412 <tag foo=bar/>text
11413 !! result
11414 <pre>
11415 NULL
11416 array (
11417 'foo' => 'bar',
11418 )
11419 </pre>text
11420
11421 !! end
11422
11423 # </tag> should be output literally since there is no matching tag that begins it
11424 !! test
11425 Parser hook: basic arguments using terminated empty elements (bug 2374)
11426 !! input
11427 <tag width=200 height = "100" depth = '50' square/>
11428 other stuff
11429 </tag>
11430 !! result
11431 <pre>
11432 NULL
11433 array (
11434 'width' => '200',
11435 'height' => '100',
11436 'depth' => '50',
11437 'square' => 'square',
11438 )
11439 </pre>
11440 <p>other stuff
11441 &lt;/tag&gt;
11442 </p>
11443 !! end
11444
11445 ###
11446 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
11447 ###
11448
11449 !! test
11450 Parser hook: static parser hook not inside a comment
11451 !! input
11452 <statictag>hello, world</statictag>
11453 <statictag action=flush/>
11454 !! result
11455 <p>hello, world
11456 </p>
11457 !! end
11458
11459
11460 !! test
11461 Parser hook: static parser hook inside a comment
11462 !! input
11463 <!-- <statictag>hello, world</statictag> -->
11464 <statictag action=flush/>
11465 !! result
11466 <p><br />
11467 </p>
11468 !! end
11469
11470 # Nested template calls; this case was broken by Parser.php rev 1.506,
11471 # since reverted.
11472
11473 !! article
11474 Template:One-parameter
11475 !! text
11476 (My parameter is: {{{1}}})
11477 !! endarticle
11478
11479 !! article
11480 Template:Map-one-parameter
11481 !! text
11482 {{{{{1}}}|{{{2}}}}}
11483 !! endarticle
11484
11485 !! test
11486 Nested template calls
11487 !! input
11488 {{Map-one-parameter|One-parameter|param}}
11489 !! result
11490 <p>(My parameter is: param)
11491 </p>
11492 !! end
11493
11494
11495 ###
11496 ### Sanitizer
11497 ###
11498 !! test
11499 Sanitizer: Closing of open tags
11500 !! input
11501 <s></s><table></table>
11502 !! result
11503 <s></s><table></table>
11504
11505 !! end
11506
11507 !! test
11508 Sanitizer: Closing of open but not closed tags
11509 !! input
11510 <s>foo
11511 !! result
11512 <p><s>foo</s>
11513 </p>
11514 !! end
11515
11516 !! test
11517 Sanitizer: Closing of closed but not open tags
11518 !! input
11519 </s>
11520 !! result
11521 <p>&lt;/s&gt;
11522 </p>
11523 !! end
11524
11525 !! test
11526 Sanitizer: Closing of closed but not open table tags
11527 !! input
11528 Table not started</td></tr></table>
11529 !! result
11530 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
11531 </p>
11532 !! end
11533
11534 !! test
11535 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
11536 !! input
11537 <span id="æ: v">byte</span>[[#æ: v|backlink]]
11538 !! result
11539 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
11540 </p>
11541 !! end
11542
11543 !! test
11544 Sanitizer: Validating the contents of the id attribute (bug 4515)
11545 !! options
11546 disabled
11547 !! input
11548 <br id=9 />
11549 !! result
11550 Something, but definitely not <br id="9" />...
11551 !! end
11552
11553 !! test
11554 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
11555 !! options
11556 disabled
11557 !! input
11558 <br id="foo" /><br id="foo" />
11559 !! result
11560 Something need to be done. foo-2 ?
11561 !! end
11562
11563 !! test
11564 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
11565 !! input
11566 <div itemscope>
11567 <meta itemprop="hello" content="world">
11568 <meta http-equiv="refresh" content="5">
11569 <meta itemprop="hello" http-equiv="refresh" content="5">
11570 <link itemprop="hello" href="{{SERVER}}">
11571 <link rel="stylesheet" href="{{SERVER}}">
11572 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
11573 </div>
11574 !! result
11575 <div itemscope="itemscope">
11576 <p> <meta itemprop="hello" content="world" />
11577 &lt;meta http-equiv="refresh" content="5"&gt;
11578 <meta itemprop="hello" content="5" />
11579 </p>
11580 <link itemprop="hello" href="http&#58;//example.org" />
11581 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
11582 <link itemprop="hello" href="http&#58;//example.org" />
11583 </div>
11584
11585 !! end
11586
11587 !! test
11588 Language converter: output gets cut off unexpectedly (bug 5757)
11589 !! options
11590 language=zh
11591 !! input
11592 this bit is safe: }-
11593
11594 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
11595
11596 then we get cut off here: }-
11597
11598 all additional text is vanished
11599 !! result
11600 <p>this bit is safe: }-
11601 </p><p>but if we add a conversion instance: xxx
11602 </p><p>then we get cut off here: }-
11603 </p><p>all additional text is vanished
11604 </p>
11605 !! end
11606
11607 !! test
11608 Self closed html pairs (bug 5487)
11609 !! options
11610 !! input
11611 <center><font id="bug" />Centered text</center>
11612 <div><font id="bug2" />In div text</div>
11613 !! result
11614 <center>&lt;font id="bug" /&gt;Centered text</center>
11615 <div>&lt;font id="bug2" /&gt;In div text</div>
11616
11617 !! end
11618
11619 #
11620 #
11621 #
11622
11623 !! test
11624 Punctuation: nbsp before exclamation
11625 !! input
11626 C'est grave !
11627 !! result
11628 <p>C'est grave&#160;!
11629 </p>
11630 !! end
11631
11632 !! test
11633 Punctuation: CSS !important (bug 11874)
11634 !! input
11635 <div style="width:50% !important">important</div>
11636 !! result
11637 <div style="width:50% !important">important</div>
11638
11639 !!end
11640
11641 !! test
11642 Punctuation: CSS ! important (bug 11874; with space after)
11643 !! input
11644 <div style="width:50% ! important">important</div>
11645 !! result
11646 <div style="width:50% ! important">important</div>
11647
11648 !!end
11649
11650
11651 !! test
11652 HTML bullet list, closed tags (bug 5497)
11653 !! input
11654 <ul>
11655 <li>One</li>
11656 <li>Two</li>
11657 </ul>
11658 !! result
11659 <ul>
11660 <li>One</li>
11661 <li>Two</li>
11662 </ul>
11663
11664 !! end
11665
11666 !! test
11667 HTML bullet list, unclosed tags (bug 5497)
11668 !! options
11669 disabled
11670 !! input
11671 <ul>
11672 <li>One
11673 <li>Two
11674 </ul>
11675 !! result
11676 <ul>
11677 <li>One
11678 </li><li>Two
11679 </li></ul>
11680
11681 !! end
11682
11683 !! test
11684 HTML ordered list, closed tags (bug 5497)
11685 !! input
11686 <ol>
11687 <li>One</li>
11688 <li>Two</li>
11689 </ol>
11690 !! result
11691 <ol>
11692 <li>One</li>
11693 <li>Two</li>
11694 </ol>
11695
11696 !! end
11697
11698 !! test
11699 HTML ordered list, unclosed tags (bug 5497)
11700 !! options
11701 disabled
11702 !! input
11703 <ol>
11704 <li>One
11705 <li>Two
11706 </ol>
11707 !! result
11708 <ol>
11709 <li>One
11710 </li><li>Two
11711 </li></ol>
11712
11713 !! end
11714
11715 !! test
11716 HTML nested bullet list, closed tags (bug 5497)
11717 !! input
11718 <ul>
11719 <li>One</li>
11720 <li>Two:
11721 <ul>
11722 <li>Sub-one</li>
11723 <li>Sub-two</li>
11724 </ul>
11725 </li>
11726 </ul>
11727 !! result
11728 <ul>
11729 <li>One</li>
11730 <li>Two:
11731 <ul>
11732 <li>Sub-one</li>
11733 <li>Sub-two</li>
11734 </ul>
11735 </li>
11736 </ul>
11737
11738 !! end
11739
11740 !! test
11741 HTML nested bullet list, open tags (bug 5497)
11742 !! options
11743 disabled
11744 !! input
11745 <ul>
11746 <li>One
11747 <li>Two:
11748 <ul>
11749 <li>Sub-one
11750 <li>Sub-two
11751 </ul>
11752 </ul>
11753 !! result
11754 <ul>
11755 <li>One
11756 </li><li>Two:
11757 <ul>
11758 <li>Sub-one
11759 </li><li>Sub-two
11760 </li></ul>
11761 </li></ul>
11762
11763 !! end
11764
11765 !! test
11766 HTML nested ordered list, closed tags (bug 5497)
11767 !! input
11768 <ol>
11769 <li>One</li>
11770 <li>Two:
11771 <ol>
11772 <li>Sub-one</li>
11773 <li>Sub-two</li>
11774 </ol>
11775 </li>
11776 </ol>
11777 !! result
11778 <ol>
11779 <li>One</li>
11780 <li>Two:
11781 <ol>
11782 <li>Sub-one</li>
11783 <li>Sub-two</li>
11784 </ol>
11785 </li>
11786 </ol>
11787
11788 !! end
11789
11790 !! test
11791 HTML nested ordered list, open tags (bug 5497)
11792 !! options
11793 disabled
11794 !! input
11795 <ol>
11796 <li>One
11797 <li>Two:
11798 <ol>
11799 <li>Sub-one
11800 <li>Sub-two
11801 </ol>
11802 </ol>
11803 !! result
11804 <ol>
11805 <li>One
11806 </li><li>Two:
11807 <ol>
11808 <li>Sub-one
11809 </li><li>Sub-two
11810 </li></ol>
11811 </li></ol>
11812
11813 !! end
11814
11815 !! test
11816 HTML ordered list item with parameters oddity
11817 !! input
11818 <ol><li id="fragment">One</li></ol>
11819 !! result
11820 <ol><li id="fragment">One</li></ol>
11821
11822 !! end
11823
11824 !!test
11825 bug 5918: autonumbering
11826 !! input
11827 [http://first/] [http://second] [ftp://ftp]
11828
11829 ftp://inlineftp
11830
11831 [mailto:enclosed@mail.tld With target]
11832
11833 [mailto:enclosed@mail.tld]
11834
11835 mailto:inline@mail.tld
11836 !! result
11837 <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>
11838 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
11839 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
11840 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
11841 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
11842 </p>
11843 !! end
11844
11845
11846 #
11847 # Security and HTML correctness
11848 # From Nick Jenkins' fuzz testing
11849 #
11850
11851 !! test
11852 Fuzz testing: Parser13
11853 !! input
11854 {|
11855 | http://a|
11856 !! result
11857 <table>
11858 <tr>
11859 <td>
11860 </td>
11861 </tr>
11862 </table>
11863
11864 !! end
11865
11866 !! test
11867 Fuzz testing: Parser14
11868 !! input
11869 == onmouseover= ==
11870 http://__TOC__
11871 !! result
11872 <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>
11873 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11874 <ul>
11875 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
11876 </ul>
11877 </div>
11878
11879
11880 !! end
11881
11882 !! test
11883 Fuzz testing: Parser14-table
11884 !! input
11885 ==a==
11886 {| STYLE=__TOC__
11887 !! result
11888 <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>
11889 <table style="&#95;_TOC&#95;_">
11890 <tr><td></td></tr>
11891 </table>
11892
11893 !! end
11894
11895 # Known to produce bogus xml (extra </td>)
11896 !! test
11897 Fuzz testing: Parser16
11898 !! options
11899 noxml
11900 !! input
11901 {|
11902 !https://||||||
11903 !! result
11904 <table>
11905 <tr>
11906 <th>https://</th>
11907 <th></th>
11908 <th></th>
11909 <th>
11910 </td>
11911 </tr>
11912 </table>
11913
11914 !! end
11915
11916 !! test
11917 Fuzz testing: Parser21
11918 !! input
11919 {|
11920 ! irc://{{ftp://a" onmouseover="alert('hello world');"
11921 |
11922 !! result
11923 <table>
11924 <tr>
11925 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
11926 </th>
11927 <td>
11928 </td>
11929 </tr>
11930 </table>
11931
11932 !! end
11933
11934 !! test
11935 Fuzz testing: Parser22
11936 !! input
11937 http://===r:::https://b
11938
11939 {|
11940 !!result
11941 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
11942 </p>
11943 <table>
11944 <tr><td></td></tr>
11945 </table>
11946
11947 !! end
11948
11949 # Known to produce bad XML for now
11950 !! test
11951 Fuzz testing: Parser24
11952 !! options
11953 noxml
11954 !! input
11955 {|
11956 {{{|
11957 <u CLASS=
11958 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
11959 <br style="onmouseover='alert(document.cookie);' " />
11960
11961 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
11962 |
11963 !! result
11964 <table>
11965 {{{|
11966 <u class="&#124;">}}}} &gt;
11967 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
11968
11969 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
11970 <tr>
11971 <td></u>
11972 </td>
11973 </tr>
11974 </table>
11975
11976 !! end
11977
11978 # Note: the current result listed for this is not what the original one was,
11979 # but the original bug was JavaScript injection, which is fixed in any case.
11980 # It's not clear that the original result listed was any more correct than the
11981 # current one. Original result:
11982 # <p>{{{|
11983 # </p>
11984 # <li class="&#124;&#124;">
11985 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
11986 !!test
11987 Fuzz testing: Parser25 (bug 6055)
11988 !! input
11989 {{{
11990 |
11991 <LI CLASS=||
11992 >
11993 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
11994 !! result
11995 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
11996 </p>
11997 !! end
11998
11999 !!test
12000 Fuzz testing: URL adjacent extension (with space, clean)
12001 !! options
12002 !! input
12003 http://example.com <nowiki>junk</nowiki>
12004 !! result
12005 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
12006 </p>
12007 !!end
12008
12009 !!test
12010 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
12011 !! options
12012 !! input
12013 http://example.com<nowiki>junk</nowiki>
12014 !! result
12015 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
12016 </p>
12017 !!end
12018
12019 !!test
12020 Fuzz testing: URL adjacent extension (no space, dirty; pre)
12021 !! options
12022 !! input
12023 http://example.com<pre>junk</pre>
12024 !! result
12025 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
12026
12027 !!end
12028
12029 !!test
12030 Fuzz testing: image with bogus manual thumbnail
12031 !!input
12032 [[Image:foobar.jpg|thumbnail= ]]
12033 !!result
12034 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
12035
12036 !!end
12037
12038 !! test
12039 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
12040 !! input
12041 <pre dir="&#10;"></pre>
12042 !! result
12043 <pre dir="&#10;"></pre>
12044
12045 !! end
12046
12047 !! test
12048 Parsing optional HTML elements (Bug 6171)
12049 !! options
12050 !! input
12051 <table>
12052 <tr>
12053 <td> Some tabular data</td>
12054 <td> More tabular data ...
12055 <td> And yet som tabular data</td>
12056 </tr>
12057 </table>
12058 !! result
12059 <table>
12060 <tr>
12061 <td> Some tabular data</td>
12062 <td> More tabular data ...
12063 </td><td> And yet som tabular data</td>
12064 </tr>
12065 </table>
12066
12067 !! end
12068
12069 !! test
12070 Correct handling of <td>, <tr> (Bug 6171)
12071 !! options
12072 !! input
12073 <table>
12074 <tr>
12075 <td> Some tabular data</td>
12076 <td> More tabular data ...</td>
12077 <td> And yet som tabular data</td>
12078 </tr>
12079 </table>
12080 !! result
12081 <table>
12082 <tr>
12083 <td> Some tabular data</td>
12084 <td> More tabular data ...</td>
12085 <td> And yet som tabular data</td>
12086 </tr>
12087 </table>
12088
12089 !! end
12090
12091
12092 !! test
12093 Parsing crashing regression (fr:JavaScript)
12094 !! input
12095 </body></x>
12096 !! result
12097 <p>&lt;/body&gt;&lt;/x&gt;
12098 </p>
12099 !! end
12100
12101 !! test
12102 Inline wiki vs wiki block nesting
12103 !! input
12104 '''Bold paragraph
12105
12106 New wiki paragraph
12107 !! result
12108 <p><b>Bold paragraph</b>
12109 </p><p>New wiki paragraph
12110 </p>
12111 !! end
12112
12113 !! test
12114 Inline HTML vs wiki block nesting
12115 !! options
12116 disabled
12117 !! input
12118 <b>Bold paragraph
12119
12120 New wiki paragraph
12121 !! result
12122 <p><b>Bold paragraph</b>
12123 </p><p>New wiki paragraph
12124 </p>
12125 !! end
12126
12127 # Original result was this:
12128 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
12129 # </p>
12130 # While that might be marginally more intuitive, maybe, the six-apostrophe
12131 # construct is clearly pathological and the result stated here (which is what
12132 # the parser actually does) is about as reasonable as anything.
12133 !!test
12134 Mixing markup for italics and bold
12135 !! options
12136 !! input
12137 '''bold''''''bold''bolditalics'''''
12138 !! result
12139 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
12140 </p>
12141 !! end
12142
12143
12144 !! article
12145 Xyzzyx
12146 !! text
12147 Article for special page transclusion test
12148 !! endarticle
12149
12150 !! test
12151 Special page transclusion
12152 !! options
12153 !! input
12154 {{Special:Prefixindex/Xyzzyx}}
12155 !! result
12156 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
12157
12158 !! end
12159
12160 !! test
12161 Special page transclusion twice (bug 5021)
12162 !! options
12163 !! input
12164 {{Special:Prefixindex/Xyzzyx}}
12165 {{Special:Prefixindex/Xyzzyx}}
12166 !! result
12167 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
12168 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
12169
12170 !! end
12171
12172 !! test
12173 Transclusion of default MediaWiki message
12174 !! input
12175 {{MediaWiki:Mainpage}}
12176 !!result
12177 <p>Main Page
12178 </p>
12179 !! end
12180
12181 !! test
12182 Transclusion of nonexistent MediaWiki message
12183 !! input
12184 {{MediaWiki:Mainpagexxx}}
12185 !!result
12186 <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>
12187 </p>
12188 !! end
12189
12190 !! test
12191 Transclusion of MediaWiki message with underscore
12192 !! input
12193 {{MediaWiki:history_short}}
12194 !! result
12195 <p>History
12196 </p>
12197 !! end
12198
12199 !! test
12200 Transclusion of MediaWiki message with space
12201 !! input
12202 {{MediaWiki:history short}}
12203 !! result
12204 <p>History
12205 </p>
12206 !! end
12207
12208 !! test
12209 Invalid header with following text
12210 !! input
12211 = x = y
12212 !! result
12213 <p>= x = y
12214 </p>
12215 !! end
12216
12217
12218 !! test
12219 Section extraction test (section 0)
12220 !! options
12221 section=0
12222 !! input
12223 start
12224 ==a==
12225 ===aa===
12226 ====aaa====
12227 ==b==
12228 ===ba===
12229 ===bb===
12230 ====bba====
12231 ===bc===
12232 ==c==
12233 ===ca===
12234 !! result
12235 start
12236 !! end
12237
12238 !! test
12239 Section extraction test (section 1)
12240 !! options
12241 section=1
12242 !! input
12243 start
12244 ==a==
12245 ===aa===
12246 ====aaa====
12247 ==b==
12248 ===ba===
12249 ===bb===
12250 ====bba====
12251 ===bc===
12252 ==c==
12253 ===ca===
12254 !! result
12255 ==a==
12256 ===aa===
12257 ====aaa====
12258 !! end
12259
12260 !! test
12261 Section extraction test (section 2)
12262 !! options
12263 section=2
12264 !! input
12265 start
12266 ==a==
12267 ===aa===
12268 ====aaa====
12269 ==b==
12270 ===ba===
12271 ===bb===
12272 ====bba====
12273 ===bc===
12274 ==c==
12275 ===ca===
12276 !! result
12277 ===aa===
12278 ====aaa====
12279 !! end
12280
12281 !! test
12282 Section extraction test (section 3)
12283 !! options
12284 section=3
12285 !! input
12286 start
12287 ==a==
12288 ===aa===
12289 ====aaa====
12290 ==b==
12291 ===ba===
12292 ===bb===
12293 ====bba====
12294 ===bc===
12295 ==c==
12296 ===ca===
12297 !! result
12298 ====aaa====
12299 !! end
12300
12301 !! test
12302 Section extraction test (section 4)
12303 !! options
12304 section=4
12305 !! input
12306 start
12307 ==a==
12308 ===aa===
12309 ====aaa====
12310 ==b==
12311 ===ba===
12312 ===bb===
12313 ====bba====
12314 ===bc===
12315 ==c==
12316 ===ca===
12317 !! result
12318 ==b==
12319 ===ba===
12320 ===bb===
12321 ====bba====
12322 ===bc===
12323 !! end
12324
12325 !! test
12326 Section extraction test (section 5)
12327 !! options
12328 section=5
12329 !! input
12330 start
12331 ==a==
12332 ===aa===
12333 ====aaa====
12334 ==b==
12335 ===ba===
12336 ===bb===
12337 ====bba====
12338 ===bc===
12339 ==c==
12340 ===ca===
12341 !! result
12342 ===ba===
12343 !! end
12344
12345 !! test
12346 Section extraction test (section 6)
12347 !! options
12348 section=6
12349 !! input
12350 start
12351 ==a==
12352 ===aa===
12353 ====aaa====
12354 ==b==
12355 ===ba===
12356 ===bb===
12357 ====bba====
12358 ===bc===
12359 ==c==
12360 ===ca===
12361 !! result
12362 ===bb===
12363 ====bba====
12364 !! end
12365
12366 !! test
12367 Section extraction test (section 7)
12368 !! options
12369 section=7
12370 !! input
12371 start
12372 ==a==
12373 ===aa===
12374 ====aaa====
12375 ==b==
12376 ===ba===
12377 ===bb===
12378 ====bba====
12379 ===bc===
12380 ==c==
12381 ===ca===
12382 !! result
12383 ====bba====
12384 !! end
12385
12386 !! test
12387 Section extraction test (section 8)
12388 !! options
12389 section=8
12390 !! input
12391 start
12392 ==a==
12393 ===aa===
12394 ====aaa====
12395 ==b==
12396 ===ba===
12397 ===bb===
12398 ====bba====
12399 ===bc===
12400 ==c==
12401 ===ca===
12402 !! result
12403 ===bc===
12404 !! end
12405
12406 !! test
12407 Section extraction test (section 9)
12408 !! options
12409 section=9
12410 !! input
12411 start
12412 ==a==
12413 ===aa===
12414 ====aaa====
12415 ==b==
12416 ===ba===
12417 ===bb===
12418 ====bba====
12419 ===bc===
12420 ==c==
12421 ===ca===
12422 !! result
12423 ==c==
12424 ===ca===
12425 !! end
12426
12427 !! test
12428 Section extraction test (section 10)
12429 !! options
12430 section=10
12431 !! input
12432 start
12433 ==a==
12434 ===aa===
12435 ====aaa====
12436 ==b==
12437 ===ba===
12438 ===bb===
12439 ====bba====
12440 ===bc===
12441 ==c==
12442 ===ca===
12443 !! result
12444 ===ca===
12445 !! end
12446
12447 !! test
12448 Section extraction test (nonexistent section 11)
12449 !! options
12450 section=11
12451 !! input
12452 start
12453 ==a==
12454 ===aa===
12455 ====aaa====
12456 ==b==
12457 ===ba===
12458 ===bb===
12459 ====bba====
12460 ===bc===
12461 ==c==
12462 ===ca===
12463 !! result
12464 !! end
12465
12466 !! test
12467 Section extraction test with bogus heading (section 1)
12468 !! options
12469 section=1
12470 !! input
12471 ==a==
12472 ==bogus== not a legal section
12473 ==b==
12474 !! result
12475 ==a==
12476 ==bogus== not a legal section
12477 !! end
12478
12479 !! test
12480 Section extraction test with bogus heading (section 2)
12481 !! options
12482 section=2
12483 !! input
12484 ==a==
12485 ==bogus== not a legal section
12486 ==b==
12487 !! result
12488 ==b==
12489 !! end
12490
12491 !! test
12492 Section extraction test with comment after heading (section 1)
12493 !! options
12494 section=1
12495 !! input
12496 ==a==
12497 ==b== <!-- -->
12498 ==c==
12499 !! result
12500 ==a==
12501 !! end
12502
12503 !! test
12504 Section extraction test with comment after heading (section 2)
12505 !! options
12506 section=2
12507 !! input
12508 ==a==
12509 ==b== <!-- -->
12510 ==c==
12511 !! result
12512 ==b== <!-- -->
12513 !! end
12514
12515 !! test
12516 Section extraction test with bogus <nowiki> heading (section 1)
12517 !! options
12518 section=1
12519 !! input
12520 ==a==
12521 ==bogus== <nowiki>not a legal section</nowiki>
12522 ==b==
12523 !! result
12524 ==a==
12525 ==bogus== <nowiki>not a legal section</nowiki>
12526 !! end
12527
12528 !! test
12529 Section extraction test with bogus <nowiki> heading (section 2)
12530 !! options
12531 section=2
12532 !! input
12533 ==a==
12534 ==bogus== <nowiki>not a legal section</nowiki>
12535 ==b==
12536 !! result
12537 ==b==
12538 !! end
12539
12540
12541 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
12542 # instead of respecting commented sections
12543 !! test
12544 Section extraction prefixed by comment (section 1)
12545 !! options
12546 section=1
12547 !! input
12548 <!-- -->==sec1==
12549 ==sec2==
12550 !!result
12551 ==sec2==
12552 !!end
12553
12554 !! test
12555 Section extraction prefixed by comment (section 2)
12556 !! options
12557 section=2
12558 !! input
12559 <!-- -->==sec1==
12560 ==sec2==
12561 !!result
12562
12563 !!end
12564
12565
12566 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
12567 # instead of respecting HTML-style headings
12568 !! test
12569 Section extraction, mixed wiki and html (section 1)
12570 !! options
12571 section=1
12572 !! input
12573 <h2>unmarked</h2>
12574 unmarked
12575 ==1==
12576 one
12577 ==2==
12578 two
12579 !! result
12580 ==1==
12581 one
12582 !! end
12583
12584 !! test
12585 Section extraction, mixed wiki and html (section 2)
12586 !! options
12587 section=2
12588 !! input
12589 <h2>unmarked</h2>
12590 unmarked
12591 ==1==
12592 one
12593 ==2==
12594 two
12595 !! result
12596 ==2==
12597 two
12598 !! end
12599
12600
12601 # Formerly testing for bug 3342
12602 !! test
12603 Section extraction, heading surrounded by <noinclude>
12604 !! options
12605 section=1
12606 !! input
12607 <noinclude>==unmarked==</noinclude>
12608 ==marked==
12609 !! result
12610 ==marked==
12611 !!end
12612
12613 # Test behavior of bug 19910
12614 !! test
12615 Sectiion with all-equals
12616 !! options
12617 section=2
12618 !! input
12619 ===
12620 The line above must have a trailing space
12621 === <!--
12622 --> <!-- -->
12623 But just in case it doesn't...
12624 !! result
12625 === <!--
12626 --> <!-- -->
12627 But just in case it doesn't...
12628 !! end
12629
12630 !! test
12631 Section replacement test (section 0)
12632 !! options
12633 replace=0,"xxx"
12634 !! input
12635 start
12636 ==a==
12637 ===aa===
12638 ====aaa====
12639 ==b==
12640 ===ba===
12641 ===bb===
12642 ====bba====
12643 ===bc===
12644 ==c==
12645 ===ca===
12646 !! result
12647 xxx
12648
12649 ==a==
12650 ===aa===
12651 ====aaa====
12652 ==b==
12653 ===ba===
12654 ===bb===
12655 ====bba====
12656 ===bc===
12657 ==c==
12658 ===ca===
12659 !! end
12660
12661 !! test
12662 Section replacement test (section 1)
12663 !! options
12664 replace=1,"xxx"
12665 !! input
12666 start
12667 ==a==
12668 ===aa===
12669 ====aaa====
12670 ==b==
12671 ===ba===
12672 ===bb===
12673 ====bba====
12674 ===bc===
12675 ==c==
12676 ===ca===
12677 !! result
12678 start
12679 xxx
12680
12681 ==b==
12682 ===ba===
12683 ===bb===
12684 ====bba====
12685 ===bc===
12686 ==c==
12687 ===ca===
12688 !! end
12689
12690 !! test
12691 Section replacement test (section 2)
12692 !! options
12693 replace=2,"xxx"
12694 !! input
12695 start
12696 ==a==
12697 ===aa===
12698 ====aaa====
12699 ==b==
12700 ===ba===
12701 ===bb===
12702 ====bba====
12703 ===bc===
12704 ==c==
12705 ===ca===
12706 !! result
12707 start
12708 ==a==
12709 xxx
12710
12711 ==b==
12712 ===ba===
12713 ===bb===
12714 ====bba====
12715 ===bc===
12716 ==c==
12717 ===ca===
12718 !! end
12719
12720 !! test
12721 Section replacement test (section 3)
12722 !! options
12723 replace=3,"xxx"
12724 !! input
12725 start
12726 ==a==
12727 ===aa===
12728 ====aaa====
12729 ==b==
12730 ===ba===
12731 ===bb===
12732 ====bba====
12733 ===bc===
12734 ==c==
12735 ===ca===
12736 !! result
12737 start
12738 ==a==
12739 ===aa===
12740 xxx
12741
12742 ==b==
12743 ===ba===
12744 ===bb===
12745 ====bba====
12746 ===bc===
12747 ==c==
12748 ===ca===
12749 !! end
12750
12751 !! test
12752 Section replacement test (section 4)
12753 !! options
12754 replace=4,"xxx"
12755 !! input
12756 start
12757 ==a==
12758 ===aa===
12759 ====aaa====
12760 ==b==
12761 ===ba===
12762 ===bb===
12763 ====bba====
12764 ===bc===
12765 ==c==
12766 ===ca===
12767 !! result
12768 start
12769 ==a==
12770 ===aa===
12771 ====aaa====
12772 xxx
12773
12774 ==c==
12775 ===ca===
12776 !! end
12777
12778 !! test
12779 Section replacement test (section 5)
12780 !! options
12781 replace=5,"xxx"
12782 !! input
12783 start
12784 ==a==
12785 ===aa===
12786 ====aaa====
12787 ==b==
12788 ===ba===
12789 ===bb===
12790 ====bba====
12791 ===bc===
12792 ==c==
12793 ===ca===
12794 !! result
12795 start
12796 ==a==
12797 ===aa===
12798 ====aaa====
12799 ==b==
12800 xxx
12801
12802 ===bb===
12803 ====bba====
12804 ===bc===
12805 ==c==
12806 ===ca===
12807 !! end
12808
12809 !! test
12810 Section replacement test (section 6)
12811 !! options
12812 replace=6,"xxx"
12813 !! input
12814 start
12815 ==a==
12816 ===aa===
12817 ====aaa====
12818 ==b==
12819 ===ba===
12820 ===bb===
12821 ====bba====
12822 ===bc===
12823 ==c==
12824 ===ca===
12825 !! result
12826 start
12827 ==a==
12828 ===aa===
12829 ====aaa====
12830 ==b==
12831 ===ba===
12832 xxx
12833
12834 ===bc===
12835 ==c==
12836 ===ca===
12837 !! end
12838
12839 !! test
12840 Section replacement test (section 7)
12841 !! options
12842 replace=7,"xxx"
12843 !! input
12844 start
12845 ==a==
12846 ===aa===
12847 ====aaa====
12848 ==b==
12849 ===ba===
12850 ===bb===
12851 ====bba====
12852 ===bc===
12853 ==c==
12854 ===ca===
12855 !! result
12856 start
12857 ==a==
12858 ===aa===
12859 ====aaa====
12860 ==b==
12861 ===ba===
12862 ===bb===
12863 xxx
12864
12865 ===bc===
12866 ==c==
12867 ===ca===
12868 !! end
12869
12870 !! test
12871 Section replacement test (section 8)
12872 !! options
12873 replace=8,"xxx"
12874 !! input
12875 start
12876 ==a==
12877 ===aa===
12878 ====aaa====
12879 ==b==
12880 ===ba===
12881 ===bb===
12882 ====bba====
12883 ===bc===
12884 ==c==
12885 ===ca===
12886 !! result
12887 start
12888 ==a==
12889 ===aa===
12890 ====aaa====
12891 ==b==
12892 ===ba===
12893 ===bb===
12894 ====bba====
12895 xxx
12896
12897 ==c==
12898 ===ca===
12899 !!end
12900
12901 !! test
12902 Section replacement test (section 9)
12903 !! options
12904 replace=9,"xxx"
12905 !! input
12906 start
12907 ==a==
12908 ===aa===
12909 ====aaa====
12910 ==b==
12911 ===ba===
12912 ===bb===
12913 ====bba====
12914 ===bc===
12915 ==c==
12916 ===ca===
12917 !! result
12918 start
12919 ==a==
12920 ===aa===
12921 ====aaa====
12922 ==b==
12923 ===ba===
12924 ===bb===
12925 ====bba====
12926 ===bc===
12927 xxx
12928 !! end
12929
12930 !! test
12931 Section replacement test (section 10)
12932 !! options
12933 replace=10,"xxx"
12934 !! input
12935 start
12936 ==a==
12937 ===aa===
12938 ====aaa====
12939 ==b==
12940 ===ba===
12941 ===bb===
12942 ====bba====
12943 ===bc===
12944 ==c==
12945 ===ca===
12946 !! result
12947 start
12948 ==a==
12949 ===aa===
12950 ====aaa====
12951 ==b==
12952 ===ba===
12953 ===bb===
12954 ====bba====
12955 ===bc===
12956 ==c==
12957 xxx
12958 !! end
12959
12960 !! test
12961 Section replacement test with initial whitespace (bug 13728)
12962 !! options
12963 replace=2,"xxx"
12964 !! input
12965 Preformatted initial line
12966 ==a==
12967 ===a===
12968 !! result
12969 Preformatted initial line
12970 ==a==
12971 xxx
12972 !! end
12973
12974
12975 !! test
12976 Section extraction, heading followed by pre with 20 spaces (bug 6398)
12977 !! options
12978 section=1
12979 !! input
12980 ==a==
12981 a
12982 !! result
12983 ==a==
12984 a
12985 !! end
12986
12987 !! test
12988 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
12989 !! options
12990 section=1
12991 !! input
12992 ==a==
12993 a
12994 !! result
12995 ==a==
12996 a
12997 !! end
12998
12999
13000 !! test
13001 Section extraction, <pre> around bogus header (bug 10309)
13002 !! options
13003 noxml section=2
13004 !! input
13005 == Section One ==
13006 <pre>
13007 =======
13008 </pre>
13009
13010 == Section Two ==
13011 stuff
13012 !! result
13013 == Section Two ==
13014 stuff
13015 !! end
13016
13017 !! test
13018 Section replacement, <pre> around bogus header (bug 10309)
13019 !! options
13020 noxml replace=2,"xxx"
13021 !! input
13022 == Section One ==
13023 <pre>
13024 =======
13025 </pre>
13026
13027 == Section Two ==
13028 stuff
13029 !! result
13030 == Section One ==
13031 <pre>
13032 =======
13033 </pre>
13034
13035 xxx
13036 !! end
13037
13038
13039
13040 !! test
13041 Handling of &#x0A; in URLs
13042 !! input
13043 **irc://&#x0A;a
13044 !! result
13045 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
13046 </li></ul>
13047 </li></ul>
13048
13049 !!end
13050
13051 !! test
13052 5 quotes, code coverage +1 line (php)
13053 !! options
13054 php
13055 !! input
13056 '''''
13057 !! result
13058 !! end
13059 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
13060 !! test
13061 5 quotes, code coverage +1 line (parsoid)
13062 !! options
13063 parsoid
13064 !! input
13065 '''''
13066 !! result
13067 <p><b><i></i></b></p>
13068 !! end
13069
13070 !! test
13071 Special:Search page linking.
13072 !! input
13073 {{Special:search}}
13074 !! result
13075 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
13076 </p>
13077 !! end
13078
13079 !! test
13080 Say the magic word
13081 !! options
13082 title=[[Parser test]]
13083 !! input
13084 * {{PAGENAME}}
13085 * {{PAGENAMEE}}
13086 * {{FULLPAGENAME}}
13087 * {{FULLPAGENAMEE}}
13088 * {{BASEPAGENAME}}
13089 * {{BASEPAGENAMEE}}
13090 * {{SUBPAGENAME}}
13091 * {{SUBPAGENAMEE}}
13092 * {{ROOTPAGENAME}}
13093 * {{ROOTPAGENAMEE}}
13094 * {{TALKPAGENAME}}
13095 * {{TALKPAGENAMEE}}
13096 * {{SUBJECTPAGENAME}}
13097 * {{SUBJECTPAGENAMEE}}
13098 * {{NAMESPACEE}}
13099 * {{NAMESPACE}}
13100 * {{NAMESPACENUMBER}}
13101 * {{TALKSPACE}}
13102 * {{TALKSPACEE}}
13103 * {{SUBJECTSPACE}}
13104 * {{SUBJECTSPACEE}}
13105 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
13106 !! result
13107 <ul><li> Parser test
13108 </li><li> Parser_test
13109 </li><li> Parser test
13110 </li><li> Parser_test
13111 </li><li> Parser test
13112 </li><li> Parser_test
13113 </li><li> Parser test
13114 </li><li> Parser_test
13115 </li><li> Parser test
13116 </li><li> Parser_test
13117 </li><li> Talk:Parser test
13118 </li><li> Talk:Parser_test
13119 </li><li> Parser test
13120 </li><li> Parser_test
13121 </li><li>
13122 </li><li>
13123 </li><li> 0
13124 </li><li> Talk
13125 </li><li> Talk
13126 </li><li>
13127 </li><li>
13128 </li><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>
13129 </li></ul>
13130
13131 !! end
13132 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
13133
13134 !! test
13135 Gallery
13136 !! input
13137 <gallery>
13138 image1.png |
13139 image2.gif|||||
13140
13141 image3|
13142 image4 |300px| centre
13143 image5.svg| http://///////
13144 [[x|xx]]]]
13145 * image6
13146 </gallery>
13147 !! result
13148 <ul class="gallery mw-gallery-traditional">
13149 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13150 <div class="thumb" style="height: 150px;">Image1.png</div>
13151 <div class="gallerytext">
13152 </div>
13153 </div></li>
13154 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13155 <div class="thumb" style="height: 150px;">Image2.gif</div>
13156 <div class="gallerytext">
13157 <p>||||
13158 </p>
13159 </div>
13160 </div></li>
13161 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13162 <div class="thumb" style="height: 150px;">Image3</div>
13163 <div class="gallerytext">
13164 </div>
13165 </div></li>
13166 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13167 <div class="thumb" style="height: 150px;">Image4</div>
13168 <div class="gallerytext">
13169 <p>300px| centre
13170 </p>
13171 </div>
13172 </div></li>
13173 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13174 <div class="thumb" style="height: 150px;">Image5.svg</div>
13175 <div class="gallerytext">
13176 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
13177 </p>
13178 </div>
13179 </div></li>
13180 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13181 <div class="thumb" style="height: 150px;">* image6</div>
13182 <div class="gallerytext">
13183 </div>
13184 </div></li>
13185 </ul>
13186
13187 !! end
13188
13189 !! test
13190 Gallery (with options)
13191 !! input
13192 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
13193 File:Nonexistant.jpg|caption
13194 File:Nonexistant.jpg
13195 image:foobar.jpg|some '''caption''' [[Main Page]]
13196 image:foobar.jpg
13197 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
13198 </gallery>
13199 !! result
13200 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
13201 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
13202 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13203 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
13204 <div class="gallerytext">
13205 <p>caption
13206 </p>
13207 </div>
13208 </div></li>
13209 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13210 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
13211 <div class="gallerytext">
13212 </div>
13213 </div></li>
13214 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13215 <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>
13216 <div class="gallerytext">
13217 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
13218 </p>
13219 </div>
13220 </div></li>
13221 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13222 <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>
13223 <div class="gallerytext">
13224 </div>
13225 </div></li>
13226 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13227 <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>
13228 <div class="gallerytext">
13229 <p>Blabla|blabla.
13230 </p>
13231 </div>
13232 </div></li>
13233 </ul>
13234
13235 !! end
13236
13237 !! test
13238 Gallery with wikitext inside caption
13239 !! input
13240 <gallery>
13241 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
13242 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
13243 </gallery>
13244 !! result
13245 <ul class="gallery mw-gallery-traditional">
13246 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13247 <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>
13248 <div class="gallerytext">
13249 <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>
13250 </p>
13251 </div>
13252 </div></li>
13253 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13254 <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>
13255 <div class="gallerytext">
13256 <p>This is a test template
13257 </p>
13258 </div>
13259 </div></li>
13260 </ul>
13261
13262 !! end
13263
13264 !! test
13265 gallery (with showfilename option)
13266 !! input
13267 <gallery showfilename>
13268 File:Nonexistant.jpg|caption
13269 File:Nonexistant.jpg
13270 image:foobar.jpg|some '''caption''' [[Main Page]]
13271 File:Foobar.jpg
13272 </gallery>
13273 !! result
13274 <ul class="gallery mw-gallery-traditional">
13275 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13276 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13277 <div class="gallerytext">
13278 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
13279 caption
13280 </p>
13281 </div>
13282 </div></li>
13283 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13284 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13285 <div class="gallerytext">
13286 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
13287 </p>
13288 </div>
13289 </div></li>
13290 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13291 <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>
13292 <div class="gallerytext">
13293 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
13294 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
13295 </p>
13296 </div>
13297 </div></li>
13298 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13299 <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>
13300 <div class="gallerytext">
13301 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
13302 </p>
13303 </div>
13304 </div></li>
13305 </ul>
13306
13307 !! end
13308
13309 !! test
13310 Gallery (with namespace-less filenames)
13311 !! input
13312 <gallery>
13313 File:Nonexistant.jpg
13314 Nonexistant.jpg
13315 image:foobar.jpg
13316 foobar.jpg
13317 </gallery>
13318 !! result
13319 <ul class="gallery mw-gallery-traditional">
13320 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13321 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13322 <div class="gallerytext">
13323 </div>
13324 </div></li>
13325 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13326 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13327 <div class="gallerytext">
13328 </div>
13329 </div></li>
13330 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13331 <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>
13332 <div class="gallerytext">
13333 </div>
13334 </div></li>
13335 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13336 <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>
13337 <div class="gallerytext">
13338 </div>
13339 </div></li>
13340 </ul>
13341
13342 !! end
13343
13344 !! test
13345 HTML Hex character encoding (spells the word "JavaScript")
13346 !! input
13347 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
13348 !! result
13349 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
13350 </p>
13351 !! end
13352
13353 !! test
13354 HTML Hex character encoding bogus encoding (bug 26437 regression check)
13355 !! input
13356 &#xsee;&#XSEE;
13357 !! result
13358 <p>&amp;#xsee;&amp;#XSEE;
13359 </p>
13360 !! end
13361
13362 !! test
13363 HTML Hex character encoding mixed case
13364 !! input
13365 &#xEE;&#Xee;
13366 !! result
13367 <p>&#xee;&#xee;
13368 </p>
13369 !! end
13370
13371 !! test
13372 __FORCETOC__ override
13373 !! input
13374 __NEWSECTIONLINK__
13375 __FORCETOC__
13376 !! result
13377 <p><br />
13378 </p>
13379 !! end
13380
13381 !! test
13382 ISBN code coverage
13383 !! input
13384 ISBN 978-0-1234-56&#x20;789
13385 !! result
13386 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
13387 </p>
13388 !! end
13389
13390 !! test
13391 ISBN followed by 5 spaces
13392 !! input
13393 ISBN
13394 !! result
13395 <p>ISBN
13396 </p>
13397 !! end
13398
13399 !! test
13400 Double ISBN
13401 !! input
13402 ISBN ISBN 1234567890
13403 !! result
13404 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
13405 </p>
13406 !! end
13407
13408 !! test
13409 Bug 22905: <abbr> followed by ISBN followed by </a>
13410 !! input
13411 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
13412 !! result
13413 <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>
13414 </p>
13415 !! end
13416
13417 !! test
13418 Double RFC
13419 !! input
13420 RFC RFC 1234
13421 !! result
13422 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
13423 </p>
13424 !! end
13425
13426 !! test
13427 Double RFC with a wiki link
13428 !! input
13429 RFC [[RFC 1234]]
13430 !! result
13431 <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>
13432 </p>
13433 !! end
13434
13435 !! test
13436 RFC code coverage
13437 !! input
13438 RFC 983&#x20;987
13439 !! result
13440 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
13441 </p>
13442 !! end
13443
13444 !! test
13445 Centre-aligned image
13446 !! input
13447 [[Image:foobar.jpg|centre]]
13448 !! result
13449 <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>
13450
13451 !!end
13452
13453 !! test
13454 None-aligned image
13455 !! input
13456 [[Image:foobar.jpg|none]]
13457 !! result
13458 <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>
13459
13460 !!end
13461
13462 !! test
13463 Width + Height sized image (using px) (height is ignored)
13464 !! input
13465 [[Image:foobar.jpg|640x480px]]
13466 !! result
13467 <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>
13468 </p>
13469 !!end
13470
13471 !! test
13472 Width-sized image (using px, no following whitespace)
13473 !! input
13474 [[Image:foobar.jpg|640px]]
13475 !! result
13476 <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>
13477 </p>
13478 !!end
13479
13480 !! test
13481 Width-sized image (using px, with following whitespace - test regression from r39467)
13482 !! input
13483 [[Image:foobar.jpg|640px ]]
13484 !! result
13485 <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>
13486 </p>
13487 !!end
13488
13489 !! test
13490 Width-sized image (using px, with preceding whitespace - test regression from r39467)
13491 !! input
13492 [[Image:foobar.jpg| 640px]]
13493 !! result
13494 <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>
13495 </p>
13496 !!end
13497
13498 !! test
13499 Another italics / bold test
13500 !! input
13501 ''' ''x'
13502 !! result
13503 <pre>'<i> </i>x'
13504 </pre>
13505 !!end
13506
13507 # Note the results may be incorrect, as parserTest output included this:
13508 # XML error: Mismatched tag at byte 6120:
13509 # ...<dd> </dt></dl> </dd...
13510 !! test
13511 dt/dd/dl test
13512 !! options
13513 disabled
13514 !! input
13515 :;;;::
13516 !! result
13517 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
13518 </dd></dl>
13519 </dd></dl>
13520 </dt></dl>
13521 </dt></dl>
13522 </dt></dl>
13523 </dd></dl>
13524
13525 !!end
13526
13527
13528 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
13529 !! test
13530 Images with the "|" character in the comment
13531 !! input
13532 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
13533 !! result
13534 <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>
13535
13536 !!end
13537
13538 !! test
13539 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
13540 !! input
13541 <html><script>alert(1);</script></html>
13542 !! result
13543 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
13544 </p>
13545 !! end
13546
13547 !! test
13548 HTML with raw HTML ($wgRawHtml==true)
13549 !! options
13550 wgRawHtml=1
13551 !! input
13552 <html><script>alert(1);</script></html>
13553 !! result
13554 <p><script>alert(1);</script>
13555 </p>
13556 !! end
13557
13558 !! test
13559 Parents of subpages, one level up
13560 !! options
13561 subpage title=[[Subpage test/L1/L2/L3]]
13562 !! input
13563 [[../|L2]]
13564 !! result
13565 <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>
13566 </p>
13567 !! end
13568
13569
13570 !! test
13571 Parents of subpages, one level up, not named
13572 !! options
13573 subpage title=[[Subpage test/L1/L2/L3]]
13574 !! input
13575 [[../]]
13576 !! result
13577 <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>
13578 </p>
13579 !! end
13580
13581
13582
13583 !! test
13584 Parents of subpages, two levels up
13585 !! options
13586 subpage title=[[Subpage test/L1/L2/L3]]
13587 !! input
13588 [[../../|L1]]2
13589
13590 [[../../|L1]]l
13591 !! result
13592 <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
13593 </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>
13594 </p>
13595 !! end
13596
13597 !! test
13598 Parents of subpages, two levels up, without trailing slash or name.
13599 !! options
13600 subpage title=[[Subpage test/L1/L2/L3]]
13601 !! input
13602 [[../..]]
13603 !! result
13604 <p>[[../..]]
13605 </p>
13606 !! end
13607
13608 !! test
13609 Parents of subpages, two levels up, with lots of extra trailing slashes.
13610 !! options
13611 subpage title=[[Subpage test/L1/L2/L3]]
13612 !! input
13613 [[../../////]]
13614 !! result
13615 <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>
13616 </p>
13617 !! end
13618
13619 !! article
13620 Subpage test/L1/L2/L3Sibling
13621 !! text
13622 Sibling article
13623 !! endarticle
13624
13625 !! test
13626 Transclusion of a sibling page (one level up)
13627 !! options
13628 subpage title=[[Subpage test/L1/L2/L3]]
13629 !! input
13630 {{../L3Sibling}}
13631 !! result
13632 <p>Sibling article
13633 </p>
13634 !! end
13635
13636 !! test
13637 Transclusion of a child page
13638 !! options
13639 subpage title=[[Subpage test/L1/L2]]
13640 !! input
13641 {{/L3Sibling}}
13642 !! result
13643 <p>Sibling article
13644 </p>
13645 !! end
13646
13647 !! test
13648 Non-transclusion because of too many up levels
13649 !! options
13650 subpage title=[[Subpage test/L1/L2/L3]]
13651 !! input
13652 {{../../../../More than parent}}
13653 !! result
13654 <p>{{../../../../More than parent}}
13655 </p>
13656 !! end
13657
13658 !! test
13659 Definition list code coverage
13660 !! input
13661 ; title : def
13662 ; title : def
13663 ;title: def
13664 !! result
13665 <dl><dt> title &#160;</dt><dd> def
13666 </dd><dt> title&#160;</dt><dd> def
13667 </dd><dt>title</dt><dd> def
13668 </dd></dl>
13669
13670 !! end
13671
13672 !! test
13673 Don't fall for the self-closing div
13674 !! input
13675 <div>hello world</div/>
13676 !! result
13677 <div>hello world</div>
13678
13679 !! end
13680
13681 !! test
13682 MSGNW magic word
13683 !! input
13684 {{MSGNW:msg}}
13685 !! result
13686 <p>&#91;&#91;:Template:Msg&#93;&#93;
13687 </p>
13688 !! end
13689
13690 !! test
13691 RAW magic word
13692 !! input
13693 {{RAW:QUERTY}}
13694 !! result
13695 <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>
13696 </p>
13697 !! end
13698
13699 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
13700 !! test
13701 Always escape literal '>' in output, not just after '<'
13702 !! input
13703 ><>
13704 !! result
13705 <p>&gt;&lt;&gt;
13706 </p>
13707 !! end
13708
13709 !! test
13710 Template caching
13711 !! input
13712 {{Test}}
13713 {{Test}}
13714 !! result
13715 <p>This is a test template
13716 This is a test template
13717 </p>
13718 !! end
13719
13720
13721 !! article
13722 MediaWiki:Fake
13723 !! text
13724 ==header==
13725 !! endarticle
13726
13727 !! test
13728 Inclusion of !userCanEdit() content
13729 !! input
13730 {{MediaWiki:Fake}}
13731 !! result
13732 <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>
13733
13734 !! end
13735
13736
13737 !! test
13738 Out-of-order TOC heading levels
13739 !! input
13740 ==2==
13741 ======6======
13742 ===3===
13743 =1=
13744 =====5=====
13745 ==2==
13746 !! result
13747 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13748 <ul>
13749 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
13750 <ul>
13751 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
13752 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
13753 </ul>
13754 </li>
13755 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
13756 <ul>
13757 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
13758 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
13759 </ul>
13760 </li>
13761 </ul>
13762 </div>
13763
13764 <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>
13765 <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>
13766 <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>
13767 <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>
13768 <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>
13769 <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>
13770
13771 !! end
13772
13773
13774 !! test
13775 ISBN with a dummy number
13776 !! input
13777 ISBN ---
13778 !! result
13779 <p>ISBN ---
13780 </p>
13781 !! end
13782
13783
13784 !! test
13785 ISBN with space-delimited number
13786 !! input
13787 ISBN 92 9017 032 8
13788 !! result
13789 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
13790 </p>
13791 !! end
13792
13793
13794 !! test
13795 ISBN with multiple spaces, no number
13796 !! input
13797 ISBN foo
13798 !! result
13799 <p>ISBN foo
13800 </p>
13801 !! end
13802
13803
13804 !! test
13805 ISBN length
13806 !! input
13807 ISBN 123456789
13808
13809 ISBN 1234567890
13810
13811 ISBN 12345678901
13812 !! result
13813 <p>ISBN 123456789
13814 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
13815 </p><p>ISBN 12345678901
13816 </p>
13817 !! end
13818
13819
13820 !! test
13821 ISBN with trailing year (bug 8110)
13822 !! input
13823 ISBN 1-234-56789-0 - 2006
13824
13825 ISBN 1 234 56789 0 - 2006
13826 !! result
13827 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
13828 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
13829 </p>
13830 !! end
13831
13832
13833 !! test
13834 anchorencode
13835 !! input
13836 {{anchorencode:foo bar©#%n}}
13837 !! result
13838 <p>foo_bar.C2.A9.23.25n
13839 </p>
13840 !! end
13841
13842 !! test
13843 anchorencode trims spaces
13844 !! input
13845 {{anchorencode: __pretty__please__}}
13846 !! result
13847 <p>pretty_please
13848 </p>
13849 !! end
13850
13851 !! test
13852 anchorencode deals with links
13853 !! input
13854 {{anchorencode: [[hello|world]] [[hi]]}}
13855 !! result
13856 <p>world_hi
13857 </p>
13858 !! end
13859
13860 !! test
13861 anchorencode deals with templates
13862 !! input
13863 {{anchorencode: {{Foo}} }}
13864 !! result
13865 <p>FOO
13866 </p>
13867 !! end
13868
13869 !! test
13870 anchorencode encodes like the TOC generator: (bug 18431)
13871 !! input
13872 === _ +:.3A%3A&&amp;]] ===
13873 {{anchorencode: _ +:.3A%3A&&amp;]] }}
13874 __NOEDITSECTION__
13875 !! result
13876 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
13877 <p>.2B:.3A.253A.26.26.5D.5D
13878 </p>
13879 !! end
13880
13881 !! test
13882 Bug 6200: blockquotes and paragraph formatting
13883 !! input
13884 <blockquote>
13885 foo
13886 </blockquote>
13887
13888 bar
13889
13890 baz
13891 !! result
13892 <blockquote>
13893 <p>foo
13894 </p>
13895 </blockquote>
13896 <p>bar
13897 </p>
13898 <pre>baz
13899 </pre>
13900 !! end
13901
13902 !! test
13903 Bug 8293: Use of center tag ruins paragraph formatting
13904 !! input
13905 <center>
13906 foo
13907 </center>
13908
13909 bar
13910
13911 baz
13912 !! result
13913 <center>
13914 <p>foo
13915 </p>
13916 </center>
13917 <p>bar
13918 </p>
13919 <pre>baz
13920 </pre>
13921 !! end
13922
13923 !!test
13924 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
13925 !!options
13926 php
13927 !!input
13928 <span><s>x</span></s>
13929 !!result
13930 <p><span><s>x&lt;/span&gt;</s></span>
13931 </p>
13932 !!end
13933
13934 !!test
13935 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
13936 !!options
13937 parsoid
13938 !!input
13939 <span><s>x</span></s>
13940 !!result
13941 <p><span><s>x</s></span><s></s>
13942 </p>
13943 !!end
13944
13945 ###
13946 ### Language variants related tests
13947 ###
13948 !! test
13949 Self-link in language variants
13950 !! options
13951 title=[[Dunav]] language=sr
13952 !! input
13953 Both [[Dunav]] and [[Дунав]] are names for this river.
13954 !! result
13955 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
13956 </p>
13957 !!end
13958
13959 !! article
13960 Дуна
13961 !! text
13962 content
13963 !! endarticle
13964
13965 !! test
13966 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
13967 !! options
13968 title=[[Duna]] language=sr
13969 !! input
13970 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
13971 !! result
13972 <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.
13973 </p>
13974 !! end
13975
13976 !! test
13977 Link to pages in language variants
13978 !! options
13979 language=sr
13980 !! input
13981 Main Page can be written as [[Маин Паге]]
13982 !! result
13983 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
13984 </p>
13985 !!end
13986
13987
13988 !! test
13989 Multiple links to pages in language variants
13990 !! options
13991 language=sr
13992 !! input
13993 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
13994 !! result
13995 <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>.
13996 </p>
13997 !!end
13998
13999
14000 !! test
14001 Simple template in language variants
14002 !! options
14003 language=sr
14004 !! input
14005 {{тест}}
14006 !! result
14007 <p>This is a test template
14008 </p>
14009 !! end
14010
14011
14012 !! test
14013 Template with explicit namespace in language variants
14014 !! options
14015 language=sr
14016 !! input
14017 {{Template:тест}}
14018 !! result
14019 <p>This is a test template
14020 </p>
14021 !! end
14022
14023
14024 !! test
14025 Basic test for template parameter in language variants
14026 !! options
14027 language=sr
14028 !! input
14029 {{парамтест|param=foo}}
14030 !! result
14031 <p>This is a test template with parameter foo
14032 </p>
14033 !! end
14034
14035
14036 !! test
14037 Simple category in language variants
14038 !! options
14039 language=sr cat
14040 !! input
14041 [[Category:МедиаWики Усер'с Гуиде]]
14042 !! result
14043 <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>
14044 !! end
14045
14046
14047 !! article
14048 Category:分类
14049 !! text
14050 blah
14051 !! endarticle
14052
14053 !! article
14054 Category:分類
14055 !! text
14056 blah
14057 !! endarticle
14058
14059 !! test
14060 Don't convert blue categorylinks to another variant (bug 33210)
14061 !! options
14062 language=zh cat
14063 !! input
14064 [[A]][[Category:分类]]
14065 !! result
14066 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
14067 !! end
14068
14069
14070 !! test
14071 Stripping -{}- tags (language variants)
14072 !! options
14073 language=sr
14074 !! input
14075 Latin proverb: -{Ne nuntium necare}-
14076 !! result
14077 <p>Latin proverb: Ne nuntium necare
14078 </p>
14079 !! end
14080
14081
14082 !! test
14083 Prevent conversion with -{}- tags (language variants)
14084 !! options
14085 language=sr variant=sr-ec
14086 !! input
14087 Latinski: -{Ne nuntium necare}-
14088 !! result
14089 <p>Латински: Ne nuntium necare
14090 </p>
14091 !! end
14092
14093
14094 !! test
14095 Prevent conversion of text with -{}- tags (language variants)
14096 !! options
14097 language=sr variant=sr-ec
14098 !! input
14099 Latinski: -{Ne nuntium necare}-
14100 !! result
14101 <p>Латински: Ne nuntium necare
14102 </p>
14103 !! end
14104
14105
14106 !! test
14107 Prevent conversion of links with -{}- tags (language variants)
14108 !! options
14109 language=sr variant=sr-ec
14110 !! input
14111 -{[[Main Page]]}-
14112 !! result
14113 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
14114 </p>
14115 !! end
14116
14117
14118 !! test
14119 -{}- tags within headlines (within html for parserConvert())
14120 !! options
14121 language=sr variant=sr-ec
14122 !! input
14123 == -{Naslov}- ==
14124 !! result
14125 <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>
14126
14127 !! end
14128
14129
14130 !! test
14131 Explicit definition of language variant alternatives
14132 !! options
14133 language=zh variant=zh-tw
14134 !! input
14135 -{zh:China;zh-tw:Taiwan}-, not China
14136 !! result
14137 <p>Taiwan, not China
14138 </p>
14139 !! end
14140
14141
14142 !! test
14143 Conversion around HTML tags
14144 !! options
14145 language=sr variant=sr-ec
14146 !! input
14147 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
14148 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
14149 !! result
14150 <p>
14151 <span title="ЛаCтин">ски</span>
14152 </p>
14153 !! end
14154
14155
14156 !! test
14157 Explicit session-wise language variant mapping (A flag and - flag)
14158 !! options
14159 language=zh variant=zh-tw
14160 !! input
14161 Taiwan is not China.
14162 But -{A|zh:China;zh-tw:Taiwan}- is China,
14163 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
14164 and -{China}- is China.
14165 !! result
14166 <p>Taiwan is not China.
14167 But Taiwan is Taiwan,
14168 (This should be stripped!)
14169 and China is China.
14170 </p>
14171 !! end
14172
14173 !! test
14174 Explicit session-wise language variant mapping (H flag for hide)
14175 !! options
14176 language=zh variant=zh-tw
14177 !! input
14178 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
14179 Taiwan is China.
14180 !! result
14181 <p>(This should be stripped!)
14182 Taiwan is Taiwan.
14183 </p>
14184 !! end
14185
14186 !! test
14187 Adding explicit conversion rule for title (T flag)
14188 !! options
14189 language=zh variant=zh-tw showtitle
14190 !! input
14191 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
14192 !! result
14193 Taiwan
14194 <p>Should be stripped!
14195 </p>
14196 !! end
14197
14198 !! test
14199 Testing that changing the language variant here in the tests actually works
14200 !! options
14201 language=zh variant=zh showtitle
14202 !! input
14203 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
14204 !! result
14205 China
14206 <p>Should be stripped!
14207 </p>
14208 !! end
14209
14210 !! test
14211 Recursive conversion of alt and title attrs shouldn't clear converter state
14212 !! options
14213 language=zh variant=zh-cn showtitle
14214 !! input
14215 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
14216 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
14217 !! result
14218 China
14219 <p>
14220 Should be stripped<span title="Exclamation">!</span>
14221 </p>
14222 !! end
14223
14224 !! test
14225 Bug 24072: more test on conversion rule for title
14226 !! options
14227 language=zh variant=zh-tw showtitle
14228 !! input
14229 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
14230 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
14231 !! result
14232 Taiwan
14233 <p>This should be stripped!
14234 This won't take interferes with the title rule.
14235 </p>
14236 !! end
14237
14238 !! test
14239 Partly disable title conversion if variant == main language code
14240 !! options
14241 language=zh variant=zh title=[[ZH]] showtitle
14242 !! input
14243 -{T|zh-cn:CN;zh-tw:TW}-
14244 !! result
14245 ZH
14246 <p>
14247 </p>
14248 !! end
14249
14250 !! test
14251 Partly disable title conversion if variant == main language code, more
14252 !! options
14253 language=zh variant=zh title=[[ZH]] showtitle
14254 !! input
14255 -{T|TW}-
14256 !! result
14257 ZH
14258 <p>
14259 </p>
14260 !! end
14261
14262 !! test
14263 Raw output of variant escape tags (R flag)
14264 !! options
14265 language=zh variant=zh-tw
14266 !! input
14267 Raw: -{R|zh:China;zh-tw:Taiwan}-
14268 !! result
14269 <p>Raw: zh:China;zh-tw:Taiwan
14270 </p>
14271 !! end
14272
14273 !! test
14274 Nested using of manual convert syntax
14275 !! options
14276 language=zh variant=zh-hk
14277 !! input
14278 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
14279 !! result
14280 <p>Nested: Hello Hong Kong!
14281 </p>
14282 !! end
14283
14284 !! test
14285 Proper conversion of text in external links
14286 !! options
14287 language=sr variant=sr-ec
14288 !! input
14289 http://www.google.com
14290 gopher://www.google.com
14291 [http://www.google.com http://www.google.com]
14292 [gopher://www.google.com gopher://www.google.com]
14293 [https://www.google.com irc://www.google.com]
14294 [ftp://www.google.com www.google.com/ftp://dir]
14295 [//www.google.com www.google.com]
14296 !! result
14297 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
14298 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
14299 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
14300 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
14301 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
14302 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
14303 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
14304 </p>
14305 !! end
14306
14307 !! test
14308 Do not convert roman numbers to language variants
14309 !! options
14310 language=sr variant=sr-ec
14311 !! input
14312 Fridrih IV je car.
14313 !! result
14314 <p>Фридрих IV је цар.
14315 </p>
14316 !! end
14317
14318 !! test
14319 Unclosed language converter markup "-{"
14320 !! options
14321 language=sr
14322 !! input
14323 -{T|hello
14324 !! result
14325 <p>-{T|hello
14326 </p>
14327 !! end
14328
14329 !! test
14330 Don't convert raw rule "-{R|=&gt;}-" to "=>"
14331 !! options
14332 language=sr
14333 !! input
14334 -{R|=&gt;}-
14335 !! result
14336 <p>=&gt;
14337 </p>
14338 !!end
14339
14340 !! test
14341 Bug 529: Uncovered bullet
14342 !! input
14343 * Foo {{bullet}}
14344 !! result
14345 <ul><li> Foo
14346 </li><li> Bar
14347 </li></ul>
14348
14349 !! end
14350
14351 # Plain MediaWiki does not remove empty lists, but tidy actually does.
14352 # Templates in Wikipedia rely on this behavior, as tidy has always been
14353 # enabled there. These tests are normally run *without* tidy, so specify the
14354 # full output here.
14355 # To test realistic parsing behavior, apply a tidy-like transformation to both
14356 # the expected output and your parser's output.
14357 !! test
14358 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
14359 !! input
14360 ******* Foo {{bullet}}
14361 !! result
14362 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
14363 </li></ul>
14364 </li></ul>
14365 </li></ul>
14366 </li></ul>
14367 </li></ul>
14368 </li></ul>
14369 </li><li> Bar
14370 </li></ul>
14371
14372 !! end
14373
14374 !! test
14375 Bug 529: Uncovered table already at line-start
14376 !! input
14377 x
14378
14379 {{table}}
14380 y
14381 !! result
14382 <p>x
14383 </p>
14384 <table>
14385 <tr>
14386 <td> 1 </td>
14387 <td> 2
14388 </td></tr>
14389 <tr>
14390 <td> 3 </td>
14391 <td> 4
14392 </td></tr></table>
14393 <p>y
14394 </p>
14395 !! end
14396
14397 !! test
14398 Bug 529: Uncovered bullet in parser function result
14399 !! input
14400 * Foo {{lc:{{bullet}} }}
14401 !! result
14402 <ul><li> Foo
14403 </li><li> bar
14404 </li></ul>
14405
14406 !! end
14407
14408 !! test
14409 Bug 5678: Double-parsed template argument
14410 !! input
14411 {{lc:{{{1}}}|hello}}
14412 !! result
14413 <p>{{{1}}}
14414 </p>
14415 !! end
14416
14417 !! test
14418 Bug 5678: Double-parsed template invocation
14419 !! input
14420 {{lc:{{paramtest {{!}} param = hello }} }}
14421 !! result
14422 <p>{{paramtest | param = hello }}
14423 </p>
14424 !! end
14425
14426 !! test
14427 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
14428 !! options
14429 language=cs
14430 title=[[Main Page]]
14431 !! input
14432 {{PRVNÍVELKÉ:ěščř}}
14433 {{prvnívelké:ěščř}}
14434 {{PRVNÍMALÉ:ěščř}}
14435 {{prvnímalé:ěščř}}
14436 {{MALÁ:ěščř}}
14437 {{malá:ěščř}}
14438 {{VELKÁ:ěščř}}
14439 {{velká:ěščř}}
14440 !! result
14441 <p>Ěščř
14442 Ěščř
14443 ěščř
14444 ěščř
14445 ěščř
14446 ěščř
14447 ĚŠČŘ
14448 ĚŠČŘ
14449 </p>
14450 !! end
14451
14452 !! test
14453 Morwen/13: Unclosed link followed by heading
14454 !! input
14455 [[link
14456 ==heading==
14457 !! result
14458 <p>[[link
14459 </p>
14460 <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>
14461
14462 !! end
14463
14464 !! test
14465 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
14466 !! input
14467 {{foo|
14468 =heading=
14469 !! result
14470 <p>{{foo|
14471 </p>
14472 <h1><span class="mw-headline" id="heading">heading</span></h1>
14473
14474 !! end
14475
14476 !! test
14477 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
14478 !! input
14479 {{foo|
14480 ==heading==
14481 !! result
14482 <p>{{foo|
14483 </p>
14484 <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>
14485
14486 !! end
14487
14488 !! test
14489 Tildes in comments
14490 !! options
14491 pst
14492 !! input
14493 <!-- ~~~~ -->
14494 !! result
14495 <!-- ~~~~ -->
14496 !! end
14497
14498 !! test
14499 Paragraphs inside divs (no extra line breaks)
14500 !! input
14501 <div>Line one
14502
14503 Line two</div>
14504 !! result
14505 <div>Line one
14506 Line two</div>
14507
14508 !! end
14509
14510 !! test
14511 Paragraphs inside divs (extra line break on open)
14512 !! input
14513 <div>
14514 Line one
14515
14516 Line two</div>
14517 !! result
14518 <div>
14519 <p>Line one
14520 </p>
14521 Line two</div>
14522
14523 !! end
14524
14525 !! test
14526 Paragraphs inside divs (extra line break on close)
14527 !! input
14528 <div>Line one
14529
14530 Line two
14531 </div>
14532 !! result
14533 <div>Line one
14534 <p>Line two
14535 </p>
14536 </div>
14537
14538 !! end
14539
14540 !! test
14541 Paragraphs inside divs (extra line break on open and close)
14542 !! input
14543 <div>
14544 Line one
14545
14546 Line two
14547 </div>
14548 !! result
14549 <div>
14550 <p>Line one
14551 </p><p>Line two
14552 </p>
14553 </div>
14554
14555 !! end
14556
14557 !! test
14558 Nesting tags, paragraphs on lines which begin with <div>
14559 !! options
14560 disabled
14561 !! input
14562 <div></div><strong>A
14563 B</strong>
14564 !! result
14565 <div></div>
14566 <p><strong>A
14567 B</strong>
14568 </p>
14569 !! end
14570
14571 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
14572 !! test
14573 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
14574 !! input
14575 <blockquote>Line one
14576
14577 Line two</blockquote>
14578 !! result
14579 <blockquote>Line one
14580 Line two</blockquote>
14581
14582 !! end
14583
14584 !! test
14585 Bug 6200: paragraphs inside blockquotes (extra line break on open)
14586 !! input
14587 <blockquote>
14588 Line one
14589
14590 Line two</blockquote>
14591 !! result
14592 <blockquote>
14593 <p>Line one
14594 </p>
14595 Line two</blockquote>
14596
14597 !! end
14598
14599 !! test
14600 Bug 6200: paragraphs inside blockquotes (extra line break on close)
14601 !! input
14602 <blockquote>Line one
14603
14604 Line two
14605 </blockquote>
14606 !! result
14607 <blockquote>Line one
14608 <p>Line two
14609 </p>
14610 </blockquote>
14611
14612 !! end
14613
14614 !! test
14615 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
14616 !! input
14617 <blockquote>
14618 Line one
14619
14620 Line two
14621 </blockquote>
14622 !! result
14623 <blockquote>
14624 <p>Line one
14625 </p><p>Line two
14626 </p>
14627 </blockquote>
14628
14629 !! end
14630
14631 !! test
14632 Paragraphs inside blockquotes/divs (no extra line breaks)
14633 !! input
14634 <blockquote><div>Line one
14635
14636 Line two</div></blockquote>
14637 !! result
14638 <blockquote><div>Line one
14639 Line two</div></blockquote>
14640
14641 !! end
14642
14643 !! test
14644 Paragraphs inside blockquotes/divs (extra line break on open)
14645 !! input
14646 <blockquote><div>
14647 Line one
14648
14649 Line two</div></blockquote>
14650 !! result
14651 <blockquote><div>
14652 <p>Line one
14653 </p>
14654 Line two</div></blockquote>
14655
14656 !! end
14657
14658 !! test
14659 Paragraphs inside blockquotes/divs (extra line break on close)
14660 !! input
14661 <blockquote><div>Line one
14662
14663 Line two
14664 </div></blockquote>
14665 !! result
14666 <blockquote><div>Line one
14667 <p>Line two
14668 </p>
14669 </div></blockquote>
14670
14671 !! end
14672
14673 !! test
14674 Paragraphs inside blockquotes/divs (extra line break on open and close)
14675 !! input
14676 <blockquote><div>
14677 Line one
14678
14679 Line two
14680 </div></blockquote>
14681 !! result
14682 <blockquote><div>
14683 <p>Line one
14684 </p><p>Line two
14685 </p>
14686 </div></blockquote>
14687
14688 !! end
14689
14690 !! test
14691 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
14692 !! options
14693 wgLinkHolderBatchSize=0
14694 !! input
14695 [[meatball:1]]
14696 [[meatball:2]]
14697 [[meatball:3]]
14698 !! result
14699 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
14700 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
14701 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
14702 </p>
14703 !! end
14704
14705 !! test
14706 Free external link invading image caption
14707 !! input
14708 [[Image:Foobar.jpg|thumb|http://x|hello]]
14709 !! result
14710 <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>
14711
14712 !! end
14713
14714 !! test
14715 Bug 15196: localised external link numbers
14716 !! options
14717 language=fa
14718 !! input
14719 [http://en.wikipedia.org/]
14720 !! result
14721 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
14722 </p>
14723 !! end
14724
14725 !! test
14726 Multibyte character in padleft
14727 !! input
14728 {{padleft:-Hello|7|Æ}}
14729 !! result
14730 <p>Æ-Hello
14731 </p>
14732 !! end
14733
14734 !! test
14735 Multibyte character in padright
14736 !! input
14737 {{padright:Hello-|7|Æ}}
14738 !! result
14739 <p>Hello-Æ
14740 </p>
14741 !! end
14742
14743 !!test
14744 formatdate parser function
14745 !!input
14746 {{#formatdate:2009-03-24}}
14747 !! result
14748 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
14749 </p>
14750 !! end
14751
14752 !!test
14753 formatdate parser function, with default format
14754 !!input
14755 {{#formatdate:2009-03-24|mdy}}
14756 !! result
14757 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
14758 </p>
14759 !! end
14760
14761 !! test
14762 Spacing of numbers in formatted dates
14763 !! input
14764 {{#formatdate:January 15}}
14765 !! result
14766 <p><span class="mw-formatted-date" title="01-15">January 15</span>
14767 </p>
14768 !! end
14769
14770 !! test
14771 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
14772 !! options
14773 language=nl title=[[MediaWiki:Common.css]]
14774 !! input
14775 {{#formatdate:2009-03-24|dmy}}
14776 !! result
14777 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
14778 </p>
14779 !! end
14780
14781 #
14782 #
14783 #
14784
14785 #
14786 # Edit comments
14787 #
14788
14789 !! test
14790 Edit comment with link
14791 !! options
14792 comment
14793 !! input
14794 I like the [[Main Page]] a lot
14795 !! result
14796 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
14797 !!end
14798
14799 !! test
14800 Edit comment with link and link text
14801 !! options
14802 comment
14803 !! input
14804 I like the [[Main Page|best pages]] a lot
14805 !! result
14806 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
14807 !!end
14808
14809 !! test
14810 Edit comment with link and link text with suffix
14811 !! options
14812 comment
14813 !! input
14814 I like the [[Main Page|best page]]s a lot
14815 !! result
14816 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
14817 !!end
14818
14819 !! test
14820 Edit comment with section link (non-local, eg in history list)
14821 !! options
14822 comment title=[[Main Page]]
14823 !! input
14824 /* External links */ removed bogus entries
14825 !! result
14826 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
14827 !!end
14828
14829 !! test
14830 Edit comment with section link and text before it (non-local, eg in history list)
14831 !! options
14832 comment title=[[Main Page]]
14833 !! input
14834 pre-comment text /* External links */ removed bogus entries
14835 !! result
14836 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>
14837 !!end
14838
14839 !! test
14840 Edit comment with section link (local, eg in diff view)
14841 !! options
14842 comment local title=[[Main Page]]
14843 !! input
14844 /* External links */ removed bogus entries
14845 !! result
14846 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
14847 !!end
14848
14849 !! test
14850 Edit comment with subpage link (bug 14080)
14851 !! options
14852 comment
14853 subpage
14854 title=[[Subpage test]]
14855 !! input
14856 Poked at a [[/subpage]] here...
14857 !! result
14858 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
14859 !!end
14860
14861 !! test
14862 Edit comment with subpage link and link text (bug 14080)
14863 !! options
14864 comment
14865 subpage
14866 title=[[Subpage test]]
14867 !! input
14868 Poked at a [[/subpage|neat little page]] here...
14869 !! result
14870 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
14871 !!end
14872
14873 !! test
14874 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
14875 !! options
14876 comment
14877 title=[[Subpage test]]
14878 !! input
14879 Poked at a [[/subpage]] here...
14880 !! result
14881 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...
14882 !!end
14883
14884 !! test
14885 Edit comment with bare anchor link (local, as on diff)
14886 !! options
14887 comment
14888 local
14889 title=[[Main Page]]
14890 !!input
14891 [[#section]]
14892 !! result
14893 <a href="#section">#section</a>
14894 !! end
14895
14896 !! test
14897 Edit comment with bare anchor link (non-local, as on history)
14898 !! options
14899 comment
14900 title=[[Main Page]]
14901 !!input
14902 [[#section]]
14903 !! result
14904 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
14905 !! end
14906
14907 !! test
14908 Anchor starting with underscore
14909 !!input
14910 [[#_ref|One]]
14911 !! result
14912 <p><a href="#_ref">One</a>
14913 </p>
14914 !! end
14915
14916 !! test
14917 Id starting with underscore
14918 !!input
14919 <div id="_ref"></div>
14920 !! result
14921 <div id="_ref"></div>
14922
14923 !! end
14924
14925 !! test
14926 Space normalisation on autocomment (bug 22784)
14927 !! options
14928 comment
14929 title=[[Main Page]]
14930 !!input
14931 /* __hello__world__ */
14932 !! result
14933 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
14934 !! end
14935
14936 !! test
14937 percent-encoding and + signs in comments (Bug 26410)
14938 !! options
14939 comment
14940 !!input
14941 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
14942 !! result
14943 <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>
14944 !! end
14945
14946 !! test
14947 Bad images - basic functionality
14948 !! options
14949 disabled
14950 !! input
14951 [[File:Bad.jpg]]
14952 !! result
14953 !! end
14954
14955 !! test
14956 Bad images - bug 16039: text after bad image disappears
14957 !! options
14958 disabled
14959 !! input
14960 Foo bar
14961 [[File:Bad.jpg]]
14962 Bar foo
14963 !! result
14964 <p>Foo bar
14965 </p><p>Bar foo
14966 </p>
14967 !! end
14968
14969 !! test
14970 Verify that displaytitle works (bug #22501) no displaytitle
14971 !! options
14972 showtitle
14973 !! config
14974 wgAllowDisplayTitle=true
14975 wgRestrictDisplayTitle=false
14976 !! input
14977 this is not the the title
14978 !! result
14979 Parser test
14980 <p>this is not the the title
14981 </p>
14982 !! end
14983
14984 !! test
14985 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
14986 !! options
14987 showtitle
14988 title=[[Screen]]
14989 !! config
14990 wgAllowDisplayTitle=true
14991 wgRestrictDisplayTitle=false
14992 !! input
14993 this is not the the title
14994 {{DISPLAYTITLE:whatever}}
14995 !! result
14996 whatever
14997 <p>this is not the the title
14998 </p>
14999 !! end
15000
15001 !! test
15002 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
15003 !! options
15004 showtitle
15005 title=[[Screen]]
15006 !! config
15007 wgAllowDisplayTitle=true
15008 wgRestrictDisplayTitle=true
15009 !! input
15010 this is not the the title
15011 {{DISPLAYTITLE:whatever}}
15012 !! result
15013 Screen
15014 <p>this is not the the title
15015 </p>
15016 !! end
15017
15018 !! test
15019 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
15020 !! options
15021 showtitle
15022 title=[[Screen]]
15023 !! config
15024 wgAllowDisplayTitle=true
15025 wgRestrictDisplayTitle=true
15026 !! input
15027 this is not the the title
15028 {{DISPLAYTITLE:screen}}
15029 !! result
15030 screen
15031 <p>this is not the the title
15032 </p>
15033 !! end
15034
15035 !! test
15036 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
15037 !! options
15038 showtitle
15039 title=[[Screen]]
15040 !! config
15041 wgAllowDisplayTitle=false
15042 !! input
15043 this is not the the title
15044 {{DISPLAYTITLE:screen}}
15045 !! result
15046 Screen
15047 <p>this is not the the title
15048 <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>
15049 </p>
15050 !! end
15051
15052 !! test
15053 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
15054 !! options
15055 showtitle
15056 title=[[Screen]]
15057 !! config
15058 wgAllowDisplayTitle=false
15059 !! input
15060 this is not the the title
15061 !! result
15062 Screen
15063 <p>this is not the the title
15064 </p>
15065 !! end
15066
15067 !! test
15068 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
15069 !! options
15070 showtitle
15071 title=[[Screen]]
15072 !! config
15073 wgAllowDisplayTitle=true
15074 wgRestrictDisplayTitle=true
15075 !! input
15076 this is not the the title
15077 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
15078 !! result
15079 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
15080 <p>this is not the the title
15081 </p>
15082 !! end
15083
15084 !! test
15085 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
15086 !! options
15087 showtitle
15088 title=[[Screen]]
15089 !! config
15090 wgAllowDisplayTitle=true
15091 wgRestrictDisplayTitle=true
15092 !! input
15093 this is not the the title
15094 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
15095 !! result
15096 <span style="color: red;">s</span>creen
15097 <p>this is not the the title
15098 </p>
15099 !! end
15100
15101 !! test
15102 preload: check <noinclude> and <includeonly>
15103 !! options
15104 preload
15105 !! input
15106 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
15107 !! result
15108 Hello kind world.
15109 !! end
15110
15111 !! test
15112 preload: check <onlyinclude>
15113 !! options
15114 preload
15115 !! input
15116 Goodbye <onlyinclude>Hello world</onlyinclude>
15117 !! result
15118 Hello world
15119 !! end
15120
15121 !! test
15122 preload: can pass tags through if we want to
15123 !! options
15124 preload
15125 !! input
15126 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
15127 !! result
15128 <includeonly>Hello world</includeonly>
15129 !! end
15130
15131 !! test
15132 preload: check that it doesn't try to do tricks
15133 !! options
15134 preload
15135 !! input
15136 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
15137 !! result
15138 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
15139 !! end
15140
15141 !! test
15142 Play a bit with r67090 and bug 3158
15143 !! options
15144 disabled
15145 !! input
15146 <div style="width:50% !important">&nbsp;</div>
15147 <div style="width:50%&nbsp;!important">&nbsp;</div>
15148 <div style="width:50%&#160;!important">&nbsp;</div>
15149 <div style="border : solid;">&nbsp;</div>
15150 !! result
15151 <div style="width:50% !important">&nbsp;</div>
15152 <div style="width:50% !important">&nbsp;</div>
15153 <div style="width:50% !important">&nbsp;</div>
15154 <div style="border&#160;: solid;">&nbsp;</div>
15155
15156 !! end
15157
15158 !! test
15159 HTML5 data attributes
15160 !! input
15161 <span data-foo="bar">Baz</span>
15162 <p data-abc-def_hij="">Quuz</p>
15163 !! result
15164 <p><span data-foo="bar">Baz</span>
15165 </p>
15166 <p data-abc-def_hij="">Quuz</p>
15167
15168 !! end
15169
15170 !! test
15171 percent-encoding and + signs in internal links (Bug 26410)
15172 !! input
15173 [[User:+%]] [[Page+title%]]
15174 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
15175 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
15176 [[%33%45]] [[%33%45+]]
15177 !! result
15178 <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>
15179 <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>
15180 <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>
15181 <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>
15182 </p>
15183 !! end
15184
15185 !! test
15186 Special characters in embedded file links (bug 27679)
15187 !! input
15188 [[File:Contains & ampersand.jpg]]
15189 [[File:Does not exist.jpg|Title with & ampersand]]
15190 !! result
15191 <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>
15192 <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>
15193 </p>
15194 !! end
15195
15196
15197 !! test
15198 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
15199 !! input
15200 Text&apos;s been normalized?
15201 !! result
15202 <p>Text&#39;s been normalized?
15203 </p>
15204 !! end
15205
15206 !! test
15207 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
15208 !! input
15209 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
15210 !! result
15211 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
15212 </p>
15213 !! end
15214
15215 !! test
15216 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
15217 !! input
15218 [http://www.example.org/ ideograms]
15219 !! result
15220 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
15221 </p>
15222 !! end
15223
15224 !! test
15225 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
15226 !! input
15227 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
15228 !! result
15229 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
15230 </p>
15231 !! end
15232
15233 !! article
15234 Mediawiki:loop1
15235 !! text
15236 {{Identical|A}}
15237 !! endarticle
15238
15239 !! article
15240 Mediawiki:loop2
15241 !! text
15242 {{Identical|B}}
15243 !! endarticle
15244
15245 !! article
15246 Template:Identical
15247 !! text
15248 {{int:loop1}}
15249 {{int:loop2}}
15250 !! endarticle
15251
15252 !! test
15253 Bug 31098 Template which includes system messages which includes the template
15254 !! input
15255 {{Identical}}
15256 !! result
15257 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
15258 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
15259 </p>
15260 !! end
15261
15262 !! test
15263 Bug31490 Turkish: ucfirst 'blah'
15264 !! options
15265 language=tr
15266 !! input
15267 {{ucfirst:blah}}
15268 !! result
15269 <p>Blah
15270 </p>
15271 !! end
15272
15273 !! test
15274 Bug31490 Turkish: ucfirst 'ix'
15275 !! options
15276 language=tr
15277 !! input
15278 {{ucfirst:ix}}
15279 !! result
15280 <p>İx
15281 </p>
15282 !! end
15283
15284 !! test
15285 Bug31490 Turkish: lcfirst 'BLAH'
15286 !! options
15287 language=tr
15288 !! input
15289 {{lcfirst:BLAH}}
15290 !! result
15291 <p>bLAH
15292 </p>
15293 !! end
15294
15295 !! test
15296 Bug31490 Turkish: ucfırst (with a dotless i)
15297 !! options
15298 language=tr
15299 !! input
15300 {{ucfırst:blah}}
15301 !! result
15302 <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>
15303 </p>
15304 !! end
15305
15306 !! test
15307 Bug31490 ucfırst (with a dotless i) with English language
15308 !! options
15309 language=en
15310 !! input
15311 {{ucfırst:blah}}
15312 !! result
15313 <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>
15314 </p>
15315 !! end
15316
15317 !! test
15318 Bug 26375: TOC with italics
15319 !! options
15320 title=[[Main Page]]
15321 !! input
15322 __TOC__
15323 == ''Lost'' episodes ==
15324 !! result
15325 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15326 <ul>
15327 <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>
15328 </ul>
15329 </div>
15330
15331 <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>
15332
15333 !! end
15334
15335 !! test
15336 Bug 26375: TOC with bold
15337 !! options
15338 title=[[Main Page]]
15339 !! input
15340 __TOC__
15341 == '''should be bold''' then normal text ==
15342 !! result
15343 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15344 <ul>
15345 <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>
15346 </ul>
15347 </div>
15348
15349 <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>
15350
15351 !! end
15352
15353 !! test
15354 Bug 33845: Headings become cursive in TOC when they contain an image
15355 !! options
15356 title=[[Main Page]]
15357 !! input
15358 __TOC__
15359 == Image [[Image:foobar.jpg]] ==
15360 !! result
15361 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15362 <ul>
15363 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
15364 </ul>
15365 </div>
15366
15367 <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>
15368
15369 !! end
15370
15371 !! test
15372 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
15373 !! options
15374 title=[[Main Page]]
15375 !! input
15376 __TOC__
15377 == <blockquote>Quote</blockquote> ==
15378 !! result
15379 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15380 <ul>
15381 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
15382 </ul>
15383 </div>
15384
15385 <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>
15386
15387 !! end
15388
15389 !! test
15390 Unclosed tags in TOC
15391 !! options
15392 title=[[Main Page]]
15393 !! input
15394 __TOC__
15395 == Proof: 2 < 3 ==
15396 <small>Hanc marginis exiguitas non caperet.</small>
15397 QED
15398 !! result
15399 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15400 <ul>
15401 <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>
15402 </ul>
15403 </div>
15404
15405 <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>
15406 <p><small>Hanc marginis exiguitas non caperet.</small>
15407 QED
15408 </p>
15409 !! end
15410
15411 !! test
15412 Multiple tags in TOC
15413 !! input
15414 __TOC__
15415 == <i>Foo</i> <b>Bar</b> ==
15416
15417 == <i>Foo</i> <blockquote>Bar</blockquote> ==
15418 !! result
15419 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15420 <ul>
15421 <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>
15422 <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>
15423 </ul>
15424 </div>
15425
15426 <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>
15427 <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>
15428
15429 !! end
15430
15431 !! test
15432 Tags with parameters in TOC
15433 !! input
15434 __TOC__
15435 == <sup class="in-h2">Hello</sup> ==
15436
15437 == <sup class="a > b">Evilbye</sup> ==
15438 !! result
15439 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15440 <ul>
15441 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
15442 <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>
15443 </ul>
15444 </div>
15445
15446 <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>
15447 <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>
15448
15449 !! end
15450
15451 !! test
15452 span tags with directionality in TOC
15453 !! input
15454 __TOC__
15455 == <span dir="ltr">C++</span> ==
15456
15457 == <span dir="rtl">זבנג!</span> ==
15458
15459 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
15460
15461 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
15462
15463 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
15464 !! result
15465 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15466 <ul>
15467 <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>
15468 <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>
15469 <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>
15470 <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>
15471 <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>
15472 </ul>
15473 </div>
15474
15475 <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>
15476 <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>
15477 <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>
15478 <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>
15479 <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>
15480
15481 !! end
15482
15483 !! article
15484 MediaWiki:Bug32057
15485 !! text
15486 == {{int:headline_sample}} ==
15487 !! endarticle
15488
15489 !! test
15490 Bug 32057: Title needed when expanding <h> nodes.
15491 !! options
15492 title=[[Main Page]]
15493 !! input
15494 {{int:Bug32057}}
15495 !! result
15496 <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>
15497
15498 !! end
15499
15500 !! test
15501 Strip marker in urlencode
15502 !! input
15503 {{urlencode:x<nowiki/>y}}
15504 {{urlencode:x<nowiki/>y|wiki}}
15505 {{urlencode:x<nowiki/>y|path}}
15506 !! result
15507 <p>xy
15508 xy
15509 xy
15510 </p>
15511 !! end
15512
15513 !! test
15514 Strip marker in lc
15515 !! input
15516 {{lc:x<nowiki/>y}}
15517 !! result
15518 <p>xy
15519 </p>
15520 !! end
15521
15522 !! test
15523 Strip marker in uc
15524 !! input
15525 {{uc:x<nowiki/>y}}
15526 !! result
15527 <p>XY
15528 </p>
15529 !! end
15530
15531 !! test
15532 Strip marker in formatNum
15533 !! input
15534 {{formatnum:1<nowiki/>2}}
15535 {{formatnum:1<nowiki/>2|R}}
15536 !! result
15537 <p>12
15538 12
15539 </p>
15540 !! end
15541
15542 !! test
15543 Check noCommafy in formatNum
15544 !! options
15545 language=be-tarask
15546 !! input
15547 {{formatnum:123456.78}}
15548 {{formatnum:123456.78|NOSEP}}
15549 !! result
15550 <p>123 456,78
15551 123456.78
15552 </p>
15553 !! end
15554
15555 !! test
15556 Strip marker in grammar
15557 !! options
15558 language=fi
15559 !! input
15560 {{grammar:elative|foo<nowiki/>bar}}
15561 !! result
15562 <p>foobarista
15563 </p>
15564 !! end
15565
15566 !! test
15567 Strip marker in padleft
15568 !! input
15569 {{padleft:|2|x<nowiki/>y}}
15570 !! result
15571 <p>xy
15572 </p>
15573 !! end
15574
15575 !! test
15576 Strip marker in padright
15577 !! input
15578 {{padright:|2|x<nowiki/>y}}
15579 !! result
15580 <p>xy
15581 </p>
15582 !! end
15583
15584 !! test
15585 Strip marker in anchorencode
15586 !! input
15587 {{anchorencode:x<nowiki/>y}}
15588 !! result
15589 <p>xy
15590 </p>
15591 !! end
15592
15593 !! test
15594 nowiki inside link inside heading (bug 18295)
15595 !! input
15596 ==[[foo|x<nowiki>y</nowiki>z]]==
15597 !! result
15598 <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>
15599
15600 !! end
15601
15602 !! test
15603 new support for bdi element (bug 31817)
15604 !! input
15605 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
15606 !! result
15607 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
15608
15609 !!end
15610
15611 !! test
15612 Ignore pipe between table row attributes
15613 !! input
15614 {|
15615 | quux
15616 |- id=foo | style='color: red'
15617 | bar
15618 |}
15619 !! result
15620 <table>
15621 <tr>
15622 <td> quux
15623 </td></tr>
15624 <tr id="foo" style="color: red">
15625 <td> bar
15626 </td></tr></table>
15627
15628 !! end
15629
15630 !!test
15631 Gallery override link with WikiLink (bug 34852)
15632 !! input
15633 <gallery>
15634 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
15635 </gallery>
15636 !! result
15637 <ul class="gallery mw-gallery-traditional">
15638 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15639 <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>
15640 <div class="gallerytext">
15641 <p>caption
15642 </p>
15643 </div>
15644 </div></li>
15645 </ul>
15646
15647 !! end
15648
15649 !!test
15650 Gallery override link with absolute external link (bug 34852)
15651 !! input
15652 <gallery>
15653 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
15654 </gallery>
15655 !! result
15656 <ul class="gallery mw-gallery-traditional">
15657 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15658 <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>
15659 <div class="gallerytext">
15660 <p>caption
15661 </p>
15662 </div>
15663 </div></li>
15664 </ul>
15665
15666 !! end
15667
15668 !!test
15669 Gallery override link with malicious javascript (bug 34852)
15670 !! input
15671 <gallery>
15672 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
15673 </gallery>
15674 !! result
15675 <ul class="gallery mw-gallery-traditional">
15676 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15677 <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>
15678 <div class="gallerytext">
15679 <p>caption
15680 </p>
15681 </div>
15682 </div></li>
15683 </ul>
15684
15685 !! end
15686
15687 !!test
15688 Gallery with invalid title as link (bug 43964)
15689 !! input
15690 <gallery>
15691 File:foobar.jpg|link=<
15692 </gallery>
15693 !! result
15694 <ul class="gallery mw-gallery-traditional">
15695 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15696 <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>
15697 <div class="gallerytext">
15698 </div>
15699 </div></li>
15700 </ul>
15701
15702 !! end
15703
15704 !!test
15705 Language parser function
15706 !! input
15707 {{#language:ar}}
15708 !! result
15709 <p>العربية
15710 </p>
15711 !! end
15712
15713 !!test
15714 Padleft and padright as substr
15715 !! input
15716 {{padleft:|3|abcde}}
15717 {{padright:|3|abcde}}
15718 !! result
15719 <p>abc
15720 abc
15721 </p>
15722 !! end
15723
15724 !!test
15725 Special parser function
15726 !! input
15727 {{#special:RandomPage}}
15728 {{#special:BaDtItLe}}
15729 {{#special:Foobar}}
15730 !! result
15731 <p>Special:Random
15732 Special:Badtitle
15733 Special:Foobar
15734 </p>
15735 !! end
15736
15737 !!test
15738 Bug 34939 - Case insensitive link parsing ([HttP://])
15739 !! input
15740 [HttP://MediaWiki.Org/]
15741 !! result
15742 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
15743 </p>
15744 !! end
15745
15746 !!test
15747 Bug 34939 - Case insensitive link parsing ([HttP:// title])
15748 !! input
15749 [HttP://MediaWiki.Org/ MediaWiki]
15750 !! result
15751 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
15752 </p>
15753 !! end
15754
15755 !!test
15756 Bug 34939 - Case insensitive link parsing (HttP://)
15757 !! input
15758 HttP://MediaWiki.Org/
15759 !! result
15760 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
15761 </p>
15762 !! end
15763
15764 !!test
15765 Disable TOC
15766 !! options
15767 notoc
15768 !! input
15769 Lead
15770 == Section 1 ==
15771 == Section 2 ==
15772 == Section 3 ==
15773 == Section 4 ==
15774 == Section 5 ==
15775 !! result
15776 <p>Lead
15777 </p>
15778
15779 <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>
15780 <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>
15781 <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>
15782 <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>
15783 <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>
15784
15785 !! end
15786
15787
15788 ###
15789 ### Parsoids-specific tests
15790 ### Parsoid-PHP parser incompatibilities
15791 ###
15792 !!test
15793 1. SOL-sensitive wikitext tokens as template-args
15794 !!options
15795 parsoid=wt2html,wt2wt
15796 !!input
15797 {{echo|*a}}
15798 {{echo|#a}}
15799 {{echo|:a}}
15800 !!result
15801 <span about="#mwt1" typeof="mw:Transclusion">
15802 </span><ul about="#mwt1"><li>a</li></ul>
15803 <span about="#mwt2" typeof="mw:Transclusion">
15804 </span><ol about="#mwt2"><li>a</li></ol>
15805 <span about="#mwt3" typeof="mw:Transclusion">
15806 </span><dl about="#mwt3"><dd>a</dd></dl>
15807 !!end
15808
15809 #### ----------------------------------------------------------------
15810 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
15811 #### tags. Parsoid's output for these tags differs from that of the
15812 #### PHP parser.
15813 #### ----------------------------------------------------------------
15814
15815 !!test
15816 Ref: 1. ref-location should be replaced with an index span
15817 !!options
15818 parsoid
15819 !!input
15820 A <ref>foo</ref>
15821 B <ref name="x">foo</ref>
15822 C <ref name="y" />
15823 !!result
15824 <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>
15825 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>
15826 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>
15827 !!end
15828
15829 !!test
15830 Ref: 2. ref-tags with identical names should all get the same index
15831 !!options
15832 parsoid
15833 !!input
15834 A <ref name="x">foo</ref>
15835 B <ref name="x" />
15836 !!result
15837 <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>
15838 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>
15839 !!end
15840
15841 !!test
15842 Ref: 3. spaces in ref-names should be ignored
15843 !!options
15844 parsoid
15845 !!input
15846 A <ref name="x">foo</ref>
15847 B <ref name=" x " />
15848 C <ref name= x />
15849 !!result
15850 <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>
15851 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>
15852 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>
15853 !!end
15854
15855 !!test
15856 Ref: 4. 'constructor' should be accepted as a valid ref-name
15857 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
15858 !!options
15859 parsoid
15860 !!input
15861 A <ref name="constructor">foo</ref>
15862 !!result
15863 <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>
15864 !!end
15865
15866 !!test
15867 Ref: 5. body should accept generic wikitext
15868 !!options
15869 parsoid
15870 !!input
15871 A <ref>
15872 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
15873 </ref>
15874
15875 <references />
15876 !!result
15877 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"This is a <b data-parsoid=\"{&amp;quot;dsr&amp;quot;:[19,40,3,3]}\"><a rel=\"mw:WikiLink\" href=\"./Bolded_link\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;./Bolded_link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;bolded link&amp;quot;},&amp;quot;dsr&amp;quot;:[22,37,2,2]}\">bolded link</a></b> and this is a <span about=\"#mwt5\" 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;transclusion&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[55,76,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;]}]]}\">transclusion</span>\n"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
15878
15879 <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'>
15880 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> This is a <b><a rel="mw:WikiLink" href="./Bolded_link">bolded link</a></b> and this is a <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"transclusion"}},"i":0}}]}'>transclusion</span>
15881 </li></ol>
15882 !!end
15883
15884 !!test
15885 Ref: 6. indent-pres should not be output in ref-body
15886 !!options
15887 parsoid
15888 !!input
15889 A <ref>
15890 foo
15891 bar
15892 baz
15893 </ref>
15894
15895 <references />
15896 !!result
15897 <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>
15898
15899 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
15900 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
15901 bar
15902 baz
15903 </li></ol>
15904 !!end
15905
15906 !!test
15907 Ref: 7. No p-wrapping in ref-body
15908 !!options
15909 parsoid
15910 !!input
15911 A <ref>
15912 foo
15913
15914 bar
15915
15916
15917 baz
15918
15919
15920
15921 booz
15922 </ref>
15923
15924 <references />
15925 !!result
15926 <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>
15927
15928 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
15929 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
15930
15931 bar
15932
15933
15934 baz
15935
15936
15937
15938 booz
15939 </li></ol>
15940 !!end
15941
15942 !!test
15943 Ref: 8. transclusion wikitext has lower precedence
15944 !!options
15945 parsoid
15946 !!input
15947 A <ref> foo {{echo|</ref> B C}}
15948
15949 <references />
15950 !!result
15951 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo <span typeof=\"mw:Nowiki\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;{{&amp;quot;,&amp;quot;dsr&amp;quot;:[12,14,0,0]}\">{{</span>echo|"},"attrs":{}}' 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>
15952
15953 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
15954 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <span typeof="mw:Nowiki">{{</span>echo|</li></ol>
15955 !!end
15956
15957 !!test
15958 Ref: 9. unclosed comments should not leak out of ref-body
15959 !!options
15960 parsoid
15961 !!input
15962 A <ref> foo <!--</ref> B C
15963
15964 <references />
15965 !!result
15966 <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> B C</p>
15967
15968 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
15969 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li></ol>
15970 !!end
15971
15972 !!test
15973 Ref: 10. Unclosed HTML tags should not leak out of ref-body
15974 !!options
15975 parsoid
15976 !!input
15977 A <ref> <b> foo </ref> B C
15978
15979 <references />
15980 !!result
15981 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"<b data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;autoInsertedEnd&amp;quot;:true,&amp;quot;dsr&amp;quot;:[8,16,3,0]}\"> foo </b>"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> B C</p>
15982
15983 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
15984 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> <b> foo </b></li></ol>
15985 !!end
15986
15987 !!test
15988 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
15989 !!options
15990 parsoid
15991 !!input
15992 A <ref>foo</ref> B
15993 C <ref>bar</ref> D
15994 !!result
15995 <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> B
15996 C <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[2]</a></span> D</p>
15997 !!end
15998
15999 !!test
16000 Ref: 12. ref-tags act as trailing newline migration barrier
16001 !!options
16002 parsoid
16003 !!input
16004 <!--the newline at the end of this line moves out of the p-tag-->a
16005
16006 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
16007 <ref />
16008
16009 c
16010 !!result
16011 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
16012
16013
16014 <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>
16015 <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>
16016
16017
16018 <p>c</p>
16019 !!end
16020
16021 !!test
16022 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
16023 !!options
16024 parsoid
16025 !!input
16026 <ref>foo</ref> A
16027 <ref>bar
16028 </ref> B
16029 !!result
16030 <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
16031 <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>
16032 !!end
16033
16034 !!test
16035 Ref: 14. A nested ref-tag should be emitted as plain text
16036 !!options
16037 parsoid
16038 !!input
16039 <ref>foo <ref>bar</ref> baz</ref>
16040
16041 <references />
16042 !!result
16043 <p><span about="#mwt1" class="reference" data-mw="{&quot;name&quot;:&quot;ref&quot;,&quot;body&quot;:{&quot;html&quot;:&quot;foo &amp;lt;ref&amp;gt;bar&amp;lt;/ref&amp;gt; baz&quot;},&quot;attrs&quot;:{}}" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
16044
16045 <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
16046 <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&gt;bar&lt;/ref&gt; baz</li></ol>
16047 !!end
16048
16049 !!test
16050 Ref: 15. ref-tags with identical names should get identical indexes
16051 !!options
16052 parsoid
16053 !!input
16054 A1 <ref name="a">foo</ref> A2 <ref name="a" />
16055 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
16056
16057 <references />
16058 !!result
16059 <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>
16060 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>
16061
16062 <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></ol>
16063 !!end
16064
16065 !!test
16066 References: 1. references tag without any refs should be handled properly
16067 !!options
16068 parsoid
16069 !!input
16070 <references />
16071 !!result
16072 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
16073 !!end
16074
16075 !!test
16076 References: 2. references tag with group only outputs references from that group
16077 !!options
16078 parsoid
16079 !!input
16080 A <ref group="a">foo</ref>
16081 B <ref group="b">bar</ref>
16082
16083 <references group='a' />
16084 !!result
16085 <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>
16086 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>
16087
16088 <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></ol>
16089 !!end
16090
16091 !!test
16092 References: 3. ref list should be cleared after processing references
16093 !!options
16094 parsoid
16095 !!input
16096 A <ref>foo</ref>
16097
16098 <references />
16099
16100 B <ref>bar</ref>
16101
16102 <references />
16103 !!result
16104 <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>
16105
16106 <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></ol>
16107
16108 <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>
16109
16110 <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></ol>
16111 !!end
16112
16113 !!test
16114 References: 4. only referenced group should be cleared after processing references
16115 !!options
16116 parsoid
16117 !!input
16118 A <ref group="a">afoo</ref>
16119 B <ref>bfoo</ref>
16120
16121 <references group="a"/>
16122
16123 C <ref>cfoo</ref>
16124
16125 <references />
16126 !!result
16127 <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>
16128 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>
16129
16130 <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></ol>
16131
16132 <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>
16133
16134 <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></ol>
16135 !!end
16136
16137 !!test
16138 References: 5. ref tags in references should be processed while ignoring all other content
16139 !!options
16140 parsoid
16141 !!input
16142 A <ref name="a" />
16143 B <ref name="b">bar</ref>
16144
16145 <references>
16146 <ref name="a">foo</ref>
16147 This should just get lost.
16148 </references>
16149 !!result
16150 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{"name":"a"}}' id="cite_ref-a-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-a-1">[1]</a></span>
16151 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"><a href="#cite_note-b-2">[2]</a></span></p>
16152
16153 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","body":{"extsrc":"<ref name=\"a\">foo</ref>\nThis should just get lost.","html":"\n<span about=\"#mwt8\" class=\"reference\" data-mw=\"{&amp;quot;name&amp;quot;:&amp;quot;ref&amp;quot;,&amp;quot;body&amp;quot;:{&amp;quot;html&amp;quot;:&amp;quot;foo&amp;quot;},&amp;quot;attrs&amp;quot;:{&amp;quot;name&amp;quot;:&amp;quot;a&amp;quot;}}\" rel=\"dc:references\" typeof=\"mw:Extension/ref\"><a href=\"#cite_note-a-1\">[1]</a></span>\n"},"attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy"><a href="#cite_ref-a-1-0">↑</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">↑</a></span> bar</li></ol>
16154 !!end
16155
16156 !!test
16157 References: 6. <references /> from a transclusion
16158 !!options
16159 parsoid
16160 !!input
16161 {{echo|<references />}}
16162 !!result
16163 <ol class="references" about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<references />"}},"i":0}}]}'></ol>
16164 !!end
16165
16166 !! test
16167 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
16168 !! options
16169 parsoid
16170 !! input
16171 A <ref>foo bar for a</ref>
16172 B <ref name="b" />
16173
16174 <references />
16175
16176 <references>
16177 <ref name="b">foo</ref>
16178 </references>
16179 !! result
16180 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo bar for a"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span>
16181 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"><a href="#cite_note-b-2">[2]</a></span></p>
16182
16183 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
16184 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo bar for a</li>
16185 <li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b-2-0">↑</a></span> </li></ol>
16186
16187 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","body":{"extsrc":"<ref name=\"b\">foo</ref>","html":"\n<span about=\"#mwt10\" class=\"reference\" data-mw=\"{&amp;quot;name&amp;quot;:&amp;quot;ref&amp;quot;,&amp;quot;body&amp;quot;:{&amp;quot;html&amp;quot;:&amp;quot;foo&amp;quot;},&amp;quot;attrs&amp;quot;:{&amp;quot;name&amp;quot;:&amp;quot;b&amp;quot;}}\" rel=\"dc:references\" typeof=\"mw:Extension/ref\"><a href=\"#cite_note-b-1\">[1]</a></span>\n"},"attrs":{}}'>
16188 <li about="#cite_note-b-1" id="cite_note-b-1"><span rel="mw:referencedBy">↑</span> foo</li></ol>
16189 !! end
16190
16191 #### ----------------------------------------------------------------
16192 #### The following section of tests are primarily to test
16193 #### wikitext escaping capabilities of Parsoid. Given that
16194 #### escaping can be done any number of ways, the wikitext (input)
16195 #### is always adjusted to reflect how Parsoid adds nowiki
16196 #### escape tags.
16197 ####
16198 #### We are marking several tests as parsoid-only since the
16199 #### HTML in the result section is different from what the
16200 #### PHP parser generates for it.
16201 #### ----------------------------------------------------------------
16202
16203
16204 #### --------------- Headings ---------------
16205 #### 0. Unnested
16206 #### 1. Nested inside html <h1>=foo=</h1>
16207 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
16208 #### 3. Nested inside html with wikitext split by html tags
16209 #### 4. No escape needed
16210 #### 5. Empty headings <h1></h1>
16211 #### 6. Heading chars in SOL context
16212 #### ----------------------------------------
16213 !! test
16214 Headings: 0. Unnested
16215 !! options
16216 parsoid
16217 !! input
16218 <nowiki>=foo=</nowiki>
16219
16220 <nowiki> =foo= </nowiki>
16221 <!--cmt-->
16222 <nowiki>=foo=</nowiki>
16223
16224 =foo''a''<nowiki>=</nowiki>
16225 !! result
16226 <p><span typeof="mw:Nowiki">=foo=</span></p>
16227
16228 <p><span typeof="mw:Nowiki"> =foo= </span>
16229 <!--cmt-->
16230 <span typeof="mw:Nowiki">=foo=</span></p>
16231
16232 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
16233 !!end
16234
16235 !! test
16236 Headings: 1. Nested inside html
16237 !! options
16238 parsoid
16239 !! input
16240 =<nowiki>=foo=</nowiki>=
16241
16242 ==<nowiki>=foo=</nowiki>==
16243
16244 ===<nowiki>=foo=</nowiki>===
16245
16246 ====<nowiki>=foo=</nowiki>====
16247
16248 =====<nowiki>=foo=</nowiki>=====
16249
16250 ======<nowiki>=foo=</nowiki>======
16251 !! result
16252 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
16253 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
16254 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
16255 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
16256 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
16257 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
16258 !!end
16259
16260 !! test
16261 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
16262 !! options
16263 parsoid
16264 !! input
16265 =foo=
16266 <nowiki>*</nowiki>bar
16267
16268 =foo=
16269 =bar
16270
16271 =foo=
16272 <nowiki>=bar=</nowiki>
16273 !! result
16274 <h1>foo</h1>*bar
16275 <h1>foo</h1>=bar
16276 <h1>foo</h1>=bar=
16277 !!end
16278
16279 !! test
16280 Headings: 3. Nested inside html with wikitext split by html tags
16281 !! options
16282 parsoid
16283 !! input
16284 =='''bold'''<nowiki>foo=</nowiki>=
16285 !! result
16286 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
16287 !!end
16288
16289 !! test
16290 Headings: 4a. No escaping needed (testing just h1 and h2)
16291 !! options
16292 parsoid
16293 !! input
16294 ==foo=
16295
16296 =foo==
16297
16298 = =foo= =
16299
16300 ==foo= bar=
16301
16302 ===foo==
16303
16304 ==foo===
16305
16306 =''=''foo==
16307
16308 =<nowiki>=</nowiki>=
16309 !! result
16310 <h1>=foo</h1>
16311 <h1>foo=</h1>
16312 <h1> =foo= </h1>
16313 <h1>=foo= bar</h1>
16314 <h2>=foo</h2>
16315 <h2>foo=</h2>
16316 <h1><i>=</i>foo=</h1>
16317 <h1><span typeof="mw:Nowiki">=</span></h1>
16318 !!end
16319
16320 !! test
16321 Headings: 4b. No escaping needed (inside p-tags)
16322 !! options
16323 parsoid
16324 !! input
16325 ===
16326 =foo= x
16327 =foo= <s></s>
16328 !! result
16329 <p>===
16330 =foo= x
16331 =foo= <s></s>
16332 </p>
16333 !!end
16334
16335 !! test
16336 Headings: 5. Empty headings
16337 !! options
16338 parsoid
16339 !! input
16340 =<nowiki/>=
16341
16342 ==<nowiki/>==
16343
16344 ===<nowiki/>===
16345
16346 ====<nowiki/>====
16347
16348 =====<nowiki/>=====
16349
16350 ======<nowiki/>======
16351 !! result
16352 <h1></h1>
16353 <h2></h2>
16354 <h3></h3>
16355 <h4></h4>
16356 <h5></h5>
16357 <h6></h6>
16358 !!end
16359
16360 !! test
16361 Headings: 6a. Heading chars in SOL context (with trailing spaces)
16362 !! options
16363 parsoid
16364 !! input
16365 <nowiki>=a=</nowiki>
16366
16367 <nowiki>=a=</nowiki>
16368
16369 <nowiki>=a=</nowiki>
16370
16371 <nowiki>=a=</nowiki>
16372 !! result
16373 <p>=a=</p>
16374 <p>=a= </p>
16375 <p>=a= </p>
16376 <p>=a= </p>
16377 !!end
16378
16379 !! test
16380 Headings: 6b. Heading chars in SOL context (with trailing newlines)
16381 !! options
16382 parsoid
16383 !! input
16384 <nowiki>=a=
16385 b</nowiki>
16386
16387 <nowiki>=a=
16388 b</nowiki>
16389
16390 <nowiki>=a=
16391 b</nowiki>
16392
16393 <nowiki>=a=
16394 b</nowiki>
16395 !! result
16396 <p>=a=
16397 b</p>
16398 <p>=a=
16399 b</p>
16400 <p>=a=
16401 b</p>
16402 <p>=a=
16403 b</p>
16404 </p>
16405 !!end
16406
16407 !! test
16408 Headings: 6c. Heading chars in SOL context (leading newline break)
16409 !! options
16410 parsoid
16411 !! input
16412 a
16413 <nowiki>=b=</nowiki>
16414 !! result
16415 <p>a
16416 =b=</p>
16417 !!end
16418
16419 !! test
16420 Headings: 6d. Heading chars in SOL context (with interspersed comments)
16421 !! options
16422 parsoid
16423 !! input
16424 <!--c0--><nowiki>=a=</nowiki>
16425 <!--c1-->
16426 <nowiki>=a=</nowiki> <!--c2--> <!--c3-->
16427 !! result
16428 <p><!--c0-->=a=</p>
16429 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
16430 !!end
16431
16432 !! test
16433 Headings: 6d. Heading chars in SOL context (No escaping needed)
16434 !! options
16435 parsoid=html2wt
16436 !! input
16437 =a=<div>b</div>
16438 !! result
16439 =a=<div>b</div>
16440 !!end
16441
16442 #### --------------- Lists ---------------
16443 #### 0. Outside nests (*foo, etc.)
16444 #### 1. Nested inside html <ul><li>*foo</li></ul>
16445 #### 2. Inside definition lists
16446 #### 3. Only bullets at start should be escaped
16447 #### 4. No escapes needed
16448 #### 5. No unnecessary escapes
16449 #### 6. Escape bullets in SOL position
16450 #### 7. Escape bullets in a multi-line context
16451 #### ----------------------------------------
16452
16453 !! test
16454 Lists: 0. Outside nests
16455 !! input
16456 <nowiki>*</nowiki>foo
16457
16458 <nowiki>#</nowiki>foo
16459 !! result
16460 <p>*foo
16461 </p><p>#foo
16462 </p>
16463 !!end
16464
16465 !! test
16466 Lists: 1. Nested inside html
16467 !! input
16468 *<nowiki>*foo</nowiki>
16469
16470 *<nowiki>#foo</nowiki>
16471
16472 *<nowiki>:foo</nowiki>
16473
16474 *<nowiki>;foo</nowiki>
16475
16476 #<nowiki>*foo</nowiki>
16477
16478 #<nowiki>#foo</nowiki>
16479
16480 #<nowiki>:foo</nowiki>
16481
16482 #<nowiki>;foo</nowiki>
16483 !! result
16484 <ul><li>*foo
16485 </li></ul>
16486 <ul><li>#foo
16487 </li></ul>
16488 <ul><li>:foo
16489 </li></ul>
16490 <ul><li>;foo
16491 </li></ul>
16492 <ol><li>*foo
16493 </li></ol>
16494 <ol><li>#foo
16495 </li></ol>
16496 <ol><li>:foo
16497 </li></ol>
16498 <ol><li>;foo
16499 </li></ol>
16500
16501 !!end
16502
16503 !! test
16504 Lists: 2. Inside definition lists
16505 !! input
16506 ;<nowiki>;foo</nowiki>
16507
16508 ;<nowiki>:foo</nowiki>
16509
16510 ;<nowiki>:foo</nowiki>
16511 :bar
16512
16513 :<nowiki>:foo</nowiki>
16514 !! result
16515 <dl><dt>;foo
16516 </dt></dl>
16517 <dl><dt>:foo
16518 </dt></dl>
16519 <dl><dt>:foo
16520 </dt><dd>bar
16521 </dd></dl>
16522 <dl><dd>:foo
16523 </dd></dl>
16524
16525 !!end
16526
16527 !! test
16528 Lists: 3. Only bullets at start of text should be escaped
16529 !! input
16530 *<nowiki>*foo*bar</nowiki>
16531
16532 *<nowiki>*foo</nowiki>''it''*bar
16533 !! result
16534 <ul><li>*foo*bar
16535 </li></ul>
16536 <ul><li>*foo<i>it</i>*bar
16537 </li></ul>
16538
16539 !!end
16540
16541 !! test
16542 Lists: 4. No escapes needed
16543 !! options
16544 parsoid
16545 !! input
16546 *foo*bar
16547
16548 *''foo''*bar
16549
16550 *[[Foo]]: bar
16551 !! result
16552 <ul><li>foo*bar
16553 </li></ul>
16554 <ul><li><i>foo</i>*bar
16555 </li></ul>
16556 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
16557 </li></ul>
16558 !!end
16559
16560 !! test
16561 Lists: 5. No unnecessary escapes
16562 !! input
16563 * bar <span><nowiki>[[foo]]</nowiki></span>
16564
16565 *=bar <span><nowiki>[[foo]]</nowiki></span>
16566
16567 *[[bar <span><nowiki>[[foo]]</nowiki></span>
16568
16569 *]]bar <span><nowiki>[[foo]]</nowiki></span>
16570
16571 *=bar <span>foo]]</span>=
16572
16573 * <s></s>: a
16574 !! result
16575 <ul><li> bar <span>[[foo]]</span>
16576 </li></ul>
16577 <ul><li>=bar <span>[[foo]]</span>
16578 </li></ul>
16579 <ul><li>[[bar <span>[[foo]]</span>
16580 </li></ul>
16581 <ul><li>]]bar <span>[[foo]]</span>
16582 </li></ul>
16583 <ul><li>=bar <span>foo]]</span>=
16584 </li></ul>
16585 <ul><li> <s></s>: a
16586 </li></ul>
16587
16588 !!end
16589
16590 !! test
16591 Lists: 6. Escape bullets in SOL position
16592 !! options
16593 parsoid
16594 !! input
16595 <!--cmt--><nowiki>*foo</nowiki>
16596 !! result
16597 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
16598 !!end
16599
16600 !! test
16601 Lists: 7. Escape bullets in a multi-line context
16602 !! input
16603 a
16604 <nowiki>*</nowiki>b
16605 !! result
16606 <p>a
16607 *b
16608 </p>
16609 !!end
16610
16611 #### --------------- HRs ---------------
16612 #### 1. Single line
16613 #### -----------------------------------
16614
16615 !! test
16616 HRs: 1. Single line
16617 !! options
16618 parsoid
16619 !! input
16620 ----<nowiki>----</nowiki>
16621 ----=foo=
16622 ----*foo
16623 !! result
16624 <hr><span typeof="mw:Nowiki">----</span>
16625 <hr>=foo=
16626 <hr>*foo
16627 !! end
16628
16629 #### --------------- Tables ---------------
16630 #### 1a. Simple example
16631 #### 1b. No escaping needed (!foo)
16632 #### 1c. No escaping needed (|foo)
16633 #### 1d. No escaping needed (|}foo)
16634 ####
16635 #### 2a. Nested in td (<td>foo|bar</td>)
16636 #### 2b. Nested in td (<td>foo||bar</td>)
16637 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
16638 ####
16639 #### 3a. Nested in th (<th>foo!bar</th>)
16640 #### 3b. Nested in th (<th>foo!!bar</th>)
16641 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
16642 ####
16643 #### 4a. Escape -
16644 #### 4b. Escape +
16645 #### 4c. No escaping needed
16646 #### --------------------------------------
16647
16648 !! test
16649 Tables: 1a. Simple example
16650 !! input
16651 <nowiki>{|
16652 |}</nowiki>
16653 !! result
16654 <p>{|
16655 |}
16656 </p>
16657 !! end
16658
16659 !! test
16660 Tables: 1b. No escaping needed
16661 !! input
16662 !foo
16663 !! result
16664 <p>!foo
16665 </p>
16666 !! end
16667
16668 !! test
16669 Tables: 1c. No escaping needed
16670 !! input
16671 |foo
16672 !! result
16673 <p>|foo
16674 </p>
16675 !! end
16676
16677 !! test
16678 Tables: 1d. No escaping needed
16679 !! input
16680 |}foo
16681 !! result
16682 <p>|}foo
16683 </p>
16684 !! end
16685
16686 !! test
16687 Tables: 2a. Nested in td
16688 !! options
16689 parsoid
16690 !! input
16691 {|
16692 |<nowiki>foo|bar</nowiki>
16693 |}
16694 !! result
16695 <table><tbody><tr>
16696 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
16697 !! end
16698
16699 !! test
16700 Tables: 2b. Nested in td
16701 !! options
16702 parsoid
16703 !! input
16704 {|
16705 |<nowiki>foo||bar</nowiki>
16706 |''it''<nowiki>foo||bar</nowiki>
16707 |}
16708 !! result
16709 <table><tbody><tr>
16710 <td><span typeof="mw:Nowiki">foo||bar</span></td>
16711 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
16712 !! end
16713
16714 !! test
16715 Tables: 2c. Nested in td -- no escaping needed
16716 !! options
16717 parsoid
16718 !! input
16719 {|
16720 |foo!!bar
16721 |}
16722 !! result
16723 <table><tbody><tr><td>foo!!bar
16724 </td></tr></tbody></table>
16725
16726 !! end
16727
16728 !! test
16729 Tables: 3a. Nested in th
16730 !! options
16731 parsoid
16732 !! input
16733 {|
16734 !foo!bar
16735 |}
16736 !! result
16737 <table><tbody><tr><th>foo!bar
16738 </th></tr></tbody></table>
16739
16740 !! end
16741
16742 !! test
16743 Tables: 3b. Nested in th
16744 !! options
16745 parsoid
16746 !! input
16747 {|
16748 !<nowiki>foo!!bar</nowiki>
16749 |}
16750 !! result
16751 <table>
16752 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
16753 </tbody></table>
16754 !! end
16755
16756 !! test
16757 Tables: 3c. Nested in th -- no escaping needed
16758 !! options
16759 parsoid
16760 !! input
16761 {|
16762 !<nowiki>foo||bar</nowiki>
16763 |}
16764 !! result
16765 <table><tbody><tr>
16766 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
16767 !! end
16768
16769 !! test
16770 Tables: 4a. Escape -
16771 !! options
16772 parsoid
16773 !! input
16774 {|
16775 !-bar
16776 |-
16777 |<nowiki>-bar</nowiki>
16778 |}
16779 !! result
16780 <table><tbody>
16781 <tr><th>-bar</th></tr>
16782 <tr>
16783 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
16784 !! end
16785
16786 !! test
16787 Tables: 4b. Escape +
16788 !! options
16789 parsoid
16790 !! input
16791 {|
16792 !+bar
16793 |-
16794 |<nowiki>+bar</nowiki>
16795 |}
16796 !! result
16797 <table><tbody>
16798 <tr><th>+bar</th></tr>
16799 <tr>
16800 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
16801 !! end
16802
16803 !! test
16804 Tables: 4c. No escaping needed
16805 !! options
16806 parsoid
16807 !! input
16808 {|
16809 |foo-bar
16810 |foo+bar
16811 |-
16812 |''foo''-bar
16813 |''foo''+bar
16814 |-
16815 |foo
16816 bar|baz
16817 +bar
16818 -bar
16819 |}
16820 !! result
16821 <table><tbody>
16822 <tr><td>foo-bar</td><td>foo+bar</td></tr>
16823 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
16824 <tr><td>foo
16825 <p>bar|baz
16826 +bar
16827 -bar</p></td></tr>
16828 </tbody></table>
16829 !! end
16830
16831 ### SSS FIXME: Disabled right now because accurate html2wt
16832 ### on this snippet requires data-parsoid flags that we've
16833 ### stripped out of these tests. We should scheme how we
16834 ### we want to handle these kind of tests that require
16835 ### data-parsoid flags for accurate html2wt serialization
16836
16837 !! test
16838 Tables: 4d. No escaping needed
16839 !! options
16840 disabled
16841 !! input
16842 {|
16843 ||+1
16844 ||-2
16845 |}
16846 !! result
16847 <table>
16848 <tr>
16849 <td>+1
16850 </td>
16851 <td>-2
16852 </td></tr></table>
16853
16854 !! end
16855
16856 #### --------------- Links ----------------
16857 #### 1. Quote marks in link text
16858 #### 2. Wikilinks: Escapes needed
16859 #### 3. Wikilinks: No escapes needed
16860 #### 4. Extlinks: Escapes needed
16861 #### 5. Extlinks: No escapes needed
16862 #### --------------------------------------
16863 !! test
16864 Links 1. Quote marks in link text
16865 !! options
16866 parsoid
16867 !! input
16868 [[Foo|Foo<nowiki>''boo''</nowiki>]]
16869 !! result
16870 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
16871 !! end
16872
16873 !! test
16874 Links 2. WikiLinks: Escapes needed
16875 !! options
16876 parsoid
16877 !! input
16878 [[Foo|<nowiki>[Foobar]</nowiki>]]
16879 [[Foo|<nowiki>Foobar]</nowiki>]]
16880 [[Foo|x [Foobar] x]]
16881 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
16882 [[Foo|<nowiki>[[Bar]]</nowiki>]]
16883 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
16884 [[Foo|<nowiki>|Bar</nowiki>]]
16885 [[Foo|<nowiki>]]bar</nowiki>]]
16886 [[Foo|<nowiki>[[bar</nowiki>]]
16887 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
16888 !! result
16889 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
16890 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
16891 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
16892 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
16893 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
16894 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
16895 <a href="Foo" rel="mw:WikiLink">|Bar</a>
16896 <a href="Foo" rel="mw:WikiLink">]]bar</a>
16897 <a href="Foo" rel="mw:WikiLink">[[bar</a>
16898 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
16899 !! end
16900
16901 !! test
16902 Links 3. WikiLinks: No escapes needed
16903 !! options
16904 parsoid
16905 !! input
16906 [[Foo|[Foobar]]
16907 [[Foo|foo|bar]]
16908 !! result
16909 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
16910 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
16911 !! end
16912
16913 !! test
16914 Links 4. ExtLinks: Escapes needed
16915 !! options
16916 parsoid
16917 !! input
16918 [http://google.com <nowiki>[google]</nowiki>]
16919 [http://google.com <nowiki>google]</nowiki>]
16920 !! result
16921 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
16922 <a href="http://google.com" rel="mw:ExtLink">google]</a>
16923 !! end
16924
16925 !! test
16926 Links 5. ExtLinks: No escapes needed
16927 !! options
16928 parsoid
16929 !! input
16930 [http://google.com [google]
16931 !! result
16932 <a href="http://google.com" rel="mw:ExtLink">[google</a>
16933 !! end
16934
16935 #### --------------- Quotes ---------------
16936 #### 1. Quotes inside <b> and <i>
16937 #### 2. Link fragments separated by <i> and <b> tags
16938 #### 3. Link fragments inside <i> and <b>
16939 #### 4. No escaping needed
16940 #### --------------------------------------
16941 !! test
16942 1. Quotes inside <b> and <i>
16943 !! options
16944 parsoid=html2wt,wt2wt
16945 !! input
16946 ''<nowiki>'foo'</nowiki>''
16947 ''<nowiki>''foo''</nowiki>''
16948 ''<nowiki>'''foo'''</nowiki>''
16949 ''foo''<nowiki/>'s
16950 '''<nowiki>'foo'</nowiki>'''
16951 '''<nowiki>''foo''</nowiki>'''
16952 '''<nowiki>'''foo'''</nowiki>'''
16953 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
16954 '''foo'''<nowiki/>'s
16955 '''foo''
16956 ''foo''<nowiki/>'
16957 '<nowiki/>''foo''<nowiki/>'
16958 ''''foo'''
16959 '''foo'''<nowiki/>'
16960 '<nowiki/>'''foo'''<nowiki/>'
16961 !! result
16962 <p><i>'foo'</i>
16963 <i>''foo''</i>
16964 <i>'''foo'''</i>
16965 <i>foo</i>'s
16966 <b>'foo'</b>
16967 <b>''foo''</b>
16968 <b>'''foo'''</b>
16969 <b>foo'<i>bar'</i>baz</b>
16970 <b>foo</b>'s
16971 '<i>foo</i>
16972 <i>foo</i>'
16973 '<i>foo</i>'
16974 '<b>foo</b>
16975 <b>foo</b>'
16976 '<b>foo</b>'</p>
16977 !! end
16978
16979 !! test
16980 2. Link fragments separated by <i> and <b> tags
16981 !! input
16982 [[''foo''<nowiki>hello]]</nowiki>
16983
16984 [['''foo'''<nowiki>hello]]</nowiki>
16985 !! result
16986 <p>[[<i>foo</i>hello]]
16987 </p><p>[[<b>foo</b>hello]]
16988 </p>
16989 !! end
16990
16991 !! test
16992 3. Link fragments inside <i> and <b>
16993 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
16994 this is one of the shortcomings of this format)
16995 !! input
16996 ''[[foo''<nowiki>]]</nowiki>
16997
16998 '''[[foo'''<nowiki>]]</nowiki>
16999 !! result
17000 <p><i>[[foo</i>]]
17001 </p><p><b>[[foo</b>]]
17002 </p>
17003 !! end
17004
17005 !! test
17006 4. No escaping needed
17007 !! input
17008 '<span>''bar''</span>'
17009 '<span>'''bar'''</span>'
17010 !! result
17011 <p>'<span><i>bar</i></span>'
17012 '<span><b>bar</b></span>'
17013 </p>
17014 !! end
17015
17016 #### ----------- Paragraphs ---------------
17017 #### 1. No unnecessary escapes
17018 #### --------------------------------------
17019
17020 !! test
17021 1. No unnecessary escapes
17022 !! input
17023 bar <span><nowiki>[[foo]]</nowiki></span>
17024
17025 =bar <span><nowiki>[[foo]]</nowiki></span>
17026
17027 [[bar <span><nowiki>[[foo]]</nowiki></span>
17028
17029 ]]bar <span><nowiki>[[foo]]</nowiki></span>
17030
17031 =bar <span>foo]]</span><nowiki>=</nowiki>
17032 !! result
17033 <p>bar <span>[[foo]]</span>
17034 </p><p>=bar <span>[[foo]]</span>
17035 </p><p>[[bar <span>[[foo]]</span>
17036 </p><p>]]bar <span>[[foo]]</span>
17037 </p><p>=bar <span>foo]]</span>=
17038 </p>
17039 !!end
17040
17041 #### ----------------------- PRE --------------------------
17042 #### 1. Leading whitespace in SOL context should be escaped
17043 #### ------------------------------------------------------
17044 !! test
17045 1. Leading whitespace in SOL context should be escaped
17046 !! options
17047 parsoid
17048 !! input
17049 <nowiki> </nowiki>a
17050
17051 <nowiki> </nowiki> a
17052
17053 <nowiki> </nowiki>a(tab)
17054
17055 <nowiki> </nowiki> a
17056 <!--cmt-->
17057 <nowiki> </nowiki> a
17058
17059 a
17060 <nowiki> </nowiki>b
17061
17062 a
17063 <nowiki> </nowiki>b
17064
17065 a
17066 <nowiki> </nowiki> b
17067 !! result
17068 <p> a</p>
17069 <p> a</p>
17070 <p> a(tab)</p>
17071 <p> a</p>
17072 <p><!--cmt--> a</p>
17073 <p>a
17074 b</p>
17075 <p>a
17076 b</p>
17077 <p>a
17078 b</p>
17079 !! end
17080
17081 #### --------------- Behavior Switches --------------------
17082 !! test
17083 1. Valid behavior switches should be escaped
17084 !! options
17085 parsoid=html2wt
17086 !! input
17087 <nowiki>__TOC__</nowiki>
17088 !! result
17089 __TOC__
17090 !! end
17091
17092 !! test
17093 2. Invalid behavior switches should not be escaped
17094 !! options
17095 parsoid=html2wt
17096 !! input
17097 __TOO__
17098 __|__
17099 !! result
17100 __TOO__
17101 __|__
17102 !! end
17103
17104 #### --------------- HTML tags ---------------
17105 #### 1. a tags
17106 #### 2. other tags
17107 #### 3. multi-line html tag
17108 #### -----------------------------------------
17109 !! test
17110 1. a tags
17111 !! options
17112 parsoid
17113 !! input
17114 <a href="http://google.com">google</a>
17115 !! result
17116 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
17117 !! end
17118
17119 !! test
17120 2. other tags
17121 !! input
17122 <nowiki><div>foo</div>
17123 <div style="color:red">foo</div></nowiki>
17124 !! result
17125 <p>&lt;div&gt;foo&lt;/div&gt;
17126 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
17127 </p>
17128 !! end
17129
17130 !! test
17131 3. multi-line html tag
17132 !! input
17133 <nowiki><div
17134 >foo</div
17135 ></nowiki>
17136 !! result
17137 <p>&lt;div
17138 &gt;foo&lt;/div
17139 &gt;
17140 </p>
17141 !! end
17142
17143 !! test
17144 4. extension tags
17145 !! input
17146 <nowiki><ref>foo</ref></nowiki>
17147 !! result
17148 <p>&lt;ref&gt;foo&lt;/ref&gt;
17149 </p>
17150 !! end
17151
17152 #### --------------- Others ---------------
17153 !! test
17154 Escaping nowikis
17155 !! input
17156 &lt;nowiki&gt;foo&lt;/nowiki&gt;
17157 !! result
17158 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
17159 </p>
17160 !! end
17161
17162 ## The quote-char in the input is necessary for triggering the bug
17163 !! test
17164 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
17165 !! options
17166 parsoid=wt2wt,html2wt
17167 !! input
17168 foo's bar :
17169 !! result
17170 <p>foo's bar :</p>
17171 !! end
17172
17173 !! test
17174
17175 Tag-like HTML structures are passed through as text
17176 !! input
17177 <x y>
17178
17179 <x.y>
17180
17181 <x-y>
17182
17183 1>2
17184
17185 x<y
17186
17187 a>b
17188
17189 1<d e>f
17190 !! result
17191 <p>&lt;x y&gt;
17192 </p><p>&lt;x.y&gt;
17193 </p><p>&lt;x-y&gt;
17194 </p><p>1&gt;2
17195 </p><p>x&lt;y
17196 </p><p>a&gt;b
17197 </p><p>1&lt;d e&gt;f
17198 </p>
17199 !! end
17200
17201
17202 # This was a bug in the PHP parser (see bug 17663 and its dups,
17203 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
17204 !! test
17205 Tag names followed by punctuation should not be recognized as tags
17206 !! input
17207 <s.ome> text
17208 !! result
17209 <p>&lt;s.ome&gt; text
17210 </p>
17211 !! end
17212
17213 !! test
17214 HTML tag with necessary entities in attributes
17215 !! input
17216 <span title="&amp;amp;">foo</span>
17217 !! result
17218 <p><span title="&amp;amp;">foo</span>
17219 </p>
17220 !! end
17221
17222 !! test
17223 HTML tag with 'unnecessary' entity encoding in attributes
17224 !! input
17225 <span title="&amp;">foo</span>
17226 !! result
17227 <p><span title="&amp;">foo</span>
17228 </p>
17229 !! end
17230
17231 !! test
17232 HTML tag with broken attribute value quoting
17233 !! input
17234 <span title="Hello world>Foo</span>
17235 !! result
17236 <p><span>Foo</span>
17237 </p>
17238 !! end
17239
17240 !! test
17241 Parsoid-only: HTML tag with broken attribute value quoting
17242 !! options
17243 parsoid
17244 !! input
17245 <span title="Hello world>Foo</span>
17246 !! result
17247 <p><span title="Hello world">Foo</span>
17248 </p>
17249 !! end
17250
17251 !! test
17252 Table with broken attribute value quoting
17253 !! input
17254 {|
17255 | title="Hello world|Foo
17256 |}
17257 !! result
17258 <table>
17259 <tr>
17260 <td>Foo
17261 </td></tr></table>
17262
17263 !! end
17264
17265 !! test
17266 Table with broken attribute value quoting on consecutive lines
17267 !! input
17268 {|
17269 | title="Hello world|Foo
17270 | style="color:red|Bar
17271 |}
17272 !! result
17273 <table>
17274 <tr>
17275 <td>Foo
17276 </td>
17277 <td>Bar
17278 </td></tr></table>
17279
17280 !! end
17281
17282 !! test
17283 Parsoid-only: Table with broken attribute value quoting on consecutive lines
17284 !! options
17285 parsoid
17286 !! input
17287 {|
17288 | title="Hello world|Foo
17289 | style="color:red|Bar
17290 |}
17291 !! result
17292 <table><tbody>
17293 <tr>
17294 <td title="Hello world">Foo
17295 </td><td style="color: red">Bar
17296 </td></tr></tbody></table>
17297
17298 !! end
17299
17300 !! test
17301 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
17302 !! options
17303 parsoid
17304 !! input
17305 {{}}
17306 !! result
17307 {{}}
17308 !! end
17309
17310 !! test
17311 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
17312 !! options
17313 parsoid
17314 !! input
17315 }}{{
17316 !! result
17317 }}{{
17318 !! end
17319
17320 !!test
17321 Accept empty td cell attribute
17322 !!input
17323 {|
17324 | align="center" | foo || |
17325 |}
17326 !!result
17327 <table>
17328 <tr>
17329 <td align="center"> foo </td>
17330 <td>
17331 </td></tr></table>
17332
17333 !!end
17334
17335 !!test
17336 Non-empty attributes in th-cells
17337 !!input
17338 {|
17339 ! Foo !! style="color: red" | Bar
17340 |}
17341 !!result
17342 <table>
17343 <tr>
17344 <th> Foo </th>
17345 <th style="color: red"> Bar
17346 </th></tr></table>
17347
17348 !!end
17349
17350 !!test
17351 Accept empty attributes in th-cells
17352 !!input
17353 {|
17354 !| foo !!| bar
17355 |}
17356 !!result
17357 <table>
17358 <tr>
17359 <th> foo </th>
17360 <th> bar
17361 </th></tr></table>
17362
17363 !!end
17364
17365 !!test
17366 Empty table rows go away
17367 !!input
17368 {|
17369 | Hello
17370 | there
17371 |- class="foo"
17372 |-
17373 |}
17374 !! result
17375 <table>
17376 <tr>
17377 <td> Hello
17378 </td>
17379 <td> there
17380 </td></tr>
17381
17382 </table>
17383
17384 !! end
17385
17386 ###
17387 ### Parsoid-centric tests for testing RTing of inter-element separators
17388 ### Edge cases not tested by existing parser tests and specific to
17389 ### Parsoid-specific serialization strategies.
17390 ###
17391
17392 !!test
17393 RT-ed inter-element separators should be valid separators
17394 !!input
17395 {|
17396 |- [[foo]]
17397 |}
17398 !!result
17399 <table>
17400
17401 </table>
17402
17403 !!end
17404
17405 !!test
17406 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
17407 (Parsoid-only since PHP parser relies on Tidy for correct output)
17408 !!options
17409 parsoid
17410 !!input
17411 {|
17412 |<small>foo
17413 bar
17414 |}
17415
17416 {|
17417 |<small>foo<small>
17418 |}
17419 !!result
17420 !!end
17421
17422 !!test
17423 Empty TD followed by TD with tpl-generated attribute
17424 !!input
17425 {|
17426 |-
17427 |
17428 |{{echo|style='color:red'}}|foo
17429 |}
17430 !!result
17431 <table>
17432
17433 <tr>
17434 <td>
17435 </td>
17436 <td>foo
17437 </td></tr></table>
17438
17439 !!end
17440
17441 !!test
17442 Indented table with an empty td
17443 !!input
17444 {|
17445 |-
17446 |
17447 |foo
17448 |}
17449 !!result
17450 <table>
17451
17452 <tr>
17453 <td>
17454 </td>
17455 <td>foo
17456 </td></tr></table>
17457
17458 !!end
17459
17460 !!test
17461 Empty TR followed by a template-generated TR
17462 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
17463 !!options
17464 parsoid
17465 !!input
17466 {|
17467 |-
17468 {{echo|<tr><td>foo</td></tr>}}
17469 |}
17470 !!result
17471 <table>
17472 <tbody>
17473 <tr></tr>
17474 <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}}]}'>
17475 <td>foo</td></tr>
17476 </tbody></table>
17477 !!end
17478
17479 ## PHP and parsoid output differ for this, and since this is primarily
17480 ## for testing Parsoid's serializer, marking this Parsoid only
17481 !!test
17482 Empty TR followed by mixed-ws-comment line should RT correctly
17483 !!options
17484 parsoid
17485 !!input
17486 {|
17487 |-
17488 <!--c-->
17489 |-
17490 <!--c--> <!--d-->
17491 |}
17492 !!result
17493 <table>
17494 <tbody>
17495 <tr></tr>
17496 <!--c-->
17497 <tr>
17498 <!--c--> </tr><!--d-->
17499 </tbody></table>
17500
17501 !!end
17502
17503 !!test
17504 Multi-line image caption generated by templates with/without trailing newlines
17505 !!options
17506 parsoid
17507 !!input
17508 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
17509 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
17510 !!result
17511 <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>
17512 <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>
17513
17514 !!end
17515
17516 ## PHP emits broken html for this, and since this is primarily
17517 ## a Parsoid serializer test, marking this Parsoid only
17518 !!test
17519 Improperly nested inline or quotes tags with whitespace in between
17520 !!options
17521 parsoid
17522 !!input
17523 <span> <s>x</span> </s>
17524 ''' ''x''' ''
17525 !!result
17526 <p><span> <s>x</s></span><s> </s>
17527 <b> <i>x</i></b><i> </i>
17528 </p>
17529 !!end
17530
17531 !!test
17532 Encapsulate protected attributes from wt
17533 !!options
17534 parsoid
17535 !!input
17536 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
17537 !!result
17538 <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>
17539 </body>
17540 !!end
17541
17542 ## Currently the p-wrapper is fragile in how adds / removes transformations.
17543 ## Having nested or stray pre tags results in the attempt to add duplicates,
17544 ## causing an assertion fail. This test tries to prevent that situation.
17545 !!test
17546 Ensure ParagraphWrapper can deal with stray closing pre tags
17547 !!options
17548 parsoid=wt2html
17549 !!input
17550 plain text</pre>
17551 !!result
17552 plain text
17553 !!end
17554
17555 !!test
17556 Ensure fostered text content is wrapped in spans
17557 !!options
17558 parsoid=wt2html
17559 !!input
17560 <table>hi</table><table>ho</table>
17561 !!result
17562 <span>hi</span>
17563 <table></table>
17564 <span>ho</span>
17565 <table></table>
17566 !!end
17567
17568 !!test
17569 Encapsulation properly handles null DSR information from foster box
17570 !!options
17571 parsoid=wt2html,wt2wt
17572 !!input
17573 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
17574 !!result
17575 <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;
17576 <table>foo
17577 <tr>
17578 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
17579 <table>
17580 <tbody>
17581 <tr>
17582 <td>bar</td></tr></tbody></table>
17583 !!end
17584
17585 !!test
17586 1. Encapsulate foster-parented transclusion content
17587 !!options
17588 parsoid=wt2wt,wt2html
17589 !!input
17590 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
17591 !!result
17592 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
17593 <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
17594 <tr>
17595 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
17596 <table>
17597 <tbody>
17598 <tr>
17599 <td>bar</td></tr></tbody></table>
17600 !!end
17601
17602 !!test
17603 2. Encapsulate foster-parented transclusion content
17604 !!options
17605 parsoid=wt2wt,wt2html
17606 !!input
17607 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
17608 !!result
17609 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
17610 <table>
17611 <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>
17612 <tr>
17613 <td>bar</td></tr></table>&quot;]}">foo</div>
17614 <table>
17615 <tbody>
17616 <tr>
17617 <td>bar</td></tr></tbody></table>
17618 !!end
17619
17620 !!test
17621 3. Encapsulate foster-parented transclusion content
17622 !!options
17623 parsoid=wt2wt,wt2html
17624 !!input
17625 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
17626 !!result
17627 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
17628 <table>
17629 <div>
17630 <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>
17631 <tr>
17632 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
17633 <p>foo</p></div>
17634 <table>
17635 <tbody>
17636 <tr>
17637 <td>bar</td></tr></tbody></table>
17638 !!end
17639
17640 !!test
17641 4. Encapsulate foster-parented transclusion content
17642 !!options
17643 parsoid=wt2wt,wt2html
17644 !!input
17645 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
17646 !!result
17647 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
17648 <table>
17649 <div>
17650 <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>
17651 <tr>
17652 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
17653 <p>foo</p></div>
17654 <table>
17655 <tbody>
17656 <tr>
17657 <td>bar</td></tr></tbody></table>
17658 !!end
17659
17660 !!test
17661 5. Encapsulate foster-parented transclusion content
17662 !!options
17663 parsoid=wt2wt,wt2html
17664 !!input
17665 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
17666 !!result
17667 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
17668 <table>
17669 <tr>
17670 <td>
17671 <div>
17672 <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>
17673 <table>
17674 <tbody>
17675 <tr>
17676 <td>
17677 <div>
17678 <p>foo</p></div></td></tr></tbody></table>
17679 !!end
17680
17681 !!test
17682 6. Encapsulate foster-parented transclusion content
17683 !!options
17684 parsoid=wt2wt,wt2html
17685 !!input
17686 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
17687 !!result
17688 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
17689 <table>
17690 <tr>
17691 <td>
17692 <div>
17693 <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>
17694 <table>
17695 <tbody>
17696 <tr>
17697 <td>
17698 <div>
17699 <p>foo</p></div></td></tr></tbody></table>
17700 <p>ok</p>
17701 !!end
17702
17703 !!test
17704 7. Encapsulate foster-parented transclusion content
17705 !!options
17706 parsoid=wt2wt,wt2html
17707 !!input
17708 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
17709 !!result
17710 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
17711 <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;
17712 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
17713 <td>bar</td></table>&quot;]}">foo</p>
17714 <table>
17715 <tbody>
17716 <tr>
17717 <td>bar</td></tr></tbody></table>
17718 !!end
17719
17720 !!test
17721 8. Encapsulate foster-parented transclusion content
17722 !!options
17723 parsoid=wt2wt,wt2html
17724 !!input
17725 {{echo|a
17726 }}{|{{echo|style='color:red'}}
17727 |-
17728 |b
17729 |}
17730 !!result
17731 <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>
17732 <table>
17733 <tbody>
17734 <tr>
17735 <td>b</td></tr></tbody></table>
17736 !!end
17737
17738 # -----------------------------------------------------------------
17739 # The following section of tests are primarily to spec requirements
17740 # around serialization of new/edited content.
17741 #
17742 # All these tests are marked Parsoid html2wt and html2html only
17743 # ----------------------------------------------------------------
17744
17745 !! test
17746 Image: Modifying size of an image
17747 !! options
17748 parsoid=html2wt
17749 !! input
17750 [[Image:Wiki.png|230x230px]]
17751 !! result
17752 <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>
17753 !!end
17754
17755 !! test
17756 Image: New block level image should have \n before and after
17757 !! options
17758 parsoid=html2wt
17759 !! input
17760 123
17761 [[File:Wiki.png|right|thumb|150x150px]]
17762 456
17763 !! result
17764 <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>
17765 !!end
17766
17767 # Wacky -- the leading newline in input is required because
17768 # that is what the serializer emits. To be fixed. Not fixing
17769 # the test because this test is required to test serialization of
17770 # new content and preferred whitespace style.
17771 !! test
17772 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
17773 !! options
17774 parsoid=html2wt
17775 !! input
17776
17777 * foo
17778 !! result
17779 <ul>
17780 <li><p>foo</p></li>
17781 </ul>
17782 !! end
17783
17784 # Wacky -- the leading newline in input is required because
17785 # that is what the serializer emits. To be fixed. Not fixing
17786 # the test because this test is required to test serialization of
17787 # new content and preferred whitespace style.
17788 !! test
17789 Lists: Add space after bullets
17790 !! options
17791 parsoid=html2wt
17792 !! input
17793
17794 * foo
17795 * bar
17796 * <span> baz</span>
17797 !! result
17798 <ul>
17799 <li>foo</li>
17800 <li> bar</li>
17801 <li><span> baz</span></li>
17802 </ul>
17803 !! end
17804
17805 !! test
17806 Parsoid: Serialize positional parameters with = in them as named parameter
17807 !! options
17808 parsoid=html2wt
17809 !! input
17810 {{echo|1 = f=oo}}
17811
17812 {{echo|1 = f=oo|2 = bar}}
17813
17814 <!--Orig params with data-parsoid has heuristics for handling = chars-->
17815 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
17816 {{echo|<nowiki>f=oo</nowiki>|bar}}
17817 !! result
17818 <p about="#mwt1" typeof="mw:Transclusion"
17819 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
17820
17821 <p about="#mwt1" typeof="mw:Transclusion"
17822 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
17823
17824 <!--Orig params with data-parsoid has heuristics for handling = chars-->
17825 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
17826 <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>
17827 !! end
17828
17829 !! test
17830 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
17831 !! options
17832 parsoid=html2wt
17833 !! input
17834 <div>a
17835 b
17836 </div>
17837 <div>a
17838 b
17839 </div>
17840 <div>
17841 a
17842
17843 b
17844 </div>
17845 !! result
17846 <div>a<p>b</p></div>
17847 <div>a
17848 <p>b</p></div>
17849 <div>
17850 a
17851 <p>b</p></div>
17852 !! end
17853
17854 #-----------------------------
17855 # I/B quote minimization tests
17856 #-----------------------------
17857
17858 !! test
17859 1. I/B quote minimization: wikitext-only tags should be combined
17860 !! options
17861 parsoid=html2wt
17862 !! input
17863 ''AB''
17864
17865 '''AB'''
17866
17867 ''A'''B'''''
17868
17869 '''A''B'''''
17870
17871 '''A''BC''D'''
17872
17873 '''''AB'''''
17874
17875 '''''AB'''''
17876
17877 '''''AB'''''
17878 !! result
17879 <p><i>A</i><i>B</i></p>
17880 <p><b>A</b><b>B</b></p>
17881 <p><i>A</i><b><i>B</i></b></p>
17882 <p><b>A</b><i><b>B</b></i></p>
17883 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
17884 <p><i><b>A</b></i><i><b>B</b></i></p>
17885 <p><i><b>A</b></i><b><i>B</i></b></p>
17886 <p><b><i>A</i></b><i><b>B</b></i></p>
17887 !! end
17888
17889 !! test
17890 2. I/B quote minimization: wikitext and html tags should not be combined
17891 !! options
17892 parsoid=html2wt
17893 !! input
17894 ''A''<i>B</i>
17895
17896 ''A'''''<i>B</i>'''
17897 !! result
17898 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
17899 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
17900 !! end
17901
17902 !! test
17903 3. I/B quote minimization: templated content stops minimization
17904 !! options
17905 parsoid=html2wt
17906 !! input
17907 ''A''{{echo|''B''}}
17908
17909 ''A''{{echo|'''''B'''''}}
17910 !! result
17911 <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>
17912 <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>
17913 !! end
17914
17915 !! test
17916 4. I/B quote minimization: new content should be mimimized with adjacent old content
17917 !! options
17918 parsoid=html2wt
17919 !! input
17920 ''AB''
17921
17922 '''AB'''
17923
17924 ''A'''B'''''
17925 !! result
17926 <p><i>A</i><i data-parsoid='{}'>B</i></p>
17927 <p><b data-parsoid='{}'>A</b><b>B</b></p>
17928 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
17929 !! end
17930
17931 # -----------------------------------------------------------------
17932 # End of section for Parsoid-only html2wt tests for serialization
17933 # of new content
17934 # -----------------------------------------------------------------
17935
17936 TODO:
17937 more images
17938 more tables
17939 character entities
17940 and much more
17941 Try for 100% code coverage