Merge "(bug 46463) Mark edit preview as in page view language"
[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 #
30 # You can also set the following parser properties via test options:
31 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
32 # wgLinkHolderBatchSize, wgRawHtml
33 #
34 # For testing purposes, temporary articles can created:
35 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
36 # where '/' denotes a newline.
37
38 # This is the standard article assumed to exist.
39 !! article
40 Main Page
41 !! text
42 blah blah
43 !! endarticle
44
45 !!article
46 Template:Foo
47 !!text
48 FOO
49 !!endarticle
50
51 !! article
52 Template:Blank
53 !! text
54 !! endarticle
55
56 !! article
57 Template:pipe
58 !! text
59 |
60 !! endarticle
61
62 !!article
63 MediaWiki:bad image list
64 !!text
65 * [[File:Bad.jpg]] except [[Nasty page]]
66 !!endarticle
67
68 !! article
69 Template:inner list
70 !! text
71 * item 1
72 !! endarticle
73
74 !! article
75 Template:tbl-start
76 !! text
77 {|
78 !! endarticle
79
80 !! article
81 Template:tbl-end
82 !! text
83 |}
84 !! endarticle
85
86 !! article
87 Template:!
88 !! text
89 |
90 !! endarticle
91
92 !! article
93 Template:echo
94 !! text
95 {{{1}}}
96 !! endarticle
97
98 !! article
99 Template:echo_with_span
100 !! text
101 <span>{{{1}}}</span>
102 !! endarticle
103
104 !! article
105 Template:echo_with_div
106 !! text
107 <div>{{{1}}}</div>
108 !! endarticle
109
110 !! article
111 Template:attr_str
112 !! text
113 {{{1}}}="{{{2}}}"
114 !! endarticle
115
116 !! article
117 Template:table_attribs
118 !! text
119 <noinclude>
120 |</noinclude>style="color: red"| Foo
121 !! endarticle
122
123 !! article
124 Template:table_cells
125 !! text
126 {{table_attribs}} || Bar || Baz
127 !! endarticle
128
129 !! article
130 Template:image_attribs
131 !! text
132 <noinclude>
133 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
134 !! endarticle
135
136 !! article
137 A?b
138 !! text
139 Weirdo titles!
140 !! endarticle
141
142 ###
143 ### Basic tests
144 ###
145 !! test
146 Blank input
147 !! input
148 !! result
149 !! end
150
151
152 !! test
153 Simple paragraph
154 !! input
155 This is a simple paragraph.
156 !! result
157 <p>This is a simple paragraph.
158 </p>
159 !! end
160
161 !! test
162 Paragraphs with extra newline spacing
163 !! input
164 foo
165
166 bar
167
168
169 baz
170
171
172
173 booz
174 !! result
175 <p>foo
176 </p><p>bar
177 </p><p><br />
178 baz
179 </p><p><br />
180 </p><p>booz
181 </p>
182 !! end
183
184 !! test
185 Paragraphs with newline spacing with comment lines in between
186 !! input
187 ----
188 a
189 <!--foo-->
190 b
191 ----
192 a
193 <!--foo--><!--More than 1 comment disables stripping of this line!-->
194 b
195 ----
196 a
197 <!--foo-->
198
199 b
200 ----
201 a
202
203 <!--foo-->
204 b
205 ----
206 a
207 <!--foo-->
208
209
210 b
211 ----
212 a
213
214
215 <!--foo-->
216 b
217 ----
218 !! result
219 <hr />
220 <p>a
221 b
222 </p>
223 <hr />
224 <p>a
225 </p><p>b
226 </p>
227 <hr />
228 <p>a
229 </p><p>b
230 </p>
231 <hr />
232 <p>a
233 </p><p>b
234 </p>
235 <hr />
236 <p>a
237 </p><p><br />
238 b
239 </p>
240 <hr />
241 <p>a
242 </p><p><br />
243 b
244 </p>
245 <hr />
246
247 !! end
248
249 !! test
250 Paragraphs with newline spacing with non-empty white-space lines in between
251 !! input
252 ----
253 a
254
255 b
256 ----
257 a
258
259
260 b
261 ----
262 !! result
263 <hr />
264 <p>a
265 </p><p>b
266 </p>
267 <hr />
268 <p>a
269 </p><p><br />
270 b
271 </p>
272 <hr />
273
274 !! end
275
276 !! test
277 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
278 !! input
279 ----
280 a
281 <!--foo-->
282 b
283 ----
284 a
285 <!--foo--><!--More than 1 comment disables stripping of this line!-->
286 b
287 ----
288 a
289
290 <!--foo-->
291 <!--bar-->
292 b
293 ----
294 a
295
296 <!--foo-->
297 <!--bar-->
298
299 b
300 ----
301 !! result
302 <hr />
303 <p>a
304 b
305 </p>
306 <hr />
307 <p>a
308 </p><p>b
309 </p>
310 <hr />
311 <p>a
312 </p><p>b
313 </p>
314 <hr />
315 <p>a
316 </p><p><br />
317 b
318 </p>
319 <hr />
320
321 !! end
322
323 !! test
324 Extra newlines: More paragraphs with indented comment
325 !! input
326 a
327
328 <!--boo-->
329
330 b
331 !!result
332 <p>a
333 </p><p><br />
334 b
335 </p>
336 !!end
337
338 !! test
339 Extra newlines followed by heading
340 !! input
341 a
342
343
344
345 =b=
346 [[a]]
347
348
349 =b=
350 !! result
351 <p>a
352 </p><p><br />
353 </p>
354 <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>
355 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
356 </p><p><br />
357 </p>
358 <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>
359
360 !! end
361
362 !! test
363 Extra newlines between heading and content are swallowed
364 !! input
365 =b=
366
367
368
369 [[a]]
370 !! result
371 <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>
372 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
373 </p>
374 !! end
375
376 !! test
377 Parsing an URL
378 !! input
379 http://fr.wikipedia.org/wiki/🍺
380 <!-- EasterEgg we love beer, better be able be able to link to it -->
381 !! result
382 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
383 </p>
384 !! end
385
386 !! test
387 Simple list
388 !! input
389 * Item 1
390 * Item 2
391 !! result
392 <ul><li> Item 1
393 </li><li> Item 2
394 </li></ul>
395
396 !! end
397
398 !! test
399 Italics and bold
400 !! input
401 * plain
402 * plain''italic''plain
403 * plain''italic''plain''italic''plain
404 * plain'''bold'''plain
405 * plain'''bold'''plain'''bold'''plain
406 * plain''italic''plain'''bold'''plain
407 * plain'''bold'''plain''italic''plain
408 * plain''italic'''bold-italic'''italic''plain
409 * plain'''bold''bold-italic''bold'''plain
410 * plain'''''bold-italic'''italic''plain
411 * plain'''''bold-italic''bold'''plain
412 * plain''italic'''bold-italic'''''plain
413 * plain'''bold''bold-italic'''''plain
414 * plain l'''italic''plain
415 * plain l''''bold''' plain
416 !! result
417 <ul><li> plain
418 </li><li> plain<i>italic</i>plain
419 </li><li> plain<i>italic</i>plain<i>italic</i>plain
420 </li><li> plain<b>bold</b>plain
421 </li><li> plain<b>bold</b>plain<b>bold</b>plain
422 </li><li> plain<i>italic</i>plain<b>bold</b>plain
423 </li><li> plain<b>bold</b>plain<i>italic</i>plain
424 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
425 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
426 </li><li> plain<i><b>bold-italic</b>italic</i>plain
427 </li><li> plain<b><i>bold-italic</i>bold</b>plain
428 </li><li> plain<i>italic<b>bold-italic</b></i>plain
429 </li><li> plain<b>bold<i>bold-italic</i></b>plain
430 </li><li> plain l'<i>italic</i>plain
431 </li><li> plain l'<b>bold</b> plain
432 </li></ul>
433
434 !! end
435
436 # this example taken from the simple/Moon article
437 !! test
438 Italics and possessives
439 !! input
440 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
441 !! result
442 <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
443 </p>
444 !! end
445
446 ###
447 ### 2-quote opening sequence tests
448 ###
449 !! test
450 Italics and bold: 2-quote opening sequence: (2,2)
451 !! input
452 ''foo''
453 !! result
454 <p><i>foo</i>
455 </p>
456 !!end
457
458
459 !! test
460 Italics and bold: 2-quote opening sequence: (2,3)
461 !! input
462 ''foo'''
463 !! result
464 <p><i>foo'</i>
465 </p>
466 !!end
467
468
469 !! test
470 Italics and bold: 2-quote opening sequence: (2,4)
471 !! input
472 ''foo''''
473 !! result
474 <p><i>foo''</i>
475 </p>
476 !!end
477
478
479 !! test
480 Italics and bold: 2-quote opening sequence: (2,5) (php)
481 !! options
482 php
483 !! input
484 ''foo'''''
485 !! result
486 <p><i>foo</i>
487 </p>
488 !!end
489 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
490 !! test
491 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
492 !! options
493 parsoid
494 !! input
495 ''foo'''''
496 !! result
497 <p><i>foo</i><b></b>
498 </p>
499 !!end
500
501
502 ###
503 ### 3-quote opening sequence tests
504 ###
505
506 !! test
507 Italics and bold: 3-quote opening sequence: (3,2)
508 !! input
509 '''foo''
510 !! result
511 <p>'<i>foo</i>
512 </p>
513 !!end
514
515
516 !! test
517 Italics and bold: 3-quote opening sequence: (3,3)
518 !! input
519 '''foo'''
520 !! result
521 <p><b>foo</b>
522 </p>
523 !!end
524
525
526 !! test
527 Italics and bold: 3-quote opening sequence: (3,4)
528 !! input
529 '''foo''''
530 !! result
531 <p><b>foo'</b>
532 </p>
533 !!end
534
535
536 !! test
537 Italics and bold: 3-quote opening sequence: (3,5) (php)
538 !! options
539 php
540 !! input
541 '''foo'''''
542 !! result
543 <p><b>foo</b>
544 </p>
545 !!end
546 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
547 !! test
548 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
549 !! options
550 parsoid
551 !! input
552 '''foo'''''
553 !! result
554 <p><b>foo<i></i></b>
555 </p>
556 !!end
557
558
559 ###
560 ### 4-quote opening sequence tests
561 ###
562
563 !! test
564 Italics and bold: 4-quote opening sequence: (4,2)
565 !! input
566 ''''foo''
567 !! result
568 <p>''<i>foo</i>
569 </p>
570 !!end
571
572
573 !! test
574 Italics and bold: 4-quote opening sequence: (4,3)
575 !! input
576 ''''foo'''
577 !! result
578 <p>'<b>foo</b>
579 </p>
580 !!end
581
582
583 !! test
584 Italics and bold: 4-quote opening sequence: (4,4)
585 !! input
586 ''''foo''''
587 !! result
588 <p>'<b>foo'</b>
589 </p>
590 !!end
591
592
593 !! test
594 Italics and bold: 4-quote opening sequence: (4,5) (php)
595 !! options
596 php
597 !! input
598 ''''foo'''''
599 !! result
600 <p>'<b>foo</b>
601 </p>
602 !!end
603 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
604 !! test
605 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
606 !! options
607 parsoid
608 !! input
609 ''''foo'''''
610 !! result
611 <p>'<b>foo<i></i></b>
612 </p>
613 !!end
614
615
616 ###
617 ### 5-quote opening sequence tests
618 ###
619
620 !! test
621 Italics and bold: 5-quote opening sequence: (5,2) (php)
622 !! options
623 php
624 !! input
625 '''''foo''
626 !! result
627 <p><b><i>foo</i></b>
628 </p>
629 !!end
630 # Parsoid reverses the nesting order, compared to the PHP parser
631 !! test
632 Italics and bold: 5-quote opening sequence: (5,2) (parsoid)
633 !! options
634 parsoid
635 !! input
636 '''''foo''
637 !! result
638 <p><i><b>foo</b></i>
639 </p>
640 !!end
641
642
643 !! test
644 Italics and bold: 5-quote opening sequence: (5,3)
645 !! input
646 '''''foo'''
647 !! result
648 <p><i><b>foo</b></i>
649 </p>
650 !!end
651
652
653 !! test
654 Italics and bold: 5-quote opening sequence: (5,4)
655 !! input
656 '''''foo''''
657 !! result
658 <p><i><b>foo'</b></i>
659 </p>
660 !!end
661
662
663 !! test
664 Italics and bold: 5-quote opening sequence: (5,5)
665 !! input
666 '''''foo'''''
667 !! result
668 <p><i><b>foo</b></i>
669 </p>
670 !!end
671
672 ###
673 ### multiple quote sequences in a line
674 ###
675 !! test
676 Italics and bold: multiple quote sequences: (2,4,2)
677 !! input
678 ''foo''''bar''
679 !! result
680 <p><i>foo'<b>bar</b></i>
681 </p>
682 !!end
683
684
685 !! test
686 Italics and bold: multiple quote sequences: (2,4,3)
687 !! input
688 ''foo''''bar'''
689 !! result
690 <p><i>foo'<b>bar</b></i>
691 </p>
692 !!end
693
694
695 !! test
696 Italics and bold: multiple quote sequences: (2,4,4)
697 !! input
698 ''foo''''bar''''
699 !! result
700 <p><i>foo'<b>bar'</b></i>
701 </p>
702 !!end
703
704
705 !! test
706 Italics and bold: multiple quote sequences: (3,4,2) (php)
707 !! options
708 php
709 !! input
710 '''foo''''bar''
711 !! result
712 <p><b>foo'</b>bar
713 </p>
714 !!end
715 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
716 !! test
717 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
718 !! options
719 parsoid
720 !! input
721 '''foo''''bar''
722 !! result
723 <p><b>foo'</b>bar<i></i>
724 </p>
725 !!end
726
727
728 !! test
729 Italics and bold: multiple quote sequences: (3,4,3) (php)
730 !! options
731 php
732 !! input
733 '''foo''''bar'''
734 !! result
735 <p><b>foo'</b>bar
736 </p>
737 !!end
738 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
739 !! test
740 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
741 !! options
742 parsoid
743 !! input
744 '''foo''''bar'''
745 !! result
746 <p><b>foo'</b>bar<b></b>
747 </p>
748 !!end
749
750 ###
751 ### other quote tests
752 ###
753 !! test
754 Italics and bold: other quote tests: (2,3,5)
755 !! input
756 ''this is about '''foo's family'''''
757 !! result
758 <p><i>this is about <b>foo's family</b></i>
759 </p>
760 !!end
761
762
763 !! test
764 Italics and bold: other quote tests: (2,(3,3),2)
765 !! input
766 ''this is about '''foo's''' family''
767 !! result
768 <p><i>this is about <b>foo's</b> family</i>
769 </p>
770 !!end
771
772
773 !! test
774 Italics and bold: other quote tests: (3,2,3,2)
775 !! input
776 '''this is about ''foo'''s family''
777 !! result
778 <p><b>this is about <i>foo</i></b><i>s family</i>
779 </p>
780 !!end
781
782
783 # The Parsoid team believes the PHP parser's output on this test is wrong.
784 # It only checks for convert-to-bold-on-single-character-word when the word
785 # matches with a bold tag ("'''") that is *odd* in the list of quote tokens.
786 # This means that the bold token in position 2 (0-indexed) gets converted by
787 # parsoid, but doesn't get changed by the PHP parser.
788 !! test
789 Italics and bold: other quote tests: (3,2,3,3) (php)
790 !! options
791 php
792 !! input
793 '''this is about ''foo'''s family'''
794 !! result
795 <p>'<i>this is about </i>foo<b>s family</b>
796 </p>
797 !!end
798 # This is the output the Parsoid team believes to be correct.
799 !! test
800 Italics and bold: other quote tests: (3,2,3,3) (parsoid)
801 !! options
802 parsoid
803 !! input
804 '''this is about ''foo'''s family'''
805 !! result
806 <p><b>this is about <i>foo'</i>s family</b>
807 </p>
808 !!end
809
810
811 !! test
812 Italics and bold: other quote tests: (3,(2,2),3)
813 !! input
814 '''this is about ''foo's'' family'''
815 !! result
816 <p><b>this is about <i>foo's</i> family</b>
817 </p>
818 !!end
819
820
821 !! test
822 Italicized possessive
823 !! input
824 The ''[[Main Page]]'''s talk page.
825 !! result
826 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
827 </p>
828 !! end
829
830 !! test
831 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
832 (Requires tidy for PHP parser output to be fixed up)
833 !! options
834 parsoid=wt2html,wt2wt
835 !! input
836 {|
837 !''a!!''b
838 |''a||''b
839 |}
840 !! result
841 <table>
842 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
843 <td><i>a</i></td><td><i>b</i></td></tr>
844 </tbody></table>
845 !! end
846
847 ###
848 ### Non-html5 tags
849 ###
850
851 !! test
852 Non-html5 tags should be accepted
853 !! input
854 <center>''foo''</center>
855 <big>''foo''</big>
856 <font>''foo''</font>
857 <strike>''foo''</strike>
858 <tt>''foo''</tt>
859 !! result
860 <center><i>foo</i></center>
861 <p><big><i>foo</i></big>
862 <font><i>foo</i></font>
863 <strike><i>foo</i></strike>
864 <tt><i>foo</i></tt>
865 </p>
866 !! end
867
868 !! test
869 <wbr> is valid wikitext (bug 52468)
870 !! input
871 <wbr>
872 !! result
873 <p><wbr />
874 </p>
875 !! end
876
877 # <strike> is HTML4, <s> is HTML4/5.
878 !! test
879 <s> or <strike> for strikethrough
880 !! input
881 <strike>strike</strike>
882
883 <s>s</s>
884 !! result
885 <p><strike>strike</strike>
886 </p><p><s>s</s>
887 </p>
888 !! end
889
890 !! test
891 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
892 !! input
893 <b→> doesn't work! </b>
894
895 <bä> doesn't work! </b>
896
897 <boo> works fine </b>
898
899 <s.foo>foo</s>
900
901 <s.foo>s.foo</s.foo>
902
903 <sub-ID#1>
904 !! result
905 <p>&lt;b→&gt; doesn't work! &lt;/b&gt;
906 </p><p>&lt;bä&gt; doesn't work! &lt;/b&gt;
907 </p><p>&lt;boo&gt; works fine &lt;/b&gt;
908 </p><p>&lt;s.foo&gt;foo&lt;/s&gt;
909 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
910 </p><p>&lt;sub-ID#1&gt;
911 </p>
912 !! end
913
914 ###
915 ### Special characters
916 ###
917
918 !! test
919 Bare pipe character (bug 52363)
920 !! input
921 |
922 !! result
923 <p>|
924 </p>
925 !! end
926
927 !! test
928 Bare pipe character from a template (bug 52363)
929 !! input
930 {{pipe}}
931 !! result
932 <p>|
933 </p>
934 !! end
935
936 ###
937 ### <nowiki> test cases
938 ###
939
940 !! test
941 <nowiki> unordered list
942 !! input
943 <nowiki>* This is not an unordered list item.</nowiki>
944 !! result
945 <p>* This is not an unordered list item.
946 </p>
947 !! end
948
949 !! test
950 <nowiki> spacing
951 !! input
952 <nowiki>Lorem ipsum dolor
953
954 sed abit.
955 sed nullum.
956
957 :and a colon
958 </nowiki>
959 !! result
960 <p>Lorem ipsum dolor
961
962 sed abit.
963 sed nullum.
964
965 :and a colon
966
967 </p>
968 !! end
969
970 !! test
971 nowiki 3
972 !! input
973 :There is not nowiki.
974 :There is <nowiki>nowiki</nowiki>.
975
976 #There is not nowiki.
977 #There is <nowiki>nowiki</nowiki>.
978
979 *There is not nowiki.
980 *There is <nowiki>nowiki</nowiki>.
981 !! result
982 <dl><dd>There is not nowiki.
983 </dd><dd>There is nowiki.
984 </dd></dl>
985 <ol><li>There is not nowiki.
986 </li><li>There is nowiki.
987 </li></ol>
988 <ul><li>There is not nowiki.
989 </li><li>There is nowiki.
990 </li></ul>
991
992 !! end
993
994 !! test
995 Entities inside <nowiki>
996 !! input
997 <nowiki>&lt;</nowiki>
998 !! result
999 <p>&lt;
1000 </p>
1001 !! end
1002
1003 !! test
1004 Entities inside template parameters
1005 !! options
1006 parsoid
1007 !! input
1008 {{echo|&ndash;}}
1009 !! result
1010 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}'>&ndash;</span>
1011 </p>
1012 !! end
1013
1014 ###
1015 ### Comments
1016 ###
1017 !! test
1018 Comments and Indent-Pre
1019 !! input
1020 <!-- comment 1 --> asdf
1021
1022 <!-- comment 1 --> asdf
1023 <!-- comment 2 -->
1024
1025 <!-- comment 1 --> asdf
1026 <!-- comment 2 -->xyz
1027
1028 <!-- comment 1 --> asdf
1029 <!-- comment 2 --> xyz
1030 !! result
1031 <pre>asdf
1032 </pre>
1033 <pre>asdf
1034 </pre>
1035 <pre>asdf
1036 </pre>
1037 <p>xyz
1038 </p>
1039 <pre>asdf
1040 xyz
1041 </pre>
1042 !! end
1043
1044 !! test
1045 Comment test 2a
1046 !! input
1047 asdf
1048 <!-- comment 1 -->
1049 jkl
1050 !! result
1051 <p>asdf
1052 jkl
1053 </p>
1054 !! end
1055
1056 !! test
1057 Comment test 2b
1058 !! input
1059 asdf
1060 <!-- comment 1 -->
1061
1062 jkl
1063 !! result
1064 <p>asdf
1065 </p><p>jkl
1066 </p>
1067 !! end
1068
1069 !! test
1070 Comment test 3
1071 !! input
1072 asdf
1073 <!-- comment 1 -->
1074 <!-- comment 2 -->
1075 jkl
1076 !! result
1077 <p>asdf
1078 jkl
1079 </p>
1080 !! end
1081
1082 !! test
1083 Comment test 4
1084 !! input
1085 asdf<!-- comment 1 -->jkl
1086 !! result
1087 <p>asdfjkl
1088 </p>
1089 !! end
1090
1091 !! test
1092 Comment spacing
1093 !! input
1094 a
1095 <!-- foo --> b <!-- bar -->
1096 c
1097 !! result
1098 <p>a
1099 </p>
1100 <pre> b
1101 </pre>
1102 <p>c
1103 </p>
1104 !! end
1105
1106 !! test
1107 Comment whitespace
1108 !! input
1109 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1110 !! result
1111
1112 !! end
1113
1114 !! test
1115 Comment semantics and delimiters
1116 !! input
1117 <!-- --><!----><!-----><!------>
1118 !! result
1119
1120 !! end
1121
1122 !! test
1123 Comment semantics and delimiters, redux
1124 !! input
1125 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1126 -- foo -- funky huh? ... -->
1127 !! result
1128
1129 !! end
1130
1131 !! test
1132 Comment semantics and delimiters: directors cut
1133 !! input
1134 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1135 everything starting with < followed by !-- until the first -- and > we see,
1136 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1137 -->-->
1138 !! result
1139 <p>--&gt;
1140 </p>
1141 !! end
1142
1143 !! test
1144 Comment semantics: nesting
1145 !! input
1146 <!--<!-- no, we're not going to do anything fancy here -->-->
1147 !! result
1148 <p>--&gt;
1149 </p>
1150 !! end
1151
1152 !! test
1153 Comment semantics: unclosed comment at end
1154 !! input
1155 <!--This comment will run out to the end of the document
1156 !! result
1157
1158 !! end
1159
1160 !! test
1161 Comment in template title
1162 !! input
1163 {{f<!---->oo}}
1164 !! result
1165 <p>FOO
1166 </p>
1167 !! end
1168
1169 !! test
1170 Comment on its own line post-expand
1171 !! input
1172 a
1173 {{blank}}<!---->
1174 b
1175 !! result
1176 <p>a
1177 </p><p>b
1178 </p>
1179 !! end
1180
1181 !! test
1182 Comment on its own line post-expand with non-significant whitespace
1183 !! input
1184 a
1185 {{blank}} <!---->
1186 b
1187 !! result
1188 <p>a
1189 </p><p>b
1190 </p>
1191 !! end
1192
1193 ###
1194 ### paragraph wrapping tests
1195 ###
1196 !! test
1197 No block tags
1198 !! input
1199 a
1200
1201 b
1202 !! result
1203 <p>a
1204 </p><p>b
1205 </p>
1206 !! end
1207 !! test
1208 Block tag on one line
1209 !! input
1210 a <div>foo</div>
1211
1212 b
1213 !! result
1214 a <div>foo</div>
1215 <p>b
1216 </p>
1217 !! end
1218
1219 !! test
1220 Block tag on both lines
1221 !! input
1222 a <div>foo</div>
1223
1224 b <div>foo</div>
1225 !! result
1226 a <div>foo</div>
1227 b <div>foo</div>
1228
1229 !! end
1230
1231 !! test
1232 Multiple lines without block tags
1233 !! input
1234 <div>foo</div> a
1235 b
1236 c
1237 d<!--foo--> e
1238 x <div>foo</div> z
1239 !! result
1240 <div>foo</div> a
1241 <p>b
1242 c
1243 d e
1244 </p>
1245 x <div>foo</div> z
1246
1247 !! end
1248
1249 !! test
1250 Empty lines between lines with block tags
1251 !! input
1252 <div></div>
1253
1254
1255 <div></div>a
1256
1257 b
1258 <div>a</div>b
1259
1260 <div>b</div>d
1261
1262
1263 <div>e</div>
1264 !! result
1265 <div></div>
1266 <p><br />
1267 </p>
1268 <div></div>a
1269 <p>b
1270 </p>
1271 <div>a</div>b
1272 <div>b</div>d
1273 <p><br />
1274 </p>
1275 <div>e</div>
1276
1277 !! end
1278
1279 ###
1280 ### Preformatted text
1281 ###
1282 !! test
1283 Preformatted text
1284 !! input
1285 This is some
1286 Preformatted text
1287 With ''italic''
1288 And '''bold'''
1289 And a [[Main Page|link]]
1290 !! result
1291 <pre>This is some
1292 Preformatted text
1293 With <i>italic</i>
1294 And <b>bold</b>
1295 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1296 </pre>
1297 !! end
1298
1299 !! test
1300 Ident preformatting with inline content
1301 !! input
1302 a
1303 ''b''
1304 !! result
1305 <pre>a
1306 <i>b</i>
1307 </pre>
1308 !! end
1309
1310 !! test
1311 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1312 !! input
1313 <pre><nowiki>
1314 <b>
1315 <cite>
1316 <em>
1317 </nowiki></pre>
1318 !! result
1319 <pre>
1320 &lt;b&gt;
1321 &lt;cite&gt;
1322 &lt;em&gt;
1323 </pre>
1324
1325 !! end
1326
1327 !! test
1328 Regression with preformatted in <center>
1329 !! input
1330 <center>
1331 Blah
1332 </center>
1333 !! result
1334 <center>
1335 <pre>Blah
1336 </pre>
1337 </center>
1338
1339 !! end
1340
1341 !! test
1342 Bug 6200: Preformatted in <blockquote>
1343 !! input
1344 <blockquote>
1345 Blah
1346 </blockquote>
1347 !! result
1348 <blockquote>
1349 <pre>Blah
1350 </pre>
1351 </blockquote>
1352
1353 !! end
1354
1355 !! test
1356 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1357 !! input
1358 <blockquote>
1359 Foo
1360
1361 Bar
1362 </blockquote>
1363 !! result
1364 <blockquote>
1365 <p>Foo
1366 </p><p>Bar
1367 </p>
1368 </blockquote>
1369
1370 !! end
1371
1372 !! test
1373 Bug 15491: <ins>/<del> in blockquote
1374 !! input
1375 <blockquote>
1376 Foo <del>bar</del> <ins>baz</ins> quux
1377 </blockquote>
1378 !! result
1379 <blockquote>
1380 <p>Foo <del>bar</del> <ins>baz</ins> quux
1381 </p>
1382 </blockquote>
1383
1384 !! end
1385
1386 # Note that the p-wrapping is newline sensitive, which could be
1387 # considered a bug: tidy will wrap only the 'Foo' in the example
1388 # below in a <p> tag. (see comment 23-25 of bug #6200)
1389 !! test
1390 Bug 15491: <ins>/<del> in blockquote (2)
1391 !! input
1392 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1393 </blockquote>
1394 !! result
1395 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1396 </blockquote>
1397
1398 !! end
1399
1400 !! test
1401 <pre> with attributes (bug 3202)
1402 !! input
1403 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1404 !! result
1405 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1406
1407 !! end
1408
1409 !! test
1410 <pre> with width attribute (bug 3202)
1411 !! input
1412 <pre width="8">Narrow screen goodies</pre>
1413 !! result
1414 <pre width="8">Narrow screen goodies</pre>
1415
1416 !! end
1417
1418 !! test
1419 <pre> with forbidden attribute (bug 3202)
1420 !! input
1421 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1422 !! result
1423 <pre width="8">Narrow screen goodies</pre>
1424
1425 !! end
1426
1427 !! test
1428 Entities inside <pre>
1429 !! input
1430 <pre>&lt;</pre>
1431 !! result
1432 <pre>&lt;</pre>
1433
1434 !! end
1435
1436 !! test
1437 <pre> with forbidden attribute values (bug 3202)
1438 !! input
1439 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1440 !! result
1441 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1442
1443 !! end
1444
1445 !! test
1446 <nowiki> inside <pre> (bug 13238)
1447 !! input
1448 <pre>
1449 <nowiki>
1450 </pre>
1451 <pre>
1452 <nowiki></nowiki>
1453 </pre>
1454 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1455 !! result
1456 <pre>
1457 &lt;nowiki&gt;
1458 </pre>
1459 <pre>
1460
1461 </pre>
1462 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1463
1464 !! end
1465
1466 !! test
1467 <nowiki> and <pre> preference (first one wins)
1468 !! input
1469 <pre>
1470 <nowiki>
1471 </pre>
1472 </nowiki>
1473 </pre>
1474
1475 <nowiki>
1476 <pre>
1477 <nowiki>
1478 </pre>
1479 </nowiki>
1480 </pre>
1481
1482 !! result
1483 <pre>
1484 &lt;nowiki&gt;
1485 </pre>
1486 <p>&lt;/nowiki&gt;
1487 &lt;/pre&gt;
1488 </p><p>
1489 &lt;pre&gt;
1490 &lt;nowiki&gt;
1491 &lt;/pre&gt;
1492
1493 &lt;/pre&gt;
1494 </p>
1495 !! end
1496
1497 !! test
1498 </pre> inside nowiki
1499 !! input
1500 <nowiki></pre></nowiki>
1501 !! result
1502 <p>&lt;/pre&gt;
1503 </p>
1504 !! end
1505
1506 !!test
1507 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1508 !!input
1509 {{echo|}}
1510 !!result
1511
1512 !!end
1513
1514 !!test
1515 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1516 !!input
1517 {{echo|
1518 foo}}
1519 !!result
1520 <p>foo
1521 </p>
1522 !!end
1523
1524 !! test
1525 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1526 !! input
1527 {{echo|a
1528 b}}
1529 !!result
1530 <pre>a
1531 </pre>
1532 <p>b
1533 </p>
1534 !!end
1535
1536 !! test
1537 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1538 !! input
1539 {{echo|a
1540 b
1541 c
1542 d
1543 e
1544 }}
1545 !!result
1546 <pre>a
1547 </pre>
1548 <p>b
1549 c
1550 </p>
1551 <pre>d
1552 </pre>
1553 <p>e
1554 </p>
1555 !!end
1556
1557 !!test
1558 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1559 !!input
1560 {{echo| foo}}
1561
1562 {{echo| foo}}{{echo| bar}}
1563
1564 {{echo| foo}}
1565 {{echo| bar}}
1566
1567 {{echo|<!--cmt--> foo}}
1568
1569 <!--cmt-->{{echo| foo}}
1570
1571 {{echo|{{echo| }}bar}}
1572 !!result
1573 <pre>foo
1574 </pre>
1575 <pre>foo bar
1576 </pre>
1577 <pre>foo
1578 bar
1579 </pre>
1580 <pre>foo
1581 </pre>
1582 <pre>foo
1583 </pre>
1584 <pre>bar
1585 </pre>
1586 !!end
1587
1588 !! test
1589 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1590 !! input
1591 {{echo| }}a
1592
1593 {{echo|
1594 }}a
1595
1596 {{echo|
1597 b}}
1598
1599 {{echo|a
1600 }}b
1601
1602 {{echo|a
1603 }} b
1604 !!result
1605 <pre>a
1606 </pre>
1607 <p><br />
1608 </p>
1609 <pre>a
1610 </pre>
1611 <p><br />
1612 </p>
1613 <pre>b
1614 </pre>
1615 <p>a
1616 </p>
1617 <pre>b
1618 </pre>
1619 <p>a
1620 </p>
1621 <pre>b
1622 </pre>
1623 !!end
1624
1625 !! test
1626 Templates: Single-line variant of parameter whitespace stripping test
1627 !! input
1628 {{echo| a}}
1629
1630 {{echo|1= a}}
1631
1632 {{echo|{{echo| a}}}}
1633
1634 {{echo|1={{echo| a}}}}
1635 !! result
1636 <pre>a
1637 </pre>
1638 <p>a
1639 </p>
1640 <pre>a
1641 </pre>
1642 <p>a
1643 </p>
1644 !! end
1645
1646 !! test
1647 Templates: Strip whitespace from named parameters, but not positional ones
1648 !! input
1649 {{echo|
1650 foo}}
1651
1652 {{echo|
1653 * foo}}
1654
1655 {{echo| 1 =
1656 foo}}
1657
1658 {{echo| 1 =
1659 * foo}}
1660 !! result
1661 <pre>foo
1662 </pre>
1663 <p><br />
1664 </p>
1665 <ul><li> foo
1666 </li></ul>
1667 <p>foo
1668 </p>
1669 <ul><li> foo
1670 </li></ul>
1671
1672 !! end
1673
1674 !! test
1675 Templates: Dont strip whitespace from whitespace/comment-only arguments
1676 !! input
1677 {{echo| }}
1678 {{echo|<!--cmt-->}}
1679 {{echo| <!--cmt--> }}
1680 !! result
1681 <p><br />
1682 </p>
1683 !! end
1684
1685 !! test
1686 Templates: Parsoid parameter escaping test 1
1687 !! options
1688 parsoid
1689 !! input
1690 {{echo|[foo]|{{echo|[bar]}}}}
1691 !! result
1692 <p about="#mwt1" typeof="mw:Transclusion"
1693 data-mw="{&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;2&quot;:{&quot;wt&quot;:&quot;{{echo|[bar]}}&quot;}},&quot;i&quot;:0}">[foo]</p>
1694 !! end
1695
1696 !! test
1697 Parsoid: Pipes in external links in template parameter
1698 !! options
1699 parsoid
1700 !! input
1701 {{echo|[{{echo|http://example.com}} link]}}
1702 !! result
1703 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw="{&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;[{{echo|http://example.com}} link]&quot;}},&quot;i&quot;:0}">link</a></p>
1704 !! end
1705
1706 !! test
1707 Parsoid: pipe in transclusion parameter
1708 !! options
1709 parsoid
1710 !! input
1711 {{echo|http://foo.com/a&#124;b}}
1712 !! result
1713 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1714 typeof="mw:Transclusion"
1715 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a|b"}},"i":0}'>http://foo.com/a|b</a></p>
1716 !! end
1717
1718 !! test
1719 Parsoid: Pipe in external link target and content in template parameter
1720 !! options
1721 parsoid=html2wt,wt2wt
1722 !! input
1723 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
1724 !! result
1725 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1726 typeof="mw:Transclusion"
1727 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},
1728 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}'>a|b</a></p>
1729 !! end
1730
1731 !! test
1732 Templates: Dont escape already nowiki-escaped text in template parameters
1733 !! options
1734 parsoid=html2wt,wt2wt
1735 !! input
1736 {{echo|foo<nowiki>|</nowiki>bar}}
1737 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
1738 {{echo|<nowiki></nowiki>}}
1739 !! result
1740 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"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>
1741 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"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>
1742 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}'></span>
1743 </p>
1744 !! end
1745
1746 ###
1747 ### Parsoid-centric tests for testing RT edge cases for pre
1748 ###
1749
1750 !!test
1751 1a. Indent-Pre and Comments
1752 !!input
1753 a
1754 <!--a-->
1755 c
1756 !!result
1757 <pre>a
1758 </pre>
1759 <p>c
1760 </p>
1761 !!end
1762
1763 !!test
1764 1b. Indent-Pre and Comments
1765 !!input
1766 a
1767 <!--a-->
1768 c
1769 !!result
1770 <pre>a
1771 </pre>
1772 <p>c
1773 </p>
1774 !!end
1775
1776 !!test
1777 1c. Indent-Pre and Comments
1778 !!input
1779 <!--a--> a
1780
1781 <!--a--> a
1782 !!result
1783 <pre> a
1784 </pre>
1785 <pre> a
1786 </pre>
1787 !!end
1788
1789 !!test
1790 2a. Indent-Pre and tables
1791 !!input
1792 {|
1793 |-
1794 !h1!!h2
1795 |foo||bar
1796 |}
1797 !!result
1798 <table>
1799
1800 <tr>
1801 <th>h1</th>
1802 <th>h2
1803 </th>
1804 <td>foo</td>
1805 <td>bar
1806 </td></tr></table>
1807
1808 !!end
1809
1810 !!test
1811 2b. Indent-Pre and tables
1812 !!input
1813 {|
1814 |-
1815 |foo
1816 |}
1817 !!result
1818 <table>
1819
1820 <tr>
1821 <td>foo
1822 </td></tr></table>
1823
1824 !!end
1825
1826 !!test
1827 2c. Indent-Pre and tables (bug 42252)
1828 !!input
1829 {|
1830 |+ foo
1831 ! | bar
1832 |}
1833 !!result
1834 <table>
1835 <caption> foo
1836 </caption>
1837 <tr>
1838 <th> bar
1839 </th></tr></table>
1840
1841 !!end
1842
1843 !!test
1844 3a. Indent-Pre and block tags (single-line html)
1845 !!input
1846 <p> foo </p>
1847 <div> foo </div>
1848 <span> foo </span>
1849 !!result
1850 <p> foo </p>
1851 <div> foo </div>
1852 <pre><span> foo </span>
1853 </pre>
1854 !!end
1855
1856 !!test
1857 3b. Indent-Pre and block tags (pre-content on separate line)
1858 !!input
1859 <p>
1860 foo
1861 </p>
1862
1863 <div>
1864 foo
1865 </div>
1866
1867 <center>
1868 foo
1869 </center>
1870
1871 <blockquote>
1872 foo
1873 </blockquote>
1874
1875 <table><tr><td>
1876 foo
1877 </td></tr></table>
1878
1879 <ul><li>
1880 foo
1881 </li></ul>
1882
1883 !!result
1884 <p>
1885 foo
1886 </p>
1887 <div>
1888 <pre>foo
1889 </pre>
1890 </div>
1891 <center>
1892 <pre>foo
1893 </pre>
1894 </center>
1895 <blockquote>
1896 <pre>foo
1897 </pre>
1898 </blockquote>
1899 <table><tr><td>
1900 <pre>foo
1901 </pre>
1902 </td></tr></table>
1903 <ul><li>
1904 foo
1905 </li></ul>
1906
1907 !!end
1908
1909 !!test
1910 4. Multiple spaces at start-of-line
1911 !!input
1912 <p> foo </p>
1913 foo
1914 {|
1915 |foo
1916 |}
1917 !!result
1918 <p> foo </p>
1919 <pre> foo
1920 </pre>
1921 <table>
1922 <tr>
1923 <td>foo
1924 </td></tr></table>
1925
1926 !!end
1927
1928 !! test
1929 5. White-space in indent-pre
1930 NOTE: the white-space char on 2nd line is significant
1931 !! input
1932 a<br/>
1933
1934 b
1935 !! result
1936 <pre>a<br />
1937
1938 b
1939 </pre>
1940 !! end
1941
1942 ###
1943 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1944 ###
1945
1946 !!test
1947 HTML-pre: 1. embedded newlines
1948 !!input
1949 <pre>foo</pre>
1950
1951 <pre>
1952 foo
1953 </pre>
1954
1955 <pre>
1956
1957 foo
1958 </pre>
1959
1960 <pre>
1961
1962
1963 foo
1964 </pre>
1965 !!result
1966 <pre>foo</pre>
1967 <pre>
1968 foo
1969 </pre>
1970 <pre>
1971
1972 foo
1973 </pre>
1974 <pre>
1975
1976
1977 foo
1978 </pre>
1979
1980 !!end
1981
1982 !!test
1983 HTML-pre: 2: indented text
1984 !!input
1985 <pre>
1986 foo
1987 </pre>
1988 !!result
1989 <pre>
1990 foo
1991 </pre>
1992
1993 !!end
1994
1995 !!test
1996 HTML-pre: 3: other wikitext
1997 !!input
1998 <pre>
1999 * foo
2000 # bar
2001 = no-h =
2002 '' no-italic ''
2003 [[ NoLink ]]
2004 </pre>
2005 !!result
2006 <pre>
2007 * foo
2008 # bar
2009 = no-h =
2010 '' no-italic ''
2011 [[ NoLink ]]
2012 </pre>
2013
2014 !!end
2015
2016 ###
2017 ### Definition lists
2018 ###
2019 !! test
2020 Simple definition
2021 !! input
2022 ; name : Definition
2023 !! result
2024 <dl><dt> name&#160;</dt><dd> Definition
2025 </dd></dl>
2026
2027 !! end
2028
2029 !! test
2030 Definition list for indentation only
2031 !! input
2032 : Indented text
2033 !! result
2034 <dl><dd> Indented text
2035 </dd></dl>
2036
2037 !! end
2038
2039 !! test
2040 Definition list with no space
2041 !! input
2042 ;name:Definition
2043 !! result
2044 <dl><dt>name</dt><dd>Definition
2045 </dd></dl>
2046
2047 !!end
2048
2049 !! test
2050 Definition list with URL link
2051 !! input
2052 ; http://example.com/ : definition
2053 !! result
2054 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
2055 </dd></dl>
2056
2057 !! end
2058
2059 !! test
2060 Definition list with bracketed URL link
2061 !! input
2062 ;[http://www.example.com/ Example]:Something about it
2063 !! result
2064 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
2065 </dd></dl>
2066
2067 !! end
2068
2069 !! test
2070 Definition list with wikilink containing colon
2071 !! input
2072 ; [[Help:FAQ]]: The least-read page on Wikipedia
2073 !! result
2074 <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
2075 </dd></dl>
2076
2077 !! end
2078
2079 # At Brion's and JeLuF's insistence... :)
2080 !! test
2081 Definition list with news link containing colon
2082 !! input
2083 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
2084 !! result
2085 <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!
2086 </dd></dl>
2087
2088 !! end
2089
2090 !! test
2091 Malformed definition list with colon
2092 !! input
2093 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2094 !! result
2095 <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
2096 </dt></dl>
2097
2098 !! end
2099
2100 !! test
2101 Definition lists: colon in external link text
2102 !! input
2103 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2104 !! result
2105 <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
2106 </dd></dl>
2107
2108 !! end
2109
2110 !! test
2111 Definition lists: colon in HTML attribute
2112 !! input
2113 ;<b style="display: inline">bold</b>
2114 !! result
2115 <dl><dt><b style="display: inline">bold</b>
2116 </dt></dl>
2117
2118 !! end
2119
2120 !! test
2121 Definition lists: self-closed tag
2122 !! input
2123 ;one<br/>two : two-line fun
2124 !! result
2125 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
2126 </dd></dl>
2127
2128 !! end
2129
2130 !! test
2131 Bug 11748: Literal closing tags
2132 !! input
2133 <dl>
2134 <dt>test 1</dt>
2135 <dd>test test test test test</dd>
2136 <dt>test 2</dt>
2137 <dd>test test test test test</dd>
2138 </dl>
2139 !! result
2140 <dl>
2141 <dt>test 1</dt>
2142 <dd>test test test test test</dd>
2143 <dt>test 2</dt>
2144 <dd>test test test test test</dd>
2145 </dl>
2146
2147 !! end
2148
2149 !! test
2150 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2151 !! input
2152 <ul><li>
2153 ; term : description
2154 * unordered
2155 </li>
2156 </ul>
2157 !! result
2158 <ul><li>
2159 <dl><dt> term&#160;</dt><dd> description
2160 </dd></dl>
2161 <ul><li> unordered
2162 </li></ul>
2163 </li>
2164 </ul>
2165
2166 !! end
2167
2168 !! test
2169
2170 Definition list with empty definition and following paragraph
2171 !! input
2172 ; term:
2173 Paragraph text
2174 !! result
2175 <dl><dt> term</dt><dd>
2176 </dd></dl>
2177 <p>Paragraph text
2178 </p>
2179 !! end
2180
2181 !! test
2182 Nested definition lists using html syntax
2183 !! input
2184 <dl><dd>
2185 <dl>
2186 <dd>Foo</dd>
2187 </dl>
2188 </dd></dl>
2189 !! result
2190 <dl><dd>
2191 <dl>
2192 <dd>Foo</dd>
2193 </dl>
2194 </dd></dl>
2195
2196 !! end
2197
2198 !! test
2199 Definition Lists: No nesting: Multiple dd's
2200 !! input
2201 ;x
2202 :a
2203 :b
2204 !! result
2205 <dl><dt>x
2206 </dt><dd>a
2207 </dd><dd>b
2208 </dd></dl>
2209
2210 !! end
2211
2212 !! test
2213 Definition Lists: Indentation: Regular
2214 !! input
2215 :i1
2216 ::i2
2217 :::i3
2218 !! result
2219 <dl><dd>i1
2220 <dl><dd>i2
2221 <dl><dd>i3
2222 </dd></dl>
2223 </dd></dl>
2224 </dd></dl>
2225
2226 !! end
2227
2228 !! test
2229 Definition Lists: Indentation: Missing 1st level
2230 !! input
2231 ::i2
2232 :::i3
2233 !! result
2234 <dl><dd><dl><dd>i2
2235 <dl><dd>i3
2236 </dd></dl>
2237 </dd></dl>
2238 </dd></dl>
2239
2240 !! end
2241
2242 !! test
2243 Definition Lists: Indentation: Multi-level indent
2244 !! input
2245 :::i3
2246 !! result
2247 <dl><dd><dl><dd><dl><dd>i3
2248 </dd></dl>
2249 </dd></dl>
2250 </dd></dl>
2251
2252 !! end
2253
2254 !! test
2255 Definition Lists: Hacky use to indent tables
2256 !! input
2257 ::{|
2258 |foo
2259 |bar
2260 |}
2261 this text
2262 should be left alone
2263 !! result
2264 <dl><dd><dl><dd><table>
2265 <tr>
2266 <td>foo
2267 </td>
2268 <td>bar
2269 </td></tr></table></dd></dl></dd></dl>
2270 <p>this text
2271 should be left alone
2272 </p>
2273 !! end
2274 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2275 ## as an empty dt item. It also ignores all but the last ";" when followed
2276 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2277 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2278 ## ";"s.
2279 ##
2280 ## Ex: ";;t2 ::d2" is transformed into:
2281 ##
2282 ## <dl>
2283 ## <dt>t2 </dt>
2284 ## <dd>
2285 ## <dl>
2286 ## <dt></dt>
2287 ## <dd>d2</dd>
2288 ## </dl>
2289 ## </dd>
2290 ## </dl>
2291 ##
2292 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2293 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2294 ##
2295 ## <dl>
2296 ## <dt>
2297 ## <dl>
2298 ## <dt>t2 </dt>
2299 ## <dd>:d2</dd>
2300 ## </dl>
2301 ## </dt>
2302 ## </dl>
2303 ##
2304 ## All Parsoid only definition list tests have this difference.
2305 ##
2306 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2307 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2308
2309 !! test
2310 Table / list interaction: indented table with lists in table contents
2311 !! input
2312 :{|
2313 |-
2314 | a
2315 * b
2316 |-
2317 | c
2318 * d
2319 |}
2320 !! result
2321 <dl><dd><table>
2322
2323 <tr>
2324 <td> a
2325 <ul><li> b
2326 </li></ul>
2327 </td></tr>
2328 <tr>
2329 <td> c
2330 <ul><li> d
2331 </li></ul>
2332 </td></tr></table></dd></dl>
2333
2334 !! end
2335
2336 !!test
2337 Table / list interaction: lists nested in tables nested in indented lists
2338 !!input
2339 :{|
2340 |
2341 :a
2342 :b
2343 |
2344 *c
2345 *d
2346 |}
2347
2348 *e
2349 *f
2350 !!result
2351 <dl><dd><table>
2352 <tr>
2353 <td>
2354 <dl><dd>a
2355 </dd><dd>b
2356 </dd></dl>
2357 </td>
2358 <td>
2359 <ul><li>c
2360 </li><li>d
2361 </li></ul>
2362 </td></tr></table></dd></dl>
2363 <ul><li>e
2364 </li><li>f
2365 </li></ul>
2366
2367 !!end
2368
2369 !! test
2370 Definition Lists: Nesting: Multi-level (Parsoid only)
2371 !! options
2372 parsoid
2373 !! input
2374 ;t1 :d1
2375 ;;t2 ::d2
2376 ;;;t3 :::d3
2377 !! result
2378 <dl>
2379 <dt>t1 </dt>
2380 <dd>d1</dd>
2381 <dt>
2382 <dl>
2383 <dt>t2 </dt>
2384 <dd>:d2</dd>
2385 <dt>
2386 <dl>
2387 <dt>t3 </dt>
2388 <dd>::d3</dd>
2389 </dl>
2390 </dt>
2391 </dl>
2392 </dt>
2393 </dl>
2394
2395
2396 !! end
2397
2398
2399 !! test
2400 Definition Lists: Nesting: Test 2 (Parsoid only)
2401 !! options
2402 parsoid
2403 !! input
2404 ;t1
2405 ::d2
2406 !! result
2407 <dl>
2408 <dt>t1</dt>
2409 <dd>
2410 <dl>
2411 <dd>d2</dd>
2412 </dl>
2413 </dd>
2414 </dl>
2415
2416 !! end
2417
2418
2419 !! test
2420 Definition Lists: Nesting: Test 3 (Parsoid only)
2421 !! options
2422 parsoid
2423 !! input
2424 :;t1
2425 ::::d2
2426 !! result
2427 <dl>
2428 <dd>
2429 <dl>
2430 <dt>t1</dt>
2431 <dd>
2432 <dl>
2433 <dd>
2434 <dl>
2435 <dd>d2</dd>
2436 </dl>
2437 </dd>
2438 </dl>
2439 </dd>
2440 </dl>
2441 </dd>
2442 </dl>
2443
2444 !! end
2445
2446
2447 !! test
2448 Definition Lists: Nesting: Test 4
2449 !! input
2450 ::;t3
2451 :::d3
2452 !! result
2453 <dl><dd><dl><dd><dl><dt>t3
2454 </dt><dd>d3
2455 </dd></dl>
2456 </dd></dl>
2457 </dd></dl>
2458
2459 !! end
2460
2461
2462 ## The Parsoid team believes the following three test exposes a
2463 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2464 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2465 !! test
2466 Definition Lists: Mixed Lists: Test 1 (php)
2467 !! options
2468 php
2469 !! input
2470 :;* foo
2471 ::* bar
2472 :; baz
2473 !! result
2474 <dl><dd><dl><dt><ul><li> foo
2475 </li><li> bar
2476 </li></ul>
2477 </dt></dl>
2478 <dl><dt> baz
2479 </dt></dl>
2480 </dd></dl>
2481
2482 !! end
2483 !! test
2484 Definition Lists: Mixed Lists: Test 1 (parsoid)
2485 !! options
2486 parsoid
2487 !! input
2488 :;* foo
2489 ::* bar
2490 :; baz
2491 !! result
2492 <dl><dd><dl><dt><ul><li> foo
2493 </li></ul></dt><dd><ul><li> bar
2494 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2495 !! end
2496
2497 !! test
2498 Definition Lists: Mixed Lists: Test 2
2499 !! input
2500 *: d1
2501 *: d2
2502 !! result
2503 <ul><li><dl><dd> d1
2504 </dd><dd> d2
2505 </dd></dl>
2506 </li></ul>
2507
2508 !! end
2509
2510
2511 !! test
2512 Definition Lists: Mixed Lists: Test 3
2513 !! input
2514 *::: d1
2515 *::: d2
2516 !! result
2517 <ul><li><dl><dd><dl><dd><dl><dd> d1
2518 </dd><dd> d2
2519 </dd></dl>
2520 </dd></dl>
2521 </dd></dl>
2522 </li></ul>
2523
2524 !! end
2525
2526
2527 !! test
2528 Definition Lists: Mixed Lists: Test 4
2529 !! input
2530 *;d1 :d2
2531 *;d3 :d4
2532 !! result
2533 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2534 </dd><dt>d3&#160;</dt><dd>d4
2535 </dd></dl>
2536 </li></ul>
2537
2538 !! end
2539
2540
2541 !! test
2542 Definition Lists: Mixed Lists: Test 5
2543 !! input
2544 *:d1
2545 *:: d2
2546 !! result
2547 <ul><li><dl><dd>d1
2548 <dl><dd> d2
2549 </dd></dl>
2550 </dd></dl>
2551 </li></ul>
2552
2553 !! end
2554
2555
2556 !! test
2557 Definition Lists: Mixed Lists: Test 6
2558 !! input
2559 #*:d1
2560 #*::: d3
2561 !! result
2562 <ol><li><ul><li><dl><dd>d1
2563 <dl><dd><dl><dd> d3
2564 </dd></dl>
2565 </dd></dl>
2566 </dd></dl>
2567 </li></ul>
2568 </li></ol>
2569
2570 !! end
2571
2572
2573 !! test
2574 Definition Lists: Mixed Lists: Test 7
2575 !! input
2576 :* d1
2577 :* d2
2578 !! result
2579 <dl><dd><ul><li> d1
2580 </li><li> d2
2581 </li></ul>
2582 </dd></dl>
2583
2584 !! end
2585
2586
2587 !! test
2588 Definition Lists: Mixed Lists: Test 8
2589 !! input
2590 :* d1
2591 ::* d2
2592 !! result
2593 <dl><dd><ul><li> d1
2594 </li></ul>
2595 <dl><dd><ul><li> d2
2596 </li></ul>
2597 </dd></dl>
2598 </dd></dl>
2599
2600 !! end
2601
2602
2603 !! test
2604 Definition Lists: Mixed Lists: Test 9
2605 !! input
2606 *;foo :bar
2607 !! result
2608 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2609 </dd></dl>
2610 </li></ul>
2611
2612 !! end
2613
2614
2615 !! test
2616 Definition Lists: Mixed Lists: Test 10
2617 !! input
2618 *#;foo :bar
2619 !! result
2620 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2621 </dd></dl>
2622 </li></ol>
2623 </li></ul>
2624
2625 !! end
2626
2627 # The Parsoid team disagrees with the PHP parser's seemingly-random
2628 # rules regarding dd/dt on the next two tests. Parsoid is more
2629 # consistent, and recognizes the shared nesting and keeps the
2630 # still-open tags around until the nesting is complete.
2631
2632 !! test
2633 Definition Lists: Mixed Lists: Test 11 (php)
2634 !! options
2635 php
2636 !! input
2637 *#*#;*;;foo :bar
2638 *#*#;boo :baz
2639 !! result
2640 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2641 </dt></dl>
2642 </dd></dl>
2643 </li></ul>
2644 </dd></dl>
2645 <dl><dt>boo&#160;</dt><dd>baz
2646 </dd></dl>
2647 </li></ol>
2648 </li></ul>
2649 </li></ol>
2650 </li></ul>
2651
2652 !! end
2653 !! test
2654 Definition Lists: Mixed Lists: Test 11 (parsoid)
2655 !! options
2656 parsoid
2657 !! input
2658 *#*#;*;;foo :bar
2659 *#*#;boo :baz
2660 !! result
2661 <ul>
2662 <li>
2663 <ol>
2664 <li>
2665 <ul>
2666 <li>
2667 <ol>
2668 <li>
2669 <dl>
2670 <dt>
2671 <ul>
2672 <li>
2673 <dl>
2674 <dt>
2675 <dl>
2676 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2677 <dd data-parsoid='{"stx":"row"}'>bar</dd></dl></dt></dl></li></ul></dt>
2678 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2679 <dd data-parsoid='{"stx":"row"}'>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2680 !! end
2681
2682
2683 !! test
2684 Definition Lists: Weird Ones: Test 1 (php)
2685 !! options
2686 php
2687 !! input
2688 *#;*::;; foo : bar (who uses this?)
2689 !! result
2690 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2691 </dt></dl>
2692 </dd></dl>
2693 </dd></dl>
2694 </dd></dl>
2695 </li></ul>
2696 </dd></dl>
2697 </li></ol>
2698 </li></ul>
2699
2700 !! end
2701 !! test
2702 Definition Lists: Weird Ones: Test 1 (parsoid)
2703 !! options
2704 parsoid
2705 !! input
2706 *#;*::;; foo : bar (who uses this?)
2707 !! result
2708 <ul>
2709 <li>
2710 <ol>
2711 <li>
2712 <dl>
2713 <dt>
2714 <ul>
2715 <li>
2716 <dl>
2717 <dd>
2718 <dl>
2719 <dd>
2720 <dl>
2721 <dt>
2722 <dl>
2723 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2724 <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>
2725 !! end
2726
2727 ###
2728 ### External links
2729 ###
2730 !! test
2731 External links: non-bracketed
2732 !! input
2733 Non-bracketed: http://example.com
2734 !! result
2735 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2736 </p>
2737 !! end
2738
2739 !! test
2740 External links: numbered
2741 !! input
2742 Numbered: [http://example.com]
2743 Numbered: [http://example.net]
2744 Numbered: [http://example.com]
2745 !! result
2746 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2747 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2748 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2749 </p>
2750 !!end
2751
2752 !! test
2753 External links: specified text
2754 !! input
2755 Specified text: [http://example.com link]
2756 !! result
2757 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2758 </p>
2759 !!end
2760
2761 !! test
2762 External links: trail
2763 !! input
2764 Linktrails should not work for external links: [http://example.com link]s
2765 !! result
2766 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2767 </p>
2768 !! end
2769
2770 !! test
2771 External links: dollar sign in URL
2772 !! input
2773 http://example.com/1$2345
2774 !! result
2775 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2776 </p>
2777 !! end
2778
2779 !! test
2780 External links: dollar sign in URL (named)
2781 !! input
2782 [http://example.com/1$2345]
2783 !! result
2784 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2785 </p>
2786 !!end
2787
2788 !! test
2789 External links: open square bracket forbidden in URL (bug 4377)
2790 !! input
2791 http://example.com/1[2345
2792 !! result
2793 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2794 </p>
2795 !! end
2796
2797 !! test
2798 External links: open square bracket forbidden in URL (named) (bug 4377)
2799 !! input
2800 [http://example.com/1[2345]
2801 !! result
2802 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2803 </p>
2804 !!end
2805
2806 !! test
2807 External links: nowiki in URL link text (bug 6230)
2808 !!input
2809 [http://example.com/ <nowiki>''example site''</nowiki>]
2810 !! result
2811 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2812 </p>
2813 !! end
2814
2815 !! test
2816 External links: newline forbidden in text (bug 6230 regression check)
2817 !! input
2818 [http://example.com/ first
2819 second]
2820 !! result
2821 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2822 second]
2823 </p>
2824 !!end
2825
2826 !! test
2827 External links: Pipe char between url and text
2828 !! input
2829 [http://example.com | link]
2830 !! result
2831 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2832 </p>
2833 !!end
2834
2835 !! test
2836 External links: protocol-relative URL in brackets
2837 !! input
2838 [//example.com/ Test]
2839 !! result
2840 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2841 </p>
2842 !! end
2843
2844 !! test
2845 External links: protocol-relative URL in brackets without text
2846 !! input
2847 [//example.com]
2848 !! result
2849 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2850 </p>
2851 !! end
2852
2853 !! test
2854 External links: protocol-relative URL in free text is left alone
2855 !! input
2856 //example.com/Foo
2857 !! result
2858 <p>//example.com/Foo
2859 </p>
2860 !!end
2861
2862 !! test
2863 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2864 !! input
2865 foo//example.com/Foo
2866 !! result
2867 <p>foo//example.com/Foo
2868 </p>
2869 !! end
2870
2871 !! test
2872 External image
2873 !! input
2874 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2875 !! result
2876 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2877 </p>
2878 !! end
2879
2880 !! test
2881 External image from https
2882 !! input
2883 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2884 !! result
2885 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2886 </p>
2887 !! end
2888
2889 !! test
2890 External image (when not allowed)
2891 !! options
2892 wgAllowExternalImages=0
2893 !! input
2894 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2895 !! result
2896 <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>
2897 </p>
2898 !! end
2899
2900 !! test
2901 Link to non-http image, no img tag
2902 !! input
2903 Link to non-http image, no img tag: ftp://example.com/test.jpg
2904 !! result
2905 <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>
2906 </p>
2907 !! end
2908
2909 !! test
2910 External links: terminating separator
2911 !! input
2912 Terminating separator: http://example.com/thing,
2913 !! result
2914 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2915 </p>
2916 !! end
2917
2918 !! test
2919 External links: intervening separator
2920 !! input
2921 Intervening separator: http://example.com/1,2,3
2922 !! result
2923 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2924 </p>
2925 !! end
2926
2927 !! test
2928 External links: old bug with URL in query
2929 !! input
2930 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2931 !! result
2932 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2933 </p>
2934 !! end
2935
2936 !! test
2937 External links: old URL-in-URL bug, mixed protocols
2938 !! input
2939 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2940 !! result
2941 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2942 </p>
2943 !!end
2944
2945 !! test
2946 External links: URL in text
2947 !! input
2948 URL in text: [http://example.com http://example.com]
2949 !! result
2950 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2951 </p>
2952 !! end
2953
2954 !! test
2955 External links: Clickable images
2956 !! input
2957 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2958 !! result
2959 <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>
2960 </p>
2961 !!end
2962
2963 !! test
2964 External links: raw ampersand
2965 !! input
2966 Old &amp; use: http://x&y
2967 !! result
2968 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2969 </p>
2970 !! end
2971
2972 !! test
2973 External links: encoded ampersand
2974 !! input
2975 Old &amp; use: http://x&amp;y
2976 !! result
2977 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2978 </p>
2979 !! end
2980
2981 !! test
2982 External links: encoded equals (bug 6102)
2983 !! input
2984 http://example.com/?foo&#61;bar
2985 !! result
2986 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2987 </p>
2988 !! end
2989
2990 !! test
2991 External links: [raw ampersand]
2992 !! input
2993 Old &amp; use: [http://x&y]
2994 !! result
2995 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2996 </p>
2997 !! end
2998
2999 !! test
3000 External links: [encoded ampersand]
3001 !! input
3002 Old &amp; use: [http://x&amp;y]
3003 !! result
3004 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3005 </p>
3006 !! end
3007
3008 !! test
3009 External links: [encoded equals] (bug 6102)
3010 !! input
3011 [http://example.com/?foo&#61;bar]
3012 !! result
3013 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3014 </p>
3015 !! end
3016
3017 !! test
3018 External links: [IDN ignored character reference in hostname; strip it right off]
3019 !! input
3020 [http://e&zwnj;xample.com/]
3021 !! result
3022 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
3023 </p>
3024 !! end
3025
3026 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
3027 # Where an external link could easily circumvent the sanitization of the text of
3028 # a link like this (where an IDN-ignore character is in the URL somewhere), this
3029 # test demands a higher standard. That's a bit strange.
3030 #
3031 # Example:
3032 #
3033 # http://e‌xample.com -> [http://example.com|http://example.com]
3034 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
3035 #
3036 # The first example is sanitized, but the second is not. Any security benefits
3037 # from this production are trivial to circumvent. Either remove this test and
3038 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
3039 # the test accordingly.
3040 #
3041 # All our love,
3042 # The Parsoid team.
3043 !! test
3044 External links: IDN ignored character reference in hostname; strip it right off
3045 !! input
3046 http://e&zwnj;xample.com/
3047 !! result
3048 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
3049 </p>
3050 !! end
3051
3052 !! test
3053 External links: www.jpeg.org (bug 554)
3054 !! input
3055 http://www.jpeg.org
3056 !!result
3057 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
3058 </p>
3059 !! end
3060
3061 !! test
3062 External links: URL within URL (original bug 2)
3063 !! input
3064 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
3065 !! result
3066 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
3067 </p>
3068 !! end
3069
3070 !! test
3071 BUG 361: URL inside bracketed URL
3072 !! input
3073 [http://www.example.com/foo http://www.example.com/bar]
3074 !! result
3075 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
3076 </p>
3077 !! end
3078
3079 !! test
3080 BUG 361: URL within URL, not bracketed
3081 !! input
3082 http://www.example.com/foo?=http://www.example.com/bar
3083 !! result
3084 <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>
3085 </p>
3086 !! end
3087
3088 !! test
3089 BUG 289: ">"-token in URL-tail
3090 !! input
3091 http://www.example.com/<hello>
3092 !! result
3093 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
3094 </p>
3095 !!end
3096
3097 !! test
3098 BUG 289: literal ">"-token in URL-tail
3099 !! input
3100 http://www.example.com/<b>html</b>
3101 !! result
3102 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
3103 </p>
3104 !!end
3105
3106 !! test
3107 BUG 289: ">"-token in bracketed URL
3108 !! input
3109 [http://www.example.com/<hello> stuff]
3110 !! result
3111 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
3112 </p>
3113 !!end
3114
3115 !! test
3116 BUG 289: literal ">"-token in bracketed URL
3117 !! input
3118 [http://www.example.com/<b>html</b> stuff]
3119 !! result
3120 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
3121 </p>
3122 !!end
3123
3124 !! test
3125 BUG 289: literal double quote at end of URL
3126 !! input
3127 http://www.example.com/"hello"
3128 !! result
3129 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
3130 </p>
3131 !!end
3132
3133 !! test
3134 BUG 289: literal double quote in bracketed URL
3135 !! input
3136 [http://www.example.com/"hello" stuff]
3137 !! result
3138 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
3139 </p>
3140 !!end
3141
3142 !! test
3143 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
3144 !! input
3145 [http://www.example.com test]
3146 !! result
3147 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3148 </p>
3149 !! end
3150
3151 !! test
3152 External links: link text with spaces
3153 !! input
3154 [http://www.example.com a b c]
3155 [http://www.example.com ''a'' ''b'']
3156 !! result
3157 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3158 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3159 </p>
3160 !! end
3161
3162 !! test
3163 External links: wiki links within external link (Bug 3695)
3164 !! input
3165 [http://example.com [[wikilink]] embedded in ext link]
3166 !! result
3167 <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>
3168 </p>
3169 !! end
3170
3171 !! test
3172 BUG 787: Links with one slash after the url protocol are invalid
3173 !! input
3174 http:/example.com
3175
3176 [http:/example.com title]
3177 !! result
3178 <p>http:/example.com
3179 </p><p>[http:/example.com title]
3180 </p>
3181 !! end
3182
3183 !! test
3184 Bracketed external links with template-generated invalid target
3185 !! input
3186 [{{echo|http:/example.com}} title]
3187 !! result
3188 <p>[http:/example.com title]
3189 </p>
3190 !! end
3191
3192 !! test
3193 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3194 !! input
3195 ''[http://example.com text'']
3196 [http://example.com '''text]'''
3197 ''Something [http://example.com in italic'']
3198 ''Something [http://example.com mixed''''', even bold]'''
3199 '''''Now [http://example.com both''''']
3200 !! result
3201 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3202 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3203 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3204 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3205 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3206 </p>
3207 !! end
3208
3209
3210 !! test
3211 Bug 4781: %26 in URL
3212 !! input
3213 http://www.example.com/?title=AT%26T
3214 !! result
3215 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3216 </p>
3217 !! end
3218
3219 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3220 # % is actually legal in HTML5. Any change in output would need testing though.
3221 !! test
3222 Bug 4781, 5267: %25 in URL
3223 !! input
3224 http://www.example.com/?title=100%25_Bran
3225 !! result
3226 <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>
3227 </p>
3228 !! end
3229
3230 !! test
3231 Bug 4781, 5267: %28, %29 in URL
3232 !! input
3233 http://www.example.com/?title=Ben-Hur_%281959_film%29
3234 !! result
3235 <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>
3236 </p>
3237 !! end
3238
3239
3240 !! test
3241 Bug 4781: %26 in autonumber URL
3242 !! input
3243 [http://www.example.com/?title=AT%26T]
3244 !! result
3245 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3246 </p>
3247 !! end
3248
3249 !! test
3250 Bug 4781, 5267: %26 in autonumber URL
3251 !! input
3252 [http://www.example.com/?title=100%25_Bran]
3253 !! result
3254 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3255 </p>
3256 !! end
3257
3258 !! test
3259 Bug 4781, 5267: %28, %29 in autonumber URL
3260 !! input
3261 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3262 !! result
3263 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3264 </p>
3265 !! end
3266
3267
3268 !! test
3269 Bug 4781: %26 in bracketed URL
3270 !! input
3271 [http://www.example.com/?title=AT%26T link]
3272 !! result
3273 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3274 </p>
3275 !! end
3276
3277 !! test
3278 Bug 4781, 5267: %26 in bracketed URL
3279 !! input
3280 [http://www.example.com/?title=100%25_Bran link]
3281 !! result
3282 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3283 </p>
3284 !! end
3285
3286 !! test
3287 Bug 4781, 5267: %28, %29 in bracketed URL
3288 !! input
3289 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3290 !! result
3291 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3292 </p>
3293 !! end
3294
3295 !! test
3296 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3297 !! input
3298 Some [http://example.com/ pretty ''italics'' and stuff]!
3299 !! result
3300 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3301 </p>
3302 !! end
3303
3304 !! test
3305 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3306 !! input
3307 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3308 !! result
3309 <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>
3310 </p>
3311 !! end
3312
3313 !! test
3314 External link containing double-single-quotes with no space separating the url from text in italics
3315 !! input
3316 [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]].]
3317 !! result
3318 <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>
3319 </p>
3320 !! end
3321
3322 !! test
3323 External link with comments in link text
3324 !! input
3325 [http://www.google.com Google <!-- comment -->]
3326 !! result
3327 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3328 </p>
3329 !! end
3330
3331 !! test
3332 URL-encoding in URL functions (single parameter)
3333 !! input
3334 {{localurl:Some page|amp=&}}
3335 !! result
3336 <p>/index.php?title=Some_page&amp;amp=&amp;
3337 </p>
3338 !! end
3339
3340 !! test
3341 URL-encoding in URL functions (multiple parameters)
3342 !! input
3343 {{localurl:Some page|q=?&amp=&}}
3344 !! result
3345 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3346 </p>
3347 !! end
3348
3349 !! test
3350 Brackets in urls
3351 !! input
3352 http://example.com/index.php?foozoid%5B%5D=bar
3353
3354 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3355 !! result
3356 <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>
3357 </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>
3358 </p>
3359 !! end
3360
3361 !! test
3362 IPv6 urls (bug 21261)
3363 !! options
3364 disabled
3365 !! input
3366 http://[2404:130:0:1000::187:2]/index.php
3367 !! result
3368 <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>
3369 </p>
3370 !! end
3371
3372 !! test
3373 Non-extlinks in brackets
3374 !! input
3375 [foo]
3376 [foo bar]
3377 [foo ''bar'']
3378 [fool's] errand
3379 [fool's errand]
3380 [{{echo|foo}}]
3381 [{{echo|foo}} bar]
3382 [{{echo|foo}} ''bar'']
3383 [{{echo|foo}}l's] errand
3384 [{{echo|foo}}l's errand]
3385 [url={{echo|foo}}]
3386 [url=http://example.com]
3387 !! result
3388 <p>[foo]
3389 [foo bar]
3390 [foo <i>bar</i>]
3391 [fool's] errand
3392 [fool's errand]
3393 [foo]
3394 [foo bar]
3395 [foo <i>bar</i>]
3396 [fool's] errand
3397 [fool's errand]
3398 [url=foo]
3399 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3400 </p>
3401 !! end
3402
3403 !! test
3404 Parsoid: Percent encoding in external links
3405 !! options
3406 parsoid
3407 !! input
3408 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
3409 !! result
3410 <p><a rel="mw:ExtLink"
3411 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
3412 !! end
3413
3414 !! test
3415 Parsoid: use url link syntax for links where the content is equal the link
3416 target
3417 !! options
3418 parsoid
3419 !! input
3420 http://example.com
3421 !! result
3422 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
3423 !! end
3424
3425 ###
3426 ### Quotes
3427 ###
3428
3429 !! test
3430 Quotes
3431 !! input
3432 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3433
3434 Normal text. '''''Bold italic text.''''' Normal text.
3435 !!result
3436 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3437 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3438 </p>
3439 !! end
3440
3441
3442 !! test
3443 Unclosed and unmatched quotes (php)
3444 !! options
3445 php
3446 !! input
3447 '''''Bold italic text '''with bold deactivated''' in between.'''''
3448
3449 '''''Bold italic text ''with italic deactivated'' in between.'''''
3450
3451 '''Bold text..
3452
3453 ..spanning two paragraphs (should not work).'''
3454
3455 '''Bold tag left open
3456
3457 ''Italic tag left open
3458
3459 Normal text.
3460
3461 <!-- Unmatching number of opening, closing tags: -->
3462 '''This year''''s election ''should'' beat '''last year''''s.
3463
3464 ''Tom'''s car is bigger than ''Susan'''s.
3465
3466 Plain ''italic'''s plain
3467 !! result
3468 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3469 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3470 </p><p><b>Bold text..</b>
3471 </p><p>..spanning two paragraphs (should not work).
3472 </p><p><b>Bold tag left open</b>
3473 </p><p><i>Italic tag left open</i>
3474 </p><p>Normal text.
3475 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3476 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3477 </p><p>Plain <i>italic'</i>s plain
3478 </p>
3479 !! end
3480 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3481 # parser strips. The wikitext contains just the first half of the bold
3482 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3483 # differently than the PHP parser.)
3484 !! test
3485 Unclosed and unmatched quotes (parsoid)
3486 !! options
3487 parsoid
3488 !! input
3489 '''''Bold italic text '''with bold deactivated''' in between.'''''
3490
3491 '''''Bold italic text ''with italic deactivated'' in between.'''''
3492
3493 '''Bold text..
3494
3495 ..spanning two paragraphs (should not work).'''
3496
3497 '''Bold tag left open
3498
3499 ''Italic tag left open
3500
3501 Normal text.
3502
3503 <!-- Unmatching number of opening, closing tags: -->
3504 '''This year''''s election ''should'' beat '''last year''''s.
3505
3506 ''Tom'''s car is bigger than ''Susan'''s.
3507
3508 Plain ''italic'''s plain
3509 !! result
3510 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3511 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3512 </p><p><b>Bold text..</b>
3513 </p><p>..spanning two paragraphs (should not work).<b></b>
3514 </p><p><b>Bold tag left open</b>
3515 </p><p><i>Italic tag left open</i>
3516 </p><p>Normal text.
3517 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3518 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3519 </p><p>Plain <i>italic'</i>s plain
3520 </p>
3521 !! end
3522
3523 ###
3524 ### Tables
3525 ###
3526 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3527 ###
3528
3529 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3530 # is the bare minimum required by the spec, see:
3531 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3532 !! test
3533 A table with no data. (php)
3534 !! options
3535 php
3536 !! input
3537 {||}
3538 !! result
3539 !! end
3540 # Parsoid team replies: empty table tags are legal in HTML5
3541 !! test
3542 A table with no data. (parsoid)
3543 !! options
3544 parsoid
3545 !! input
3546 {||}
3547 !! result
3548 <table></table>
3549 !! end
3550
3551 # A table with nothing but a caption is invalid XHTML, we might want to render
3552 # this as <p>caption</p>
3553 !! test
3554 A table with nothing but a caption (php)
3555 !! options
3556 php
3557 !! input
3558 {|
3559 |+ caption
3560 |}
3561 !! result
3562 <table>
3563 <caption> caption
3564 </caption><tr><td></td></tr></table>
3565
3566 !! end
3567 # Parsoid team replies: table with only a caption is legal in HTML5
3568 !! test
3569 A table with nothing but a caption (parsoid)
3570 !! options
3571 parsoid
3572 !! input
3573 {|
3574 |+ caption
3575 |}
3576 !! result
3577 <table><caption> caption</caption></table>
3578 !! end
3579
3580 !! test
3581 A table with caption with default-spaced attributes and a table row
3582 !! input
3583 {|
3584 |+ style="color: red;" | caption1
3585 |-
3586 | foo
3587 |}
3588 !! result
3589 <table>
3590 <caption style="color: red;"> caption1
3591 </caption>
3592 <tr>
3593 <td> foo
3594 </td></tr></table>
3595
3596 !! end
3597
3598 !! test
3599 A table with captions with non-default spaced attributes and a table row
3600 !! input
3601 {|
3602 |+style="color: red;"|caption2
3603 |+ style="color: red;"| caption3
3604 |-
3605 | foo
3606 |}
3607 !! result
3608 <table>
3609 <caption style="color: red;">caption2
3610 </caption>
3611 <caption style="color: red;"> caption3
3612 </caption>
3613 <tr>
3614 <td> foo
3615 </td></tr></table>
3616
3617 !! end
3618
3619 !! test
3620 Table td-cell syntax variations
3621 !! input
3622 {|
3623 | foo bar foo | baz
3624 | foo bar foo || baz
3625 | style='color:red;' | baz
3626 | style='color:red;' || baz
3627 |}
3628 !! result
3629 <table>
3630 <tr>
3631 <td> baz
3632 </td>
3633 <td> foo bar foo </td>
3634 <td> baz
3635 </td>
3636 <td style="color:red;"> baz
3637 </td>
3638 <td> style='color:red;' </td>
3639 <td> baz
3640 </td></tr></table>
3641
3642 !! end
3643
3644 !! test
3645 Simple table
3646 !! input
3647 {|
3648 | 1 || 2
3649 |-
3650 | 3 || 4
3651 |}
3652 !! result
3653 <table>
3654 <tr>
3655 <td> 1 </td>
3656 <td> 2
3657 </td></tr>
3658 <tr>
3659 <td> 3 </td>
3660 <td> 4
3661 </td></tr></table>
3662
3663 !! end
3664
3665 !! test
3666 Simple table but with multiple dashes for row wikitext
3667 !! input
3668 {|
3669 | foo
3670 |-----
3671 | bar
3672 |}
3673 !! result
3674 <table>
3675 <tr>
3676 <td> foo
3677 </td></tr>
3678 <tr>
3679 <td> bar
3680 </td></tr></table>
3681
3682 !! end
3683 !! test
3684 Multiplication table
3685 !! input
3686 {| border="1" cellpadding="2"
3687 |+Multiplication table
3688 |-
3689 ! &times; !! 1 !! 2 !! 3
3690 |-
3691 ! 1
3692 | 1 || 2 || 3
3693 |-
3694 ! 2
3695 | 2 || 4 || 6
3696 |-
3697 ! 3
3698 | 3 || 6 || 9
3699 |-
3700 ! 4
3701 | 4 || 8 || 12
3702 |-
3703 ! 5
3704 | 5 || 10 || 15
3705 |}
3706 !! result
3707 <table border="1" cellpadding="2">
3708 <caption>Multiplication table
3709 </caption>
3710 <tr>
3711 <th> &#215; </th>
3712 <th> 1 </th>
3713 <th> 2 </th>
3714 <th> 3
3715 </th></tr>
3716 <tr>
3717 <th> 1
3718 </th>
3719 <td> 1 </td>
3720 <td> 2 </td>
3721 <td> 3
3722 </td></tr>
3723 <tr>
3724 <th> 2
3725 </th>
3726 <td> 2 </td>
3727 <td> 4 </td>
3728 <td> 6
3729 </td></tr>
3730 <tr>
3731 <th> 3
3732 </th>
3733 <td> 3 </td>
3734 <td> 6 </td>
3735 <td> 9
3736 </td></tr>
3737 <tr>
3738 <th> 4
3739 </th>
3740 <td> 4 </td>
3741 <td> 8 </td>
3742 <td> 12
3743 </td></tr>
3744 <tr>
3745 <th> 5
3746 </th>
3747 <td> 5 </td>
3748 <td> 10 </td>
3749 <td> 15
3750 </td></tr></table>
3751
3752 !! end
3753
3754 !! test
3755 Accept "||" in table headings
3756 !! input
3757 {|
3758 !h1 || h2
3759 |}
3760 !! result
3761 <table>
3762 <tr>
3763 <th>h1 </th>
3764 <th> h2
3765 </th></tr></table>
3766
3767 !! end
3768
3769 !! test
3770 Accept "||" in indented table headings
3771 !! input
3772 :{|
3773 !h1 || h2
3774 |}
3775 !! result
3776 <dl><dd><table>
3777 <tr>
3778 <th>h1 </th>
3779 <th> h2
3780 </th></tr></table></dd></dl>
3781
3782 !! end
3783
3784 !! test
3785 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3786 !! input
3787 {|
3788 !| h1
3789 || a
3790 |}
3791 !! result
3792 <table>
3793 <tr>
3794 <th> h1
3795 </th>
3796 <td> a
3797 </td></tr></table>
3798
3799 !! end
3800
3801 !!test
3802 Accept "| !" at start of line in tables (ignore !-attribute)
3803 !!input
3804 {|
3805 |-
3806 | !style="color:red" | bar
3807 |}
3808 !!result
3809 <table>
3810
3811 <tr>
3812 <td> bar
3813 </td></tr></table>
3814
3815 !!end
3816
3817 !!test
3818 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 +/-
3819 !!input
3820 {|
3821 |-
3822 |style='color:red;'|+1
3823 |style='color:blue;'|-1
3824 |-
3825 | 1 || 2 || 3
3826 | 1 ||+2 ||-3
3827 |-
3828 | +1
3829 | -1
3830 |}
3831 !!result
3832 <table>
3833
3834 <tr>
3835 <td style="color:red;">+1
3836 </td>
3837 <td style="color:blue;">-1
3838 </td></tr>
3839 <tr>
3840 <td> 1 </td>
3841 <td> 2 </td>
3842 <td> 3
3843 </td>
3844 <td> 1 </td>
3845 <td>+2 </td>
3846 <td>-3
3847 </td></tr>
3848 <tr>
3849 <td> +1
3850 </td>
3851 <td> -1
3852 </td></tr></table>
3853
3854 !!end
3855
3856 !! test
3857 Table rowspan
3858 !! input
3859 {| border=1
3860 | Cell 1, row 1
3861 |rowspan=2| Cell 2, row 1 (and 2)
3862 | Cell 3, row 1
3863 |-
3864 | Cell 1, row 2
3865 | Cell 3, row 2
3866 |}
3867 !! result
3868 <table border="1">
3869 <tr>
3870 <td> Cell 1, row 1
3871 </td>
3872 <td rowspan="2"> Cell 2, row 1 (and 2)
3873 </td>
3874 <td> Cell 3, row 1
3875 </td></tr>
3876 <tr>
3877 <td> Cell 1, row 2
3878 </td>
3879 <td> Cell 3, row 2
3880 </td></tr></table>
3881
3882 !! end
3883
3884 !! test
3885 Nested table
3886 !! input
3887 {| border=1
3888 | &alpha;
3889 |
3890 {| bgcolor=#ABCDEF border=2
3891 |nested
3892 |-
3893 |table
3894 |}
3895 |the original table again
3896 |}
3897 !! result
3898 <table border="1">
3899 <tr>
3900 <td> &#945;
3901 </td>
3902 <td>
3903 <table bgcolor="#ABCDEF" border="2">
3904 <tr>
3905 <td>nested
3906 </td></tr>
3907 <tr>
3908 <td>table
3909 </td></tr></table>
3910 </td>
3911 <td>the original table again
3912 </td></tr></table>
3913
3914 !! end
3915
3916 !! test
3917 Invalid attributes in table cell (bug 1830)
3918 !! input
3919 {|
3920 |Cell:|broken
3921 |}
3922 !! result
3923 <table>
3924 <tr>
3925 <td>broken
3926 </td></tr></table>
3927
3928 !! end
3929
3930
3931 !! test
3932 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3933 !! input
3934 {|
3935 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3936 !! result
3937 <table>
3938 <tr>
3939 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3940 <td>]" onmouseover="alert(document.cookie)"&gt;test
3941 </td>
3942 </tr>
3943 </table>
3944
3945 !! end
3946
3947
3948 !! test
3949 Indented table markup mixed with indented pre content (proposed in bug 6200)
3950 !! input
3951 <table>
3952 <tr>
3953 <td>
3954 Text that should be rendered preformatted
3955 </td>
3956 </tr>
3957 </table>
3958 !! result
3959 <table>
3960 <tr>
3961 <td>
3962 <pre>Text that should be rendered preformatted
3963 </pre>
3964 </td>
3965 </tr>
3966 </table>
3967
3968 !! end
3969
3970 !! test
3971 Template-generated table cell attributes and cell content
3972 !! input
3973 {|
3974 |{{table_attribs}}
3975 |}
3976 !! result
3977 <table>
3978 <tr>
3979 <td style="color: red"> Foo
3980 </td></tr></table>
3981
3982 !! end
3983
3984 !! test
3985 Template-generated table cell attributes and cell content (2)
3986 !! input
3987 {|
3988 |align=center {{table_attribs}}
3989 |}
3990 !! result
3991 <table>
3992 <tr>
3993 <td align="center" style="color: red"> Foo
3994 </td></tr></table>
3995
3996 !! end
3997
3998 !! test
3999 Template-generated table cell attributes and cell content (3)
4000 !! input
4001 {|
4002 |align=center {{table_cells}}
4003 |}
4004 !! result
4005 <table>
4006 <tr>
4007 <td align="center" style="color: red"> Foo </td>
4008 <td> Bar </td>
4009 <td> Baz
4010 </td></tr></table>
4011
4012 !! end
4013
4014 !! test
4015 Table with row followed by newlines and table heading
4016 !! input
4017 {|
4018 |-
4019
4020 ! foo
4021 |}
4022 !! result
4023 <table>
4024
4025
4026 <tr>
4027 <th> foo
4028 </th></tr></table>
4029
4030 !! end
4031
4032 !! test
4033 Table with empty line following the start tag
4034 !! input
4035 {|
4036
4037 |-
4038 | foo
4039 |}
4040 !! result
4041 <table>
4042
4043
4044 <tr>
4045 <td> foo
4046 </td></tr></table>
4047
4048 !! end
4049
4050 # FIXME: Preserve the attribute properly (with an empty string as value) in
4051 # the PHP parser. Parsoid implements the behavior below.
4052 !! test
4053 Table attributes with empty value
4054 !! options
4055 parsoid
4056 !! input
4057 {|
4058 | style=| hello
4059 |}
4060 !! result
4061 <table>
4062 <tbody>
4063 <tr>
4064 <td style=""> hello
4065 </td></tr></tbody></table>
4066
4067 !! end
4068
4069 !! test
4070 Wikitext table with a lot of comments
4071 !! input
4072 {|
4073 <!-- c0 -->
4074 | foo
4075 <!-- c1 -->
4076 |- <!-- c2 -->
4077 <!-- c3 -->
4078 |<!-- c4 -->
4079 <!-- c5 -->
4080 |}
4081 !! result
4082 <table>
4083 <tr>
4084 <td> foo
4085 </td></tr>
4086 <tr>
4087 <td>
4088 </td></tr></table>
4089
4090 !! end
4091
4092 !! test
4093 Wikitext table with double-line table cell
4094 !! input
4095 {|
4096 |a
4097 b
4098 |}
4099 !! result
4100 <table>
4101 <tr>
4102 <td>a
4103 <p>b
4104 </p>
4105 </td></tr></table>
4106
4107 !! end
4108
4109 !! test
4110 Table cell with a single comment
4111 !! input
4112 {|
4113 | <!-- c1 -->
4114 | a
4115 |}
4116 !! result
4117 <table>
4118 <tr>
4119 <td>
4120 </td>
4121 <td> a
4122 </td></tr></table>
4123
4124 !! end
4125
4126 # The expected HTML structure in this test is debatable. The PHP parser does
4127 # not parse this kind of table at all. The main focus for Parsoid is on
4128 # round-tripping, so this output is ok for now. TODO: revisit!
4129 !! test
4130 Wikitext table with html-syntax row (Parsoid)
4131 !! options
4132 parsoid
4133 !! input
4134 {|
4135 |-
4136 <td>foo</td>
4137 |}
4138 !! result
4139 <table>
4140 <tbody>
4141 <tr>
4142 <td>foo</td></tr></tbody></table>
4143 !! end
4144
4145 !! test
4146 Implicit <td> after a |-
4147 (PHP parser relies on Tidy to add the missing <td> tags)
4148 !! options
4149 parsoid=wt2html,wt2wt
4150 !! input
4151 {|
4152 |-
4153 a
4154 |}
4155 !! result
4156 <table>
4157 <tr><td>a</td></tr>
4158 </table>
4159 !! end
4160
4161 !! test
4162 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
4163 (PHP parser relies on Tidy to add the missing <td> tags)
4164 !! options
4165 parsoid=wt2html,wt2wt
4166 !! input
4167 {|
4168 |-
4169 |
4170 a
4171 |-
4172 b
4173 |}
4174 !! result
4175 <table>
4176 <tbody>
4177 <tr><td><pre>a</pre></td></tr>
4178 <tr><td> b</td></tr>
4179 </tbody>
4180 </table>
4181 !! end
4182
4183 !! test
4184 Lists should be recognized in an implicit <td> context
4185 (PHP parser relies on Tidy to add the missing <td> tags)
4186 !! options
4187 parsoid=wt2html,wt2wt
4188 !! input
4189 {|
4190 |-
4191 *a
4192 |}
4193 !! result
4194 <table>
4195 <tr>
4196 <td><ul><li>a</li></ul></td>
4197 </tr>
4198 </table>
4199 !! end
4200
4201 ###
4202 ### Internal links
4203 ###
4204 !! test
4205 Plain link, capitalized
4206 !! input
4207 [[Main Page]]
4208 !! result
4209 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4210 </p>
4211 !! end
4212
4213 !! test
4214 Plain link, uncapitalized
4215 !! input
4216 [[main Page]]
4217 !! result
4218 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
4219 </p>
4220 !! end
4221
4222 !! test
4223 Piped link
4224 !! input
4225 [[Main Page|The Main Page]]
4226 !! result
4227 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4228 </p>
4229 !! end
4230
4231 !! test
4232 Piped link with comment in link text
4233 !! input
4234 [[Main Page|The Main<!--front--> Page]]
4235 !! result
4236 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4237 </p>
4238 !! end
4239
4240 !! test
4241 Broken link
4242 !! input
4243 [[Zigzagzogzagzig]]
4244 !! result
4245 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
4246 </p>
4247 !! end
4248
4249 !! test
4250 Broken link with fragment
4251 !! input
4252 [[Zigzagzogzagzig#zug]]
4253 !! result
4254 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
4255 </p>
4256 !! end
4257
4258 !! test
4259 Special page link with fragment
4260 !! input
4261 [[Special:Version#anchor]]
4262 !! result
4263 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
4264 </p>
4265 !! end
4266
4267 !! test
4268 Nonexistent special page link with fragment
4269 !! input
4270 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
4271 !! result
4272 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
4273 </p>
4274 !! end
4275
4276 !! test
4277 Link with prefix
4278 !! input
4279 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
4280 !! result
4281 <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>
4282 </p>
4283 !! end
4284
4285 !! test
4286 Link with suffix
4287 !! input
4288 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
4289 !! result
4290 <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>!!!
4291 </p>
4292 !! end
4293
4294 !! article
4295 prefixed article
4296 !! text
4297 Some text
4298 !! endarticle
4299
4300 !! test
4301 Bug 43661: Piped links with identical prefixes
4302 !! input
4303 [[prefixed article|prefixed articles with spaces]]
4304
4305 [[prefixed article|prefixed articlesaoeu]]
4306
4307 [[Main Page|Main Page test]]
4308 !! result
4309 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
4310 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
4311 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
4312 </p>
4313 !! end
4314
4315
4316 !! test
4317 Link with HTML entity in suffix / tail
4318 !! input
4319 [[Main Page]]&quot;, [[Main Page]]&#97;
4320 !! result
4321 <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;
4322 </p>
4323 !! end
4324
4325 !! test
4326 Link with 3 brackets
4327 !! input
4328 [[[main page]]]
4329 !! result
4330 <p>[[[main page]]]
4331 </p>
4332 !! end
4333
4334 !! test
4335 Piped link with 3 brackets
4336 !! input
4337 [[[main page|the main page]]]
4338 !! result
4339 <p>[[[main page|the main page]]]
4340 </p>
4341 !! end
4342
4343 !! test
4344 Link with multiple pipes
4345 !! input
4346 [[Main Page|The|Main|Page]]
4347 !! result
4348 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
4349 </p>
4350 !! end
4351
4352 !! test
4353 Link to namespaces
4354 !! input
4355 [[Talk:Parser testing]], [[Meta:Disclaimers]]
4356 !! result
4357 <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>
4358 </p>
4359 !! end
4360
4361 !! test
4362 Piped link to namespace
4363 !! input
4364 [[Meta:Disclaimers|The disclaimers]]
4365 !! result
4366 <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>
4367 </p>
4368 !! end
4369
4370 !! test
4371 Link containing }
4372 !! input
4373 [[Usually caused by a typo (oops}]]
4374 !! result
4375 <p>[[Usually caused by a typo (oops}]]
4376 </p>
4377 !! end
4378
4379 !! test
4380 Link containing % (not as a hex sequence)
4381 !! input
4382 [[7% Solution]]
4383 !! result
4384 <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>
4385 </p>
4386 !! end
4387
4388 !! test
4389 Link containing % as a single hex sequence interpreted to char
4390 !! input
4391 [[7%25 Solution]]
4392 !! result
4393 <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>
4394 </p>
4395 !!end
4396
4397 !! test
4398 Link containing % as a double hex sequence interpreted to hex sequence
4399 !! input
4400 [[7%2525 Solution]]
4401 !! result
4402 <p>[[7%2525 Solution]]
4403 </p>
4404 !!end
4405
4406 !! test
4407 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
4408 Example for such a section: == < ==
4409 !! input
4410 [[%23%3c]][[%23%3e]]
4411 !! result
4412 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
4413 </p>
4414 !! end
4415
4416 !! test
4417 Link containing "<#" and ">#" as a hex sequences
4418 !! input
4419 [[%3c%23]][[%3e%23]]
4420 !! result
4421 <p>[[%3c%23]][[%3e%23]]
4422 </p>
4423 !! end
4424
4425 !! test
4426 Link containing an equals sign
4427 !! input
4428 [[Special:BookSources/isbn=4-00-026157-6]]
4429 !! result
4430 <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>
4431 </p>
4432 !! end
4433
4434 !! article
4435 Foo~bar
4436 !! text
4437 Just a test of an article title containing a tilde.
4438 !! endarticle
4439
4440 # note that links containing signatures, like [[Foo~~~~]], are
4441 # massaged by the pre-save transform (PST) and so the tildes are never
4442 # seen by the parser.
4443 !! test
4444 Link containing a tilde
4445 !! input
4446 [[Foo~bar]]
4447 !! result
4448 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
4449 </p>
4450 !! end
4451
4452 !! test
4453 Link containing double-single-quotes '' (bug 4598)
4454 !! input
4455 [[Lista d''e paise d''o munno]]
4456 !! result
4457 <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>
4458 </p>
4459 !! end
4460
4461 !! test
4462 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4463 !! input
4464 Some [[Link|pretty ''italics'' and stuff]]!
4465 !! result
4466 <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>!
4467 </p>
4468 !! end
4469
4470 !! test
4471 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4472 !! input
4473 ''Some [[Link|pretty ''italics'' and stuff]]!
4474 !! result
4475 <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>
4476 </p>
4477 !! end
4478
4479 !! test
4480 Link with double quotes in title part (literal) and alternate part (interpreted)
4481 !! input
4482 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4483
4484 [[''Pentecoste'']]
4485
4486 [[''Pentecoste''|Pentecoste]]
4487
4488 [[''Pentecoste''|''Pentecoste'']]
4489 !! result
4490 <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>
4491 </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>
4492 </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>
4493 </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>
4494 </p>
4495 !! end
4496
4497 !! test
4498 Broken image links with HTML captions (bug 39700)
4499 !! input
4500 [[File:Nonexistent|<script></script>]]
4501 [[File:Nonexistent|100px|<script></script>]]
4502 [[File:Nonexistent|&lt;]]
4503 [[File:Nonexistent|a<i>b</i>c]]
4504 !! result
4505 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4506 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4507 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4508 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4509 </p>
4510 !! end
4511
4512 !! test
4513 Plain link to URL
4514 !! input
4515 [[http://www.example.com]]
4516 !! result
4517 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4518 </p>
4519 !! end
4520
4521 !! test
4522 Plain link to URL with link text
4523 !! input
4524 [[http://www.example.com Link text]]
4525 !! result
4526 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4527 </p>
4528 !! end
4529
4530 !! test
4531 Plain link to protocol-relative URL
4532 !! input
4533 [[//www.example.com]]
4534 !! result
4535 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4536 </p>
4537 !! end
4538
4539 !! test
4540 Plain link to protocol-relative URL with link text
4541 !! input
4542 [[//www.example.com Link text]]
4543 !! result
4544 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4545 </p>
4546 !! end
4547
4548 !! test
4549 Plain link to page with question mark in title
4550 !! input
4551 [[A?b]]
4552
4553 [[A?b|Baz]]
4554 !! result
4555 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4556 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4557 </p>
4558 !! end
4559
4560
4561 # I'm fairly sure the expected result here is wrong.
4562 # We want these to be URL links, not pseudo-pages with URLs for titles....
4563 # However the current output is also pretty screwy.
4564 #
4565 # ----
4566 # I'm changing it to match the current output--it arguably makes more
4567 # sense in the light of the test above. Old expected result was:
4568 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4569 #</p>
4570 # But I think this test is bordering on "garbage in, garbage out" anyway.
4571 # -- wtm
4572 !! test
4573 Piped link to URL
4574 !! input
4575 Piped link to URL: [[http://www.example.com|an example URL]]
4576 !! result
4577 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4578 </p>
4579 !! end
4580
4581 !! test
4582 BUG 2: [[page|http://url/]] should link to page, not http://url/
4583 !! input
4584 [[Main Page|http://url/]]
4585 !! result
4586 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4587 </p>
4588 !! end
4589
4590 !! test
4591 BUG 337: Escaped self-links should be bold
4592 !! options
4593 title=[[Bug462]]
4594 !! input
4595 [[Bu&#103;462]] [[Bug462]]
4596 !! result
4597 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4598 </p>
4599 !! end
4600
4601 !! test
4602 Self-link to section should not be bold
4603 !! options
4604 title=[[Main Page]]
4605 !! input
4606 [[Main Page#section]]
4607 !! result
4608 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4609 </p>
4610 !! end
4611
4612 !! article
4613 00
4614 !! text
4615 This is 00.
4616 !! endarticle
4617
4618 !!test
4619 Self-link to numeric title
4620 !!options
4621 title=[[0]]
4622 !!input
4623 [[0]]
4624 !!result
4625 <p><strong class="selflink">0</strong>
4626 </p>
4627 !!end
4628
4629 !!test
4630 Link to numeric-equivalent title
4631 !!options
4632 title=[[0]]
4633 !!input
4634 [[00]]
4635 !!result
4636 <p><a href="/wiki/00" title="00">00</a>
4637 </p>
4638 !!end
4639
4640 !! test
4641 <nowiki> inside a link
4642 !! input
4643 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4644 !! result
4645 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4646 </p>
4647 !! end
4648
4649 !! test
4650 Non-breaking spaces in title
4651 !! input
4652 [[&nbsp; Main &nbsp; Page &nbsp;]]
4653 !! result
4654 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4655 </p>
4656 !!end
4657
4658 !! test
4659 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4660 !! options
4661 language=ca
4662 !! input
4663 '''[[Main Page]]'''
4664 !! result
4665 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4666 </p>
4667 !! end
4668
4669 !! test
4670 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4671 !! options
4672 language=ca
4673 !! input
4674 ''[[Main Page]]''
4675 !! result
4676 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4677 </p>
4678 !! end
4679
4680 !! test
4681 Internal link with en linktrail: no apostrophes (bug 27473)
4682 !! options
4683 language=en
4684 !! input
4685 [[Something]]'nice
4686 !! result
4687 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4688 </p>
4689 !! end
4690
4691 !! test
4692 Internal link with ca linktrail with apostrophes (bug 27473)
4693 !! options
4694 language=ca
4695 !! input
4696 [[Something]]'nice
4697 !! result
4698 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4699 </p>
4700 !! end
4701
4702 !! test
4703 Internal link with kaa linktrail with apostrophes (bug 27473)
4704 !! options
4705 language=kaa
4706 !! input
4707 [[Something]]'nice
4708 !! result
4709 <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>
4710 </p>
4711 !! end
4712
4713 !! article
4714 Söfnuður
4715 !! text
4716 Test.
4717 !! endarticle
4718
4719 !! test
4720 Internal link with is link prefix
4721 !! options
4722 language=is
4723 !! input
4724 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
4725 !! result
4726 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
4727 </p>
4728 !! end
4729
4730 !! article
4731 Mótmælendatrú
4732 !! text
4733 Test.
4734 !! endarticle
4735
4736 !! test
4737 Internal link with is link trail and link prefix
4738 !! options
4739 language=is
4740 !! input
4741 [[mótmælendatrú|xxx]]ar
4742 [[mótmælendatrú]]ar
4743 mótmælenda[[söfnuður]]
4744 mótmælenda[[söfnuður|söfnuðir]]
4745 mótmælenda[[söfnuður|söfnuðir]]xxx
4746 !! result
4747 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
4748 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
4749 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
4750 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
4751 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
4752 </p>
4753 !! end
4754
4755 !! test
4756 Parsoid link trail escaping
4757 !! options
4758 parsoid=html2wt,html2html
4759 !! input
4760 [[apple]]<nowiki/>s
4761 !! result
4762 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
4763 !! end
4764
4765 !! test
4766 Parsoid link prefix escaping
4767 !! options
4768 language=is
4769 parsoid=html2wt,html2html
4770 !! input
4771 Aðrir mótmælenda<nowiki/>[[söfnuður]]
4772 !! result
4773 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
4774 !! end
4775
4776 !! test
4777 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4778 !! input
4779 [[Foo| bar]]
4780
4781 [[Foo| ''bar'']]
4782
4783 [http://wp.org foo]
4784
4785 [http://wp.org ''foo'']
4786 !! result
4787 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
4788 </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>
4789 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4790 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4791 </p>
4792 !! end
4793
4794 ###
4795 ### Interwiki links (see maintenance/interwiki.sql)
4796 ###
4797
4798 !! test
4799 Inline interwiki link
4800 !! input
4801 [[MeatBall:SoftSecurity]]
4802 !! result
4803 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4804 </p>
4805 !! end
4806
4807 !! test
4808 Inline interwiki link with empty title (bug 2372)
4809 !! input
4810 [[MeatBall:]]
4811 !! result
4812 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4813 </p>
4814 !! end
4815
4816 !! test
4817 Interwiki link encoding conversion (bug 1636)
4818 !! input
4819 *[[Wikipedia:ro:Olteni&#0355;a]]
4820 *[[Wikipedia:ro:Olteni&#355;a]]
4821 !! result
4822 <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>
4823 </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>
4824 </li></ul>
4825
4826 !! end
4827
4828 !! test
4829 Interwiki link with fragment (bug 2130)
4830 !! input
4831 [[MeatBall:SoftSecurity#foo]]
4832 !! result
4833 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4834 </p>
4835 !! end
4836
4837 !! test
4838 Interlanguage link
4839 !! input
4840 Blah blah blah
4841 [[zh:Chinese]]
4842 !!result
4843 <p>Blah blah blah
4844 </p>
4845 !! end
4846
4847 !! test
4848 Double interlanguage link
4849 !! input
4850 Blah blah blah
4851 [[es:Spanish]]
4852 [[zh:Chinese]]
4853 !!result
4854 <p>Blah blah blah
4855 </p>
4856 !! end
4857
4858 !! test
4859 Interlanguage link, with prefix links
4860 !! options
4861 language=ln
4862 !! input
4863 Blah blah blah
4864 [[zh:Chinese]]
4865 !!result
4866 <p>Blah blah blah
4867 </p>
4868 !! end
4869
4870 !! test
4871 Double interlanguage link, with prefix links (bug 8897)
4872 !! options
4873 language=ln
4874 !! input
4875 Blah blah blah
4876 [[es:Spanish]]
4877 [[zh:Chinese]]
4878 !!result
4879 <p>Blah blah blah
4880 </p>
4881 !! end
4882
4883 !! test
4884 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4885 !! options
4886 language=ln
4887 !! input
4888 [[WW&nbsp;II]]
4889 !!result
4890 <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>
4891 </p>
4892 !! end
4893
4894 !! test
4895 Parsoid: handle constructor well
4896 !! options
4897 parsoid
4898 !! input
4899 [[constructor]]
4900
4901 [[constructor:foo]]
4902 !! result
4903 <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>
4904
4905
4906 <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>
4907 !! end
4908
4909 ##
4910 ## Redirects, Parsoid-only
4911 ##
4912 !! test
4913 Simple redirect to page
4914 !! options
4915 parsoid
4916 !! input
4917 #REDIRECT [[Main Page]]
4918 !! result
4919 <link rel="mw:PageProp/redirect" href="./Main_Page">
4920 !! end
4921
4922 !! test
4923 Redirect to category
4924 !! options
4925 parsoid=wt2html
4926 !! input
4927 #REDIRECT [[Category:Foo]]
4928 !! result
4929 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
4930 !! end
4931
4932 !! test
4933 Redirect to category page
4934 !! options
4935 parsoid=wt2html,html2html
4936 !! input
4937 #REDIRECT [[:Category:Foo]]
4938 !! result
4939 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
4940 !! end
4941
4942 !! test
4943 Redirect to image page
4944 !! options
4945 parsoid
4946 !! input
4947 #REDIRECT [[File:Wiki.png]]
4948 !! result
4949 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
4950 !! end
4951
4952 !! test
4953 Redirect to language
4954 !! options
4955 parsoid
4956 !! input
4957 #REDIRECT [[en:File:Wiki.png]]
4958 !! result
4959 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
4960 !! end
4961
4962 !! test
4963 Redirect to interwiki
4964 !! options
4965 parsoid
4966 !! input
4967 #REDIRECT [[meatball:File:Wiki.png]]
4968 !! result
4969 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
4970 !! end
4971
4972 ##
4973 ## XHTML tidiness
4974 ###
4975
4976 !! test
4977 <br> to <br />
4978 !! input
4979 1<br>2<br />3
4980 !! result
4981 <p>1<br />2<br />3
4982 </p>
4983 !! end
4984
4985 !! test
4986 Broken br tag sanitization
4987 !! options
4988 php
4989 !! input
4990 </br>
4991 !! result
4992 <p>&lt;/br&gt;
4993 </p>
4994 !! end
4995
4996 # TODO: Fix html2html mode (bug 51055)!
4997 !! test
4998 Parsoid: Broken br tag recognition
4999 !! options
5000 parsoid=wt2html
5001 !! input
5002 </br>
5003 !! result
5004 <p><br></p>
5005 !! end
5006
5007 !! test
5008 Incorrecly removing closing slashes from correctly formed XHTML
5009 !! input
5010 <br style="clear:both;" />
5011 !! result
5012 <p><br style="clear:both;" />
5013 </p>
5014 !! end
5015
5016 !! test
5017 Failing to transform badly formed HTML into correct XHTML
5018 !! input
5019 <br style="clear: left;">
5020 <br style="clear: right;">
5021 <br style="clear: both;">
5022 !! result
5023 <p><br style="clear: left;" />
5024 <br style="clear: right;" />
5025 <br style="clear: both;" />
5026 </p>
5027 !!end
5028
5029 !! test
5030 Handling html with a div self-closing tag
5031 !! input
5032 <div title />
5033 <div title/>
5034 <div title/ >
5035 <div title=bar />
5036 <div title=bar/>
5037 <div title=bar/ >
5038 !! result
5039 <p>&lt;div title /&gt;
5040 &lt;div title/&gt;
5041 </p>
5042 <div>
5043 <p>&lt;div title=bar /&gt;
5044 &lt;div title=bar/&gt;
5045 </p>
5046 <div title="bar/"></div>
5047 </div>
5048
5049 !! end
5050
5051 !! test
5052 Handling html with a br self-closing tag
5053 !! input
5054 <br title />
5055 <br title/>
5056 <br title/ >
5057 <br title=bar />
5058 <br title=bar/>
5059 <br title=bar/ >
5060 !! result
5061 <p><br title="title" />
5062 <br title="title" />
5063 <br />
5064 <br title="bar" />
5065 <br title="bar" />
5066 <br title="bar/" />
5067 </p>
5068 !! end
5069
5070 !! test
5071 Horizontal ruler (should it add that extra space?)
5072 !! input
5073 <hr>
5074 <hr >
5075 foo <hr
5076 > bar
5077 !! result
5078 <hr />
5079 <hr />
5080 foo <hr /> bar
5081
5082 !! end
5083
5084 !! test
5085 Horizontal ruler -- 4+ dashes render hr
5086 !! input
5087 ----
5088 !! result
5089 <hr />
5090
5091 !! end
5092
5093 !! test
5094 Horizontal ruler -- eats additional dashes on the same line
5095 !! input
5096 ---------
5097 !! result
5098 <hr />
5099
5100 !! end
5101
5102 !! test
5103 Horizontal ruler -- does not collapse dashes on consecutive lines
5104 !! input
5105 ----
5106 ----
5107 !! result
5108 <hr />
5109 <hr />
5110
5111 !! end
5112
5113 !! test
5114 Horizontal ruler -- <4 dashes render as plain text
5115 !! input
5116 ---
5117 !! result
5118 <p>---
5119 </p>
5120 !! end
5121
5122 !! test
5123 Horizontal ruler -- Supports content following dashes on same line
5124 !! input
5125 ---- Foo
5126 !! result
5127 <hr /> Foo
5128
5129 !! end
5130
5131 ###
5132 ### Block-level elements
5133 ###
5134 !! test
5135 Common list
5136 !! input
5137 *Common list
5138 * item 2
5139 *item 3
5140 !! result
5141 <ul><li>Common list
5142 </li><li> item 2
5143 </li><li>item 3
5144 </li></ul>
5145
5146 !! end
5147
5148 !! test
5149 Numbered list
5150 !! input
5151 #Numbered list
5152 #item 2
5153 # item 3
5154 !! result
5155 <ol><li>Numbered list
5156 </li><li>item 2
5157 </li><li> item 3
5158 </li></ol>
5159
5160 !! end
5161
5162 !! test
5163 Mixed list
5164 !! input
5165 *Mixed list
5166 *# with numbers
5167 ** and bullets
5168 *# and numbers
5169 *bullets again
5170 **bullet level 2
5171 ***bullet level 3
5172 ***#Number on level 4
5173 **bullet level 2
5174 **#Number on level 3
5175 **#Number on level 3
5176 *#number level 2
5177 *Level 1
5178 *** Level 3
5179 #** Level 3, but ordered
5180 !! result
5181 <ul><li>Mixed list
5182 <ol><li> with numbers
5183 </li></ol>
5184 <ul><li> and bullets
5185 </li></ul>
5186 <ol><li> and numbers
5187 </li></ol>
5188 </li><li>bullets again
5189 <ul><li>bullet level 2
5190 <ul><li>bullet level 3
5191 <ol><li>Number on level 4
5192 </li></ol>
5193 </li></ul>
5194 </li><li>bullet level 2
5195 <ol><li>Number on level 3
5196 </li><li>Number on level 3
5197 </li></ol>
5198 </li></ul>
5199 <ol><li>number level 2
5200 </li></ol>
5201 </li><li>Level 1
5202 <ul><li><ul><li> Level 3
5203 </li></ul>
5204 </li></ul>
5205 </li></ul>
5206 <ol><li><ul><li><ul><li> Level 3, but ordered
5207 </li></ul>
5208 </li></ul>
5209 </li></ol>
5210
5211 !! end
5212
5213 !! test
5214 Nested lists 1
5215 !! input
5216 *foo
5217 **bar
5218 !! result
5219 <ul><li>foo
5220 <ul><li>bar
5221 </li></ul>
5222 </li></ul>
5223
5224 !! end
5225
5226 !! test
5227 Nested lists 2
5228 !! input
5229 **foo
5230 *bar
5231 !! result
5232 <ul><li><ul><li>foo
5233 </li></ul>
5234 </li><li>bar
5235 </li></ul>
5236
5237 !! end
5238
5239 !! test
5240 Nested lists 3 (first element empty)
5241 !! input
5242 *
5243 **bar
5244 !! result
5245 <ul><li>
5246 <ul><li>bar
5247 </li></ul>
5248 </li></ul>
5249
5250 !! end
5251
5252 !! test
5253 Nested lists 4 (first element empty)
5254 !! input
5255 **
5256 *bar
5257 !! result
5258 <ul><li><ul><li>
5259 </li></ul>
5260 </li><li>bar
5261 </li></ul>
5262
5263 !! end
5264
5265 !! test
5266 Nested lists 5 (both elements empty)
5267 !! input
5268 **
5269 *
5270 !! result
5271 <ul><li><ul><li>
5272 </li></ul>
5273 </li><li>
5274 </li></ul>
5275
5276 !! end
5277
5278 !! test
5279 Nested lists 6 (both elements empty)
5280 !! input
5281 *
5282 **
5283 !! result
5284 <ul><li>
5285 <ul><li>
5286 </li></ul>
5287 </li></ul>
5288
5289 !! end
5290
5291 !! test
5292 Nested lists 7 (skip initial nesting levels)
5293 !! input
5294 *** foo
5295 !! result
5296 <ul><li><ul><li><ul><li> foo
5297 </li></ul>
5298 </li></ul>
5299 </li></ul>
5300
5301 !! end
5302
5303 !! test
5304 Nested lists 8 (multiple nesting transitions)
5305 !! input
5306 * foo
5307 *** bar
5308 ** baz
5309 * boo
5310 !! result
5311 <ul><li> foo
5312 <ul><li><ul><li> bar
5313 </li></ul>
5314 </li><li> baz
5315 </li></ul>
5316 </li><li> boo
5317 </li></ul>
5318
5319 !! end
5320
5321 !! test
5322 1. Lists with start-of-line-transparent tokens before bullets: Comments
5323 !! input
5324 *foo
5325 *<!--cmt-->bar
5326 <!--cmt-->*baz
5327 !! result
5328 <ul><li>foo
5329 </li><li>bar
5330 </li><li>baz
5331 </li></ul>
5332
5333 !! end
5334
5335 !! test
5336 2. Lists with start-of-line-transparent tokens before bullets: Template close
5337 !! input
5338 *foo {{echo|bar
5339 }}*baz
5340 !! result
5341 <ul><li>foo bar
5342 </li><li>baz
5343 </li></ul>
5344
5345 !! end
5346
5347 !! test
5348 List items are not parsed correctly following a <pre> block (bug 785)
5349 !! input
5350 * <pre>foo</pre>
5351 * <pre>bar</pre>
5352 * zar
5353 !! result
5354 <ul><li> <pre>foo</pre>
5355 </li><li> <pre>bar</pre>
5356 </li><li> zar
5357 </li></ul>
5358
5359 !! end
5360
5361 !! test
5362 List items from template
5363 !! input
5364
5365 {{inner list}}
5366 * item 2
5367
5368 * item 0
5369 {{inner list}}
5370 * item 2
5371
5372 * item 0
5373 * notSOL{{inner list}}
5374 * item 2
5375 !! result
5376 <ul><li> item 1
5377 </li><li> item 2
5378 </li></ul>
5379 <ul><li> item 0
5380 </li><li> item 1
5381 </li><li> item 2
5382 </li></ul>
5383 <ul><li> item 0
5384 </li><li> notSOL
5385 </li><li> item 1
5386 </li><li> item 2
5387 </li></ul>
5388
5389 !! end
5390
5391 !! test
5392 List interrupted by empty line or heading
5393 !! input
5394 * foo
5395
5396 ** bar
5397 == A heading ==
5398 * Another list item
5399 !! result
5400 <ul><li> foo
5401 </li></ul>
5402 <ul><li><ul><li> bar
5403 </li></ul>
5404 </li></ul>
5405 <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>
5406 <ul><li> Another list item
5407 </li></ul>
5408
5409 !!end
5410
5411 !!test
5412 Multiple list tags generated by templates
5413 !!input
5414 {{echo|<li>}}a
5415 {{echo|<li>}}b
5416 {{echo|<li>}}c
5417 !!result
5418 <li>a
5419 <li>b
5420 <li>c</li>
5421 </li>
5422 </li>
5423
5424 !!end
5425
5426 !!test
5427 Single-comment whitespace lines dont break lists, but multi-comment whitespace lines do
5428 !!input
5429 *a
5430 <!--This line will NOT split the list-->
5431 *b
5432 <!--This line will NOT split the list either-->
5433 *c
5434 <!--foo--> <!--This line with more than 1 comment will split the list-->
5435 *d
5436 !!result
5437 <ul><li>a
5438 </li><li>b
5439 </li><li>c
5440 </li></ul>
5441 <ul><li>d
5442 </li></ul>
5443
5444 !!end
5445
5446 !!test
5447 Test the li-hack
5448 (Cannot test this with PHP parser since it relies on Tidy for the hack)
5449 !!options
5450 parsoid=wt2html,wt2wt
5451 !!input
5452 * foo
5453 * <li>li-hack
5454 * {{echo|<li>templated li-hack}}
5455 * <!--foo--> <li> unsupported li-hack with preceding comments
5456
5457 <ul>
5458 <li><li>not a li-hack
5459 </li>
5460 </ul>
5461 !!result
5462 <ul><li> foo</li>
5463 <li>li-hack</li>
5464 <li about="#mwt1" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<li>templated li-hack"}}}'>templated li-hack</li>
5465 <li> <!--foo--> </li><li> li-hack with preceding comments</li></ul>
5466
5467 <ul>
5468 <li></li><li>not a li-hack
5469 </li>
5470 </ul>
5471 !!end
5472
5473 !! test
5474 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
5475 !! options
5476 parsoid
5477 !! input
5478 # foo
5479 ## bar
5480 * foo
5481 ** bar
5482 : foo
5483 :: bar
5484 !! result
5485 <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>
5486 !! end
5487
5488 # ------------------------------------------------------------------------
5489 # The next set of tests are about Parsoid's ability to handle badly nested
5490 # tags (parse, minimize scope of fixup, and roundtrip back)
5491 # ------------------------------------------------------------------------
5492
5493 !! test
5494 Unbalanced closing block tags break a list
5495 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5496 !! options
5497 parsoid
5498 !! input
5499 <div>
5500 *a</div><div>
5501 *b</div>
5502 !! result
5503 <div>
5504 <ul><li>a
5505 </li></ul></div><div>
5506 <ul><li>b
5507 </li></ul></div>
5508 !! end
5509
5510 !! test
5511 Unbalanced closing non-block tags don't break a list
5512 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5513 !! options
5514 parsoid
5515 !! input
5516 <span>
5517 *a</span><span>
5518 *b</span>
5519 !! result
5520 <p><span></span>
5521 </p>
5522 <ul><li>a<span></span>
5523 </li><li>b
5524 </li></ul>
5525 !! end
5526
5527 !! test
5528 Unclosed formatting tags that straddle lists are closed and reopened
5529 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5530 !! options
5531 parsoid
5532 !! input
5533 # <s> a
5534 # b </s>
5535 !! result
5536 <ol><li> <s> a </s>
5537 </li><li> <s> b </s>
5538 </li></ol>
5539 !! end
5540
5541 !!test
5542 List embedded in a non-block tag
5543 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
5544 !! options
5545 parsoid
5546 !!input
5547 <small>
5548 * foo
5549 </small>
5550 !!result
5551 <p><small></small></p>
5552 <small>
5553 <ul>
5554 <li> foo</li>
5555 </ul>
5556 </small>
5557 <p><small></small></p>
5558 !!end
5559
5560 ###
5561 ### Magic Words
5562 ###
5563
5564 !! test
5565 Magic Word: {{CURRENTDAY}}
5566 !! input
5567 {{CURRENTDAY}}
5568 !! result
5569 <p>1
5570 </p>
5571 !! end
5572
5573 !! test
5574 Magic Word: {{CURRENTDAY2}}
5575 !! input
5576 {{CURRENTDAY2}}
5577 !! result
5578 <p>01
5579 </p>
5580 !! end
5581
5582 !! test
5583 Magic Word: {{CURRENTDAYNAME}}
5584 !! input
5585 {{CURRENTDAYNAME}}
5586 !! result
5587 <p>Thursday
5588 </p>
5589 !! end
5590
5591 !! test
5592 Magic Word: {{CURRENTDOW}}
5593 !! input
5594 {{CURRENTDOW}}
5595 !! result
5596 <p>4
5597 </p>
5598 !! end
5599
5600 !! test
5601 Magic Word: {{CURRENTMONTH}}
5602 !! input
5603 {{CURRENTMONTH}}
5604 !! result
5605 <p>01
5606 </p>
5607 !! end
5608
5609 !! test
5610 Magic Word: {{CURRENTMONTHABBREV}}
5611 !! input
5612 {{CURRENTMONTHABBREV}}
5613 !! result
5614 <p>Jan
5615 </p>
5616 !! end
5617
5618 !! test
5619 Magic Word: {{CURRENTMONTHNAME}}
5620 !! input
5621 {{CURRENTMONTHNAME}}
5622 !! result
5623 <p>January
5624 </p>
5625 !! end
5626
5627 !! test
5628 Magic Word: {{CURRENTMONTHNAMEGEN}}
5629 !! input
5630 {{CURRENTMONTHNAMEGEN}}
5631 !! result
5632 <p>January
5633 </p>
5634 !! end
5635
5636 !! test
5637 Magic Word: {{CURRENTTIME}}
5638 !! input
5639 {{CURRENTTIME}}
5640 !! result
5641 <p>00:02
5642 </p>
5643 !! end
5644
5645 !! test
5646 Magic Word: {{CURRENTWEEK}} (@bug 4594)
5647 !! input
5648 {{CURRENTWEEK}}
5649 !! result
5650 <p>1
5651 </p>
5652 !! end
5653
5654 !! test
5655 Magic Word: {{CURRENTYEAR}}
5656 !! input
5657 {{CURRENTYEAR}}
5658 !! result
5659 <p>1970
5660 </p>
5661 !! end
5662
5663 !! test
5664 Magic Word: {{FULLPAGENAME}}
5665 !! options
5666 title=[[User:Ævar Arnfjörð Bjarmason]]
5667 !! input
5668 {{FULLPAGENAME}}
5669 !! result
5670 <p>User:Ævar Arnfjörð Bjarmason
5671 </p>
5672 !! end
5673
5674 !! test
5675 Magic Word: {{FULLPAGENAMEE}}
5676 !! options
5677 title=[[User:Ævar Arnfjörð Bjarmason]]
5678 !! input
5679 {{FULLPAGENAMEE}}
5680 !! result
5681 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5682 </p>
5683 !! end
5684
5685 !! test
5686 Magic Word: {{NAMESPACE}}
5687 !! options
5688 title=[[User:Ævar Arnfjörð Bjarmason]]
5689 !! input
5690 {{NAMESPACE}}
5691 !! result
5692 <p>User
5693 </p>
5694 !! end
5695
5696 !! test
5697 Magic Word: {{NAMESPACEE}}
5698 !! options
5699 title=[[User:Ævar Arnfjörð Bjarmason]]
5700 !! input
5701 {{NAMESPACEE}}
5702 !! result
5703 <p>User
5704 </p>
5705 !! end
5706
5707 !! test
5708 Magic Word: {{NAMESPACENUMBER}}
5709 !! options
5710 title=[[User:Ævar Arnfjörð Bjarmason]]
5711 !! input
5712 {{NAMESPACENUMBER}}
5713 !! result
5714 <p>2
5715 </p>
5716 !! end
5717
5718 !! test
5719 Magic Word: {{NUMBEROFFILES}}
5720 !! input
5721 {{NUMBEROFFILES}}
5722 !! result
5723 <p>4
5724 </p>
5725 !! end
5726
5727 !! test
5728 Magic Word: {{PAGENAME}}
5729 !! options
5730 title=[[User:Ævar Arnfjörð Bjarmason]]
5731 !! input
5732 {{PAGENAME}}
5733 !! result
5734 <p>Ævar Arnfjörð Bjarmason
5735 </p>
5736 !! end
5737
5738 !! test
5739 Magic Word: {{PAGENAME}} with metacharacters
5740 !! options
5741 title=[['foo & bar = baz']]
5742 !! input
5743 ''{{PAGENAME}}''
5744 !! result
5745 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
5746 </p>
5747 !! end
5748
5749 !! test
5750 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
5751 !! options
5752 title=[[*RFC 1234 http://example.com/]]
5753 !! input
5754 {{PAGENAME}}
5755 !! result
5756 <p>&#42;RFC&#32;1234 http&#58;//example.com/
5757 </p>
5758 !! end
5759
5760 !! test
5761 Magic Word: {{PAGENAMEE}}
5762 !! options
5763 title=[[User:Ævar Arnfjörð Bjarmason]]
5764 !! input
5765 {{PAGENAMEE}}
5766 !! result
5767 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5768 </p>
5769 !! end
5770
5771 !! test
5772 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
5773 !! options
5774 title=[[*RFC 1234 http://example.com/]]
5775 !! input
5776 {{PAGENAMEE}}
5777 !! result
5778 <p>&#42;RFC_1234_http&#58;//example.com/
5779 </p>
5780 !! end
5781
5782 !! test
5783 Magic Word: {{REVISIONID}}
5784 !! input
5785 {{REVISIONID}}
5786 !! result
5787 <p>1337
5788 </p>
5789 !! end
5790
5791 !! test
5792 Magic Word: {{SCRIPTPATH}}
5793 !! input
5794 {{SCRIPTPATH}}
5795 !! result
5796 <p>/
5797 </p>
5798 !! end
5799
5800 !! test
5801 Magic Word: {{SERVER}}
5802 !! input
5803 {{SERVER}}
5804 !! result
5805 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5806 </p>
5807 !! end
5808
5809 !! test
5810 Magic Word: {{SERVERNAME}}
5811 !! input
5812 {{SERVERNAME}}
5813 !! result
5814 <p>example.org
5815 </p>
5816 !! end
5817
5818 !! test
5819 Magic Word: {{SITENAME}}
5820 !! input
5821 {{SITENAME}}
5822 !! result
5823 <p>MediaWiki
5824 </p>
5825 !! end
5826
5827 !! test
5828 Case-sensitive magic words, when cased differently, should just be template transclusions
5829 !! input
5830 {{CurrentMonth}}
5831 {{currentday}}
5832 {{cURreNTweEK}}
5833 {{currentHour}}
5834 !! result
5835 <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>
5836 <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>
5837 <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>
5838 <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>
5839 </p>
5840 !! end
5841
5842 !! test
5843 Case-insensitive magic words should still work with weird casing.
5844 !! input
5845 {{sErVeRNaMe}}
5846 {{LCFirst:AOEU}}
5847 {{ucFIRST:aoeu}}
5848 {{SERver}}
5849 !! result
5850 <p>example.org
5851 aOEU
5852 Aoeu
5853 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5854 </p>
5855 !! end
5856
5857 !! test
5858 Namespace 1 {{ns:1}}
5859 !! input
5860 {{ns:1}}
5861 !! result
5862 <p>Talk
5863 </p>
5864 !! end
5865
5866 !! test
5867 Namespace 1 {{ns:01}}
5868 !! input
5869 {{ns:01}}
5870 !! result
5871 <p>Talk
5872 </p>
5873 !! end
5874
5875 !! test
5876 Namespace 0 {{ns:0}} (bug 4783)
5877 !! input
5878 {{ns:0}}
5879 !! result
5880
5881 !! end
5882
5883 !! test
5884 Namespace 0 {{ns:00}} (bug 4783)
5885 !! input
5886 {{ns:00}}
5887 !! result
5888
5889 !! end
5890
5891 !! test
5892 Namespace -1 {{ns:-1}}
5893 !! input
5894 {{ns:-1}}
5895 !! result
5896 <p>Special
5897 </p>
5898 !! end
5899
5900 !! test
5901 Namespace User {{ns:User}}
5902 !! input
5903 {{ns:User}}
5904 !! result
5905 <p>User
5906 </p>
5907 !! end
5908
5909 !! test
5910 Namespace User talk {{ns:User_talk}}
5911 !! input
5912 {{ns:User_talk}}
5913 !! result
5914 <p>User talk
5915 </p>
5916 !! end
5917
5918 !! test
5919 Namespace User talk {{ns:uSeR tAlK}}
5920 !! input
5921 {{ns:uSeR tAlK}}
5922 !! result
5923 <p>User talk
5924 </p>
5925 !! end
5926
5927 !! test
5928 Namespace File {{ns:File}}
5929 !! input
5930 {{ns:File}}
5931 !! result
5932 <p>File
5933 </p>
5934 !! end
5935
5936 !! test
5937 Namespace File {{ns:Image}}
5938 !! input
5939 {{ns:Image}}
5940 !! result
5941 <p>File
5942 </p>
5943 !! end
5944
5945 !! test
5946 Namespace (lang=de) Benutzer {{ns:User}}
5947 !! options
5948 language=de
5949 !! input
5950 {{ns:User}}
5951 !! result
5952 <p>Benutzer
5953 </p>
5954 !! end
5955
5956 !! test
5957 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
5958 !! options
5959 language=de
5960 !! input
5961 {{ns:3}}
5962 !! result
5963 <p>Benutzer Diskussion
5964 </p>
5965 !! end
5966
5967
5968 !! test
5969 Urlencode
5970 !! input
5971 {{urlencode:hi world?!}}
5972 {{urlencode:hi world?!|WIKI}}
5973 {{urlencode:hi world?!|PATH}}
5974 {{urlencode:hi world?!|QUERY}}
5975 !! result
5976 <p>hi+world%3F%21
5977 hi_world%3F!
5978 hi%20world%3F%21
5979 hi+world%3F%21
5980 </p>
5981 !! end
5982
5983 ###
5984 ### Magic links
5985 ###
5986 !! test
5987 Magic links: internal link to RFC (bug 479)
5988 !! input
5989 [[RFC 123]]
5990 !! result
5991 <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>
5992 </p>
5993 !! end
5994
5995 !! test
5996 Magic links: RFC (bug 479)
5997 !! input
5998 RFC 822
5999 !! result
6000 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
6001 </p>
6002 !! end
6003
6004 !! test
6005 Magic links: ISBN (bug 1937)
6006 !! input
6007 ISBN 0-306-40615-2
6008 !! result
6009 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
6010 </p>
6011 !! end
6012
6013 !! test
6014 Magic links: PMID incorrectly converts space to underscore
6015 !! input
6016 PMID 1234
6017 !! result
6018 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
6019 </p>
6020 !! end
6021
6022 ###
6023 ### Templates
6024 ####
6025
6026 !! test
6027 Nonexistent template
6028 !! input
6029 {{thistemplatedoesnotexist}}
6030 !! result
6031 <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>
6032 </p>
6033 !! end
6034
6035 !! test
6036 Template with invalid target containing tags
6037 !! input
6038 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
6039 !! result
6040 <p>{{a<b>b</b>|foo|a=b|a = b}}
6041 </p>
6042 !! end
6043
6044 !! test
6045 Template with invalid target containing unclosed tag
6046 !! input
6047 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
6048 !! result
6049 <p>{{a<b>|foo|a=b|a = b}}</b>
6050 </p>
6051 !! end
6052
6053 !! article
6054 Template:test
6055 !! text
6056 This is a test template
6057 !! endarticle
6058
6059 !! test
6060 Simple template
6061 !! input
6062 {{test}}
6063 !! result
6064 <p>This is a test template
6065 </p>
6066 !! end
6067
6068 !! test
6069 Template with explicit namespace
6070 !! input
6071 {{Template:test}}
6072 !! result
6073 <p>This is a test template
6074 </p>
6075 !! end
6076
6077
6078 !! article
6079 Template:paramtest
6080 !! text
6081 This is a test template with parameter {{{param}}}
6082 !! endarticle
6083
6084 !! test
6085 Template parameter
6086 !! input
6087 {{paramtest|param=foo}}
6088 !! result
6089 <p>This is a test template with parameter foo
6090 </p>
6091 !! end
6092
6093 !! article
6094 Template:paramtestnum
6095 !! text
6096 [[{{{1}}}|{{{2}}}]]
6097 !! endarticle
6098
6099 !! test
6100 Template unnamed parameter
6101 !! input
6102 {{paramtestnum|Main Page|the main page}}
6103 !! result
6104 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
6105 </p>
6106 !! end
6107
6108 !! article
6109 Template:templatesimple
6110 !! text
6111 (test)
6112 !! endarticle
6113
6114 !! article
6115 Template:templateredirect
6116 !! text
6117 #redirect [[Template:templatesimple]]
6118 !! endarticle
6119
6120 !! article
6121 Template:templateasargtestnum
6122 !! text
6123 {{{{{1}}}}}
6124 !! endarticle
6125
6126 !! article
6127 Template:templateasargtest
6128 !! text
6129 {{template{{{templ}}}}}
6130 !! endarticle
6131
6132 !! article
6133 Template:templateasargtest2
6134 !! text
6135 {{{{{templ}}}}}
6136 !! endarticle
6137
6138 !! test
6139 Template with template name as unnamed argument
6140 !! input
6141 {{templateasargtestnum|templatesimple}}
6142 !! result
6143 <p>(test)
6144 </p>
6145 !! end
6146
6147 !! test
6148 Template with template name as argument
6149 !! input
6150 {{templateasargtest|templ=simple}}
6151 !! result
6152 <p>(test)
6153 </p>
6154 !! end
6155
6156 !! test
6157 Template with template name as argument (2)
6158 !! input
6159 {{templateasargtest2|templ=templatesimple}}
6160 !! result
6161 <p>(test)
6162 </p>
6163 !! end
6164
6165 !! article
6166 Template:templateasargtestdefault
6167 !! text
6168 {{{{{templ|templatesimple}}}}}
6169 !! endarticle
6170
6171 !! article
6172 Template:templa
6173 !! text
6174 '''templ'''
6175 !! endarticle
6176
6177 !! test
6178 Template with default value
6179 !! input
6180 {{templateasargtestdefault}}
6181 !! result
6182 <p>(test)
6183 </p>
6184 !! end
6185
6186 !! test
6187 Template with default value (value set)
6188 !! input
6189 {{templateasargtestdefault|templ=templa}}
6190 !! result
6191 <p><b>templ</b>
6192 </p>
6193 !! end
6194
6195 !! test
6196 Template redirect
6197 !! input
6198 {{templateredirect}}
6199 !! result
6200 <p>(test)
6201 </p>
6202 !! end
6203
6204 !! test
6205 Template with argument in separate line
6206 !! input
6207 {{ templateasargtest |
6208 templ = simple }}
6209 !! result
6210 <p>(test)
6211 </p>
6212 !! end
6213
6214 !! test
6215 Template with complex template as argument
6216 !! input
6217 {{paramtest|
6218 param ={{ templateasargtest |
6219 templ = simple }}}}
6220 !! result
6221 <p>This is a test template with parameter (test)
6222 </p>
6223 !! end
6224
6225 !! test
6226 Template with thumb image (with link in description)
6227 !! input
6228 {{paramtest|
6229 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
6230 !! result
6231 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>
6232
6233 !! end
6234
6235 !! article
6236 Template:complextemplate
6237 !! text
6238 {{{1}}} {{paramtest|
6239 param ={{{param}}}}}
6240 !! endarticle
6241
6242 !! test
6243 Template with complex arguments
6244 !! input
6245 {{complextemplate|
6246 param ={{ templateasargtest |
6247 templ = simple }}|[[Template:complextemplate|link]]}}
6248 !! result
6249 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
6250 </p>
6251 !! end
6252
6253 !! test
6254 BUG 553: link with two variables in a piped link
6255 !! input
6256 {|
6257 |[[{{{1}}}|{{{2}}}]]
6258 |}
6259 !! result
6260 <table>
6261 <tr>
6262 <td>[[{{{1}}}|{{{2}}}]]
6263 </td></tr></table>
6264
6265 !! end
6266
6267 !! test
6268 Magic variable as template parameter
6269 !! input
6270 {{paramtest|param={{SITENAME}}}}
6271 !! result
6272 <p>This is a test template with parameter MediaWiki
6273 </p>
6274 !! end
6275
6276 !! article
6277 Template:linktest
6278 !! text
6279 [[{{{param}}}|link]]
6280 !! endarticle
6281
6282 !! test
6283 Template parameter as link source
6284 !! input
6285 {{linktest|param=Main Page}}
6286 !! result
6287 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
6288 </p>
6289 !! end
6290
6291 !!test
6292 Template-generated attribute string (k='v')
6293 !!input
6294 <span {{attr_str|id|v1}}>bar</span>
6295 !!result
6296 <p><span id="v1">bar</span>
6297 </p>
6298 !!end
6299
6300 !!article
6301 Template:paramtest2
6302 !! text
6303 including another template, {{paramtest|param={{{arg}}}}}
6304 !! endarticle
6305
6306 !! test
6307 Template passing argument to another template
6308 !! input
6309 {{paramtest2|arg='hmm'}}
6310 !! result
6311 <p>including another template, This is a test template with parameter 'hmm'
6312 </p>
6313 !! end
6314
6315 !! article
6316 Template:Linktest2
6317 !! text
6318 Main Page
6319 !! endarticle
6320
6321 !! test
6322 Template as link source
6323 !! input
6324 [[{{linktest2}}]]
6325
6326 [[{{linktest2}}|Main Page]]
6327
6328 [[{{linktest2}}]]Page
6329 !! result
6330 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6331 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6332 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
6333 </p>
6334 !! end
6335
6336
6337 !! article
6338 Template:loop1
6339 !! text
6340 {{loop2}}
6341 !! endarticle
6342
6343 !! article
6344 Template:loop2
6345 !! text
6346 {{loop1}}
6347 !! endarticle
6348
6349 !! test
6350 Template infinite loop
6351 !! input
6352 {{loop1}}
6353 !! result
6354 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
6355 </p>
6356 !! end
6357
6358 !! test
6359 Template from main namespace
6360 !! input
6361 {{:Main Page}}
6362 !! result
6363 <p>blah blah
6364 </p>
6365 !! end
6366
6367 !! article
6368 Template:table
6369 !! text
6370 {|
6371 | 1 || 2
6372 |-
6373 | 3 || 4
6374 |}
6375 !! endarticle
6376
6377 !! test
6378 BUG 529: Template with table, not included at beginning of line
6379 !! input
6380 foo {{table}}
6381 !! result
6382 <p>foo
6383 </p>
6384 <table>
6385 <tr>
6386 <td> 1 </td>
6387 <td> 2
6388 </td></tr>
6389 <tr>
6390 <td> 3 </td>
6391 <td> 4
6392 </td></tr></table>
6393
6394 !! end
6395
6396 !! test
6397 BUG 523: Template shouldn't eat newline (or add an extra one before table)
6398 !! input
6399 foo
6400 {{table}}
6401 !! result
6402 <p>foo
6403 </p>
6404 <table>
6405 <tr>
6406 <td> 1 </td>
6407 <td> 2
6408 </td></tr>
6409 <tr>
6410 <td> 3 </td>
6411 <td> 4
6412 </td></tr></table>
6413
6414 !! end
6415
6416 !! test
6417 BUG 41: Template parameters shown as broken links
6418 !! input
6419 {{{parameter}}}
6420 !! result
6421 <p>{{{parameter}}}
6422 </p>
6423 !! end
6424
6425 !! test
6426 Template with targets containing wikilinks
6427 !! input
6428 {{[[foo]]}}
6429
6430 {{[[{{echo|foo}}]]}}
6431
6432 {{{{echo|[[foo}}]]}}
6433 !! result
6434 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6435 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6436 </p><p>{{[[foo}}]]
6437 </p>
6438 !! end
6439
6440 !! article
6441 Template:MSGNW test
6442 !! text
6443 ''None'' of '''this''' should be
6444 * interpreted
6445 but rather passed unmodified
6446 {{test}}
6447 !! endarticle
6448
6449 # hmm, fix this or just deprecate msgnw and document its behavior?
6450 !! test
6451 msgnw keyword
6452 !! options
6453 disabled
6454 !! input
6455 {{msgnw:MSGNW test}}
6456 !! result
6457 <p>''None'' of '''this''' should be
6458 * interpreted
6459 but rather passed unmodified
6460 {{test}}
6461 </p>
6462 !! end
6463
6464 !! test
6465 int keyword
6466 !! input
6467 {{int:youhavenewmessages|lots of money|not!}}
6468 !! result
6469 <p>You have lots of money (not!).
6470 </p>
6471 !! end
6472
6473 !! article
6474 Template:Includes
6475 !! text
6476 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6477 !! endarticle
6478
6479 !! test
6480 <includeonly> and <noinclude> being included
6481 !! input
6482 {{Includes}}
6483 !! result
6484 <p>Foobar
6485 </p>
6486 !! end
6487
6488 !! article
6489 Template:Includes2
6490 !! text
6491 <onlyinclude>Foo</onlyinclude>bar
6492 !! endarticle
6493
6494 !! test
6495 <onlyinclude> being included
6496 !! input
6497 {{Includes2}}
6498 !! result
6499 <p>Foo
6500 </p>
6501 !! end
6502
6503
6504 !! article
6505 Template:Includes3
6506 !! text
6507 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
6508 !! endarticle
6509
6510 !! test
6511 <onlyinclude> and <includeonly> being included
6512 !! input
6513 {{Includes3}}
6514 !! result
6515 <p>Foo
6516 </p>
6517 !! end
6518
6519 !! test
6520 <includeonly> and <noinclude> on a page
6521 !! input
6522 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6523 !! result
6524 <p>Foozar
6525 </p>
6526 !! end
6527
6528 !! test
6529 Un-closed <noinclude>
6530 !! input
6531 <noinclude>
6532 !! result
6533 !! end
6534
6535 !! test
6536 <onlyinclude> on a page
6537 !! input
6538 <onlyinclude>Foo</onlyinclude>bar
6539 !! result
6540 <p>Foobar
6541 </p>
6542 !! end
6543
6544 !! test
6545 Un-closed <onlyinclude>
6546 !! input
6547 <onlyinclude>
6548 !! result
6549 !! end
6550
6551 !!test
6552 Self-closed noinclude, includeonly, onlyinclude tags
6553 !!input
6554 <noinclude />
6555 <includeonly />
6556 <onlyinclude />
6557 !!result
6558 <p><br />
6559 </p>
6560 !!end
6561
6562 !!test
6563 Unbalanced includeonly and noinclude tags
6564 !!input
6565 {|
6566 |a</noinclude>
6567 |b</noinclude></noinclude>
6568 |c</noinclude></includeonly>
6569 |d</includeonly></includeonly>
6570 |}
6571 !!result
6572 <table>
6573 <tr>
6574 <td>a
6575 </td>
6576 <td>b
6577 </td>
6578 <td>c&lt;/includeonly&gt;
6579 </td>
6580 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
6581 </td></tr></table>
6582
6583 !!end
6584
6585 !! article
6586 Template:Includeonly section
6587 !! text
6588 <includeonly>
6589 ==Includeonly section==
6590 </includeonly>
6591 ==Section T-1==
6592 !!endarticle
6593
6594 !! test
6595 Bug 6563: Edit link generation for section shown by <includeonly>
6596 !! input
6597 {{includeonly section}}
6598 !! result
6599 <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>
6600 <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>
6601
6602 !! end
6603
6604 # Uses same input as the contents of [[Template:Includeonly section]]
6605 !! test
6606 Bug 6563: Section extraction for section shown by <includeonly>
6607 !! options
6608 section=T-2
6609 !! input
6610 <includeonly>
6611 ==Includeonly section==
6612 </includeonly>
6613 ==Section T-2==
6614 !! result
6615 ==Section T-2==
6616 !! end
6617
6618 !! test
6619 Bug 6563: Edit link generation for section suppressed by <includeonly>
6620 !! input
6621 <includeonly>
6622 ==Includeonly section==
6623 </includeonly>
6624 ==Section 1==
6625 !! result
6626 <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>
6627
6628 !! end
6629
6630 !! test
6631 Bug 6563: Section extraction for section suppressed by <includeonly>
6632 !! options
6633 section=1
6634 !! input
6635 <includeonly>
6636 ==Includeonly section==
6637 </includeonly>
6638 ==Section 1==
6639 !! result
6640 ==Section 1==
6641 !! end
6642
6643 !! test
6644 Un-closed <includeonly>
6645 !! input
6646 <includeonly>
6647 !! result
6648 !! end
6649
6650 # TODO: test with DOM fragment reuse!
6651 !! test
6652 Parsoid: DOM fragment reuse
6653 !! options
6654 parsoid=wt2wt,wt2html
6655 !! input
6656 a{{echo|b<table></table>c}}d
6657
6658 a{{echo|b
6659 <table></table>
6660 c}}d
6661
6662 {{echo|a
6663
6664 <table></table>
6665
6666 b}}
6667 !! result
6668 a<span typeof="mw:Transclusion">b</span>
6669 <table></table><span>c</span>d
6670 <p typeof="mw:Transclusion">ab</p>
6671 <table></table>
6672 <p>cd</p>
6673 <p typeof="mw:Transclusion">a</p>
6674 <table></table>
6675 <p>b</p>
6676 !! end
6677
6678 ###
6679 ### <includeonly> and <noinclude> in attributes
6680 ###
6681 !!test
6682 0. includeonly around the entire attribute
6683 !!input
6684 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
6685 !!result
6686 <p><span id="v2">bar</span>
6687 </p>
6688 !!end
6689
6690 !!test
6691 1. includeonly in html attr key
6692 !!input
6693 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
6694 !!result
6695 <p><span id="foo">bar</span>
6696 </p>
6697 !!end
6698
6699 !!test
6700 2. includeonly in html attr value
6701 !!input
6702 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
6703 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
6704 !!result
6705 <p><span id="v1">bar</span>
6706 <span id="v1">bar</span>
6707 </p>
6708 !!end
6709
6710 !!test
6711 3. includeonly in part of an attr value
6712 !!input
6713 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
6714 !!result
6715 <p><span style="color:red;">bar</span>
6716 </p>
6717 !!end
6718
6719 ###
6720 ### Testing parsing of templates where a template arg
6721 ### has the same name as the template itself.
6722 ###
6723
6724 !! article
6725 Template:quote
6726 !! text
6727 {{{quote|{{{1}}}}}}
6728 !! endarticle
6729
6730 !!test
6731 Templates: Template Name/Arg clash: 1. Use of positional param
6732 !!input
6733 {{quote|foo}}
6734 !!result
6735 <p>foo
6736 </p>
6737 !!end
6738
6739 !!test
6740 Templates: Template Name/Arg clash: 2. Use of named param
6741 !!input
6742 {{quote|quote=foo}}
6743 !!result
6744 <p>foo
6745 </p>
6746 !!end
6747
6748 !!test
6749 Templates: Template Name/Arg clash: 3. Use of named param with empty input
6750 !!input
6751 {{quote|quote}}
6752 !!result
6753 <p>quote
6754 </p>
6755 !!end
6756
6757 ###
6758 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
6759 ###
6760
6761 !!test
6762 Templates: 1. Simple use
6763 !!input
6764 {{echo|Foo}}
6765 !!result
6766 <p>Foo
6767 </p>
6768 !!end
6769
6770 !!test
6771 Templates: 2. Inside a block tag
6772 !!input
6773 <div>{{echo|Foo}}</div>
6774 !!result
6775 <div>Foo</div>
6776
6777 !!end
6778
6779 !!test
6780 Templates: P-wrapping: 1a. Templates on consecutive lines
6781 !!input
6782 {{echo|Foo}}
6783 {{echo|bar}}
6784 !!result
6785 <p>Foo
6786 bar
6787 </p>
6788 !!end
6789
6790 !!test
6791 Templates: P-wrapping: 1b. Templates on consecutive lines
6792 !!input
6793 Foo
6794
6795 {{echo|bar}}
6796 {{echo|baz}}
6797 !!result
6798 <p>Foo
6799 </p><p>bar
6800 baz
6801 </p>
6802 !!end
6803
6804 !!test
6805 Templates: P-wrapping: 1c. Templates on consecutive lines
6806 !!input
6807 {{echo|Foo}}
6808 {{echo|bar}} <div>baz</div>
6809 !!result
6810 <p>Foo
6811 </p>
6812 bar <div>baz</div>
6813
6814 !!end
6815
6816 !!test
6817 Templates: P-wrapping: 1d. Template preceded by comment-only line
6818 !!options
6819 parsoid=wt2html,wt2wt
6820 !!input
6821 <!-- foo -->
6822 {{echo|Bar}}
6823 !!result
6824 <!-- foo -->
6825 <p typeof="mw:Transclusion">Bar
6826 </p>
6827 !!end
6828
6829 !!test
6830 Templates: Inline Text: 1. Multiple tmeplate uses
6831 !!input
6832 {{echo|Foo}}bar{{echo|baz}}
6833 !!result
6834 <p>Foobarbaz
6835 </p>
6836 !!end
6837
6838 !!test
6839 Templates: Inline Text: 2. Back-to-back template uses
6840 !!input
6841 {{echo|Foo}}{{echo|bar}}
6842 !!result
6843 <p>Foobar
6844 </p>
6845 !!end
6846
6847 !!test
6848 Templates: Block Tags: 1. Multiple template uses
6849 !!input
6850 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
6851 !!result
6852 <div>Foo</div><div>bar</div><div>baz</div>
6853
6854 !!end
6855
6856 !!test
6857 Templates: Block Tags: 2. Back-to-back template uses
6858 !!input
6859 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
6860 !!result
6861 <div>Foo</div><div>bar</div>
6862
6863 !!end
6864
6865 !!test
6866 Templates: Links: 1. Simple example
6867 !!input
6868 {{echo|[[Foo|bar]]}}
6869 !!result
6870 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6871 </p>
6872 !!end
6873
6874 !!test
6875 Templates: Links: 2. Generation of link href
6876 !!input
6877 [[{{echo|Foo}}|bar]]
6878 !!result
6879 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6880 </p>
6881 !!end
6882
6883 !!test
6884 Templates: Links: 3. Generation of part of a link href
6885 !!input
6886 [[Fo{{echo|o}}|bar]]
6887
6888 [[Foo{{echo|bar}}]]
6889
6890 [[Foo{{echo|bar}}baz]]
6891
6892 [[Foo{{echo|bar}}|bar]]
6893
6894 [[:Foo{{echo|bar}}]]
6895
6896 [[:Foo{{echo|bar}}|bar]]
6897 !!result
6898 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6899 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6900 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
6901 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6902 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6903 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6904 </p>
6905 !!end
6906
6907 !!test
6908 Templates: Links: 4. Multiple templates generating link href
6909 !!input
6910 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
6911 !!result
6912 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6913 </p>
6914 !!end
6915
6916 !!test
6917 Templates: Links: 5. Generation of link text
6918 !!input
6919 [[Foo|{{echo|bar}}]]
6920 !!result
6921 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6922 </p>
6923 !!end
6924
6925 !!test
6926 Templates: Links: 5. Nested templates (only outermost template should be marked)
6927 !!input
6928 {{echo|[[{{echo|Foo}}|bar]]}}
6929 !!result
6930 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6931 </p>
6932 !!end
6933
6934 !!test
6935 Templates: HTML Tag: 1. Generation of HTML attr. key
6936 !!input
6937 <div {{echo|style}}="color:red;">foo</div>
6938 !!result
6939 <div style="color:red;">foo</div>
6940
6941 !!end
6942
6943 !!test
6944 Templates: HTML Tag: 2. Generation of HTML attr. value
6945 !!input
6946 <div style={{echo|'color:red;'}}>foo</div>
6947 !!result
6948 <div style="color:red;">foo</div>
6949
6950 !!end
6951
6952 !!test
6953 Templates: HTML Tag: 3. Generation of HTML attr key and value
6954 !!input
6955 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
6956 !!result
6957 <div style="color:red;">foo</div>
6958
6959 !!end
6960
6961 !!test
6962 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
6963 !!input
6964 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
6965 !!result
6966 <div title="This is a long title with just one piece templated">foo</div>
6967
6968 !!end
6969
6970 !!test
6971 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
6972 !!input
6973 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
6974 !!result
6975 <div title="This is a long title with just one piece templated">foo</div>
6976
6977 !!end
6978
6979 !!test
6980 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
6981 !!input
6982 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
6983 !!result
6984 <div title="This is a long title with just one piece templated">foo</div>
6985
6986 !!end
6987
6988 !!test
6989 Templates: HTML Tag: 7. Generation of partial attribute key string
6990 !!input
6991 <div st{{echo|yle}}="color:red;">foo</div>
6992 !!result
6993 <div style="color:red;">foo</div>
6994
6995 !!end
6996
6997 !!test
6998 Templates: HTML Tables: 1. Generating start of a HTML table
6999 !!input
7000 {{echo|<table><tr><td>foo</td>}}</tr></table>
7001 !!result
7002 <table><tr><td>foo</td></tr></table>
7003
7004 !!end
7005
7006 !!test
7007 Templates: HTML Tables: 2a. Generating middle of a HTML table
7008 !!input
7009 <table><tr>{{echo|<td>foo</td>}}</tr></table>
7010 !!result
7011 <table><tr><td>foo</td></tr></table>
7012
7013 !!end
7014
7015 !!test
7016 Templates: HTML Tables: 2b. Generating middle of a HTML table
7017 !!input
7018 <table>{{echo|<tr><td>foo</td></tr>}}</table>
7019 !!result
7020 <table><tr><td>foo</td></tr></table>
7021
7022 !!end
7023
7024 !!test
7025 Templates: HTML Tables: 3. Generating end of a HTML table
7026 !!input
7027 <table><tr>{{echo|<td>foo</td></tr></table>}}
7028 !!result
7029 <table><tr><td>foo</td></tr></table>
7030
7031 !!end
7032
7033 !!test
7034 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
7035 !!input
7036 {{echo|<table>}}<tr><td>foo</td></tr></table>
7037 !!result
7038 <table><tr><td>foo</td></tr></table>
7039
7040 !!end
7041
7042 !!test
7043 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
7044 !!input
7045 <table>{{echo|<tr>}}<td>foo</td></tr></table>
7046 !!result
7047 <table><tr><td>foo</td></tr></table>
7048
7049 !!end
7050
7051 !!test
7052 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
7053 !!input
7054 <table><tr>{{echo|<td>}}foo</td></tr></table>
7055 !!result
7056 <table><tr><td>foo</td></tr></table>
7057
7058 !!end
7059
7060 !!test
7061 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
7062 !!input
7063 <table><tr><td>foo{{echo|</td>}}</tr></table>
7064 !!result
7065 <table><tr><td>foo</td></tr></table>
7066
7067 !!end
7068
7069 !!test
7070 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
7071 !!input
7072 <table><tr><td>foo</td>{{echo|</tr>}}</table>
7073 !!result
7074 <table><tr><td>foo</td></tr></table>
7075
7076 !!end
7077
7078 !!test
7079 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
7080 !!input
7081 <table><tr><td>foo</td></tr>{{echo|</table>}}
7082 !!result
7083 <table><tr><td>foo</td></tr></table>
7084
7085 !!end
7086
7087 !!test
7088 Templates: HTML Tables: 5. Proper fostering of categories from inside
7089 !!options
7090 parsoid=wt2html,wt2wt
7091 !!input
7092 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
7093 <!--Two categories (Bug 50330)-->
7094 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
7095 !!result
7096 <link rel="mw:WikiLink/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
7097 <!--Two categories (Bug 50330)-->
7098 <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>
7099 !!end
7100
7101 !!test
7102 Templates: Wiki Tables: 1a. Fostering of entire template content
7103 !!input
7104 {|
7105 {{echo|a}}
7106 |}
7107 !!result
7108 <table>
7109 a
7110 <tr><td></td></tr></table>
7111
7112 !!end
7113
7114 !!test
7115 Templates: Wiki Tables: 1b. Fostering of entire template content
7116 !!input
7117 {|
7118 {{echo|<div>}}
7119 foo
7120 {{echo|</div>}}
7121 |}
7122 !!result
7123 <table>
7124 <div>
7125 <p>foo
7126 </p>
7127 </div>
7128 <tr><td></td></tr></table>
7129
7130 !!end
7131
7132 !!test
7133 Templates: Wiki Tables: 2. Fostering of partial template content
7134 !!input
7135 {|
7136 {{echo|a
7137 <div>b</div>}}
7138 |}
7139 !!result
7140 <table>
7141 a
7142 <div>b</div>
7143 <tr><td></td></tr></table>
7144
7145 !!end
7146
7147 !!test
7148 Templates: Wiki Tables: 3. td-content via multiple templates
7149 !!input
7150 {|
7151 {{echo|{{pipe}}a}}{{echo|b}}
7152 |}
7153 !!result
7154 <table>
7155 <tr>
7156 <td>ab
7157 </td></tr></table>
7158
7159 !!end
7160
7161 !!test
7162 Templates: Wiki Tables: 4. Templated tags, no content
7163 !!input
7164 {{tbl-start}}
7165 {{tbl-end}}
7166 !!result
7167 <table>
7168 <tr><td></td></tr></table>
7169
7170 !!end
7171
7172 !!test
7173 Templates: Wiki Tables: 5. Templated tags, regular td-tags
7174 !!input
7175 {{tbl-start}}
7176 |foo
7177 {{tbl-end}}
7178 !!result
7179 <table>
7180 <tr>
7181 <td>foo
7182 </td></tr></table>
7183
7184 !!end
7185
7186 !!test
7187 Templates: Wiki Tables: 6. Templated tags, templated td-tags
7188 !!input
7189 {{tbl-start}}
7190 {{!}}foo
7191 {{tbl-end}}
7192 !!result
7193 <table>
7194 <tr>
7195 <td>foo
7196 </td></tr></table>
7197
7198 !!end
7199
7200 !!test
7201 Templates: Lists: Multi-line list-items via templates
7202 !!input
7203 *{{echo|a {{nonexistent|
7204 unused}}}}
7205 *{{echo|b {{nonexistent|
7206 unused}}}}
7207 !!result
7208 <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>
7209 </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>
7210 </li></ul>
7211
7212 !!end
7213
7214 !!test
7215 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
7216 !!input
7217 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
7218 !!result
7219 <p><i>ab</i>c<i>d</i>e
7220 </p>
7221 !!end
7222
7223 !!test
7224 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
7225 (PHP parser generates misnested html)
7226 !! options
7227 parsoid=wt2html,wt2wt
7228 !!input
7229 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
7230 !!result
7231 <p><span typeof="mw:Transclusion"><i>a</i></span><i typeof="mw:Transclusion"><span>b</span></i><span>c</span><i>d</i><span>e</span></p>
7232 !!end
7233
7234 !!test
7235 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
7236 (PHP parser generates misnested html)
7237 !! options
7238 parsoid=wt2html,wt2wt
7239 !!input
7240 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
7241 !!result
7242 <div typeof="mw:Transclusion"><i>a</i></div>
7243 <div typeof="mw:Transclusion"><i>b</i>c<i>d</i></div>
7244 <div typeof="mw:Transclusion">e</div>
7245 !!end
7246
7247 !!test
7248 Templates: Ugly nesting: 4. Divs opened/closed across templates
7249 !!input
7250 a<div>b{{echo|c</div>d}}e
7251 !!result
7252 a<div>bc</div>de
7253
7254 !!end
7255
7256 !!test
7257 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
7258 (Parsoid-centric)
7259 !! options
7260 parsoid
7261 !!input
7262 {|
7263 |{{echo|foo</table>}}
7264 |bar
7265 |}
7266 !!result
7267 <table typeof="mw:Transclusion">
7268 <tbody>
7269 <tr>
7270 <td>foo</td></tr></tbody></table><span>bar</span>
7271 !!end
7272
7273 !!test
7274 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
7275 (Parsoid-centric)
7276 !! options
7277 parsoid
7278 !!input
7279 <table>
7280 <tr>
7281 <td>
7282 <table>
7283 <tr>
7284 <td>1. {{echo|foo </table>}}</td>
7285 <td> bar </td>
7286 <td>2. {{echo|baz </table>}}</td>
7287 </tr>
7288 <tr>
7289 <td>abc</td>
7290 </tr>
7291 </table>
7292 </td>
7293 </tr>
7294 <tr>
7295 <td>xyz</td>
7296 </tr>
7297 </table>
7298 !!result
7299 <table about="#mwt1" typeof="mw:Transclusion">
7300 <tbody><tr >
7301 <td >
7302 <table >
7303 <tbody><tr >
7304 <td >1. foo </td></tr></tbody></table></td>
7305 <td > bar </td>
7306 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
7307 </span><span about="#mwt1">
7308
7309 abc</span><span about="#mwt1">
7310 </span><span about="#mwt1">
7311 </span><span about="#mwt1">
7312 </span><span about="#mwt1">
7313 </span><span about="#mwt1">
7314
7315 xyz</span><span about="#mwt1">
7316 </span><span about="#mwt1">
7317 </span>
7318 !!end
7319
7320 !! test
7321 Templates: Ugly templates: 3. newline-only template parameter
7322 !! input
7323 foo {{echo|
7324 }}
7325 !! result
7326 <p>foo
7327 </p>
7328 !! end
7329
7330 # This looks like a bug: a single newline triggers p/br for some reason.
7331 !! test
7332 Templates: Ugly templates: 4. newline-only template parameter inconsistency
7333 !! input
7334 {{echo|
7335 }}
7336 !! result
7337 <p><br />
7338 </p>
7339 !! end
7340
7341
7342 !!test
7343 Parser Functions: 1. Simple example
7344 !!input
7345 {{uc:foo}}
7346 !!result
7347 <p>FOO
7348 </p>
7349 !!end
7350
7351 !!test
7352 Parser Functions: 2. Nested use (only outermost should be marked up)
7353 !!input
7354 {{uc:{{lc:FOO}}}}
7355 !!result
7356 <p>FOO
7357 </p>
7358 !!end
7359
7360 ###
7361 ### Pre-save transform tests
7362 ###
7363 !! test
7364 pre-save transform: subst:
7365 !! options
7366 PST
7367 !! input
7368 {{subst:test}}
7369 !! result
7370 This is a test template
7371 !! end
7372
7373 !! test
7374 pre-save transform: normal template
7375 !! options
7376 PST
7377 !! input
7378 {{test}}
7379 !! result
7380 {{test}}
7381 !! end
7382
7383 !! test
7384 pre-save transform: nonexistent template
7385 !! options
7386 PST
7387 !! input
7388 {{thistemplatedoesnotexist}}
7389 !! result
7390 {{thistemplatedoesnotexist}}
7391 !! end
7392
7393
7394 !! test
7395 pre-save transform: subst magic variables
7396 !! options
7397 PST
7398 !! input
7399 {{subst:SITENAME}}
7400 !! result
7401 MediaWiki
7402 !! end
7403
7404 # This is bug 89, which I fixed. -- wtm
7405 !! test
7406 pre-save transform: subst: templates with parameters
7407 !! options
7408 pst
7409 !! input
7410 {{subst:paramtest|param="something else"}}
7411 !! result
7412 This is a test template with parameter "something else"
7413 !! end
7414
7415 !! article
7416 Template:nowikitest
7417 !! text
7418 <nowiki>'''not wiki'''</nowiki>
7419 !! endarticle
7420
7421 !! test
7422 pre-save transform: nowiki in subst (bug 1188)
7423 !! options
7424 pst
7425 !! input
7426 {{subst:nowikitest}}
7427 !! result
7428 <nowiki>'''not wiki'''</nowiki>
7429 !! end
7430
7431
7432 !! article
7433 Template:commenttest
7434 !! text
7435 This template has <!-- a comment --> in it.
7436 !! endarticle
7437
7438 !! test
7439 pre-save transform: comment in subst (bug 1936)
7440 !! options
7441 pst
7442 !! input
7443 {{subst:commenttest}}
7444 !! result
7445 This template has <!-- a comment --> in it.
7446 !! end
7447
7448 !! test
7449 pre-save transform: unclosed tag
7450 !! options
7451 pst noxml
7452 !! input
7453 <nowiki>'''not wiki'''
7454 !! result
7455 <nowiki>'''not wiki'''
7456 !! end
7457
7458 !! test
7459 pre-save transform: mixed tag case
7460 !! options
7461 pst noxml
7462 !! input
7463 <NOwiki>'''not wiki'''</noWIKI>
7464 !! result
7465 <NOwiki>'''not wiki'''</noWIKI>
7466 !! end
7467
7468 !! test
7469 pre-save transform: unclosed comment in <nowiki>
7470 !! options
7471 pst noxml
7472 !! input
7473 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7474 !! result
7475 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7476 !!end
7477
7478 # Leading @ in this template definition works around a limitation
7479 # in parsoid's parserTests which otherwise strips the <span> from the
7480 # result (confusing it for a template wrapper)
7481 !! article
7482 Template:dangerous
7483 !!text
7484 @<span onmouseover="alert('crap')">Oh no</span>
7485 !!endarticle
7486
7487 !!test
7488 (confirming safety of fix for subst bug 1936)
7489 !! input
7490 {{Template:dangerous}}
7491 !! result
7492 <p>@<span>Oh no</span>
7493 </p>
7494 !! end
7495
7496 !! test
7497 pre-save transform: comment containing gallery (bug 5024)
7498 !! options
7499 pst
7500 !! input
7501 <!-- <gallery>data</gallery> -->
7502 !!result
7503 <!-- <gallery>data</gallery> -->
7504 !!end
7505
7506 !! test
7507 pre-save transform: comment containing extension
7508 !! options
7509 pst
7510 !! input
7511 <!-- <tag>data</tag> -->
7512 !!result
7513 <!-- <tag>data</tag> -->
7514 !!end
7515
7516 !! test
7517 pre-save transform: comment containing nowiki
7518 !! options
7519 pst
7520 !! input
7521 <!-- <nowiki>data</nowiki> -->
7522 !!result
7523 <!-- <nowiki>data</nowiki> -->
7524 !!end
7525
7526 !! test
7527 pre-save transform: <noinclude> in subst (bug 3298)
7528 !! options
7529 pst
7530 !! input
7531 {{subst:Includes}}
7532 !! result
7533 Foobar
7534 !! end
7535
7536 !! test
7537 pre-save transform: <onlyinclude> in subst (bug 3298)
7538 !! options
7539 pst
7540 !! input
7541 {{subst:Includes2}}
7542 !! result
7543 Foo
7544 !! end
7545
7546 !! article
7547 Template:SubstTest
7548 !!text
7549 {{<includeonly>subst:</includeonly>Includes}}
7550 !! endarticle
7551
7552 !! article
7553 Template:SafeSubstTest
7554 !! text
7555 {{<includeonly>safesubst:</includeonly>Includes}}
7556 !! endarticle
7557
7558 !! test
7559 bug 22297: safesubst: works during PST
7560 !! options
7561 pst
7562 !! input
7563 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
7564 !! result
7565 FoobarFoobar
7566 !! end
7567
7568 !! test
7569 bug 22297: safesubst: works during normal parse
7570 !! input
7571 {{SafeSubstTest}}
7572 !! result
7573 <p>Foobar
7574 </p>
7575 !! end
7576
7577 !! test:
7578 subst: does not work during normal parse
7579 !! input
7580 {{SubstTest}}
7581 !! result
7582 <p>{{subst:Includes}}
7583 </p>
7584 !! end
7585
7586 !! test
7587 pre-save transform: context links ("pipe trick")
7588 !! options
7589 pst
7590 !! input
7591 [[Article (context)|]]
7592 [[Bar:Article|]]
7593 [[:Bar:Article|]]
7594 [[Bar:Article (context)|]]
7595 [[:Bar:Article (context)|]]
7596 [[|Article]]
7597 [[|Article (context)]]
7598 [[Bar:X (Y) Z|]]
7599 [[:Bar:X (Y) Z|]]
7600 !! result
7601 [[Article (context)|Article]]
7602 [[Bar:Article|Article]]
7603 [[:Bar:Article|Article]]
7604 [[Bar:Article (context)|Article]]
7605 [[:Bar:Article (context)|Article]]
7606 [[Article]]
7607 [[Article (context)]]
7608 [[Bar:X (Y) Z|X (Y) Z]]
7609 [[:Bar:X (Y) Z|X (Y) Z]]
7610 !! end
7611
7612 !! test
7613 pre-save transform: context links ("pipe trick") with interwiki prefix
7614 !! options
7615 pst
7616 !! input
7617 [[interwiki:Article|]]
7618 [[:interwiki:Article|]]
7619 [[interwiki:Bar:Article|]]
7620 [[:interwiki:Bar:Article|]]
7621 !! result
7622 [[interwiki:Article|Article]]
7623 [[:interwiki:Article|Article]]
7624 [[interwiki:Bar:Article|Bar:Article]]
7625 [[:interwiki:Bar:Article|Bar:Article]]
7626 !! end
7627
7628 !! test
7629 pre-save transform: context links ("pipe trick") with parens in title
7630 !! options
7631 pst title=[[Somearticle (context)]]
7632 !! input
7633 [[|Article]]
7634 !! result
7635 [[Article (context)|Article]]
7636 !! end
7637
7638 !! test
7639 pre-save transform: context links ("pipe trick") with comma in title
7640 !! options
7641 pst title=[[Someplace, Somewhere]]
7642 !! input
7643 [[|Otherplace]]
7644 [[Otherplace, Elsewhere|]]
7645 [[Otherplace, Elsewhere, Anywhere|]]
7646 !! result
7647 [[Otherplace, Somewhere|Otherplace]]
7648 [[Otherplace, Elsewhere|Otherplace]]
7649 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
7650 !! end
7651
7652 !! test
7653 pre-save transform: context links ("pipe trick") with parens and comma
7654 !! options
7655 pst title=[[Someplace (IGNORED), Somewhere]]
7656 !! input
7657 [[|Otherplace]]
7658 [[Otherplace (place), Elsewhere|]]
7659 !! result
7660 [[Otherplace, Somewhere|Otherplace]]
7661 [[Otherplace (place), Elsewhere|Otherplace]]
7662 !! end
7663
7664 !! test
7665 pre-save transform: context links ("pipe trick") with comma and parens
7666 !! options
7667 pst title=[[Who, me? (context)]]
7668 !! input
7669 [[|Yes, you.]]
7670 [[Me, Myself, and I (1937 song)|]]
7671 !! result
7672 [[Yes, you. (context)|Yes, you.]]
7673 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
7674 !! end
7675
7676 !! test
7677 pre-save transform: context links ("pipe trick") with namespace
7678 !! options
7679 pst title=[[Ns:Somearticle]]
7680 !! input
7681 [[|Article]]
7682 !! result
7683 [[Ns:Article|Article]]
7684 !! end
7685
7686 !! test
7687 pre-save transform: context links ("pipe trick") with namespace and parens
7688 !! options
7689 pst title=[[Ns:Somearticle (context)]]
7690 !! input
7691 [[|Article]]
7692 !! result
7693 [[Ns:Article (context)|Article]]
7694 !! end
7695
7696 !! test
7697 pre-save transform: context links ("pipe trick") with namespace and comma
7698 !! options
7699 pst title=[[Ns:Somearticle, Context, Whatever]]
7700 !! input
7701 [[|Article]]
7702 !! result
7703 [[Ns:Article, Context, Whatever|Article]]
7704 !! end
7705
7706 !! test
7707 pre-save transform: context links ("pipe trick") with namespace, comma and parens
7708 !! options
7709 pst title=[[Ns:Somearticle, Context (context)]]
7710 !! input
7711 [[|Article]]
7712 !! result
7713 [[Ns:Article (context)|Article]]
7714 !! end
7715
7716 !! test
7717 pre-save transform: context links ("pipe trick") with namespace, parens and comma
7718 !! options
7719 pst title=[[Ns:Somearticle (IGNORED), Context]]
7720 !! input
7721 [[|Article]]
7722 !! result
7723 [[Ns:Article, Context|Article]]
7724 !! end
7725
7726 !! test
7727 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
7728 !! options
7729 pst
7730 !! input
7731 [[Article(context)|]]
7732 [[Bar:Article(context)|]]
7733 [[:Bar:Article(context)|]]
7734 [[|Article(context)]]
7735 [[Bar:X(Y)Z|]]
7736 [[:Bar:X(Y)Z|]]
7737 !! result
7738 [[Article(context)|Article]]
7739 [[Bar:Article(context)|Article]]
7740 [[:Bar:Article(context)|Article]]
7741 [[Article(context)]]
7742 [[Bar:X(Y)Z|X(Y)Z]]
7743 [[:Bar:X(Y)Z|X(Y)Z]]
7744 !! end
7745
7746 !! test
7747 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
7748 !! options
7749 pst
7750 !! input
7751 [[Article (context)|]]
7752 [[Bar:Article (context)|]]
7753 [[:Bar:Article (context)|]]
7754 [[|Article (context)]]
7755 [[Bar:X (Y) Z|]]
7756 [[:Bar:X (Y) Z|]]
7757 !! result
7758 [[Article (context)|Article]]
7759 [[Bar:Article (context)|Article]]
7760 [[:Bar:Article (context)|Article]]
7761 [[Article (context)]]
7762 [[Bar:X (Y) Z|X (Y) Z]]
7763 [[:Bar:X (Y) Z|X (Y) Z]]
7764 !! end
7765
7766 !! test
7767 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
7768 !! options
7769 pst
7770 !! input
7771 [[Article(context)|]]
7772 [[Bar:Article(context)|]]
7773 [[:Bar:Article(context)|]]
7774 [[|Article(context)]]
7775 [[Bar:X(Y)Z|]]
7776 [[:Bar:X(Y)Z|]]
7777 !! result
7778 [[Article(context)|Article]]
7779 [[Bar:Article(context)|Article]]
7780 [[:Bar:Article(context)|Article]]
7781 [[Article(context)]]
7782 [[Bar:X(Y)Z|X(Y)Z]]
7783 [[:Bar:X(Y)Z|X(Y)Z]]
7784 !! end
7785
7786 !! test
7787 pre-save transform: context links ("pipe trick") with commas (bug 21660)
7788 !! options
7789 pst
7790 !! input
7791 [[Article (context), context|]]
7792 [[Article (context),context|]]
7793 [[Bar:Article (context), context|]]
7794 [[Bar:Article (context),context|]]
7795 [[:Bar:Article (context), context|]]
7796 [[:Bar:Article (context),context|]]
7797 !! result
7798 [[Article (context), context|Article]]
7799 [[Article (context),context|Article]]
7800 [[Bar:Article (context), context|Article]]
7801 [[Bar:Article (context),context|Article]]
7802 [[:Bar:Article (context), context|Article]]
7803 [[:Bar:Article (context),context|Article]]
7804 !! end
7805
7806 !! test
7807 pre-save transform: trim trailing empty lines
7808 !! options
7809 pst
7810 !! input
7811 Empty lines are trimmed
7812
7813
7814
7815
7816 !! result
7817 Empty lines are trimmed
7818 !! end
7819
7820 !! test
7821 pre-save transform: Signature expansion
7822 !! options
7823 pst
7824 !! input
7825 * ~~~
7826 * <noinclude>~~~</noinclude>
7827 * <includeonly>~~~</includeonly>
7828 * <onlyinclude>~~~</onlyinclude>
7829 !! result
7830 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
7831 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
7832 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
7833 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
7834 !! end
7835
7836
7837 !! test
7838 pre-save transform: Signature expansion in nowiki tags (bug 93)
7839 !! options
7840 pst disabled
7841 !! input
7842 Shall not expand:
7843
7844 <nowiki>~~~~</nowiki>
7845
7846 <includeonly><nowiki>~~~~</nowiki></includeonly>
7847
7848 <noinclude><nowiki>~~~~</nowiki></noinclude>
7849
7850 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7851
7852 {{subst:Foo}} shall be converted to FOO
7853
7854 As well as inside noinclude/onlyinclude
7855 <noinclude>{{subst:Foo}}</noinclude>
7856 <onlyinclude>{{subst:Foo}}</onlyinclude>
7857
7858 But not inside includeonly
7859 <includeonly>{{subst:Foo}}</includeonly>
7860 !! result
7861 Shall not expand:
7862
7863 <nowiki>~~~~</nowiki>
7864
7865 <includeonly><nowiki>~~~~</nowiki></includeonly>
7866
7867 <noinclude><nowiki>~~~~</nowiki></noinclude>
7868
7869 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7870
7871 FOO shall be converted to FOO
7872
7873 As well as inside noinclude/onlyinclude
7874 <noinclude>FOO</noinclude>
7875 <onlyinclude>FOO</onlyinclude>
7876
7877 But not inside includeonly
7878 <includeonly>{{subst:Foo}}</includeonly>
7879 !! end
7880
7881 !! test
7882 Parsoid: Recognize nowiki with trailing space in tags
7883 !! options
7884 parsoid=wt2html
7885 !! input
7886 <nowiki ><div>[[foo]]</nowiki >
7887
7888 a<nowiki / >b
7889
7890 c<nowiki />d
7891
7892 e<nowiki/ >f
7893 !! result
7894 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
7895 <p>ab</p>
7896 <p>cd</p>
7897 <p>ef</p>
7898 !! end
7899
7900 !! test
7901 Parsoid: Recognize nowiki with odd capitalization
7902 !! options
7903 parsoid=wt2html
7904 !! input
7905 <noWikI ><div>[[foo]]</Nowiki >
7906 !! result
7907 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
7908 !! end
7909
7910
7911 !! test
7912 Parsoid: Escape nowiki with trailing space in tags
7913 !! options
7914 parsoid=html2wt
7915 !! input
7916 &lt;nowiki &gt; foo &lt;/nowiki &gt;
7917
7918 a&lt;nowiki /&gt;b
7919
7920 c&lt;nowiki/ &gt;d
7921 !! result
7922 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
7923 <p>a&lt;nowiki /&gt;b</p>
7924 <p>c&lt;nowiki/ &gt;d</p>
7925 !! end
7926
7927 !! test
7928 Parsoid: Escape weird noWikI capitalizations
7929 !! options
7930 parsoid=html2wt
7931 !! input
7932 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
7933 !! result
7934 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
7935 !! end
7936
7937 ###
7938 ### Message transform tests
7939 ###
7940 !! test
7941 message transform: magic variables
7942 !! options
7943 msg
7944 !! input
7945 {{SITENAME}}
7946 !! result
7947 MediaWiki
7948 !! end
7949
7950 !! test
7951 message transform: should not transform wiki markup
7952 !! options
7953 msg
7954 !! input
7955 ''test''
7956 !! result
7957 ''test''
7958 !! end
7959
7960 !! test
7961 message transform: <noinclude> in transcluded template (bug 4926)
7962 !! options
7963 msg
7964 !! input
7965 {{Includes}}
7966 !! result
7967 Foobar
7968 !! end
7969
7970 !! test
7971 message transform: <onlyinclude> in transcluded template (bug 4926)
7972 !! options
7973 msg
7974 !! input
7975 {{Includes2}}
7976 !! result
7977 Foo
7978 !! end
7979
7980 !! test
7981 {{#special:}} page name, known
7982 !! options
7983 msg
7984 !! input
7985 {{#special:Recentchanges}}
7986 !! result
7987 Special:RecentChanges
7988 !! end
7989
7990 !! test
7991 {{#special:}} page name with subpage, known
7992 !! options
7993 msg
7994 !! input
7995 {{#special:Recentchanges/param}}
7996 !! result
7997 Special:RecentChanges/param
7998 !! end
7999
8000 !! test
8001 {{#special:}} page name, unknown
8002 !! options
8003 msg
8004 !! input
8005 {{#special:foobar nonexistent}}
8006 !! result
8007 Special:Foobar nonexistent
8008 !! end
8009
8010 !! test
8011 {{#speciale:}} page name, known
8012 !! options
8013 msg
8014 !! input
8015 {{#speciale:Recentchanges}}
8016 !! result
8017 Special:RecentChanges
8018 !! end
8019
8020 !! test
8021 {{#speciale:}} page name with subpage, known
8022 !! options
8023 msg
8024 !! input
8025 {{#speciale:Recentchanges/param}}
8026 !! result
8027 Special:RecentChanges/param
8028 !! end
8029
8030 !! test
8031 {{#speciale:}} page name, unknown
8032 !! options
8033 msg
8034 !! input
8035 {{#speciale:foobar nonexistent}}
8036 !! result
8037 Special:Foobar_nonexistent
8038 !! end
8039
8040 ###
8041 ### Images
8042 ###
8043 !! test
8044 Simple image
8045 !! input
8046 [[Image:foobar.jpg]]
8047 !! result
8048 <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>
8049 </p>
8050 !! end
8051
8052 !! test
8053 Right-aligned image
8054 !! input
8055 [[Image:foobar.jpg|right]]
8056 !! result
8057 <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>
8058
8059 !! end
8060
8061 !! test
8062 Simple image (using File: namespace, now canonical)
8063 !! input
8064 [[File:foobar.jpg]]
8065 !! result
8066 <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>
8067 </p>
8068 !! end
8069
8070 !! test
8071 Image with caption
8072 !! input
8073 [[Image:foobar.jpg|right|Caption text]]
8074 !! result
8075 <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>
8076
8077 !! end
8078
8079 !! test
8080 Image with empty attribute
8081 !! input
8082 [[Image:foobar.jpg|right||Caption text]]
8083 !! result
8084 <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>
8085
8086 !! end
8087
8088 !! test
8089 Image with attributes from template.
8090 !! input
8091 [[Image:foobar.jpg|{{image_attribs}}]]
8092 !! result
8093 <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>
8094
8095 !! end
8096
8097 !! test
8098 Image with link tails
8099 !! input
8100 123[[Image:foobar.jpg]]456
8101 123[[Image:foobar.jpg|right]]456
8102 123[[Image:foobar.jpg|thumb]]456
8103 !! result
8104 <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
8105 </p>
8106 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
8107 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
8108
8109 !! end
8110
8111 !! test
8112 Image with multiple captions -- only last one is accepted
8113 !! input
8114 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
8115 !! result
8116 <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>
8117
8118 !! end
8119
8120 !! test
8121 Image with width attribute at different positions
8122 !! input
8123 [[Image:foobar.jpg|200px|right|Caption]]
8124 [[Image:foobar.jpg|right|200px|Caption]]
8125 [[Image:foobar.jpg|right|Caption|200px]]
8126 !! result
8127 <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>
8128 <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>
8129 <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>
8130
8131 !! end
8132
8133 !! test
8134 Image with link parameter, wiki target
8135 !! input
8136 [[Image:foobar.jpg|link=Target page]]
8137 !! result
8138 <p><a href="/wiki/Target_page" title="Target page"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8139 </p>
8140 !! end
8141
8142 !! test
8143 Image with link parameter, URL target
8144 !! input
8145 [[Image:foobar.jpg|link=http://example.com/]]
8146 !! result
8147 <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>
8148 </p>
8149 !! end
8150
8151 !! test
8152 Image with link parameter, wgExternalLinkTarget
8153 !! input
8154 [[Image:foobar.jpg|link=http://example.com/]]
8155 !! config
8156 wgExternalLinkTarget='foobar'
8157 !! result
8158 <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>
8159 </p>
8160 !! end
8161
8162 !! test
8163 Image with link parameter, wgNoFollowLinks set to false
8164 !! input
8165 [[Image:foobar.jpg|link=http://example.com/]]
8166 !! config
8167 wgNoFollowLinks=false
8168 !! result
8169 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8170 </p>
8171 !! end
8172
8173 !! test
8174 Image with link parameter, wgNoFollowDomainExceptions
8175 !! input
8176 [[Image:foobar.jpg|link=http://example.com/]]
8177 !! config
8178 wgNoFollowDomainExceptions='example.com'
8179 !! result
8180 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8181 </p>
8182 !! end
8183
8184 !! test
8185 Image with link parameter, wgExternalLinkTarget, unnamed parameter
8186 !! input
8187 [[Image:foobar.jpg|link=http://example.com/|Title]]
8188 !! config
8189 wgExternalLinkTarget='foobar'
8190 !! result
8191 <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>
8192 </p>
8193 !! end
8194
8195 !! test
8196 Image with empty link parameter
8197 !! input
8198 [[Image:foobar.jpg|link=]]
8199 !! result
8200 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
8201 </p>
8202 !! end
8203
8204 !! test
8205 Image with link parameter (wiki target) and unnamed parameter
8206 !! input
8207 [[Image:foobar.jpg|link=Target page|Title]]
8208 !! result
8209 <p><a href="/wiki/Target_page" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8210 </p>
8211 !! end
8212
8213 !! test
8214 Image with link parameter (URL target) and unnamed parameter
8215 !! input
8216 [[Image:foobar.jpg|link=http://example.com/|Title]]
8217 !! result
8218 <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>
8219 </p>
8220 !! end
8221
8222 !! test
8223 Thumbnail image with link parameter
8224 !! options
8225 php
8226 !! input
8227 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
8228 !! result
8229 <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>
8230
8231 !! end
8232
8233 !! test
8234 Manually-specified thumbnail image
8235 !! options
8236 php
8237 !! input
8238 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
8239 !! result
8240 <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>
8241
8242 !! end
8243
8244 !! test
8245 Manually-specified thumbnail image with explicit link to wiki page
8246 !! options
8247 php
8248 !! input
8249 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
8250 !! result
8251 <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>
8252
8253 !! end
8254
8255 !! test
8256 Manually-specified thumbnail image with explicit link to url
8257 !! options
8258 php
8259 !! input
8260 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
8261 !! result
8262 <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>
8263
8264 !! end
8265
8266 !! test
8267 Manually-specified thumbnail image with explicit no link
8268 !! options
8269 php
8270 !! input
8271 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
8272 !! result
8273 <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>
8274
8275 !! end
8276
8277 !! test
8278 Manually-specified thumbnail image with explicit link and alt text
8279 !! options
8280 php
8281 !! input
8282 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
8283 !! result
8284 <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>
8285
8286 !! end
8287
8288 !! test
8289 Image with frame and link
8290 !! input
8291 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
8292 !! result
8293 <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>
8294
8295 !! end
8296
8297 !! test
8298 Image with frame and link and explicit alt
8299 !! input
8300 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
8301 !! result
8302 <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>
8303
8304 !! end
8305
8306 !! test
8307 Image with wiki markup in implicit alt
8308 !! input
8309 [[Image:Foobar.jpg|testing '''bold''' in alt]]
8310 !! result
8311 <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>
8312 </p>
8313 !! end
8314
8315 !! test
8316 Image with wiki markup in explicit alt
8317 !! input
8318 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
8319 !! result
8320 <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>
8321 </p>
8322 !! end
8323
8324 !! test
8325 Link to image page- image page normally doesn't exists, hence edit link
8326 Add test with existing image page
8327 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
8328 !! input
8329 [[:Image:test]]
8330 !! result
8331 <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>
8332 </p>
8333 !! end
8334
8335 !! test
8336 bug 18784 Link to non-existent image page with caption should use caption as link text
8337 !! input
8338 [[:Image:test|caption]]
8339 !! result
8340 <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>
8341 </p>
8342 !! end
8343
8344 !! test
8345 Frameless image caption with a free URL
8346 !! input
8347 [[Image:foobar.jpg|http://example.com]]
8348 !! result
8349 <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>
8350 </p>
8351 !! end
8352
8353 !! test
8354 Thumbnail image caption with a free URL
8355 !! input
8356 [[Image:foobar.jpg|thumb|http://example.com]]
8357 !! result
8358 <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>
8359
8360 !! end
8361
8362 !! test
8363 Thumbnail image caption with a free URL and explicit alt
8364 !! input
8365 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
8366 !! result
8367 <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>
8368
8369 !! end
8370
8371 !! test
8372 SVG thumbnails with no language set
8373 !! options
8374 !! input
8375 [[File:Foobar.svg|thumb|width=200]]
8376 !! result
8377 <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>
8378
8379 !! end
8380
8381 !! test
8382 SVG thumbnails with language de
8383 !! options
8384 !! input
8385 [[File:Foobar.svg|thumb|width=200|lang=de]]
8386 !! result
8387 <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>
8388
8389 !! end
8390
8391 !! test
8392 SVG thumbnails with invalid language code
8393 !! options
8394 !! input
8395 [[File:Foobar.svg|thumb|width=200|lang=invalid.language.code]]
8396 !! result
8397 <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>
8398
8399 !! end
8400
8401 !! test
8402 BUG 1887: A ISBN with a thumbnail
8403 !! input
8404 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
8405 !! result
8406 <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>
8407
8408 !! end
8409
8410 !! test
8411 BUG 1887: A RFC with a thumbnail
8412 !! input
8413 [[Image:foobar.jpg|thumb|This is RFC 12354]]
8414 !! result
8415 <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>
8416
8417 !! end
8418
8419 !! test
8420 BUG 1887: A mailto link with a thumbnail
8421 !! input
8422 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
8423 !! result
8424 <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>
8425
8426 !! end
8427
8428 # Pending resolution to bug 368
8429 !! test
8430 BUG 648: Frameless image caption with a link
8431 !! input
8432 [[Image:foobar.jpg|text with a [[link]] in it]]
8433 !! result
8434 <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>
8435 </p>
8436 !! end
8437
8438 !! test
8439 BUG 648: Frameless image caption with a link (suffix)
8440 !! input
8441 [[Image:foobar.jpg|text with a [[link]]foo in it]]
8442 !! result
8443 <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>
8444 </p>
8445 !! end
8446
8447 !! test
8448 BUG 648: Frameless image caption with an interwiki link
8449 !! input
8450 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
8451 !! result
8452 <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>
8453 </p>
8454 !! end
8455
8456 !! test
8457 BUG 648: Frameless image caption with a piped interwiki link
8458 !! input
8459 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
8460 !! result
8461 <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>
8462 </p>
8463 !! end
8464
8465 !! test
8466 Escape HTML special chars in image alt text
8467 !! input
8468 [[Image:foobar.jpg|& < > "]]
8469 !! result
8470 <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>
8471 </p>
8472 !! end
8473
8474 !! test
8475 BUG 499: Alt text should have &#1234;, not &amp;1234;
8476 !! input
8477 [[Image:foobar.jpg|&#9792;]]
8478 !! result
8479 <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>
8480 </p>
8481 !! end
8482
8483 !! test
8484 Broken image caption with link
8485 !! input
8486 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
8487 !! result
8488 <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.
8489 </p>
8490 !! end
8491
8492 !! test
8493 Image caption containing another image
8494 !! input
8495 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
8496 !! result
8497 <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>
8498
8499 !! end
8500
8501 !! test
8502 Image caption containing a newline
8503 !! input
8504 [[Image:Foobar.jpg|This
8505 *is some text]]
8506 !! result
8507 <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>
8508 </p>
8509 !!end
8510
8511 !!test
8512 Parsoid: Image caption containing leading space
8513 (The leading space should not trigger nowiki escaping in wt2wt mode)
8514 !! input
8515 [[Image:Foobar.jpg|thumb| bar]]
8516 !! result
8517 <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>
8518
8519 !!end
8520
8521 !! test
8522 Bug 3090: External links other than http: in image captions
8523 !! input
8524 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
8525 !! result
8526 <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>
8527
8528 !! end
8529
8530 !! test
8531 Custom class
8532 !! input
8533 [[Image:foobar.jpg|a|class=b]]
8534 !! result
8535 <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>
8536 </p>
8537 !! end
8538
8539 !! test
8540 Localized image handling (1).
8541 !! options
8542 language=es
8543 !! input
8544 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
8545 !! result
8546 <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>
8547
8548 !! end
8549
8550 !! test
8551 Localized image handling (2).
8552 !! options
8553 language=es
8554 !! input
8555 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
8556 !! result
8557 <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>
8558
8559 !! end
8560
8561 !! test
8562 "border", "frameless" and "class" attributes on an image.
8563 !! input
8564 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
8565 !! result
8566 <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>
8567 </p>
8568 !! end
8569
8570 !! article
8571 File:Barfoo.jpg
8572 !! text
8573 #REDIRECT [[File:Barfoo.jpg]]
8574 !! endarticle
8575
8576 !! test
8577 Redirected image
8578 !! input
8579 [[Image:Barfoo.jpg]]
8580 !! result
8581 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
8582 </p>
8583 !! end
8584
8585 !! test
8586 Missing image with uploads disabled
8587 !! options
8588 wgEnableUploads=0
8589 !! input
8590 [[Image:Foobaz.jpg]]
8591 !! result
8592 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
8593 </p>
8594 !! end
8595
8596 # Parsoid-specific testing for images
8597 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
8598 # Currently imperfect due to a flaw in the Parsoid testrunner
8599 # Work in progress
8600
8601 !! test
8602 Parsoid-specific image handling - simple image
8603 !! options
8604 parsoid
8605 !! input
8606 [[Image:Foobar.jpg]]
8607 !! result
8608 <p>
8609 <span class="mw-default-size" typeof="mw:Image">
8610 <a href="File:Foobar.jpg">
8611 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8612 </a>
8613 </span>
8614 </p>
8615 !! end
8616
8617 !! test
8618 Parsoid-specific image handling - simple image without link
8619 !! options
8620 parsoid
8621 !! input
8622 [[Image:Foobar.jpg|link=]]
8623 !! result
8624 <p>
8625 <span class="mw-default-size" typeof="mw:Image">
8626 <span>
8627 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8628 </span>
8629 </span>
8630 </p>
8631 !! end
8632
8633 !! test
8634 Parsoid-specific image handling - simple image with specific link
8635 !! options
8636 parsoid
8637 !! input
8638 [[Image:Foobar.jpg|link=Main Page]]
8639 !! result
8640 <p>
8641 <span class="mw-default-size" typeof="mw:Image">
8642 <a href="Main_Page">
8643 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8644 </a>
8645 </span>
8646 </p>
8647 !! end
8648
8649 !! test
8650 Parsoid-specific image handling - simple image with size and middle alignment
8651 !! options
8652 parsoid
8653 !! input
8654 [[Image:Foobar.jpg|50px|middle]]
8655 !! result
8656 <p>
8657 <span class="mw-valign-middle" typeof="mw:Image">
8658 <a href="File:Foobar.jpg">
8659 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8660 </a>
8661 </span>
8662 </p>
8663 !! end
8664
8665 !! test
8666 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
8667 !! options
8668 parsoid
8669 !! input
8670 [[Image:Foobar.jpg|500x10px|baseline|caption]]
8671 !! result
8672 <p>
8673 <span class="mw-valign-baseline" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8674 <a href="File:Foobar.jpg">
8675 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89">
8676 </a>
8677 </span>
8678 </p>
8679 !! end
8680
8681 !! test
8682 Parsoid-specific image handling - simple image with border and size spec
8683 !! options
8684 parsoid
8685 !! input
8686 [[Image:Foobar.jpg|50px|border|caption]]
8687 !! result
8688 <p>
8689 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8690 <a href="File:Foobar.jpg">
8691 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8692 </a>
8693 </span>
8694 </p>
8695 !! end
8696
8697 !! test
8698 Parsoid-specific image handling - thumbnail with halign, valign, and caption
8699 !! options
8700 parsoid
8701 !! input
8702 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
8703 !! result
8704 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
8705 <a href="File:Foobar.jpg">
8706 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/180px-Foobar.jpg" height="21" width="180" />
8707 </a>
8708 <figcaption>caption content</figcaption>
8709 </figure>
8710 !! end
8711
8712 !! test
8713 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
8714 !! options
8715 parsoid
8716 !! input
8717 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
8718 !! result
8719 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
8720 <a href="File:Foobar.jpg">
8721 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
8722 </a>
8723 <figcaption>caption</figcaption>
8724 </figure>
8725 !! end
8726
8727 !! test
8728 Parsoid-specific image handling - framed image with specific size and caption
8729 !! options
8730 parsoid
8731 !! input
8732 [[Image:Foobar.jpg|500x50px|frame|caption]]
8733 !! result
8734 <figure typeof="mw:Image/Frame">
8735 <a href="File:Foobar.jpg">
8736 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8737 </a>
8738 <figcaption>caption</figcaption>
8739 </figure>
8740 !! end
8741
8742 !! test
8743 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
8744 !! options
8745 parsoid
8746 !! input
8747 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
8748 !! result
8749 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
8750 <a href="File:Foobar.jpg">
8751 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8752 </a>
8753 <figcaption>caption</figcaption>
8754 </figure>
8755 !! end
8756
8757 !! test
8758 Parsoid-specific image handling - frameless image with specific size, border, and caption
8759 !! options
8760 parsoid
8761 !! input
8762 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
8763 !! result
8764 <p>
8765 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8766 <a href="File:Foobar.jpg">
8767 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8768 </a>
8769 </p>
8770 !! end
8771
8772 #!! test
8773 #Parsoid-specific image handling - simple image with a formatted caption
8774 #!! options
8775 #parsoid
8776 #!! input
8777 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
8778 #!! result
8779 #<p>
8780 #<span typeof="mw:Image">
8781 #<a class="mw-default-size" href="Image:Foobar.jpg">
8782 #<img alt="Foobar.jpg" class="mw-default-size" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8783 #</a>
8784 #<span>abc</span>
8785 #</span>
8786 #</p>
8787
8788
8789 ###
8790 ### Subpages
8791 ###
8792 !! article
8793 Subpage test/subpage
8794 !! text
8795 foo
8796 !! endarticle
8797
8798 !! test
8799 Subpage link
8800 !! options
8801 subpage title=[[Subpage test]]
8802 !! input
8803 [[/subpage]]
8804 !! result
8805 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
8806 </p>
8807 !! end
8808
8809 !! test
8810 Subpage noslash link
8811 !! options
8812 subpage title=[[Subpage test]]
8813 !!input
8814 [[/subpage/]]
8815 !! result
8816 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
8817 </p>
8818 !! end
8819
8820 # TODO: make this PHP-parser compatible!
8821 !! test
8822 Relative subpage noslash link
8823 !! options
8824 parsoid=wt2wt,wt2html,html2html
8825 subpage title=[[Subpage test/1/2/3/4]]
8826 !!input
8827 [[../../subpage/]]
8828
8829 [[../../subpage]]
8830 !! result
8831 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
8832 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
8833 !! end
8834
8835 # TODO: make this PHP-parser compatible!
8836 !! test
8837 Parsoid: dot-slash prefixed wikilinks
8838 !! options
8839 parsoid=wt2wt,wt2html,html2html
8840 !!input
8841 [[./foo]]
8842
8843 [[././bar]]
8844
8845 [[././baz/]]
8846 !! result
8847 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
8848 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
8849 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
8850 !! end
8851
8852 !! test
8853 Disabled subpages
8854 !! input
8855 [[/subpage]]
8856 !! result
8857 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
8858 </p>
8859 !! end
8860
8861 !! test
8862 BUG 561: {{/Subpage}}
8863 !! options
8864 subpage title=[[Page]]
8865 !! input
8866 {{/Subpage}}
8867 !! result
8868 <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>
8869 </p>
8870 !! end
8871
8872 ###
8873 ### Categories
8874 ###
8875 !! article
8876 Category:MediaWiki User's Guide
8877 !! text
8878 blah
8879 !! endarticle
8880
8881 !! test
8882 Link to category
8883 !! input
8884 [[:Category:MediaWiki User's Guide]]
8885 !! result
8886 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
8887 </p>
8888 !! end
8889
8890 !! test
8891 Simple category
8892 !! options
8893 cat
8894 !! input
8895 [[Category:MediaWiki User's Guide]]
8896 !! result
8897 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8898 !! end
8899
8900 !! test
8901 PAGESINCATEGORY invalid title fatal (r33546 fix)
8902 !! input
8903 {{PAGESINCATEGORY:<bogus>}}
8904 !! result
8905 <p>0
8906 </p>
8907 !! end
8908
8909 !! test
8910 Category with different sort key
8911 !! options
8912 cat
8913 !! input
8914 [[Category:MediaWiki User's Guide|Foo]]
8915 !! result
8916 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8917 !! end
8918
8919 !! test
8920 Category with identical sort key
8921 !! options
8922 cat
8923 !! input
8924 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8925 !! result
8926 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8927 !! end
8928
8929 !! test
8930 Category with empty sort key
8931 !! options
8932 cat
8933 pst
8934 !! input
8935 [[Category:MediaWiki User's Guide|]]
8936 !! result
8937 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8938 !! end
8939
8940 !! test
8941 Category with empty sort key and parentheses
8942 !! options
8943 cat
8944 pst
8945 !! input
8946 [[Category:Foo (bar)|]]
8947 !! result
8948 [[Category:Foo (bar)|Foo]]
8949 !! end
8950
8951 !! test
8952 Category with link tail
8953 !! options
8954 cat
8955 pst
8956 !! input
8957 123[[Category:Foo]]456
8958 !! result
8959 123[[Category:Foo]]456
8960 !! end
8961
8962 !! test
8963 Category with template
8964 !! options
8965 cat
8966 pst
8967 !! input
8968 [[Category:{{echo|Foo}}]]
8969 !! result
8970 [[Category:{{echo|Foo}}]]
8971 !! end
8972
8973 !! test
8974 Category with template in sort key
8975 !! options
8976 cat
8977 pst
8978 !! input
8979 [[Category:Foo|{{echo|Bar}}]]
8980 !! result
8981 [[Category:Foo|{{echo|Bar}}]]
8982 !! end
8983
8984 !! test
8985 Category with template in sort key and title
8986 !! options
8987 cat
8988 pst
8989 !! input
8990 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8991 !! result
8992 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8993 !! end
8994
8995 !! test
8996 Category / paragraph interactions
8997 !! input
8998 Foo [[Category:Baz]] Bar
8999
9000 Foo [[Category:Baz]]
9001 Bar
9002
9003 Foo
9004 [[Category:Baz]]
9005 Bar
9006
9007 Foo
9008 [[Category:Baz]] Bar
9009
9010 Foo
9011 [[Category:Baz]]
9012 [[Category:Baz]]
9013 [[Category:Baz]]
9014 Bar
9015
9016 [[Category:Baz]]
9017 [[Category:Baz]]
9018 [[Category:Baz]]
9019
9020 [[Category:Baz]]
9021 {{echo|[[Category:Baz]]}}
9022 [[Category:Baz]]
9023 !! result
9024 <p>Foo Bar
9025 </p><p>Foo
9026 Bar
9027 </p><p>Foo
9028 Bar
9029 </p><p>Foo Bar
9030 </p><p>Foo
9031 Bar
9032 </p>
9033 !! end
9034
9035 !! test
9036 Parsoid: Serialize link to category page with colon escape
9037 !! options
9038 parsoid
9039 !! input
9040
9041 [[:Category:Foo]]
9042 [[:Category:Foo|Bar]]
9043 !! result
9044 <p>
9045 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
9046 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
9047 </p>
9048 !! end
9049
9050 !! test
9051 Parsoid: Link prefix/suffixes aren't applied to category links
9052 !! options
9053 parsoid=wt2html,wt2wt,html2html
9054 language=is
9055 !! input
9056 x[[Category:Foo]]y
9057 !! result
9058 <p>x<link rel="mw:WikiLink/Category" href="Category:Foo">y</p>
9059 !! end
9060
9061 !! test
9062 Parsoid: Serialize link to file page with colon escape
9063 !! options
9064 parsoid
9065 !! input
9066
9067 [[:File:Foo.png]]
9068 [[:File:Foo.png|Bar]]
9069 !! result
9070 <p>
9071 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
9072 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
9073 </p>
9074 !! end
9075
9076 !! test
9077 Parsoid: Serialize a genuine category link without colon escape
9078 !! options
9079 parsoid
9080 !! input
9081 [[Category:Foo]]
9082 [[Category:Foo|Bar]]
9083 !! result
9084 <link rel="mw:WikiLink/Category" href="Category:Foo">
9085 <link rel="mw:WikiLink/Category" href="Category:Foo#Bar">
9086 !! end
9087
9088 ###
9089 ### Inter-language links
9090 ###
9091 !! test
9092 Inter-language links
9093 !! options
9094 ill
9095 !! input
9096 [[es:Alimento]]
9097 [[fr:Nourriture]]
9098 [[zh:&#39135;&#21697;]]
9099 !! result
9100 es:Alimento fr:Nourriture zh:食品
9101 !! end
9102
9103 !! test
9104 Duplicate interlanguage links (bug 24502)
9105 !! options
9106 ill
9107 !! input
9108 [[es:1]]
9109 [[es:2]]
9110 [[fr:1]]
9111 [[fr:2]]
9112 !! result
9113 es:1 fr:1
9114 !! end
9115
9116 ###
9117 ### Sections
9118 ###
9119 !! test
9120 Basic section headings
9121 !! input
9122 == Headline 1 ==
9123 Some text
9124
9125 ==Headline 2==
9126 More
9127 ===Smaller headline===
9128 Blah blah
9129 !! result
9130 <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>
9131 <p>Some text
9132 </p>
9133 <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>
9134 <p>More
9135 </p>
9136 <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>
9137 <p>Blah blah
9138 </p>
9139 !! end
9140
9141 !! test
9142 Section headings with TOC
9143 !! input
9144 == Headline 1 ==
9145 === Subheadline 1 ===
9146 ===== Skipping a level =====
9147 ====== Skipping a level ======
9148
9149 == Headline 2 ==
9150 Some text
9151 ===Another headline===
9152 !! result
9153 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9154 <ul>
9155 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
9156 <ul>
9157 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
9158 <ul>
9159 <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>
9160 <ul>
9161 <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>
9162 </ul>
9163 </li>
9164 </ul>
9165 </li>
9166 </ul>
9167 </li>
9168 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
9169 <ul>
9170 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
9171 </ul>
9172 </li>
9173 </ul>
9174 </div>
9175 <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>
9176 <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>
9177 <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>
9178 <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>
9179 <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>
9180 <p>Some text
9181 </p>
9182 <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>
9183
9184 !! end
9185
9186 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
9187 !! test
9188 Handling of sections up to level 6 and beyond
9189 !! input
9190 = Level 1 Heading=
9191 == Level 2 Heading==
9192 === Level 3 Heading===
9193 ==== Level 4 Heading====
9194 ===== Level 5 Heading=====
9195 ====== Level 6 Heading======
9196 ======= Level 7 Heading=======
9197 ======== Level 8 Heading========
9198 ========= Level 9 Heading=========
9199 ========== Level 10 Heading==========
9200 !! result
9201 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9202 <ul>
9203 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
9204 <ul>
9205 <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>
9206 <ul>
9207 <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>
9208 <ul>
9209 <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>
9210 <ul>
9211 <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>
9212 <ul>
9213 <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>
9214 <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>
9215 <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>
9216 <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>
9217 <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>
9218 </ul>
9219 </li>
9220 </ul>
9221 </li>
9222 </ul>
9223 </li>
9224 </ul>
9225 </li>
9226 </ul>
9227 </li>
9228 </ul>
9229 </div>
9230 <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>
9231 <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>
9232 <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>
9233 <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>
9234 <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>
9235 <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>
9236 <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>
9237 <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>
9238 <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>
9239 <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>
9240
9241 !! end
9242
9243 !! test
9244 TOC regression (bug 9764)
9245 !! input
9246 == title 1 ==
9247 === title 1.1 ===
9248 ==== title 1.1.1 ====
9249 === title 1.2 ===
9250 == title 2 ==
9251 === title 2.1 ===
9252 !! result
9253 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9254 <ul>
9255 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9256 <ul>
9257 <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>
9258 <ul>
9259 <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>
9260 </ul>
9261 </li>
9262 <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>
9263 </ul>
9264 </li>
9265 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9266 <ul>
9267 <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>
9268 </ul>
9269 </li>
9270 </ul>
9271 </div>
9272 <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>
9273 <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>
9274 <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>
9275 <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>
9276 <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>
9277 <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>
9278
9279 !! end
9280
9281 !! test
9282 TOC with wgMaxTocLevel=3 (bug 6204)
9283 !! options
9284 wgMaxTocLevel=3
9285 !! input
9286 == title 1 ==
9287 === title 1.1 ===
9288 ==== title 1.1.1 ====
9289 === title 1.2 ===
9290 == title 2 ==
9291 === title 2.1 ===
9292 !! result
9293 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9294 <ul>
9295 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9296 <ul>
9297 <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>
9298 <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>
9299 </ul>
9300 </li>
9301 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9302 <ul>
9303 <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>
9304 </ul>
9305 </li>
9306 </ul>
9307 </div>
9308 <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>
9309 <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>
9310 <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>
9311 <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>
9312 <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>
9313 <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>
9314
9315 !! end
9316
9317 !! test
9318 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
9319 !! options
9320 wgMaxTocLevel=3
9321 !! input
9322 ==Section 1==
9323 ===Section 1.1===
9324 ====Section 1.1.1====
9325 ====Section 1.1.1.1====
9326 ==Section 2==
9327 !! result
9328 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9329 <ul>
9330 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
9331 <ul>
9332 <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>
9333 </ul>
9334 </li>
9335 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
9336 </ul>
9337 </div>
9338 <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>
9339 <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>
9340 <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>
9341 <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>
9342 <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>
9343
9344 !! end
9345
9346
9347 !! test
9348 Resolving duplicate section names
9349 !! input
9350 == Foo bar ==
9351 == Foo bar ==
9352 !! result
9353 <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>
9354 <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>
9355
9356 !! end
9357
9358 !! test
9359 Resolving duplicate section names with differing case (bug 10721)
9360 !! input
9361 == Foo bar ==
9362 == Foo Bar ==
9363 !! result
9364 <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>
9365 <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>
9366
9367 !! end
9368
9369 !! article
9370 Template:sections
9371 !! text
9372 ===Section 1===
9373 ==Section 2==
9374 !! endarticle
9375
9376 !! test
9377 Template with sections, __NOTOC__
9378 !! input
9379 __NOTOC__
9380 ==Section 0==
9381 {{sections}}
9382 ==Section 4==
9383 !! result
9384 <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>
9385 <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>
9386 <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>
9387 <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>
9388
9389 !! end
9390
9391 !! test
9392 __NOEDITSECTION__ keyword
9393 !! input
9394 __NOEDITSECTION__
9395 ==Section 1==
9396 ==Section 2==
9397 !! result
9398 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
9399 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
9400
9401 !! end
9402
9403 !! test
9404 Link inside a section heading
9405 !! input
9406 ==Section with a [[Main Page|link]] in it==
9407 !! result
9408 <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>
9409
9410 !! end
9411
9412 !! test
9413 TOC regression (bug 12077)
9414 !! input
9415 __TOC__
9416 == title 1 ==
9417 === title 1.1 ===
9418 == title 2 ==
9419 !! result
9420 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9421 <ul>
9422 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9423 <ul>
9424 <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>
9425 </ul>
9426 </li>
9427 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
9428 </ul>
9429 </div>
9430 <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>
9431 <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>
9432 <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>
9433
9434 !! end
9435
9436 !! test
9437 BUG 1219 URL next to image (good)
9438 !! input
9439 http://example.com [[Image:foobar.jpg]]
9440 !! result
9441 <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>
9442 </p>
9443 !!end
9444
9445 !! test
9446 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
9447 !! input
9448 ===
9449 The line above must have a trailing space!
9450 === <!--
9451 --> <!-- -->
9452 But just in case it doesn't...
9453 !! result
9454 <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>
9455 <p>The line above must have a trailing space!
9456 </p>
9457 <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>
9458 <p>But just in case it doesn't...
9459 </p>
9460 !! end
9461
9462 !! test
9463 Header with special characters (bug 25462)
9464 !! input
9465 The tooltips shall not show entities to the user (ie. be double escaped)
9466
9467 == text > text ==
9468 section 1
9469
9470 == text < text ==
9471 section 2
9472
9473 == text & text ==
9474 section 3
9475
9476 == text ' text ==
9477 section 4
9478
9479 == text " text ==
9480 section 5
9481 !! result
9482 <p>The tooltips shall not show entities to the user (ie. be double escaped)
9483 </p>
9484 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9485 <ul>
9486 <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>
9487 <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>
9488 <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>
9489 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
9490 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
9491 </ul>
9492 </div>
9493 <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>
9494 <p>section 1
9495 </p>
9496 <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>
9497 <p>section 2
9498 </p>
9499 <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>
9500 <p>section 3
9501 </p>
9502 <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>
9503 <p>section 4
9504 </p>
9505 <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>
9506 <p>section 5
9507 </p>
9508 !! end
9509
9510 !! test
9511 Headers with excess '=' characters
9512 (Are similar tests necessary beyond the 1st level?)
9513 !! input
9514 =foo==
9515 ==foo=
9516 =''italic'' heading==
9517 ==''italic'' heading=
9518 !! result
9519 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9520 <ul>
9521 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
9522 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
9523 <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>
9524 <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>
9525 </ul>
9526 </div>
9527 <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>
9528 <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>
9529 <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>
9530 <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>
9531
9532 !! end
9533
9534 !! test
9535 HTML headers vs TOC (bug 23393)
9536 (__NOEDITSECTION__ for clearer output, doesn't matter here)
9537 !! input
9538 <h1>Header 1</h1>
9539 == Header 1.1 ==
9540 == Header 1.2 ==
9541
9542 <h1>Header 2
9543 </h1>
9544 == Header 2.1 ==
9545 == Header 2.2 ==
9546 __NOEDITSECTION__
9547 !! result
9548 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9549 <ul>
9550 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
9551 <ul>
9552 <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>
9553 <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>
9554 </ul>
9555 </li>
9556 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
9557 <ul>
9558 <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>
9559 <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>
9560 </ul>
9561 </li>
9562 </ul>
9563 </div>
9564 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
9565 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
9566 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
9567 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
9568 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
9569 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
9570
9571 !! end
9572
9573 !! test
9574 BUG 1219 URL next to image (broken)
9575 !! input
9576 http://example.com[[Image:foobar.jpg]]
9577 !! result
9578 <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>
9579 </p>
9580 !!end
9581
9582 !! test
9583 Bug 1186 news: in the middle of text
9584 !! input
9585 http://en.wikinews.org/wiki/Wikinews:Workplace
9586 !! result
9587 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
9588 </p>
9589 !!end
9590
9591
9592 !! test
9593 Namespaced link must have a title
9594 !! input
9595 [[Project:]]
9596 !! result
9597 <p>[[Project:]]
9598 </p>
9599 !!end
9600
9601 !! test
9602 Namespaced link must have a title (bad fragment version)
9603 !! input
9604 [[Project:#fragment]]
9605 !! result
9606 <p>[[Project:#fragment]]
9607 </p>
9608 !!end
9609
9610
9611 ###
9612 ### HTML tags and HTML attributes
9613 ###
9614
9615 !! test
9616 div with no attributes
9617 !! input
9618 <div>HTML rocks</div>
9619 !! result
9620 <div>HTML rocks</div>
9621
9622 !! end
9623
9624 !! test
9625 div with double-quoted attribute
9626 !! input
9627 <div id="rock">HTML rocks</div>
9628 !! result
9629 <div id="rock">HTML rocks</div>
9630
9631 !! end
9632
9633 !! test
9634 div with single-quoted attribute
9635 !! input
9636 <div id='rock'>HTML rocks</div>
9637 !! result
9638 <div id="rock">HTML rocks</div>
9639
9640 !! end
9641
9642 !! test
9643 div with unquoted attribute
9644 !! input
9645 <div id=rock>HTML rocks</div>
9646 !! result
9647 <div id="rock">HTML rocks</div>
9648
9649 !! end
9650
9651 !! test
9652 div with illegal double attributes
9653 !! input
9654 <div id="a" id="b">HTML rocks</div>
9655 !! result
9656 <div id="b">HTML rocks</div>
9657
9658 !!end
9659
9660 # FIXME: produce empty string instead of "class" in the PHP parser, following
9661 # the HTML5 spec.
9662 !! test
9663 div with empty attribute value, space before equals
9664 !! options
9665 parsoid
9666 !! input
9667 <div class =>HTML rocks</div>
9668 !! result
9669 <div class="">HTML rocks</div>
9670
9671 !! end
9672
9673 # The PHP parser escapes the opening brace to &#123; for some reason, so
9674 # disabled this test for it.
9675 !! test
9676 div with braces in attribute value
9677 !! options
9678 parsoid
9679 !! input
9680 <div title="{}">Foo</div>
9681 !! result
9682 <div title="{}">Foo</div>
9683 !! end
9684
9685 # This it very inconsistent in the PHP parser: it returns
9686 # class="class" if there is a space between the name and the equal sign (see
9687 # 'div with empty attribute value, space before equals'), but strips the
9688 # attribute completely if the space is missing. We hope that not much content
9689 # depends on this, so are implementing the behavior below in Parsoid for
9690 # consistencies' sake. Disabled for the PHP parser.
9691 # FIXME: fix this behavior in the PHP parser?
9692 !! test
9693 div with empty attribute value, no space before equals
9694 !! options
9695 parsoid
9696 !! input
9697 <div class=>HTML rocks</div>
9698 !! result
9699 <div class="">HTML rocks</div>
9700
9701 !! end
9702
9703 !! test
9704 HTML multiple attributes correction
9705 !! input
9706 <p class="error" class="awesome">Awesome!</p>
9707 !! result
9708 <p class="awesome">Awesome!</p>
9709
9710 !!end
9711
9712 !! test
9713 Table multiple attributes correction
9714 !! input
9715 {|
9716 !+ class="error" class="awesome"| status
9717 |}
9718 !! result
9719 <table>
9720 <tr>
9721 <th class="awesome"> status
9722 </th></tr></table>
9723
9724 !!end
9725
9726 !! test
9727 DIV IN UPPERCASE
9728 !! input
9729 <DIV ID="x">HTML ROCKS</DIV>
9730 !! result
9731 <div id="x">HTML ROCKS</div>
9732
9733 !!end
9734
9735 !! test
9736 Non-ASCII pseudo-tags are rendered as text
9737 !! input
9738 <khyô>
9739 !! result
9740 <p>&lt;khyô&gt;
9741 </p>
9742 !! end
9743
9744 !! test
9745 Pseudo-tag with URL 'name' renders as url link
9746 !! input
9747 <http://example.com/>
9748 !! result
9749 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
9750 </p>
9751 !! end
9752
9753 !! test
9754 text with amp in the middle of nowhere
9755 !! input
9756 Remember AT&T?
9757 !!result
9758 <p>Remember AT&amp;T?
9759 </p>
9760 !! end
9761
9762 !! test
9763 text with character entity: eacute
9764 !! input
9765 I always thought &eacute; was a cute letter.
9766 !! result
9767 <p>I always thought &#233; was a cute letter.
9768 </p>
9769 !! end
9770
9771 !! test
9772 text with entity-escaped character entity-like string: eacute
9773 !! input
9774 I always thought &amp;eacute; was a cute letter.
9775 !! result
9776 <p>I always thought &amp;eacute; was a cute letter.
9777 </p>
9778 !! end
9779
9780 !! test
9781 text with undefined character entity: xacute
9782 !! input
9783 I always thought &xacute; was a cute letter.
9784 !! result
9785 <p>I always thought &amp;xacute; was a cute letter.
9786 </p>
9787 !! end
9788
9789
9790 ###
9791 ### Nesting tests (see bug 41545, 50604, 51081)
9792 ###
9793
9794 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
9795 # Note that html2wt is considerably more difficult if we use <b> in
9796 # the test case, instead of <big>
9797 !! test
9798 Ensure that HTML adoption agency algorithm is properly implemented.
9799 !! input
9800 <big>X<big>Y</big>Z</big>
9801 !! result
9802 <p><big>X<big>Y</big>Z</big>
9803 </p>
9804 !! end
9805
9806 # This was bug 41545 in the PHP parser.
9807 !! test
9808 Nesting of <kbd>
9809 !! input
9810 <kbd>X<kbd>Y</kbd>Z</kbd>
9811 !! result
9812 <p><kbd>X<kbd>Y</kbd>Z</kbd>
9813 </p>
9814 !! end
9815
9816 # The following cases were bug 51081 in the PHP parser.
9817 # Note that there are some other nestable tags (b, i, etc) which are
9818 # not covered; see bug 51081 for discussion.
9819 !! test
9820 Nesting of <em>
9821 !! input
9822 <em>X<em>Y</em>Z</em>
9823 !! result
9824 <p><em>X<em>Y</em>Z</em>
9825 </p>
9826 !! end
9827
9828 !! test
9829 Nesting of <strong>
9830 !! input
9831 <strong>X<strong>Y</strong>Z</strong>
9832 !! result
9833 <p><strong>X<strong>Y</strong>Z</strong>
9834 </p>
9835 !! end
9836
9837 !! test
9838 Nesting of <q>
9839 !! input
9840 <q>X<q>Y</q>Z</q>
9841 !! result
9842 <p><q>X<q>Y</q>Z</q>
9843 </p>
9844 !! end
9845
9846 !! test
9847 Nesting of <ruby>
9848 !! input
9849 <ruby>X<ruby>Y</ruby>Z</ruby>
9850 !! result
9851 <p><ruby>X<ruby>Y</ruby>Z</ruby>
9852 </p>
9853 !! end
9854
9855 !! test
9856 Nesting of <bdo>
9857 !! input
9858 <bdo>X<bdo>Y</bdo>Z</bdo>
9859 !! result
9860 <p><bdo>X<bdo>Y</bdo>Z</bdo>
9861 </p>
9862 !! end
9863
9864
9865 ###
9866 ### Media links
9867 ###
9868
9869 !! test
9870 Media link
9871 !! input
9872 [[Media:Foobar.jpg]]
9873 !! result
9874 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
9875 </p>
9876 !! end
9877
9878 !! test
9879 Media link with text
9880 !! input
9881 [[Media:Foobar.jpg|A neat file to look at]]
9882 !! result
9883 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
9884 </p>
9885 !! end
9886
9887 # FIXME: this is still bad HTML tag nesting
9888 !! test
9889 Media link with nasty text
9890 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
9891 !! input
9892 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
9893 !! result
9894 <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>
9895
9896 !! end
9897
9898 !! test
9899 Media link to nonexistent file (bug 1702)
9900 !! input
9901 [[Media:No such.jpg]]
9902 !! result
9903 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
9904 </p>
9905 !! end
9906
9907 !! test
9908 Image link to nonexistent file (bug 1850 - good)
9909 !! input
9910 [[Image:No such.jpg]]
9911 !! result
9912 <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>
9913 </p>
9914 !! end
9915
9916 !! test
9917 :Image link to nonexistent file (bug 1850 - bad)
9918 !! input
9919 [[:Image:No such.jpg]]
9920 !! result
9921 <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>
9922 </p>
9923 !! end
9924
9925
9926
9927 !! test
9928 Character reference normalization in link text (bug 1938)
9929 !! input
9930 [[Main Page|this&that]]
9931 !! result
9932 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
9933 </p>
9934 !!end
9935
9936 !! article
9937 אַ
9938 !! text
9939 Test for unicode normalization
9940
9941 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
9942 !! endarticle
9943
9944 !! test
9945 (bug 19451) Links should refer to the normalized form.
9946 !! input
9947 [[&#xFB2E;]]
9948 [[&#x5d0;&#x5b7;]]
9949 [[&#x5d0;ַ]]
9950 [[א&#x5b7;]]
9951 [[אַ]]
9952 !! result
9953 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
9954 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
9955 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
9956 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
9957 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
9958 </p>
9959 !! end
9960
9961 !! test
9962 Empty attribute crash test (bug 2067)
9963 !! input
9964 <font color="">foo</font>
9965 !! result
9966 <p><font color="">foo</font>
9967 </p>
9968 !! end
9969
9970 !! test
9971 Empty attribute crash test single-quotes (bug 2067)
9972 !! input
9973 <font color=''>foo</font>
9974 !! result
9975 <p><font color="">foo</font>
9976 </p>
9977 !! end
9978
9979 !! test
9980 Attribute test: equals, then nothing
9981 !! input
9982 <font color=>foo</font>
9983 !! result
9984 <p><font>foo</font>
9985 </p>
9986 !! end
9987
9988 !! test
9989 Attribute test: unquoted value
9990 !! input
9991 <font color=x>foo</font>
9992 !! result
9993 <p><font color="x">foo</font>
9994 </p>
9995 !! end
9996
9997 !! test
9998 Attribute test: unquoted but illegal value (hash)
9999 !! input
10000 <font color=#x>foo</font>
10001 !! result
10002 <p><font color="#x">foo</font>
10003 </p>
10004 !! end
10005
10006 !! test
10007 Attribute test: no value
10008 !! input
10009 <font color>foo</font>
10010 !! result
10011 <p><font color="color">foo</font>
10012 </p>
10013 !! end
10014
10015 !! test
10016 Bug 2095: link with three closing brackets
10017 !! input
10018 [[Main Page]]]
10019 !! result
10020 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
10021 </p>
10022 !! end
10023
10024 !! test
10025 Bug 2095: link with pipe and three closing brackets
10026 !! input
10027 [[Main Page|link]]]
10028 !! result
10029 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
10030 </p>
10031 !! end
10032
10033 !! test
10034 Bug 2095: link with pipe and three closing brackets, version 2
10035 !! input
10036 [[Main Page|[http://example.com/]]]
10037 !! result
10038 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
10039 </p>
10040 !! end
10041
10042
10043 ###
10044 ### Safety
10045 ###
10046
10047 !! article
10048 Template:Dangerous attribute
10049 !! text
10050 " onmouseover="alert(document.cookie)
10051 !! endarticle
10052
10053 !! article
10054 Template:Dangerous style attribute
10055 !! text
10056 border-size: expression(alert(document.cookie))
10057 !! endarticle
10058
10059 !! article
10060 Template:Div style
10061 !! text
10062 <div style="float: right; {{{1}}}">Magic div</div>
10063 !! endarticle
10064
10065 !! test
10066 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
10067 !! input
10068 <div title="{{test}}"></div>
10069 !! result
10070 <div title="This is a test template"></div>
10071
10072 !! end
10073
10074 !! test
10075 Bug 2304: HTML attribute safety (dangerous template; 2309)
10076 !! input
10077 <div title="{{dangerous attribute}}"></div>
10078 !! result
10079 <div title=""></div>
10080
10081 !! end
10082
10083 !! test
10084 Bug 2304: HTML attribute safety (dangerous style template; 2309)
10085 !! input
10086 <div style="{{dangerous style attribute}}"></div>
10087 !! result
10088 <div style="/* insecure input */"></div>
10089
10090 !! end
10091
10092 !! test
10093 Bug 2304: HTML attribute safety (safe parameter; 2309)
10094 !! input
10095 {{div style|width: 200px}}
10096 !! result
10097 <div style="float: right; width: 200px">Magic div</div>
10098
10099 !! end
10100
10101 !! test
10102 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
10103 !! input
10104 {{div style|width: expression(alert(document.cookie))}}
10105 !! result
10106 <div style="/* insecure input */">Magic div</div>
10107
10108 !! end
10109
10110 !! test
10111 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
10112 !! input
10113 {{div style|"><script>alert(document.cookie)</script>}}
10114 !! result
10115 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
10116
10117 !! end
10118
10119 !! test
10120 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
10121 !! input
10122 {{div style|" ><script>alert(document.cookie)</script>}}
10123 !! result
10124 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
10125
10126 !! end
10127
10128 !! test
10129 Bug 2304: HTML attribute safety (link)
10130 !! input
10131 <div title="[[Main Page]]"></div>
10132 !! result
10133 <div title="&#91;&#91;Main Page]]"></div>
10134
10135 !! end
10136
10137 !! test
10138 Bug 2304: HTML attribute safety (italics)
10139 !! input
10140 <div title="''foobar''"></div>
10141 !! result
10142 <div title="&#39;&#39;foobar&#39;&#39;"></div>
10143
10144 !! end
10145
10146 !! test
10147 Bug 2304: HTML attribute safety (bold)
10148 !! input
10149 <div title="'''foobar'''"></div>
10150 !! result
10151 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
10152
10153 !! end
10154
10155
10156 !! test
10157 Bug 2304: HTML attribute safety (ISBN)
10158 !! input
10159 <div title="ISBN 1234567890"></div>
10160 !! result
10161 <div title="&#73;SBN 1234567890"></div>
10162
10163 !! end
10164
10165 !! test
10166 Bug 2304: HTML attribute safety (RFC)
10167 !! input
10168 <div title="RFC 1234"></div>
10169 !! result
10170 <div title="&#82;FC 1234"></div>
10171
10172 !! end
10173
10174 !! test
10175 Bug 2304: HTML attribute safety (PMID)
10176 !! input
10177 <div title="PMID 1234567890"></div>
10178 !! result
10179 <div title="&#80;MID 1234567890"></div>
10180
10181 !! end
10182
10183 !! test
10184 Bug 2304: HTML attribute safety (web link)
10185 !! input
10186 <div title="http://example.com/"></div>
10187 !! result
10188 <div title="http&#58;//example.com/"></div>
10189
10190 !! end
10191
10192 !! test
10193 Bug 2304: HTML attribute safety (named web link)
10194 !! input
10195 <div title="[http://example.com/ link]"></div>
10196 !! result
10197 <div title="&#91;http&#58;//example.com/ link]"></div>
10198
10199 !! end
10200
10201 !! test
10202 Bug 3244: HTML attribute safety (extension; safe)
10203 !! input
10204 <div style="<nowiki>background:blue</nowiki>"></div>
10205 !! result
10206 <div style="background:blue"></div>
10207
10208 !! end
10209
10210 !! test
10211 Bug 3244: HTML attribute safety (extension; unsafe)
10212 !! input
10213 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
10214 !! result
10215 <div style="/* insecure input */"></div>
10216
10217 !! end
10218
10219 # More MSIE fun discovered by Tom Gilder
10220
10221 !! test
10222 MSIE CSS safety test: spurious slash
10223 !! input
10224 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
10225 !! result
10226 <div style="/* insecure input */">evil</div>
10227
10228 !! end
10229
10230 !! test
10231 MSIE CSS safety test: hex code
10232 !! input
10233 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
10234 !! result
10235 <div style="/* insecure input */">evil</div>
10236
10237 !! end
10238
10239 !! test
10240 MSIE CSS safety test: comment in url
10241 !! input
10242 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
10243 !! result
10244 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
10245
10246 !! end
10247
10248 !! test
10249 MSIE CSS safety test: comment in expression
10250 !! input
10251 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
10252 !! result
10253 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
10254
10255 !! end
10256
10257
10258 !! test
10259 Table attribute legitimate extension
10260 !! input
10261 {|
10262 !+ style="<nowiki>color:blue</nowiki>"| status
10263 |}
10264 !! result
10265 <table>
10266 <tr>
10267 <th style="color:blue"> status
10268 </th></tr></table>
10269
10270 !!end
10271
10272 !! test
10273 Table attribute safety
10274 !! input
10275 {|
10276 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
10277 |}
10278 !! result
10279 <table>
10280 <tr>
10281 <th style="/* insecure input */"> status
10282 </th></tr></table>
10283
10284 !! end
10285
10286 !! test
10287 CSS line continuation 1
10288 !! input
10289 <div style="background-image: u\&#10;rl(test.jpg);"></div>
10290 !! result
10291 <div style="/* insecure input */"></div>
10292
10293 !! end
10294
10295 !! test
10296 CSS line continuation 2
10297 !! input
10298 <div style="background-image: u\&#13;rl(test.jpg); "></div>
10299 !! result
10300 <div style="/* insecure input */"></div>
10301
10302 !! end
10303
10304 !! article
10305 Template:Identity
10306 !! text
10307 {{{1}}}
10308 !! endarticle
10309
10310 !! test
10311 Expansion of multi-line templates in attribute values (bug 6255)
10312 !! input
10313 <div style="background: {{identity|#00FF00}}">-</div>
10314 !! result
10315 <div style="background: #00FF00">-</div>
10316
10317 !! end
10318
10319
10320 !! test
10321 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
10322 !! input
10323 <div style="background:
10324 #00FF00">-</div>
10325 !! result
10326 <div style="background: #00FF00">-</div>
10327
10328 !! end
10329
10330 !! test
10331 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
10332 !! input
10333 <div style="background: &#10;#00FF00">-</div>
10334 !! result
10335 <div style="background: &#10;#00FF00">-</div>
10336
10337 !! end
10338
10339 ###
10340 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
10341 ###
10342 !! test
10343 Parser hook: empty input
10344 !! input
10345 <tag></tag>
10346 !! result
10347 <pre>
10348 ''
10349 array (
10350 )
10351 </pre>
10352
10353 !! end
10354
10355 !! test
10356 Parser hook: empty input using terminated empty elements
10357 !! input
10358 <tag/>
10359 !! result
10360 <pre>
10361 NULL
10362 array (
10363 )
10364 </pre>
10365
10366 !! end
10367
10368 !! test
10369 Parser hook: empty input using terminated empty elements (space before)
10370 !! input
10371 <tag />
10372 !! result
10373 <pre>
10374 NULL
10375 array (
10376 )
10377 </pre>
10378
10379 !! end
10380
10381 !! test
10382 Parser hook: basic input
10383 !! input
10384 <tag>input</tag>
10385 !! result
10386 <pre>
10387 'input'
10388 array (
10389 )
10390 </pre>
10391
10392 !! end
10393
10394
10395 !! test
10396 Parser hook: case insensitive
10397 !! input
10398 <TAG>input</TAG>
10399 !! result
10400 <pre>
10401 'input'
10402 array (
10403 )
10404 </pre>
10405
10406 !! end
10407
10408
10409 !! test
10410 Parser hook: case insensitive, redux
10411 !! input
10412 <TaG>input</TAg>
10413 !! result
10414 <pre>
10415 'input'
10416 array (
10417 )
10418 </pre>
10419
10420 !! end
10421
10422 !! test
10423 Parser hook: nested tags
10424 !! options
10425 noxml
10426 !! input
10427 <tag><tag></tag></tag>
10428 !! result
10429 <pre>
10430 '<tag>'
10431 array (
10432 )
10433 </pre>&lt;/tag&gt;
10434
10435 !! end
10436
10437 !! test
10438 Parser hook: basic arguments
10439 !! input
10440 <tag width=200 height = "100" depth = '50' square></tag>
10441 !! result
10442 <pre>
10443 ''
10444 array (
10445 'width' => '200',
10446 'height' => '100',
10447 'depth' => '50',
10448 'square' => 'square',
10449 )
10450 </pre>
10451
10452 !! end
10453
10454 !! test
10455 Parser hook: argument containing a forward slash (bug 5344)
10456 !! input
10457 <tag filename='/tmp/bla'></tag>
10458 !! result
10459 <pre>
10460 ''
10461 array (
10462 'filename' => '/tmp/bla',
10463 )
10464 </pre>
10465
10466 !! end
10467
10468 !! test
10469 Parser hook: empty input using terminated empty elements (bug 2374)
10470 !! input
10471 <tag foo=bar/>text
10472 !! result
10473 <pre>
10474 NULL
10475 array (
10476 'foo' => 'bar',
10477 )
10478 </pre>text
10479
10480 !! end
10481
10482 # </tag> should be output literally since there is no matching tag that begins it
10483 !! test
10484 Parser hook: basic arguments using terminated empty elements (bug 2374)
10485 !! input
10486 <tag width=200 height = "100" depth = '50' square/>
10487 other stuff
10488 </tag>
10489 !! result
10490 <pre>
10491 NULL
10492 array (
10493 'width' => '200',
10494 'height' => '100',
10495 'depth' => '50',
10496 'square' => 'square',
10497 )
10498 </pre>
10499 <p>other stuff
10500 &lt;/tag&gt;
10501 </p>
10502 !! end
10503
10504 ###
10505 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
10506 ###
10507
10508 !! test
10509 Parser hook: static parser hook not inside a comment
10510 !! input
10511 <statictag>hello, world</statictag>
10512 <statictag action=flush/>
10513 !! result
10514 <p>hello, world
10515 </p>
10516 !! end
10517
10518
10519 !! test
10520 Parser hook: static parser hook inside a comment
10521 !! input
10522 <!-- <statictag>hello, world</statictag> -->
10523 <statictag action=flush/>
10524 !! result
10525 <p><br />
10526 </p>
10527 !! end
10528
10529 # Nested template calls; this case was broken by Parser.php rev 1.506,
10530 # since reverted.
10531
10532 !! article
10533 Template:One-parameter
10534 !! text
10535 (My parameter is: {{{1}}})
10536 !! endarticle
10537
10538 !! article
10539 Template:Map-one-parameter
10540 !! text
10541 {{{{{1}}}|{{{2}}}}}
10542 !! endarticle
10543
10544 !! test
10545 Nested template calls
10546 !! input
10547 {{Map-one-parameter|One-parameter|param}}
10548 !! result
10549 <p>(My parameter is: param)
10550 </p>
10551 !! end
10552
10553
10554 ###
10555 ### Sanitizer
10556 ###
10557 !! test
10558 Sanitizer: Closing of open tags
10559 !! input
10560 <s></s><table></table>
10561 !! result
10562 <s></s><table></table>
10563
10564 !! end
10565
10566 !! test
10567 Sanitizer: Closing of open but not closed tags
10568 !! input
10569 <s>foo
10570 !! result
10571 <p><s>foo</s>
10572 </p>
10573 !! end
10574
10575 !! test
10576 Sanitizer: Closing of closed but not open tags
10577 !! input
10578 </s>
10579 !! result
10580 <p>&lt;/s&gt;
10581 </p>
10582 !! end
10583
10584 !! test
10585 Sanitizer: Closing of closed but not open table tags
10586 !! input
10587 Table not started</td></tr></table>
10588 !! result
10589 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
10590 </p>
10591 !! end
10592
10593 !! test
10594 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
10595 !! input
10596 <span id="æ: v">byte</span>[[#æ: v|backlink]]
10597 !! result
10598 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
10599 </p>
10600 !! end
10601
10602 !! test
10603 Sanitizer: Validating the contents of the id attribute (bug 4515)
10604 !! options
10605 disabled
10606 !! input
10607 <br id=9 />
10608 !! result
10609 Something, but definitely not <br id="9" />...
10610 !! end
10611
10612 !! test
10613 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
10614 !! options
10615 disabled
10616 !! input
10617 <br id="foo" /><br id="foo" />
10618 !! result
10619 Something need to be done. foo-2 ?
10620 !! end
10621
10622 !! test
10623 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
10624 !! input
10625 <div itemscope>
10626 <meta itemprop="hello" content="world">
10627 <meta http-equiv="refresh" content="5">
10628 <meta itemprop="hello" http-equiv="refresh" content="5">
10629 <link itemprop="hello" href="{{SERVER}}">
10630 <link rel="stylesheet" href="{{SERVER}}">
10631 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
10632 </div>
10633 !! result
10634 <div itemscope="itemscope">
10635 <p> <meta itemprop="hello" content="world" />
10636 &lt;meta http-equiv="refresh" content="5"&gt;
10637 <meta itemprop="hello" content="5" />
10638 </p>
10639 <link itemprop="hello" href="http&#58;//example.org" />
10640 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
10641 <link itemprop="hello" href="http&#58;//example.org" />
10642 </div>
10643
10644 !! end
10645
10646 !! test
10647 Language converter: output gets cut off unexpectedly (bug 5757)
10648 !! options
10649 language=zh
10650 !! input
10651 this bit is safe: }-
10652
10653 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
10654
10655 then we get cut off here: }-
10656
10657 all additional text is vanished
10658 !! result
10659 <p>this bit is safe: }-
10660 </p><p>but if we add a conversion instance: xxx
10661 </p><p>then we get cut off here: }-
10662 </p><p>all additional text is vanished
10663 </p>
10664 !! end
10665
10666 !! test
10667 Self closed html pairs (bug 5487)
10668 !! options
10669 !! input
10670 <center><font id="bug" />Centered text</center>
10671 <div><font id="bug2" />In div text</div>
10672 !! result
10673 <center>&lt;font id="bug" /&gt;Centered text</center>
10674 <div>&lt;font id="bug2" /&gt;In div text</div>
10675
10676 !! end
10677
10678 #
10679 #
10680 #
10681
10682 !! test
10683 Punctuation: nbsp before exclamation
10684 !! input
10685 C'est grave !
10686 !! result
10687 <p>C'est grave&#160;!
10688 </p>
10689 !! end
10690
10691 !! test
10692 Punctuation: CSS !important (bug 11874)
10693 !! input
10694 <div style="width:50% !important">important</div>
10695 !! result
10696 <div style="width:50% !important">important</div>
10697
10698 !!end
10699
10700 !! test
10701 Punctuation: CSS ! important (bug 11874; with space after)
10702 !! input
10703 <div style="width:50% ! important">important</div>
10704 !! result
10705 <div style="width:50% ! important">important</div>
10706
10707 !!end
10708
10709
10710 !! test
10711 HTML bullet list, closed tags (bug 5497)
10712 !! input
10713 <ul>
10714 <li>One</li>
10715 <li>Two</li>
10716 </ul>
10717 !! result
10718 <ul>
10719 <li>One</li>
10720 <li>Two</li>
10721 </ul>
10722
10723 !! end
10724
10725 !! test
10726 HTML bullet list, unclosed tags (bug 5497)
10727 !! options
10728 disabled
10729 !! input
10730 <ul>
10731 <li>One
10732 <li>Two
10733 </ul>
10734 !! result
10735 <ul>
10736 <li>One
10737 </li><li>Two
10738 </li></ul>
10739
10740 !! end
10741
10742 !! test
10743 HTML ordered list, closed tags (bug 5497)
10744 !! input
10745 <ol>
10746 <li>One</li>
10747 <li>Two</li>
10748 </ol>
10749 !! result
10750 <ol>
10751 <li>One</li>
10752 <li>Two</li>
10753 </ol>
10754
10755 !! end
10756
10757 !! test
10758 HTML ordered list, unclosed tags (bug 5497)
10759 !! options
10760 disabled
10761 !! input
10762 <ol>
10763 <li>One
10764 <li>Two
10765 </ol>
10766 !! result
10767 <ol>
10768 <li>One
10769 </li><li>Two
10770 </li></ol>
10771
10772 !! end
10773
10774 !! test
10775 HTML nested bullet list, closed tags (bug 5497)
10776 !! input
10777 <ul>
10778 <li>One</li>
10779 <li>Two:
10780 <ul>
10781 <li>Sub-one</li>
10782 <li>Sub-two</li>
10783 </ul>
10784 </li>
10785 </ul>
10786 !! result
10787 <ul>
10788 <li>One</li>
10789 <li>Two:
10790 <ul>
10791 <li>Sub-one</li>
10792 <li>Sub-two</li>
10793 </ul>
10794 </li>
10795 </ul>
10796
10797 !! end
10798
10799 !! test
10800 HTML nested bullet list, open tags (bug 5497)
10801 !! options
10802 disabled
10803 !! input
10804 <ul>
10805 <li>One
10806 <li>Two:
10807 <ul>
10808 <li>Sub-one
10809 <li>Sub-two
10810 </ul>
10811 </ul>
10812 !! result
10813 <ul>
10814 <li>One
10815 </li><li>Two:
10816 <ul>
10817 <li>Sub-one
10818 </li><li>Sub-two
10819 </li></ul>
10820 </li></ul>
10821
10822 !! end
10823
10824 !! test
10825 HTML nested ordered list, closed tags (bug 5497)
10826 !! input
10827 <ol>
10828 <li>One</li>
10829 <li>Two:
10830 <ol>
10831 <li>Sub-one</li>
10832 <li>Sub-two</li>
10833 </ol>
10834 </li>
10835 </ol>
10836 !! result
10837 <ol>
10838 <li>One</li>
10839 <li>Two:
10840 <ol>
10841 <li>Sub-one</li>
10842 <li>Sub-two</li>
10843 </ol>
10844 </li>
10845 </ol>
10846
10847 !! end
10848
10849 !! test
10850 HTML nested ordered list, open tags (bug 5497)
10851 !! options
10852 disabled
10853 !! input
10854 <ol>
10855 <li>One
10856 <li>Two:
10857 <ol>
10858 <li>Sub-one
10859 <li>Sub-two
10860 </ol>
10861 </ol>
10862 !! result
10863 <ol>
10864 <li>One
10865 </li><li>Two:
10866 <ol>
10867 <li>Sub-one
10868 </li><li>Sub-two
10869 </li></ol>
10870 </li></ol>
10871
10872 !! end
10873
10874 !! test
10875 HTML ordered list item with parameters oddity
10876 !! input
10877 <ol><li id="fragment">One</li></ol>
10878 !! result
10879 <ol><li id="fragment">One</li></ol>
10880
10881 !! end
10882
10883 !!test
10884 bug 5918: autonumbering
10885 !! input
10886 [http://first/] [http://second] [ftp://ftp]
10887
10888 ftp://inlineftp
10889
10890 [mailto:enclosed@mail.tld With target]
10891
10892 [mailto:enclosed@mail.tld]
10893
10894 mailto:inline@mail.tld
10895 !! result
10896 <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>
10897 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
10898 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
10899 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
10900 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
10901 </p>
10902 !! end
10903
10904
10905 #
10906 # Security and HTML correctness
10907 # From Nick Jenkins' fuzz testing
10908 #
10909
10910 !! test
10911 Fuzz testing: Parser13
10912 !! input
10913 {|
10914 | http://a|
10915 !! result
10916 <table>
10917 <tr>
10918 <td>
10919 </td>
10920 </tr>
10921 </table>
10922
10923 !! end
10924
10925 !! test
10926 Fuzz testing: Parser14
10927 !! input
10928 == onmouseover= ==
10929 http://__TOC__
10930 !! result
10931 <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>
10932 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10933 <ul>
10934 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
10935 </ul>
10936 </div>
10937
10938 !! end
10939
10940 !! test
10941 Fuzz testing: Parser14-table
10942 !! input
10943 ==a==
10944 {| STYLE=__TOC__
10945 !! result
10946 <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>
10947 <table style="&#95;_TOC&#95;_">
10948 <tr><td></td></tr>
10949 </table>
10950
10951 !! end
10952
10953 # Known to produce bogus xml (extra </td>)
10954 !! test
10955 Fuzz testing: Parser16
10956 !! options
10957 noxml
10958 !! input
10959 {|
10960 !https://||||||
10961 !! result
10962 <table>
10963 <tr>
10964 <th>https://</th>
10965 <th></th>
10966 <th></th>
10967 <th>
10968 </td>
10969 </tr>
10970 </table>
10971
10972 !! end
10973
10974 !! test
10975 Fuzz testing: Parser21
10976 !! input
10977 {|
10978 ! irc://{{ftp://a" onmouseover="alert('hello world');"
10979 |
10980 !! result
10981 <table>
10982 <tr>
10983 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
10984 </th>
10985 <td>
10986 </td>
10987 </tr>
10988 </table>
10989
10990 !! end
10991
10992 !! test
10993 Fuzz testing: Parser22
10994 !! input
10995 http://===r:::https://b
10996
10997 {|
10998 !!result
10999 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
11000 </p>
11001 <table>
11002 <tr><td></td></tr>
11003 </table>
11004
11005 !! end
11006
11007 # Known to produce bad XML for now
11008 !! test
11009 Fuzz testing: Parser24
11010 !! options
11011 noxml
11012 !! input
11013 {|
11014 {{{|
11015 <u CLASS=
11016 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
11017 <br style="onmouseover='alert(document.cookie);' " />
11018
11019 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
11020 |
11021 !! result
11022 <table>
11023 {{{|
11024 <u class="&#124;">}}}} &gt;
11025 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
11026
11027 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
11028 <tr>
11029 <td></u>
11030 </td>
11031 </tr>
11032 </table>
11033
11034 !! end
11035
11036 # Note: the current result listed for this is not what the original one was,
11037 # but the original bug was JavaScript injection, which is fixed in any case.
11038 # It's not clear that the original result listed was any more correct than the
11039 # current one. Original result:
11040 # <p>{{{|
11041 # </p>
11042 # <li class="&#124;&#124;">
11043 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
11044 !!test
11045 Fuzz testing: Parser25 (bug 6055)
11046 !! input
11047 {{{
11048 |
11049 <LI CLASS=||
11050 >
11051 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
11052 !! result
11053 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
11054 </p>
11055 !! end
11056
11057 !!test
11058 Fuzz testing: URL adjacent extension (with space, clean)
11059 !! options
11060 !! input
11061 http://example.com <nowiki>junk</nowiki>
11062 !! result
11063 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
11064 </p>
11065 !!end
11066
11067 !!test
11068 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
11069 !! options
11070 !! input
11071 http://example.com<nowiki>junk</nowiki>
11072 !! result
11073 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
11074 </p>
11075 !!end
11076
11077 !!test
11078 Fuzz testing: URL adjacent extension (no space, dirty; pre)
11079 !! options
11080 !! input
11081 http://example.com<pre>junk</pre>
11082 !! result
11083 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
11084
11085 !!end
11086
11087 !!test
11088 Fuzz testing: image with bogus manual thumbnail
11089 !!input
11090 [[Image:foobar.jpg|thumbnail= ]]
11091 !!result
11092 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
11093
11094 !!end
11095
11096 !! test
11097 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
11098 !! input
11099 <pre dir="&#10;"></pre>
11100 !! result
11101 <pre dir="&#10;"></pre>
11102
11103 !! end
11104
11105 !! test
11106 Parsing optional HTML elements (Bug 6171)
11107 !! options
11108 !! input
11109 <table>
11110 <tr>
11111 <td> Some tabular data</td>
11112 <td> More tabular data ...
11113 <td> And yet som tabular data</td>
11114 </tr>
11115 </table>
11116 !! result
11117 <table>
11118 <tr>
11119 <td> Some tabular data</td>
11120 <td> More tabular data ...
11121 </td><td> And yet som tabular data</td>
11122 </tr>
11123 </table>
11124
11125 !! end
11126
11127 !! test
11128 Correct handling of <td>, <tr> (Bug 6171)
11129 !! options
11130 !! input
11131 <table>
11132 <tr>
11133 <td> Some tabular data</td>
11134 <td> More tabular data ...</td>
11135 <td> And yet som tabular data</td>
11136 </tr>
11137 </table>
11138 !! result
11139 <table>
11140 <tr>
11141 <td> Some tabular data</td>
11142 <td> More tabular data ...</td>
11143 <td> And yet som tabular data</td>
11144 </tr>
11145 </table>
11146
11147 !! end
11148
11149
11150 !! test
11151 Parsing crashing regression (fr:JavaScript)
11152 !! input
11153 </body></x>
11154 !! result
11155 <p>&lt;/body&gt;&lt;/x&gt;
11156 </p>
11157 !! end
11158
11159 !! test
11160 Inline wiki vs wiki block nesting
11161 !! input
11162 '''Bold paragraph
11163
11164 New wiki paragraph
11165 !! result
11166 <p><b>Bold paragraph</b>
11167 </p><p>New wiki paragraph
11168 </p>
11169 !! end
11170
11171 !! test
11172 Inline HTML vs wiki block nesting
11173 !! options
11174 disabled
11175 !! input
11176 <b>Bold paragraph
11177
11178 New wiki paragraph
11179 !! result
11180 <p><b>Bold paragraph</b>
11181 </p><p>New wiki paragraph
11182 </p>
11183 !! end
11184
11185 # Original result was this:
11186 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
11187 # </p>
11188 # While that might be marginally more intuitive, maybe, the six-apostrophe
11189 # construct is clearly pathological and the result stated here (which is what
11190 # the parser actually does) is about as reasonable as anything.
11191 !!test
11192 Mixing markup for italics and bold
11193 !! options
11194 !! input
11195 '''bold''''''bold''bolditalics'''''
11196 !! result
11197 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
11198 </p>
11199 !! end
11200
11201
11202 !! article
11203 Xyzzyx
11204 !! text
11205 Article for special page transclusion test
11206 !! endarticle
11207
11208 !! test
11209 Special page transclusion
11210 !! options
11211 !! input
11212 {{Special:Prefixindex/Xyzzyx}}
11213 !! result
11214 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11215
11216 !! end
11217
11218 !! test
11219 Special page transclusion twice (bug 5021)
11220 !! options
11221 !! input
11222 {{Special:Prefixindex/Xyzzyx}}
11223 {{Special:Prefixindex/Xyzzyx}}
11224 !! result
11225 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11226 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11227
11228 !! end
11229
11230 !! test
11231 Transclusion of default MediaWiki message
11232 !! input
11233 {{MediaWiki:Mainpage}}
11234 !!result
11235 <p>Main Page
11236 </p>
11237 !! end
11238
11239 !! test
11240 Transclusion of nonexistent MediaWiki message
11241 !! input
11242 {{MediaWiki:Mainpagexxx}}
11243 !!result
11244 <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>
11245 </p>
11246 !! end
11247
11248 !! test
11249 Transclusion of MediaWiki message with underscore
11250 !! input
11251 {{MediaWiki:history_short}}
11252 !! result
11253 <p>History
11254 </p>
11255 !! end
11256
11257 !! test
11258 Transclusion of MediaWiki message with space
11259 !! input
11260 {{MediaWiki:history short}}
11261 !! result
11262 <p>History
11263 </p>
11264 !! end
11265
11266 !! test
11267 Invalid header with following text
11268 !! input
11269 = x = y
11270 !! result
11271 <p>= x = y
11272 </p>
11273 !! end
11274
11275
11276 !! test
11277 Section extraction test (section 0)
11278 !! options
11279 section=0
11280 !! input
11281 start
11282 ==a==
11283 ===aa===
11284 ====aaa====
11285 ==b==
11286 ===ba===
11287 ===bb===
11288 ====bba====
11289 ===bc===
11290 ==c==
11291 ===ca===
11292 !! result
11293 start
11294 !! end
11295
11296 !! test
11297 Section extraction test (section 1)
11298 !! options
11299 section=1
11300 !! input
11301 start
11302 ==a==
11303 ===aa===
11304 ====aaa====
11305 ==b==
11306 ===ba===
11307 ===bb===
11308 ====bba====
11309 ===bc===
11310 ==c==
11311 ===ca===
11312 !! result
11313 ==a==
11314 ===aa===
11315 ====aaa====
11316 !! end
11317
11318 !! test
11319 Section extraction test (section 2)
11320 !! options
11321 section=2
11322 !! input
11323 start
11324 ==a==
11325 ===aa===
11326 ====aaa====
11327 ==b==
11328 ===ba===
11329 ===bb===
11330 ====bba====
11331 ===bc===
11332 ==c==
11333 ===ca===
11334 !! result
11335 ===aa===
11336 ====aaa====
11337 !! end
11338
11339 !! test
11340 Section extraction test (section 3)
11341 !! options
11342 section=3
11343 !! input
11344 start
11345 ==a==
11346 ===aa===
11347 ====aaa====
11348 ==b==
11349 ===ba===
11350 ===bb===
11351 ====bba====
11352 ===bc===
11353 ==c==
11354 ===ca===
11355 !! result
11356 ====aaa====
11357 !! end
11358
11359 !! test
11360 Section extraction test (section 4)
11361 !! options
11362 section=4
11363 !! input
11364 start
11365 ==a==
11366 ===aa===
11367 ====aaa====
11368 ==b==
11369 ===ba===
11370 ===bb===
11371 ====bba====
11372 ===bc===
11373 ==c==
11374 ===ca===
11375 !! result
11376 ==b==
11377 ===ba===
11378 ===bb===
11379 ====bba====
11380 ===bc===
11381 !! end
11382
11383 !! test
11384 Section extraction test (section 5)
11385 !! options
11386 section=5
11387 !! input
11388 start
11389 ==a==
11390 ===aa===
11391 ====aaa====
11392 ==b==
11393 ===ba===
11394 ===bb===
11395 ====bba====
11396 ===bc===
11397 ==c==
11398 ===ca===
11399 !! result
11400 ===ba===
11401 !! end
11402
11403 !! test
11404 Section extraction test (section 6)
11405 !! options
11406 section=6
11407 !! input
11408 start
11409 ==a==
11410 ===aa===
11411 ====aaa====
11412 ==b==
11413 ===ba===
11414 ===bb===
11415 ====bba====
11416 ===bc===
11417 ==c==
11418 ===ca===
11419 !! result
11420 ===bb===
11421 ====bba====
11422 !! end
11423
11424 !! test
11425 Section extraction test (section 7)
11426 !! options
11427 section=7
11428 !! input
11429 start
11430 ==a==
11431 ===aa===
11432 ====aaa====
11433 ==b==
11434 ===ba===
11435 ===bb===
11436 ====bba====
11437 ===bc===
11438 ==c==
11439 ===ca===
11440 !! result
11441 ====bba====
11442 !! end
11443
11444 !! test
11445 Section extraction test (section 8)
11446 !! options
11447 section=8
11448 !! input
11449 start
11450 ==a==
11451 ===aa===
11452 ====aaa====
11453 ==b==
11454 ===ba===
11455 ===bb===
11456 ====bba====
11457 ===bc===
11458 ==c==
11459 ===ca===
11460 !! result
11461 ===bc===
11462 !! end
11463
11464 !! test
11465 Section extraction test (section 9)
11466 !! options
11467 section=9
11468 !! input
11469 start
11470 ==a==
11471 ===aa===
11472 ====aaa====
11473 ==b==
11474 ===ba===
11475 ===bb===
11476 ====bba====
11477 ===bc===
11478 ==c==
11479 ===ca===
11480 !! result
11481 ==c==
11482 ===ca===
11483 !! end
11484
11485 !! test
11486 Section extraction test (section 10)
11487 !! options
11488 section=10
11489 !! input
11490 start
11491 ==a==
11492 ===aa===
11493 ====aaa====
11494 ==b==
11495 ===ba===
11496 ===bb===
11497 ====bba====
11498 ===bc===
11499 ==c==
11500 ===ca===
11501 !! result
11502 ===ca===
11503 !! end
11504
11505 !! test
11506 Section extraction test (nonexistent section 11)
11507 !! options
11508 section=11
11509 !! input
11510 start
11511 ==a==
11512 ===aa===
11513 ====aaa====
11514 ==b==
11515 ===ba===
11516 ===bb===
11517 ====bba====
11518 ===bc===
11519 ==c==
11520 ===ca===
11521 !! result
11522 !! end
11523
11524 !! test
11525 Section extraction test with bogus heading (section 1)
11526 !! options
11527 section=1
11528 !! input
11529 ==a==
11530 ==bogus== not a legal section
11531 ==b==
11532 !! result
11533 ==a==
11534 ==bogus== not a legal section
11535 !! end
11536
11537 !! test
11538 Section extraction test with bogus heading (section 2)
11539 !! options
11540 section=2
11541 !! input
11542 ==a==
11543 ==bogus== not a legal section
11544 ==b==
11545 !! result
11546 ==b==
11547 !! end
11548
11549 !! test
11550 Section extraction test with comment after heading (section 1)
11551 !! options
11552 section=1
11553 !! input
11554 ==a==
11555 ==b== <!-- -->
11556 ==c==
11557 !! result
11558 ==a==
11559 !! end
11560
11561 !! test
11562 Section extraction test with comment after heading (section 2)
11563 !! options
11564 section=2
11565 !! input
11566 ==a==
11567 ==b== <!-- -->
11568 ==c==
11569 !! result
11570 ==b== <!-- -->
11571 !! end
11572
11573 !! test
11574 Section extraction test with bogus <nowiki> heading (section 1)
11575 !! options
11576 section=1
11577 !! input
11578 ==a==
11579 ==bogus== <nowiki>not a legal section</nowiki>
11580 ==b==
11581 !! result
11582 ==a==
11583 ==bogus== <nowiki>not a legal section</nowiki>
11584 !! end
11585
11586 !! test
11587 Section extraction test with bogus <nowiki> heading (section 2)
11588 !! options
11589 section=2
11590 !! input
11591 ==a==
11592 ==bogus== <nowiki>not a legal section</nowiki>
11593 ==b==
11594 !! result
11595 ==b==
11596 !! end
11597
11598
11599 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
11600 # instead of respecting commented sections
11601 !! test
11602 Section extraction prefixed by comment (section 1)
11603 !! options
11604 section=1
11605 !! input
11606 <!-- -->==sec1==
11607 ==sec2==
11608 !!result
11609 ==sec2==
11610 !!end
11611
11612 !! test
11613 Section extraction prefixed by comment (section 2)
11614 !! options
11615 section=2
11616 !! input
11617 <!-- -->==sec1==
11618 ==sec2==
11619 !!result
11620
11621 !!end
11622
11623
11624 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
11625 # instead of respecting HTML-style headings
11626 !! test
11627 Section extraction, mixed wiki and html (section 1)
11628 !! options
11629 section=1
11630 !! input
11631 <h2>unmarked</h2>
11632 unmarked
11633 ==1==
11634 one
11635 ==2==
11636 two
11637 !! result
11638 ==1==
11639 one
11640 !! end
11641
11642 !! test
11643 Section extraction, mixed wiki and html (section 2)
11644 !! options
11645 section=2
11646 !! input
11647 <h2>unmarked</h2>
11648 unmarked
11649 ==1==
11650 one
11651 ==2==
11652 two
11653 !! result
11654 ==2==
11655 two
11656 !! end
11657
11658
11659 # Formerly testing for bug 3342
11660 !! test
11661 Section extraction, heading surrounded by <noinclude>
11662 !! options
11663 section=1
11664 !! input
11665 <noinclude>==unmarked==</noinclude>
11666 ==marked==
11667 !! result
11668 ==marked==
11669 !!end
11670
11671 # Test behavior of bug 19910
11672 !! test
11673 Sectiion with all-equals
11674 !! options
11675 section=2
11676 !! input
11677 ===
11678 The line above must have a trailing space
11679 === <!--
11680 --> <!-- -->
11681 But just in case it doesn't...
11682 !! result
11683 === <!--
11684 --> <!-- -->
11685 But just in case it doesn't...
11686 !! end
11687
11688 !! test
11689 Section replacement test (section 0)
11690 !! options
11691 replace=0,"xxx"
11692 !! input
11693 start
11694 ==a==
11695 ===aa===
11696 ====aaa====
11697 ==b==
11698 ===ba===
11699 ===bb===
11700 ====bba====
11701 ===bc===
11702 ==c==
11703 ===ca===
11704 !! result
11705 xxx
11706
11707 ==a==
11708 ===aa===
11709 ====aaa====
11710 ==b==
11711 ===ba===
11712 ===bb===
11713 ====bba====
11714 ===bc===
11715 ==c==
11716 ===ca===
11717 !! end
11718
11719 !! test
11720 Section replacement test (section 1)
11721 !! options
11722 replace=1,"xxx"
11723 !! input
11724 start
11725 ==a==
11726 ===aa===
11727 ====aaa====
11728 ==b==
11729 ===ba===
11730 ===bb===
11731 ====bba====
11732 ===bc===
11733 ==c==
11734 ===ca===
11735 !! result
11736 start
11737 xxx
11738
11739 ==b==
11740 ===ba===
11741 ===bb===
11742 ====bba====
11743 ===bc===
11744 ==c==
11745 ===ca===
11746 !! end
11747
11748 !! test
11749 Section replacement test (section 2)
11750 !! options
11751 replace=2,"xxx"
11752 !! input
11753 start
11754 ==a==
11755 ===aa===
11756 ====aaa====
11757 ==b==
11758 ===ba===
11759 ===bb===
11760 ====bba====
11761 ===bc===
11762 ==c==
11763 ===ca===
11764 !! result
11765 start
11766 ==a==
11767 xxx
11768
11769 ==b==
11770 ===ba===
11771 ===bb===
11772 ====bba====
11773 ===bc===
11774 ==c==
11775 ===ca===
11776 !! end
11777
11778 !! test
11779 Section replacement test (section 3)
11780 !! options
11781 replace=3,"xxx"
11782 !! input
11783 start
11784 ==a==
11785 ===aa===
11786 ====aaa====
11787 ==b==
11788 ===ba===
11789 ===bb===
11790 ====bba====
11791 ===bc===
11792 ==c==
11793 ===ca===
11794 !! result
11795 start
11796 ==a==
11797 ===aa===
11798 xxx
11799
11800 ==b==
11801 ===ba===
11802 ===bb===
11803 ====bba====
11804 ===bc===
11805 ==c==
11806 ===ca===
11807 !! end
11808
11809 !! test
11810 Section replacement test (section 4)
11811 !! options
11812 replace=4,"xxx"
11813 !! input
11814 start
11815 ==a==
11816 ===aa===
11817 ====aaa====
11818 ==b==
11819 ===ba===
11820 ===bb===
11821 ====bba====
11822 ===bc===
11823 ==c==
11824 ===ca===
11825 !! result
11826 start
11827 ==a==
11828 ===aa===
11829 ====aaa====
11830 xxx
11831
11832 ==c==
11833 ===ca===
11834 !! end
11835
11836 !! test
11837 Section replacement test (section 5)
11838 !! options
11839 replace=5,"xxx"
11840 !! input
11841 start
11842 ==a==
11843 ===aa===
11844 ====aaa====
11845 ==b==
11846 ===ba===
11847 ===bb===
11848 ====bba====
11849 ===bc===
11850 ==c==
11851 ===ca===
11852 !! result
11853 start
11854 ==a==
11855 ===aa===
11856 ====aaa====
11857 ==b==
11858 xxx
11859
11860 ===bb===
11861 ====bba====
11862 ===bc===
11863 ==c==
11864 ===ca===
11865 !! end
11866
11867 !! test
11868 Section replacement test (section 6)
11869 !! options
11870 replace=6,"xxx"
11871 !! input
11872 start
11873 ==a==
11874 ===aa===
11875 ====aaa====
11876 ==b==
11877 ===ba===
11878 ===bb===
11879 ====bba====
11880 ===bc===
11881 ==c==
11882 ===ca===
11883 !! result
11884 start
11885 ==a==
11886 ===aa===
11887 ====aaa====
11888 ==b==
11889 ===ba===
11890 xxx
11891
11892 ===bc===
11893 ==c==
11894 ===ca===
11895 !! end
11896
11897 !! test
11898 Section replacement test (section 7)
11899 !! options
11900 replace=7,"xxx"
11901 !! input
11902 start
11903 ==a==
11904 ===aa===
11905 ====aaa====
11906 ==b==
11907 ===ba===
11908 ===bb===
11909 ====bba====
11910 ===bc===
11911 ==c==
11912 ===ca===
11913 !! result
11914 start
11915 ==a==
11916 ===aa===
11917 ====aaa====
11918 ==b==
11919 ===ba===
11920 ===bb===
11921 xxx
11922
11923 ===bc===
11924 ==c==
11925 ===ca===
11926 !! end
11927
11928 !! test
11929 Section replacement test (section 8)
11930 !! options
11931 replace=8,"xxx"
11932 !! input
11933 start
11934 ==a==
11935 ===aa===
11936 ====aaa====
11937 ==b==
11938 ===ba===
11939 ===bb===
11940 ====bba====
11941 ===bc===
11942 ==c==
11943 ===ca===
11944 !! result
11945 start
11946 ==a==
11947 ===aa===
11948 ====aaa====
11949 ==b==
11950 ===ba===
11951 ===bb===
11952 ====bba====
11953 xxx
11954
11955 ==c==
11956 ===ca===
11957 !!end
11958
11959 !! test
11960 Section replacement test (section 9)
11961 !! options
11962 replace=9,"xxx"
11963 !! input
11964 start
11965 ==a==
11966 ===aa===
11967 ====aaa====
11968 ==b==
11969 ===ba===
11970 ===bb===
11971 ====bba====
11972 ===bc===
11973 ==c==
11974 ===ca===
11975 !! result
11976 start
11977 ==a==
11978 ===aa===
11979 ====aaa====
11980 ==b==
11981 ===ba===
11982 ===bb===
11983 ====bba====
11984 ===bc===
11985 xxx
11986 !! end
11987
11988 !! test
11989 Section replacement test (section 10)
11990 !! options
11991 replace=10,"xxx"
11992 !! input
11993 start
11994 ==a==
11995 ===aa===
11996 ====aaa====
11997 ==b==
11998 ===ba===
11999 ===bb===
12000 ====bba====
12001 ===bc===
12002 ==c==
12003 ===ca===
12004 !! result
12005 start
12006 ==a==
12007 ===aa===
12008 ====aaa====
12009 ==b==
12010 ===ba===
12011 ===bb===
12012 ====bba====
12013 ===bc===
12014 ==c==
12015 xxx
12016 !! end
12017
12018 !! test
12019 Section replacement test with initial whitespace (bug 13728)
12020 !! options
12021 replace=2,"xxx"
12022 !! input
12023 Preformatted initial line
12024 ==a==
12025 ===a===
12026 !! result
12027 Preformatted initial line
12028 ==a==
12029 xxx
12030 !! end
12031
12032
12033 !! test
12034 Section extraction, heading followed by pre with 20 spaces (bug 6398)
12035 !! options
12036 section=1
12037 !! input
12038 ==a==
12039 a
12040 !! result
12041 ==a==
12042 a
12043 !! end
12044
12045 !! test
12046 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
12047 !! options
12048 section=1
12049 !! input
12050 ==a==
12051 a
12052 !! result
12053 ==a==
12054 a
12055 !! end
12056
12057
12058 !! test
12059 Section extraction, <pre> around bogus header (bug 10309)
12060 !! options
12061 noxml section=2
12062 !! input
12063 == Section One ==
12064 <pre>
12065 =======
12066 </pre>
12067
12068 == Section Two ==
12069 stuff
12070 !! result
12071 == Section Two ==
12072 stuff
12073 !! end
12074
12075 !! test
12076 Section replacement, <pre> around bogus header (bug 10309)
12077 !! options
12078 noxml replace=2,"xxx"
12079 !! input
12080 == Section One ==
12081 <pre>
12082 =======
12083 </pre>
12084
12085 == Section Two ==
12086 stuff
12087 !! result
12088 == Section One ==
12089 <pre>
12090 =======
12091 </pre>
12092
12093 xxx
12094 !! end
12095
12096
12097
12098 !! test
12099 Handling of &#x0A; in URLs
12100 !! input
12101 **irc://&#x0A;a
12102 !! result
12103 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
12104 </li></ul>
12105 </li></ul>
12106
12107 !!end
12108
12109 !! test
12110 5 quotes, code coverage +1 line (php)
12111 !! options
12112 php
12113 !! input
12114 '''''
12115 !! result
12116 !! end
12117 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
12118 !! test
12119 5 quotes, code coverage +1 line (parsoid)
12120 !! options
12121 parsoid
12122 !! input
12123 '''''
12124 !! result
12125 <p><i><b></b></i></p>
12126 !! end
12127
12128 !! test
12129 Special:Search page linking.
12130 !! input
12131 {{Special:search}}
12132 !! result
12133 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
12134 </p>
12135 !! end
12136
12137 !! test
12138 Say the magic word
12139 !! input
12140 * {{PAGENAME}}
12141 * {{BASEPAGENAME}}
12142 * {{SUBPAGENAME}}
12143 * {{SUBPAGENAMEE}}
12144 * {{ROOTPAGENAME}}
12145 * {{ROOTPAGENAMEE}}
12146 * {{BASEPAGENAME}}
12147 * {{BASEPAGENAMEE}}
12148 * {{TALKPAGENAME}}
12149 * {{TALKPAGENAMEE}}
12150 * {{SUBJECTPAGENAME}}
12151 * {{SUBJECTPAGENAMEE}}
12152 * {{NAMESPACEE}}
12153 * {{NAMESPACE}}
12154 * {{TALKSPACE}}
12155 * {{TALKSPACEE}}
12156 * {{SUBJECTSPACE}}
12157 * {{SUBJECTSPACEE}}
12158 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
12159 !! result
12160 <ul><li> Parser test
12161 </li><li> Parser test
12162 </li><li> Parser test
12163 </li><li> Parser_test
12164 </li><li> Parser test
12165 </li><li> Parser_test
12166 </li><li> Parser test
12167 </li><li> Parser_test
12168 </li><li> Talk:Parser test
12169 </li><li> Talk:Parser_test
12170 </li><li> Parser test
12171 </li><li> Parser_test
12172 </li><li>
12173 </li><li>
12174 </li><li> Talk
12175 </li><li> Talk
12176 </li><li>
12177 </li><li>
12178 </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>
12179 </li></ul>
12180
12181 !! end
12182 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
12183
12184 !! test
12185 Gallery
12186 !! input
12187 <gallery>
12188 image1.png |
12189 image2.gif|||||
12190
12191 image3|
12192 image4 |300px| centre
12193 image5.svg| http://///////
12194 [[x|xx]]]]
12195 * image6
12196 </gallery>
12197 !! result
12198 <ul class="gallery">
12199 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12200 <div style="height: 150px;">Image1.png</div>
12201 <div class="gallerytext">
12202 </div>
12203 </div></li>
12204 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12205 <div style="height: 150px;">Image2.gif</div>
12206 <div class="gallerytext">
12207 <p>||||
12208 </p>
12209 </div>
12210 </div></li>
12211 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12212 <div style="height: 150px;">Image3</div>
12213 <div class="gallerytext">
12214 </div>
12215 </div></li>
12216 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12217 <div style="height: 150px;">Image4</div>
12218 <div class="gallerytext">
12219 <p>300px| centre
12220 </p>
12221 </div>
12222 </div></li>
12223 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12224 <div style="height: 150px;">Image5.svg</div>
12225 <div class="gallerytext">
12226 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
12227 </p>
12228 </div>
12229 </div></li>
12230 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12231 <div style="height: 150px;">* image6</div>
12232 <div class="gallerytext">
12233 </div>
12234 </div></li>
12235 </ul>
12236
12237 !! end
12238
12239 !! test
12240 Gallery (with options)
12241 !! input
12242 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
12243 File:Nonexistant.jpg|caption
12244 File:Nonexistant.jpg
12245 image:foobar.jpg|some '''caption''' [[Main Page]]
12246 image:foobar.jpg
12247 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
12248 </gallery>
12249 !! result
12250 <ul class="gallery" style="max-width: 226px;_width: 226px;">
12251 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
12252 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12253 <div style="height: 70px;">Nonexistant.jpg</div>
12254 <div class="gallerytext">
12255 <p>caption
12256 </p>
12257 </div>
12258 </div></li>
12259 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12260 <div style="height: 70px;">Nonexistant.jpg</div>
12261 <div class="gallerytext">
12262 </div>
12263 </div></li>
12264 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12265 <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>
12266 <div class="gallerytext">
12267 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12268 </p>
12269 </div>
12270 </div></li>
12271 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12272 <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>
12273 <div class="gallerytext">
12274 </div>
12275 </div></li>
12276 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12277 <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>
12278 <div class="gallerytext">
12279 <p>Blabla|blabla.
12280 </p>
12281 </div>
12282 </div></li>
12283 </ul>
12284
12285 !! end
12286
12287 !! test
12288 Gallery with wikitext inside caption
12289 !! input
12290 <gallery>
12291 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
12292 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
12293 </gallery>
12294 !! result
12295 <ul class="gallery">
12296 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12297 <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>
12298 <div class="gallerytext">
12299 <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>
12300 </p>
12301 </div>
12302 </div></li>
12303 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12304 <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>
12305 <div class="gallerytext">
12306 <p>This is a test template
12307 </p>
12308 </div>
12309 </div></li>
12310 </ul>
12311
12312 !! end
12313
12314 !! test
12315 gallery (with showfilename option)
12316 !! input
12317 <gallery showfilename>
12318 File:Nonexistant.jpg|caption
12319 File:Nonexistant.jpg
12320 image:foobar.jpg|some '''caption''' [[Main Page]]
12321 File:Foobar.jpg
12322 </gallery>
12323 !! result
12324 <ul class="gallery">
12325 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12326 <div style="height: 150px;">Nonexistant.jpg</div>
12327 <div class="gallerytext">
12328 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12329 caption
12330 </p>
12331 </div>
12332 </div></li>
12333 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12334 <div style="height: 150px;">Nonexistant.jpg</div>
12335 <div class="gallerytext">
12336 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12337 </p>
12338 </div>
12339 </div></li>
12340 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12341 <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>
12342 <div class="gallerytext">
12343 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12344 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12345 </p>
12346 </div>
12347 </div></li>
12348 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12349 <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>
12350 <div class="gallerytext">
12351 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12352 </p>
12353 </div>
12354 </div></li>
12355 </ul>
12356
12357 !! end
12358
12359 !! test
12360 Gallery (with namespace-less filenames)
12361 !! input
12362 <gallery>
12363 File:Nonexistant.jpg
12364 Nonexistant.jpg
12365 image:foobar.jpg
12366 foobar.jpg
12367 </gallery>
12368 !! result
12369 <ul class="gallery">
12370 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12371 <div style="height: 150px;">Nonexistant.jpg</div>
12372 <div class="gallerytext">
12373 </div>
12374 </div></li>
12375 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12376 <div style="height: 150px;">Nonexistant.jpg</div>
12377 <div class="gallerytext">
12378 </div>
12379 </div></li>
12380 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12381 <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>
12382 <div class="gallerytext">
12383 </div>
12384 </div></li>
12385 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12386 <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>
12387 <div class="gallerytext">
12388 </div>
12389 </div></li>
12390 </ul>
12391
12392 !! end
12393
12394 !! test
12395 HTML Hex character encoding (spells the word "JavaScript")
12396 !! input
12397 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
12398 !! result
12399 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
12400 </p>
12401 !! end
12402
12403 !! test
12404 HTML Hex character encoding bogus encoding (bug 26437 regression check)
12405 !! input
12406 &#xsee;&#XSEE;
12407 !! result
12408 <p>&amp;#xsee;&amp;#XSEE;
12409 </p>
12410 !! end
12411
12412 !! test
12413 HTML Hex character encoding mixed case
12414 !! input
12415 &#xEE;&#Xee;
12416 !! result
12417 <p>&#xee;&#xee;
12418 </p>
12419 !! end
12420
12421 !! test
12422 __FORCETOC__ override
12423 !! input
12424 __NEWSECTIONLINK__
12425 __FORCETOC__
12426 !! result
12427 <p><br />
12428 </p>
12429 !! end
12430
12431 !! test
12432 ISBN code coverage
12433 !! input
12434 ISBN 978-0-1234-56&#x20;789
12435 !! result
12436 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
12437 </p>
12438 !! end
12439
12440 !! test
12441 ISBN followed by 5 spaces
12442 !! input
12443 ISBN
12444 !! result
12445 <p>ISBN
12446 </p>
12447 !! end
12448
12449 !! test
12450 Double ISBN
12451 !! input
12452 ISBN ISBN 1234567890
12453 !! result
12454 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
12455 </p>
12456 !! end
12457
12458 !! test
12459 Bug 22905: <abbr> followed by ISBN followed by </a>
12460 !! input
12461 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
12462 !! result
12463 <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>
12464 </p>
12465 !! end
12466
12467 !! test
12468 Double RFC
12469 !! input
12470 RFC RFC 1234
12471 !! result
12472 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
12473 </p>
12474 !! end
12475
12476 !! test
12477 Double RFC with a wiki link
12478 !! input
12479 RFC [[RFC 1234]]
12480 !! result
12481 <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>
12482 </p>
12483 !! end
12484
12485 !! test
12486 RFC code coverage
12487 !! input
12488 RFC 983&#x20;987
12489 !! result
12490 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
12491 </p>
12492 !! end
12493
12494 !! test
12495 Centre-aligned image
12496 !! input
12497 [[Image:foobar.jpg|centre]]
12498 !! result
12499 <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>
12500
12501 !!end
12502
12503 !! test
12504 None-aligned image
12505 !! input
12506 [[Image:foobar.jpg|none]]
12507 !! result
12508 <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>
12509
12510 !!end
12511
12512 !! test
12513 Width + Height sized image (using px) (height is ignored)
12514 !! input
12515 [[Image:foobar.jpg|640x480px]]
12516 !! result
12517 <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>
12518 </p>
12519 !!end
12520
12521 !! test
12522 Width-sized image (using px, no following whitespace)
12523 !! input
12524 [[Image:foobar.jpg|640px]]
12525 !! result
12526 <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>
12527 </p>
12528 !!end
12529
12530 !! test
12531 Width-sized image (using px, with following whitespace - test regression from r39467)
12532 !! input
12533 [[Image:foobar.jpg|640px ]]
12534 !! result
12535 <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>
12536 </p>
12537 !!end
12538
12539 !! test
12540 Width-sized image (using px, with preceding whitespace - test regression from r39467)
12541 !! input
12542 [[Image:foobar.jpg| 640px]]
12543 !! result
12544 <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>
12545 </p>
12546 !!end
12547
12548 !! test
12549 Another italics / bold test
12550 !! input
12551 ''' ''x'
12552 !! result
12553 <pre>'<i> </i>x'
12554 </pre>
12555 !!end
12556
12557 # Note the results may be incorrect, as parserTest output included this:
12558 # XML error: Mismatched tag at byte 6120:
12559 # ...<dd> </dt></dl> </dd...
12560 !! test
12561 dt/dd/dl test
12562 !! options
12563 disabled
12564 !! input
12565 :;;;::
12566 !! result
12567 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
12568 </dd></dl>
12569 </dd></dl>
12570 </dt></dl>
12571 </dt></dl>
12572 </dt></dl>
12573 </dd></dl>
12574
12575 !!end
12576
12577
12578 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
12579 !! test
12580 Images with the "|" character in the comment
12581 !! input
12582 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
12583 !! result
12584 <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>
12585
12586 !!end
12587
12588 !! test
12589 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
12590 !! input
12591 <html><script>alert(1);</script></html>
12592 !! result
12593 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
12594 </p>
12595 !! end
12596
12597 !! test
12598 HTML with raw HTML ($wgRawHtml==true)
12599 !! options
12600 wgRawHtml=1
12601 !! input
12602 <html><script>alert(1);</script></html>
12603 !! result
12604 <p><script>alert(1);</script>
12605 </p>
12606 !! end
12607
12608 !! test
12609 Parents of subpages, one level up
12610 !! options
12611 subpage title=[[Subpage test/L1/L2/L3]]
12612 !! input
12613 [[../|L2]]
12614 !! result
12615 <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>
12616 </p>
12617 !! end
12618
12619
12620 !! test
12621 Parents of subpages, one level up, not named
12622 !! options
12623 subpage title=[[Subpage test/L1/L2/L3]]
12624 !! input
12625 [[../]]
12626 !! result
12627 <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>
12628 </p>
12629 !! end
12630
12631
12632
12633 !! test
12634 Parents of subpages, two levels up
12635 !! options
12636 subpage title=[[Subpage test/L1/L2/L3]]
12637 !! input
12638 [[../../|L1]]2
12639
12640 [[../../|L1]]l
12641 !! result
12642 <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
12643 </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>
12644 </p>
12645 !! end
12646
12647 !! test
12648 Parents of subpages, two levels up, without trailing slash or name.
12649 !! options
12650 subpage title=[[Subpage test/L1/L2/L3]]
12651 !! input
12652 [[../..]]
12653 !! result
12654 <p>[[../..]]
12655 </p>
12656 !! end
12657
12658 !! test
12659 Parents of subpages, two levels up, with lots of extra trailing slashes.
12660 !! options
12661 subpage title=[[Subpage test/L1/L2/L3]]
12662 !! input
12663 [[../../////]]
12664 !! result
12665 <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>
12666 </p>
12667 !! end
12668
12669 !! article
12670 Subpage test/L1/L2/L3Sibling
12671 !! text
12672 Sibling article
12673 !! endarticle
12674
12675 !! test
12676 Transclusion of a sibling page (one level up)
12677 !! options
12678 subpage title=[[Subpage test/L1/L2/L3]]
12679 !! input
12680 {{../L3Sibling}}
12681 !! result
12682 <p>Sibling article
12683 </p>
12684 !! end
12685
12686 !! test
12687 Transclusion of a child page
12688 !! options
12689 subpage title=[[Subpage test/L1/L2]]
12690 !! input
12691 {{/L3Sibling}}
12692 !! result
12693 <p>Sibling article
12694 </p>
12695 !! end
12696
12697 !! test
12698 Non-transclusion because of too many up levels
12699 !! options
12700 subpage title=[[Subpage test/L1/L2/L3]]
12701 !! input
12702 {{../../../../More than parent}}
12703 !! result
12704 <p>{{../../../../More than parent}}
12705 </p>
12706 !! end
12707
12708 !! test
12709 Definition list code coverage
12710 !! input
12711 ; title : def
12712 ; title : def
12713 ;title: def
12714 !! result
12715 <dl><dt> title &#160;</dt><dd> def
12716 </dd><dt> title&#160;</dt><dd> def
12717 </dd><dt>title</dt><dd> def
12718 </dd></dl>
12719
12720 !! end
12721
12722 !! test
12723 Don't fall for the self-closing div
12724 !! input
12725 <div>hello world</div/>
12726 !! result
12727 <div>hello world</div>
12728
12729 !! end
12730
12731 !! test
12732 MSGNW magic word
12733 !! input
12734 {{MSGNW:msg}}
12735 !! result
12736 <p>&#91;&#91;:Template:Msg&#93;&#93;
12737 </p>
12738 !! end
12739
12740 !! test
12741 RAW magic word
12742 !! input
12743 {{RAW:QUERTY}}
12744 !! result
12745 <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>
12746 </p>
12747 !! end
12748
12749 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
12750 !! test
12751 Always escape literal '>' in output, not just after '<'
12752 !! input
12753 ><>
12754 !! result
12755 <p>&gt;&lt;&gt;
12756 </p>
12757 !! end
12758
12759 !! test
12760 Template caching
12761 !! input
12762 {{Test}}
12763 {{Test}}
12764 !! result
12765 <p>This is a test template
12766 This is a test template
12767 </p>
12768 !! end
12769
12770
12771 !! article
12772 MediaWiki:Fake
12773 !! text
12774 ==header==
12775 !! endarticle
12776
12777 !! test
12778 Inclusion of !userCanEdit() content
12779 !! input
12780 {{MediaWiki:Fake}}
12781 !! result
12782 <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>
12783
12784 !! end
12785
12786
12787 !! test
12788 Out-of-order TOC heading levels
12789 !! input
12790 ==2==
12791 ======6======
12792 ===3===
12793 =1=
12794 =====5=====
12795 ==2==
12796 !! result
12797 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12798 <ul>
12799 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
12800 <ul>
12801 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
12802 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
12803 </ul>
12804 </li>
12805 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
12806 <ul>
12807 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
12808 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
12809 </ul>
12810 </li>
12811 </ul>
12812 </div>
12813 <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>
12814 <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>
12815 <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>
12816 <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>
12817 <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>
12818 <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>
12819
12820 !! end
12821
12822
12823 !! test
12824 ISBN with a dummy number
12825 !! input
12826 ISBN ---
12827 !! result
12828 <p>ISBN ---
12829 </p>
12830 !! end
12831
12832
12833 !! test
12834 ISBN with space-delimited number
12835 !! input
12836 ISBN 92 9017 032 8
12837 !! result
12838 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
12839 </p>
12840 !! end
12841
12842
12843 !! test
12844 ISBN with multiple spaces, no number
12845 !! input
12846 ISBN foo
12847 !! result
12848 <p>ISBN foo
12849 </p>
12850 !! end
12851
12852
12853 !! test
12854 ISBN length
12855 !! input
12856 ISBN 123456789
12857
12858 ISBN 1234567890
12859
12860 ISBN 12345678901
12861 !! result
12862 <p>ISBN 123456789
12863 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
12864 </p><p>ISBN 12345678901
12865 </p>
12866 !! end
12867
12868
12869 !! test
12870 ISBN with trailing year (bug 8110)
12871 !! input
12872 ISBN 1-234-56789-0 - 2006
12873
12874 ISBN 1 234 56789 0 - 2006
12875 !! result
12876 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
12877 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
12878 </p>
12879 !! end
12880
12881
12882 !! test
12883 anchorencode
12884 !! input
12885 {{anchorencode:foo bar©#%n}}
12886 !! result
12887 <p>foo_bar.C2.A9.23.25n
12888 </p>
12889 !! end
12890
12891 !! test
12892 anchorencode trims spaces
12893 !! input
12894 {{anchorencode: __pretty__please__}}
12895 !! result
12896 <p>pretty_please
12897 </p>
12898 !! end
12899
12900 !! test
12901 anchorencode deals with links
12902 !! input
12903 {{anchorencode: [[hello|world]] [[hi]]}}
12904 !! result
12905 <p>world_hi
12906 </p>
12907 !! end
12908
12909 !! test
12910 anchorencode deals with templates
12911 !! input
12912 {{anchorencode: {{Foo}} }}
12913 !! result
12914 <p>FOO
12915 </p>
12916 !! end
12917
12918 !! test
12919 anchorencode encodes like the TOC generator: (bug 18431)
12920 !! input
12921 === _ +:.3A%3A&&amp;]] ===
12922 {{anchorencode: _ +:.3A%3A&&amp;]] }}
12923 __NOEDITSECTION__
12924 !! result
12925 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
12926 <p>.2B:.3A.253A.26.26.5D.5D
12927 </p>
12928 !! end
12929
12930 !! test
12931 Bug 6200: blockquotes and paragraph formatting
12932 !! input
12933 <blockquote>
12934 foo
12935 </blockquote>
12936
12937 bar
12938
12939 baz
12940 !! result
12941 <blockquote>
12942 <p>foo
12943 </p>
12944 </blockquote>
12945 <p>bar
12946 </p>
12947 <pre>baz
12948 </pre>
12949 !! end
12950
12951 !! test
12952 Bug 8293: Use of center tag ruins paragraph formatting
12953 !! input
12954 <center>
12955 foo
12956 </center>
12957
12958 bar
12959
12960 baz
12961 !! result
12962 <center>
12963 <p>foo
12964 </p>
12965 </center>
12966 <p>bar
12967 </p>
12968 <pre>baz
12969 </pre>
12970 !! end
12971
12972 !!test
12973 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
12974 !!options
12975 php
12976 !!input
12977 <span><s>x</span></s>
12978 !!result
12979 <p><span><s>x&lt;/span&gt;</s></span>
12980 </p>
12981 !!end
12982
12983 !!test
12984 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
12985 !!options
12986 parsoid
12987 !!input
12988 <span><s>x</span></s>
12989 !!result
12990 <p><span><s>x</s></span><s></s>
12991 </p>
12992 !!end
12993
12994 ###
12995 ### Language variants related tests
12996 ###
12997 !! test
12998 Self-link in language variants
12999 !! options
13000 title=[[Dunav]] language=sr
13001 !! input
13002 Both [[Dunav]] and [[Дунав]] are names for this river.
13003 !! result
13004 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
13005 </p>
13006 !!end
13007
13008 !! article
13009 Дуна
13010 !! text
13011 content
13012 !! endarticle
13013
13014 !! test
13015 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
13016 !! options
13017 title=[[Duna]] language=sr
13018 !! input
13019 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
13020 !! result
13021 <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.
13022 </p>
13023 !! end
13024
13025 !! test
13026 Link to pages in language variants
13027 !! options
13028 language=sr
13029 !! input
13030 Main Page can be written as [[Маин Паге]]
13031 !! result
13032 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
13033 </p>
13034 !!end
13035
13036
13037 !! test
13038 Multiple links to pages in language variants
13039 !! options
13040 language=sr
13041 !! input
13042 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
13043 !! result
13044 <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>.
13045 </p>
13046 !!end
13047
13048
13049 !! test
13050 Simple template in language variants
13051 !! options
13052 language=sr
13053 !! input
13054 {{тест}}
13055 !! result
13056 <p>This is a test template
13057 </p>
13058 !! end
13059
13060
13061 !! test
13062 Template with explicit namespace in language variants
13063 !! options
13064 language=sr
13065 !! input
13066 {{Template:тест}}
13067 !! result
13068 <p>This is a test template
13069 </p>
13070 !! end
13071
13072
13073 !! test
13074 Basic test for template parameter in language variants
13075 !! options
13076 language=sr
13077 !! input
13078 {{парамтест|param=foo}}
13079 !! result
13080 <p>This is a test template with parameter foo
13081 </p>
13082 !! end
13083
13084
13085 !! test
13086 Simple category in language variants
13087 !! options
13088 language=sr cat
13089 !! input
13090 [[Category:МедиаWики Усер'с Гуиде]]
13091 !! result
13092 <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>
13093 !! end
13094
13095
13096 !! article
13097 Category:分类
13098 !! text
13099 blah
13100 !! endarticle
13101
13102 !! article
13103 Category:分類
13104 !! text
13105 blah
13106 !! endarticle
13107
13108 !! test
13109 Don't convert blue categorylinks to another variant (bug 33210)
13110 !! options
13111 language=zh cat
13112 !! input
13113 [[A]][[Category:分类]]
13114 !! result
13115 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
13116 !! end
13117
13118
13119 !! test
13120 Stripping -{}- tags (language variants)
13121 !! options
13122 language=sr
13123 !! input
13124 Latin proverb: -{Ne nuntium necare}-
13125 !! result
13126 <p>Latin proverb: Ne nuntium necare
13127 </p>
13128 !! end
13129
13130
13131 !! test
13132 Prevent conversion with -{}- tags (language variants)
13133 !! options
13134 language=sr variant=sr-ec
13135 !! input
13136 Latinski: -{Ne nuntium necare}-
13137 !! result
13138 <p>Латински: Ne nuntium necare
13139 </p>
13140 !! end
13141
13142
13143 !! test
13144 Prevent conversion of text with -{}- tags (language variants)
13145 !! options
13146 language=sr variant=sr-ec
13147 !! input
13148 Latinski: -{Ne nuntium necare}-
13149 !! result
13150 <p>Латински: Ne nuntium necare
13151 </p>
13152 !! end
13153
13154
13155 !! test
13156 Prevent conversion of links with -{}- tags (language variants)
13157 !! options
13158 language=sr variant=sr-ec
13159 !! input
13160 -{[[Main Page]]}-
13161 !! result
13162 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
13163 </p>
13164 !! end
13165
13166
13167 !! test
13168 -{}- tags within headlines (within html for parserConvert())
13169 !! options
13170 language=sr variant=sr-ec
13171 !! input
13172 == -{Naslov}- ==
13173 !! result
13174 <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>
13175
13176 !! end
13177
13178
13179 !! test
13180 Explicit definition of language variant alternatives
13181 !! options
13182 language=zh variant=zh-tw
13183 !! input
13184 -{zh:China;zh-tw:Taiwan}-, not China
13185 !! result
13186 <p>Taiwan, not China
13187 </p>
13188 !! end
13189
13190
13191 !! test
13192 Conversion around HTML tags
13193 !! options
13194 language=sr variant=sr-ec
13195 !! input
13196 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
13197 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
13198 !! result
13199 <p>
13200 <span title="ЛаCтин">ски</span>
13201 </p>
13202 !! end
13203
13204
13205 !! test
13206 Explicit session-wise language variant mapping (A flag and - flag)
13207 !! options
13208 language=zh variant=zh-tw
13209 !! input
13210 Taiwan is not China.
13211 But -{A|zh:China;zh-tw:Taiwan}- is China,
13212 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
13213 and -{China}- is China.
13214 !! result
13215 <p>Taiwan is not China.
13216 But Taiwan is Taiwan,
13217 (This should be stripped!)
13218 and China is China.
13219 </p>
13220 !! end
13221
13222 !! test
13223 Explicit session-wise language variant mapping (H flag for hide)
13224 !! options
13225 language=zh variant=zh-tw
13226 !! input
13227 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
13228 Taiwan is China.
13229 !! result
13230 <p>(This should be stripped!)
13231 Taiwan is Taiwan.
13232 </p>
13233 !! end
13234
13235 !! test
13236 Adding explicit conversion rule for title (T flag)
13237 !! options
13238 language=zh variant=zh-tw showtitle
13239 !! input
13240 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13241 !! result
13242 Taiwan
13243 <p>Should be stripped!
13244 </p>
13245 !! end
13246
13247 !! test
13248 Testing that changing the language variant here in the tests actually works
13249 !! options
13250 language=zh variant=zh showtitle
13251 !! input
13252 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13253 !! result
13254 China
13255 <p>Should be stripped!
13256 </p>
13257 !! end
13258
13259 !! test
13260 Recursive conversion of alt and title attrs shouldn't clear converter state
13261 !! options
13262 language=zh variant=zh-cn showtitle
13263 !! input
13264 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
13265 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
13266 !! result
13267 China
13268 <p>
13269 Should be stripped<span title="Exclamation">!</span>
13270 </p>
13271 !! end
13272
13273 !! test
13274 Bug 24072: more test on conversion rule for title
13275 !! options
13276 language=zh variant=zh-tw showtitle
13277 !! input
13278 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13279 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
13280 !! result
13281 Taiwan
13282 <p>This should be stripped!
13283 This won't take interferes with the title rule.
13284 </p>
13285 !! end
13286
13287 !! test
13288 Partly disable title conversion if variant == main language code
13289 !! options
13290 language=zh variant=zh title=[[ZH]] showtitle
13291 !! input
13292 -{T|zh-cn:CN;zh-tw:TW}-
13293 !! result
13294 ZH
13295 <p>
13296 </p>
13297 !! end
13298
13299 !! test
13300 Partly disable title conversion if variant == main language code, more
13301 !! options
13302 language=zh variant=zh title=[[ZH]] showtitle
13303 !! input
13304 -{T|TW}-
13305 !! result
13306 ZH
13307 <p>
13308 </p>
13309 !! end
13310
13311 !! test
13312 Raw output of variant escape tags (R flag)
13313 !! options
13314 language=zh variant=zh-tw
13315 !! input
13316 Raw: -{R|zh:China;zh-tw:Taiwan}-
13317 !! result
13318 <p>Raw: zh:China;zh-tw:Taiwan
13319 </p>
13320 !! end
13321
13322 !! test
13323 Nested using of manual convert syntax
13324 !! options
13325 language=zh variant=zh-hk
13326 !! input
13327 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
13328 !! result
13329 <p>Nested: Hello Hong Kong!
13330 </p>
13331 !! end
13332
13333 !! test
13334 Proper conversion of text in external links
13335 !! options
13336 language=sr variant=sr-ec
13337 !! input
13338 http://www.google.com
13339 gopher://www.google.com
13340 [http://www.google.com http://www.google.com]
13341 [gopher://www.google.com gopher://www.google.com]
13342 [https://www.google.com irc://www.google.com]
13343 [ftp://www.google.com www.google.com/ftp://dir]
13344 [//www.google.com www.google.com]
13345 !! result
13346 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13347 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13348 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13349 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13350 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
13351 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
13352 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
13353 </p>
13354 !! end
13355
13356 !! test
13357 Do not convert roman numbers to language variants
13358 !! options
13359 language=sr variant=sr-ec
13360 !! input
13361 Fridrih IV je car.
13362 !! result
13363 <p>Фридрих IV је цар.
13364 </p>
13365 !! end
13366
13367 !! test
13368 Unclosed language converter markup "-{"
13369 !! options
13370 language=sr
13371 !! input
13372 -{T|hello
13373 !! result
13374 <p>-{T|hello
13375 </p>
13376 !! end
13377
13378 !! test
13379 Don't convert raw rule "-{R|=&gt;}-" to "=>"
13380 !! options
13381 language=sr
13382 !! input
13383 -{R|=&gt;}-
13384 !! result
13385 <p>=&gt;
13386 </p>
13387 !!end
13388
13389 !!article
13390 Template:Bullet
13391 !!text
13392 * Bar
13393 !!endarticle
13394
13395 !! test
13396 Bug 529: Uncovered bullet
13397 !! input
13398 * Foo {{bullet}}
13399 !! result
13400 <ul><li> Foo
13401 </li><li> Bar
13402 </li></ul>
13403
13404 !! end
13405
13406 # Plain MediaWiki does not remove empty lists, but tidy actually does.
13407 # Templates in Wikipedia rely on this behavior, as tidy has always been
13408 # enabled there. These tests are normally run *without* tidy, so specify the
13409 # full output here.
13410 # To test realistic parsing behavior, apply a tidy-like transformation to both
13411 # the expected output and your parser's output.
13412 !! test
13413 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
13414 !! input
13415 ******* Foo {{bullet}}
13416 !! result
13417 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
13418 </li></ul>
13419 </li></ul>
13420 </li></ul>
13421 </li></ul>
13422 </li></ul>
13423 </li></ul>
13424 </li><li> Bar
13425 </li></ul>
13426
13427 !! end
13428
13429 !! test
13430 Bug 529: Uncovered table already at line-start
13431 !! input
13432 x
13433
13434 {{table}}
13435 y
13436 !! result
13437 <p>x
13438 </p>
13439 <table>
13440 <tr>
13441 <td> 1 </td>
13442 <td> 2
13443 </td></tr>
13444 <tr>
13445 <td> 3 </td>
13446 <td> 4
13447 </td></tr></table>
13448 <p>y
13449 </p>
13450 !! end
13451
13452 !! test
13453 Bug 529: Uncovered bullet in parser function result
13454 !! input
13455 * Foo {{lc:{{bullet}} }}
13456 !! result
13457 <ul><li> Foo
13458 </li><li> bar
13459 </li></ul>
13460
13461 !! end
13462
13463 !! test
13464 Bug 5678: Double-parsed template argument
13465 !! input
13466 {{lc:{{{1}}}|hello}}
13467 !! result
13468 <p>{{{1}}}
13469 </p>
13470 !! end
13471
13472 !! test
13473 Bug 5678: Double-parsed template invocation
13474 !! input
13475 {{lc:{{paramtest {{!}} param = hello }} }}
13476 !! result
13477 <p>{{paramtest | param = hello }}
13478 </p>
13479 !! end
13480
13481 !! test
13482 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
13483 !! options
13484 language=cs
13485 title=[[Main Page]]
13486 !! input
13487 {{PRVNÍVELKÉ:ěščř}}
13488 {{prvnívelké:ěščř}}
13489 {{PRVNÍMALÉ:ěščř}}
13490 {{prvnímalé:ěščř}}
13491 {{MALÁ:ěščř}}
13492 {{malá:ěščř}}
13493 {{VELKÁ:ěščř}}
13494 {{velká:ěščř}}
13495 !! result
13496 <p>Ěščř
13497 Ěščř
13498 ěščř
13499 ěščř
13500 ěščř
13501 ěščř
13502 ĚŠČŘ
13503 ĚŠČŘ
13504 </p>
13505 !! end
13506
13507 !! test
13508 Morwen/13: Unclosed link followed by heading
13509 !! input
13510 [[link
13511 ==heading==
13512 !! result
13513 <p>[[link
13514 </p>
13515 <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>
13516
13517 !! end
13518
13519 !! test
13520 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
13521 !! input
13522 {{foo|
13523 =heading=
13524 !! result
13525 <p>{{foo|
13526 </p>
13527 <h1><span class="mw-headline" id="heading">heading</span></h1>
13528
13529 !! end
13530
13531 !! test
13532 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
13533 !! input
13534 {{foo|
13535 ==heading==
13536 !! result
13537 <p>{{foo|
13538 </p>
13539 <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>
13540
13541 !! end
13542
13543 !! test
13544 Tildes in comments
13545 !! options
13546 pst
13547 !! input
13548 <!-- ~~~~ -->
13549 !! result
13550 <!-- ~~~~ -->
13551 !! end
13552
13553 !! test
13554 Paragraphs inside divs (no extra line breaks)
13555 !! input
13556 <div>Line one
13557
13558 Line two</div>
13559 !! result
13560 <div>Line one
13561 Line two</div>
13562
13563 !! end
13564
13565 !! test
13566 Paragraphs inside divs (extra line break on open)
13567 !! input
13568 <div>
13569 Line one
13570
13571 Line two</div>
13572 !! result
13573 <div>
13574 <p>Line one
13575 </p>
13576 Line two</div>
13577
13578 !! end
13579
13580 !! test
13581 Paragraphs inside divs (extra line break on close)
13582 !! input
13583 <div>Line one
13584
13585 Line two
13586 </div>
13587 !! result
13588 <div>Line one
13589 <p>Line two
13590 </p>
13591 </div>
13592
13593 !! end
13594
13595 !! test
13596 Paragraphs inside divs (extra line break on open and close)
13597 !! input
13598 <div>
13599 Line one
13600
13601 Line two
13602 </div>
13603 !! result
13604 <div>
13605 <p>Line one
13606 </p><p>Line two
13607 </p>
13608 </div>
13609
13610 !! end
13611
13612 !! test
13613 Nesting tags, paragraphs on lines which begin with <div>
13614 !! options
13615 disabled
13616 !! input
13617 <div></div><strong>A
13618 B</strong>
13619 !! result
13620 <div></div>
13621 <p><strong>A
13622 B</strong>
13623 </p>
13624 !! end
13625
13626 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
13627 !! test
13628 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
13629 !! input
13630 <blockquote>Line one
13631
13632 Line two</blockquote>
13633 !! result
13634 <blockquote>Line one
13635 Line two</blockquote>
13636
13637 !! end
13638
13639 !! test
13640 Bug 6200: paragraphs inside blockquotes (extra line break on open)
13641 !! input
13642 <blockquote>
13643 Line one
13644
13645 Line two</blockquote>
13646 !! result
13647 <blockquote>
13648 <p>Line one
13649 </p>
13650 Line two</blockquote>
13651
13652 !! end
13653
13654 !! test
13655 Bug 6200: paragraphs inside blockquotes (extra line break on close)
13656 !! input
13657 <blockquote>Line one
13658
13659 Line two
13660 </blockquote>
13661 !! result
13662 <blockquote>Line one
13663 <p>Line two
13664 </p>
13665 </blockquote>
13666
13667 !! end
13668
13669 !! test
13670 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
13671 !! input
13672 <blockquote>
13673 Line one
13674
13675 Line two
13676 </blockquote>
13677 !! result
13678 <blockquote>
13679 <p>Line one
13680 </p><p>Line two
13681 </p>
13682 </blockquote>
13683
13684 !! end
13685
13686 !! test
13687 Paragraphs inside blockquotes/divs (no extra line breaks)
13688 !! input
13689 <blockquote><div>Line one
13690
13691 Line two</div></blockquote>
13692 !! result
13693 <blockquote><div>Line one
13694 Line two</div></blockquote>
13695
13696 !! end
13697
13698 !! test
13699 Paragraphs inside blockquotes/divs (extra line break on open)
13700 !! input
13701 <blockquote><div>
13702 Line one
13703
13704 Line two</div></blockquote>
13705 !! result
13706 <blockquote><div>
13707 <p>Line one
13708 </p>
13709 Line two</div></blockquote>
13710
13711 !! end
13712
13713 !! test
13714 Paragraphs inside blockquotes/divs (extra line break on close)
13715 !! input
13716 <blockquote><div>Line one
13717
13718 Line two
13719 </div></blockquote>
13720 !! result
13721 <blockquote><div>Line one
13722 <p>Line two
13723 </p>
13724 </div></blockquote>
13725
13726 !! end
13727
13728 !! test
13729 Paragraphs inside blockquotes/divs (extra line break on open and close)
13730 !! input
13731 <blockquote><div>
13732 Line one
13733
13734 Line two
13735 </div></blockquote>
13736 !! result
13737 <blockquote><div>
13738 <p>Line one
13739 </p><p>Line two
13740 </p>
13741 </div></blockquote>
13742
13743 !! end
13744
13745 !! test
13746 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
13747 !! options
13748 wgLinkHolderBatchSize=0
13749 !! input
13750 [[meatball:1]]
13751 [[meatball:2]]
13752 [[meatball:3]]
13753 !! result
13754 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
13755 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
13756 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
13757 </p>
13758 !! end
13759
13760 !! test
13761 Free external link invading image caption
13762 !! input
13763 [[Image:Foobar.jpg|thumb|http://x|hello]]
13764 !! result
13765 <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>
13766
13767 !! end
13768
13769 !! test
13770 Bug 15196: localised external link numbers
13771 !! options
13772 language=fa
13773 !! input
13774 [http://en.wikipedia.org/]
13775 !! result
13776 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
13777 </p>
13778 !! end
13779
13780 !! test
13781 Multibyte character in padleft
13782 !! input
13783 {{padleft:-Hello|7|Æ}}
13784 !! result
13785 <p>Æ-Hello
13786 </p>
13787 !! end
13788
13789 !! test
13790 Multibyte character in padright
13791 !! input
13792 {{padright:Hello-|7|Æ}}
13793 !! result
13794 <p>Hello-Æ
13795 </p>
13796 !! end
13797
13798 !!test
13799 formatdate parser function
13800 !!input
13801 {{#formatdate:2009-03-24}}
13802 !! result
13803 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
13804 </p>
13805 !! end
13806
13807 !!test
13808 formatdate parser function, with default format
13809 !!input
13810 {{#formatdate:2009-03-24|mdy}}
13811 !! result
13812 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
13813 </p>
13814 !! end
13815
13816 !! test
13817 Spacing of numbers in formatted dates
13818 !! input
13819 {{#formatdate:January 15}}
13820 !! result
13821 <p><span class="mw-formatted-date" title="01-15">January 15</span>
13822 </p>
13823 !! end
13824
13825 !! test
13826 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
13827 !! options
13828 language=nl title=[[MediaWiki:Common.css]]
13829 !! input
13830 {{#formatdate:2009-03-24|dmy}}
13831 !! result
13832 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
13833 </p>
13834 !! end
13835
13836 #
13837 #
13838 #
13839
13840 #
13841 # Edit comments
13842 #
13843
13844 !! test
13845 Edit comment with link
13846 !! options
13847 comment
13848 !! input
13849 I like the [[Main Page]] a lot
13850 !! result
13851 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
13852 !!end
13853
13854 !! test
13855 Edit comment with link and link text
13856 !! options
13857 comment
13858 !! input
13859 I like the [[Main Page|best pages]] a lot
13860 !! result
13861 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13862 !!end
13863
13864 !! test
13865 Edit comment with link and link text with suffix
13866 !! options
13867 comment
13868 !! input
13869 I like the [[Main Page|best page]]s a lot
13870 !! result
13871 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13872 !!end
13873
13874 !! test
13875 Edit comment with section link (non-local, eg in history list)
13876 !! options
13877 comment title=[[Main Page]]
13878 !! input
13879 /* External links */ removed bogus entries
13880 !! result
13881 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13882 !!end
13883
13884 !! test
13885 Edit comment with section link and text before it (non-local, eg in history list)
13886 !! options
13887 comment title=[[Main Page]]
13888 !! input
13889 pre-comment text /* External links */ removed bogus entries
13890 !! result
13891 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>
13892 !!end
13893
13894 !! test
13895 Edit comment with section link (local, eg in diff view)
13896 !! options
13897 comment local title=[[Main Page]]
13898 !! input
13899 /* External links */ removed bogus entries
13900 !! result
13901 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13902 !!end
13903
13904 !! test
13905 Edit comment with subpage link (bug 14080)
13906 !! options
13907 comment
13908 subpage
13909 title=[[Subpage test]]
13910 !! input
13911 Poked at a [[/subpage]] here...
13912 !! result
13913 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
13914 !!end
13915
13916 !! test
13917 Edit comment with subpage link and link text (bug 14080)
13918 !! options
13919 comment
13920 subpage
13921 title=[[Subpage test]]
13922 !! input
13923 Poked at a [[/subpage|neat little page]] here...
13924 !! result
13925 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
13926 !!end
13927
13928 !! test
13929 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
13930 !! options
13931 comment
13932 title=[[Subpage test]]
13933 !! input
13934 Poked at a [[/subpage]] here...
13935 !! result
13936 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...
13937 !!end
13938
13939 !! test
13940 Edit comment with bare anchor link (local, as on diff)
13941 !! options
13942 comment
13943 local
13944 title=[[Main Page]]
13945 !!input
13946 [[#section]]
13947 !! result
13948 <a href="#section">#section</a>
13949 !! end
13950
13951 !! test
13952 Edit comment with bare anchor link (non-local, as on history)
13953 !! options
13954 comment
13955 title=[[Main Page]]
13956 !!input
13957 [[#section]]
13958 !! result
13959 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
13960 !! end
13961
13962 !! test
13963 Anchor starting with underscore
13964 !!input
13965 [[#_ref|One]]
13966 !! result
13967 <p><a href="#_ref">One</a>
13968 </p>
13969 !! end
13970
13971 !! test
13972 Id starting with underscore
13973 !!input
13974 <div id="_ref"></div>
13975 !! result
13976 <div id="_ref"></div>
13977
13978 !! end
13979
13980 !! test
13981 Space normalisation on autocomment (bug 22784)
13982 !! options
13983 comment
13984 title=[[Main Page]]
13985 !!input
13986 /* __hello__world__ */
13987 !! result
13988 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
13989 !! end
13990
13991 !! test
13992 percent-encoding and + signs in comments (Bug 26410)
13993 !! options
13994 comment
13995 !!input
13996 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
13997 !! result
13998 <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>
13999 !! end
14000
14001 !! test
14002 Bad images - basic functionality
14003 !! options
14004 disabled
14005 !! input
14006 [[File:Bad.jpg]]
14007 !! result
14008 !! end
14009
14010 !! test
14011 Bad images - bug 16039: text after bad image disappears
14012 !! options
14013 disabled
14014 !! input
14015 Foo bar
14016 [[File:Bad.jpg]]
14017 Bar foo
14018 !! result
14019 <p>Foo bar
14020 </p><p>Bar foo
14021 </p>
14022 !! end
14023
14024 !! test
14025 Verify that displaytitle works (bug #22501) no displaytitle
14026 !! options
14027 showtitle
14028 !! config
14029 wgAllowDisplayTitle=true
14030 wgRestrictDisplayTitle=false
14031 !! input
14032 this is not the the title
14033 !! result
14034 Parser test
14035 <p>this is not the the title
14036 </p>
14037 !! end
14038
14039 !! test
14040 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
14041 !! options
14042 showtitle
14043 title=[[Screen]]
14044 !! config
14045 wgAllowDisplayTitle=true
14046 wgRestrictDisplayTitle=false
14047 !! input
14048 this is not the the title
14049 {{DISPLAYTITLE:whatever}}
14050 !! result
14051 whatever
14052 <p>this is not the the title
14053 </p>
14054 !! end
14055
14056 !! test
14057 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
14058 !! options
14059 showtitle
14060 title=[[Screen]]
14061 !! config
14062 wgAllowDisplayTitle=true
14063 wgRestrictDisplayTitle=true
14064 !! input
14065 this is not the the title
14066 {{DISPLAYTITLE:whatever}}
14067 !! result
14068 Screen
14069 <p>this is not the the title
14070 </p>
14071 !! end
14072
14073 !! test
14074 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
14075 !! options
14076 showtitle
14077 title=[[Screen]]
14078 !! config
14079 wgAllowDisplayTitle=true
14080 wgRestrictDisplayTitle=true
14081 !! input
14082 this is not the the title
14083 {{DISPLAYTITLE:screen}}
14084 !! result
14085 screen
14086 <p>this is not the the title
14087 </p>
14088 !! end
14089
14090 !! test
14091 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
14092 !! options
14093 showtitle
14094 title=[[Screen]]
14095 !! config
14096 wgAllowDisplayTitle=false
14097 !! input
14098 this is not the the title
14099 {{DISPLAYTITLE:screen}}
14100 !! result
14101 Screen
14102 <p>this is not the the title
14103 <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>
14104 </p>
14105 !! end
14106
14107 !! test
14108 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
14109 !! options
14110 showtitle
14111 title=[[Screen]]
14112 !! config
14113 wgAllowDisplayTitle=false
14114 !! input
14115 this is not the the title
14116 !! result
14117 Screen
14118 <p>this is not the the title
14119 </p>
14120 !! end
14121
14122 !! test
14123 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
14124 !! options
14125 showtitle
14126 title=[[Screen]]
14127 !! config
14128 wgAllowDisplayTitle=true
14129 wgRestrictDisplayTitle=true
14130 !! input
14131 this is not the the title
14132 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
14133 !! result
14134 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
14135 <p>this is not the the title
14136 </p>
14137 !! end
14138
14139 !! test
14140 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
14141 !! options
14142 showtitle
14143 title=[[Screen]]
14144 !! config
14145 wgAllowDisplayTitle=true
14146 wgRestrictDisplayTitle=true
14147 !! input
14148 this is not the the title
14149 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
14150 !! result
14151 <span style="color: red;">s</span>creen
14152 <p>this is not the the title
14153 </p>
14154 !! end
14155
14156 !! test
14157 preload: check <noinclude> and <includeonly>
14158 !! options
14159 preload
14160 !! input
14161 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
14162 !! result
14163 Hello kind world.
14164 !! end
14165
14166 !! test
14167 preload: check <onlyinclude>
14168 !! options
14169 preload
14170 !! input
14171 Goodbye <onlyinclude>Hello world</onlyinclude>
14172 !! result
14173 Hello world
14174 !! end
14175
14176 !! test
14177 preload: can pass tags through if we want to
14178 !! options
14179 preload
14180 !! input
14181 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
14182 !! result
14183 <includeonly>Hello world</includeonly>
14184 !! end
14185
14186 !! test
14187 preload: check that it doesn't try to do tricks
14188 !! options
14189 preload
14190 !! input
14191 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
14192 !! result
14193 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
14194 !! end
14195
14196 !! test
14197 Play a bit with r67090 and bug 3158
14198 !! options
14199 disabled
14200 !! input
14201 <div style="width:50% !important">&nbsp;</div>
14202 <div style="width:50%&nbsp;!important">&nbsp;</div>
14203 <div style="width:50%&#160;!important">&nbsp;</div>
14204 <div style="border : solid;">&nbsp;</div>
14205 !! result
14206 <div style="width:50% !important">&nbsp;</div>
14207 <div style="width:50% !important">&nbsp;</div>
14208 <div style="width:50% !important">&nbsp;</div>
14209 <div style="border&#160;: solid;">&nbsp;</div>
14210
14211 !! end
14212
14213 !! test
14214 HTML5 data attributes
14215 !! input
14216 <span data-foo="bar">Baz</span>
14217 <p data-abc-def_hij="">Quuz</p>
14218 !! result
14219 <p><span data-foo="bar">Baz</span>
14220 </p>
14221 <p data-abc-def_hij="">Quuz</p>
14222
14223 !! end
14224
14225 !! test
14226 percent-encoding and + signs in internal links (Bug 26410)
14227 !! input
14228 [[User:+%]] [[Page+title%]]
14229 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
14230 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
14231 [[%33%45]] [[%33%45+]]
14232 !! result
14233 <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>
14234 <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>
14235 <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>
14236 <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>
14237 </p>
14238 !! end
14239
14240 !! test
14241 Special characters in embedded file links (bug 27679)
14242 !! input
14243 [[File:Contains & ampersand.jpg]]
14244 [[File:Does not exist.jpg|Title with & ampersand]]
14245 !! result
14246 <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>
14247 <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>
14248 </p>
14249 !! end
14250
14251
14252 !! test
14253 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
14254 !! input
14255 Text&apos;s been normalized?
14256 !! result
14257 <p>Text&#39;s been normalized?
14258 </p>
14259 !! end
14260
14261 !! test
14262 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
14263 !! input
14264 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
14265 !! result
14266 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
14267 </p>
14268 !! end
14269
14270 !! test
14271 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
14272 !! input
14273 [http://www.example.org/ ideograms]
14274 !! result
14275 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
14276 </p>
14277 !! end
14278
14279 !! test
14280 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
14281 !! input
14282 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
14283 !! result
14284 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
14285 </p>
14286 !! end
14287
14288 !! article
14289 Mediawiki:loop1
14290 !! text
14291 {{Identical|A}}
14292 !! endarticle
14293
14294 !! article
14295 Mediawiki:loop2
14296 !! text
14297 {{Identical|B}}
14298 !! endarticle
14299
14300 !! article
14301 Template:Identical
14302 !! text
14303 {{int:loop1}}
14304 {{int:loop2}}
14305 !! endarticle
14306
14307 !! test
14308 Bug 31098 Template which includes system messages which includes the template
14309 !! input
14310 {{Identical}}
14311 !! result
14312 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14313 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14314 </p>
14315 !! end
14316
14317 !! test
14318 Bug31490 Turkish: ucfirst 'blah'
14319 !! options
14320 language=tr
14321 !! input
14322 {{ucfirst:blah}}
14323 !! result
14324 <p>Blah
14325 </p>
14326 !! end
14327
14328 !! test
14329 Bug31490 Turkish: ucfirst 'ix'
14330 !! options
14331 language=tr
14332 !! input
14333 {{ucfirst:ix}}
14334 !! result
14335 <p>İx
14336 </p>
14337 !! end
14338
14339 !! test
14340 Bug31490 Turkish: lcfirst 'BLAH'
14341 !! options
14342 language=tr
14343 !! input
14344 {{lcfirst:BLAH}}
14345 !! result
14346 <p>bLAH
14347 </p>
14348 !! end
14349
14350 !! test
14351 Bug31490 Turkish: ucfırst (with a dotless i)
14352 !! options
14353 language=tr
14354 !! input
14355 {{ucfırst:blah}}
14356 !! result
14357 <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>
14358 </p>
14359 !! end
14360
14361 !! test
14362 Bug31490 ucfırst (with a dotless i) with English language
14363 !! options
14364 language=en
14365 !! input
14366 {{ucfırst:blah}}
14367 !! result
14368 <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>
14369 </p>
14370 !! end
14371
14372 !! test
14373 Bug 26375: TOC with italics
14374 !! options
14375 title=[[Main Page]]
14376 !! input
14377 __TOC__
14378 == ''Lost'' episodes ==
14379 !! result
14380 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14381 <ul>
14382 <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>
14383 </ul>
14384 </div>
14385 <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>
14386
14387 !! end
14388
14389 !! test
14390 Bug 26375: TOC with bold
14391 !! options
14392 title=[[Main Page]]
14393 !! input
14394 __TOC__
14395 == '''should be bold''' then normal text ==
14396 !! result
14397 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14398 <ul>
14399 <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>
14400 </ul>
14401 </div>
14402 <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>
14403
14404 !! end
14405
14406 !! test
14407 Bug 33845: Headings become cursive in TOC when they contain an image
14408 !! options
14409 title=[[Main Page]]
14410 !! input
14411 __TOC__
14412 == Image [[Image:foobar.jpg]] ==
14413 !! result
14414 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14415 <ul>
14416 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
14417 </ul>
14418 </div>
14419 <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>
14420
14421 !! end
14422
14423 !! test
14424 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
14425 !! options
14426 title=[[Main Page]]
14427 !! input
14428 __TOC__
14429 == <blockquote>Quote</blockquote> ==
14430 !! result
14431 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14432 <ul>
14433 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
14434 </ul>
14435 </div>
14436 <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>
14437
14438 !! end
14439
14440 !! test
14441 Unclosed tags in TOC
14442 !! options
14443 title=[[Main Page]]
14444 !! input
14445 __TOC__
14446 == Proof: 2 < 3 ==
14447 <small>Hanc marginis exiguitas non caperet.</small>
14448 QED
14449 !! result
14450 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14451 <ul>
14452 <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>
14453 </ul>
14454 </div>
14455 <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>
14456 <p><small>Hanc marginis exiguitas non caperet.</small>
14457 QED
14458 </p>
14459 !! end
14460
14461 !! test
14462 Multiple tags in TOC
14463 !! input
14464 __TOC__
14465 == <i>Foo</i> <b>Bar</b> ==
14466
14467 == <i>Foo</i> <blockquote>Bar</blockquote> ==
14468 !! result
14469 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14470 <ul>
14471 <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>
14472 <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>
14473 </ul>
14474 </div>
14475 <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>
14476 <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>
14477
14478 !! end
14479
14480 !! test
14481 Tags with parameters in TOC
14482 !! input
14483 __TOC__
14484 == <sup class="in-h2">Hello</sup> ==
14485
14486 == <sup class="a > b">Evilbye</sup> ==
14487 !! result
14488 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14489 <ul>
14490 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
14491 <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>
14492 </ul>
14493 </div>
14494 <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>
14495 <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>
14496
14497 !! end
14498
14499 !! test
14500 span tags with directionality in TOC
14501 !! input
14502 __TOC__
14503 == <span dir="ltr">C++</span> ==
14504
14505 == <span dir="rtl">זבנג!</span> ==
14506
14507 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
14508
14509 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
14510
14511 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
14512 !! result
14513 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14514 <ul>
14515 <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>
14516 <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>
14517 <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>
14518 <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>
14519 <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>
14520 </ul>
14521 </div>
14522 <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>
14523 <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>
14524 <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>
14525 <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>
14526 <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>
14527
14528 !! end
14529
14530 !! article
14531 MediaWiki:Bug32057
14532 !! text
14533 == {{int:headline_sample}} ==
14534 !! endarticle
14535
14536 !! test
14537 Bug 32057: Title needed when expanding <h> nodes.
14538 !! options
14539 title=[[Main Page]]
14540 !! input
14541 {{int:Bug32057}}
14542 !! result
14543 <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>
14544
14545 !! end
14546
14547 !! test
14548 Strip marker in urlencode
14549 !! input
14550 {{urlencode:x<nowiki/>y}}
14551 {{urlencode:x<nowiki/>y|wiki}}
14552 {{urlencode:x<nowiki/>y|path}}
14553 !! result
14554 <p>xy
14555 xy
14556 xy
14557 </p>
14558 !! end
14559
14560 !! test
14561 Strip marker in lc
14562 !! input
14563 {{lc:x<nowiki/>y}}
14564 !! result
14565 <p>xy
14566 </p>
14567 !! end
14568
14569 !! test
14570 Strip marker in uc
14571 !! input
14572 {{uc:x<nowiki/>y}}
14573 !! result
14574 <p>XY
14575 </p>
14576 !! end
14577
14578 !! test
14579 Strip marker in formatNum
14580 !! input
14581 {{formatnum:1<nowiki/>2}}
14582 {{formatnum:1<nowiki/>2|R}}
14583 !! result
14584 <p>12
14585 12
14586 </p>
14587 !! end
14588
14589 !! test
14590 Check noCommafy in formatNum
14591 !! options
14592 language=be-tarask
14593 !! input
14594 {{formatnum:123456.78}}
14595 {{formatnum:123456.78|NOSEP}}
14596 !! result
14597 <p>123 456,78
14598 123456.78
14599 </p>
14600 !! end
14601
14602 !! test
14603 Strip marker in grammar
14604 !! options
14605 language=fi
14606 !! input
14607 {{grammar:elative|foo<nowiki/>bar}}
14608 !! result
14609 <p>foobarista
14610 </p>
14611 !! end
14612
14613 !! test
14614 Strip marker in padleft
14615 !! input
14616 {{padleft:|2|x<nowiki/>y}}
14617 !! result
14618 <p>xy
14619 </p>
14620 !! end
14621
14622 !! test
14623 Strip marker in padright
14624 !! input
14625 {{padright:|2|x<nowiki/>y}}
14626 !! result
14627 <p>xy
14628 </p>
14629 !! end
14630
14631 !! test
14632 Strip marker in anchorencode
14633 !! input
14634 {{anchorencode:x<nowiki/>y}}
14635 !! result
14636 <p>xy
14637 </p>
14638 !! end
14639
14640 !! test
14641 nowiki inside link inside heading (bug 18295)
14642 !! input
14643 ==[[foo|x<nowiki>y</nowiki>z]]==
14644 !! result
14645 <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>
14646
14647 !! end
14648
14649 !! test
14650 new support for bdi element (bug 31817)
14651 !! input
14652 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14653 !! result
14654 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14655
14656 !!end
14657
14658 !! test
14659 Ignore pipe between table row attributes
14660 !! input
14661 {|
14662 | quux
14663 |- id=foo | style='color: red'
14664 | bar
14665 |}
14666 !! result
14667 <table>
14668 <tr>
14669 <td> quux
14670 </td></tr>
14671 <tr id="foo" style="color: red">
14672 <td> bar
14673 </td></tr></table>
14674
14675 !! end
14676
14677 !!test
14678 Gallery override link with WikiLink (bug 34852)
14679 !! input
14680 <gallery>
14681 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
14682 </gallery>
14683 !! result
14684 <ul class="gallery">
14685 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14686 <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>
14687 <div class="gallerytext">
14688 <p>caption
14689 </p>
14690 </div>
14691 </div></li>
14692 </ul>
14693
14694 !! end
14695
14696 !!test
14697 Gallery override link with absolute external link (bug 34852)
14698 !! input
14699 <gallery>
14700 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
14701 </gallery>
14702 !! result
14703 <ul class="gallery">
14704 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14705 <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>
14706 <div class="gallerytext">
14707 <p>caption
14708 </p>
14709 </div>
14710 </div></li>
14711 </ul>
14712
14713 !! end
14714
14715 !!test
14716 Gallery override link with malicious javascript (bug 34852)
14717 !! input
14718 <gallery>
14719 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
14720 </gallery>
14721 !! result
14722 <ul class="gallery">
14723 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14724 <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>
14725 <div class="gallerytext">
14726 <p>caption
14727 </p>
14728 </div>
14729 </div></li>
14730 </ul>
14731
14732 !! end
14733
14734 !!test
14735 Gallery with invalid title as link (bug 43964)
14736 !! input
14737 <gallery>
14738 File:foobar.jpg|link=<
14739 </gallery>
14740 !! result
14741 <ul class="gallery">
14742 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14743 <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>
14744 <div class="gallerytext">
14745 </div>
14746 </div></li>
14747 </ul>
14748
14749 !! end
14750
14751 !!test
14752 Language parser function
14753 !! input
14754 {{#language:ar}}
14755 !! result
14756 <p>العربية
14757 </p>
14758 !! end
14759
14760 !!test
14761 Padleft and padright as substr
14762 !! input
14763 {{padleft:|3|abcde}}
14764 {{padright:|3|abcde}}
14765 !! result
14766 <p>abc
14767 abc
14768 </p>
14769 !! end
14770
14771 !!test
14772 Special parser function
14773 !! input
14774 {{#special:RandomPage}}
14775 {{#special:BaDtItLe}}
14776 {{#special:Foobar}}
14777 !! result
14778 <p>Special:Random
14779 Special:Badtitle
14780 Special:Foobar
14781 </p>
14782 !! end
14783
14784 !!test
14785 Bug 34939 - Case insensitive link parsing ([HttP://])
14786 !! input
14787 [HttP://MediaWiki.Org/]
14788 !! result
14789 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
14790 </p>
14791 !! end
14792
14793 !!test
14794 Bug 34939 - Case insensitive link parsing ([HttP:// title])
14795 !! input
14796 [HttP://MediaWiki.Org/ MediaWiki]
14797 !! result
14798 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
14799 </p>
14800 !! end
14801
14802 !!test
14803 Bug 34939 - Case insensitive link parsing (HttP://)
14804 !! input
14805 HttP://MediaWiki.Org/
14806 !! result
14807 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
14808 </p>
14809 !! end
14810
14811
14812 ###
14813 ### Parsoids-specific tests
14814 ### Parsoid-PHP parser incompatibilities
14815 ###
14816 !!test
14817 1. SOL-sensitive wikitext tokens as template-args
14818 !!options
14819 parsoid=wt2html,wt2wt
14820 !!input
14821 {{echo|*a}}
14822 {{echo|#a}}
14823 {{echo|:a}}
14824 !!result
14825 <span about="#mwt1" typeof="mw:Transclusion">
14826 </span><ul about="#mwt1"><li>a</li></ul>
14827 <span about="#mwt2" typeof="mw:Transclusion">
14828 </span><ol about="#mwt2"><li>a</li></ol>
14829 <span about="#mwt3" typeof="mw:Transclusion">
14830 </span><dl about="#mwt3"><dd>a</dd></dl>
14831 !!end
14832
14833 #### ----------------------------------------------------------------
14834 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
14835 #### tags. Parsoid's output for these tags differs from that of the
14836 #### PHP parser.
14837 #### ----------------------------------------------------------------
14838
14839 !!test
14840 Ref: 1. ref-location should be replaced with an index span
14841 !!options
14842 parsoid
14843 !!input
14844 A <ref>foo</ref>
14845 B <ref name="x">foo</ref>
14846 C <ref name="y" />
14847 !!result
14848 <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>
14849 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>
14850 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>
14851 !!end
14852
14853 !!test
14854 Ref: 2. ref-tags with identical names should all get the same index
14855 !!options
14856 parsoid
14857 !!input
14858 A <ref name="x">foo</ref>
14859 B <ref name="x" />
14860 !!result
14861 <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>
14862 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>
14863 !!end
14864
14865 !!test
14866 Ref: 3. spaces in ref-names should be ignored
14867 !!options
14868 parsoid
14869 !!input
14870 A <ref name="x">foo</ref>
14871 B <ref name=" x " />
14872 C <ref name= x />
14873 !!result
14874 <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>
14875 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>
14876 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>
14877 !!end
14878
14879 !!test
14880 Ref: 4. 'constructor' should be accepted as a valid ref-name
14881 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
14882 !!options
14883 parsoid
14884 !!input
14885 A <ref name="constructor">foo</ref>
14886 !!result
14887 <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>
14888 !!end
14889
14890 !!test
14891 Ref: 5. body should accept generic wikitext
14892 !!options
14893 parsoid
14894 !!input
14895 A <ref>
14896 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
14897 </ref>
14898
14899 <references />
14900 !!result
14901 <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;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;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;dsr&amp;quot;:[22,37,2,2]}\">bolded link</a></b> and this is a <span about=\"#mwt3\" typeof=\"mw:Transclusion\" data-mw=\"{&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;}}}\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;{{echo|transclusion}}&amp;quot;,&amp;quot;dsr&amp;quot;:[55,76,null,null]}\">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>
14902
14903 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14904 <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='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"transclusion"}}}'>transclusion</span>
14905 </li></ol>
14906 !!end
14907
14908 !!test
14909 Ref: 6. indent-pres should not be output in ref-body
14910 !!options
14911 parsoid
14912 !!input
14913 A <ref>
14914 foo
14915 bar
14916 baz
14917 </ref>
14918
14919 <references />
14920 !!result
14921 <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>
14922
14923 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14924 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
14925 bar
14926 baz
14927 </li></ol>
14928 !!end
14929
14930 !!test
14931 Ref: 6. No p-wrapping in ref-body
14932 !!options
14933 parsoid
14934 !!input
14935 A <ref>
14936 foo
14937
14938 bar
14939
14940
14941 baz
14942
14943
14944
14945 booz
14946 </ref>
14947
14948 <references />
14949 !!result
14950 <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>
14951
14952 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14953 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
14954
14955 bar
14956
14957
14958 baz
14959
14960
14961
14962 booz
14963 </li></ol>
14964 !!end
14965
14966 !!test
14967 Ref: 8. transclusion wikitext has lower precedence
14968 !!options
14969 parsoid
14970 !!input
14971 A <ref> foo {{echo|</ref> B C}}
14972
14973 <references />
14974 !!result
14975 <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,2,null]}\">{{</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>
14976
14977 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14978 <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>
14979 !!end
14980
14981 !!test
14982 Ref: 9. unclosed comments should not leak out of ref-body
14983 !!options
14984 parsoid
14985 !!input
14986 A <ref> foo <!--</ref> B C
14987
14988 <references />
14989 !!result
14990 <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>
14991
14992 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14993 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li></ol>
14994 !!end
14995
14996 !!test
14997 Ref: 10. Unclosed HTML tags should not leak out of ref-body
14998 !!options
14999 parsoid
15000 !!input
15001 A <ref> <b> foo </ref> B C
15002
15003 <references />
15004 !!result
15005 <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>
15006
15007 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15008 <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>
15009 !!end
15010
15011 !!test
15012 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
15013 !!options
15014 parsoid
15015 !!input
15016 A <ref>foo</ref> B
15017 C <ref>bar</ref> D
15018 !!result
15019 <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
15020 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>
15021 !!end
15022
15023 !!test
15024 Ref: 12. ref-tags act as trailing newline migration barrier
15025 !!options
15026 parsoid
15027 !!input
15028 <!--the newline at the end of this line moves out of the p-tag-->a
15029
15030 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
15031 <ref />
15032
15033 c
15034 !!result
15035 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
15036
15037
15038 <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>
15039 <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>
15040
15041
15042 <p>c</p>
15043 !!end
15044
15045 !!test
15046 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
15047 !!options
15048 parsoid
15049 !!input
15050 <ref>foo</ref> A
15051 <ref>bar
15052 </ref> B
15053 !!result
15054 <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
15055 <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>
15056 !!end
15057
15058 !!test
15059 Ref: 14. A nested ref-tag should be emitted as plain text
15060 !!options
15061 parsoid
15062 !!input
15063 <ref>foo <ref>bar</ref> baz</ref>
15064
15065 <references />
15066 !!result
15067 <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>
15068
15069 <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
15070 <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>
15071 !!end
15072
15073 !!test
15074 Ref: 15. ref-tags with identical names should get identical indexes
15075 !!options
15076 parsoid
15077 !!input
15078 A1 <ref name="a">foo</ref> A2 <ref name="a" />
15079 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
15080
15081 <references />
15082 !!result
15083 <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>
15084 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>
15085
15086 <ol about="#mwt10" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"><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>
15087 !!end
15088
15089 !!test
15090 References: 1. references tag without any refs should be handled properly
15091 !!options
15092 parsoid
15093 !!input
15094 <references />
15095 !!result
15096 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"></ol>
15097 !!end
15098
15099 !!test
15100 References: 2. references tag with group only outputs references from that group
15101 !!options
15102 parsoid
15103 !!input
15104 A <ref group="a">foo</ref>
15105 B <ref group="b">bar</ref>
15106
15107 <references group='a' />
15108 !!result
15109 <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>
15110 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>
15111
15112 <ol about="#mwt6" class="references" data-mw='{"name":"references","attrs":{"group":"a"}}' typeof="mw:Extension/references"><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
15113 !!end
15114
15115 !!test
15116 References: 3. ref list should be cleared after processing references
15117 !!options
15118 parsoid
15119 !!input
15120 A <ref>foo</ref>
15121
15122 <references />
15123
15124 B <ref>bar</ref>
15125
15126 <references />
15127 !!result
15128 <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>
15129
15130 <ol about="#mwt4" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
15131
15132 <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>
15133
15134 <ol about="#mwt8" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> bar</li></ol>
15135 !!end
15136
15137 !!test
15138 References: 4. only referenced group should be cleared after processing references
15139 !!options
15140 parsoid
15141 !!input
15142 A <ref group="a">afoo</ref>
15143 B <ref>bfoo</ref>
15144
15145 <references group="a"/>
15146
15147 C <ref>cfoo</ref>
15148
15149 <references />
15150 !!result
15151 <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>
15152 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>
15153
15154 <ol about="#mwt6" class="references" data-mw='{"name":"references","attrs":{"group":"a"}}' typeof="mw:Extension/references"><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> afoo</li></ol>
15155
15156 <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>
15157
15158 <ol about="#mwt10" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"><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>
15159 !!end
15160
15161 !!test
15162 References: 5. ref tags in references should be processed while ignoring all other content
15163 !!options
15164 parsoid
15165 !!input
15166 A <ref name="a" />
15167 B <ref name="b">bar</ref>
15168
15169 <references>
15170 <ref name="a">foo</ref>
15171 This should just get lost.
15172 </references>
15173 !!result
15174 <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>
15175 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>
15176
15177 <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":"<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>"},"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>
15178 !!end
15179
15180 !!test
15181 References: 6. <references /> from a transclusion
15182 !!options
15183 parsoid
15184 !!input
15185 {{echo|<references />}}
15186 !!result
15187 <ol class="references" about="#mwt2" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<references />"}},"i":0}'></ol>
15188 !!end
15189
15190 !! test
15191 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
15192 !! options
15193 parsoid
15194 !! input
15195 A <ref>foo bar for a</ref>
15196 B <ref name="b" />
15197
15198 <references />
15199
15200 <references>
15201 <ref name="b">foo</ref>
15202 </references>
15203 !! result
15204 <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>
15205 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>
15206
15207 <ol class="references" typeof="mw:Extension/references" about="#mwt6" 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 bar for a</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> </li></ol>
15208
15209 <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":{}}'><li about="#cite_note-b-1" id="cite_note-b-1"><span rel="mw:referencedBy">↑</span> foo</li></ol>
15210
15211 !! end
15212
15213 #### ----------------------------------------------------------------
15214 #### The following section of tests are primarily to test
15215 #### wikitext escaping capabilities of Parsoid. Given that
15216 #### escaping can be done any number of ways, the wikitext (input)
15217 #### is always adjusted to reflect how Parsoid adds nowiki
15218 #### escape tags.
15219 ####
15220 #### We are marking several tests as parsoid-only since the
15221 #### HTML in the result section is different from what the
15222 #### PHP parser generates for it.
15223 #### ----------------------------------------------------------------
15224
15225
15226 #### --------------- Headings ---------------
15227 #### 0. Unnested
15228 #### 1. Nested inside html <h1>=foo=</h1>
15229 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
15230 #### 3. Nested inside html with wikitext split by html tags
15231 #### 4. No escape needed
15232 #### 5. Empty headings <h1></h1>
15233 #### 6. Heading chars in SOL context
15234 #### ----------------------------------------
15235 !! test
15236 Headings: 0. Unnested
15237 !! options
15238 parsoid
15239 !! input
15240 <nowiki>=foo=</nowiki>
15241
15242 <nowiki> =foo= </nowiki>
15243 <!--cmt-->
15244 <nowiki>=foo=</nowiki>
15245
15246 =foo''a''<nowiki>=</nowiki>
15247 !! result
15248 <p><span typeof="mw:Nowiki">=foo=</span></p>
15249
15250 <p><span typeof="mw:Nowiki"> =foo= </span>
15251 <!--cmt-->
15252 <span typeof="mw:Nowiki">=foo=</span></p>
15253
15254 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
15255 !!end
15256
15257 !! test
15258 Headings: 1. Nested inside html
15259 !! options
15260 parsoid
15261 !! input
15262 =<nowiki>=foo=</nowiki>=
15263
15264 ==<nowiki>=foo=</nowiki>==
15265
15266 ===<nowiki>=foo=</nowiki>===
15267
15268 ====<nowiki>=foo=</nowiki>====
15269
15270 =====<nowiki>=foo=</nowiki>=====
15271
15272 ======<nowiki>=foo=</nowiki>======
15273 !! result
15274 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
15275 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
15276 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
15277 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
15278 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
15279 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
15280 !!end
15281
15282 !! test
15283 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
15284 !! options
15285 parsoid
15286 !! input
15287 =foo=
15288 <nowiki>*</nowiki>bar
15289
15290 =foo=
15291 =bar
15292
15293 =foo=
15294 <nowiki>=bar=</nowiki>
15295 !! result
15296 <h1>foo</h1>*bar
15297 <h1>foo</h1>=bar
15298 <h1>foo</h1>=bar=
15299 !!end
15300
15301 !! test
15302 Headings: 3. Nested inside html with wikitext split by html tags
15303 !! options
15304 parsoid
15305 !! input
15306 =='''bold'''<nowiki>foo=</nowiki>=
15307 !! result
15308 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
15309 !!end
15310
15311 !! test
15312 Headings: 4a. No escaping needed (testing just h1 and h2)
15313 !! options
15314 parsoid
15315 !! input
15316 ==foo=
15317
15318 =foo==
15319
15320 = =foo= =
15321
15322 ==foo= bar=
15323
15324 ===foo==
15325
15326 ==foo===
15327
15328 =''=''foo==
15329
15330 =<nowiki>=</nowiki>=
15331 !! result
15332 <h1>=foo</h1>
15333 <h1>foo=</h1>
15334 <h1> =foo= </h1>
15335 <h1>=foo= bar</h1>
15336 <h2>=foo</h2>
15337 <h2>foo=</h2>
15338 <h1><i>=</i>foo=</h1>
15339 <h1><span typeof="mw:Nowiki">=</span></h1>
15340 !!end
15341
15342 !! test
15343 Headings: 4b. No escaping needed (inside p-tags)
15344 !! options
15345 parsoid
15346 !! input
15347 ===
15348 =foo= x
15349 =foo= <s></s>
15350 !! result
15351 <p>===
15352 =foo= x
15353 =foo= <s></s>
15354 </p>
15355 !!end
15356
15357 !! test
15358 Headings: 5. Empty headings
15359 !! options
15360 parsoid
15361 !! input
15362 =<nowiki/>=
15363
15364 ==<nowiki/>==
15365
15366 ===<nowiki/>===
15367
15368 ====<nowiki/>====
15369
15370 =====<nowiki/>=====
15371
15372 ======<nowiki/>======
15373 !! result
15374 <h1></h1>
15375 <h2></h2>
15376 <h3></h3>
15377 <h4></h4>
15378 <h5></h5>
15379 <h6></h6>
15380 !!end
15381
15382 !! test
15383 Headings: 6a. Heading chars in SOL context (with trailing spaces)
15384 !! options
15385 parsoid
15386 !! input
15387 <nowiki>=a=</nowiki>
15388
15389 <nowiki>=a=</nowiki>
15390
15391 <nowiki>=a=</nowiki>
15392
15393 <nowiki>=a=</nowiki>
15394 !! result
15395 <p>=a=</p>
15396 <p>=a= </p>
15397 <p>=a= </p>
15398 <p>=a= </p>
15399 !!end
15400
15401 !! test
15402 Headings: 6b. Heading chars in SOL context (with trailing newlines)
15403 !! options
15404 parsoid
15405 !! input
15406 <nowiki>=a=
15407 b</nowiki>
15408
15409 <nowiki>=a=
15410 b</nowiki>
15411
15412 <nowiki>=a=
15413 b</nowiki>
15414
15415 <nowiki>=a=
15416 b</nowiki>
15417 !! result
15418 <p>=a=
15419 b</p>
15420 <p>=a=
15421 b</p>
15422 <p>=a=
15423 b</p>
15424 <p>=a=
15425 b</p>
15426 </p>
15427 !!end
15428
15429 !! test
15430 Headings: 6c. Heading chars in SOL context (leading newline break)
15431 !! options
15432 parsoid
15433 !! input
15434 a
15435 <nowiki>=b=</nowiki>
15436 !! result
15437 <p>a
15438 =b=</p>
15439 !!end
15440
15441 !! test
15442 Headings: 6d. Heading chars in SOL context (with interspersed comments)
15443 !! options
15444 parsoid
15445 !! input
15446 <!--c0--><nowiki>=a=</nowiki>
15447 <!--c1-->
15448 <nowiki>=a=</nowiki> <!--c2--> <!--c3-->
15449 !! result
15450 <p><!--c0-->=a=</p>
15451 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
15452 !!end
15453
15454 !! test
15455 Headings: 6d. Heading chars in SOL context (No escaping needed)
15456 !! options
15457 parsoid=html2wt
15458 !! input
15459 =a=<div>b</div>
15460 !! result
15461 =a=<div>b</div>
15462 !!end
15463
15464 #### --------------- Lists ---------------
15465 #### 0. Outside nests (*foo, etc.)
15466 #### 1. Nested inside html <ul><li>*foo</li></ul>
15467 #### 2. Inside definition lists
15468 #### 3. Only bullets at start should be escaped
15469 #### 4. No escapes needed
15470 #### 5. No unnecessary escapes
15471 #### 6. Escape bullets in SOL position
15472 #### 7. Escape bullets in a multi-line context
15473 #### ----------------------------------------
15474
15475 !! test
15476 Lists: 0. Outside nests
15477 !! input
15478 <nowiki>*</nowiki>foo
15479
15480 <nowiki>#</nowiki>foo
15481 !! result
15482 <p>*foo
15483 </p><p>#foo
15484 </p>
15485 !!end
15486
15487 !! test
15488 Lists: 1. Nested inside html
15489 !! input
15490 *<nowiki>*foo</nowiki>
15491
15492 *<nowiki>#foo</nowiki>
15493
15494 *<nowiki>:foo</nowiki>
15495
15496 *<nowiki>;foo</nowiki>
15497
15498 #<nowiki>*foo</nowiki>
15499
15500 #<nowiki>#foo</nowiki>
15501
15502 #<nowiki>:foo</nowiki>
15503
15504 #<nowiki>;foo</nowiki>
15505 !! result
15506 <ul><li>*foo
15507 </li></ul>
15508 <ul><li>#foo
15509 </li></ul>
15510 <ul><li>:foo
15511 </li></ul>
15512 <ul><li>;foo
15513 </li></ul>
15514 <ol><li>*foo
15515 </li></ol>
15516 <ol><li>#foo
15517 </li></ol>
15518 <ol><li>:foo
15519 </li></ol>
15520 <ol><li>;foo
15521 </li></ol>
15522
15523 !!end
15524
15525 !! test
15526 Lists: 2. Inside definition lists
15527 !! input
15528 ;<nowiki>;foo</nowiki>
15529
15530 ;<nowiki>:foo</nowiki>
15531
15532 ;<nowiki>:foo</nowiki>
15533 :bar
15534
15535 :<nowiki>:foo</nowiki>
15536 !! result
15537 <dl><dt>;foo
15538 </dt></dl>
15539 <dl><dt>:foo
15540 </dt></dl>
15541 <dl><dt>:foo
15542 </dt><dd>bar
15543 </dd></dl>
15544 <dl><dd>:foo
15545 </dd></dl>
15546
15547 !!end
15548
15549 !! test
15550 Lists: 3. Only bullets at start of text should be escaped
15551 !! input
15552 *<nowiki>*foo*bar</nowiki>
15553
15554 *<nowiki>*foo</nowiki>''it''*bar
15555 !! result
15556 <ul><li>*foo*bar
15557 </li></ul>
15558 <ul><li>*foo<i>it</i>*bar
15559 </li></ul>
15560
15561 !!end
15562
15563 !! test
15564 Lists: 4. No escapes needed
15565 !! options
15566 parsoid
15567 !! input
15568 *foo*bar
15569
15570 *''foo''*bar
15571
15572 *[[Foo]]: bar
15573 !! result
15574 <ul><li>foo*bar
15575 </li></ul>
15576 <ul><li><i>foo</i>*bar
15577 </li></ul>
15578 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
15579 </li></ul>
15580 !!end
15581
15582 !! test
15583 Lists: 5. No unnecessary escapes
15584 !! input
15585 * bar <span><nowiki>[[foo]]</nowiki></span>
15586
15587 *=bar <span><nowiki>[[foo]]</nowiki></span>
15588
15589 *[[bar <span><nowiki>[[foo]]</nowiki></span>
15590
15591 *]]bar <span><nowiki>[[foo]]</nowiki></span>
15592
15593 *=bar <span>foo]]</span>=
15594
15595 * <s></s>: a
15596 !! result
15597 <ul><li> bar <span>[[foo]]</span>
15598 </li></ul>
15599 <ul><li>=bar <span>[[foo]]</span>
15600 </li></ul>
15601 <ul><li>[[bar <span>[[foo]]</span>
15602 </li></ul>
15603 <ul><li>]]bar <span>[[foo]]</span>
15604 </li></ul>
15605 <ul><li>=bar <span>foo]]</span>=
15606 </li></ul>
15607 <ul><li> <s></s>: a
15608 </li></ul>
15609
15610 !!end
15611
15612 !! test
15613 Lists: 6. Escape bullets in SOL position
15614 !! options
15615 parsoid
15616 !! input
15617 <!--cmt--><nowiki>*foo</nowiki>
15618 !! result
15619 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
15620 !!end
15621
15622 !! test
15623 Lists: 7. Escape bullets in a multi-line context
15624 !! input
15625 a
15626 <nowiki>*</nowiki>b
15627 !! result
15628 <p>a
15629 *b
15630 </p>
15631 !!end
15632
15633 #### --------------- HRs ---------------
15634 #### 1. Single line
15635 #### -----------------------------------
15636
15637 !! test
15638 HRs: 1. Single line
15639 !! options
15640 parsoid
15641 !! input
15642 ----<nowiki>----</nowiki>
15643 ----=foo=
15644 ----*foo
15645 !! result
15646 <hr><span typeof="mw:Nowiki">----</span>
15647 <hr>=foo=
15648 <hr>*foo
15649 !! end
15650
15651 #### --------------- Tables ---------------
15652 #### 1a. Simple example
15653 #### 1b. No escaping needed (!foo)
15654 #### 1c. No escaping needed (|foo)
15655 #### 1d. No escaping needed (|}foo)
15656 ####
15657 #### 2a. Nested in td (<td>foo|bar</td>)
15658 #### 2b. Nested in td (<td>foo||bar</td>)
15659 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
15660 ####
15661 #### 3a. Nested in th (<th>foo!bar</th>)
15662 #### 3b. Nested in th (<th>foo!!bar</th>)
15663 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
15664 ####
15665 #### 4a. Escape -
15666 #### 4b. Escape +
15667 #### 4c. No escaping needed
15668 #### --------------------------------------
15669
15670 !! test
15671 Tables: 1a. Simple example
15672 !! input
15673 <nowiki>{|
15674 |}</nowiki>
15675 !! result
15676 <p>{|
15677 |}
15678 </p>
15679 !! end
15680
15681 !! test
15682 Tables: 1b. No escaping needed
15683 !! input
15684 !foo
15685 !! result
15686 <p>!foo
15687 </p>
15688 !! end
15689
15690 !! test
15691 Tables: 1c. No escaping needed
15692 !! input
15693 |foo
15694 !! result
15695 <p>|foo
15696 </p>
15697 !! end
15698
15699 !! test
15700 Tables: 1d. No escaping needed
15701 !! input
15702 |}foo
15703 !! result
15704 <p>|}foo
15705 </p>
15706 !! end
15707
15708 !! test
15709 Tables: 2a. Nested in td
15710 !! options
15711 parsoid
15712 !! input
15713 {|
15714 |<nowiki>foo|bar</nowiki>
15715 |}
15716 !! result
15717 <table><tbody><tr>
15718 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
15719 !! end
15720
15721 !! test
15722 Tables: 2b. Nested in td
15723 !! options
15724 parsoid
15725 !! input
15726 {|
15727 |<nowiki>foo||bar</nowiki>
15728 |''it''<nowiki>foo||bar</nowiki>
15729 |}
15730 !! result
15731 <table><tbody><tr>
15732 <td><span typeof="mw:Nowiki">foo||bar</span></td>
15733 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
15734 !! end
15735
15736 !! test
15737 Tables: 2c. Nested in td -- no escaping needed
15738 !! options
15739 parsoid
15740 !! input
15741 {|
15742 |foo!!bar
15743 |}
15744 !! result
15745 <table><tbody><tr><td>foo!!bar
15746 </td></tr></tbody></table>
15747
15748 !! end
15749
15750 !! test
15751 Tables: 3a. Nested in th
15752 !! options
15753 parsoid
15754 !! input
15755 {|
15756 !foo!bar
15757 |}
15758 !! result
15759 <table><tbody><tr><th>foo!bar
15760 </th></tr></tbody></table>
15761
15762 !! end
15763
15764 !! test
15765 Tables: 3b. Nested in th
15766 !! options
15767 parsoid
15768 !! input
15769 {|
15770 !<nowiki>foo!!bar</nowiki>
15771 |}
15772 !! result
15773 <table>
15774 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
15775 </tbody></table>
15776 !! end
15777
15778 !! test
15779 Tables: 3c. Nested in th -- no escaping needed
15780 !! options
15781 parsoid
15782 !! input
15783 {|
15784 !<nowiki>foo||bar</nowiki>
15785 |}
15786 !! result
15787 <table><tbody><tr>
15788 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
15789 !! end
15790
15791 !! test
15792 Tables: 4a. Escape -
15793 !! options
15794 parsoid
15795 !! input
15796 {|
15797 |-
15798 !-bar
15799 |-
15800 |<nowiki>-bar</nowiki>
15801 |}
15802 !! result
15803 <table><tbody>
15804 <tr><th>-bar</th></tr>
15805 <tr>
15806 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
15807 !! end
15808
15809 !! test
15810 Tables: 4b. Escape +
15811 !! options
15812 parsoid
15813 !! input
15814 {|
15815 |-
15816 !+bar
15817 |-
15818 |<nowiki>+bar</nowiki>
15819 |}
15820 !! result
15821 <table><tbody>
15822 <tr><th>+bar</th></tr>
15823 <tr>
15824 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
15825 !! end
15826
15827 !! test
15828 Tables: 4c. No escaping needed
15829 !! options
15830 parsoid
15831 !! input
15832 {|
15833 |-
15834 |foo-bar
15835 |foo+bar
15836 |-
15837 |''foo''-bar
15838 |''foo''+bar
15839 |-
15840 |foo
15841 bar|baz
15842 +bar
15843 -bar
15844 |}
15845 !! result
15846 <table><tbody>
15847 <tr><td>foo-bar</td><td>foo+bar</td></tr>
15848 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
15849 <tr><td>foo
15850 <p>bar|baz
15851 +bar
15852 -bar</p></td></tr>
15853 </tbody></table>
15854 !! end
15855
15856 ### SSS FIXME: Disabled right now because accurate html2wt
15857 ### on this snippet requires data-parsoid flags that we've
15858 ### stripped out of these tests. We should scheme how we
15859 ### we want to handle these kind of tests that require
15860 ### data-parsoid flags for accurate html2wt serialization
15861
15862 !! test
15863 Tables: 4d. No escaping needed
15864 !! options
15865 disabled
15866 !! input
15867 {|
15868 ||+1
15869 ||-2
15870 |}
15871 !! result
15872 <table>
15873 <tr>
15874 <td>+1
15875 </td>
15876 <td>-2
15877 </td></tr></table>
15878
15879 !! end
15880
15881 #### --------------- Links ----------------
15882 #### 1. Quote marks in link text
15883 #### 2. Wikilinks: Escapes needed
15884 #### 3. Wikilinks: No escapes needed
15885 #### 4. Extlinks: Escapes needed
15886 #### 5. Extlinks: No escapes needed
15887 #### --------------------------------------
15888 !! test
15889 Links 1. Quote marks in link text
15890 !! options
15891 parsoid
15892 !! input
15893 [[Foo|Foo<nowiki>''boo''</nowiki>]]
15894 !! result
15895 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
15896 !! end
15897
15898 !! test
15899 Links 2. WikiLinks: Escapes needed
15900 !! options
15901 parsoid
15902 !! input
15903 [[Foo|<nowiki>[Foobar]</nowiki>]]
15904 [[Foo|<nowiki>Foobar]</nowiki>]]
15905 [[Foo|x [Foobar] x]]
15906 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
15907 [[Foo|<nowiki>[[Bar]]</nowiki>]]
15908 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
15909 [[Foo|<nowiki>|Bar</nowiki>]]
15910 [[Foo|<nowiki>]]bar</nowiki>]]
15911 [[Foo|<nowiki>[[bar</nowiki>]]
15912 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
15913 !! result
15914 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
15915 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
15916 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
15917 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
15918 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
15919 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
15920 <a href="Foo" rel="mw:WikiLink">|Bar</a>
15921 <a href="Foo" rel="mw:WikiLink">]]bar</a>
15922 <a href="Foo" rel="mw:WikiLink">[[bar</a>
15923 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
15924 !! end
15925
15926 !! test
15927 Links 3. WikiLinks: No escapes needed
15928 !! options
15929 parsoid
15930 !! input
15931 [[Foo|[Foobar]]
15932 [[Foo|foo|bar]]
15933 !! result
15934 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
15935 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
15936 !! end
15937
15938 !! test
15939 Links 4. ExtLinks: Escapes needed
15940 !! options
15941 parsoid
15942 !! input
15943 [http://google.com <nowiki>[google]</nowiki>]
15944 [http://google.com <nowiki>google]</nowiki>]
15945 !! result
15946 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
15947 <a href="http://google.com" rel="mw:ExtLink">google]</a>
15948 !! end
15949
15950 !! test
15951 Links 5. ExtLinks: No escapes needed
15952 !! options
15953 parsoid
15954 !! input
15955 [http://google.com [google]
15956 !! result
15957 <a href="http://google.com" rel="mw:ExtLink">[google</a>
15958 !! end
15959
15960 #### --------------- Quotes ---------------
15961 #### 1. Quotes inside <b> and <i>
15962 #### 2. Link fragments separated by <i> and <b> tags
15963 #### 3. Link fragments inside <i> and <b>
15964 #### 4. No escaping needed
15965 #### --------------------------------------
15966 !! test
15967 1. Quotes inside <b> and <i>
15968 !! options
15969 parsoid=html2wt,wt2wt
15970 !! input
15971 ''<nowiki>'foo'</nowiki>''
15972 ''<nowiki>''foo''</nowiki>''
15973 ''<nowiki>'''foo'''</nowiki>''
15974 ''foo''<nowiki/>'s
15975 '''<nowiki>'foo'</nowiki>'''
15976 '''<nowiki>''foo''</nowiki>'''
15977 '''<nowiki>'''foo'''</nowiki>'''
15978 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
15979 '''foo'''<nowiki/>'s
15980 '''foo''
15981 ''foo''<nowiki/>'
15982 '<nowiki/>''foo''<nowiki/>'
15983 ''''foo'''
15984 '''foo'''<nowiki/>'
15985 '<nowiki/>'''foo'''<nowiki/>'
15986 !! result
15987 <p><i>'foo'</i>
15988 <i>''foo''</i>
15989 <i>'''foo'''</i>
15990 <i>foo</i>'s
15991 <b>'foo'</b>
15992 <b>''foo''</b>
15993 <b>'''foo'''</b>
15994 <b>foo'<i>bar'</i>baz</b>
15995 <b>foo</b>'s
15996 '<i>foo</i>
15997 <i>foo</i>'
15998 '<i>foo</i>'
15999 '<b>foo</b>
16000 <b>foo</b>'
16001 '<b>foo</b>'</p>
16002 !! end
16003
16004 !! test
16005 2. Link fragments separated by <i> and <b> tags
16006 !! input
16007 [[''foo''<nowiki>hello]]</nowiki>
16008
16009 [['''foo'''<nowiki>hello]]</nowiki>
16010 !! result
16011 <p>[[<i>foo</i>hello]]
16012 </p><p>[[<b>foo</b>hello]]
16013 </p>
16014 !! end
16015
16016 !! test
16017 3. Link fragments inside <i> and <b>
16018 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
16019 this is one of the shortcomings of this format)
16020 !! input
16021 ''[[foo''<nowiki>]]</nowiki>
16022
16023 '''[[foo'''<nowiki>]]</nowiki>
16024 !! result
16025 <p><i>[[foo</i>]]
16026 </p><p><b>[[foo</b>]]
16027 </p>
16028 !! end
16029
16030 !! test
16031 4. No escaping needed
16032 !! input
16033 '<span>''bar''</span>'
16034 '<span>'''bar'''</span>'
16035 !! result
16036 <p>'<span><i>bar</i></span>'
16037 '<span><b>bar</b></span>'
16038 </p>
16039 !! end
16040
16041 #### ----------- Paragraphs ---------------
16042 #### 1. No unnecessary escapes
16043 #### --------------------------------------
16044
16045 !! test
16046 1. No unnecessary escapes
16047 !! input
16048 bar <span><nowiki>[[foo]]</nowiki></span>
16049
16050 =bar <span><nowiki>[[foo]]</nowiki></span>
16051
16052 [[bar <span><nowiki>[[foo]]</nowiki></span>
16053
16054 ]]bar <span><nowiki>[[foo]]</nowiki></span>
16055
16056 =bar <span>foo]]</span><nowiki>=</nowiki>
16057 !! result
16058 <p>bar <span>[[foo]]</span>
16059 </p><p>=bar <span>[[foo]]</span>
16060 </p><p>[[bar <span>[[foo]]</span>
16061 </p><p>]]bar <span>[[foo]]</span>
16062 </p><p>=bar <span>foo]]</span>=
16063 </p>
16064 !!end
16065
16066 #### ----------------------- PRE --------------------------
16067 #### 1. Leading whitespace in SOL context should be escaped
16068 #### ------------------------------------------------------
16069 !! test
16070 1. Leading whitespace in SOL context should be escaped
16071 !! options
16072 parsoid
16073 !! input
16074 <nowiki> </nowiki>a
16075
16076 <nowiki> </nowiki> a
16077
16078 <nowiki> </nowiki>a(tab)
16079
16080 <nowiki> </nowiki> a
16081 <!--cmt-->
16082 <nowiki> </nowiki> a
16083
16084 a
16085 <nowiki> </nowiki>b
16086
16087 a
16088 <nowiki> </nowiki>b
16089
16090 a
16091 <nowiki> </nowiki> b
16092 !! result
16093 <p> a</p>
16094 <p> a</p>
16095 <p> a(tab)</p>
16096 <p> a</p>
16097 <p><!--cmt--> a</p>
16098 <p>a
16099 b</p>
16100 <p>a
16101 b</p>
16102 <p>a
16103 b</p>
16104 !! end
16105
16106 #### --------------- HTML tags ---------------
16107 #### 1. a tags
16108 #### 2. other tags
16109 #### 3. multi-line html tag
16110 #### -----------------------------------------
16111 !! test
16112 1. a tags
16113 !! options
16114 parsoid
16115 !! input
16116 <a href="http://google.com">google</a>
16117 !! result
16118 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
16119 !! end
16120
16121 !! test
16122 2. other tags
16123 !! input
16124 <nowiki><div>foo</div>
16125 <div style="color:red">foo</div></nowiki>
16126 !! result
16127 <p>&lt;div&gt;foo&lt;/div&gt;
16128 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
16129 </p>
16130 !! end
16131
16132 !! test
16133 3. multi-line html tag
16134 !! input
16135 <nowiki><div
16136 >foo</div
16137 ></nowiki>
16138 !! result
16139 <p>&lt;div
16140 &gt;foo&lt;/div
16141 &gt;
16142 </p>
16143 !! end
16144
16145 !! test
16146 4. extension tags
16147 !! input
16148 <nowiki><ref>foo</ref></nowiki>
16149 !! result
16150 <p>&lt;ref&gt;foo&lt;/ref&gt;
16151 </p>
16152 !! end
16153
16154 #### --------------- Others ---------------
16155 !! test
16156 Escaping nowikis
16157 !! input
16158 &lt;nowiki&gt;foo&lt;/nowiki&gt;
16159 !! result
16160 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
16161 </p>
16162 !! end
16163
16164 ## The quote-char in the input is necessary for triggering the bug
16165 !! test
16166 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
16167 !! options
16168 parsoid=wt2wt,html2wt
16169 !! input
16170 foo's bar :
16171 !! result
16172 <p>foo's bar :</p>
16173 !! end
16174
16175 !! test
16176
16177 Tag-like HTML structures are passed through as text
16178 !! input
16179 <x y>
16180
16181 <x.y>
16182
16183 <x-y>
16184
16185 1>2
16186
16187 x<y
16188
16189 a>b
16190
16191 1<d e>f
16192 !! result
16193 <p>&lt;x y&gt;
16194 </p><p>&lt;x.y&gt;
16195 </p><p>&lt;x-y&gt;
16196 </p><p>1&gt;2
16197 </p><p>x&lt;y
16198 </p><p>a&gt;b
16199 </p><p>1&lt;d e&gt;f
16200 </p>
16201 !! end
16202
16203
16204 # This was a bug in the PHP parser (see bug 17663 and its dups,
16205 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
16206 !! test
16207 Tag names followed by punctuation should not be recognized as tags
16208 !! input
16209 <s.ome> text
16210 !! result
16211 <p>&lt;s.ome&gt; text
16212 </p>
16213 !! end
16214
16215 !! test
16216 HTML tag with necessary entities in attributes
16217 !! input
16218 <span title="&amp;amp;">foo</span>
16219 !! result
16220 <p><span title="&amp;amp;">foo</span>
16221 </p>
16222 !! end
16223
16224 !! test
16225 HTML tag with 'unnecessary' entity encoding in attributes
16226 !! input
16227 <span title="&amp;">foo</span>
16228 !! result
16229 <p><span title="&amp;">foo</span>
16230 </p>
16231 !! end
16232
16233 !! test
16234 HTML tag with broken attribute value quoting
16235 !! input
16236 <span title="Hello world>Foo</span>
16237 !! result
16238 <p><span>Foo</span>
16239 </p>
16240 !! end
16241
16242 !! test
16243 Parsoid-only: HTML tag with broken attribute value quoting
16244 !! options
16245 parsoid
16246 !! input
16247 <span title="Hello world>Foo</span>
16248 !! result
16249 <p><span title="Hello world">Foo</span>
16250 </p>
16251 !! end
16252
16253 !! test
16254 Table with broken attribute value quoting
16255 !! input
16256 {|
16257 | title="Hello world|Foo
16258 |}
16259 !! result
16260 <table>
16261 <tr>
16262 <td>Foo
16263 </td></tr></table>
16264
16265 !! end
16266
16267 !! test
16268 Table with broken attribute value quoting on consecutive lines
16269 !! input
16270 {|
16271 | title="Hello world|Foo
16272 | style="color:red|Bar
16273 |}
16274 !! result
16275 <table>
16276 <tr>
16277 <td>Foo
16278 </td>
16279 <td>Bar
16280 </td></tr></table>
16281
16282 !! end
16283
16284 !! test
16285 Parsoid-only: Table with broken attribute value quoting on consecutive lines
16286 !! options
16287 parsoid
16288 !! input
16289 {|
16290 | title="Hello world|Foo
16291 | style="color:red|Bar
16292 |}
16293 !! result
16294 <table><tbody>
16295 <tr>
16296 <td title="Hello world">Foo
16297 </td><td style="color: red">Bar
16298 </td></tr></tbody></table>
16299
16300 !! end
16301
16302 !! test
16303 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
16304 !! options
16305 parsoid
16306 !! input
16307 {{}}
16308 !! result
16309 {{}}
16310 !! end
16311
16312 !! test
16313 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
16314 !! options
16315 parsoid
16316 !! input
16317 }}{{
16318 !! result
16319 }}{{
16320 !! end
16321
16322 !!test
16323 Accept empty td cell attribute
16324 !!input
16325 {|
16326 | align="center" | foo || |
16327 |}
16328 !!result
16329 <table>
16330 <tr>
16331 <td align="center"> foo </td>
16332 <td>
16333 </td></tr></table>
16334
16335 !!end
16336
16337 !!test
16338 Non-empty attributes in th-cells
16339 !!input
16340 {|
16341 ! Foo !! style="color: red" | Bar
16342 |}
16343 !!result
16344 <table>
16345 <tr>
16346 <th> Foo </th>
16347 <th style="color: red"> Bar
16348 </th></tr></table>
16349
16350 !!end
16351
16352 !!test
16353 Accept empty attributes in th-cells
16354 !!input
16355 {|
16356 !| foo !!| bar
16357 |}
16358 !!result
16359 <table>
16360 <tr>
16361 <th> foo </th>
16362 <th> bar
16363 </th></tr></table>
16364
16365 !!end
16366
16367 !!test
16368 Empty table rows go away
16369 !!input
16370 {|
16371 | Hello
16372 | there
16373 |- class="foo"
16374 |-
16375 |}
16376 !! result
16377 <table>
16378 <tr>
16379 <td> Hello
16380 </td>
16381 <td> there
16382 </td></tr>
16383
16384 </table>
16385
16386 !! end
16387
16388 ###
16389 ### Parsoid-centric tests for testing RTing of inter-element separators
16390 ### Edge cases not tested by existing parser tests and specific to
16391 ### Parsoid-specific serialization strategies.
16392 ###
16393
16394 !!test
16395 RT-ed inter-element separators should be valid separators
16396 !!input
16397 {|
16398 |- [[foo]]
16399 |}
16400 !!result
16401 <table>
16402
16403 </table>
16404
16405 !!end
16406
16407 !!test
16408 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
16409 (Parsoid-only since PHP parser relies on Tidy for correct output)
16410 !!options
16411 parsoid
16412 !!input
16413 {|
16414 |<small>foo
16415 bar
16416 |}
16417
16418 {|
16419 |<small>foo<small>
16420 |}
16421 !!result
16422 !!end
16423
16424 !!test
16425 Empty TD followed by TD with tpl-generated attribute
16426 !!input
16427 {|
16428 |-
16429 |
16430 |{{echo|style='color:red'}}|foo
16431 |}
16432 !!result
16433 <table>
16434
16435 <tr>
16436 <td>
16437 </td>
16438 <td>foo
16439 </td></tr></table>
16440
16441 !!end
16442
16443 !!test
16444 Indented table with an empty td
16445 !!input
16446 {|
16447 |-
16448 |
16449 |foo
16450 |}
16451 !!result
16452 <table>
16453
16454 <tr>
16455 <td>
16456 </td>
16457 <td>foo
16458 </td></tr></table>
16459
16460 !!end
16461
16462 !!test
16463 Empty TR followed by a template-generated TR
16464 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
16465 !!options
16466 parsoid=wt2html,wt2wt
16467 !!input
16468 {|
16469 |-
16470 {{echo|<tr><td>foo</td></tr>}}
16471 |}
16472 !!result
16473 <table>
16474 <tbody>
16475 <tr></tr>
16476 <tr typeof="mw:Transclusion">
16477 <td>foo</td></tr></tbody></table>
16478 !!end
16479
16480 ## PHP and parsoid output differ for this, and since this is primarily
16481 ## for testing Parsoid's serializer, marking this Parsoid only
16482 !!test
16483 Empty TR followed by mixed-ws-comment line should RT correctly
16484 !!options
16485 parsoid
16486 !!input
16487 {|
16488 |-
16489 <!--c-->
16490 |-
16491 <!--c--> <!--d-->
16492 |}
16493 !!result
16494 <table>
16495 <tbody>
16496 <tr>
16497 <td> <!--c--></td></tr>
16498 <tr>
16499 <td><!--c--> <!--d--></td></tr>
16500 </tbody></table>
16501
16502 !!end
16503
16504 !!test
16505 Multi-line image caption generated by templates with/without trailing newlines
16506 !!options
16507 parsoid
16508 !!input
16509 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
16510 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
16511 !!result
16512 <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>
16513 <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>
16514
16515 !!end
16516
16517 ## PHP emits broken html for this, and since this is primarily
16518 ## a Parsoid serializer test, marking this Parsoid only
16519 !!test
16520 Improperly nested inline or quotes tags with whitespace in between
16521 !!options
16522 parsoid
16523 !!input
16524 <span> <s>x</span> </s>
16525 ''' ''x''' ''
16526 !!result
16527 <p><span> <s>x</s></span><s> </s>
16528 <b> <i>x</i></b><i> </i>
16529 </p>
16530 !!end
16531
16532 !!test
16533 Encapsulate protected attributes from wt
16534 !!options
16535 parsoid
16536 !!input
16537 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
16538 !!result
16539 <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>
16540 </body>
16541 !!end
16542
16543 # -----------------------------------------------------------------
16544 # The following section of tests are primarily to spec requirements
16545 # around serialization of new/edited content.
16546 #
16547 # All these tests are marked Parsoid html2wt and html2html only
16548 # ----------------------------------------------------------------
16549
16550 !! test
16551 Image: Modifying size of an image
16552 !! options
16553 parsoid=html2wt
16554 !! input
16555 [[Image:Wiki.png|230x230px]]
16556 !! result
16557 <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>
16558 !!end
16559
16560 !! test
16561 Image: New block level image should have \n before and after
16562 !! options
16563 parsoid=html2wt
16564 !! input
16565 123
16566 [[File:Wiki.png|right|thumb|150x150px]]
16567 456
16568 !! result
16569 <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>
16570 !!end
16571
16572 !! test
16573 Lists: Add space after bullets
16574 !! options
16575 parsoid=html2wt
16576 !! input
16577
16578 * foo
16579 * bar
16580 * <span> baz</span>
16581 !! result
16582 <ul>
16583 <li>foo</li>
16584 <li> bar</li>
16585 <li><span> baz</span></li>
16586 </ul>
16587 !! end
16588
16589 !! test
16590 Parsoid: Serialize positional parameters with = in them as named parameter
16591 !! options
16592 parsoid=html2wt
16593 !! input
16594 {{echo|1 = f=oo}}
16595 !! result
16596 <p about="#mwt1" typeof="mw:Transclusion"
16597 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}'
16598 >foo</p>
16599 !! end
16600
16601 # -----------------------------------------------------------------
16602 # End of section for Parsoid-only html2wt tests for serialization
16603 # of new content
16604 # -----------------------------------------------------------------
16605
16606 TODO:
16607 more images
16608 more tables
16609 character entities
16610 and much more
16611 Try for 100% code coverage