4aadd7aed840909f01057e4f7a94d5e96ab64e4e
[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 # For testing purposes, temporary articles can created:
31 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
32 # where '/' denotes a newline.
33
34 # This is the standard article assumed to exist.
35 !! article
36 Main Page
37 !! text
38 blah blah
39 !! endarticle
40
41 !!article
42 Template:Foo
43 !!text
44 FOO
45 !!endarticle
46
47 !! article
48 Template:Blank
49 !! text
50 !! endarticle
51
52 !! article
53 Template:pipe
54 !! text
55 |
56 !! endarticle
57
58 !!article
59 MediaWiki:bad image list
60 !!text
61 * [[File:Bad.jpg]] except [[Nasty page]]
62 !!endarticle
63
64 !! article
65 Template:inner list
66 !! text
67 * item 1
68 !! endarticle
69
70 !! article
71 Template:tbl-start
72 !! text
73 {|
74 !! endarticle
75
76 !! article
77 Template:tbl-end
78 !! text
79 |}
80 !! endarticle
81
82 !! article
83 Template:!
84 !! text
85 |
86 !! endarticle
87
88 !! article
89 Template:echo
90 !! text
91 {{{1}}}
92 !! endarticle
93
94 !! article
95 Template:echo_with_span
96 !! text
97 <span>{{{1}}}</span>
98 !! endarticle
99
100 !! article
101 Template:echo_with_div
102 !! text
103 <div>{{{1}}}</div>
104 !! endarticle
105
106 !! article
107 Template:attr_str
108 !! text
109 {{{1}}}="{{{2}}}"
110 !! endarticle
111
112 !! article
113 Template:table_attribs
114 !! text
115 <noinclude>
116 |</noinclude>style="color: red"| Foo
117 !! endarticle
118
119 !! article
120 A?b
121 !! text
122 Weirdo titles!
123 !! endarticle
124
125 ###
126 ### Basic tests
127 ###
128 !! test
129 Blank input
130 !! input
131 !! result
132 !! end
133
134
135 !! test
136 Simple paragraph
137 !! input
138 This is a simple paragraph.
139 !! result
140 <p>This is a simple paragraph.
141 </p>
142 !! end
143
144 !! test
145 Paragraphs with extra newline spacing
146 !! input
147 foo
148
149 bar
150
151
152 baz
153
154
155
156 booz
157 !! result
158 <p>foo
159 </p><p>bar
160 </p><p><br />
161 baz
162 </p><p><br />
163 </p><p>booz
164 </p>
165 !! end
166
167 !! test
168 Paragraphs with newline spacing with comment lines in between
169 !! input
170 ----
171 a
172 <!--foo-->
173 b
174 ----
175 a
176 <!--foo--><!--More than 1 comment disables stripping of this line!-->
177 b
178 ----
179 a
180 <!--foo-->
181
182 b
183 ----
184 a
185
186 <!--foo-->
187 b
188 ----
189 a
190 <!--foo-->
191
192
193 b
194 ----
195 a
196
197
198 <!--foo-->
199 b
200 ----
201 !! result
202 <hr />
203 <p>a
204 b
205 </p>
206 <hr />
207 <p>a
208 </p><p>b
209 </p>
210 <hr />
211 <p>a
212 </p><p>b
213 </p>
214 <hr />
215 <p>a
216 </p><p>b
217 </p>
218 <hr />
219 <p>a
220 </p><p><br />
221 b
222 </p>
223 <hr />
224 <p>a
225 </p><p><br />
226 b
227 </p>
228 <hr />
229
230 !! end
231
232 !! test
233 Paragraphs with newline spacing with non-empty white-space lines in between
234 !! input
235 ----
236 a
237
238 b
239 ----
240 a
241
242
243 b
244 ----
245 !! result
246 <hr />
247 <p>a
248 </p><p>b
249 </p>
250 <hr />
251 <p>a
252 </p><p><br />
253 b
254 </p>
255 <hr />
256
257 !! end
258
259 !! test
260 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
261 !! input
262 ----
263 a
264 <!--foo-->
265 b
266 ----
267 a
268 <!--foo--><!--More than 1 comment disables stripping of this line!-->
269 b
270 ----
271 a
272
273 <!--foo-->
274 <!--bar-->
275 b
276 ----
277 a
278
279 <!--foo-->
280 <!--bar-->
281
282 b
283 ----
284 !! result
285 <hr />
286 <p>a
287 b
288 </p>
289 <hr />
290 <p>a
291 </p><p>b
292 </p>
293 <hr />
294 <p>a
295 </p><p>b
296 </p>
297 <hr />
298 <p>a
299 </p><p><br />
300 b
301 </p>
302 <hr />
303
304 !! end
305
306 !! test
307 Extra newlines: More paragraphs with indented comment
308 !! input
309 a
310
311 <!--boo-->
312
313 b
314 !!result
315 <p>a
316 </p><p><br />
317 b
318 </p>
319 !!end
320
321 !! test
322 Extra newlines followed by heading
323 !! input
324 a
325
326
327
328 =b=
329 [[a]]
330
331
332 =b=
333 !! result
334 <p>a
335 </p><p><br />
336 </p>
337 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a>]</span></h1>
338 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
339 </p><p><br />
340 </p>
341 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a>]</span></h1>
342
343 !! end
344
345 !! test
346 Extra newlines between heading and content are swallowed
347 !! input
348 =b=
349
350
351
352 [[a]]
353 !! result
354 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a>]</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>
357 !! end
358
359 !! test
360 Parsing an URL
361 !! input
362 http://fr.wikipedia.org/wiki/🍺
363 <!-- EasterEgg we love beer, better be able be able to link to it -->
364 !! result
365 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
366 </p>
367 !! end
368
369 !! test
370 Simple list
371 !! input
372 * Item 1
373 * Item 2
374 !! result
375 <ul><li> Item 1
376 </li><li> Item 2
377 </li></ul>
378
379 !! end
380
381 !! test
382 Italics and bold
383 !! input
384 * plain
385 * plain''italic''plain
386 * plain''italic''plain''italic''plain
387 * plain'''bold'''plain
388 * plain'''bold'''plain'''bold'''plain
389 * plain''italic''plain'''bold'''plain
390 * plain'''bold'''plain''italic''plain
391 * plain''italic'''bold-italic'''italic''plain
392 * plain'''bold''bold-italic''bold'''plain
393 * plain'''''bold-italic'''italic''plain
394 * plain'''''bold-italic''bold'''plain
395 * plain''italic'''bold-italic'''''plain
396 * plain'''bold''bold-italic'''''plain
397 * plain l'''italic''plain
398 * plain l''''bold''' plain
399 !! result
400 <ul><li> plain
401 </li><li> plain<i>italic</i>plain
402 </li><li> plain<i>italic</i>plain<i>italic</i>plain
403 </li><li> plain<b>bold</b>plain
404 </li><li> plain<b>bold</b>plain<b>bold</b>plain
405 </li><li> plain<i>italic</i>plain<b>bold</b>plain
406 </li><li> plain<b>bold</b>plain<i>italic</i>plain
407 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
408 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
409 </li><li> plain<i><b>bold-italic</b>italic</i>plain
410 </li><li> plain<b><i>bold-italic</i>bold</b>plain
411 </li><li> plain<i>italic<b>bold-italic</b></i>plain
412 </li><li> plain<b>bold<i>bold-italic</i></b>plain
413 </li><li> plain l'<i>italic</i>plain
414 </li><li> plain l'<b>bold</b> plain
415 </li></ul>
416
417 !! end
418
419 # this example taken from the simple/Moon article
420 !! test
421 Italics and possessives
422 !! input
423 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
424 !! result
425 <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
426 </p>
427 !! end
428
429 ###
430 ### 2-quote opening sequence tests
431 ###
432 !! test
433 Italics and bold: 2-quote opening sequence: (2,2)
434 !! input
435 ''foo''
436 !! result
437 <p><i>foo</i>
438 </p>
439 !!end
440
441
442 !! test
443 Italics and bold: 2-quote opening sequence: (2,3)
444 !! input
445 ''foo'''
446 !! result
447 <p><i>foo'</i>
448 </p>
449 !!end
450
451
452 !! test
453 Italics and bold: 2-quote opening sequence: (2,4)
454 !! input
455 ''foo''''
456 !! result
457 <p><i>foo''</i>
458 </p>
459 !!end
460
461
462 !! test
463 Italics and bold: 2-quote opening sequence: (2,5) (php)
464 !! options
465 php
466 !! input
467 ''foo'''''
468 !! result
469 <p><i>foo</i>
470 </p>
471 !!end
472 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
473 !! test
474 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
475 !! options
476 parsoid
477 !! input
478 ''foo'''''
479 !! result
480 <p><i>foo</i><b></b>
481 </p>
482 !!end
483
484
485 ###
486 ### 3-quote opening sequence tests
487 ###
488
489 !! test
490 Italics and bold: 3-quote opening sequence: (3,2)
491 !! input
492 '''foo''
493 !! result
494 <p>'<i>foo</i>
495 </p>
496 !!end
497
498
499 !! test
500 Italics and bold: 3-quote opening sequence: (3,3)
501 !! input
502 '''foo'''
503 !! result
504 <p><b>foo</b>
505 </p>
506 !!end
507
508
509 !! test
510 Italics and bold: 3-quote opening sequence: (3,4)
511 !! input
512 '''foo''''
513 !! result
514 <p><b>foo'</b>
515 </p>
516 !!end
517
518
519 !! test
520 Italics and bold: 3-quote opening sequence: (3,5) (php)
521 !! options
522 php
523 !! input
524 '''foo'''''
525 !! result
526 <p><b>foo</b>
527 </p>
528 !!end
529 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
530 !! test
531 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
532 !! options
533 parsoid
534 !! input
535 '''foo'''''
536 !! result
537 <p><b>foo<i></i></b>
538 </p>
539 !!end
540
541
542 ###
543 ### 4-quote opening sequence tests
544 ###
545
546 !! test
547 Italics and bold: 4-quote opening sequence: (4,2)
548 !! input
549 ''''foo''
550 !! result
551 <p>''<i>foo</i>
552 </p>
553 !!end
554
555
556 !! test
557 Italics and bold: 4-quote opening sequence: (4,3)
558 !! input
559 ''''foo'''
560 !! result
561 <p>'<b>foo</b>
562 </p>
563 !!end
564
565
566 !! test
567 Italics and bold: 4-quote opening sequence: (4,4)
568 !! input
569 ''''foo''''
570 !! result
571 <p>'<b>foo'</b>
572 </p>
573 !!end
574
575
576 !! test
577 Italics and bold: 4-quote opening sequence: (4,5) (php)
578 !! options
579 php
580 !! input
581 ''''foo'''''
582 !! result
583 <p>'<b>foo</b>
584 </p>
585 !!end
586 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
587 !! test
588 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
589 !! options
590 parsoid
591 !! input
592 ''''foo'''''
593 !! result
594 <p>'<b>foo<i></i></b>
595 </p>
596 !!end
597
598
599 ###
600 ### 5-quote opening sequence tests
601 ###
602
603 !! test
604 Italics and bold: 5-quote opening sequence: (5,2) (php)
605 !! options
606 php
607 !! input
608 '''''foo''
609 !! result
610 <p><b><i>foo</i></b>
611 </p>
612 !!end
613 # Parsoid reverses the nesting order, compared to the PHP parser
614 !! test
615 Italics and bold: 5-quote opening sequence: (5,2) (parsoid)
616 !! options
617 parsoid
618 !! input
619 '''''foo''
620 !! result
621 <p><i><b>foo</b></i>
622 </p>
623 !!end
624
625
626 !! test
627 Italics and bold: 5-quote opening sequence: (5,3)
628 !! input
629 '''''foo'''
630 !! result
631 <p><i><b>foo</b></i>
632 </p>
633 !!end
634
635
636 !! test
637 Italics and bold: 5-quote opening sequence: (5,4)
638 !! input
639 '''''foo''''
640 !! result
641 <p><i><b>foo'</b></i>
642 </p>
643 !!end
644
645
646 !! test
647 Italics and bold: 5-quote opening sequence: (5,5)
648 !! input
649 '''''foo'''''
650 !! result
651 <p><i><b>foo</b></i>
652 </p>
653 !!end
654
655 ###
656 ### multiple quote sequences in a line
657 ###
658 !! test
659 Italics and bold: multiple quote sequences: (2,4,2)
660 !! input
661 ''foo''''bar''
662 !! result
663 <p><i>foo'<b>bar</b></i>
664 </p>
665 !!end
666
667
668 !! test
669 Italics and bold: multiple quote sequences: (2,4,3)
670 !! input
671 ''foo''''bar'''
672 !! result
673 <p><i>foo'<b>bar</b></i>
674 </p>
675 !!end
676
677
678 !! test
679 Italics and bold: multiple quote sequences: (2,4,4)
680 !! input
681 ''foo''''bar''''
682 !! result
683 <p><i>foo'<b>bar'</b></i>
684 </p>
685 !!end
686
687
688 !! test
689 Italics and bold: multiple quote sequences: (3,4,2) (php)
690 !! options
691 php
692 !! input
693 '''foo''''bar''
694 !! result
695 <p><b>foo'</b>bar
696 </p>
697 !!end
698 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
699 !! test
700 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
701 !! options
702 parsoid
703 !! input
704 '''foo''''bar''
705 !! result
706 <p><b>foo'</b>bar<i></i>
707 </p>
708 !!end
709
710
711 !! test
712 Italics and bold: multiple quote sequences: (3,4,3) (php)
713 !! options
714 php
715 !! input
716 '''foo''''bar'''
717 !! result
718 <p><b>foo'</b>bar
719 </p>
720 !!end
721 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
722 !! test
723 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
724 !! options
725 parsoid
726 !! input
727 '''foo''''bar'''
728 !! result
729 <p><b>foo'</b>bar<b></b>
730 </p>
731 !!end
732
733 ###
734 ### other quote tests
735 ###
736 !! test
737 Italics and bold: other quote tests: (2,3,5)
738 !! input
739 ''this is about '''foo's family'''''
740 !! result
741 <p><i>this is about <b>foo's family</b></i>
742 </p>
743 !!end
744
745
746 !! test
747 Italics and bold: other quote tests: (2,(3,3),2)
748 !! input
749 ''this is about '''foo's''' family''
750 !! result
751 <p><i>this is about <b>foo's</b> family</i>
752 </p>
753 !!end
754
755
756 !! test
757 Italics and bold: other quote tests: (3,2,3,2)
758 !! input
759 '''this is about ''foo'''s family''
760 !! result
761 <p><b>this is about <i>foo</i></b><i>s family</i>
762 </p>
763 !!end
764
765
766 # The Parsoid team believes the PHP parser's output on this test is wrong.
767 # It only checks for convert-to-bold-on-single-character-word when the word
768 # matches with a bold tag ("'''") that is *odd* in the list of quote tokens.
769 # This means that the bold token in position 2 (0-indexed) gets converted by
770 # parsoid, but doesn't get changed by the PHP parser.
771 !! test
772 Italics and bold: other quote tests: (3,2,3,3) (php)
773 !! options
774 php
775 !! input
776 '''this is about ''foo'''s family'''
777 !! result
778 <p>'<i>this is about </i>foo<b>s family</b>
779 </p>
780 !!end
781 # This is the output the Parsoid team believes to be correct.
782 !! test
783 Italics and bold: other quote tests: (3,2,3,3) (parsoid)
784 !! options
785 parsoid
786 !! input
787 '''this is about ''foo'''s family'''
788 !! result
789 <p><b>this is about <i>foo'</i>s family</b>
790 </p>
791 !!end
792
793
794 !! test
795 Italics and bold: other quote tests: (3,(2,2),3)
796 !! input
797 '''this is about ''foo's'' family'''
798 !! result
799 <p><b>this is about <i>foo's</i> family</b>
800 </p>
801 !!end
802
803
804 !! test
805 Italicized possessive
806 !! input
807 The ''[[Main Page]]'''s talk page.
808 !! result
809 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
810 </p>
811 !! end
812
813 ###
814 ### Non-html5 tags
815 ###
816
817 !! test
818 Non-html5 tags should be accepted
819 !! input
820 <center>''foo''</center>
821 <big>''foo''</big>
822 <font>''foo''</font>
823 <strike>''foo''</strike>
824 <tt>''foo''</tt>
825 !! result
826 <center><i>foo</i></center>
827 <p><big><i>foo</i></big>
828 <font><i>foo</i></font>
829 <strike><i>foo</i></strike>
830 <tt><i>foo</i></tt>
831 </p>
832 !! end
833
834 ###
835 ### <nowiki> test cases
836 ###
837
838 !! test
839 <nowiki> unordered list
840 !! input
841 <nowiki>* This is not an unordered list item.</nowiki>
842 !! result
843 <p>* This is not an unordered list item.
844 </p>
845 !! end
846
847 !! test
848 <nowiki> spacing
849 !! input
850 <nowiki>Lorem ipsum dolor
851
852 sed abit.
853 sed nullum.
854
855 :and a colon
856 </nowiki>
857 !! result
858 <p>Lorem ipsum dolor
859
860 sed abit.
861 sed nullum.
862
863 :and a colon
864
865 </p>
866 !! end
867
868 !! test
869 nowiki 3
870 !! input
871 :There is not nowiki.
872 :There is <nowiki>nowiki</nowiki>.
873
874 #There is not nowiki.
875 #There is <nowiki>nowiki</nowiki>.
876
877 *There is not nowiki.
878 *There is <nowiki>nowiki</nowiki>.
879 !! result
880 <dl><dd>There is not nowiki.
881 </dd><dd>There is nowiki.
882 </dd></dl>
883 <ol><li>There is not nowiki.
884 </li><li>There is nowiki.
885 </li></ol>
886 <ul><li>There is not nowiki.
887 </li><li>There is nowiki.
888 </li></ul>
889
890 !! end
891
892 !! test
893 Entities inside <nowiki>
894 !! input
895 <nowiki>&lt;</nowiki>
896 !! result
897 <p>&lt;
898 </p>
899 !! end
900
901
902 ###
903 ### Comments
904 ###
905 !! test
906 Comments and Indent-Pre
907 !! input
908 <!-- comment 1 --> asdf
909
910 <!-- comment 1 --> asdf
911 <!-- comment 2 -->
912
913 <!-- comment 1 --> asdf
914 <!-- comment 2 -->xyz
915
916 <!-- comment 1 --> asdf
917 <!-- comment 2 --> xyz
918 !! result
919 <pre>asdf
920 </pre>
921 <pre>asdf
922 </pre>
923 <pre>asdf
924 </pre>
925 <p>xyz
926 </p>
927 <pre>asdf
928 xyz
929 </pre>
930 !! end
931
932 !! test
933 Comment test 2a
934 !! input
935 asdf
936 <!-- comment 1 -->
937 jkl
938 !! result
939 <p>asdf
940 jkl
941 </p>
942 !! end
943
944 !! test
945 Comment test 2b
946 !! input
947 asdf
948 <!-- comment 1 -->
949
950 jkl
951 !! result
952 <p>asdf
953 </p><p>jkl
954 </p>
955 !! end
956
957 !! test
958 Comment test 3
959 !! input
960 asdf
961 <!-- comment 1 -->
962 <!-- comment 2 -->
963 jkl
964 !! result
965 <p>asdf
966 jkl
967 </p>
968 !! end
969
970 !! test
971 Comment test 4
972 !! input
973 asdf<!-- comment 1 -->jkl
974 !! result
975 <p>asdfjkl
976 </p>
977 !! end
978
979 !! test
980 Comment spacing
981 !! input
982 a
983 <!-- foo --> b <!-- bar -->
984 c
985 !! result
986 <p>a
987 </p>
988 <pre> b
989 </pre>
990 <p>c
991 </p>
992 !! end
993
994 !! test
995 Comment whitespace
996 !! input
997 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
998 !! result
999
1000 !! end
1001
1002 !! test
1003 Comment semantics and delimiters
1004 !! input
1005 <!-- --><!----><!-----><!------>
1006 !! result
1007
1008 !! end
1009
1010 !! test
1011 Comment semantics and delimiters, redux
1012 !! input
1013 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1014 -- foo -- funky huh? ... -->
1015 !! result
1016
1017 !! end
1018
1019 !! test
1020 Comment semantics and delimiters: directors cut
1021 !! input
1022 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1023 everything starting with < followed by !-- until the first -- and > we see,
1024 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1025 -->-->
1026 !! result
1027 <p>--&gt;
1028 </p>
1029 !! end
1030
1031 !! test
1032 Comment semantics: nesting
1033 !! input
1034 <!--<!-- no, we're not going to do anything fancy here -->-->
1035 !! result
1036 <p>--&gt;
1037 </p>
1038 !! end
1039
1040 !! test
1041 Comment semantics: unclosed comment at end
1042 !! input
1043 <!--This comment will run out to the end of the document
1044 !! result
1045
1046 !! end
1047
1048 !! test
1049 Comment in template title
1050 !! input
1051 {{f<!---->oo}}
1052 !! result
1053 <p>FOO
1054 </p>
1055 !! end
1056
1057 !! test
1058 Comment on its own line post-expand
1059 !! input
1060 a
1061 {{blank}}<!---->
1062 b
1063 !! result
1064 <p>a
1065 </p><p>b
1066 </p>
1067 !! end
1068
1069 !! test
1070 Comment on its own line post-expand with non-significant whitespace
1071 !! input
1072 a
1073 {{blank}} <!---->
1074 b
1075 !! result
1076 <p>a
1077 </p><p>b
1078 </p>
1079 !! end
1080
1081 ###
1082 ### paragraph wraping tests
1083 ###
1084 !! test
1085 No block tags
1086 !! input
1087 a
1088
1089 b
1090 !! result
1091 <p>a
1092 </p><p>b
1093 </p>
1094 !! end
1095 !! test
1096 Block tag on one line
1097 !! input
1098 a <div>foo</div>
1099
1100 b
1101 !! result
1102 a <div>foo</div>
1103 <p>b
1104 </p>
1105 !! end
1106
1107 !! test
1108 Block tag on both lines
1109 !! input
1110 a <div>foo</div>
1111
1112 b <div>foo</div>
1113 !! result
1114 a <div>foo</div>
1115 b <div>foo</div>
1116
1117 !! end
1118
1119 !! test
1120 Multiple lines without block tags
1121 !! input
1122 <div>foo</div> a
1123 b
1124 c
1125 d<!--foo--> e
1126 x <div>foo</div> z
1127 !! result
1128 <div>foo</div> a
1129 <p>b
1130 c
1131 d e
1132 </p>
1133 x <div>foo</div> z
1134
1135 !! end
1136
1137 !! test
1138 Empty lines between lines with block tags
1139 !! input
1140 <div></div>
1141
1142
1143 <div></div>a
1144
1145 b
1146 <div>a</div>b
1147
1148 <div>b</div>d
1149
1150
1151 <div>e</div>
1152 !! result
1153 <div></div>
1154 <p><br />
1155 </p>
1156 <div></div>a
1157 <p>b
1158 </p>
1159 <div>a</div>b
1160 <div>b</div>d
1161 <p><br />
1162 </p>
1163 <div>e</div>
1164
1165 !! end
1166
1167 ###
1168 ### Preformatted text
1169 ###
1170 !! test
1171 Preformatted text
1172 !! input
1173 This is some
1174 Preformatted text
1175 With ''italic''
1176 And '''bold'''
1177 And a [[Main Page|link]]
1178 !! result
1179 <pre>This is some
1180 Preformatted text
1181 With <i>italic</i>
1182 And <b>bold</b>
1183 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1184 </pre>
1185 !! end
1186
1187 !! test
1188 Ident preformatting with inline content
1189 !! input
1190 a
1191 ''b''
1192 !! result
1193 <pre>a
1194 <i>b</i>
1195 </pre>
1196 !! end
1197
1198 !! test
1199 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1200 !! input
1201 <pre><nowiki>
1202 <b>
1203 <cite>
1204 <em>
1205 </nowiki></pre>
1206 !! result
1207 <pre>
1208 &lt;b&gt;
1209 &lt;cite&gt;
1210 &lt;em&gt;
1211 </pre>
1212
1213 !! end
1214
1215 !! test
1216 Regression with preformatted in <center>
1217 !! input
1218 <center>
1219 Blah
1220 </center>
1221 !! result
1222 <center>
1223 <pre>Blah
1224 </pre>
1225 </center>
1226
1227 !! end
1228
1229 # Expected output in the following test is not really expected (there should be
1230 # <pre> in the output) -- it's only testing for well-formedness.
1231 !! test
1232 Bug 6200: Preformatted in <blockquote>
1233 !! input
1234 <blockquote>
1235 Blah
1236 </blockquote>
1237 !! result
1238 <blockquote>
1239 Blah
1240 </blockquote>
1241
1242 !! end
1243
1244 !! test
1245 <pre> with attributes (bug 3202)
1246 !! input
1247 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1248 !! result
1249 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1250
1251 !! end
1252
1253 !! test
1254 <pre> with width attribute (bug 3202)
1255 !! input
1256 <pre width="8">Narrow screen goodies</pre>
1257 !! result
1258 <pre width="8">Narrow screen goodies</pre>
1259
1260 !! end
1261
1262 !! test
1263 <pre> with forbidden attribute (bug 3202)
1264 !! input
1265 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1266 !! result
1267 <pre width="8">Narrow screen goodies</pre>
1268
1269 !! end
1270
1271 !! test
1272 Entities inside <pre>
1273 !! input
1274 <pre>&lt;</pre>
1275 !! result
1276 <pre>&lt;</pre>
1277
1278 !! end
1279
1280 !! test
1281 <pre> with forbidden attribute values (bug 3202)
1282 !! input
1283 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1284 !! result
1285 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1286
1287 !! end
1288
1289 !! test
1290 <nowiki> inside <pre> (bug 13238)
1291 !! input
1292 <pre>
1293 <nowiki>
1294 </pre>
1295 <pre>
1296 <nowiki></nowiki>
1297 </pre>
1298 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1299 !! result
1300 <pre>
1301 &lt;nowiki&gt;
1302 </pre>
1303 <pre>
1304
1305 </pre>
1306 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1307
1308 !! end
1309
1310 !! test
1311 <nowiki> and <pre> preference (first one wins)
1312 !! input
1313 <pre>
1314 <nowiki>
1315 </pre>
1316 </nowiki>
1317 </pre>
1318
1319 <nowiki>
1320 <pre>
1321 <nowiki>
1322 </pre>
1323 </nowiki>
1324 </pre>
1325
1326 !! result
1327 <pre>
1328 &lt;nowiki&gt;
1329 </pre>
1330 <p>&lt;/nowiki&gt;
1331 &lt;/pre&gt;
1332 </p><p>
1333 &lt;pre&gt;
1334 &lt;nowiki&gt;
1335 &lt;/pre&gt;
1336
1337 &lt;/pre&gt;
1338 </p>
1339 !! end
1340
1341 !! test
1342 </pre> inside nowiki
1343 !! input
1344 <nowiki></pre></nowiki>
1345 !! result
1346 <p>&lt;/pre&gt;
1347 </p>
1348 !! end
1349
1350 !!test
1351 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1352 !!input
1353 {{echo|}}
1354 !!result
1355
1356 !!end
1357
1358 !!test
1359 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1360 !!input
1361 {{echo|
1362 foo}}
1363 !!result
1364 <p>foo
1365 </p>
1366 !!end
1367
1368 !! test
1369 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1370 !! input
1371 {{echo|a
1372 b}}
1373 !!result
1374 <pre>a
1375 </pre>
1376 <p>b
1377 </p>
1378 !!end
1379
1380 !! test
1381 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1382 !! input
1383 {{echo|a
1384 b
1385 c
1386 d
1387 e
1388 }}
1389 !!result
1390 <pre>a
1391 </pre>
1392 <p>b
1393 c
1394 </p>
1395 <pre>d
1396 </pre>
1397 <p>e
1398 </p>
1399 !!end
1400
1401 !!test
1402 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1403 !!input
1404 {{echo| foo}}
1405
1406 {{echo| foo}}{{echo| bar}}
1407
1408 {{echo| foo}}
1409 {{echo| bar}}
1410
1411 {{echo|<!--cmt--> foo}}
1412
1413 <!--cmt-->{{echo| foo}}
1414
1415 {{echo|{{echo| }}bar}}
1416 !!result
1417 <pre>foo
1418 </pre>
1419 <pre>foo bar
1420 </pre>
1421 <pre>foo
1422 bar
1423 </pre>
1424 <pre>foo
1425 </pre>
1426 <pre>foo
1427 </pre>
1428 <pre>bar
1429 </pre>
1430 !!end
1431
1432 !! test
1433 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1434 !! input
1435 {{echo| }}a
1436
1437 {{echo|
1438 }}a
1439
1440 {{echo|
1441 b}}
1442
1443 {{echo|a
1444 }}b
1445
1446 {{echo|a
1447 }} b
1448 !!result
1449 <pre>a
1450 </pre>
1451 <p><br />
1452 </p>
1453 <pre>a
1454 </pre>
1455 <p><br />
1456 </p>
1457 <pre>b
1458 </pre>
1459 <p>a
1460 </p>
1461 <pre>b
1462 </pre>
1463 <p>a
1464 </p>
1465 <pre>b
1466 </pre>
1467 !!end
1468
1469 !! test
1470 Templates: Single-line variant of parameter whitespace stripping test
1471 !! input
1472 {{echo| a}}
1473
1474 {{echo|1= a}}
1475
1476 {{echo|{{echo| a}}}}
1477
1478 {{echo|1={{echo| a}}}}
1479 !! result
1480 <pre>a
1481 </pre>
1482 <p>a
1483 </p>
1484 <pre>a
1485 </pre>
1486 <p>a
1487 </p>
1488 !! end
1489
1490 !! test
1491 Templates: Strip whitespace from named parameters, but not positional ones
1492 !! input
1493 {{echo|
1494 foo}}
1495
1496 {{echo|
1497 * foo}}
1498
1499 {{echo| 1 =
1500 foo}}
1501
1502 {{echo| 1 =
1503 * foo}}
1504 !! result
1505 <pre>foo
1506 </pre>
1507 <p><br />
1508 </p>
1509 <ul><li> foo
1510 </li></ul>
1511 <p>foo
1512 </p>
1513 <ul><li> foo
1514 </li></ul>
1515
1516 !! end
1517
1518 ###
1519 ### Parsoid-centric tests for testing RT edge cases for pre
1520 ###
1521
1522 !!test
1523 1a. Indent-Pre and Comments
1524 !!input
1525 a
1526 <!--a-->
1527 c
1528 !!result
1529 <pre>a
1530 </pre>
1531 <p>c
1532 </p>
1533 !!end
1534
1535 !!test
1536 1b. Indent-Pre and Comments
1537 !!input
1538 a
1539 <!--a-->
1540 c
1541 !!result
1542 <pre>a
1543 </pre>
1544 <p>c
1545 </p>
1546 !!end
1547
1548 !!test
1549 1c. Indent-Pre and Comments
1550 !!input
1551 <!--a--> a
1552
1553 <!--a--> a
1554 !!result
1555 <pre> a
1556 </pre>
1557 <pre> a
1558 </pre>
1559 !!end
1560
1561 !!test
1562 2a. Indent-Pre and tables
1563 !!input
1564 {|
1565 |-
1566 !h1!!h2
1567 |foo||bar
1568 |}
1569 !!result
1570 <table>
1571
1572 <tr>
1573 <th>h1</th>
1574 <th>h2
1575 </th>
1576 <td>foo</td>
1577 <td>bar
1578 </td></tr></table>
1579
1580 !!end
1581
1582 !!test
1583 2b. Indent-Pre and tables
1584 !!input
1585 {|
1586 |-
1587 |foo
1588 |}
1589 !!result
1590 <table>
1591
1592 <tr>
1593 <td>foo
1594 </td></tr></table>
1595
1596 !!end
1597
1598 !!test
1599 2c. Indent-Pre and tables (bug 42252)
1600 !!input
1601 {|
1602 |+ foo
1603 ! | bar
1604 |}
1605 !!result
1606 <table>
1607 <caption> foo
1608 </caption>
1609 <tr>
1610 <th> bar
1611 </th></tr></table>
1612
1613 !!end
1614
1615 !!test
1616 3a. Indent-Pre and block tags (single-line html)
1617 !!input
1618 <p> foo </p>
1619 <div> foo </div>
1620 <span> foo </span>
1621 !!result
1622 <p> foo </p>
1623 <div> foo </div>
1624 <pre><span> foo </span>
1625 </pre>
1626 !!end
1627
1628 !!test
1629 3b. Indent-Pre and block tags (pre-content on separate line)
1630 !!input
1631 <p>
1632 foo
1633 </p>
1634
1635 <div>
1636 foo
1637 </div>
1638
1639 <center>
1640 foo
1641 </center>
1642
1643 <blockquote>
1644 foo
1645 </blockquote>
1646
1647 <table><tr><td>
1648 foo
1649 </td></tr></table>
1650
1651 <ul><li>
1652 foo
1653 </li></ul>
1654
1655 !!result
1656 <p>
1657 foo
1658 </p>
1659 <div>
1660 <pre>foo
1661 </pre>
1662 </div>
1663 <center>
1664 <pre>foo
1665 </pre>
1666 </center>
1667 <blockquote>
1668 foo
1669 </blockquote>
1670 <table><tr><td>
1671 <pre>foo
1672 </pre>
1673 </td></tr></table>
1674 <ul><li>
1675 foo
1676 </li></ul>
1677
1678 !!end
1679
1680 !!test
1681 4. Multiple spaces at start-of-line
1682 !!input
1683 <p> foo </p>
1684 foo
1685 {|
1686 |foo
1687 |}
1688 !!result
1689 <p> foo </p>
1690 <pre> foo
1691 </pre>
1692 <table>
1693 <tr>
1694 <td>foo
1695 </td></tr></table>
1696
1697 !!end
1698
1699 !! test
1700 5. White-space in indent-pre
1701 NOTE: the white-space char on 2nd line is significant
1702 !! input
1703 a<br/>
1704
1705 b
1706 !! result
1707 <pre>a<br />
1708
1709 b
1710 </pre>
1711 !! end
1712
1713 ###
1714 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1715 ###
1716
1717 !!test
1718 HTML-pre: 1. embedded newlines
1719 !!input
1720 <pre>foo</pre>
1721
1722 <pre>
1723 foo
1724 </pre>
1725
1726 <pre>
1727
1728 foo
1729 </pre>
1730
1731 <pre>
1732
1733
1734 foo
1735 </pre>
1736 !!result
1737 <pre>foo</pre>
1738 <pre>
1739 foo
1740 </pre>
1741 <pre>
1742
1743 foo
1744 </pre>
1745 <pre>
1746
1747
1748 foo
1749 </pre>
1750
1751 !!end
1752
1753 !!test
1754 HTML-pre: 2: indented text
1755 !!input
1756 <pre>
1757 foo
1758 </pre>
1759 !!result
1760 <pre>
1761 foo
1762 </pre>
1763
1764 !!end
1765
1766 !!test
1767 HTML-pre: 3: other wikitext
1768 !!input
1769 <pre>
1770 * foo
1771 # bar
1772 = no-h =
1773 '' no-italic ''
1774 [[ NoLink ]]
1775 </pre>
1776 !!result
1777 <pre>
1778 * foo
1779 # bar
1780 = no-h =
1781 '' no-italic ''
1782 [[ NoLink ]]
1783 </pre>
1784
1785 !!end
1786
1787 ###
1788 ### Definition lists
1789 ###
1790 !! test
1791 Simple definition
1792 !! input
1793 ; name : Definition
1794 !! result
1795 <dl><dt> name&#160;</dt><dd> Definition
1796 </dd></dl>
1797
1798 !! end
1799
1800 !! test
1801 Definition list for indentation only
1802 !! input
1803 : Indented text
1804 !! result
1805 <dl><dd> Indented text
1806 </dd></dl>
1807
1808 !! end
1809
1810 !! test
1811 Definition list with no space
1812 !! input
1813 ;name:Definition
1814 !! result
1815 <dl><dt>name</dt><dd>Definition
1816 </dd></dl>
1817
1818 !!end
1819
1820 !! test
1821 Definition list with URL link
1822 !! input
1823 ; http://example.com/ : definition
1824 !! result
1825 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
1826 </dd></dl>
1827
1828 !! end
1829
1830 !! test
1831 Definition list with bracketed URL link
1832 !! input
1833 ;[http://www.example.com/ Example]:Something about it
1834 !! result
1835 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
1836 </dd></dl>
1837
1838 !! end
1839
1840 !! test
1841 Definition list with wikilink containing colon
1842 !! input
1843 ; [[Help:FAQ]]: The least-read page on Wikipedia
1844 !! result
1845 <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
1846 </dd></dl>
1847
1848 !! end
1849
1850 # At Brion's and JeLuF's insistence... :)
1851 !! test
1852 Definition list with news link containing colon
1853 !! input
1854 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
1855 !! result
1856 <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!
1857 </dd></dl>
1858
1859 !! end
1860
1861 !! test
1862 Malformed definition list with colon
1863 !! input
1864 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
1865 !! result
1866 <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
1867 </dt></dl>
1868
1869 !! end
1870
1871 !! test
1872 Definition lists: colon in external link text
1873 !! input
1874 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
1875 !! result
1876 <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
1877 </dd></dl>
1878
1879 !! end
1880
1881 !! test
1882 Definition lists: colon in HTML attribute
1883 !! input
1884 ;<b style="display: inline">bold</b>
1885 !! result
1886 <dl><dt><b style="display: inline">bold</b>
1887 </dt></dl>
1888
1889 !! end
1890
1891 !! test
1892 Definition lists: self-closed tag
1893 !! input
1894 ;one<br/>two : two-line fun
1895 !! result
1896 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
1897 </dd></dl>
1898
1899 !! end
1900
1901 !! test
1902 Bug 11748: Literal closing tags
1903 !! input
1904 <dl>
1905 <dt>test 1</dt>
1906 <dd>test test test test test</dd>
1907 <dt>test 2</dt>
1908 <dd>test test test test test</dd>
1909 </dl>
1910 !! result
1911 <dl>
1912 <dt>test 1</dt>
1913 <dd>test test test test test</dd>
1914 <dt>test 2</dt>
1915 <dd>test test test test test</dd>
1916 </dl>
1917
1918 !! end
1919
1920 !! test
1921 Definition and unordered list using wiki syntax nested in unordered list using html tags.
1922 !! input
1923 <ul><li>
1924 ; term : description
1925 * unordered
1926 </li>
1927 </ul>
1928 !! result
1929 <ul><li>
1930 <dl><dt> term&#160;</dt><dd> description
1931 </dd></dl>
1932 <ul><li> unordered
1933 </li></ul>
1934 </li>
1935 </ul>
1936
1937 !! end
1938
1939 !! test
1940
1941 Definition list with empty definition and following paragraph
1942 !! input
1943 ; term:
1944 Paragraph text
1945 !! result
1946 <dl><dt> term</dt><dd>
1947 </dd></dl>
1948 <p>Paragraph text
1949 </p>
1950 !! end
1951
1952 !! test
1953 Nested definition lists using html syntax
1954 !! input
1955 <dl><dd>
1956 <dl>
1957 <dd>Foo</dd>
1958 </dl>
1959 </dd></dl>
1960 !! result
1961 <dl><dd>
1962 <dl>
1963 <dd>Foo</dd>
1964 </dl>
1965 </dd></dl>
1966
1967 !! end
1968
1969 !! test
1970 Definition Lists: No nesting: Multiple dd's
1971 !! input
1972 ;x
1973 :a
1974 :b
1975 !! result
1976 <dl><dt>x
1977 </dt><dd>a
1978 </dd><dd>b
1979 </dd></dl>
1980
1981 !! end
1982
1983 !! test
1984 Definition Lists: Indentation: Regular
1985 !! input
1986 :i1
1987 ::i2
1988 :::i3
1989 !! result
1990 <dl><dd>i1
1991 <dl><dd>i2
1992 <dl><dd>i3
1993 </dd></dl>
1994 </dd></dl>
1995 </dd></dl>
1996
1997 !! end
1998
1999 !! test
2000 Definition Lists: Indentation: Missing 1st level
2001 !! input
2002 ::i2
2003 :::i3
2004 !! result
2005 <dl><dd><dl><dd>i2
2006 <dl><dd>i3
2007 </dd></dl>
2008 </dd></dl>
2009 </dd></dl>
2010
2011 !! end
2012
2013 !! test
2014 Definition Lists: Indentation: Multi-level indent
2015 !! input
2016 :::i3
2017 !! result
2018 <dl><dd><dl><dd><dl><dd>i3
2019 </dd></dl>
2020 </dd></dl>
2021 </dd></dl>
2022
2023 !! end
2024
2025 !! test
2026 Definition Lists: Hacky use to indent tables
2027 !! input
2028 ::{|
2029 |foo
2030 |bar
2031 |}
2032 this text
2033 should be left alone
2034 !! result
2035 <dl><dd><dl><dd><table>
2036 <tr>
2037 <td>foo
2038 </td>
2039 <td>bar
2040 </td></tr></table></dd></dl></dd></dl>
2041 <p>this text
2042 should be left alone
2043 </p>
2044 !! end
2045 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2046 ## as an empty dt item. It also ignores all but the last ";" when followed
2047 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2048 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2049 ## ";"s.
2050 ##
2051 ## Ex: ";;t2 ::d2" is transformed into:
2052 ##
2053 ## <dl>
2054 ## <dt>t2 </dt>
2055 ## <dd>
2056 ## <dl>
2057 ## <dt></dt>
2058 ## <dd>d2</dd>
2059 ## </dl>
2060 ## </dd>
2061 ## </dl>
2062 ##
2063 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2064 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2065 ##
2066 ## <dl>
2067 ## <dt>
2068 ## <dl>
2069 ## <dt>t2 </dt>
2070 ## <dd>:d2</dd>
2071 ## </dl>
2072 ## </dt>
2073 ## </dl>
2074 ##
2075 ## All Parsoid only definition list tests have this difference.
2076 ##
2077 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2078 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2079
2080 !! test
2081 Table / list interaction: indented table with lists in table contents
2082 !! input
2083 :{|
2084 |-
2085 | a
2086 * b
2087 |-
2088 | c
2089 * d
2090 |}
2091 !! result
2092 <dl><dd><table>
2093
2094 <tr>
2095 <td> a
2096 <ul><li> b
2097 </li></ul>
2098 </td></tr>
2099 <tr>
2100 <td> c
2101 <ul><li> d
2102 </li></ul>
2103 </td></tr></table></dd></dl>
2104
2105 !! end
2106
2107 !!test
2108 Table / list interaction: lists nested in tables nested in indented lists
2109 !!input
2110 :{|
2111 |
2112 :a
2113 :b
2114 |
2115 *c
2116 *d
2117 |}
2118
2119 *e
2120 *f
2121 !!result
2122 <dl><dd><table>
2123 <tr>
2124 <td>
2125 <dl><dd>a
2126 </dd><dd>b
2127 </dd></dl>
2128 </td>
2129 <td>
2130 <ul><li>c
2131 </li><li>d
2132 </li></ul>
2133 </td></tr></table></dd></dl>
2134 <ul><li>e
2135 </li><li>f
2136 </li></ul>
2137
2138 !!end
2139
2140 !! test
2141 Definition Lists: Nesting: Multi-level (Parsoid only)
2142 !! options
2143 parsoid
2144 !! input
2145 ;t1 :d1
2146 ;;t2 ::d2
2147 ;;;t3 :::d3
2148 !! result
2149 <dl>
2150 <dt>t1 </dt>
2151 <dd>d1</dd>
2152 <dt>
2153 <dl>
2154 <dt>t2 </dt>
2155 <dd>:d2</dd>
2156 <dt>
2157 <dl>
2158 <dt>t3 </dt>
2159 <dd>::d3</dd>
2160 </dl>
2161 </dt>
2162 </dl>
2163 </dt>
2164 </dl>
2165
2166
2167 !! end
2168
2169
2170 !! test
2171 Definition Lists: Nesting: Test 2 (Parsoid only)
2172 !! options
2173 parsoid
2174 !! input
2175 ;t1
2176 ::d2
2177 !! result
2178 <dl>
2179 <dt>t1</dt>
2180 <dd>
2181 <dl>
2182 <dd>d2</dd>
2183 </dl>
2184 </dd>
2185 </dl>
2186
2187 !! end
2188
2189
2190 !! test
2191 Definition Lists: Nesting: Test 3 (Parsoid only)
2192 !! options
2193 parsoid
2194 !! input
2195 :;t1
2196 ::::d2
2197 !! result
2198 <dl>
2199 <dd>
2200 <dl>
2201 <dt>t1</dt>
2202 <dd>
2203 <dl>
2204 <dd>
2205 <dl>
2206 <dd>d2</dd>
2207 </dl>
2208 </dd>
2209 </dl>
2210 </dd>
2211 </dl>
2212 </dd>
2213 </dl>
2214
2215 !! end
2216
2217
2218 !! test
2219 Definition Lists: Nesting: Test 4
2220 !! input
2221 ::;t3
2222 :::d3
2223 !! result
2224 <dl><dd><dl><dd><dl><dt>t3
2225 </dt><dd>d3
2226 </dd></dl>
2227 </dd></dl>
2228 </dd></dl>
2229
2230 !! end
2231
2232
2233 ## The Parsoid team believes the following three test exposes a
2234 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2235 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2236 !! test
2237 Definition Lists: Mixed Lists: Test 1 (php)
2238 !! options
2239 php
2240 !! input
2241 :;* foo
2242 ::* bar
2243 :; baz
2244 !! result
2245 <dl><dd><dl><dt><ul><li> foo
2246 </li><li> bar
2247 </li></ul>
2248 </dt></dl>
2249 <dl><dt> baz
2250 </dt></dl>
2251 </dd></dl>
2252
2253 !! end
2254 !! test
2255 Definition Lists: Mixed Lists: Test 1 (parsoid)
2256 !! options
2257 parsoid
2258 !! input
2259 :;* foo
2260 ::* bar
2261 :; baz
2262 !! result
2263 <dl><dd><dl><dt><ul><li> foo
2264 </li></ul></dt><dd><ul><li> bar
2265 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2266 !! end
2267
2268 !! test
2269 Definition Lists: Mixed Lists: Test 2
2270 !! input
2271 *: d1
2272 *: d2
2273 !! result
2274 <ul><li><dl><dd> d1
2275 </dd><dd> d2
2276 </dd></dl>
2277 </li></ul>
2278
2279 !! end
2280
2281
2282 !! test
2283 Definition Lists: Mixed Lists: Test 3
2284 !! input
2285 *::: d1
2286 *::: d2
2287 !! result
2288 <ul><li><dl><dd><dl><dd><dl><dd> d1
2289 </dd><dd> d2
2290 </dd></dl>
2291 </dd></dl>
2292 </dd></dl>
2293 </li></ul>
2294
2295 !! end
2296
2297
2298 !! test
2299 Definition Lists: Mixed Lists: Test 4
2300 !! input
2301 *;d1 :d2
2302 *;d3 :d4
2303 !! result
2304 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2305 </dd><dt>d3&#160;</dt><dd>d4
2306 </dd></dl>
2307 </li></ul>
2308
2309 !! end
2310
2311
2312 !! test
2313 Definition Lists: Mixed Lists: Test 5
2314 !! input
2315 *:d1
2316 *:: d2
2317 !! result
2318 <ul><li><dl><dd>d1
2319 <dl><dd> d2
2320 </dd></dl>
2321 </dd></dl>
2322 </li></ul>
2323
2324 !! end
2325
2326
2327 !! test
2328 Definition Lists: Mixed Lists: Test 6
2329 !! input
2330 #*:d1
2331 #*::: d3
2332 !! result
2333 <ol><li><ul><li><dl><dd>d1
2334 <dl><dd><dl><dd> d3
2335 </dd></dl>
2336 </dd></dl>
2337 </dd></dl>
2338 </li></ul>
2339 </li></ol>
2340
2341 !! end
2342
2343
2344 !! test
2345 Definition Lists: Mixed Lists: Test 7
2346 !! input
2347 :* d1
2348 :* d2
2349 !! result
2350 <dl><dd><ul><li> d1
2351 </li><li> d2
2352 </li></ul>
2353 </dd></dl>
2354
2355 !! end
2356
2357
2358 !! test
2359 Definition Lists: Mixed Lists: Test 8
2360 !! input
2361 :* d1
2362 ::* d2
2363 !! result
2364 <dl><dd><ul><li> d1
2365 </li></ul>
2366 <dl><dd><ul><li> d2
2367 </li></ul>
2368 </dd></dl>
2369 </dd></dl>
2370
2371 !! end
2372
2373
2374 !! test
2375 Definition Lists: Mixed Lists: Test 9
2376 !! input
2377 *;foo :bar
2378 !! result
2379 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2380 </dd></dl>
2381 </li></ul>
2382
2383 !! end
2384
2385
2386 !! test
2387 Definition Lists: Mixed Lists: Test 10
2388 !! input
2389 *#;foo :bar
2390 !! result
2391 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2392 </dd></dl>
2393 </li></ol>
2394 </li></ul>
2395
2396 !! end
2397
2398 # The Parsoid team disagrees with the PHP parser's seemingly-random
2399 # rules regarding dd/dt on the next two tests. Parsoid is more
2400 # consistent, and recognizes the shared nesting and keeps the
2401 # still-open tags around until the nesting is complete.
2402
2403 !! test
2404 Definition Lists: Mixed Lists: Test 11 (php)
2405 !! options
2406 php
2407 !! input
2408 *#*#;*;;foo :bar
2409 *#*#;boo :baz
2410 !! result
2411 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2412 </dt></dl>
2413 </dd></dl>
2414 </li></ul>
2415 </dd></dl>
2416 <dl><dt>boo&#160;</dt><dd>baz
2417 </dd></dl>
2418 </li></ol>
2419 </li></ul>
2420 </li></ol>
2421 </li></ul>
2422
2423 !! end
2424 !! test
2425 Definition Lists: Mixed Lists: Test 11 (parsoid)
2426 !! options
2427 parsoid
2428 !! input
2429 *#*#;*;;foo :bar
2430 *#*#;boo :baz
2431 !! result
2432 <ul>
2433 <li>
2434 <ol>
2435 <li>
2436 <ul>
2437 <li>
2438 <ol>
2439 <li>
2440 <dl>
2441 <dt>
2442 <ul>
2443 <li>
2444 <dl>
2445 <dt>
2446 <dl>
2447 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2448 <dd data-parsoid='{"stx":"row"}'>bar</dd></dl></dt></dl></li></ul></dt>
2449 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2450 <dd data-parsoid='{"stx":"row"}'>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2451 !! end
2452
2453
2454 !! test
2455 Definition Lists: Weird Ones: Test 1 (php)
2456 !! options
2457 php
2458 !! input
2459 *#;*::;; foo : bar (who uses this?)
2460 !! result
2461 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2462 </dt></dl>
2463 </dd></dl>
2464 </dd></dl>
2465 </dd></dl>
2466 </li></ul>
2467 </dd></dl>
2468 </li></ol>
2469 </li></ul>
2470
2471 !! end
2472 !! test
2473 Definition Lists: Weird Ones: Test 1 (parsoid)
2474 !! options
2475 parsoid
2476 !! input
2477 *#;*::;; foo : bar (who uses this?)
2478 !! result
2479 <ul>
2480 <li>
2481 <ol>
2482 <li>
2483 <dl>
2484 <dt>
2485 <ul>
2486 <li>
2487 <dl>
2488 <dd>
2489 <dl>
2490 <dd>
2491 <dl>
2492 <dt>
2493 <dl>
2494 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2495 <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>
2496 !! end
2497
2498 ###
2499 ### External links
2500 ###
2501 !! test
2502 External links: non-bracketed
2503 !! input
2504 Non-bracketed: http://example.com
2505 !! result
2506 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2507 </p>
2508 !! end
2509
2510 !! test
2511 External links: numbered
2512 !! input
2513 Numbered: [http://example.com]
2514 Numbered: [http://example.net]
2515 Numbered: [http://example.com]
2516 !! result
2517 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2518 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2519 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2520 </p>
2521 !!end
2522
2523 !! test
2524 External links: specified text
2525 !! input
2526 Specified text: [http://example.com link]
2527 !! result
2528 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2529 </p>
2530 !!end
2531
2532 !! test
2533 External links: trail
2534 !! input
2535 Linktrails should not work for external links: [http://example.com link]s
2536 !! result
2537 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2538 </p>
2539 !! end
2540
2541 !! test
2542 External links: dollar sign in URL
2543 !! input
2544 http://example.com/1$2345
2545 !! result
2546 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2547 </p>
2548 !! end
2549
2550 !! test
2551 External links: dollar sign in URL (named)
2552 !! input
2553 [http://example.com/1$2345]
2554 !! result
2555 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2556 </p>
2557 !!end
2558
2559 !! test
2560 External links: open square bracket forbidden in URL (bug 4377)
2561 !! input
2562 http://example.com/1[2345
2563 !! result
2564 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2565 </p>
2566 !! end
2567
2568 !! test
2569 External links: open square bracket forbidden in URL (named) (bug 4377)
2570 !! input
2571 [http://example.com/1[2345]
2572 !! result
2573 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2574 </p>
2575 !!end
2576
2577 !! test
2578 External links: nowiki in URL link text (bug 6230)
2579 !!input
2580 [http://example.com/ <nowiki>''example site''</nowiki>]
2581 !! result
2582 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2583 </p>
2584 !! end
2585
2586 !! test
2587 External links: newline forbidden in text (bug 6230 regression check)
2588 !! input
2589 [http://example.com/ first
2590 second]
2591 !! result
2592 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2593 second]
2594 </p>
2595 !!end
2596
2597 !! test
2598 External links: Pipe char between url and text
2599 !! input
2600 [http://example.com | link]
2601 !! result
2602 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2603 </p>
2604 !!end
2605
2606 !! test
2607 External links: protocol-relative URL in brackets
2608 !! input
2609 [//example.com/ Test]
2610 !! result
2611 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2612 </p>
2613 !! end
2614
2615 !! test
2616 External links: protocol-relative URL in brackets without text
2617 !! input
2618 [//example.com]
2619 !! result
2620 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2621 </p>
2622 !! end
2623
2624 !! test
2625 External links: protocol-relative URL in free text is left alone
2626 !! input
2627 //example.com/Foo
2628 !! result
2629 <p>//example.com/Foo
2630 </p>
2631 !!end
2632
2633 !! test
2634 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2635 !! input
2636 foo//example.com/Foo
2637 !! result
2638 <p>foo//example.com/Foo
2639 </p>
2640 !! end
2641
2642 !! test
2643 External image
2644 !! input
2645 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2646 !! result
2647 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2648 </p>
2649 !! end
2650
2651 !! test
2652 External image from https
2653 !! input
2654 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2655 !! result
2656 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2657 </p>
2658 !! end
2659
2660 !! test
2661 Link to non-http image, no img tag
2662 !! input
2663 Link to non-http image, no img tag: ftp://example.com/test.jpg
2664 !! result
2665 <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>
2666 </p>
2667 !! end
2668
2669 !! test
2670 External links: terminating separator
2671 !! input
2672 Terminating separator: http://example.com/thing,
2673 !! result
2674 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2675 </p>
2676 !! end
2677
2678 !! test
2679 External links: intervening separator
2680 !! input
2681 Intervening separator: http://example.com/1,2,3
2682 !! result
2683 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2684 </p>
2685 !! end
2686
2687 !! test
2688 External links: old bug with URL in query
2689 !! input
2690 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2691 !! result
2692 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2693 </p>
2694 !! end
2695
2696 !! test
2697 External links: old URL-in-URL bug, mixed protocols
2698 !! input
2699 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2700 !! result
2701 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2702 </p>
2703 !!end
2704
2705 !! test
2706 External links: URL in text
2707 !! input
2708 URL in text: [http://example.com http://example.com]
2709 !! result
2710 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2711 </p>
2712 !! end
2713
2714 !! test
2715 External links: Clickable images
2716 !! input
2717 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2718 !! result
2719 <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>
2720 </p>
2721 !!end
2722
2723 !! test
2724 External links: raw ampersand
2725 !! input
2726 Old &amp; use: http://x&y
2727 !! result
2728 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2729 </p>
2730 !! end
2731
2732 !! test
2733 External links: encoded ampersand
2734 !! input
2735 Old &amp; use: http://x&amp;y
2736 !! result
2737 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2738 </p>
2739 !! end
2740
2741 !! test
2742 External links: encoded equals (bug 6102)
2743 !! input
2744 http://example.com/?foo&#61;bar
2745 !! result
2746 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2747 </p>
2748 !! end
2749
2750 !! test
2751 External links: [raw ampersand]
2752 !! input
2753 Old &amp; use: [http://x&y]
2754 !! result
2755 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2756 </p>
2757 !! end
2758
2759 !! test
2760 External links: [encoded ampersand]
2761 !! input
2762 Old &amp; use: [http://x&amp;y]
2763 !! result
2764 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2765 </p>
2766 !! end
2767
2768 !! test
2769 External links: [encoded equals] (bug 6102)
2770 !! input
2771 [http://example.com/?foo&#61;bar]
2772 !! result
2773 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2774 </p>
2775 !! end
2776
2777 !! test
2778 External links: [IDN ignored character reference in hostname; strip it right off]
2779 !! input
2780 [http://e&zwnj;xample.com/]
2781 !! result
2782 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2783 </p>
2784 !! end
2785
2786 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2787 # Where an external link could easily circumvent the sanitization of the text of
2788 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2789 # test demands a higher standard. That's a bit strange.
2790 #
2791 # Example:
2792 #
2793 # http://e‌xample.com -> [http://example.com|http://example.com]
2794 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2795 #
2796 # The first example is sanitized, but the second is not. Any security benefits
2797 # from this production are trivial to circumvent. Either remove this test and
2798 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2799 # the test accordingly.
2800 #
2801 # All our love,
2802 # The Parsoid team.
2803 !! test
2804 External links: IDN ignored character reference in hostname; strip it right off
2805 !! input
2806 http://e&zwnj;xample.com/
2807 !! result
2808 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
2809 </p>
2810 !! end
2811
2812 !! test
2813 External links: www.jpeg.org (bug 554)
2814 !! input
2815 http://www.jpeg.org
2816 !!result
2817 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
2818 </p>
2819 !! end
2820
2821 !! test
2822 External links: URL within URL (original bug 2)
2823 !! input
2824 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
2825 !! result
2826 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
2827 </p>
2828 !! end
2829
2830 !! test
2831 BUG 361: URL inside bracketed URL
2832 !! input
2833 [http://www.example.com/foo http://www.example.com/bar]
2834 !! result
2835 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
2836 </p>
2837 !! end
2838
2839 !! test
2840 BUG 361: URL within URL, not bracketed
2841 !! input
2842 http://www.example.com/foo?=http://www.example.com/bar
2843 !! result
2844 <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>
2845 </p>
2846 !! end
2847
2848 !! test
2849 BUG 289: ">"-token in URL-tail
2850 !! input
2851 http://www.example.com/<hello>
2852 !! result
2853 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
2854 </p>
2855 !!end
2856
2857 !! test
2858 BUG 289: literal ">"-token in URL-tail
2859 !! input
2860 http://www.example.com/<b>html</b>
2861 !! result
2862 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
2863 </p>
2864 !!end
2865
2866 !! test
2867 BUG 289: ">"-token in bracketed URL
2868 !! input
2869 [http://www.example.com/<hello> stuff]
2870 !! result
2871 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
2872 </p>
2873 !!end
2874
2875 !! test
2876 BUG 289: literal ">"-token in bracketed URL
2877 !! input
2878 [http://www.example.com/<b>html</b> stuff]
2879 !! result
2880 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
2881 </p>
2882 !!end
2883
2884 !! test
2885 BUG 289: literal double quote at end of URL
2886 !! input
2887 http://www.example.com/"hello"
2888 !! result
2889 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
2890 </p>
2891 !!end
2892
2893 !! test
2894 BUG 289: literal double quote in bracketed URL
2895 !! input
2896 [http://www.example.com/"hello" stuff]
2897 !! result
2898 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
2899 </p>
2900 !!end
2901
2902 !! test
2903 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
2904 !! input
2905 [http://www.example.com test]
2906 !! result
2907 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
2908 </p>
2909 !! end
2910
2911 !! test
2912 External links: link text with spaces
2913 !! input
2914 [http://www.example.com a b c]
2915 [http://www.example.com ''a'' ''b'']
2916 !! result
2917 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
2918 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
2919 </p>
2920 !! end
2921
2922 !! test
2923 External links: wiki links within external link (Bug 3695)
2924 !! input
2925 [http://example.com [[wikilink]] embedded in ext link]
2926 !! result
2927 <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>
2928 </p>
2929 !! end
2930
2931 !! test
2932 BUG 787: Links with one slash after the url protocol are invalid
2933 !! input
2934 http:/example.com
2935
2936 [http:/example.com title]
2937 !! result
2938 <p>http:/example.com
2939 </p><p>[http:/example.com title]
2940 </p>
2941 !! end
2942
2943 !! test
2944 Bracketed external links with template-generated invalid target
2945 !! input
2946 [{{echo|http:/example.com}} title]
2947 !! result
2948 <p>[http:/example.com title]
2949 </p>
2950 !! end
2951
2952 !! test
2953 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
2954 !! input
2955 ''[http://example.com text'']
2956 [http://example.com '''text]'''
2957 ''Something [http://example.com in italic'']
2958 ''Something [http://example.com mixed''''', even bold]'''
2959 '''''Now [http://example.com both''''']
2960 !! result
2961 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
2962 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
2963 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
2964 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
2965 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
2966 </p>
2967 !! end
2968
2969
2970 !! test
2971 Bug 4781: %26 in URL
2972 !! input
2973 http://www.example.com/?title=AT%26T
2974 !! result
2975 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
2976 </p>
2977 !! end
2978
2979 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
2980 # % is actually legal in HTML5. Any change in output would need testing though.
2981 !! test
2982 Bug 4781, 5267: %25 in URL
2983 !! input
2984 http://www.example.com/?title=100%25_Bran
2985 !! result
2986 <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>
2987 </p>
2988 !! end
2989
2990 !! test
2991 Bug 4781, 5267: %28, %29 in URL
2992 !! input
2993 http://www.example.com/?title=Ben-Hur_%281959_film%29
2994 !! result
2995 <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>
2996 </p>
2997 !! end
2998
2999
3000 !! test
3001 Bug 4781: %26 in autonumber URL
3002 !! input
3003 [http://www.example.com/?title=AT%26T]
3004 !! result
3005 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3006 </p>
3007 !! end
3008
3009 !! test
3010 Bug 4781, 5267: %26 in autonumber URL
3011 !! input
3012 [http://www.example.com/?title=100%25_Bran]
3013 !! result
3014 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3015 </p>
3016 !! end
3017
3018 !! test
3019 Bug 4781, 5267: %28, %29 in autonumber URL
3020 !! input
3021 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3022 !! result
3023 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3024 </p>
3025 !! end
3026
3027
3028 !! test
3029 Bug 4781: %26 in bracketed URL
3030 !! input
3031 [http://www.example.com/?title=AT%26T link]
3032 !! result
3033 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3034 </p>
3035 !! end
3036
3037 !! test
3038 Bug 4781, 5267: %26 in bracketed URL
3039 !! input
3040 [http://www.example.com/?title=100%25_Bran link]
3041 !! result
3042 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3043 </p>
3044 !! end
3045
3046 !! test
3047 Bug 4781, 5267: %28, %29 in bracketed URL
3048 !! input
3049 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3050 !! result
3051 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3052 </p>
3053 !! end
3054
3055 !! test
3056 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3057 !! input
3058 Some [http://example.com/ pretty ''italics'' and stuff]!
3059 !! result
3060 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3061 </p>
3062 !! end
3063
3064 !! test
3065 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3066 !! input
3067 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3068 !! result
3069 <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>
3070 </p>
3071 !! end
3072
3073 !! test
3074 External link containing double-single-quotes with no space separating the url from text in italics
3075 !! input
3076 [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]].]
3077 !! result
3078 <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>
3079 </p>
3080 !! end
3081
3082 !! test
3083 URL-encoding in URL functions (single parameter)
3084 !! input
3085 {{localurl:Some page|amp=&}}
3086 !! result
3087 <p>/index.php?title=Some_page&amp;amp=&amp;
3088 </p>
3089 !! end
3090
3091 !! test
3092 URL-encoding in URL functions (multiple parameters)
3093 !! input
3094 {{localurl:Some page|q=?&amp=&}}
3095 !! result
3096 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3097 </p>
3098 !! end
3099
3100 !! test
3101 Brackets in urls
3102 !! input
3103 http://example.com/index.php?foozoid%5B%5D=bar
3104
3105 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3106 !! result
3107 <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>
3108 </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>
3109 </p>
3110 !! end
3111
3112 !! test
3113 IPv6 urls (bug 21261)
3114 !! options
3115 disabled
3116 !! input
3117 http://[2404:130:0:1000::187:2]/index.php
3118 !! result
3119 <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>
3120 </p>
3121 !! end
3122
3123 !! test
3124 Non-extlinks in brackets
3125 !! input
3126 [foo]
3127 [foo bar]
3128 [foo ''bar'']
3129 [fool's] errand
3130 [fool's errand]
3131 [{{echo|foo}}]
3132 [{{echo|foo}} bar]
3133 [{{echo|foo}} ''bar'']
3134 [{{echo|foo}}l's] errand
3135 [{{echo|foo}}l's errand]
3136 [url={{echo|foo}}]
3137 [url=http://example.com]
3138 !! result
3139 <p>[foo]
3140 [foo bar]
3141 [foo <i>bar</i>]
3142 [fool's] errand
3143 [fool's errand]
3144 [foo]
3145 [foo bar]
3146 [foo <i>bar</i>]
3147 [fool's] errand
3148 [fool's errand]
3149 [url=foo]
3150 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3151 </p>
3152 !! end
3153
3154 ###
3155 ### Quotes
3156 ###
3157
3158 !! test
3159 Quotes
3160 !! input
3161 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3162
3163 Normal text. '''''Bold italic text.''''' Normal text.
3164 !!result
3165 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3166 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3167 </p>
3168 !! end
3169
3170
3171 !! test
3172 Unclosed and unmatched quotes (php)
3173 !! options
3174 php
3175 !! input
3176 '''''Bold italic text '''with bold deactivated''' in between.'''''
3177
3178 '''''Bold italic text ''with italic deactivated'' in between.'''''
3179
3180 '''Bold text..
3181
3182 ..spanning two paragraphs (should not work).'''
3183
3184 '''Bold tag left open
3185
3186 ''Italic tag left open
3187
3188 Normal text.
3189
3190 <!-- Unmatching number of opening, closing tags: -->
3191 '''This year''''s election ''should'' beat '''last year''''s.
3192
3193 ''Tom'''s car is bigger than ''Susan'''s.
3194
3195 Plain ''italic'''s plain
3196 !! result
3197 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3198 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3199 </p><p><b>Bold text..</b>
3200 </p><p>..spanning two paragraphs (should not work).
3201 </p><p><b>Bold tag left open</b>
3202 </p><p><i>Italic tag left open</i>
3203 </p><p>Normal text.
3204 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3205 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3206 </p><p>Plain <i>italic'</i>s plain
3207 </p>
3208 !! end
3209 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3210 # parser strips. The wikitext contains just the first half of the bold
3211 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3212 # differently than the PHP parser.)
3213 !! test
3214 Unclosed and unmatched quotes (parsoid)
3215 !! options
3216 parsoid
3217 !! input
3218 '''''Bold italic text '''with bold deactivated''' in between.'''''
3219
3220 '''''Bold italic text ''with italic deactivated'' in between.'''''
3221
3222 '''Bold text..
3223
3224 ..spanning two paragraphs (should not work).'''
3225
3226 '''Bold tag left open
3227
3228 ''Italic tag left open
3229
3230 Normal text.
3231
3232 <!-- Unmatching number of opening, closing tags: -->
3233 '''This year''''s election ''should'' beat '''last year''''s.
3234
3235 ''Tom'''s car is bigger than ''Susan'''s.
3236
3237 Plain ''italic'''s plain
3238 !! result
3239 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3240 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3241 </p><p><b>Bold text..</b>
3242 </p><p>..spanning two paragraphs (should not work).<b></b>
3243 </p><p><b>Bold tag left open</b>
3244 </p><p><i>Italic tag left open</i>
3245 </p><p>Normal text.
3246 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3247 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3248 </p><p>Plain <i>italic'</i>s plain
3249 </p>
3250 !! end
3251
3252 ###
3253 ### Tables
3254 ###
3255 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3256 ###
3257
3258 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3259 # is the bare minimun required by the spec, see:
3260 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3261 !! test
3262 A table with no data. (php)
3263 !! options
3264 php
3265 !! input
3266 {||}
3267 !! result
3268 !! end
3269 # Parsoid team replies: empty table tags are legal in HTML5
3270 !! test
3271 A table with no data. (parsoid)
3272 !! options
3273 parsoid
3274 !! input
3275 {||}
3276 !! result
3277 <table></table>
3278 !! end
3279
3280 # A table with nothing but a caption is invalid XHTML, we might want to render
3281 # this as <p>caption</p>
3282 !! test
3283 A table with nothing but a caption (php)
3284 !! options
3285 php
3286 !! input
3287 {|
3288 |+ caption
3289 |}
3290 !! result
3291 <table>
3292 <caption> caption
3293 </caption><tr><td></td></tr></table>
3294
3295 !! end
3296 # Parsoid team replies: table with only a caption is legal in HTML5
3297 !! test
3298 A table with nothing but a caption (parsoid)
3299 !! options
3300 parsoid
3301 !! input
3302 {|
3303 |+ caption
3304 |}
3305 !! result
3306 <table><caption> caption</caption></table>
3307 !! end
3308
3309 !! test
3310 A table with caption with default-spaced attributes and a table row
3311 !! input
3312 {|
3313 |+ style="color: red;" | caption1
3314 |-
3315 | foo
3316 |}
3317 !! result
3318 <table>
3319 <caption style="color: red;"> caption1
3320 </caption>
3321 <tr>
3322 <td> foo
3323 </td></tr></table>
3324
3325 !! end
3326
3327 !! test
3328 A table with captions with non-default spaced attributes and a table row
3329 !! input
3330 {|
3331 |+style="color: red;"|caption2
3332 |+ style="color: red;"| caption3
3333 |-
3334 | foo
3335 |}
3336 !! result
3337 <table>
3338 <caption style="color: red;">caption2
3339 </caption>
3340 <caption style="color: red;"> caption3
3341 </caption>
3342 <tr>
3343 <td> foo
3344 </td></tr></table>
3345
3346 !! end
3347
3348 !! test
3349 Table td-cell syntax variations
3350 !! input
3351 {|
3352 | foo bar foo | baz
3353 | foo bar foo || baz
3354 | style='color:red;' | baz
3355 | style='color:red;' || baz
3356 |}
3357 !! result
3358 <table>
3359 <tr>
3360 <td> baz
3361 </td>
3362 <td> foo bar foo </td>
3363 <td> baz
3364 </td>
3365 <td style="color:red;"> baz
3366 </td>
3367 <td> style='color:red;' </td>
3368 <td> baz
3369 </td></tr></table>
3370
3371 !! end
3372
3373 !! test
3374 Simple table
3375 !! input
3376 {|
3377 | 1 || 2
3378 |-
3379 | 3 || 4
3380 |}
3381 !! result
3382 <table>
3383 <tr>
3384 <td> 1 </td>
3385 <td> 2
3386 </td></tr>
3387 <tr>
3388 <td> 3 </td>
3389 <td> 4
3390 </td></tr></table>
3391
3392 !! end
3393
3394 !! test
3395 Simple table but with multiple dashes for row wikitext
3396 !! input
3397 {|
3398 | foo
3399 |-----
3400 | bar
3401 |}
3402 !! result
3403 <table>
3404 <tr>
3405 <td> foo
3406 </td></tr>
3407 <tr>
3408 <td> bar
3409 </td></tr></table>
3410
3411 !! end
3412 !! test
3413 Multiplication table
3414 !! input
3415 {| border="1" cellpadding="2"
3416 |+Multiplication table
3417 |-
3418 ! &times; !! 1 !! 2 !! 3
3419 |-
3420 ! 1
3421 | 1 || 2 || 3
3422 |-
3423 ! 2
3424 | 2 || 4 || 6
3425 |-
3426 ! 3
3427 | 3 || 6 || 9
3428 |-
3429 ! 4
3430 | 4 || 8 || 12
3431 |-
3432 ! 5
3433 | 5 || 10 || 15
3434 |}
3435 !! result
3436 <table border="1" cellpadding="2">
3437 <caption>Multiplication table
3438 </caption>
3439 <tr>
3440 <th> &#215; </th>
3441 <th> 1 </th>
3442 <th> 2 </th>
3443 <th> 3
3444 </th></tr>
3445 <tr>
3446 <th> 1
3447 </th>
3448 <td> 1 </td>
3449 <td> 2 </td>
3450 <td> 3
3451 </td></tr>
3452 <tr>
3453 <th> 2
3454 </th>
3455 <td> 2 </td>
3456 <td> 4 </td>
3457 <td> 6
3458 </td></tr>
3459 <tr>
3460 <th> 3
3461 </th>
3462 <td> 3 </td>
3463 <td> 6 </td>
3464 <td> 9
3465 </td></tr>
3466 <tr>
3467 <th> 4
3468 </th>
3469 <td> 4 </td>
3470 <td> 8 </td>
3471 <td> 12
3472 </td></tr>
3473 <tr>
3474 <th> 5
3475 </th>
3476 <td> 5 </td>
3477 <td> 10 </td>
3478 <td> 15
3479 </td></tr></table>
3480
3481 !! end
3482
3483 !! test
3484 Accept "||" in table headings
3485 !! input
3486 {|
3487 !h1 || h2
3488 |}
3489 !! result
3490 <table>
3491 <tr>
3492 <th>h1 </th>
3493 <th> h2
3494 </th></tr></table>
3495
3496 !! end
3497
3498 !! test
3499 Accept "||" in indented table headings
3500 !! input
3501 :{|
3502 !h1 || h2
3503 |}
3504 !! result
3505 <dl><dd><table>
3506 <tr>
3507 <th>h1 </th>
3508 <th> h2
3509 </th></tr></table></dd></dl>
3510
3511 !! end
3512
3513 !! test
3514 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3515 !! input
3516 {|
3517 !| h1
3518 || a
3519 |}
3520 !! result
3521 <table>
3522 <tr>
3523 <th> h1
3524 </th>
3525 <td> a
3526 </td></tr></table>
3527
3528 !! end
3529
3530 !!test
3531 Accept "| !" at start of line in tables (ignore !-attribute)
3532 !!input
3533 {|
3534 |-
3535 | !style="color:red" | bar
3536 |}
3537 !!result
3538 <table>
3539
3540 <tr>
3541 <td> bar
3542 </td></tr></table>
3543
3544 !!end
3545
3546 !!test
3547 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 +/-
3548 !!input
3549 {|
3550 |-
3551 |style='color:red;'|+1
3552 |style='color:blue;'|-1
3553 |-
3554 | 1 || 2 || 3
3555 | 1 ||+2 ||-3
3556 |-
3557 | +1
3558 | -1
3559 |}
3560 !!result
3561 <table>
3562
3563 <tr>
3564 <td style="color:red;">+1
3565 </td>
3566 <td style="color:blue;">-1
3567 </td></tr>
3568 <tr>
3569 <td> 1 </td>
3570 <td> 2 </td>
3571 <td> 3
3572 </td>
3573 <td> 1 </td>
3574 <td>+2 </td>
3575 <td>-3
3576 </td></tr>
3577 <tr>
3578 <td> +1
3579 </td>
3580 <td> -1
3581 </td></tr></table>
3582
3583 !!end
3584
3585 !! test
3586 Table rowspan
3587 !! input
3588 {| border=1
3589 | Cell 1, row 1
3590 |rowspan=2| Cell 2, row 1 (and 2)
3591 | Cell 3, row 1
3592 |-
3593 | Cell 1, row 2
3594 | Cell 3, row 2
3595 |}
3596 !! result
3597 <table border="1">
3598 <tr>
3599 <td> Cell 1, row 1
3600 </td>
3601 <td rowspan="2"> Cell 2, row 1 (and 2)
3602 </td>
3603 <td> Cell 3, row 1
3604 </td></tr>
3605 <tr>
3606 <td> Cell 1, row 2
3607 </td>
3608 <td> Cell 3, row 2
3609 </td></tr></table>
3610
3611 !! end
3612
3613 !! test
3614 Nested table
3615 !! input
3616 {| border=1
3617 | &alpha;
3618 |
3619 {| bgcolor=#ABCDEF border=2
3620 |nested
3621 |-
3622 |table
3623 |}
3624 |the original table again
3625 |}
3626 !! result
3627 <table border="1">
3628 <tr>
3629 <td> &#945;
3630 </td>
3631 <td>
3632 <table bgcolor="#ABCDEF" border="2">
3633 <tr>
3634 <td>nested
3635 </td></tr>
3636 <tr>
3637 <td>table
3638 </td></tr></table>
3639 </td>
3640 <td>the original table again
3641 </td></tr></table>
3642
3643 !! end
3644
3645 !! test
3646 Invalid attributes in table cell (bug 1830)
3647 !! input
3648 {|
3649 |Cell:|broken
3650 |}
3651 !! result
3652 <table>
3653 <tr>
3654 <td>broken
3655 </td></tr></table>
3656
3657 !! end
3658
3659
3660 !! test
3661 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3662 !! input
3663 {|
3664 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3665 !! result
3666 <table>
3667 <tr>
3668 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3669 <td>]" onmouseover="alert(document.cookie)"&gt;test
3670 </td>
3671 </tr>
3672 </table>
3673
3674 !! end
3675
3676
3677 !! test
3678 Indented table markup mixed with indented pre content (proposed in bug 6200)
3679 !! input
3680 <table>
3681 <tr>
3682 <td>
3683 Text that should be rendered preformatted
3684 </td>
3685 </tr>
3686 </table>
3687 !! result
3688 <table>
3689 <tr>
3690 <td>
3691 <pre>Text that should be rendered preformatted
3692 </pre>
3693 </td>
3694 </tr>
3695 </table>
3696
3697 !! end
3698
3699 !! test
3700 Template-generated table cell attributes and cell content
3701 !! input
3702 {|
3703 |{{table_attribs}}
3704 |}
3705 !! result
3706 <table>
3707 <tr>
3708 <td style="color: red"> Foo
3709 </td></tr></table>
3710
3711 !! end
3712
3713 !! test
3714 Table with row followed by newlines and table heading
3715 !! input
3716 {|
3717 |-
3718
3719 ! foo
3720 |}
3721 !! result
3722 <table>
3723
3724
3725 <tr>
3726 <th> foo
3727 </th></tr></table>
3728
3729 !! end
3730
3731 !! test
3732 Table with empty line following the start tag
3733 !! input
3734 {|
3735
3736 |-
3737 | foo
3738 |}
3739 !! result
3740 <table>
3741
3742
3743 <tr>
3744 <td> foo
3745 </td></tr></table>
3746
3747 !! end
3748
3749 # FIXME: Preserve the attribute properly (with an empty string as value) in
3750 # the PHP parser. Parsoid implements the behavior below.
3751 !! test
3752 Table attributes with empty value
3753 !! options
3754 parsoid
3755 !! input
3756 {|
3757 | style=| hello
3758 |}
3759 !! result
3760 <table>
3761 <tbody>
3762 <tr>
3763 <td style=""> hello
3764 </td></tr></tbody></table>
3765
3766 !! end
3767
3768 !! test
3769 Wikitext table with a lot of comments
3770 !! input
3771 {|
3772 <!-- c0 -->
3773 | foo
3774 <!-- c1 -->
3775 |- <!-- c2 -->
3776 <!-- c3 -->
3777 |<!-- c4 -->
3778 <!-- c5 -->
3779 |}
3780 !! result
3781 <table>
3782 <tr>
3783 <td> foo
3784 </td></tr>
3785 <tr>
3786 <td>
3787 </td></tr></table>
3788
3789 !! end
3790
3791 !! test
3792 Wikitext table with double-line table cell
3793 !! input
3794 {|
3795 |a
3796 b
3797 |}
3798 !! result
3799 <table>
3800 <tr>
3801 <td>a
3802 <p>b
3803 </p>
3804 </td></tr></table>
3805
3806 !! end
3807
3808 !! test
3809 Table cell with a single comment
3810 !! input
3811 {|
3812 | <!-- c1 -->
3813 | a
3814 |}
3815 !! result
3816 <table>
3817 <tr>
3818 <td>
3819 </td>
3820 <td> a
3821 </td></tr></table>
3822
3823 !! end
3824
3825 # The expected HTML structure in this test is debatable. The PHP parser does
3826 # not parse this kind of table at all. The main focus for Parsoid is on
3827 # round-tripping, so this output is ok for now. TODO: revisit!
3828 !! test
3829 Wikitext table with html-syntax row (Parsoid)
3830 !! options
3831 parsoid
3832 !! input
3833 {|
3834 |-
3835 <td>foo</td>
3836 |}
3837 !! result
3838 <table>
3839 <tbody>
3840 <tr>
3841 <td>foo</td></tr></tbody></table>
3842 !! end
3843
3844 ###
3845 ### Internal links
3846 ###
3847 !! test
3848 Plain link, capitalized
3849 !! input
3850 [[Main Page]]
3851 !! result
3852 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
3853 </p>
3854 !! end
3855
3856 !! test
3857 Plain link, uncapitalized
3858 !! input
3859 [[main Page]]
3860 !! result
3861 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
3862 </p>
3863 !! end
3864
3865 !! test
3866 Piped link
3867 !! input
3868 [[Main Page|The Main Page]]
3869 !! result
3870 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
3871 </p>
3872 !! end
3873
3874 !! test
3875 Broken link
3876 !! input
3877 [[Zigzagzogzagzig]]
3878 !! result
3879 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
3880 </p>
3881 !! end
3882
3883 !! test
3884 Broken link with fragment
3885 !! input
3886 [[Zigzagzogzagzig#zug]]
3887 !! result
3888 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
3889 </p>
3890 !! end
3891
3892 !! test
3893 Special page link with fragment
3894 !! input
3895 [[Special:Version#anchor]]
3896 !! result
3897 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
3898 </p>
3899 !! end
3900
3901 !! test
3902 Nonexistent special page link with fragment
3903 !! input
3904 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
3905 !! result
3906 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
3907 </p>
3908 !! end
3909
3910 !! test
3911 Link with prefix
3912 !! input
3913 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
3914 !! result
3915 <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>
3916 </p>
3917 !! end
3918
3919 !! test
3920 Link with suffix
3921 !! input
3922 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
3923 !! result
3924 <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>!!!
3925 </p>
3926 !! end
3927
3928 !! article
3929 prefixed article
3930 !! text
3931 Some text
3932 !! endarticle
3933
3934 !! test
3935 Bug 43661: Piped links with identical prefixes
3936 !! input
3937 [[prefixed article|prefixed articles with spaces]]
3938
3939 [[prefixed article|prefixed articlesaoeu]]
3940
3941 [[Main Page|Main Page test]]
3942 !! result
3943 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
3944 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
3945 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
3946 </p>
3947 !! end
3948
3949
3950 !! test
3951 Link with HTML entity in suffix / tail
3952 !! input
3953 [[Main Page]]&quot;, [[Main Page]]&#97;
3954 !! result
3955 <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;
3956 </p>
3957 !! end
3958
3959 !! test
3960 Link with 3 brackets
3961 !! input
3962 [[[main page]]]
3963 !! result
3964 <p>[[[main page]]]
3965 </p>
3966 !! end
3967
3968 !! test
3969 Piped link with 3 brackets
3970 !! input
3971 [[[main page|the main page]]]
3972 !! result
3973 <p>[[[main page|the main page]]]
3974 </p>
3975 !! end
3976
3977 !! test
3978 Link with multiple pipes
3979 !! input
3980 [[Main Page|The|Main|Page]]
3981 !! result
3982 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
3983 </p>
3984 !! end
3985
3986 !! test
3987 Link to namespaces
3988 !! input
3989 [[Talk:Parser testing]], [[Meta:Disclaimers]]
3990 !! result
3991 <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>
3992 </p>
3993 !! end
3994
3995 !! test
3996 Piped link to namespace
3997 !! input
3998 [[Meta:Disclaimers|The disclaimers]]
3999 !! result
4000 <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>
4001 </p>
4002 !! end
4003
4004 !! test
4005 Link containing }
4006 !! input
4007 [[Usually caused by a typo (oops}]]
4008 !! result
4009 <p>[[Usually caused by a typo (oops}]]
4010 </p>
4011 !! end
4012
4013 !! test
4014 Link containing % (not as a hex sequence)
4015 !! input
4016 [[7% Solution]]
4017 !! result
4018 <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>
4019 </p>
4020 !! end
4021
4022 !! test
4023 Link containing % as a single hex sequence interpreted to char
4024 !! input
4025 [[7%25 Solution]]
4026 !! result
4027 <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>
4028 </p>
4029 !!end
4030
4031 !! test
4032 Link containing % as a double hex sequence interpreted to hex sequence
4033 !! input
4034 [[7%2525 Solution]]
4035 !! result
4036 <p>[[7%2525 Solution]]
4037 </p>
4038 !!end
4039
4040 !! test
4041 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
4042 Example for such a section: == < ==
4043 !! input
4044 [[%23%3c]][[%23%3e]]
4045 !! result
4046 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
4047 </p>
4048 !! end
4049
4050 !! test
4051 Link containing "<#" and ">#" as a hex sequences
4052 !! input
4053 [[%3c%23]][[%3e%23]]
4054 !! result
4055 <p>[[%3c%23]][[%3e%23]]
4056 </p>
4057 !! end
4058
4059 !! test
4060 Link containing an equals sign
4061 !! input
4062 [[Special:BookSources/isbn=4-00-026157-6]]
4063 !! result
4064 <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>
4065 </p>
4066 !! end
4067
4068 !! article
4069 Foo~bar
4070 !! text
4071 Just a test of an article title containing a tilde.
4072 !! endarticle
4073
4074 # note that links containing signatures, like [[Foo~~~~]], are
4075 # massaged by the pre-save transform (PST) and so the tildes are never
4076 # seen by the parser.
4077 !! test
4078 Link containing a tilde
4079 !! input
4080 [[Foo~bar]]
4081 !! result
4082 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
4083 </p>
4084 !! end
4085
4086 !! test
4087 Link containing double-single-quotes '' (bug 4598)
4088 !! input
4089 [[Lista d''e paise d''o munno]]
4090 !! result
4091 <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>
4092 </p>
4093 !! end
4094
4095 !! test
4096 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4097 !! input
4098 Some [[Link|pretty ''italics'' and stuff]]!
4099 !! result
4100 <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>!
4101 </p>
4102 !! end
4103
4104 !! test
4105 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4106 !! input
4107 ''Some [[Link|pretty ''italics'' and stuff]]!
4108 !! result
4109 <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>
4110 </p>
4111 !! end
4112
4113 !! test
4114 Link with double quotes in title part (literal) and alternate part (interpreted)
4115 !! input
4116 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4117
4118 [[''Pentecoste'']]
4119
4120 [[''Pentecoste''|Pentecoste]]
4121
4122 [[''Pentecoste''|''Pentecoste'']]
4123 !! result
4124 <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>
4125 </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>
4126 </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>
4127 </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>
4128 </p>
4129 !! end
4130
4131 !! test
4132 Broken image links with HTML captions (bug 39700)
4133 !! input
4134 [[File:Nonexistent|<script></script>]]
4135 [[File:Nonexistent|100px|<script></script>]]
4136 [[File:Nonexistent|&lt;]]
4137 [[File:Nonexistent|a<i>b</i>c]]
4138 !! result
4139 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4140 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4141 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4142 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4143 </p>
4144 !! end
4145
4146 !! test
4147 Plain link to URL
4148 !! input
4149 [[http://www.example.com]]
4150 !! result
4151 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4152 </p>
4153 !! end
4154
4155 !! test
4156 Plain link to URL with link text
4157 !! input
4158 [[http://www.example.com Link text]]
4159 !! result
4160 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4161 </p>
4162 !! end
4163
4164 !! test
4165 Plain link to protocol-relative URL
4166 !! input
4167 [[//www.example.com]]
4168 !! result
4169 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4170 </p>
4171 !! end
4172
4173 !! test
4174 Plain link to protocol-relative URL with link text
4175 !! input
4176 [[//www.example.com Link text]]
4177 !! result
4178 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4179 </p>
4180 !! end
4181
4182 !! test
4183 Plain link to page with question mark in title
4184 !! input
4185 [[A?b]]
4186
4187 [[A?b|Baz]]
4188 !! result
4189 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4190 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4191 </p>
4192 !! end
4193
4194
4195 # I'm fairly sure the expected result here is wrong.
4196 # We want these to be URL links, not pseudo-pages with URLs for titles....
4197 # However the current output is also pretty screwy.
4198 #
4199 # ----
4200 # I'm changing it to match the current output--it arguably makes more
4201 # sense in the light of the test above. Old expected result was:
4202 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4203 #</p>
4204 # But I think this test is bordering on "garbage in, garbage out" anyway.
4205 # -- wtm
4206 !! test
4207 Piped link to URL
4208 !! input
4209 Piped link to URL: [[http://www.example.com|an example URL]]
4210 !! result
4211 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4212 </p>
4213 !! end
4214
4215 !! test
4216 BUG 2: [[page|http://url/]] should link to page, not http://url/
4217 !! input
4218 [[Main Page|http://url/]]
4219 !! result
4220 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4221 </p>
4222 !! end
4223
4224 !! test
4225 BUG 337: Escaped self-links should be bold
4226 !! options
4227 title=[[Bug462]]
4228 !! input
4229 [[Bu&#103;462]] [[Bug462]]
4230 !! result
4231 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4232 </p>
4233 !! end
4234
4235 !! test
4236 Self-link to section should not be bold
4237 !! options
4238 title=[[Main Page]]
4239 !! input
4240 [[Main Page#section]]
4241 !! result
4242 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4243 </p>
4244 !! end
4245
4246 !! article
4247 00
4248 !! text
4249 This is 00.
4250 !! endarticle
4251
4252 !!test
4253 Self-link to numeric title
4254 !!options
4255 title=[[0]]
4256 !!input
4257 [[0]]
4258 !!result
4259 <p><strong class="selflink">0</strong>
4260 </p>
4261 !!end
4262
4263 !!test
4264 Link to numeric-equivalent title
4265 !!options
4266 title=[[0]]
4267 !!input
4268 [[00]]
4269 !!result
4270 <p><a href="/wiki/00" title="00">00</a>
4271 </p>
4272 !!end
4273
4274 !! test
4275 <nowiki> inside a link
4276 !! input
4277 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4278 !! result
4279 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4280 </p>
4281 !! end
4282
4283 !! test
4284 Non-breaking spaces in title
4285 !! input
4286 [[&nbsp; Main &nbsp; Page &nbsp;]]
4287 !! result
4288 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4289 </p>
4290 !!end
4291
4292 !! test
4293 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4294 !! options
4295 language=ca
4296 !! input
4297 '''[[Main Page]]'''
4298 !! result
4299 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4300 </p>
4301 !! end
4302
4303 !! test
4304 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4305 !! options
4306 language=ca
4307 !! input
4308 ''[[Main Page]]''
4309 !! result
4310 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4311 </p>
4312 !! end
4313
4314 !! test
4315 Internal link with en linktrail: no apostrophes (bug 27473)
4316 !! options
4317 language=en
4318 !! input
4319 [[Something]]'nice
4320 !! result
4321 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4322 </p>
4323 !! end
4324
4325 !! test
4326 Internal link with ca linktrail with apostrophes (bug 27473)
4327 !! options
4328 language=ca
4329 !! input
4330 [[Something]]'nice
4331 !! result
4332 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4333 </p>
4334 !! end
4335
4336 !! test
4337 Internal link with kaa linktrail with apostrophes (bug 27473)
4338 !! options
4339 language=kaa
4340 !! input
4341 [[Something]]'nice
4342 !! result
4343 <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>
4344 </p>
4345 !! end
4346
4347 !! article
4348 Söfnuður
4349 !! text
4350 Test.
4351 !! endarticle
4352
4353 !! test
4354 Internal link with is link prefix
4355 !! options
4356 language=is
4357 !! input
4358 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
4359 !! result
4360 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
4361 </p>
4362 !! end
4363
4364 !! article
4365 Mótmælendatrú
4366 !! text
4367 Test.
4368 !! endarticle
4369
4370 !! test
4371 Internal link with is link trail and link prefix
4372 !! options
4373 language=is
4374 !! input
4375 [[mótmælendatrú|xxx]]ar
4376 [[mótmælendatrú]]ar
4377 mótmælenda[[söfnuður]]
4378 mótmælenda[[söfnuður|söfnuðir]]
4379 mótmælenda[[söfnuður|söfnuðir]]xxx
4380 !! result
4381 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
4382 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
4383 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
4384 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
4385 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
4386 </p>
4387 !! end
4388
4389 !! test
4390 Parsoid link trail escaping
4391 !! options
4392 parsoid=html2wt,html2html
4393 !! input
4394 [[apple]]<nowiki/>s
4395 !! result
4396 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
4397 !! end
4398
4399 !! test
4400 Parsoid link prefix escaping
4401 !! options
4402 language=is
4403 parsoid=html2wt,html2html
4404 !! input
4405 Aðrir mótmælenda<nowiki/>[[söfnuður]]
4406 !! result
4407 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
4408 !! end
4409
4410 !! test
4411 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4412 !! input
4413 [[Foo| bar]]
4414
4415 [[Foo| ''bar'']]
4416
4417 [http://wp.org foo]
4418
4419 [http://wp.org ''foo'']
4420 !! result
4421 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
4422 </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>
4423 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4424 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4425 </p>
4426 !! end
4427
4428 ###
4429 ### Interwiki links (see maintenance/interwiki.sql)
4430 ###
4431
4432 !! test
4433 Inline interwiki link
4434 !! input
4435 [[MeatBall:SoftSecurity]]
4436 !! result
4437 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4438 </p>
4439 !! end
4440
4441 !! test
4442 Inline interwiki link with empty title (bug 2372)
4443 !! input
4444 [[MeatBall:]]
4445 !! result
4446 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4447 </p>
4448 !! end
4449
4450 !! test
4451 Interwiki link encoding conversion (bug 1636)
4452 !! input
4453 *[[Wikipedia:ro:Olteni&#0355;a]]
4454 *[[Wikipedia:ro:Olteni&#355;a]]
4455 !! result
4456 <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>
4457 </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>
4458 </li></ul>
4459
4460 !! end
4461
4462 !! test
4463 Interwiki link with fragment (bug 2130)
4464 !! input
4465 [[MeatBall:SoftSecurity#foo]]
4466 !! result
4467 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4468 </p>
4469 !! end
4470
4471 !! test
4472 Interlanguage link
4473 !! input
4474 Blah blah blah
4475 [[zh:Chinese]]
4476 !!result
4477 <p>Blah blah blah
4478 </p>
4479 !! end
4480
4481 !! test
4482 Double interlanguage link
4483 !! input
4484 Blah blah blah
4485 [[es:Spanish]]
4486 [[zh:Chinese]]
4487 !!result
4488 <p>Blah blah blah
4489 </p>
4490 !! end
4491
4492 !! test
4493 Interlanguage link, with prefix links
4494 !! options
4495 language=ln
4496 !! input
4497 Blah blah blah
4498 [[zh:Chinese]]
4499 !!result
4500 <p>Blah blah blah
4501 </p>
4502 !! end
4503
4504 !! test
4505 Double interlanguage link, with prefix links (bug 8897)
4506 !! options
4507 language=ln
4508 !! input
4509 Blah blah blah
4510 [[es:Spanish]]
4511 [[zh:Chinese]]
4512 !!result
4513 <p>Blah blah blah
4514 </p>
4515 !! end
4516
4517 !! test
4518 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4519 !! options
4520 language=ln
4521 !! input
4522 [[WW&nbsp;II]]
4523 !!result
4524 <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>
4525 </p>
4526 !! end
4527
4528 ##
4529 ## XHTML tidiness
4530 ###
4531
4532 !! test
4533 <br> to <br />
4534 !! input
4535 1<br>2<br />3
4536 !! result
4537 <p>1<br />2<br />3
4538 </p>
4539 !! end
4540
4541 !! test
4542 Broken br tag sanitization
4543 !! input
4544 </br>
4545 !! result
4546 <p>&lt;/br&gt;
4547 </p>
4548 !! end
4549
4550 !! test
4551 Incorrecly removing closing slashes from correctly formed XHTML
4552 !! input
4553 <br style="clear:both;" />
4554 !! result
4555 <p><br style="clear:both;" />
4556 </p>
4557 !! end
4558
4559 !! test
4560 Failing to transform badly formed HTML into correct XHTML
4561 !! input
4562 <br style="clear: left;">
4563 <br style="clear: right;">
4564 <br style="clear: both;">
4565 !! result
4566 <p><br style="clear: left;" />
4567 <br style="clear: right;" />
4568 <br style="clear: both;" />
4569 </p>
4570 !!end
4571
4572 !! test
4573 Handling html with a div self-closing tag
4574 !! input
4575 <div title />
4576 <div title/>
4577 <div title/ >
4578 <div title=bar />
4579 <div title=bar/>
4580 <div title=bar/ >
4581 !! result
4582 <p>&lt;div title /&gt;
4583 &lt;div title/&gt;
4584 </p>
4585 <div>
4586 <p>&lt;div title=bar /&gt;
4587 &lt;div title=bar/&gt;
4588 </p>
4589 <div title="bar/"></div>
4590 </div>
4591
4592 !! end
4593
4594 !! test
4595 Handling html with a br self-closing tag
4596 !! input
4597 <br title />
4598 <br title/>
4599 <br title/ >
4600 <br title=bar />
4601 <br title=bar/>
4602 <br title=bar/ >
4603 !! result
4604 <p><br title="title" />
4605 <br title="title" />
4606 <br />
4607 <br title="bar" />
4608 <br title="bar" />
4609 <br title="bar/" />
4610 </p>
4611 !! end
4612
4613 !! test
4614 Horizontal ruler (should it add that extra space?)
4615 !! input
4616 <hr>
4617 <hr >
4618 foo <hr
4619 > bar
4620 !! result
4621 <hr />
4622 <hr />
4623 foo <hr /> bar
4624
4625 !! end
4626
4627 !! test
4628 Horizontal ruler -- 4+ dashes render hr
4629 !! input
4630 ----
4631 !! result
4632 <hr />
4633
4634 !! end
4635
4636 !! test
4637 Horizontal ruler -- eats additional dashes on the same line
4638 !! input
4639 ---------
4640 !! result
4641 <hr />
4642
4643 !! end
4644
4645 !! test
4646 Horizontal ruler -- does not collapse dashes on consecutive lines
4647 !! input
4648 ----
4649 ----
4650 !! result
4651 <hr />
4652 <hr />
4653
4654 !! end
4655
4656 !! test
4657 Horizontal ruler -- <4 dashes render as plain text
4658 !! input
4659 ---
4660 !! result
4661 <p>---
4662 </p>
4663 !! end
4664
4665 !! test
4666 Horizontal ruler -- Supports content following dashes on same line
4667 !! input
4668 ---- Foo
4669 !! result
4670 <hr /> Foo
4671
4672 !! end
4673
4674 ###
4675 ### Block-level elements
4676 ###
4677 !! test
4678 Common list
4679 !! input
4680 *Common list
4681 * item 2
4682 *item 3
4683 !! result
4684 <ul><li>Common list
4685 </li><li> item 2
4686 </li><li>item 3
4687 </li></ul>
4688
4689 !! end
4690
4691 !! test
4692 Numbered list
4693 !! input
4694 #Numbered list
4695 #item 2
4696 # item 3
4697 !! result
4698 <ol><li>Numbered list
4699 </li><li>item 2
4700 </li><li> item 3
4701 </li></ol>
4702
4703 !! end
4704
4705 !! test
4706 Mixed list
4707 !! input
4708 *Mixed list
4709 *# with numbers
4710 ** and bullets
4711 *# and numbers
4712 *bullets again
4713 **bullet level 2
4714 ***bullet level 3
4715 ***#Number on level 4
4716 **bullet level 2
4717 **#Number on level 3
4718 **#Number on level 3
4719 *#number level 2
4720 *Level 1
4721 *** Level 3
4722 #** Level 3, but ordered
4723 !! result
4724 <ul><li>Mixed list
4725 <ol><li> with numbers
4726 </li></ol>
4727 <ul><li> and bullets
4728 </li></ul>
4729 <ol><li> and numbers
4730 </li></ol>
4731 </li><li>bullets again
4732 <ul><li>bullet level 2
4733 <ul><li>bullet level 3
4734 <ol><li>Number on level 4
4735 </li></ol>
4736 </li></ul>
4737 </li><li>bullet level 2
4738 <ol><li>Number on level 3
4739 </li><li>Number on level 3
4740 </li></ol>
4741 </li></ul>
4742 <ol><li>number level 2
4743 </li></ol>
4744 </li><li>Level 1
4745 <ul><li><ul><li> Level 3
4746 </li></ul>
4747 </li></ul>
4748 </li></ul>
4749 <ol><li><ul><li><ul><li> Level 3, but ordered
4750 </li></ul>
4751 </li></ul>
4752 </li></ol>
4753
4754 !! end
4755
4756 !! test
4757 Nested lists 1
4758 !! input
4759 *foo
4760 **bar
4761 !! result
4762 <ul><li>foo
4763 <ul><li>bar
4764 </li></ul>
4765 </li></ul>
4766
4767 !! end
4768
4769 !! test
4770 Nested lists 2
4771 !! input
4772 **foo
4773 *bar
4774 !! result
4775 <ul><li><ul><li>foo
4776 </li></ul>
4777 </li><li>bar
4778 </li></ul>
4779
4780 !! end
4781
4782 !! test
4783 Nested lists 3 (first element empty)
4784 !! input
4785 *
4786 **bar
4787 !! result
4788 <ul><li>
4789 <ul><li>bar
4790 </li></ul>
4791 </li></ul>
4792
4793 !! end
4794
4795 !! test
4796 Nested lists 4 (first element empty)
4797 !! input
4798 **
4799 *bar
4800 !! result
4801 <ul><li><ul><li>
4802 </li></ul>
4803 </li><li>bar
4804 </li></ul>
4805
4806 !! end
4807
4808 !! test
4809 Nested lists 5 (both elements empty)
4810 !! input
4811 **
4812 *
4813 !! result
4814 <ul><li><ul><li>
4815 </li></ul>
4816 </li><li>
4817 </li></ul>
4818
4819 !! end
4820
4821 !! test
4822 Nested lists 6 (both elements empty)
4823 !! input
4824 *
4825 **
4826 !! result
4827 <ul><li>
4828 <ul><li>
4829 </li></ul>
4830 </li></ul>
4831
4832 !! end
4833
4834 !! test
4835 Nested lists 7 (skip initial nesting levels)
4836 !! input
4837 *** foo
4838 !! result
4839 <ul><li><ul><li><ul><li> foo
4840 </li></ul>
4841 </li></ul>
4842 </li></ul>
4843
4844 !! end
4845
4846 !! test
4847 Nested lists 8 (multiple nesting transitions)
4848 !! input
4849 * foo
4850 *** bar
4851 ** baz
4852 * boo
4853 !! result
4854 <ul><li> foo
4855 <ul><li><ul><li> bar
4856 </li></ul>
4857 </li><li> baz
4858 </li></ul>
4859 </li><li> boo
4860 </li></ul>
4861
4862 !! end
4863
4864 !! test
4865 1. Lists with start-of-line-transparent tokens before bullets: Comments
4866 !! input
4867 *foo
4868 *<!--cmt-->bar
4869 <!--cmt-->*baz
4870 !! result
4871 <ul><li>foo
4872 </li><li>bar
4873 </li><li>baz
4874 </li></ul>
4875
4876 !! end
4877
4878 !! test
4879 2. Lists with start-of-line-transparent tokens before bullets: Template close
4880 !! input
4881 *foo {{echo|bar
4882 }}*baz
4883 !! result
4884 <ul><li>foo bar
4885 </li><li>baz
4886 </li></ul>
4887
4888 !! end
4889
4890 !! test
4891 Unbalanced closing block tags break a list
4892 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
4893 !! options
4894 parsoid
4895 !! input
4896 <div>
4897 *a</div><div>
4898 *b</div>
4899 !! result
4900 <div>
4901 <ul><li>a
4902 </li></ul></div><div>
4903 <ul><li>b
4904 </li></ul></div>
4905 !! end
4906
4907 !! test
4908 Unbalanced closing non-block tags don't break a list
4909 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
4910 !! options
4911 parsoid
4912 !! input
4913 <span>
4914 *a</span><span>
4915 *b</span>
4916 !! result
4917 <p><span></span>
4918 </p>
4919 <ul><li>a<span></span>
4920 </li><li>b
4921 </li></ul>
4922 !! end
4923
4924 !! test
4925 Unclosed formatting tags that straddle lists are closed and reopened
4926 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
4927 !! options
4928 parsoid
4929 !! input
4930 # <s> a
4931 # b </s>
4932 !! result
4933 <ol><li> <s> a </s>
4934 </li><li> <s> b </s>
4935 </li></ol>
4936 !! end
4937
4938 !!test
4939 List embedded in a non-block tag
4940 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
4941 !! options
4942 parsoid
4943 !!input
4944 <small>
4945 * foo
4946 </small>
4947 !!result
4948 <p><small></small></p>
4949 <small>
4950 <ul>
4951 <li> foo</li>
4952 </ul>
4953 </small>
4954 <p><small></small></p>
4955 !!end
4956
4957 !! test
4958 List items are not parsed correctly following a <pre> block (bug 785)
4959 !! input
4960 * <pre>foo</pre>
4961 * <pre>bar</pre>
4962 * zar
4963 !! result
4964 <ul><li> <pre>foo</pre>
4965 </li><li> <pre>bar</pre>
4966 </li><li> zar
4967 </li></ul>
4968
4969 !! end
4970
4971 !! test
4972 List items from template
4973 !! input
4974
4975 {{inner list}}
4976 * item 2
4977
4978 * item 0
4979 {{inner list}}
4980 * item 2
4981
4982 * item 0
4983 * notSOL{{inner list}}
4984 * item 2
4985 !! result
4986 <ul><li> item 1
4987 </li><li> item 2
4988 </li></ul>
4989 <ul><li> item 0
4990 </li><li> item 1
4991 </li><li> item 2
4992 </li></ul>
4993 <ul><li> item 0
4994 </li><li> notSOL
4995 </li><li> item 1
4996 </li><li> item 2
4997 </li></ul>
4998
4999 !! end
5000
5001 !! test
5002 List interrupted by empty line or heading
5003 !! input
5004 * foo
5005
5006 ** bar
5007 == A heading ==
5008 * Another list item
5009 !! result
5010 <ul><li> foo
5011 </li></ul>
5012 <ul><li><ul><li> bar
5013 </li></ul>
5014 </li></ul>
5015 <h2><span class="mw-headline" id="A_heading">A heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a>]</span></h2>
5016 <ul><li> Another list item
5017 </li></ul>
5018
5019 !!end
5020
5021 !!test
5022 Multiple list tags generated by templates
5023 !!input
5024 {{echo|<li>}}a
5025 {{echo|<li>}}b
5026 {{echo|<li>}}c
5027 !!result
5028 <li>a
5029 <li>b
5030 <li>c</li>
5031 </li>
5032 </li>
5033
5034 !!end
5035
5036 !!test
5037 Single-comment whitespace lines dont break lists, but multi-comment whitespace lines do
5038 !!input
5039 *a
5040 <!--This line will NOT split the list-->
5041 *b
5042 <!--This line will NOT split the list either-->
5043 *c
5044 <!--foo--> <!--This line with more than 1 comment will split the list-->
5045 *d
5046 !!result
5047 <ul><li>a
5048 </li><li>b
5049 </li><li>c
5050 </li></ul>
5051 <ul><li>d
5052 </li></ul>
5053
5054 !!end
5055
5056 ###
5057 ### Magic Words
5058 ###
5059
5060 !! test
5061 Magic Word: {{CURRENTDAY}}
5062 !! input
5063 {{CURRENTDAY}}
5064 !! result
5065 <p>1
5066 </p>
5067 !! end
5068
5069 !! test
5070 Magic Word: {{CURRENTDAY2}}
5071 !! input
5072 {{CURRENTDAY2}}
5073 !! result
5074 <p>01
5075 </p>
5076 !! end
5077
5078 !! test
5079 Magic Word: {{CURRENTDAYNAME}}
5080 !! input
5081 {{CURRENTDAYNAME}}
5082 !! result
5083 <p>Thursday
5084 </p>
5085 !! end
5086
5087 !! test
5088 Magic Word: {{CURRENTDOW}}
5089 !! input
5090 {{CURRENTDOW}}
5091 !! result
5092 <p>4
5093 </p>
5094 !! end
5095
5096 !! test
5097 Magic Word: {{CURRENTMONTH}}
5098 !! input
5099 {{CURRENTMONTH}}
5100 !! result
5101 <p>01
5102 </p>
5103 !! end
5104
5105 !! test
5106 Magic Word: {{CURRENTMONTHABBREV}}
5107 !! input
5108 {{CURRENTMONTHABBREV}}
5109 !! result
5110 <p>Jan
5111 </p>
5112 !! end
5113
5114 !! test
5115 Magic Word: {{CURRENTMONTHNAME}}
5116 !! input
5117 {{CURRENTMONTHNAME}}
5118 !! result
5119 <p>January
5120 </p>
5121 !! end
5122
5123 !! test
5124 Magic Word: {{CURRENTMONTHNAMEGEN}}
5125 !! input
5126 {{CURRENTMONTHNAMEGEN}}
5127 !! result
5128 <p>January
5129 </p>
5130 !! end
5131
5132 !! test
5133 Magic Word: {{CURRENTTIME}}
5134 !! input
5135 {{CURRENTTIME}}
5136 !! result
5137 <p>00:02
5138 </p>
5139 !! end
5140
5141 !! test
5142 Magic Word: {{CURRENTWEEK}} (@bug 4594)
5143 !! input
5144 {{CURRENTWEEK}}
5145 !! result
5146 <p>1
5147 </p>
5148 !! end
5149
5150 !! test
5151 Magic Word: {{CURRENTYEAR}}
5152 !! input
5153 {{CURRENTYEAR}}
5154 !! result
5155 <p>1970
5156 </p>
5157 !! end
5158
5159 !! test
5160 Magic Word: {{FULLPAGENAME}}
5161 !! options
5162 title=[[User:Ævar Arnfjörð Bjarmason]]
5163 !! input
5164 {{FULLPAGENAME}}
5165 !! result
5166 <p>User:Ævar Arnfjörð Bjarmason
5167 </p>
5168 !! end
5169
5170 !! test
5171 Magic Word: {{FULLPAGENAMEE}}
5172 !! options
5173 title=[[User:Ævar Arnfjörð Bjarmason]]
5174 !! input
5175 {{FULLPAGENAMEE}}
5176 !! result
5177 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5178 </p>
5179 !! end
5180
5181 !! test
5182 Magic Word: {{NAMESPACE}}
5183 !! options
5184 title=[[User:Ævar Arnfjörð Bjarmason]]
5185 !! input
5186 {{NAMESPACE}}
5187 !! result
5188 <p>User
5189 </p>
5190 !! end
5191
5192 !! test
5193 Magic Word: {{NAMESPACEE}}
5194 !! options
5195 title=[[User:Ævar Arnfjörð Bjarmason]]
5196 !! input
5197 {{NAMESPACEE}}
5198 !! result
5199 <p>User
5200 </p>
5201 !! end
5202
5203 !! test
5204 Magic Word: {{NAMESPACENUMBER}}
5205 !! options
5206 title=[[User:Ævar Arnfjörð Bjarmason]]
5207 !! input
5208 {{NAMESPACENUMBER}}
5209 !! result
5210 <p>2
5211 </p>
5212 !! end
5213
5214 !! test
5215 Magic Word: {{NUMBEROFFILES}}
5216 !! input
5217 {{NUMBEROFFILES}}
5218 !! result
5219 <p>4
5220 </p>
5221 !! end
5222
5223 !! test
5224 Magic Word: {{PAGENAME}}
5225 !! options
5226 title=[[User:Ævar Arnfjörð Bjarmason]]
5227 !! input
5228 {{PAGENAME}}
5229 !! result
5230 <p>Ævar Arnfjörð Bjarmason
5231 </p>
5232 !! end
5233
5234 !! test
5235 Magic Word: {{PAGENAME}} with metacharacters
5236 !! options
5237 title=[['foo & bar = baz']]
5238 !! input
5239 ''{{PAGENAME}}''
5240 !! result
5241 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
5242 </p>
5243 !! end
5244
5245 !! test
5246 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
5247 !! options
5248 title=[[*RFC 1234 http://example.com/]]
5249 !! input
5250 {{PAGENAME}}
5251 !! result
5252 <p>&#42;RFC&#32;1234 http&#58;//example.com/
5253 </p>
5254 !! end
5255
5256 !! test
5257 Magic Word: {{PAGENAMEE}}
5258 !! options
5259 title=[[User:Ævar Arnfjörð Bjarmason]]
5260 !! input
5261 {{PAGENAMEE}}
5262 !! result
5263 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5264 </p>
5265 !! end
5266
5267 !! test
5268 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
5269 !! options
5270 title=[[*RFC 1234 http://example.com/]]
5271 !! input
5272 {{PAGENAMEE}}
5273 !! result
5274 <p>&#42;RFC_1234_http&#58;//example.com/
5275 </p>
5276 !! end
5277
5278 !! test
5279 Magic Word: {{REVISIONID}}
5280 !! input
5281 {{REVISIONID}}
5282 !! result
5283 <p>1337
5284 </p>
5285 !! end
5286
5287 !! test
5288 Magic Word: {{SCRIPTPATH}}
5289 !! input
5290 {{SCRIPTPATH}}
5291 !! result
5292 <p>/
5293 </p>
5294 !! end
5295
5296 !! test
5297 Magic Word: {{SERVER}}
5298 !! input
5299 {{SERVER}}
5300 !! result
5301 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5302 </p>
5303 !! end
5304
5305 !! test
5306 Magic Word: {{SERVERNAME}}
5307 !! input
5308 {{SERVERNAME}}
5309 !! result
5310 <p>example.org
5311 </p>
5312 !! end
5313
5314 !! test
5315 Magic Word: {{SITENAME}}
5316 !! input
5317 {{SITENAME}}
5318 !! result
5319 <p>MediaWiki
5320 </p>
5321 !! end
5322
5323 !! test
5324 Case-sensitive magic words, when cased differently, should just be template transclusions
5325 !! input
5326 {{CurrentMonth}}
5327 {{currentday}}
5328 {{cURreNTweEK}}
5329 {{currentHour}}
5330 !! result
5331 <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>
5332 <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>
5333 <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>
5334 <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>
5335 </p>
5336 !! end
5337
5338 !! test
5339 Case-insensitive magic words should still work with weird casing.
5340 !! input
5341 {{sErVeRNaMe}}
5342 {{LCFirst:AOEU}}
5343 {{ucFIRST:aoeu}}
5344 {{SERver}}
5345 !! result
5346 <p>example.org
5347 aOEU
5348 Aoeu
5349 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5350 </p>
5351 !! end
5352
5353 !! test
5354 Namespace 1 {{ns:1}}
5355 !! input
5356 {{ns:1}}
5357 !! result
5358 <p>Talk
5359 </p>
5360 !! end
5361
5362 !! test
5363 Namespace 1 {{ns:01}}
5364 !! input
5365 {{ns:01}}
5366 !! result
5367 <p>Talk
5368 </p>
5369 !! end
5370
5371 !! test
5372 Namespace 0 {{ns:0}} (bug 4783)
5373 !! input
5374 {{ns:0}}
5375 !! result
5376
5377 !! end
5378
5379 !! test
5380 Namespace 0 {{ns:00}} (bug 4783)
5381 !! input
5382 {{ns:00}}
5383 !! result
5384
5385 !! end
5386
5387 !! test
5388 Namespace -1 {{ns:-1}}
5389 !! input
5390 {{ns:-1}}
5391 !! result
5392 <p>Special
5393 </p>
5394 !! end
5395
5396 !! test
5397 Namespace User {{ns:User}}
5398 !! input
5399 {{ns:User}}
5400 !! result
5401 <p>User
5402 </p>
5403 !! end
5404
5405 !! test
5406 Namespace User talk {{ns:User_talk}}
5407 !! input
5408 {{ns:User_talk}}
5409 !! result
5410 <p>User talk
5411 </p>
5412 !! end
5413
5414 !! test
5415 Namespace User talk {{ns:uSeR tAlK}}
5416 !! input
5417 {{ns:uSeR tAlK}}
5418 !! result
5419 <p>User talk
5420 </p>
5421 !! end
5422
5423 !! test
5424 Namespace File {{ns:File}}
5425 !! input
5426 {{ns:File}}
5427 !! result
5428 <p>File
5429 </p>
5430 !! end
5431
5432 !! test
5433 Namespace File {{ns:Image}}
5434 !! input
5435 {{ns:Image}}
5436 !! result
5437 <p>File
5438 </p>
5439 !! end
5440
5441 !! test
5442 Namespace (lang=de) Benutzer {{ns:User}}
5443 !! options
5444 language=de
5445 !! input
5446 {{ns:User}}
5447 !! result
5448 <p>Benutzer
5449 </p>
5450 !! end
5451
5452 !! test
5453 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
5454 !! options
5455 language=de
5456 !! input
5457 {{ns:3}}
5458 !! result
5459 <p>Benutzer Diskussion
5460 </p>
5461 !! end
5462
5463
5464 !! test
5465 Urlencode
5466 !! input
5467 {{urlencode:hi world?!}}
5468 {{urlencode:hi world?!|WIKI}}
5469 {{urlencode:hi world?!|PATH}}
5470 {{urlencode:hi world?!|QUERY}}
5471 !! result
5472 <p>hi+world%3F%21
5473 hi_world%3F!
5474 hi%20world%3F%21
5475 hi+world%3F%21
5476 </p>
5477 !! end
5478
5479 ###
5480 ### Magic links
5481 ###
5482 !! test
5483 Magic links: internal link to RFC (bug 479)
5484 !! input
5485 [[RFC 123]]
5486 !! result
5487 <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>
5488 </p>
5489 !! end
5490
5491 !! test
5492 Magic links: RFC (bug 479)
5493 !! input
5494 RFC 822
5495 !! result
5496 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
5497 </p>
5498 !! end
5499
5500 !! test
5501 Magic links: ISBN (bug 1937)
5502 !! input
5503 ISBN 0-306-40615-2
5504 !! result
5505 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
5506 </p>
5507 !! end
5508
5509 !! test
5510 Magic links: PMID incorrectly converts space to underscore
5511 !! input
5512 PMID 1234
5513 !! result
5514 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
5515 </p>
5516 !! end
5517
5518 ###
5519 ### Templates
5520 ####
5521
5522 !! test
5523 Nonexistent template
5524 !! input
5525 {{thistemplatedoesnotexist}}
5526 !! result
5527 <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>
5528 </p>
5529 !! end
5530
5531 !! test
5532 Template with invalid target containing tags
5533 !! input
5534 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5535 !! result
5536 <p>{{a<b>b</b>|foo|a=b|a = b}}
5537 </p>
5538 !! end
5539
5540 !! test
5541 Template with invalid target containing unclosed tag
5542 !! input
5543 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5544 !! result
5545 <p>{{a<b>|foo|a=b|a = b}}</b>
5546 </p>
5547 !! end
5548
5549 !! article
5550 Template:test
5551 !! text
5552 This is a test template
5553 !! endarticle
5554
5555 !! test
5556 Simple template
5557 !! input
5558 {{test}}
5559 !! result
5560 <p>This is a test template
5561 </p>
5562 !! end
5563
5564 !! test
5565 Template with explicit namespace
5566 !! input
5567 {{Template:test}}
5568 !! result
5569 <p>This is a test template
5570 </p>
5571 !! end
5572
5573
5574 !! article
5575 Template:paramtest
5576 !! text
5577 This is a test template with parameter {{{param}}}
5578 !! endarticle
5579
5580 !! test
5581 Template parameter
5582 !! input
5583 {{paramtest|param=foo}}
5584 !! result
5585 <p>This is a test template with parameter foo
5586 </p>
5587 !! end
5588
5589 !! article
5590 Template:paramtestnum
5591 !! text
5592 [[{{{1}}}|{{{2}}}]]
5593 !! endarticle
5594
5595 !! test
5596 Template unnamed parameter
5597 !! input
5598 {{paramtestnum|Main Page|the main page}}
5599 !! result
5600 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
5601 </p>
5602 !! end
5603
5604 !! article
5605 Template:templatesimple
5606 !! text
5607 (test)
5608 !! endarticle
5609
5610 !! article
5611 Template:templateredirect
5612 !! text
5613 #redirect [[Template:templatesimple]]
5614 !! endarticle
5615
5616 !! article
5617 Template:templateasargtestnum
5618 !! text
5619 {{{{{1}}}}}
5620 !! endarticle
5621
5622 !! article
5623 Template:templateasargtest
5624 !! text
5625 {{template{{{templ}}}}}
5626 !! endarticle
5627
5628 !! article
5629 Template:templateasargtest2
5630 !! text
5631 {{{{{templ}}}}}
5632 !! endarticle
5633
5634 !! test
5635 Template with template name as unnamed argument
5636 !! input
5637 {{templateasargtestnum|templatesimple}}
5638 !! result
5639 <p>(test)
5640 </p>
5641 !! end
5642
5643 !! test
5644 Template with template name as argument
5645 !! input
5646 {{templateasargtest|templ=simple}}
5647 !! result
5648 <p>(test)
5649 </p>
5650 !! end
5651
5652 !! test
5653 Template with template name as argument (2)
5654 !! input
5655 {{templateasargtest2|templ=templatesimple}}
5656 !! result
5657 <p>(test)
5658 </p>
5659 !! end
5660
5661 !! article
5662 Template:templateasargtestdefault
5663 !! text
5664 {{{{{templ|templatesimple}}}}}
5665 !! endarticle
5666
5667 !! article
5668 Template:templa
5669 !! text
5670 '''templ'''
5671 !! endarticle
5672
5673 !! test
5674 Template with default value
5675 !! input
5676 {{templateasargtestdefault}}
5677 !! result
5678 <p>(test)
5679 </p>
5680 !! end
5681
5682 !! test
5683 Template with default value (value set)
5684 !! input
5685 {{templateasargtestdefault|templ=templa}}
5686 !! result
5687 <p><b>templ</b>
5688 </p>
5689 !! end
5690
5691 !! test
5692 Template redirect
5693 !! input
5694 {{templateredirect}}
5695 !! result
5696 <p>(test)
5697 </p>
5698 !! end
5699
5700 !! test
5701 Template with argument in separate line
5702 !! input
5703 {{ templateasargtest |
5704 templ = simple }}
5705 !! result
5706 <p>(test)
5707 </p>
5708 !! end
5709
5710 !! test
5711 Template with complex template as argument
5712 !! input
5713 {{paramtest|
5714 param ={{ templateasargtest |
5715 templ = simple }}}}
5716 !! result
5717 <p>This is a test template with parameter (test)
5718 </p>
5719 !! end
5720
5721 !! test
5722 Template with thumb image (with link in description)
5723 !! input
5724 {{paramtest|
5725 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
5726 !! result
5727 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>
5728
5729 !! end
5730
5731 !! article
5732 Template:complextemplate
5733 !! text
5734 {{{1}}} {{paramtest|
5735 param ={{{param}}}}}
5736 !! endarticle
5737
5738 !! test
5739 Template with complex arguments
5740 !! input
5741 {{complextemplate|
5742 param ={{ templateasargtest |
5743 templ = simple }}|[[Template:complextemplate|link]]}}
5744 !! result
5745 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
5746 </p>
5747 !! end
5748
5749 !! test
5750 BUG 553: link with two variables in a piped link
5751 !! input
5752 {|
5753 |[[{{{1}}}|{{{2}}}]]
5754 |}
5755 !! result
5756 <table>
5757 <tr>
5758 <td>[[{{{1}}}|{{{2}}}]]
5759 </td></tr></table>
5760
5761 !! end
5762
5763 !! test
5764 Magic variable as template parameter
5765 !! input
5766 {{paramtest|param={{SITENAME}}}}
5767 !! result
5768 <p>This is a test template with parameter MediaWiki
5769 </p>
5770 !! end
5771
5772 !! article
5773 Template:linktest
5774 !! text
5775 [[{{{param}}}|link]]
5776 !! endarticle
5777
5778 !! test
5779 Template parameter as link source
5780 !! input
5781 {{linktest|param=Main Page}}
5782 !! result
5783 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
5784 </p>
5785 !! end
5786
5787 !!test
5788 Template-generated attribute string (k='v')
5789 !!input
5790 <span {{attr_str|id|v1}}>bar</span>
5791 !!result
5792 <p><span id="v1">bar</span>
5793 </p>
5794 !!end
5795
5796 !!article
5797 Template:paramtest2
5798 !! text
5799 including another template, {{paramtest|param={{{arg}}}}}
5800 !! endarticle
5801
5802 !! test
5803 Template passing argument to another template
5804 !! input
5805 {{paramtest2|arg='hmm'}}
5806 !! result
5807 <p>including another template, This is a test template with parameter 'hmm'
5808 </p>
5809 !! end
5810
5811 !! article
5812 Template:Linktest2
5813 !! text
5814 Main Page
5815 !! endarticle
5816
5817 !! test
5818 Template as link source
5819 !! input
5820 [[{{linktest2}}]]
5821
5822 [[{{linktest2}}|Main Page]]
5823
5824 [[{{linktest2}}]]Page
5825 !! result
5826 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5827 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5828 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
5829 </p>
5830 !! end
5831
5832
5833 !! article
5834 Template:loop1
5835 !! text
5836 {{loop2}}
5837 !! endarticle
5838
5839 !! article
5840 Template:loop2
5841 !! text
5842 {{loop1}}
5843 !! endarticle
5844
5845 !! test
5846 Template infinite loop
5847 !! input
5848 {{loop1}}
5849 !! result
5850 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
5851 </p>
5852 !! end
5853
5854 !! test
5855 Template from main namespace
5856 !! input
5857 {{:Main Page}}
5858 !! result
5859 <p>blah blah
5860 </p>
5861 !! end
5862
5863 !! article
5864 Template:table
5865 !! text
5866 {|
5867 | 1 || 2
5868 |-
5869 | 3 || 4
5870 |}
5871 !! endarticle
5872
5873 !! test
5874 BUG 529: Template with table, not included at beginning of line
5875 !! input
5876 foo {{table}}
5877 !! result
5878 <p>foo
5879 </p>
5880 <table>
5881 <tr>
5882 <td> 1 </td>
5883 <td> 2
5884 </td></tr>
5885 <tr>
5886 <td> 3 </td>
5887 <td> 4
5888 </td></tr></table>
5889
5890 !! end
5891
5892 !! test
5893 BUG 523: Template shouldn't eat newline (or add an extra one before table)
5894 !! input
5895 foo
5896 {{table}}
5897 !! result
5898 <p>foo
5899 </p>
5900 <table>
5901 <tr>
5902 <td> 1 </td>
5903 <td> 2
5904 </td></tr>
5905 <tr>
5906 <td> 3 </td>
5907 <td> 4
5908 </td></tr></table>
5909
5910 !! end
5911
5912 !! test
5913 BUG 41: Template parameters shown as broken links
5914 !! input
5915 {{{parameter}}}
5916 !! result
5917 <p>{{{parameter}}}
5918 </p>
5919 !! end
5920
5921 !! test
5922 Template with targets containing wikilinks
5923 !! input
5924 {{[[foo]]}}
5925
5926 {{[[{{echo|foo}}]]}}
5927
5928 {{{{echo|[[foo}}]]}}
5929 !! result
5930 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5931 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5932 </p><p>{{[[foo}}]]
5933 </p>
5934 !! end
5935
5936 !! article
5937 Template:MSGNW test
5938 !! text
5939 ''None'' of '''this''' should be
5940 * interpreted
5941 but rather passed unmodified
5942 {{test}}
5943 !! endarticle
5944
5945 # hmm, fix this or just deprecate msgnw and document its behavior?
5946 !! test
5947 msgnw keyword
5948 !! options
5949 disabled
5950 !! input
5951 {{msgnw:MSGNW test}}
5952 !! result
5953 <p>''None'' of '''this''' should be
5954 * interpreted
5955 but rather passed unmodified
5956 {{test}}
5957 </p>
5958 !! end
5959
5960 !! test
5961 int keyword
5962 !! input
5963 {{int:youhavenewmessages|lots of money|not!}}
5964 !! result
5965 <p>You have lots of money (not!).
5966 </p>
5967 !! end
5968
5969 !! article
5970 Template:Includes
5971 !! text
5972 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5973 !! endarticle
5974
5975 !! test
5976 <includeonly> and <noinclude> being included
5977 !! input
5978 {{Includes}}
5979 !! result
5980 <p>Foobar
5981 </p>
5982 !! end
5983
5984 !! article
5985 Template:Includes2
5986 !! text
5987 <onlyinclude>Foo</onlyinclude>bar
5988 !! endarticle
5989
5990 !! test
5991 <onlyinclude> being included
5992 !! input
5993 {{Includes2}}
5994 !! result
5995 <p>Foo
5996 </p>
5997 !! end
5998
5999
6000 !! article
6001 Template:Includes3
6002 !! text
6003 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
6004 !! endarticle
6005
6006 !! test
6007 <onlyinclude> and <includeonly> being included
6008 !! input
6009 {{Includes3}}
6010 !! result
6011 <p>Foo
6012 </p>
6013 !! end
6014
6015 !! test
6016 <includeonly> and <noinclude> on a page
6017 !! input
6018 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6019 !! result
6020 <p>Foozar
6021 </p>
6022 !! end
6023
6024 !! test
6025 Un-closed <noinclude>
6026 !! input
6027 <noinclude>
6028 !! result
6029 !! end
6030
6031 !! test
6032 <onlyinclude> on a page
6033 !! input
6034 <onlyinclude>Foo</onlyinclude>bar
6035 !! result
6036 <p>Foobar
6037 </p>
6038 !! end
6039
6040 !! test
6041 Un-closed <onlyinclude>
6042 !! input
6043 <onlyinclude>
6044 !! result
6045 !! end
6046
6047 !!test
6048 Self-closed noinclude, includeonly, onlyinclude tags
6049 !!input
6050 <noinclude />
6051 <includeonly />
6052 <onlyinclude />
6053 !!result
6054 <p><br />
6055 </p>
6056 !!end
6057
6058 !!test
6059 Unbalanced includeonly and noinclude tags
6060 !!input
6061 {|
6062 |a</noinclude>
6063 |b</noinclude></noinclude>
6064 |c</noinclude></includeonly>
6065 |d</includeonly></includeonly>
6066 |}
6067 !!result
6068 <table>
6069 <tr>
6070 <td>a
6071 </td>
6072 <td>b
6073 </td>
6074 <td>c&lt;/includeonly&gt;
6075 </td>
6076 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
6077 </td></tr></table>
6078
6079 !!end
6080
6081 !! article
6082 Template:Includeonly section
6083 !! text
6084 <includeonly>
6085 ==Includeonly section==
6086 </includeonly>
6087 ==Section T-1==
6088 !!endarticle
6089
6090 !! test
6091 Bug 6563: Edit link generation for section shown by <includeonly>
6092 !! input
6093 {{includeonly section}}
6094 !! result
6095 <h2><span class="mw-headline" id="Includeonly_section">Includeonly section</span><span class="mw-editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a>]</span></h2>
6096 <h2><span class="mw-headline" id="Section_T-1">Section T-1</span><span class="mw-editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a>]</span></h2>
6097
6098 !! end
6099
6100 # Uses same input as the contents of [[Template:Includeonly section]]
6101 !! test
6102 Bug 6563: Section extraction for section shown by <includeonly>
6103 !! options
6104 section=T-2
6105 !! input
6106 <includeonly>
6107 ==Includeonly section==
6108 </includeonly>
6109 ==Section T-2==
6110 !! result
6111 ==Section T-2==
6112 !! end
6113
6114 !! test
6115 Bug 6563: Edit link generation for section suppressed by <includeonly>
6116 !! input
6117 <includeonly>
6118 ==Includeonly section==
6119 </includeonly>
6120 ==Section 1==
6121 !! result
6122 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a>]</span></h2>
6123
6124 !! end
6125
6126 !! test
6127 Bug 6563: Section extraction for section suppressed by <includeonly>
6128 !! options
6129 section=1
6130 !! input
6131 <includeonly>
6132 ==Includeonly section==
6133 </includeonly>
6134 ==Section 1==
6135 !! result
6136 ==Section 1==
6137 !! end
6138
6139 !! test
6140 Un-closed <includeonly>
6141 !! input
6142 <includeonly>
6143 !! result
6144 !! end
6145
6146 ###
6147 ### <includeonly> and <noinclude> in attributes
6148 ###
6149 !!test
6150 0. includeonly around the entire attribute
6151 !!input
6152 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
6153 !!result
6154 <p><span id="v2">bar</span>
6155 </p>
6156 !!end
6157
6158 !!test
6159 1. includeonly in html attr key
6160 !!input
6161 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
6162 !!result
6163 <p><span id="foo">bar</span>
6164 </p>
6165 !!end
6166
6167 !!test
6168 2. includeonly in html attr value
6169 !!input
6170 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
6171 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
6172 !!result
6173 <p><span id="v1">bar</span>
6174 <span id="v1">bar</span>
6175 </p>
6176 !!end
6177
6178 !!test
6179 3. includeonly in part of an attr value
6180 !!input
6181 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
6182 !!result
6183 <p><span style="color:red;">bar</span>
6184 </p>
6185 !!end
6186
6187 ###
6188 ### Testing parsing of templates where a template arg
6189 ### has the same name as the template itself.
6190 ###
6191
6192 !! article
6193 Template:quote
6194 !! text
6195 {{{quote|{{{1}}}}}}
6196 !! endarticle
6197
6198 !!test
6199 Templates: Template Name/Arg clash: 1. Use of positional param
6200 !!input
6201 {{quote|foo}}
6202 !!result
6203 <p>foo
6204 </p>
6205 !!end
6206
6207 !!test
6208 Templates: Template Name/Arg clash: 2. Use of named param
6209 !!input
6210 {{quote|quote=foo}}
6211 !!result
6212 <p>foo
6213 </p>
6214 !!end
6215
6216 !!test
6217 Templates: Template Name/Arg clash: 3. Use of named param with empty input
6218 !!input
6219 {{quote|quote}}
6220 !!result
6221 <p>quote
6222 </p>
6223 !!end
6224
6225 ###
6226 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
6227 ###
6228
6229 !!test
6230 Templates: 1. Simple use
6231 !!input
6232 {{echo|Foo}}
6233 !!result
6234 <p>Foo
6235 </p>
6236 !!end
6237
6238 !!test
6239 Templates: 2. Inside a block tag
6240 !!input
6241 <div>{{echo|Foo}}</div>
6242 !!result
6243 <div>Foo</div>
6244
6245 !!end
6246
6247 !!test
6248 Templates: P-wrapping: 1a. Templates on consecutive lines
6249 !!input
6250 {{echo|Foo}}
6251 {{echo|bar}}
6252 !!result
6253 <p>Foo
6254 bar
6255 </p>
6256 !!end
6257
6258 !!test
6259 Templates: P-wrapping: 1b. Templates on consecutive lines
6260 !!input
6261 Foo
6262
6263 {{echo|bar}}
6264 {{echo|baz}}
6265 !!result
6266 <p>Foo
6267 </p><p>bar
6268 baz
6269 </p>
6270 !!end
6271
6272 !!test
6273 Templates: P-wrapping: 1c. Templates on consecutive lines
6274 !!input
6275 {{echo|Foo}}
6276 {{echo|bar}} <div>baz</div>
6277 !!result
6278 <p>Foo
6279 </p>
6280 bar <div>baz</div>
6281
6282 !!end
6283
6284 !!test
6285 Templates: P-wrapping: 1d. Template preceded by comment-only line
6286 !!options
6287 parsoid=wt2html,wt2wt
6288 !!input
6289 <!-- foo -->
6290 {{echo|Bar}}
6291 !!result
6292 <!-- foo -->
6293 <p typeof="mw:Transclusion">Bar
6294 </p>
6295 !!end
6296
6297 !!test
6298 Templates: Inline Text: 1. Multiple tmeplate uses
6299 !!input
6300 {{echo|Foo}}bar{{echo|baz}}
6301 !!result
6302 <p>Foobarbaz
6303 </p>
6304 !!end
6305
6306 !!test
6307 Templates: Inline Text: 2. Back-to-back template uses
6308 !!input
6309 {{echo|Foo}}{{echo|bar}}
6310 !!result
6311 <p>Foobar
6312 </p>
6313 !!end
6314
6315 !!test
6316 Templates: Block Tags: 1. Multiple template uses
6317 !!input
6318 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
6319 !!result
6320 <div>Foo</div><div>bar</div><div>baz</div>
6321
6322 !!end
6323
6324 !!test
6325 Templates: Block Tags: 2. Back-to-back template uses
6326 !!input
6327 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
6328 !!result
6329 <div>Foo</div><div>bar</div>
6330
6331 !!end
6332
6333 !!test
6334 Templates: Links: 1. Simple example
6335 !!input
6336 {{echo|[[Foo|bar]]}}
6337 !!result
6338 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6339 </p>
6340 !!end
6341
6342 !!test
6343 Templates: Links: 2. Generation of link href
6344 !!input
6345 [[{{echo|Foo}}|bar]]
6346 !!result
6347 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6348 </p>
6349 !!end
6350
6351 !!test
6352 Templates: Links: 3. Generation of part of a link href
6353 !!input
6354 [[Fo{{echo|o}}|bar]]
6355
6356 [[Foo{{echo|bar}}]]
6357
6358 [[Foo{{echo|bar}}baz]]
6359
6360 [[Foo{{echo|bar}}|bar]]
6361
6362 [[:Foo{{echo|bar}}]]
6363
6364 [[:Foo{{echo|bar}}|bar]]
6365 !!result
6366 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6367 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6368 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
6369 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6370 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6371 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6372 </p>
6373 !!end
6374
6375 !!test
6376 Templates: Links: 4. Multiple templates generating link href
6377 !!input
6378 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
6379 !!result
6380 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6381 </p>
6382 !!end
6383
6384 !!test
6385 Templates: Links: 5. Generation of link text
6386 !!input
6387 [[Foo|{{echo|bar}}]]
6388 !!result
6389 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6390 </p>
6391 !!end
6392
6393 !!test
6394 Templates: Links: 5. Nested templates (only outermost template should be marked)
6395 !!input
6396 {{echo|[[{{echo|Foo}}|bar]]}}
6397 !!result
6398 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6399 </p>
6400 !!end
6401
6402 !!test
6403 Templates: HTML Tag: 1. Generation of HTML attr. key
6404 !!input
6405 <div {{echo|style}}="color:red;">foo</div>
6406 !!result
6407 <div style="color:red;">foo</div>
6408
6409 !!end
6410
6411 !!test
6412 Templates: HTML Tag: 2. Generation of HTML attr. value
6413 !!input
6414 <div style={{echo|'color:red;'}}>foo</div>
6415 !!result
6416 <div style="color:red;">foo</div>
6417
6418 !!end
6419
6420 !!test
6421 Templates: HTML Tag: 3. Generation of HTML attr key and value
6422 !!input
6423 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
6424 !!result
6425 <div style="color:red;">foo</div>
6426
6427 !!end
6428
6429 !!test
6430 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
6431 !!input
6432 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
6433 !!result
6434 <div title="This is a long title with just one piece templated">foo</div>
6435
6436 !!end
6437
6438 !!test
6439 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
6440 !!input
6441 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
6442 !!result
6443 <div title="This is a long title with just one piece templated">foo</div>
6444
6445 !!end
6446
6447 !!test
6448 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
6449 !!input
6450 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
6451 !!result
6452 <div title="This is a long title with just one piece templated">foo</div>
6453
6454 !!end
6455
6456 !!test
6457 Templates: HTML Tag: 7. Generation of partial attribute key string
6458 !!input
6459 <div st{{echo|yle}}="color:red;">foo</div>
6460 !!result
6461 <div style="color:red;">foo</div>
6462
6463 !!end
6464
6465 !!test
6466 Templates: HTML Tables: 1. Generating start of a HTML table
6467 !!input
6468 {{echo|<table><tr><td>foo</td>}}</tr></table>
6469 !!result
6470 <table><tr><td>foo</td></tr></table>
6471
6472 !!end
6473
6474 !!test
6475 Templates: HTML Tables: 2a. Generating middle of a HTML table
6476 !!input
6477 <table><tr>{{echo|<td>foo</td>}}</tr></table>
6478 !!result
6479 <table><tr><td>foo</td></tr></table>
6480
6481 !!end
6482
6483 !!test
6484 Templates: HTML Tables: 2b. Generating middle of a HTML table
6485 !!input
6486 <table>{{echo|<tr><td>foo</td></tr>}}</table>
6487 !!result
6488 <table><tr><td>foo</td></tr></table>
6489
6490 !!end
6491
6492 !!test
6493 Templates: HTML Tables: 3. Generating end of a HTML table
6494 !!input
6495 <table><tr>{{echo|<td>foo</td></tr></table>}}
6496 !!result
6497 <table><tr><td>foo</td></tr></table>
6498
6499 !!end
6500
6501 !!test
6502 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
6503 !!input
6504 {{echo|<table>}}<tr><td>foo</td></tr></table>
6505 !!result
6506 <table><tr><td>foo</td></tr></table>
6507
6508 !!end
6509
6510 !!test
6511 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
6512 !!input
6513 <table>{{echo|<tr>}}<td>foo</td></tr></table>
6514 !!result
6515 <table><tr><td>foo</td></tr></table>
6516
6517 !!end
6518
6519 !!test
6520 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
6521 !!input
6522 <table><tr>{{echo|<td>}}foo</td></tr></table>
6523 !!result
6524 <table><tr><td>foo</td></tr></table>
6525
6526 !!end
6527
6528 !!test
6529 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
6530 !!input
6531 <table><tr><td>foo{{echo|</td>}}</tr></table>
6532 !!result
6533 <table><tr><td>foo</td></tr></table>
6534
6535 !!end
6536
6537 !!test
6538 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
6539 !!input
6540 <table><tr><td>foo</td>{{echo|</tr>}}</table>
6541 !!result
6542 <table><tr><td>foo</td></tr></table>
6543
6544 !!end
6545
6546 !!test
6547 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
6548 !!input
6549 <table><tr><td>foo</td></tr>{{echo|</table>}}
6550 !!result
6551 <table><tr><td>foo</td></tr></table>
6552
6553 !!end
6554
6555 !!test
6556 Templates: Wiki Tables: 1a. Fostering of entire template content
6557 !!input
6558 {|
6559 {{echo|a}}
6560 |}
6561 !!result
6562 <table>
6563 a
6564 <tr><td></td></tr></table>
6565
6566 !!end
6567
6568 !!test
6569 Templates: Wiki Tables: 1b. Fostering of entire template content
6570 !!input
6571 {|
6572 {{echo|<div>}}
6573 foo
6574 {{echo|</div>}}
6575 |}
6576 !!result
6577 <table>
6578 <div>
6579 <p>foo
6580 </p>
6581 </div>
6582 <tr><td></td></tr></table>
6583
6584 !!end
6585
6586 !!test
6587 Templates: Wiki Tables: 2. Fostering of partial template content
6588 !!input
6589 {|
6590 {{echo|a
6591 <div>b</div>}}
6592 |}
6593 !!result
6594 <table>
6595 a
6596 <div>b</div>
6597 <tr><td></td></tr></table>
6598
6599 !!end
6600
6601 !!test
6602 Templates: Wiki Tables: 3. td-content via multiple templates
6603 !!input
6604 {|
6605 {{echo|{{pipe}}a}}{{echo|b}}
6606 |}
6607 !!result
6608 <table>
6609 <tr>
6610 <td>ab
6611 </td></tr></table>
6612
6613 !!end
6614
6615 !!test
6616 Templates: Wiki Tables: 4. Templated tags, no content
6617 !!input
6618 {{tbl-start}}
6619 {{tbl-end}}
6620 !!result
6621 <table>
6622 <tr><td></td></tr></table>
6623
6624 !!end
6625
6626 !!test
6627 Templates: Wiki Tables: 5. Templated tags, regular td-tags
6628 !!input
6629 {{tbl-start}}
6630 |foo
6631 {{tbl-end}}
6632 !!result
6633 <table>
6634 <tr>
6635 <td>foo
6636 </td></tr></table>
6637
6638 !!end
6639
6640 !!test
6641 Templates: Wiki Tables: 6. Templated tags, templated td-tags
6642 !!input
6643 {{tbl-start}}
6644 {{!}}foo
6645 {{tbl-end}}
6646 !!result
6647 <table>
6648 <tr>
6649 <td>foo
6650 </td></tr></table>
6651
6652 !!end
6653
6654 !!test
6655 Templates: Lists: Multi-line list-items via templates
6656 !!input
6657 *{{echo|a {{nonexistent|
6658 unused}}}}
6659 *{{echo|b {{nonexistent|
6660 unused}}}}
6661 !!result
6662 <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>
6663 </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>
6664 </li></ul>
6665
6666 !!end
6667
6668 !!test
6669 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
6670 !!input
6671 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
6672 !!result
6673 <p><i>ab</i>c<i>d</i>e
6674 </p>
6675 !!end
6676
6677 !!test
6678 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
6679 (PHP parser generates misnested html)
6680 !! options
6681 parsoid=wt2html,wt2wt
6682 !!input
6683 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
6684 !!result
6685 <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>
6686 !!end
6687
6688 !!test
6689 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
6690 (PHP parser generates misnested html)
6691 !! options
6692 parsoid=wt2html,wt2wt
6693 !!input
6694 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
6695 !!result
6696 <div typeof="mw:Transclusion"><i>a</i></div>
6697 <div typeof="mw:Transclusion"><i>b</i>c<i>d</i></div>
6698 <div typeof="mw:Transclusion">e</div>
6699 !!end
6700
6701 !!test
6702 Templates: Ugly nesting: 4. Divs opened/closed across templates
6703 !!input
6704 a<div>b{{echo|c</div>d}}e
6705 !!result
6706 a<div>bc</div>de
6707
6708 !!end
6709
6710 !!test
6711 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
6712 (Parsoid-centric)
6713 !! options
6714 parsoid
6715 !!input
6716 {|
6717 |{{echo|foo</table>}}
6718 |bar
6719 |}
6720 !!result
6721 <table typeof="mw:Transclusion">
6722 <tbody>
6723 <tr>
6724 <td>foo</td></tr></tbody></table><span>bar</span>
6725 !!end
6726
6727 !!test
6728 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
6729 (Parsoid-centric)
6730 !! options
6731 parsoid
6732 !!input
6733 <table>
6734 <tr>
6735 <td>
6736 <table>
6737 <tr>
6738 <td>1. {{echo|foo </table>}}</td>
6739 <td> bar </td>
6740 <td>2. {{echo|baz </table>}}</td>
6741 </tr>
6742 <tr>
6743 <td>abc</td>
6744 </tr>
6745 </table>
6746 </td>
6747 </tr>
6748 <tr>
6749 <td>xyz</td>
6750 </tr>
6751 </table>
6752 !!result
6753 <table about="#mwt1" typeof="mw:Transclusion">
6754 <tbody><tr >
6755 <td >
6756 <table >
6757 <tbody><tr >
6758 <td >1. foo </td></tr></tbody></table></td>
6759 <td > bar </td>
6760 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
6761 </span><span about="#mwt1">
6762
6763 abc</span><span about="#mwt1">
6764 </span><span about="#mwt1">
6765 </span><span about="#mwt1">
6766 </span><span about="#mwt1">
6767 </span><span about="#mwt1">
6768
6769 xyz</span><span about="#mwt1">
6770 </span><span about="#mwt1">
6771 </span>
6772 !!end
6773
6774 !! test
6775 Templates: Ugly templates: 3. newline-only template parameter
6776 !! input
6777 foo {{echo|
6778 }}
6779 !! result
6780 <p>foo
6781 </p>
6782 !! end
6783
6784 # This looks like a bug: a single newline triggers p/br for some reason.
6785 !! test
6786 Templates: Ugly templates: 4. newline-only template parameter inconsistency
6787 !! input
6788 {{echo|
6789 }}
6790 !! result
6791 <p><br />
6792 </p>
6793 !! end
6794
6795
6796 !!test
6797 Parser Functions: 1. Simple example
6798 !!input
6799 {{uc:foo}}
6800 !!result
6801 <p>FOO
6802 </p>
6803 !!end
6804
6805 !!test
6806 Parser Functions: 2. Nested use (only outermost should be marked up)
6807 !!input
6808 {{uc:{{lc:FOO}}}}
6809 !!result
6810 <p>FOO
6811 </p>
6812 !!end
6813
6814 ###
6815 ### Pre-save transform tests
6816 ###
6817 !! test
6818 pre-save transform: subst:
6819 !! options
6820 PST
6821 !! input
6822 {{subst:test}}
6823 !! result
6824 This is a test template
6825 !! end
6826
6827 !! test
6828 pre-save transform: normal template
6829 !! options
6830 PST
6831 !! input
6832 {{test}}
6833 !! result
6834 {{test}}
6835 !! end
6836
6837 !! test
6838 pre-save transform: nonexistent template
6839 !! options
6840 PST
6841 !! input
6842 {{thistemplatedoesnotexist}}
6843 !! result
6844 {{thistemplatedoesnotexist}}
6845 !! end
6846
6847
6848 !! test
6849 pre-save transform: subst magic variables
6850 !! options
6851 PST
6852 !! input
6853 {{subst:SITENAME}}
6854 !! result
6855 MediaWiki
6856 !! end
6857
6858 # This is bug 89, which I fixed. -- wtm
6859 !! test
6860 pre-save transform: subst: templates with parameters
6861 !! options
6862 pst
6863 !! input
6864 {{subst:paramtest|param="something else"}}
6865 !! result
6866 This is a test template with parameter "something else"
6867 !! end
6868
6869 !! article
6870 Template:nowikitest
6871 !! text
6872 <nowiki>'''not wiki'''</nowiki>
6873 !! endarticle
6874
6875 !! test
6876 pre-save transform: nowiki in subst (bug 1188)
6877 !! options
6878 pst
6879 !! input
6880 {{subst:nowikitest}}
6881 !! result
6882 <nowiki>'''not wiki'''</nowiki>
6883 !! end
6884
6885
6886 !! article
6887 Template:commenttest
6888 !! text
6889 This template has <!-- a comment --> in it.
6890 !! endarticle
6891
6892 !! test
6893 pre-save transform: comment in subst (bug 1936)
6894 !! options
6895 pst
6896 !! input
6897 {{subst:commenttest}}
6898 !! result
6899 This template has <!-- a comment --> in it.
6900 !! end
6901
6902 !! test
6903 pre-save transform: unclosed tag
6904 !! options
6905 pst noxml
6906 !! input
6907 <nowiki>'''not wiki'''
6908 !! result
6909 <nowiki>'''not wiki'''
6910 !! end
6911
6912 !! test
6913 pre-save transform: mixed tag case
6914 !! options
6915 pst noxml
6916 !! input
6917 <NOwiki>'''not wiki'''</noWIKI>
6918 !! result
6919 <NOwiki>'''not wiki'''</noWIKI>
6920 !! end
6921
6922 !! test
6923 pre-save transform: unclosed comment in <nowiki>
6924 !! options
6925 pst noxml
6926 !! input
6927 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6928 !! result
6929 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6930 !!end
6931
6932 # Leading @ in this template definition works around a limitation
6933 # in parsoid's parserTests which otherwise strips the <span> from the
6934 # result (confusing it for a template wrapper)
6935 !! article
6936 Template:dangerous
6937 !!text
6938 @<span onmouseover="alert('crap')">Oh no</span>
6939 !!endarticle
6940
6941 !!test
6942 (confirming safety of fix for subst bug 1936)
6943 !! input
6944 {{Template:dangerous}}
6945 !! result
6946 <p>@<span>Oh no</span>
6947 </p>
6948 !! end
6949
6950 !! test
6951 pre-save transform: comment containing gallery (bug 5024)
6952 !! options
6953 pst
6954 !! input
6955 <!-- <gallery>data</gallery> -->
6956 !!result
6957 <!-- <gallery>data</gallery> -->
6958 !!end
6959
6960 !! test
6961 pre-save transform: comment containing extension
6962 !! options
6963 pst
6964 !! input
6965 <!-- <tag>data</tag> -->
6966 !!result
6967 <!-- <tag>data</tag> -->
6968 !!end
6969
6970 !! test
6971 pre-save transform: comment containing nowiki
6972 !! options
6973 pst
6974 !! input
6975 <!-- <nowiki>data</nowiki> -->
6976 !!result
6977 <!-- <nowiki>data</nowiki> -->
6978 !!end
6979
6980 !! test
6981 pre-save transform: <noinclude> in subst (bug 3298)
6982 !! options
6983 pst
6984 !! input
6985 {{subst:Includes}}
6986 !! result
6987 Foobar
6988 !! end
6989
6990 !! test
6991 pre-save transform: <onlyinclude> in subst (bug 3298)
6992 !! options
6993 pst
6994 !! input
6995 {{subst:Includes2}}
6996 !! result
6997 Foo
6998 !! end
6999
7000 !! article
7001 Template:SubstTest
7002 !!text
7003 {{<includeonly>subst:</includeonly>Includes}}
7004 !! endarticle
7005
7006 !! article
7007 Template:SafeSubstTest
7008 !! text
7009 {{<includeonly>safesubst:</includeonly>Includes}}
7010 !! endarticle
7011
7012 !! test
7013 bug 22297: safesubst: works during PST
7014 !! options
7015 pst
7016 !! input
7017 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
7018 !! result
7019 FoobarFoobar
7020 !! end
7021
7022 !! test
7023 bug 22297: safesubst: works during normal parse
7024 !! input
7025 {{SafeSubstTest}}
7026 !! result
7027 <p>Foobar
7028 </p>
7029 !! end
7030
7031 !! test:
7032 subst: does not work during normal parse
7033 !! input
7034 {{SubstTest}}
7035 !! result
7036 <p>{{subst:Includes}}
7037 </p>
7038 !! end
7039
7040 !! test
7041 pre-save transform: context links ("pipe trick")
7042 !! options
7043 pst
7044 !! input
7045 [[Article (context)|]]
7046 [[Bar:Article|]]
7047 [[:Bar:Article|]]
7048 [[Bar:Article (context)|]]
7049 [[:Bar:Article (context)|]]
7050 [[|Article]]
7051 [[|Article (context)]]
7052 [[Bar:X (Y) Z|]]
7053 [[:Bar:X (Y) Z|]]
7054 !! result
7055 [[Article (context)|Article]]
7056 [[Bar:Article|Article]]
7057 [[:Bar:Article|Article]]
7058 [[Bar:Article (context)|Article]]
7059 [[:Bar:Article (context)|Article]]
7060 [[Article]]
7061 [[Article (context)]]
7062 [[Bar:X (Y) Z|X (Y) Z]]
7063 [[:Bar:X (Y) Z|X (Y) Z]]
7064 !! end
7065
7066 !! test
7067 pre-save transform: context links ("pipe trick") with interwiki prefix
7068 !! options
7069 pst
7070 !! input
7071 [[interwiki:Article|]]
7072 [[:interwiki:Article|]]
7073 [[interwiki:Bar:Article|]]
7074 [[:interwiki:Bar:Article|]]
7075 !! result
7076 [[interwiki:Article|Article]]
7077 [[:interwiki:Article|Article]]
7078 [[interwiki:Bar:Article|Bar:Article]]
7079 [[:interwiki:Bar:Article|Bar:Article]]
7080 !! end
7081
7082 !! test
7083 pre-save transform: context links ("pipe trick") with parens in title
7084 !! options
7085 pst title=[[Somearticle (context)]]
7086 !! input
7087 [[|Article]]
7088 !! result
7089 [[Article (context)|Article]]
7090 !! end
7091
7092 !! test
7093 pre-save transform: context links ("pipe trick") with comma in title
7094 !! options
7095 pst title=[[Someplace, Somewhere]]
7096 !! input
7097 [[|Otherplace]]
7098 [[Otherplace, Elsewhere|]]
7099 [[Otherplace, Elsewhere, Anywhere|]]
7100 !! result
7101 [[Otherplace, Somewhere|Otherplace]]
7102 [[Otherplace, Elsewhere|Otherplace]]
7103 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
7104 !! end
7105
7106 !! test
7107 pre-save transform: context links ("pipe trick") with parens and comma
7108 !! options
7109 pst title=[[Someplace (IGNORED), Somewhere]]
7110 !! input
7111 [[|Otherplace]]
7112 [[Otherplace (place), Elsewhere|]]
7113 !! result
7114 [[Otherplace, Somewhere|Otherplace]]
7115 [[Otherplace (place), Elsewhere|Otherplace]]
7116 !! end
7117
7118 !! test
7119 pre-save transform: context links ("pipe trick") with comma and parens
7120 !! options
7121 pst title=[[Who, me? (context)]]
7122 !! input
7123 [[|Yes, you.]]
7124 [[Me, Myself, and I (1937 song)|]]
7125 !! result
7126 [[Yes, you. (context)|Yes, you.]]
7127 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
7128 !! end
7129
7130 !! test
7131 pre-save transform: context links ("pipe trick") with namespace
7132 !! options
7133 pst title=[[Ns:Somearticle]]
7134 !! input
7135 [[|Article]]
7136 !! result
7137 [[Ns:Article|Article]]
7138 !! end
7139
7140 !! test
7141 pre-save transform: context links ("pipe trick") with namespace and parens
7142 !! options
7143 pst title=[[Ns:Somearticle (context)]]
7144 !! input
7145 [[|Article]]
7146 !! result
7147 [[Ns:Article (context)|Article]]
7148 !! end
7149
7150 !! test
7151 pre-save transform: context links ("pipe trick") with namespace and comma
7152 !! options
7153 pst title=[[Ns:Somearticle, Context, Whatever]]
7154 !! input
7155 [[|Article]]
7156 !! result
7157 [[Ns:Article, Context, Whatever|Article]]
7158 !! end
7159
7160 !! test
7161 pre-save transform: context links ("pipe trick") with namespace, comma and parens
7162 !! options
7163 pst title=[[Ns:Somearticle, Context (context)]]
7164 !! input
7165 [[|Article]]
7166 !! result
7167 [[Ns:Article (context)|Article]]
7168 !! end
7169
7170 !! test
7171 pre-save transform: context links ("pipe trick") with namespace, parens and comma
7172 !! options
7173 pst title=[[Ns:Somearticle (IGNORED), Context]]
7174 !! input
7175 [[|Article]]
7176 !! result
7177 [[Ns:Article, Context|Article]]
7178 !! end
7179
7180 !! test
7181 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
7182 !! options
7183 pst
7184 !! input
7185 [[Article(context)|]]
7186 [[Bar:Article(context)|]]
7187 [[:Bar:Article(context)|]]
7188 [[|Article(context)]]
7189 [[Bar:X(Y)Z|]]
7190 [[:Bar:X(Y)Z|]]
7191 !! result
7192 [[Article(context)|Article]]
7193 [[Bar:Article(context)|Article]]
7194 [[:Bar:Article(context)|Article]]
7195 [[Article(context)]]
7196 [[Bar:X(Y)Z|X(Y)Z]]
7197 [[:Bar:X(Y)Z|X(Y)Z]]
7198 !! end
7199
7200 !! test
7201 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
7202 !! options
7203 pst
7204 !! input
7205 [[Article (context)|]]
7206 [[Bar:Article (context)|]]
7207 [[:Bar:Article (context)|]]
7208 [[|Article (context)]]
7209 [[Bar:X (Y) Z|]]
7210 [[:Bar:X (Y) Z|]]
7211 !! result
7212 [[Article (context)|Article]]
7213 [[Bar:Article (context)|Article]]
7214 [[:Bar:Article (context)|Article]]
7215 [[Article (context)]]
7216 [[Bar:X (Y) Z|X (Y) Z]]
7217 [[:Bar:X (Y) Z|X (Y) Z]]
7218 !! end
7219
7220 !! test
7221 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
7222 !! options
7223 pst
7224 !! input
7225 [[Article(context)|]]
7226 [[Bar:Article(context)|]]
7227 [[:Bar:Article(context)|]]
7228 [[|Article(context)]]
7229 [[Bar:X(Y)Z|]]
7230 [[:Bar:X(Y)Z|]]
7231 !! result
7232 [[Article(context)|Article]]
7233 [[Bar:Article(context)|Article]]
7234 [[:Bar:Article(context)|Article]]
7235 [[Article(context)]]
7236 [[Bar:X(Y)Z|X(Y)Z]]
7237 [[:Bar:X(Y)Z|X(Y)Z]]
7238 !! end
7239
7240 !! test
7241 pre-save transform: context links ("pipe trick") with commas (bug 21660)
7242 !! options
7243 pst
7244 !! input
7245 [[Article (context), context|]]
7246 [[Article (context),context|]]
7247 [[Bar:Article (context), context|]]
7248 [[Bar:Article (context),context|]]
7249 [[:Bar:Article (context), context|]]
7250 [[:Bar:Article (context),context|]]
7251 !! result
7252 [[Article (context), context|Article]]
7253 [[Article (context),context|Article]]
7254 [[Bar:Article (context), context|Article]]
7255 [[Bar:Article (context),context|Article]]
7256 [[:Bar:Article (context), context|Article]]
7257 [[:Bar:Article (context),context|Article]]
7258 !! end
7259
7260 !! test
7261 pre-save transform: trim trailing empty lines
7262 !! options
7263 pst
7264 !! input
7265 Empty lines are trimmed
7266
7267
7268
7269
7270 !! result
7271 Empty lines are trimmed
7272 !! end
7273
7274 !! test
7275 pre-save transform: Signature expansion
7276 !! options
7277 pst
7278 !! input
7279 * ~~~
7280 * <noinclude>~~~</noinclude>
7281 * <includeonly>~~~</includeonly>
7282 * <onlyinclude>~~~</onlyinclude>
7283 !! result
7284 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
7285 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
7286 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
7287 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
7288 !! end
7289
7290
7291 !! test
7292 pre-save transform: Signature expansion in nowiki tags (bug 93)
7293 !! options
7294 pst disabled
7295 !! input
7296 Shall not expand:
7297
7298 <nowiki>~~~~</nowiki>
7299
7300 <includeonly><nowiki>~~~~</nowiki></includeonly>
7301
7302 <noinclude><nowiki>~~~~</nowiki></noinclude>
7303
7304 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7305
7306 {{subst:Foo}} shall be converted to FOO
7307
7308 As well as inside noinclude/onlyinclude
7309 <noinclude>{{subst:Foo}}</noinclude>
7310 <onlyinclude>{{subst:Foo}}</onlyinclude>
7311
7312 But not inside includeonly
7313 <includeonly>{{subst:Foo}}</includeonly>
7314 !! result
7315 Shall not expand:
7316
7317 <nowiki>~~~~</nowiki>
7318
7319 <includeonly><nowiki>~~~~</nowiki></includeonly>
7320
7321 <noinclude><nowiki>~~~~</nowiki></noinclude>
7322
7323 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7324
7325 FOO shall be converted to FOO
7326
7327 As well as inside noinclude/onlyinclude
7328 <noinclude>FOO</noinclude>
7329 <onlyinclude>FOO</onlyinclude>
7330
7331 But not inside includeonly
7332 <includeonly>{{subst:Foo}}</includeonly>
7333 !! end
7334
7335 ###
7336 ### Message transform tests
7337 ###
7338 !! test
7339 message transform: magic variables
7340 !! options
7341 msg
7342 !! input
7343 {{SITENAME}}
7344 !! result
7345 MediaWiki
7346 !! end
7347
7348 !! test
7349 message transform: should not transform wiki markup
7350 !! options
7351 msg
7352 !! input
7353 ''test''
7354 !! result
7355 ''test''
7356 !! end
7357
7358 !! test
7359 message transform: <noinclude> in transcluded template (bug 4926)
7360 !! options
7361 msg
7362 !! input
7363 {{Includes}}
7364 !! result
7365 Foobar
7366 !! end
7367
7368 !! test
7369 message transform: <onlyinclude> in transcluded template (bug 4926)
7370 !! options
7371 msg
7372 !! input
7373 {{Includes2}}
7374 !! result
7375 Foo
7376 !! end
7377
7378 !! test
7379 {{#special:}} page name, known
7380 !! options
7381 msg
7382 !! input
7383 {{#special:Recentchanges}}
7384 !! result
7385 Special:RecentChanges
7386 !! end
7387
7388 !! test
7389 {{#special:}} page name with subpage, known
7390 !! options
7391 msg
7392 !! input
7393 {{#special:Recentchanges/param}}
7394 !! result
7395 Special:RecentChanges/param
7396 !! end
7397
7398 !! test
7399 {{#special:}} page name, unknown
7400 !! options
7401 msg
7402 !! input
7403 {{#special:foobarnonexistent}}
7404 !! result
7405 No such special page
7406 !! end
7407
7408 !! test
7409 {{#speciale:}} page name, known
7410 !! options
7411 msg
7412 !! input
7413 {{#speciale:Recentchanges}}
7414 !! result
7415 Special:RecentChanges
7416 !! end
7417
7418 !! test
7419 {{#speciale:}} page name with subpage, known
7420 !! options
7421 msg
7422 !! input
7423 {{#speciale:Recentchanges/param}}
7424 !! result
7425 Special:RecentChanges/param
7426 !! end
7427
7428 !! test
7429 {{#speciale:}} page name, unknown
7430 !! options
7431 msg
7432 !! input
7433 {{#speciale:foobarnonexistent}}
7434 !! result
7435 No_such_special_page
7436 !! end
7437
7438 ###
7439 ### Images
7440 ###
7441 !! test
7442 Simple image
7443 !! input
7444 [[Image:foobar.jpg]]
7445 !! result
7446 <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>
7447 </p>
7448 !! end
7449
7450 !! test
7451 Right-aligned image
7452 !! input
7453 [[Image:foobar.jpg|right]]
7454 !! result
7455 <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>
7456
7457 !! end
7458
7459 !! test
7460 Simple image (using File: namespace, now canonical)
7461 !! input
7462 [[File:foobar.jpg]]
7463 !! result
7464 <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>
7465 </p>
7466 !! end
7467
7468 !! test
7469 Image with caption
7470 !! input
7471 [[Image:foobar.jpg|right|Caption text]]
7472 !! result
7473 <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>
7474
7475 !! end
7476
7477 !! test
7478 Image with empty attribute
7479 !! input
7480 [[Image:foobar.jpg|right||Caption text]]
7481 !! result
7482 <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>
7483
7484 !! end
7485
7486 !! test
7487 Image with link tails
7488 !! input
7489 123[[Image:foobar.jpg]]456
7490 123[[Image:foobar.jpg|right]]456
7491 123[[Image:foobar.jpg|thumb]]456
7492 !! result
7493 <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
7494 </p>
7495 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
7496 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
7497
7498 !! end
7499
7500 !! test
7501 Image with multiple captions -- only last one is accepted
7502 !! input
7503 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
7504 !! result
7505 <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>
7506
7507 !! end
7508
7509 !! test
7510 Image with width attribute at different positions
7511 !! input
7512 [[Image:foobar.jpg|200px|right|Caption]]
7513 [[Image:foobar.jpg|right|200px|Caption]]
7514 [[Image:foobar.jpg|right|Caption|200px]]
7515 !! result
7516 <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>
7517 <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>
7518 <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>
7519
7520 !! end
7521
7522 !! test
7523 Image with link parameter, wiki target
7524 !! input
7525 [[Image:foobar.jpg|link=Target page]]
7526 !! result
7527 <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>
7528 </p>
7529 !! end
7530
7531 !! test
7532 Image with link parameter, URL target
7533 !! input
7534 [[Image:foobar.jpg|link=http://example.com/]]
7535 !! result
7536 <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>
7537 </p>
7538 !! end
7539
7540 !! test
7541 Image with link parameter, wgExternalLinkTarget
7542 !! input
7543 [[Image:foobar.jpg|link=http://example.com/]]
7544 !! config
7545 wgExternalLinkTarget='foobar'
7546 !! result
7547 <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>
7548 </p>
7549 !! end
7550
7551 !! test
7552 Image with link parameter, wgNoFollowLinks set to false
7553 !! input
7554 [[Image:foobar.jpg|link=http://example.com/]]
7555 !! config
7556 wgNoFollowLinks=false
7557 !! result
7558 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7559 </p>
7560 !! end
7561
7562 !! test
7563 Image with link parameter, wgNoFollowDomainExceptions
7564 !! input
7565 [[Image:foobar.jpg|link=http://example.com/]]
7566 !! config
7567 wgNoFollowDomainExceptions='example.com'
7568 !! result
7569 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7570 </p>
7571 !! end
7572
7573 !! test
7574 Image with link parameter, wgExternalLinkTarget, unnamed parameter
7575 !! input
7576 [[Image:foobar.jpg|link=http://example.com/|Title]]
7577 !! config
7578 wgExternalLinkTarget='foobar'
7579 !! result
7580 <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>
7581 </p>
7582 !! end
7583
7584 !! test
7585 Image with empty link parameter
7586 !! input
7587 [[Image:foobar.jpg|link=]]
7588 !! result
7589 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
7590 </p>
7591 !! end
7592
7593 !! test
7594 Image with link parameter (wiki target) and unnamed parameter
7595 !! input
7596 [[Image:foobar.jpg|link=Target page|Title]]
7597 !! result
7598 <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>
7599 </p>
7600 !! end
7601
7602 !! test
7603 Image with link parameter (URL target) and unnamed parameter
7604 !! input
7605 [[Image:foobar.jpg|link=http://example.com/|Title]]
7606 !! result
7607 <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>
7608 </p>
7609 !! end
7610
7611 !! test
7612 Thumbnail image with link parameter
7613 !! options
7614 php
7615 !! input
7616 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
7617 !! result
7618 <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>
7619
7620 !! end
7621
7622 !! test
7623 Manually-specified thumbnail image
7624 !! options
7625 php
7626 !! input
7627 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
7628 !! result
7629 <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>
7630
7631 !! end
7632
7633 !! test
7634 Manually-specified thumbnail image with explicit link to wiki page
7635 !! options
7636 php
7637 !! input
7638 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
7639 !! result
7640 <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>
7641
7642 !! end
7643
7644 !! test
7645 Manually-specified thumbnail image with explicit link to url
7646 !! options
7647 php
7648 !! input
7649 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
7650 !! result
7651 <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>
7652
7653 !! end
7654
7655 !! test
7656 Manually-specified thumbnail image with explicit no link
7657 !! options
7658 php
7659 !! input
7660 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
7661 !! result
7662 <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>
7663
7664 !! end
7665
7666 !! test
7667 Manually-specified thumbnail image with explicit link and alt text
7668 !! options
7669 php
7670 !! input
7671 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
7672 !! result
7673 <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>
7674
7675 !! end
7676
7677 !! test
7678 Image with frame and link
7679 !! input
7680 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
7681 !! result
7682 <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>
7683
7684 !! end
7685
7686 !! test
7687 Image with frame and link and explicit alt
7688 !! input
7689 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
7690 !! result
7691 <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>
7692
7693 !! end
7694
7695 !! test
7696 Image with wiki markup in implicit alt
7697 !! input
7698 [[Image:Foobar.jpg|testing '''bold''' in alt]]
7699 !! result
7700 <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>
7701 </p>
7702 !! end
7703
7704 !! test
7705 Image with wiki markup in explicit alt
7706 !! input
7707 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
7708 !! result
7709 <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>
7710 </p>
7711 !! end
7712
7713 !! test
7714 Link to image page- image page normally doesn't exists, hence edit link
7715 Add test with existing image page
7716 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
7717 !! input
7718 [[:Image:test]]
7719 !! result
7720 <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>
7721 </p>
7722 !! end
7723
7724 !! test
7725 bug 18784 Link to non-existent image page with caption should use caption as link text
7726 !! input
7727 [[:Image:test|caption]]
7728 !! result
7729 <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>
7730 </p>
7731 !! end
7732
7733 !! test
7734 Frameless image caption with a free URL
7735 !! input
7736 [[Image:foobar.jpg|http://example.com]]
7737 !! result
7738 <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>
7739 </p>
7740 !! end
7741
7742 !! test
7743 Thumbnail image caption with a free URL
7744 !! input
7745 [[Image:foobar.jpg|thumb|http://example.com]]
7746 !! result
7747 <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>
7748
7749 !! end
7750
7751 !! test
7752 Thumbnail image caption with a free URL and explicit alt
7753 !! input
7754 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
7755 !! result
7756 <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>
7757
7758 !! end
7759
7760
7761 !! test
7762 SVG thumbnails with no language set
7763 !! options
7764 !! input
7765 [[File:Foobar.svg|thumb|width=200]]
7766 !! result
7767 <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>
7768
7769 !! end
7770
7771 !! test
7772 SVG thumbnails with language de
7773 !! options
7774 !! input
7775 [[File:Foobar.svg|thumb|width=200|lang=de]]
7776 !! result
7777 <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>
7778
7779 !! end
7780
7781 !! test
7782 SVG thumbnails with invalid language code
7783 !! options
7784 !! input
7785 [[File:Foobar.svg|thumb|width=200|lang=invalid.language.code]]
7786 !! result
7787 <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>
7788
7789 !! end
7790
7791 !! test
7792 BUG 1887: A ISBN with a thumbnail
7793 !! input
7794 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
7795 !! result
7796 <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>
7797
7798 !! end
7799
7800 !! test
7801 BUG 1887: A RFC with a thumbnail
7802 !! input
7803 [[Image:foobar.jpg|thumb|This is RFC 12354]]
7804 !! result
7805 <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>
7806
7807 !! end
7808
7809 !! test
7810 BUG 1887: A mailto link with a thumbnail
7811 !! input
7812 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
7813 !! result
7814 <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>
7815
7816 !! end
7817
7818 # Pending resolution to bug 368
7819 !! test
7820 BUG 648: Frameless image caption with a link
7821 !! input
7822 [[Image:foobar.jpg|text with a [[link]] in it]]
7823 !! result
7824 <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>
7825 </p>
7826 !! end
7827
7828 !! test
7829 BUG 648: Frameless image caption with a link (suffix)
7830 !! input
7831 [[Image:foobar.jpg|text with a [[link]]foo in it]]
7832 !! result
7833 <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>
7834 </p>
7835 !! end
7836
7837 !! test
7838 BUG 648: Frameless image caption with an interwiki link
7839 !! input
7840 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
7841 !! result
7842 <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>
7843 </p>
7844 !! end
7845
7846 !! test
7847 BUG 648: Frameless image caption with a piped interwiki link
7848 !! input
7849 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
7850 !! result
7851 <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>
7852 </p>
7853 !! end
7854
7855 !! test
7856 Escape HTML special chars in image alt text
7857 !! input
7858 [[Image:foobar.jpg|& < > "]]
7859 !! result
7860 <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>
7861 </p>
7862 !! end
7863
7864 !! test
7865 BUG 499: Alt text should have &#1234;, not &amp;1234;
7866 !! input
7867 [[Image:foobar.jpg|&#9792;]]
7868 !! result
7869 <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>
7870 </p>
7871 !! end
7872
7873 !! test
7874 Broken image caption with link
7875 !! input
7876 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
7877 !! result
7878 <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.
7879 </p>
7880 !! end
7881
7882 !! test
7883 Image caption containing another image
7884 !! input
7885 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
7886 !! result
7887 <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>
7888
7889 !! end
7890
7891 !! test
7892 Image caption containing a newline
7893 !! input
7894 [[Image:Foobar.jpg|This
7895 *is some text]]
7896 !! result
7897 <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>
7898 </p>
7899 !!end
7900
7901 !!test
7902 Parsoid: Image caption containing leading space
7903 (The leading space should not trigger nowiki escaping in wt2wt mode)
7904 !! input
7905 [[Image:Foobar.jpg|thumb| bar]]
7906 !! result
7907 <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>
7908
7909 !!end
7910
7911 !! test
7912 Bug 3090: External links other than http: in image captions
7913 !! input
7914 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
7915 !! result
7916 <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>
7917
7918 !! end
7919
7920 !! test
7921 Custom class
7922 !! input
7923 [[Image:foobar.jpg|a|class=b]]
7924 !! result
7925 <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>
7926 </p>
7927 !! end
7928
7929 !! test
7930 Localized image handling (1).
7931 !! options
7932 language=es
7933 !! input
7934 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
7935 !! result
7936 <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>
7937
7938 !! end
7939
7940 !! test
7941 Localized image handling (2).
7942 !! options
7943 language=es
7944 !! input
7945 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
7946 !! result
7947 <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>
7948
7949 !! end
7950
7951 !! test
7952 "border", "frameless" and "class" attributes on an image.
7953 !! input
7954 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
7955 !! result
7956 <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>
7957 </p>
7958 !! end
7959
7960 !! article
7961 File:Barfoo.jpg
7962 !! text
7963 #REDIRECT [[File:Barfoo.jpg]]
7964 !! endarticle
7965
7966 !! test
7967 Redirected image
7968 !! input
7969 [[Image:Barfoo.jpg]]
7970 !! result
7971 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
7972 </p>
7973 !! end
7974
7975 !! test
7976 Missing image with uploads disabled
7977 !! options
7978 wgEnableUploads=0
7979 !! input
7980 [[Image:Foobaz.jpg]]
7981 !! result
7982 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
7983 </p>
7984 !! end
7985
7986 # Parsoid-specific testing for images
7987 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
7988 # Currently imperfect due to a flaw in the Parsoid testrunner
7989 # Work in progress
7990
7991 !! test
7992 Parsoid-specific image handling - simple image
7993 !! options
7994 parsoid
7995 !! input
7996 [[Image:Foobar.jpg]]
7997 !! result
7998 <p>
7999 <span class="mw-default-size" typeof="mw:Image">
8000 <a href="File:Foobar.jpg">
8001 <img resource="./File:Foobar.jpg" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8002 </a>
8003 </span>
8004 </p>
8005 !! end
8006
8007 !! test
8008 Parsoid-specific image handling - simple image without link
8009 !! options
8010 parsoid
8011 !! input
8012 [[Image:Foobar.jpg|link=]]
8013 !! result
8014 <p>
8015 <span class="mw-default-size" typeof="mw:Image">
8016 <span>
8017 <img resource="./File:Foobar.jpg" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8018 </span>
8019 </span>
8020 </p>
8021 !! end
8022
8023 !! test
8024 Parsoid-specific image handling - simple image with specific link
8025 !! options
8026 parsoid
8027 !! input
8028 [[Image:Foobar.jpg|link=Main Page]]
8029 !! result
8030 <p>
8031 <span class="mw-default-size" typeof="mw:Image">
8032 <a href="Main_Page">
8033 <img resource="./File:Foobar.jpg" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8034 </a>
8035 </span>
8036 </p>
8037 !! end
8038
8039 !! test
8040 Parsoid-specific image handling - simple image with size and middle alignment
8041 !! options
8042 parsoid
8043 !! input
8044 [[Image:Foobar.jpg|50px|middle]]
8045 !! result
8046 <p>
8047 <span class="mw-valign-middle" typeof="mw:Image">
8048 <a href="File:Foobar.jpg">
8049 <img resource="./File:Foobar.jpg" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8050 </a>
8051 </span>
8052 </p>
8053 !! end
8054
8055 !! test
8056 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
8057 !! options
8058 parsoid
8059 !! input
8060 [[Image:Foobar.jpg|500x10px|baseline|caption]]
8061 !! result
8062 <p>
8063 <span class="mw-valign-baseline" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8064 <a href="File:Foobar.jpg">
8065 <img resource="./File:Foobar.jpg" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89">
8066 </a>
8067 </span>
8068 </p>
8069 !! end
8070
8071 !! test
8072 Parsoid-specific image handling - simple image with border and size spec
8073 !! options
8074 parsoid
8075 !! input
8076 [[Image:Foobar.jpg|50px|border|caption]]
8077 !! result
8078 <p>
8079 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8080 <a href="File:Foobar.jpg">
8081 <img resource="./File:Foobar.jpg" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8082 </a>
8083 </span>
8084 </p>
8085 !! end
8086
8087 !! test
8088 Parsoid-specific image handling - thumbnail with halign, valign, and caption
8089 !! options
8090 parsoid
8091 !! input
8092 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
8093 !! result
8094 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
8095 <a href="File:Foobar.jpg">
8096 <img resource="./File:Foobar.jpg" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/180px-Foobar.jpg" height="21" width="180" />
8097 </a>
8098 <figcaption class="mw-figcaption">caption content</figcaption>
8099 </figure>
8100 !! end
8101
8102 !! test
8103 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
8104 !! options
8105 parsoid
8106 !! input
8107 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
8108 !! result
8109 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
8110 <a href="File:Foobar.jpg">
8111 <img resource="./File:Foobar.jpg" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
8112 </a>
8113 <figcaption class="mw-figcaption">caption</figcaption>
8114 </figure>
8115 !! end
8116
8117 !! test
8118 Parsoid-specific image handling - framed image with specific size and caption
8119 !! options
8120 parsoid
8121 !! input
8122 [[Image:Foobar.jpg|500x50px|frame|caption]]
8123 !! result
8124 <figure typeof="mw:Image/Frame">
8125 <a href="File:Foobar.jpg">
8126 <img resource="./File:Foobar.jpg" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8127 </a>
8128 <figcaption class="mw-figcaption">caption</figcaption>
8129 </figure>
8130 !! end
8131
8132 !! test
8133 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
8134 !! options
8135 parsoid
8136 !! input
8137 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
8138 !! result
8139 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
8140 <a href="File:Foobar.jpg">
8141 <img resource="./File:Foobar.jpg" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8142 </a>
8143 <figcaption class="mw-figcaption">caption</figcaption>
8144 </figure>
8145 !! end
8146
8147 !! test
8148 Parsoid-specific image handling - frameless image with specific size, border, and caption
8149 !! options
8150 parsoid
8151 !! input
8152 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
8153 !! result
8154 <p>
8155 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8156 <a href="File:Foobar.jpg">
8157 <img resource="./File:Foobar.jpg" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8158 </a>
8159 </p>
8160 !! end
8161
8162 #!! test
8163 #Parsoid-specific image handling - simple image with a formatted caption
8164 #!! options
8165 #parsoid
8166 #!! input
8167 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
8168 #!! result
8169 #<p>
8170 #<span typeof="mw:Image">
8171 #<a class="mw-default-size" href="Image:Foobar.jpg">
8172 #<img alt="Foobar.jpg" class="mw-default-size" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8173 #</a>
8174 #<span>abc</span>
8175 #</span>
8176 #</p>
8177
8178
8179 ###
8180 ### Subpages
8181 ###
8182 !! article
8183 Subpage test/subpage
8184 !! text
8185 foo
8186 !! endarticle
8187
8188 !! test
8189 Subpage link
8190 !! options
8191 subpage title=[[Subpage test]]
8192 !! input
8193 [[/subpage]]
8194 !! result
8195 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
8196 </p>
8197 !! end
8198
8199 !! test
8200 Subpage noslash link
8201 !! options
8202 subpage title=[[Subpage test]]
8203 !!input
8204 [[/subpage/]]
8205 !! result
8206 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
8207 </p>
8208 !! end
8209
8210 !! test
8211 Disabled subpages
8212 !! input
8213 [[/subpage]]
8214 !! result
8215 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
8216 </p>
8217 !! end
8218
8219 !! test
8220 BUG 561: {{/Subpage}}
8221 !! options
8222 subpage title=[[Page]]
8223 !! input
8224 {{/Subpage}}
8225 !! result
8226 <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>
8227 </p>
8228 !! end
8229
8230 ###
8231 ### Categories
8232 ###
8233 !! article
8234 Category:MediaWiki User's Guide
8235 !! text
8236 blah
8237 !! endarticle
8238
8239 !! test
8240 Link to category
8241 !! input
8242 [[:Category:MediaWiki User's Guide]]
8243 !! result
8244 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
8245 </p>
8246 !! end
8247
8248 !! test
8249 Simple category
8250 !! options
8251 cat
8252 !! input
8253 [[Category:MediaWiki User's Guide]]
8254 !! result
8255 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8256 !! end
8257
8258 !! test
8259 PAGESINCATEGORY invalid title fatal (r33546 fix)
8260 !! input
8261 {{PAGESINCATEGORY:<bogus>}}
8262 !! result
8263 <p>0
8264 </p>
8265 !! end
8266
8267 !! test
8268 Category with different sort key
8269 !! options
8270 cat
8271 !! input
8272 [[Category:MediaWiki User's Guide|Foo]]
8273 !! result
8274 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8275 !! end
8276
8277 !! test
8278 Category with identical sort key
8279 !! options
8280 cat
8281 !! input
8282 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8283 !! result
8284 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8285 !! end
8286
8287 !! test
8288 Category with empty sort key
8289 !! options
8290 cat
8291 pst
8292 !! input
8293 [[Category:MediaWiki User's Guide|]]
8294 !! result
8295 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8296 !! end
8297
8298 !! test
8299 Category with empty sort key and parentheses
8300 !! options
8301 cat
8302 pst
8303 !! input
8304 [[Category:Foo (bar)|]]
8305 !! result
8306 [[Category:Foo (bar)|Foo]]
8307 !! end
8308
8309 !! test
8310 Category with link tail
8311 !! options
8312 cat
8313 pst
8314 !! input
8315 123[[Category:Foo]]456
8316 !! result
8317 123[[Category:Foo]]456
8318 !! end
8319
8320 !! test
8321 Category with template
8322 !! options
8323 cat
8324 pst
8325 !! input
8326 [[Category:{{echo|Foo}}]]
8327 !! result
8328 [[Category:{{echo|Foo}}]]
8329 !! end
8330
8331 !! test
8332 Category with template in sort key
8333 !! options
8334 cat
8335 pst
8336 !! input
8337 [[Category:Foo|{{echo|Bar}}]]
8338 !! result
8339 [[Category:Foo|{{echo|Bar}}]]
8340 !! end
8341
8342 !! test
8343 Category with template in sort key and title
8344 !! options
8345 cat
8346 pst
8347 !! input
8348 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8349 !! result
8350 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8351 !! end
8352
8353 !! test
8354 Category / paragraph interactions
8355 !! input
8356 Foo [[Category:Baz]] Bar
8357
8358 Foo [[Category:Baz]]
8359 Bar
8360
8361 Foo
8362 [[Category:Baz]]
8363 Bar
8364
8365 Foo
8366 [[Category:Baz]] Bar
8367
8368 Foo
8369 [[Category:Baz]]
8370 [[Category:Baz]]
8371 [[Category:Baz]]
8372 Bar
8373
8374 [[Category:Baz]]
8375 [[Category:Baz]]
8376 [[Category:Baz]]
8377
8378 [[Category:Baz]]
8379 {{echo|[[Category:Baz]]}}
8380 [[Category:Baz]]
8381 !! result
8382 <p>Foo Bar
8383 </p><p>Foo
8384 Bar
8385 </p><p>Foo
8386 Bar
8387 </p><p>Foo Bar
8388 </p><p>Foo
8389 Bar
8390 </p>
8391 !! end
8392
8393 ###
8394 ### Inter-language links
8395 ###
8396 !! test
8397 Inter-language links
8398 !! options
8399 ill
8400 !! input
8401 [[es:Alimento]]
8402 [[fr:Nourriture]]
8403 [[zh:&#39135;&#21697;]]
8404 !! result
8405 es:Alimento fr:Nourriture zh:食品
8406 !! end
8407
8408 !! test
8409 Duplicate interlanguage links (bug 24502)
8410 !! options
8411 ill
8412 !! input
8413 [[es:1]]
8414 [[es:2]]
8415 [[fr:1]]
8416 [[fr:2]]
8417 !! result
8418 es:1 fr:1
8419 !! end
8420
8421 ###
8422 ### Sections
8423 ###
8424 !! test
8425 Basic section headings
8426 !! input
8427 == Headline 1 ==
8428 Some text
8429
8430 ==Headline 2==
8431 More
8432 ===Smaller headline===
8433 Blah blah
8434 !! result
8435 <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span></h2>
8436 <p>Some text
8437 </p>
8438 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline 2">edit</a>]</span></h2>
8439 <p>More
8440 </p>
8441 <h3><span class="mw-headline" id="Smaller_headline">Smaller headline</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Smaller headline">edit</a>]</span></h3>
8442 <p>Blah blah
8443 </p>
8444 !! end
8445
8446 !! test
8447 Section headings with TOC
8448 !! input
8449 == Headline 1 ==
8450 === Subheadline 1 ===
8451 ===== Skipping a level =====
8452 ====== Skipping a level ======
8453
8454 == Headline 2 ==
8455 Some text
8456 ===Another headline===
8457 !! result
8458 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8459 <ul>
8460 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
8461 <ul>
8462 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
8463 <ul>
8464 <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>
8465 <ul>
8466 <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>
8467 </ul>
8468 </li>
8469 </ul>
8470 </li>
8471 </ul>
8472 </li>
8473 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
8474 <ul>
8475 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
8476 </ul>
8477 </li>
8478 </ul>
8479 </td></tr></table>
8480 <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span></h2>
8481 <h3><span class="mw-headline" id="Subheadline_1">Subheadline 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a>]</span></h3>
8482 <h5><span class="mw-headline" id="Skipping_a_level">Skipping a level</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a>]</span></h5>
8483 <h6><span class="mw-headline" id="Skipping_a_level_2">Skipping a level</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Skipping a level">edit</a>]</span></h6>
8484 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a>]</span></h2>
8485 <p>Some text
8486 </p>
8487 <h3><span class="mw-headline" id="Another_headline">Another headline</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Another headline">edit</a>]</span></h3>
8488
8489 !! end
8490
8491 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
8492 !! test
8493 Handling of sections up to level 6 and beyond
8494 !! input
8495 = Level 1 Heading=
8496 == Level 2 Heading==
8497 === Level 3 Heading===
8498 ==== Level 4 Heading====
8499 ===== Level 5 Heading=====
8500 ====== Level 6 Heading======
8501 ======= Level 7 Heading=======
8502 ======== Level 8 Heading========
8503 ========= Level 9 Heading=========
8504 ========== Level 10 Heading==========
8505 !! result
8506 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8507 <ul>
8508 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
8509 <ul>
8510 <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>
8511 <ul>
8512 <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>
8513 <ul>
8514 <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>
8515 <ul>
8516 <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>
8517 <ul>
8518 <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>
8519 <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>
8520 <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>
8521 <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>
8522 <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>
8523 </ul>
8524 </li>
8525 </ul>
8526 </li>
8527 </ul>
8528 </li>
8529 </ul>
8530 </li>
8531 </ul>
8532 </li>
8533 </ul>
8534 </td></tr></table>
8535 <h1><span class="mw-headline" id="Level_1_Heading">Level 1 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a>]</span></h1>
8536 <h2><span class="mw-headline" id="Level_2_Heading">Level 2 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a>]</span></h2>
8537 <h3><span class="mw-headline" id="Level_3_Heading">Level 3 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a>]</span></h3>
8538 <h4><span class="mw-headline" id="Level_4_Heading">Level 4 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a>]</span></h4>
8539 <h5><span class="mw-headline" id="Level_5_Heading">Level 5 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a>]</span></h5>
8540 <h6><span class="mw-headline" id="Level_6_Heading">Level 6 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a>]</span></h6>
8541 <h6><span class="mw-headline" id=".3D_Level_7_Heading.3D">= Level 7 Heading=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: = Level 7 Heading=">edit</a>]</span></h6>
8542 <h6><span class="mw-headline" id=".3D.3D_Level_8_Heading.3D.3D">== Level 8 Heading==</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: == Level 8 Heading==">edit</a>]</span></h6>
8543 <h6><span class="mw-headline" id=".3D.3D.3D_Level_9_Heading.3D.3D.3D">=== Level 9 Heading===</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: === Level 9 Heading===">edit</a>]</span></h6>
8544 <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">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ==== Level 10 Heading====">edit</a>]</span></h6>
8545
8546 !! end
8547
8548 !! test
8549 TOC regression (bug 9764)
8550 !! input
8551 == title 1 ==
8552 === title 1.1 ===
8553 ==== title 1.1.1 ====
8554 === title 1.2 ===
8555 == title 2 ==
8556 === title 2.1 ===
8557 !! result
8558 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8559 <ul>
8560 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8561 <ul>
8562 <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>
8563 <ul>
8564 <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>
8565 </ul>
8566 </li>
8567 <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>
8568 </ul>
8569 </li>
8570 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8571 <ul>
8572 <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>
8573 </ul>
8574 </li>
8575 </ul>
8576 </td></tr></table>
8577 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span></h2>
8578 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span></h3>
8579 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span></h4>
8580 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span></h3>
8581 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span></h2>
8582 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span></h3>
8583
8584 !! end
8585
8586 !! test
8587 TOC with wgMaxTocLevel=3 (bug 6204)
8588 !! options
8589 wgMaxTocLevel=3
8590 !! input
8591 == title 1 ==
8592 === title 1.1 ===
8593 ==== title 1.1.1 ====
8594 === title 1.2 ===
8595 == title 2 ==
8596 === title 2.1 ===
8597 !! result
8598 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8599 <ul>
8600 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8601 <ul>
8602 <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>
8603 <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>
8604 </ul>
8605 </li>
8606 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8607 <ul>
8608 <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>
8609 </ul>
8610 </li>
8611 </ul>
8612 </td></tr></table>
8613 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span></h2>
8614 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span></h3>
8615 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span></h4>
8616 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span></h3>
8617 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span></h2>
8618 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span></h3>
8619
8620 !! end
8621
8622 !! test
8623 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
8624 !! options
8625 wgMaxTocLevel=3
8626 !! input
8627 ==Section 1==
8628 ===Section 1.1===
8629 ====Section 1.1.1====
8630 ====Section 1.1.1.1====
8631 ==Section 2==
8632 !! result
8633 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8634 <ul>
8635 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
8636 <ul>
8637 <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>
8638 </ul>
8639 </li>
8640 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
8641 </ul>
8642 </td></tr></table>
8643 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a>]</span></h2>
8644 <h3><span class="mw-headline" id="Section_1.1">Section 1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 1.1">edit</a>]</span></h3>
8645 <h4><span class="mw-headline" id="Section_1.1.1">Section 1.1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Section 1.1.1">edit</a>]</span></h4>
8646 <h4><span class="mw-headline" id="Section_1.1.1.1">Section 1.1.1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Section 1.1.1.1">edit</a>]</span></h4>
8647 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Section 2">edit</a>]</span></h2>
8648
8649 !! end
8650
8651
8652 !! test
8653 Resolving duplicate section names
8654 !! input
8655 == Foo bar ==
8656 == Foo bar ==
8657 !! result
8658 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span></h2>
8659 <h2><span class="mw-headline" id="Foo_bar_2">Foo bar</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo bar">edit</a>]</span></h2>
8660
8661 !! end
8662
8663 !! test
8664 Resolving duplicate section names with differing case (bug 10721)
8665 !! input
8666 == Foo bar ==
8667 == Foo Bar ==
8668 !! result
8669 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span></h2>
8670 <h2><span class="mw-headline" id="Foo_Bar_2">Foo Bar</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a>]</span></h2>
8671
8672 !! end
8673
8674 !! article
8675 Template:sections
8676 !! text
8677 ===Section 1===
8678 ==Section 2==
8679 !! endarticle
8680
8681 !! test
8682 Template with sections, __NOTOC__
8683 !! input
8684 __NOTOC__
8685 ==Section 0==
8686 {{sections}}
8687 ==Section 4==
8688 !! result
8689 <h2><span class="mw-headline" id="Section_0">Section 0</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 0">edit</a>]</span></h2>
8690 <h3><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-1" title="Template:Sections">edit</a>]</span></h3>
8691 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-2" title="Template:Sections">edit</a>]</span></h2>
8692 <h2><span class="mw-headline" id="Section_4">Section 4</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 4">edit</a>]</span></h2>
8693
8694 !! end
8695
8696 !! test
8697 __NOEDITSECTION__ keyword
8698 !! input
8699 __NOEDITSECTION__
8700 ==Section 1==
8701 ==Section 2==
8702 !! result
8703 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
8704 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
8705
8706 !! end
8707
8708 !! test
8709 Link inside a section heading
8710 !! input
8711 ==Section with a [[Main Page|link]] in it==
8712 !! result
8713 <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">[<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></h2>
8714
8715 !! end
8716
8717 !! test
8718 TOC regression (bug 12077)
8719 !! input
8720 __TOC__
8721 == title 1 ==
8722 === title 1.1 ===
8723 == title 2 ==
8724 !! result
8725 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8726 <ul>
8727 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8728 <ul>
8729 <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>
8730 </ul>
8731 </li>
8732 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
8733 </ul>
8734 </td></tr></table>
8735 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span></h2>
8736 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span></h3>
8737 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 2">edit</a>]</span></h2>
8738
8739 !! end
8740
8741 !! test
8742 BUG 1219 URL next to image (good)
8743 !! input
8744 http://example.com [[Image:foobar.jpg]]
8745 !! result
8746 <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>
8747 </p>
8748 !!end
8749
8750 !! test
8751 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
8752 !! input
8753 ===
8754 The line above must have a trailing space!
8755 === <!--
8756 --> <!-- -->
8757 But just in case it doesn't...
8758 !! result
8759 <h1><span class="mw-headline" id=".3D">=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: =">edit</a>]</span></h1>
8760 <p>The line above must have a trailing space!
8761 </p>
8762 <h1><span class="mw-headline" id=".3D_2">=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =">edit</a>]</span></h1>
8763 <p>But just in case it doesn't...
8764 </p>
8765 !! end
8766
8767 !! test
8768 Header with special characters (bug 25462)
8769 !! input
8770 The tooltips shall not show entities to the user (ie. be double escaped)
8771
8772 == text > text ==
8773 section 1
8774
8775 == text < text ==
8776 section 2
8777
8778 == text & text ==
8779 section 3
8780
8781 == text ' text ==
8782 section 4
8783
8784 == text " text ==
8785 section 5
8786 !! result
8787 <p>The tooltips shall not show entities to the user (ie. be double escaped)
8788 </p>
8789 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8790 <ul>
8791 <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>
8792 <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>
8793 <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>
8794 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
8795 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
8796 </ul>
8797 </td></tr></table>
8798 <h2><span class="mw-headline" id="text_.3E_text">text &gt; text</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: text > text">edit</a>]</span></h2>
8799 <p>section 1
8800 </p>
8801 <h2><span class="mw-headline" id="text_.3C_text">text &lt; text</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: text &lt; text">edit</a>]</span></h2>
8802 <p>section 2
8803 </p>
8804 <h2><span class="mw-headline" id="text_.26_text">text &amp; text</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: text &amp; text">edit</a>]</span></h2>
8805 <p>section 3
8806 </p>
8807 <h2><span class="mw-headline" id="text_.27_text">text ' text</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: text ' text">edit</a>]</span></h2>
8808 <p>section 4
8809 </p>
8810 <h2><span class="mw-headline" id="text_.22_text">text " text</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: text &quot; text">edit</a>]</span></h2>
8811 <p>section 5
8812 </p>
8813 !! end
8814
8815 !! test
8816 Headers with excess '=' characters
8817 (Are similar tests necessary beyond the 1st level?)
8818 !! input
8819 =foo==
8820 ==foo=
8821 =''italic'' heading==
8822 ==''italic'' heading=
8823 !! result
8824 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8825 <ul>
8826 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
8827 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
8828 <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>
8829 <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>
8830 </ul>
8831 </td></tr></table>
8832 <h1><span class="mw-headline" id="foo.3D">foo=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: foo=">edit</a>]</span></h1>
8833 <h1><span class="mw-headline" id=".3Dfoo">=foo</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =foo">edit</a>]</span></h1>
8834 <h1><span class="mw-headline" id="italic_heading.3D"><i>italic</i> heading=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: italic heading=">edit</a>]</span></h1>
8835 <h1><span class="mw-headline" id=".3Ditalic_heading">=<i>italic</i> heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: =italic heading">edit</a>]</span></h1>
8836
8837 !! end
8838
8839 !! test
8840 HTML headers vs TOC (bug 23393)
8841 (__NOEDITSECTION__ for clearer output, doesn't matter here)
8842 !! input
8843 <h1>Header 1</h1>
8844 == Header 1.1 ==
8845 == Header 1.2 ==
8846
8847 <h1>Header 2
8848 </h1>
8849 == Header 2.1 ==
8850 == Header 2.2 ==
8851 __NOEDITSECTION__
8852 !! result
8853 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8854 <ul>
8855 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
8856 <ul>
8857 <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>
8858 <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>
8859 </ul>
8860 </li>
8861 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
8862 <ul>
8863 <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>
8864 <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>
8865 </ul>
8866 </li>
8867 </ul>
8868 </td></tr></table>
8869 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
8870 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
8871 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
8872 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
8873 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
8874 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
8875
8876 !! end
8877
8878 !! test
8879 BUG 1219 URL next to image (broken)
8880 !! input
8881 http://example.com[[Image:foobar.jpg]]
8882 !! result
8883 <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>
8884 </p>
8885 !!end
8886
8887 !! test
8888 Bug 1186 news: in the middle of text
8889 !! input
8890 http://en.wikinews.org/wiki/Wikinews:Workplace
8891 !! result
8892 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
8893 </p>
8894 !!end
8895
8896
8897 !! test
8898 Namespaced link must have a title
8899 !! input
8900 [[Project:]]
8901 !! result
8902 <p>[[Project:]]
8903 </p>
8904 !!end
8905
8906 !! test
8907 Namespaced link must have a title (bad fragment version)
8908 !! input
8909 [[Project:#fragment]]
8910 !! result
8911 <p>[[Project:#fragment]]
8912 </p>
8913 !!end
8914
8915
8916 ###
8917 ### HTML tags and HTML attributes
8918 ###
8919
8920 !! test
8921 div with no attributes
8922 !! input
8923 <div>HTML rocks</div>
8924 !! result
8925 <div>HTML rocks</div>
8926
8927 !! end
8928
8929 !! test
8930 div with double-quoted attribute
8931 !! input
8932 <div id="rock">HTML rocks</div>
8933 !! result
8934 <div id="rock">HTML rocks</div>
8935
8936 !! end
8937
8938 !! test
8939 div with single-quoted attribute
8940 !! input
8941 <div id='rock'>HTML rocks</div>
8942 !! result
8943 <div id="rock">HTML rocks</div>
8944
8945 !! end
8946
8947 !! test
8948 div with unquoted attribute
8949 !! input
8950 <div id=rock>HTML rocks</div>
8951 !! result
8952 <div id="rock">HTML rocks</div>
8953
8954 !! end
8955
8956 !! test
8957 div with illegal double attributes
8958 !! input
8959 <div id="a" id="b">HTML rocks</div>
8960 !! result
8961 <div id="b">HTML rocks</div>
8962
8963 !!end
8964
8965 # FIXME: produce empty string instead of "class" in the PHP parser, following
8966 # the HTML5 spec.
8967 !! test
8968 div with empty attribute value, space before equals
8969 !! options
8970 parsoid
8971 !! input
8972 <div class =>HTML rocks</div>
8973 !! result
8974 <div class="">HTML rocks</div>
8975
8976 !! end
8977
8978 # The PHP parser escapes the opening brace to &#123; for some reason, so
8979 # disabled this test for it.
8980 !! test
8981 div with braces in attribute value
8982 !! options
8983 parsoid
8984 !! input
8985 <div title="{}">Foo</div>
8986 !! result
8987 <div title="{}">Foo</div>
8988 !! end
8989
8990 # This it very inconsistent in the PHP parser: it returns
8991 # class="class" if there is a space between the name and the equal sign (see
8992 # 'div with empty attribute value, space before equals'), but strips the
8993 # attribute completely if the space is missing. We hope that not much content
8994 # depends on this, so are implementing the behavior below in Parsoid for
8995 # consistencies' sake. Disabled for the PHP parser.
8996 # FIXME: fix this behavior in the PHP parser?
8997 !! test
8998 div with empty attribute value, no space before equals
8999 !! options
9000 parsoid
9001 !! input
9002 <div class=>HTML rocks</div>
9003 !! result
9004 <div class="">HTML rocks</div>
9005
9006 !! end
9007
9008 !! test
9009 HTML multiple attributes correction
9010 !! input
9011 <p class="error" class="awesome">Awesome!</p>
9012 !! result
9013 <p class="awesome">Awesome!</p>
9014
9015 !!end
9016
9017 !! test
9018 Table multiple attributes correction
9019 !! input
9020 {|
9021 !+ class="error" class="awesome"| status
9022 |}
9023 !! result
9024 <table>
9025 <tr>
9026 <th class="awesome"> status
9027 </th></tr></table>
9028
9029 !!end
9030
9031 !! test
9032 DIV IN UPPERCASE
9033 !! input
9034 <DIV ID="x">HTML ROCKS</DIV>
9035 !! result
9036 <div id="x">HTML ROCKS</div>
9037
9038 !!end
9039
9040 !! test
9041 Non-ASCII pseudo-tags are rendered as text
9042 !! input
9043 <khyô>
9044 !! result
9045 <p>&lt;khyô&gt;
9046 </p>
9047 !! end
9048
9049 !! test
9050 Pseudo-tag with URL 'name' renders as url link
9051 !! input
9052 <http://example.com/>
9053 !! result
9054 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
9055 </p>
9056 !! end
9057
9058 !! test
9059 text with amp in the middle of nowhere
9060 !! input
9061 Remember AT&T?
9062 !!result
9063 <p>Remember AT&amp;T?
9064 </p>
9065 !! end
9066
9067 !! test
9068 text with character entity: eacute
9069 !! input
9070 I always thought &eacute; was a cute letter.
9071 !! result
9072 <p>I always thought &#233; was a cute letter.
9073 </p>
9074 !! end
9075
9076 !! test
9077 text with entity-escaped character entity-like string: eacute
9078 !! input
9079 I always thought &amp;eacute; was a cute letter.
9080 !! result
9081 <p>I always thought &amp;eacute; was a cute letter.
9082 </p>
9083 !! end
9084
9085 !! test
9086 text with undefined character entity: xacute
9087 !! input
9088 I always thought &xacute; was a cute letter.
9089 !! result
9090 <p>I always thought &amp;xacute; was a cute letter.
9091 </p>
9092 !! end
9093
9094
9095 ###
9096 ### Media links
9097 ###
9098
9099 !! test
9100 Media link
9101 !! input
9102 [[Media:Foobar.jpg]]
9103 !! result
9104 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
9105 </p>
9106 !! end
9107
9108 !! test
9109 Media link with text
9110 !! input
9111 [[Media:Foobar.jpg|A neat file to look at]]
9112 !! result
9113 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
9114 </p>
9115 !! end
9116
9117 # FIXME: this is still bad HTML tag nesting
9118 !! test
9119 Media link with nasty text
9120 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
9121 !! input
9122 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
9123 !! result
9124 <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>
9125
9126 !! end
9127
9128 !! test
9129 Media link to nonexistent file (bug 1702)
9130 !! input
9131 [[Media:No such.jpg]]
9132 !! result
9133 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
9134 </p>
9135 !! end
9136
9137 !! test
9138 Image link to nonexistent file (bug 1850 - good)
9139 !! input
9140 [[Image:No such.jpg]]
9141 !! result
9142 <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>
9143 </p>
9144 !! end
9145
9146 !! test
9147 :Image link to nonexistent file (bug 1850 - bad)
9148 !! input
9149 [[:Image:No such.jpg]]
9150 !! result
9151 <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>
9152 </p>
9153 !! end
9154
9155
9156
9157 !! test
9158 Character reference normalization in link text (bug 1938)
9159 !! input
9160 [[Main Page|this&that]]
9161 !! result
9162 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
9163 </p>
9164 !!end
9165
9166 !! article
9167 אַ
9168 !! text
9169 Test for unicode normalization
9170
9171 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
9172 !! endarticle
9173
9174 !! test
9175 (bug 19451) Links should refer to the normalized form.
9176 !! input
9177 [[&#xFB2E;]]
9178 [[&#x5d0;&#x5b7;]]
9179 [[&#x5d0;ַ]]
9180 [[א&#x5b7;]]
9181 [[אַ]]
9182 !! result
9183 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
9184 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
9185 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
9186 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
9187 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
9188 </p>
9189 !! end
9190
9191 !! test
9192 Empty attribute crash test (bug 2067)
9193 !! input
9194 <font color="">foo</font>
9195 !! result
9196 <p><font color="">foo</font>
9197 </p>
9198 !! end
9199
9200 !! test
9201 Empty attribute crash test single-quotes (bug 2067)
9202 !! input
9203 <font color=''>foo</font>
9204 !! result
9205 <p><font color="">foo</font>
9206 </p>
9207 !! end
9208
9209 !! test
9210 Attribute test: equals, then nothing
9211 !! input
9212 <font color=>foo</font>
9213 !! result
9214 <p><font>foo</font>
9215 </p>
9216 !! end
9217
9218 !! test
9219 Attribute test: unquoted value
9220 !! input
9221 <font color=x>foo</font>
9222 !! result
9223 <p><font color="x">foo</font>
9224 </p>
9225 !! end
9226
9227 !! test
9228 Attribute test: unquoted but illegal value (hash)
9229 !! input
9230 <font color=#x>foo</font>
9231 !! result
9232 <p><font color="#x">foo</font>
9233 </p>
9234 !! end
9235
9236 !! test
9237 Attribute test: no value
9238 !! input
9239 <font color>foo</font>
9240 !! result
9241 <p><font color="color">foo</font>
9242 </p>
9243 !! end
9244
9245 !! test
9246 Bug 2095: link with three closing brackets
9247 !! input
9248 [[Main Page]]]
9249 !! result
9250 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
9251 </p>
9252 !! end
9253
9254 !! test
9255 Bug 2095: link with pipe and three closing brackets
9256 !! input
9257 [[Main Page|link]]]
9258 !! result
9259 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
9260 </p>
9261 !! end
9262
9263 !! test
9264 Bug 2095: link with pipe and three closing brackets, version 2
9265 !! input
9266 [[Main Page|[http://example.com/]]]
9267 !! result
9268 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
9269 </p>
9270 !! end
9271
9272
9273 ###
9274 ### Safety
9275 ###
9276
9277 !! article
9278 Template:Dangerous attribute
9279 !! text
9280 " onmouseover="alert(document.cookie)
9281 !! endarticle
9282
9283 !! article
9284 Template:Dangerous style attribute
9285 !! text
9286 border-size: expression(alert(document.cookie))
9287 !! endarticle
9288
9289 !! article
9290 Template:Div style
9291 !! text
9292 <div style="float: right; {{{1}}}">Magic div</div>
9293 !! endarticle
9294
9295 !! test
9296 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
9297 !! input
9298 <div title="{{test}}"></div>
9299 !! result
9300 <div title="This is a test template"></div>
9301
9302 !! end
9303
9304 !! test
9305 Bug 2304: HTML attribute safety (dangerous template; 2309)
9306 !! input
9307 <div title="{{dangerous attribute}}"></div>
9308 !! result
9309 <div title=""></div>
9310
9311 !! end
9312
9313 !! test
9314 Bug 2304: HTML attribute safety (dangerous style template; 2309)
9315 !! input
9316 <div style="{{dangerous style attribute}}"></div>
9317 !! result
9318 <div style="/* insecure input */"></div>
9319
9320 !! end
9321
9322 !! test
9323 Bug 2304: HTML attribute safety (safe parameter; 2309)
9324 !! input
9325 {{div style|width: 200px}}
9326 !! result
9327 <div style="float: right; width: 200px">Magic div</div>
9328
9329 !! end
9330
9331 !! test
9332 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
9333 !! input
9334 {{div style|width: expression(alert(document.cookie))}}
9335 !! result
9336 <div style="/* insecure input */">Magic div</div>
9337
9338 !! end
9339
9340 !! test
9341 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
9342 !! input
9343 {{div style|"><script>alert(document.cookie)</script>}}
9344 !! result
9345 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9346
9347 !! end
9348
9349 !! test
9350 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
9351 !! input
9352 {{div style|" ><script>alert(document.cookie)</script>}}
9353 !! result
9354 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9355
9356 !! end
9357
9358 !! test
9359 Bug 2304: HTML attribute safety (link)
9360 !! input
9361 <div title="[[Main Page]]"></div>
9362 !! result
9363 <div title="&#91;&#91;Main Page]]"></div>
9364
9365 !! end
9366
9367 !! test
9368 Bug 2304: HTML attribute safety (italics)
9369 !! input
9370 <div title="''foobar''"></div>
9371 !! result
9372 <div title="&#39;&#39;foobar&#39;&#39;"></div>
9373
9374 !! end
9375
9376 !! test
9377 Bug 2304: HTML attribute safety (bold)
9378 !! input
9379 <div title="'''foobar'''"></div>
9380 !! result
9381 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
9382
9383 !! end
9384
9385
9386 !! test
9387 Bug 2304: HTML attribute safety (ISBN)
9388 !! input
9389 <div title="ISBN 1234567890"></div>
9390 !! result
9391 <div title="&#73;SBN 1234567890"></div>
9392
9393 !! end
9394
9395 !! test
9396 Bug 2304: HTML attribute safety (RFC)
9397 !! input
9398 <div title="RFC 1234"></div>
9399 !! result
9400 <div title="&#82;FC 1234"></div>
9401
9402 !! end
9403
9404 !! test
9405 Bug 2304: HTML attribute safety (PMID)
9406 !! input
9407 <div title="PMID 1234567890"></div>
9408 !! result
9409 <div title="&#80;MID 1234567890"></div>
9410
9411 !! end
9412
9413 !! test
9414 Bug 2304: HTML attribute safety (web link)
9415 !! input
9416 <div title="http://example.com/"></div>
9417 !! result
9418 <div title="http&#58;//example.com/"></div>
9419
9420 !! end
9421
9422 !! test
9423 Bug 2304: HTML attribute safety (named web link)
9424 !! input
9425 <div title="[http://example.com/ link]"></div>
9426 !! result
9427 <div title="&#91;http&#58;//example.com/ link]"></div>
9428
9429 !! end
9430
9431 !! test
9432 Bug 3244: HTML attribute safety (extension; safe)
9433 !! input
9434 <div style="<nowiki>background:blue</nowiki>"></div>
9435 !! result
9436 <div style="background:blue"></div>
9437
9438 !! end
9439
9440 !! test
9441 Bug 3244: HTML attribute safety (extension; unsafe)
9442 !! input
9443 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
9444 !! result
9445 <div style="/* insecure input */"></div>
9446
9447 !! end
9448
9449 # More MSIE fun discovered by Tom Gilder
9450
9451 !! test
9452 MSIE CSS safety test: spurious slash
9453 !! input
9454 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
9455 !! result
9456 <div style="/* insecure input */">evil</div>
9457
9458 !! end
9459
9460 !! test
9461 MSIE CSS safety test: hex code
9462 !! input
9463 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
9464 !! result
9465 <div style="/* insecure input */">evil</div>
9466
9467 !! end
9468
9469 !! test
9470 MSIE CSS safety test: comment in url
9471 !! input
9472 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
9473 !! result
9474 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
9475
9476 !! end
9477
9478 !! test
9479 MSIE CSS safety test: comment in expression
9480 !! input
9481 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
9482 !! result
9483 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
9484
9485 !! end
9486
9487
9488 !! test
9489 Table attribute legitimate extension
9490 !! input
9491 {|
9492 !+ style="<nowiki>color:blue</nowiki>"| status
9493 |}
9494 !! result
9495 <table>
9496 <tr>
9497 <th style="color:blue"> status
9498 </th></tr></table>
9499
9500 !!end
9501
9502 !! test
9503 Table attribute safety
9504 !! input
9505 {|
9506 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
9507 |}
9508 !! result
9509 <table>
9510 <tr>
9511 <th style="/* insecure input */"> status
9512 </th></tr></table>
9513
9514 !! end
9515
9516 !! test
9517 CSS line continuation 1
9518 !! input
9519 <div style="background-image: u\&#10;rl(test.jpg);"></div>
9520 !! result
9521 <div style="/* insecure input */"></div>
9522
9523 !! end
9524
9525 !! test
9526 CSS line continuation 2
9527 !! input
9528 <div style="background-image: u\&#13;rl(test.jpg); "></div>
9529 !! result
9530 <div style="/* insecure input */"></div>
9531
9532 !! end
9533
9534 !! article
9535 Template:Identity
9536 !! text
9537 {{{1}}}
9538 !! endarticle
9539
9540 !! test
9541 Expansion of multi-line templates in attribute values (bug 6255)
9542 !! input
9543 <div style="background: {{identity|#00FF00}}">-</div>
9544 !! result
9545 <div style="background: #00FF00">-</div>
9546
9547 !! end
9548
9549
9550 !! test
9551 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
9552 !! input
9553 <div style="background:
9554 #00FF00">-</div>
9555 !! result
9556 <div style="background: #00FF00">-</div>
9557
9558 !! end
9559
9560 !! test
9561 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
9562 !! input
9563 <div style="background: &#10;#00FF00">-</div>
9564 !! result
9565 <div style="background: &#10;#00FF00">-</div>
9566
9567 !! end
9568
9569 ###
9570 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
9571 ###
9572 !! test
9573 Parser hook: empty input
9574 !! input
9575 <tag></tag>
9576 !! result
9577 <pre>
9578 ''
9579 array (
9580 )
9581 </pre>
9582
9583 !! end
9584
9585 !! test
9586 Parser hook: empty input using terminated empty elements
9587 !! input
9588 <tag/>
9589 !! result
9590 <pre>
9591 NULL
9592 array (
9593 )
9594 </pre>
9595
9596 !! end
9597
9598 !! test
9599 Parser hook: empty input using terminated empty elements (space before)
9600 !! input
9601 <tag />
9602 !! result
9603 <pre>
9604 NULL
9605 array (
9606 )
9607 </pre>
9608
9609 !! end
9610
9611 !! test
9612 Parser hook: basic input
9613 !! input
9614 <tag>input</tag>
9615 !! result
9616 <pre>
9617 'input'
9618 array (
9619 )
9620 </pre>
9621
9622 !! end
9623
9624
9625 !! test
9626 Parser hook: case insensitive
9627 !! input
9628 <TAG>input</TAG>
9629 !! result
9630 <pre>
9631 'input'
9632 array (
9633 )
9634 </pre>
9635
9636 !! end
9637
9638
9639 !! test
9640 Parser hook: case insensitive, redux
9641 !! input
9642 <TaG>input</TAg>
9643 !! result
9644 <pre>
9645 'input'
9646 array (
9647 )
9648 </pre>
9649
9650 !! end
9651
9652 !! test
9653 Parser hook: nested tags
9654 !! options
9655 noxml
9656 !! input
9657 <tag><tag></tag></tag>
9658 !! result
9659 <pre>
9660 '<tag>'
9661 array (
9662 )
9663 </pre>&lt;/tag&gt;
9664
9665 !! end
9666
9667 !! test
9668 Parser hook: basic arguments
9669 !! input
9670 <tag width=200 height = "100" depth = '50' square></tag>
9671 !! result
9672 <pre>
9673 ''
9674 array (
9675 'width' => '200',
9676 'height' => '100',
9677 'depth' => '50',
9678 'square' => 'square',
9679 )
9680 </pre>
9681
9682 !! end
9683
9684 !! test
9685 Parser hook: argument containing a forward slash (bug 5344)
9686 !! input
9687 <tag filename='/tmp/bla'></tag>
9688 !! result
9689 <pre>
9690 ''
9691 array (
9692 'filename' => '/tmp/bla',
9693 )
9694 </pre>
9695
9696 !! end
9697
9698 !! test
9699 Parser hook: empty input using terminated empty elements (bug 2374)
9700 !! input
9701 <tag foo=bar/>text
9702 !! result
9703 <pre>
9704 NULL
9705 array (
9706 'foo' => 'bar',
9707 )
9708 </pre>text
9709
9710 !! end
9711
9712 # </tag> should be output literally since there is no matching tag that begins it
9713 !! test
9714 Parser hook: basic arguments using terminated empty elements (bug 2374)
9715 !! input
9716 <tag width=200 height = "100" depth = '50' square/>
9717 other stuff
9718 </tag>
9719 !! result
9720 <pre>
9721 NULL
9722 array (
9723 'width' => '200',
9724 'height' => '100',
9725 'depth' => '50',
9726 'square' => 'square',
9727 )
9728 </pre>
9729 <p>other stuff
9730 &lt;/tag&gt;
9731 </p>
9732 !! end
9733
9734 ###
9735 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
9736 ###
9737
9738 !! test
9739 Parser hook: static parser hook not inside a comment
9740 !! input
9741 <statictag>hello, world</statictag>
9742 <statictag action=flush/>
9743 !! result
9744 <p>hello, world
9745 </p>
9746 !! end
9747
9748
9749 !! test
9750 Parser hook: static parser hook inside a comment
9751 !! input
9752 <!-- <statictag>hello, world</statictag> -->
9753 <statictag action=flush/>
9754 !! result
9755 <p><br />
9756 </p>
9757 !! end
9758
9759 # Nested template calls; this case was broken by Parser.php rev 1.506,
9760 # since reverted.
9761
9762 !! article
9763 Template:One-parameter
9764 !! text
9765 (My parameter is: {{{1}}})
9766 !! endarticle
9767
9768 !! article
9769 Template:Map-one-parameter
9770 !! text
9771 {{{{{1}}}|{{{2}}}}}
9772 !! endarticle
9773
9774 !! test
9775 Nested template calls
9776 !! input
9777 {{Map-one-parameter|One-parameter|param}}
9778 !! result
9779 <p>(My parameter is: param)
9780 </p>
9781 !! end
9782
9783
9784 ###
9785 ### Sanitizer
9786 ###
9787 !! test
9788 Sanitizer: Closing of open tags
9789 !! input
9790 <s></s><table></table>
9791 !! result
9792 <s></s><table></table>
9793
9794 !! end
9795
9796 !! test
9797 Sanitizer: Closing of open but not closed tags
9798 !! input
9799 <s>foo
9800 !! result
9801 <p><s>foo</s>
9802 </p>
9803 !! end
9804
9805 !! test
9806 Sanitizer: Closing of closed but not open tags
9807 !! input
9808 </s>
9809 !! result
9810 <p>&lt;/s&gt;
9811 </p>
9812 !! end
9813
9814 !! test
9815 Sanitizer: Closing of closed but not open table tags
9816 !! input
9817 Table not started</td></tr></table>
9818 !! result
9819 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
9820 </p>
9821 !! end
9822
9823 !! test
9824 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
9825 !! input
9826 <span id="æ: v">byte</span>[[#æ: v|backlink]]
9827 !! result
9828 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
9829 </p>
9830 !! end
9831
9832 !! test
9833 Sanitizer: Validating the contents of the id attribute (bug 4515)
9834 !! options
9835 disabled
9836 !! input
9837 <br id=9 />
9838 !! result
9839 Something, but definitely not <br id="9" />...
9840 !! end
9841
9842 !! test
9843 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
9844 !! options
9845 disabled
9846 !! input
9847 <br id="foo" /><br id="foo" />
9848 !! result
9849 Something need to be done. foo-2 ?
9850 !! end
9851
9852 !! test
9853 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
9854 !! input
9855 <div itemscope>
9856 <meta itemprop="hello" content="world">
9857 <meta http-equiv="refresh" content="5">
9858 <meta itemprop="hello" http-equiv="refresh" content="5">
9859 <link itemprop="hello" href="{{SERVER}}">
9860 <link rel="stylesheet" href="{{SERVER}}">
9861 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
9862 </div>
9863 !! result
9864 <div itemscope="itemscope">
9865 <p> <meta itemprop="hello" content="world" />
9866 &lt;meta http-equiv="refresh" content="5"&gt;
9867 <meta itemprop="hello" content="5" />
9868 </p>
9869 <link itemprop="hello" href="http&#58;//example.org" />
9870 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
9871 <link itemprop="hello" href="http&#58;//example.org" />
9872 </div>
9873
9874 !! end
9875
9876 !! test
9877 Language converter: output gets cut off unexpectedly (bug 5757)
9878 !! options
9879 language=zh
9880 !! input
9881 this bit is safe: }-
9882
9883 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
9884
9885 then we get cut off here: }-
9886
9887 all additional text is vanished
9888 !! result
9889 <p>this bit is safe: }-
9890 </p><p>but if we add a conversion instance: xxx
9891 </p><p>then we get cut off here: }-
9892 </p><p>all additional text is vanished
9893 </p>
9894 !! end
9895
9896 !! test
9897 Self closed html pairs (bug 5487)
9898 !! options
9899 !! input
9900 <center><font id="bug" />Centered text</center>
9901 <div><font id="bug2" />In div text</div>
9902 !! result
9903 <center>&lt;font id="bug" /&gt;Centered text</center>
9904 <div>&lt;font id="bug2" /&gt;In div text</div>
9905
9906 !! end
9907
9908 #
9909 #
9910 #
9911
9912 !! test
9913 Punctuation: nbsp before exclamation
9914 !! input
9915 C'est grave !
9916 !! result
9917 <p>C'est grave&#160;!
9918 </p>
9919 !! end
9920
9921 !! test
9922 Punctuation: CSS !important (bug 11874)
9923 !! input
9924 <div style="width:50% !important">important</div>
9925 !! result
9926 <div style="width:50% !important">important</div>
9927
9928 !!end
9929
9930 !! test
9931 Punctuation: CSS ! important (bug 11874; with space after)
9932 !! input
9933 <div style="width:50% ! important">important</div>
9934 !! result
9935 <div style="width:50% ! important">important</div>
9936
9937 !!end
9938
9939
9940 !! test
9941 HTML bullet list, closed tags (bug 5497)
9942 !! input
9943 <ul>
9944 <li>One</li>
9945 <li>Two</li>
9946 </ul>
9947 !! result
9948 <ul>
9949 <li>One</li>
9950 <li>Two</li>
9951 </ul>
9952
9953 !! end
9954
9955 !! test
9956 HTML bullet list, unclosed tags (bug 5497)
9957 !! options
9958 disabled
9959 !! input
9960 <ul>
9961 <li>One
9962 <li>Two
9963 </ul>
9964 !! result
9965 <ul>
9966 <li>One
9967 </li><li>Two
9968 </li></ul>
9969
9970 !! end
9971
9972 !! test
9973 HTML ordered list, closed tags (bug 5497)
9974 !! input
9975 <ol>
9976 <li>One</li>
9977 <li>Two</li>
9978 </ol>
9979 !! result
9980 <ol>
9981 <li>One</li>
9982 <li>Two</li>
9983 </ol>
9984
9985 !! end
9986
9987 !! test
9988 HTML ordered list, unclosed tags (bug 5497)
9989 !! options
9990 disabled
9991 !! input
9992 <ol>
9993 <li>One
9994 <li>Two
9995 </ol>
9996 !! result
9997 <ol>
9998 <li>One
9999 </li><li>Two
10000 </li></ol>
10001
10002 !! end
10003
10004 !! test
10005 HTML nested bullet list, closed tags (bug 5497)
10006 !! input
10007 <ul>
10008 <li>One</li>
10009 <li>Two:
10010 <ul>
10011 <li>Sub-one</li>
10012 <li>Sub-two</li>
10013 </ul>
10014 </li>
10015 </ul>
10016 !! result
10017 <ul>
10018 <li>One</li>
10019 <li>Two:
10020 <ul>
10021 <li>Sub-one</li>
10022 <li>Sub-two</li>
10023 </ul>
10024 </li>
10025 </ul>
10026
10027 !! end
10028
10029 !! test
10030 HTML nested bullet list, open tags (bug 5497)
10031 !! options
10032 disabled
10033 !! input
10034 <ul>
10035 <li>One
10036 <li>Two:
10037 <ul>
10038 <li>Sub-one
10039 <li>Sub-two
10040 </ul>
10041 </ul>
10042 !! result
10043 <ul>
10044 <li>One
10045 </li><li>Two:
10046 <ul>
10047 <li>Sub-one
10048 </li><li>Sub-two
10049 </li></ul>
10050 </li></ul>
10051
10052 !! end
10053
10054 !! test
10055 HTML nested ordered list, closed tags (bug 5497)
10056 !! input
10057 <ol>
10058 <li>One</li>
10059 <li>Two:
10060 <ol>
10061 <li>Sub-one</li>
10062 <li>Sub-two</li>
10063 </ol>
10064 </li>
10065 </ol>
10066 !! result
10067 <ol>
10068 <li>One</li>
10069 <li>Two:
10070 <ol>
10071 <li>Sub-one</li>
10072 <li>Sub-two</li>
10073 </ol>
10074 </li>
10075 </ol>
10076
10077 !! end
10078
10079 !! test
10080 HTML nested ordered list, open tags (bug 5497)
10081 !! options
10082 disabled
10083 !! input
10084 <ol>
10085 <li>One
10086 <li>Two:
10087 <ol>
10088 <li>Sub-one
10089 <li>Sub-two
10090 </ol>
10091 </ol>
10092 !! result
10093 <ol>
10094 <li>One
10095 </li><li>Two:
10096 <ol>
10097 <li>Sub-one
10098 </li><li>Sub-two
10099 </li></ol>
10100 </li></ol>
10101
10102 !! end
10103
10104 !! test
10105 HTML ordered list item with parameters oddity
10106 !! input
10107 <ol><li id="fragment">One</li></ol>
10108 !! result
10109 <ol><li id="fragment">One</li></ol>
10110
10111 !! end
10112
10113 !!test
10114 bug 5918: autonumbering
10115 !! input
10116 [http://first/] [http://second] [ftp://ftp]
10117
10118 ftp://inlineftp
10119
10120 [mailto:enclosed@mail.tld With target]
10121
10122 [mailto:enclosed@mail.tld]
10123
10124 mailto:inline@mail.tld
10125 !! result
10126 <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>
10127 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
10128 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
10129 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
10130 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
10131 </p>
10132 !! end
10133
10134
10135 #
10136 # Security and HTML correctness
10137 # From Nick Jenkins' fuzz testing
10138 #
10139
10140 !! test
10141 Fuzz testing: Parser13
10142 !! input
10143 {|
10144 | http://a|
10145 !! result
10146 <table>
10147 <tr>
10148 <td>
10149 </td>
10150 </tr>
10151 </table>
10152
10153 !! end
10154
10155 !! test
10156 Fuzz testing: Parser14
10157 !! input
10158 == onmouseover= ==
10159 http://__TOC__
10160 !! result
10161 <h2><span class="mw-headline" id="onmouseover.3D">onmouseover=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a>]</span></h2>
10162 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10163 <ul>
10164 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
10165 </ul>
10166 </td></tr></table>
10167
10168 !! end
10169
10170 !! test
10171 Fuzz testing: Parser14-table
10172 !! input
10173 ==a==
10174 {| STYLE=__TOC__
10175 !! result
10176 <h2><span class="mw-headline" id="a">a</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a>]</span></h2>
10177 <table style="&#95;_TOC&#95;_">
10178 <tr><td></td></tr>
10179 </table>
10180
10181 !! end
10182
10183 # Known to produce bogus xml (extra </td>)
10184 !! test
10185 Fuzz testing: Parser16
10186 !! options
10187 noxml
10188 !! input
10189 {|
10190 !https://||||||
10191 !! result
10192 <table>
10193 <tr>
10194 <th>https://</th>
10195 <th></th>
10196 <th></th>
10197 <th>
10198 </td>
10199 </tr>
10200 </table>
10201
10202 !! end
10203
10204 !! test
10205 Fuzz testing: Parser21
10206 !! input
10207 {|
10208 ! irc://{{ftp://a" onmouseover="alert('hello world');"
10209 |
10210 !! result
10211 <table>
10212 <tr>
10213 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
10214 </th>
10215 <td>
10216 </td>
10217 </tr>
10218 </table>
10219
10220 !! end
10221
10222 !! test
10223 Fuzz testing: Parser22
10224 !! input
10225 http://===r:::https://b
10226
10227 {|
10228 !!result
10229 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
10230 </p>
10231 <table>
10232 <tr><td></td></tr>
10233 </table>
10234
10235 !! end
10236
10237 # Known to produce bad XML for now
10238 !! test
10239 Fuzz testing: Parser24
10240 !! options
10241 noxml
10242 !! input
10243 {|
10244 {{{|
10245 <u CLASS=
10246 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
10247 <br style="onmouseover='alert(document.cookie);' " />
10248
10249 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10250 |
10251 !! result
10252 <table>
10253 {{{|
10254 <u class="&#124;">}}}} &gt;
10255 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
10256
10257 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10258 <tr>
10259 <td></u>
10260 </td>
10261 </tr>
10262 </table>
10263
10264 !! end
10265
10266 # Note: the current result listed for this is not what the original one was,
10267 # but the original bug was JavaScript injection, which is fixed in any case.
10268 # It's not clear that the original result listed was any more correct than the
10269 # current one. Original result:
10270 # <p>{{{|
10271 # </p>
10272 # <li class="&#124;&#124;">
10273 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10274 !!test
10275 Fuzz testing: Parser25 (bug 6055)
10276 !! input
10277 {{{
10278 |
10279 <LI CLASS=||
10280 >
10281 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
10282 !! result
10283 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10284 </p>
10285 !! end
10286
10287 !!test
10288 Fuzz testing: URL adjacent extension (with space, clean)
10289 !! options
10290 !! input
10291 http://example.com <nowiki>junk</nowiki>
10292 !! result
10293 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
10294 </p>
10295 !!end
10296
10297 !!test
10298 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
10299 !! options
10300 !! input
10301 http://example.com<nowiki>junk</nowiki>
10302 !! result
10303 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
10304 </p>
10305 !!end
10306
10307 !!test
10308 Fuzz testing: URL adjacent extension (no space, dirty; pre)
10309 !! options
10310 !! input
10311 http://example.com<pre>junk</pre>
10312 !! result
10313 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
10314
10315 !!end
10316
10317 !!test
10318 Fuzz testing: image with bogus manual thumbnail
10319 !!input
10320 [[Image:foobar.jpg|thumbnail= ]]
10321 !!result
10322 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
10323
10324 !!end
10325
10326 !! test
10327 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
10328 !! input
10329 <pre dir="&#10;"></pre>
10330 !! result
10331 <pre dir="&#10;"></pre>
10332
10333 !! end
10334
10335 !! test
10336 Parsing optional HTML elements (Bug 6171)
10337 !! options
10338 !! input
10339 <table>
10340 <tr>
10341 <td> Some tabular data</td>
10342 <td> More tabular data ...
10343 <td> And yet som tabular data</td>
10344 </tr>
10345 </table>
10346 !! result
10347 <table>
10348 <tr>
10349 <td> Some tabular data</td>
10350 <td> More tabular data ...
10351 </td><td> And yet som tabular data</td>
10352 </tr>
10353 </table>
10354
10355 !! end
10356
10357 !! test
10358 Correct handling of <td>, <tr> (Bug 6171)
10359 !! options
10360 !! input
10361 <table>
10362 <tr>
10363 <td> Some tabular data</td>
10364 <td> More tabular data ...</td>
10365 <td> And yet som tabular data</td>
10366 </tr>
10367 </table>
10368 !! result
10369 <table>
10370 <tr>
10371 <td> Some tabular data</td>
10372 <td> More tabular data ...</td>
10373 <td> And yet som tabular data</td>
10374 </tr>
10375 </table>
10376
10377 !! end
10378
10379
10380 !! test
10381 Parsing crashing regression (fr:JavaScript)
10382 !! input
10383 </body></x>
10384 !! result
10385 <p>&lt;/body&gt;&lt;/x&gt;
10386 </p>
10387 !! end
10388
10389 !! test
10390 Inline wiki vs wiki block nesting
10391 !! input
10392 '''Bold paragraph
10393
10394 New wiki paragraph
10395 !! result
10396 <p><b>Bold paragraph</b>
10397 </p><p>New wiki paragraph
10398 </p>
10399 !! end
10400
10401 !! test
10402 Inline HTML vs wiki block nesting
10403 !! options
10404 disabled
10405 !! input
10406 <b>Bold paragraph
10407
10408 New wiki paragraph
10409 !! result
10410 <p><b>Bold paragraph</b>
10411 </p><p>New wiki paragraph
10412 </p>
10413 !! end
10414
10415 # Original result was this:
10416 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
10417 # </p>
10418 # While that might be marginally more intuitive, maybe, the six-apostrophe
10419 # construct is clearly pathological and the result stated here (which is what
10420 # the parser actually does) is about as reasonable as anything.
10421 !!test
10422 Mixing markup for italics and bold
10423 !! options
10424 !! input
10425 '''bold''''''bold''bolditalics'''''
10426 !! result
10427 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
10428 </p>
10429 !! end
10430
10431
10432 !! article
10433 Xyzzyx
10434 !! text
10435 Article for special page transclusion test
10436 !! endarticle
10437
10438 !! test
10439 Special page transclusion
10440 !! options
10441 !! input
10442 {{Special:Prefixindex/Xyzzyx}}
10443 !! result
10444 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10445
10446 !! end
10447
10448 !! test
10449 Special page transclusion twice (bug 5021)
10450 !! options
10451 !! input
10452 {{Special:Prefixindex/Xyzzyx}}
10453 {{Special:Prefixindex/Xyzzyx}}
10454 !! result
10455 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10456 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10457
10458 !! end
10459
10460 !! test
10461 Transclusion of default MediaWiki message
10462 !! input
10463 {{MediaWiki:Mainpage}}
10464 !!result
10465 <p>Main Page
10466 </p>
10467 !! end
10468
10469 !! test
10470 Transclusion of nonexistent MediaWiki message
10471 !! input
10472 {{MediaWiki:Mainpagexxx}}
10473 !!result
10474 <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>
10475 </p>
10476 !! end
10477
10478 !! test
10479 Transclusion of MediaWiki message with underscore
10480 !! input
10481 {{MediaWiki:history_short}}
10482 !! result
10483 <p>History
10484 </p>
10485 !! end
10486
10487 !! test
10488 Transclusion of MediaWiki message with space
10489 !! input
10490 {{MediaWiki:history short}}
10491 !! result
10492 <p>History
10493 </p>
10494 !! end
10495
10496 !! test
10497 Invalid header with following text
10498 !! input
10499 = x = y
10500 !! result
10501 <p>= x = y
10502 </p>
10503 !! end
10504
10505
10506 !! test
10507 Section extraction test (section 0)
10508 !! options
10509 section=0
10510 !! input
10511 start
10512 ==a==
10513 ===aa===
10514 ====aaa====
10515 ==b==
10516 ===ba===
10517 ===bb===
10518 ====bba====
10519 ===bc===
10520 ==c==
10521 ===ca===
10522 !! result
10523 start
10524 !! end
10525
10526 !! test
10527 Section extraction test (section 1)
10528 !! options
10529 section=1
10530 !! input
10531 start
10532 ==a==
10533 ===aa===
10534 ====aaa====
10535 ==b==
10536 ===ba===
10537 ===bb===
10538 ====bba====
10539 ===bc===
10540 ==c==
10541 ===ca===
10542 !! result
10543 ==a==
10544 ===aa===
10545 ====aaa====
10546 !! end
10547
10548 !! test
10549 Section extraction test (section 2)
10550 !! options
10551 section=2
10552 !! input
10553 start
10554 ==a==
10555 ===aa===
10556 ====aaa====
10557 ==b==
10558 ===ba===
10559 ===bb===
10560 ====bba====
10561 ===bc===
10562 ==c==
10563 ===ca===
10564 !! result
10565 ===aa===
10566 ====aaa====
10567 !! end
10568
10569 !! test
10570 Section extraction test (section 3)
10571 !! options
10572 section=3
10573 !! input
10574 start
10575 ==a==
10576 ===aa===
10577 ====aaa====
10578 ==b==
10579 ===ba===
10580 ===bb===
10581 ====bba====
10582 ===bc===
10583 ==c==
10584 ===ca===
10585 !! result
10586 ====aaa====
10587 !! end
10588
10589 !! test
10590 Section extraction test (section 4)
10591 !! options
10592 section=4
10593 !! input
10594 start
10595 ==a==
10596 ===aa===
10597 ====aaa====
10598 ==b==
10599 ===ba===
10600 ===bb===
10601 ====bba====
10602 ===bc===
10603 ==c==
10604 ===ca===
10605 !! result
10606 ==b==
10607 ===ba===
10608 ===bb===
10609 ====bba====
10610 ===bc===
10611 !! end
10612
10613 !! test
10614 Section extraction test (section 5)
10615 !! options
10616 section=5
10617 !! input
10618 start
10619 ==a==
10620 ===aa===
10621 ====aaa====
10622 ==b==
10623 ===ba===
10624 ===bb===
10625 ====bba====
10626 ===bc===
10627 ==c==
10628 ===ca===
10629 !! result
10630 ===ba===
10631 !! end
10632
10633 !! test
10634 Section extraction test (section 6)
10635 !! options
10636 section=6
10637 !! input
10638 start
10639 ==a==
10640 ===aa===
10641 ====aaa====
10642 ==b==
10643 ===ba===
10644 ===bb===
10645 ====bba====
10646 ===bc===
10647 ==c==
10648 ===ca===
10649 !! result
10650 ===bb===
10651 ====bba====
10652 !! end
10653
10654 !! test
10655 Section extraction test (section 7)
10656 !! options
10657 section=7
10658 !! input
10659 start
10660 ==a==
10661 ===aa===
10662 ====aaa====
10663 ==b==
10664 ===ba===
10665 ===bb===
10666 ====bba====
10667 ===bc===
10668 ==c==
10669 ===ca===
10670 !! result
10671 ====bba====
10672 !! end
10673
10674 !! test
10675 Section extraction test (section 8)
10676 !! options
10677 section=8
10678 !! input
10679 start
10680 ==a==
10681 ===aa===
10682 ====aaa====
10683 ==b==
10684 ===ba===
10685 ===bb===
10686 ====bba====
10687 ===bc===
10688 ==c==
10689 ===ca===
10690 !! result
10691 ===bc===
10692 !! end
10693
10694 !! test
10695 Section extraction test (section 9)
10696 !! options
10697 section=9
10698 !! input
10699 start
10700 ==a==
10701 ===aa===
10702 ====aaa====
10703 ==b==
10704 ===ba===
10705 ===bb===
10706 ====bba====
10707 ===bc===
10708 ==c==
10709 ===ca===
10710 !! result
10711 ==c==
10712 ===ca===
10713 !! end
10714
10715 !! test
10716 Section extraction test (section 10)
10717 !! options
10718 section=10
10719 !! input
10720 start
10721 ==a==
10722 ===aa===
10723 ====aaa====
10724 ==b==
10725 ===ba===
10726 ===bb===
10727 ====bba====
10728 ===bc===
10729 ==c==
10730 ===ca===
10731 !! result
10732 ===ca===
10733 !! end
10734
10735 !! test
10736 Section extraction test (nonexistent section 11)
10737 !! options
10738 section=11
10739 !! input
10740 start
10741 ==a==
10742 ===aa===
10743 ====aaa====
10744 ==b==
10745 ===ba===
10746 ===bb===
10747 ====bba====
10748 ===bc===
10749 ==c==
10750 ===ca===
10751 !! result
10752 !! end
10753
10754 !! test
10755 Section extraction test with bogus heading (section 1)
10756 !! options
10757 section=1
10758 !! input
10759 ==a==
10760 ==bogus== not a legal section
10761 ==b==
10762 !! result
10763 ==a==
10764 ==bogus== not a legal section
10765 !! end
10766
10767 !! test
10768 Section extraction test with bogus heading (section 2)
10769 !! options
10770 section=2
10771 !! input
10772 ==a==
10773 ==bogus== not a legal section
10774 ==b==
10775 !! result
10776 ==b==
10777 !! end
10778
10779 !! test
10780 Section extraction test with comment after heading (section 1)
10781 !! options
10782 section=1
10783 !! input
10784 ==a==
10785 ==b== <!-- -->
10786 ==c==
10787 !! result
10788 ==a==
10789 !! end
10790
10791 !! test
10792 Section extraction test with comment after heading (section 2)
10793 !! options
10794 section=2
10795 !! input
10796 ==a==
10797 ==b== <!-- -->
10798 ==c==
10799 !! result
10800 ==b== <!-- -->
10801 !! end
10802
10803 !! test
10804 Section extraction test with bogus <nowiki> heading (section 1)
10805 !! options
10806 section=1
10807 !! input
10808 ==a==
10809 ==bogus== <nowiki>not a legal section</nowiki>
10810 ==b==
10811 !! result
10812 ==a==
10813 ==bogus== <nowiki>not a legal section</nowiki>
10814 !! end
10815
10816 !! test
10817 Section extraction test with bogus <nowiki> heading (section 2)
10818 !! options
10819 section=2
10820 !! input
10821 ==a==
10822 ==bogus== <nowiki>not a legal section</nowiki>
10823 ==b==
10824 !! result
10825 ==b==
10826 !! end
10827
10828
10829 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
10830 # instead of respecting commented sections
10831 !! test
10832 Section extraction prefixed by comment (section 1)
10833 !! options
10834 section=1
10835 !! input
10836 <!-- -->==sec1==
10837 ==sec2==
10838 !!result
10839 ==sec2==
10840 !!end
10841
10842 !! test
10843 Section extraction prefixed by comment (section 2)
10844 !! options
10845 section=2
10846 !! input
10847 <!-- -->==sec1==
10848 ==sec2==
10849 !!result
10850
10851 !!end
10852
10853
10854 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
10855 # instead of respecting HTML-style headings
10856 !! test
10857 Section extraction, mixed wiki and html (section 1)
10858 !! options
10859 section=1
10860 !! input
10861 <h2>unmarked</h2>
10862 unmarked
10863 ==1==
10864 one
10865 ==2==
10866 two
10867 !! result
10868 ==1==
10869 one
10870 !! end
10871
10872 !! test
10873 Section extraction, mixed wiki and html (section 2)
10874 !! options
10875 section=2
10876 !! input
10877 <h2>unmarked</h2>
10878 unmarked
10879 ==1==
10880 one
10881 ==2==
10882 two
10883 !! result
10884 ==2==
10885 two
10886 !! end
10887
10888
10889 # Formerly testing for bug 3342
10890 !! test
10891 Section extraction, heading surrounded by <noinclude>
10892 !! options
10893 section=1
10894 !! input
10895 <noinclude>==unmarked==</noinclude>
10896 ==marked==
10897 !! result
10898 ==marked==
10899 !!end
10900
10901 # Test behavior of bug 19910
10902 !! test
10903 Sectiion with all-equals
10904 !! options
10905 section=2
10906 !! input
10907 ===
10908 The line above must have a trailing space
10909 === <!--
10910 --> <!-- -->
10911 But just in case it doesn't...
10912 !! result
10913 === <!--
10914 --> <!-- -->
10915 But just in case it doesn't...
10916 !! end
10917
10918 !! test
10919 Section replacement test (section 0)
10920 !! options
10921 replace=0,"xxx"
10922 !! input
10923 start
10924 ==a==
10925 ===aa===
10926 ====aaa====
10927 ==b==
10928 ===ba===
10929 ===bb===
10930 ====bba====
10931 ===bc===
10932 ==c==
10933 ===ca===
10934 !! result
10935 xxx
10936
10937 ==a==
10938 ===aa===
10939 ====aaa====
10940 ==b==
10941 ===ba===
10942 ===bb===
10943 ====bba====
10944 ===bc===
10945 ==c==
10946 ===ca===
10947 !! end
10948
10949 !! test
10950 Section replacement test (section 1)
10951 !! options
10952 replace=1,"xxx"
10953 !! input
10954 start
10955 ==a==
10956 ===aa===
10957 ====aaa====
10958 ==b==
10959 ===ba===
10960 ===bb===
10961 ====bba====
10962 ===bc===
10963 ==c==
10964 ===ca===
10965 !! result
10966 start
10967 xxx
10968
10969 ==b==
10970 ===ba===
10971 ===bb===
10972 ====bba====
10973 ===bc===
10974 ==c==
10975 ===ca===
10976 !! end
10977
10978 !! test
10979 Section replacement test (section 2)
10980 !! options
10981 replace=2,"xxx"
10982 !! input
10983 start
10984 ==a==
10985 ===aa===
10986 ====aaa====
10987 ==b==
10988 ===ba===
10989 ===bb===
10990 ====bba====
10991 ===bc===
10992 ==c==
10993 ===ca===
10994 !! result
10995 start
10996 ==a==
10997 xxx
10998
10999 ==b==
11000 ===ba===
11001 ===bb===
11002 ====bba====
11003 ===bc===
11004 ==c==
11005 ===ca===
11006 !! end
11007
11008 !! test
11009 Section replacement test (section 3)
11010 !! options
11011 replace=3,"xxx"
11012 !! input
11013 start
11014 ==a==
11015 ===aa===
11016 ====aaa====
11017 ==b==
11018 ===ba===
11019 ===bb===
11020 ====bba====
11021 ===bc===
11022 ==c==
11023 ===ca===
11024 !! result
11025 start
11026 ==a==
11027 ===aa===
11028 xxx
11029
11030 ==b==
11031 ===ba===
11032 ===bb===
11033 ====bba====
11034 ===bc===
11035 ==c==
11036 ===ca===
11037 !! end
11038
11039 !! test
11040 Section replacement test (section 4)
11041 !! options
11042 replace=4,"xxx"
11043 !! input
11044 start
11045 ==a==
11046 ===aa===
11047 ====aaa====
11048 ==b==
11049 ===ba===
11050 ===bb===
11051 ====bba====
11052 ===bc===
11053 ==c==
11054 ===ca===
11055 !! result
11056 start
11057 ==a==
11058 ===aa===
11059 ====aaa====
11060 xxx
11061
11062 ==c==
11063 ===ca===
11064 !! end
11065
11066 !! test
11067 Section replacement test (section 5)
11068 !! options
11069 replace=5,"xxx"
11070 !! input
11071 start
11072 ==a==
11073 ===aa===
11074 ====aaa====
11075 ==b==
11076 ===ba===
11077 ===bb===
11078 ====bba====
11079 ===bc===
11080 ==c==
11081 ===ca===
11082 !! result
11083 start
11084 ==a==
11085 ===aa===
11086 ====aaa====
11087 ==b==
11088 xxx
11089
11090 ===bb===
11091 ====bba====
11092 ===bc===
11093 ==c==
11094 ===ca===
11095 !! end
11096
11097 !! test
11098 Section replacement test (section 6)
11099 !! options
11100 replace=6,"xxx"
11101 !! input
11102 start
11103 ==a==
11104 ===aa===
11105 ====aaa====
11106 ==b==
11107 ===ba===
11108 ===bb===
11109 ====bba====
11110 ===bc===
11111 ==c==
11112 ===ca===
11113 !! result
11114 start
11115 ==a==
11116 ===aa===
11117 ====aaa====
11118 ==b==
11119 ===ba===
11120 xxx
11121
11122 ===bc===
11123 ==c==
11124 ===ca===
11125 !! end
11126
11127 !! test
11128 Section replacement test (section 7)
11129 !! options
11130 replace=7,"xxx"
11131 !! input
11132 start
11133 ==a==
11134 ===aa===
11135 ====aaa====
11136 ==b==
11137 ===ba===
11138 ===bb===
11139 ====bba====
11140 ===bc===
11141 ==c==
11142 ===ca===
11143 !! result
11144 start
11145 ==a==
11146 ===aa===
11147 ====aaa====
11148 ==b==
11149 ===ba===
11150 ===bb===
11151 xxx
11152
11153 ===bc===
11154 ==c==
11155 ===ca===
11156 !! end
11157
11158 !! test
11159 Section replacement test (section 8)
11160 !! options
11161 replace=8,"xxx"
11162 !! input
11163 start
11164 ==a==
11165 ===aa===
11166 ====aaa====
11167 ==b==
11168 ===ba===
11169 ===bb===
11170 ====bba====
11171 ===bc===
11172 ==c==
11173 ===ca===
11174 !! result
11175 start
11176 ==a==
11177 ===aa===
11178 ====aaa====
11179 ==b==
11180 ===ba===
11181 ===bb===
11182 ====bba====
11183 xxx
11184
11185 ==c==
11186 ===ca===
11187 !!end
11188
11189 !! test
11190 Section replacement test (section 9)
11191 !! options
11192 replace=9,"xxx"
11193 !! input
11194 start
11195 ==a==
11196 ===aa===
11197 ====aaa====
11198 ==b==
11199 ===ba===
11200 ===bb===
11201 ====bba====
11202 ===bc===
11203 ==c==
11204 ===ca===
11205 !! result
11206 start
11207 ==a==
11208 ===aa===
11209 ====aaa====
11210 ==b==
11211 ===ba===
11212 ===bb===
11213 ====bba====
11214 ===bc===
11215 xxx
11216 !! end
11217
11218 !! test
11219 Section replacement test (section 10)
11220 !! options
11221 replace=10,"xxx"
11222 !! input
11223 start
11224 ==a==
11225 ===aa===
11226 ====aaa====
11227 ==b==
11228 ===ba===
11229 ===bb===
11230 ====bba====
11231 ===bc===
11232 ==c==
11233 ===ca===
11234 !! result
11235 start
11236 ==a==
11237 ===aa===
11238 ====aaa====
11239 ==b==
11240 ===ba===
11241 ===bb===
11242 ====bba====
11243 ===bc===
11244 ==c==
11245 xxx
11246 !! end
11247
11248 !! test
11249 Section replacement test with initial whitespace (bug 13728)
11250 !! options
11251 replace=2,"xxx"
11252 !! input
11253 Preformatted initial line
11254 ==a==
11255 ===a===
11256 !! result
11257 Preformatted initial line
11258 ==a==
11259 xxx
11260 !! end
11261
11262
11263 !! test
11264 Section extraction, heading followed by pre with 20 spaces (bug 6398)
11265 !! options
11266 section=1
11267 !! input
11268 ==a==
11269 a
11270 !! result
11271 ==a==
11272 a
11273 !! end
11274
11275 !! test
11276 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
11277 !! options
11278 section=1
11279 !! input
11280 ==a==
11281 a
11282 !! result
11283 ==a==
11284 a
11285 !! end
11286
11287
11288 !! test
11289 Section extraction, <pre> around bogus header (bug 10309)
11290 !! options
11291 noxml section=2
11292 !! input
11293 == Section One ==
11294 <pre>
11295 =======
11296 </pre>
11297
11298 == Section Two ==
11299 stuff
11300 !! result
11301 == Section Two ==
11302 stuff
11303 !! end
11304
11305 !! test
11306 Section replacement, <pre> around bogus header (bug 10309)
11307 !! options
11308 noxml replace=2,"xxx"
11309 !! input
11310 == Section One ==
11311 <pre>
11312 =======
11313 </pre>
11314
11315 == Section Two ==
11316 stuff
11317 !! result
11318 == Section One ==
11319 <pre>
11320 =======
11321 </pre>
11322
11323 xxx
11324 !! end
11325
11326
11327
11328 !! test
11329 Handling of &#x0A; in URLs
11330 !! input
11331 **irc://&#x0A;a
11332 !! result
11333 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
11334 </li></ul>
11335 </li></ul>
11336
11337 !!end
11338
11339 !! test
11340 5 quotes, code coverage +1 line (php)
11341 !! options
11342 php
11343 !! input
11344 '''''
11345 !! result
11346 !! end
11347 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
11348 !! test
11349 5 quotes, code coverage +1 line (parsoid)
11350 !! options
11351 parsoid
11352 !! input
11353 '''''
11354 !! result
11355 <p><i><b></b></i></p>
11356 !! end
11357
11358 !! test
11359 Special:Search page linking.
11360 !! input
11361 {{Special:search}}
11362 !! result
11363 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
11364 </p>
11365 !! end
11366
11367 !! test
11368 Say the magic word
11369 !! input
11370 * {{PAGENAME}}
11371 * {{BASEPAGENAME}}
11372 * {{SUBPAGENAME}}
11373 * {{SUBPAGENAMEE}}
11374 * {{ROOTPAGENAME}}
11375 * {{ROOTPAGENAMEE}}
11376 * {{BASEPAGENAME}}
11377 * {{BASEPAGENAMEE}}
11378 * {{TALKPAGENAME}}
11379 * {{TALKPAGENAMEE}}
11380 * {{SUBJECTPAGENAME}}
11381 * {{SUBJECTPAGENAMEE}}
11382 * {{NAMESPACEE}}
11383 * {{NAMESPACE}}
11384 * {{TALKSPACE}}
11385 * {{TALKSPACEE}}
11386 * {{SUBJECTSPACE}}
11387 * {{SUBJECTSPACEE}}
11388 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
11389 !! result
11390 <ul><li> Parser test
11391 </li><li> Parser test
11392 </li><li> Parser test
11393 </li><li> Parser_test
11394 </li><li> Parser test
11395 </li><li> Parser_test
11396 </li><li> Parser test
11397 </li><li> Parser_test
11398 </li><li> Talk:Parser test
11399 </li><li> Talk:Parser_test
11400 </li><li> Parser test
11401 </li><li> Parser_test
11402 </li><li>
11403 </li><li>
11404 </li><li> Talk
11405 </li><li> Talk
11406 </li><li>
11407 </li><li>
11408 </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>
11409 </li></ul>
11410
11411 !! end
11412 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
11413
11414 !! test
11415 Gallery
11416 !! input
11417 <gallery>
11418 image1.png |
11419 image2.gif|||||
11420
11421 image3|
11422 image4 |300px| centre
11423 image5.svg| http://///////
11424 [[x|xx]]]]
11425 * image6
11426 </gallery>
11427 !! result
11428 <ul class="gallery">
11429 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11430 <div style="height: 150px;">Image1.png</div>
11431 <div class="gallerytext">
11432 </div>
11433 </div></li>
11434 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11435 <div style="height: 150px;">Image2.gif</div>
11436 <div class="gallerytext">
11437 <p>||||
11438 </p>
11439 </div>
11440 </div></li>
11441 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11442 <div style="height: 150px;">Image3</div>
11443 <div class="gallerytext">
11444 </div>
11445 </div></li>
11446 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11447 <div style="height: 150px;">Image4</div>
11448 <div class="gallerytext">
11449 <p>300px| centre
11450 </p>
11451 </div>
11452 </div></li>
11453 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11454 <div style="height: 150px;">Image5.svg</div>
11455 <div class="gallerytext">
11456 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
11457 </p>
11458 </div>
11459 </div></li>
11460 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11461 <div style="height: 150px;">* image6</div>
11462 <div class="gallerytext">
11463 </div>
11464 </div></li>
11465 </ul>
11466
11467 !! end
11468
11469 !! test
11470 Gallery (with options)
11471 !! input
11472 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
11473 File:Nonexistant.jpg|caption
11474 File:Nonexistant.jpg
11475 image:foobar.jpg|some '''caption''' [[Main Page]]
11476 image:foobar.jpg
11477 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
11478 </gallery>
11479 !! result
11480 <ul class="gallery" style="max-width: 226px;_width: 226px;">
11481 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
11482 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11483 <div style="height: 70px;">Nonexistant.jpg</div>
11484 <div class="gallerytext">
11485 <p>caption
11486 </p>
11487 </div>
11488 </div></li>
11489 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11490 <div style="height: 70px;">Nonexistant.jpg</div>
11491 <div class="gallerytext">
11492 </div>
11493 </div></li>
11494 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11495 <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>
11496 <div class="gallerytext">
11497 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11498 </p>
11499 </div>
11500 </div></li>
11501 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11502 <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>
11503 <div class="gallerytext">
11504 </div>
11505 </div></li>
11506 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11507 <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>
11508 <div class="gallerytext">
11509 <p>Blabla|blabla.
11510 </p>
11511 </div>
11512 </div></li>
11513 </ul>
11514
11515 !! end
11516
11517 !! test
11518 Gallery with wikitext inside caption
11519 !! input
11520 <gallery>
11521 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
11522 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
11523 </gallery>
11524 !! result
11525 <ul class="gallery">
11526 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11527 <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>
11528 <div class="gallerytext">
11529 <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>
11530 </p>
11531 </div>
11532 </div></li>
11533 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11534 <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>
11535 <div class="gallerytext">
11536 <p>This is a test template
11537 </p>
11538 </div>
11539 </div></li>
11540 </ul>
11541
11542 !! end
11543
11544 !! test
11545 gallery (with showfilename option)
11546 !! input
11547 <gallery showfilename>
11548 File:Nonexistant.jpg|caption
11549 File:Nonexistant.jpg
11550 image:foobar.jpg|some '''caption''' [[Main Page]]
11551 File:Foobar.jpg
11552 </gallery>
11553 !! result
11554 <ul class="gallery">
11555 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11556 <div style="height: 150px;">Nonexistant.jpg</div>
11557 <div class="gallerytext">
11558 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11559 caption
11560 </p>
11561 </div>
11562 </div></li>
11563 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11564 <div style="height: 150px;">Nonexistant.jpg</div>
11565 <div class="gallerytext">
11566 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11567 </p>
11568 </div>
11569 </div></li>
11570 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11571 <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>
11572 <div class="gallerytext">
11573 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11574 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11575 </p>
11576 </div>
11577 </div></li>
11578 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11579 <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>
11580 <div class="gallerytext">
11581 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11582 </p>
11583 </div>
11584 </div></li>
11585 </ul>
11586
11587 !! end
11588
11589 !! test
11590 Gallery (with namespace-less filenames)
11591 !! input
11592 <gallery>
11593 File:Nonexistant.jpg
11594 Nonexistant.jpg
11595 image:foobar.jpg
11596 foobar.jpg
11597 </gallery>
11598 !! result
11599 <ul class="gallery">
11600 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11601 <div style="height: 150px;">Nonexistant.jpg</div>
11602 <div class="gallerytext">
11603 </div>
11604 </div></li>
11605 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11606 <div style="height: 150px;">Nonexistant.jpg</div>
11607 <div class="gallerytext">
11608 </div>
11609 </div></li>
11610 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11611 <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>
11612 <div class="gallerytext">
11613 </div>
11614 </div></li>
11615 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11616 <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>
11617 <div class="gallerytext">
11618 </div>
11619 </div></li>
11620 </ul>
11621
11622 !! end
11623
11624 !! test
11625 HTML Hex character encoding (spells the word "JavaScript")
11626 !! input
11627 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
11628 !! result
11629 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
11630 </p>
11631 !! end
11632
11633 !! test
11634 HTML Hex character encoding bogus encoding (bug 26437 regression check)
11635 !! input
11636 &#xsee;&#XSEE;
11637 !! result
11638 <p>&amp;#xsee;&amp;#XSEE;
11639 </p>
11640 !! end
11641
11642 !! test
11643 HTML Hex character encoding mixed case
11644 !! input
11645 &#xEE;&#Xee;
11646 !! result
11647 <p>&#xee;&#xee;
11648 </p>
11649 !! end
11650
11651 !! test
11652 __FORCETOC__ override
11653 !! input
11654 __NEWSECTIONLINK__
11655 __FORCETOC__
11656 !! result
11657 <p><br />
11658 </p>
11659 !! end
11660
11661 !! test
11662 ISBN code coverage
11663 !! input
11664 ISBN 978-0-1234-56&#x20;789
11665 !! result
11666 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
11667 </p>
11668 !! end
11669
11670 !! test
11671 ISBN followed by 5 spaces
11672 !! input
11673 ISBN
11674 !! result
11675 <p>ISBN
11676 </p>
11677 !! end
11678
11679 !! test
11680 Double ISBN
11681 !! input
11682 ISBN ISBN 1234567890
11683 !! result
11684 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
11685 </p>
11686 !! end
11687
11688 !! test
11689 Bug 22905: <abbr> followed by ISBN followed by </a>
11690 !! input
11691 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
11692 !! result
11693 <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>
11694 </p>
11695 !! end
11696
11697 !! test
11698 Double RFC
11699 !! input
11700 RFC RFC 1234
11701 !! result
11702 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
11703 </p>
11704 !! end
11705
11706 !! test
11707 Double RFC with a wiki link
11708 !! input
11709 RFC [[RFC 1234]]
11710 !! result
11711 <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>
11712 </p>
11713 !! end
11714
11715 !! test
11716 RFC code coverage
11717 !! input
11718 RFC 983&#x20;987
11719 !! result
11720 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
11721 </p>
11722 !! end
11723
11724 !! test
11725 Centre-aligned image
11726 !! input
11727 [[Image:foobar.jpg|centre]]
11728 !! result
11729 <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>
11730
11731 !!end
11732
11733 !! test
11734 None-aligned image
11735 !! input
11736 [[Image:foobar.jpg|none]]
11737 !! result
11738 <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>
11739
11740 !!end
11741
11742 !! test
11743 Width + Height sized image (using px) (height is ignored)
11744 !! input
11745 [[Image:foobar.jpg|640x480px]]
11746 !! result
11747 <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>
11748 </p>
11749 !!end
11750
11751 !! test
11752 Width-sized image (using px, no following whitespace)
11753 !! input
11754 [[Image:foobar.jpg|640px]]
11755 !! result
11756 <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>
11757 </p>
11758 !!end
11759
11760 !! test
11761 Width-sized image (using px, with following whitespace - test regression from r39467)
11762 !! input
11763 [[Image:foobar.jpg|640px ]]
11764 !! result
11765 <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>
11766 </p>
11767 !!end
11768
11769 !! test
11770 Width-sized image (using px, with preceding whitespace - test regression from r39467)
11771 !! input
11772 [[Image:foobar.jpg| 640px]]
11773 !! result
11774 <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>
11775 </p>
11776 !!end
11777
11778 !! test
11779 Another italics / bold test
11780 !! input
11781 ''' ''x'
11782 !! result
11783 <pre>'<i> </i>x'
11784 </pre>
11785 !!end
11786
11787 # Note the results may be incorrect, as parserTest output included this:
11788 # XML error: Mismatched tag at byte 6120:
11789 # ...<dd> </dt></dl> </dd...
11790 !! test
11791 dt/dd/dl test
11792 !! options
11793 disabled
11794 !! input
11795 :;;;::
11796 !! result
11797 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
11798 </dd></dl>
11799 </dd></dl>
11800 </dt></dl>
11801 </dt></dl>
11802 </dt></dl>
11803 </dd></dl>
11804
11805 !!end
11806
11807
11808 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
11809 !! test
11810 Images with the "|" character in the comment
11811 !! input
11812 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
11813 !! result
11814 <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>
11815
11816 !!end
11817
11818 !! test
11819 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
11820 !! input
11821 <html><script>alert(1);</script></html>
11822 !! result
11823 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
11824 </p>
11825 !! end
11826
11827 !! test
11828 HTML with raw HTML ($wgRawHtml==true)
11829 !! options
11830 rawhtml
11831 !! input
11832 <html><script>alert(1);</script></html>
11833 !! result
11834 <p><script>alert(1);</script>
11835 </p>
11836 !! end
11837
11838 !! test
11839 Parents of subpages, one level up
11840 !! options
11841 subpage title=[[Subpage test/L1/L2/L3]]
11842 !! input
11843 [[../|L2]]
11844 !! result
11845 <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>
11846 </p>
11847 !! end
11848
11849
11850 !! test
11851 Parents of subpages, one level up, not named
11852 !! options
11853 subpage title=[[Subpage test/L1/L2/L3]]
11854 !! input
11855 [[../]]
11856 !! result
11857 <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>
11858 </p>
11859 !! end
11860
11861
11862
11863 !! test
11864 Parents of subpages, two levels up
11865 !! options
11866 subpage title=[[Subpage test/L1/L2/L3]]
11867 !! input
11868 [[../../|L1]]2
11869
11870 [[../../|L1]]l
11871 !! result
11872 <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
11873 </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>
11874 </p>
11875 !! end
11876
11877 !! test
11878 Parents of subpages, two levels up, without trailing slash or name.
11879 !! options
11880 subpage title=[[Subpage test/L1/L2/L3]]
11881 !! input
11882 [[../..]]
11883 !! result
11884 <p>[[../..]]
11885 </p>
11886 !! end
11887
11888 !! test
11889 Parents of subpages, two levels up, with lots of extra trailing slashes.
11890 !! options
11891 subpage title=[[Subpage test/L1/L2/L3]]
11892 !! input
11893 [[../../////]]
11894 !! result
11895 <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>
11896 </p>
11897 !! end
11898
11899 !! test
11900 Definition list code coverage
11901 !! input
11902 ; title : def
11903 ; title : def
11904 ;title: def
11905 !! result
11906 <dl><dt> title &#160;</dt><dd> def
11907 </dd><dt> title&#160;</dt><dd> def
11908 </dd><dt>title</dt><dd> def
11909 </dd></dl>
11910
11911 !! end
11912
11913 !! test
11914 Don't fall for the self-closing div
11915 !! input
11916 <div>hello world</div/>
11917 !! result
11918 <div>hello world</div>
11919
11920 !! end
11921
11922 !! test
11923 MSGNW magic word
11924 !! input
11925 {{MSGNW:msg}}
11926 !! result
11927 <p>&#91;&#91;:Template:Msg&#93;&#93;
11928 </p>
11929 !! end
11930
11931 !! test
11932 RAW magic word
11933 !! input
11934 {{RAW:QUERTY}}
11935 !! result
11936 <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>
11937 </p>
11938 !! end
11939
11940 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
11941 !! test
11942 Always escape literal '>' in output, not just after '<'
11943 !! input
11944 ><>
11945 !! result
11946 <p>&gt;&lt;&gt;
11947 </p>
11948 !! end
11949
11950 !! test
11951 Template caching
11952 !! input
11953 {{Test}}
11954 {{Test}}
11955 !! result
11956 <p>This is a test template
11957 This is a test template
11958 </p>
11959 !! end
11960
11961
11962 !! article
11963 MediaWiki:Fake
11964 !! text
11965 ==header==
11966 !! endarticle
11967
11968 !! test
11969 Inclusion of !userCanEdit() content
11970 !! input
11971 {{MediaWiki:Fake}}
11972 !! result
11973 <h2><span class="mw-headline" id="header">header</span><span class="mw-editsection">[<a href="/index.php?title=MediaWiki:Fake&amp;action=edit&amp;section=T-1" title="MediaWiki:Fake">edit</a>]</span></h2>
11974
11975 !! end
11976
11977
11978 !! test
11979 Out-of-order TOC heading levels
11980 !! input
11981 ==2==
11982 ======6======
11983 ===3===
11984 =1=
11985 =====5=====
11986 ==2==
11987 !! result
11988 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11989 <ul>
11990 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
11991 <ul>
11992 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
11993 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
11994 </ul>
11995 </li>
11996 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
11997 <ul>
11998 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
11999 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
12000 </ul>
12001 </li>
12002 </ul>
12003 </td></tr></table>
12004 <h2><span class="mw-headline" id="2">2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 2">edit</a>]</span></h2>
12005 <h6><span class="mw-headline" id="6">6</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: 6">edit</a>]</span></h6>
12006 <h3><span class="mw-headline" id="3">3</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: 3">edit</a>]</span></h3>
12007 <h1><span class="mw-headline" id="1">1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 1">edit</a>]</span></h1>
12008 <h5><span class="mw-headline" id="5">5</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: 5">edit</a>]</span></h5>
12009 <h2><span class="mw-headline" id="2_2">2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: 2">edit</a>]</span></h2>
12010
12011 !! end
12012
12013
12014 !! test
12015 ISBN with a dummy number
12016 !! input
12017 ISBN ---
12018 !! result
12019 <p>ISBN ---
12020 </p>
12021 !! end
12022
12023
12024 !! test
12025 ISBN with space-delimited number
12026 !! input
12027 ISBN 92 9017 032 8
12028 !! result
12029 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
12030 </p>
12031 !! end
12032
12033
12034 !! test
12035 ISBN with multiple spaces, no number
12036 !! input
12037 ISBN foo
12038 !! result
12039 <p>ISBN foo
12040 </p>
12041 !! end
12042
12043
12044 !! test
12045 ISBN length
12046 !! input
12047 ISBN 123456789
12048
12049 ISBN 1234567890
12050
12051 ISBN 12345678901
12052 !! result
12053 <p>ISBN 123456789
12054 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
12055 </p><p>ISBN 12345678901
12056 </p>
12057 !! end
12058
12059
12060 !! test
12061 ISBN with trailing year (bug 8110)
12062 !! input
12063 ISBN 1-234-56789-0 - 2006
12064
12065 ISBN 1 234 56789 0 - 2006
12066 !! result
12067 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
12068 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
12069 </p>
12070 !! end
12071
12072
12073 !! test
12074 anchorencode
12075 !! input
12076 {{anchorencode:foo bar©#%n}}
12077 !! result
12078 <p>foo_bar.C2.A9.23.25n
12079 </p>
12080 !! end
12081
12082 !! test
12083 anchorencode trims spaces
12084 !! input
12085 {{anchorencode: __pretty__please__}}
12086 !! result
12087 <p>pretty_please
12088 </p>
12089 !! end
12090
12091 !! test
12092 anchorencode deals with links
12093 !! input
12094 {{anchorencode: [[hello|world]] [[hi]]}}
12095 !! result
12096 <p>world_hi
12097 </p>
12098 !! end
12099
12100 !! test
12101 anchorencode deals with templates
12102 !! input
12103 {{anchorencode: {{Foo}} }}
12104 !! result
12105 <p>FOO
12106 </p>
12107 !! end
12108
12109 !! test
12110 anchorencode encodes like the TOC generator: (bug 18431)
12111 !! input
12112 === _ +:.3A%3A&&amp;]] ===
12113 {{anchorencode: _ +:.3A%3A&&amp;]] }}
12114 __NOEDITSECTION__
12115 !! result
12116 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
12117 <p>.2B:.3A.253A.26.26.5D.5D
12118 </p>
12119 !! end
12120
12121 # Expected output in the following test is not necessarily expected (there
12122 # should probably be <p> tags inside the <blockquote> in the output) -- it's
12123 # only testing for well-formedness.
12124 !! test
12125 Bug 6200: blockquotes and paragraph formatting
12126 !! input
12127 <blockquote>
12128 foo
12129 </blockquote>
12130
12131 bar
12132
12133 baz
12134 !! result
12135 <blockquote>
12136 foo
12137 </blockquote>
12138 <p>bar
12139 </p>
12140 <pre>baz
12141 </pre>
12142 !! end
12143
12144 !! test
12145 Bug 8293: Use of center tag ruins paragraph formatting
12146 !! input
12147 <center>
12148 foo
12149 </center>
12150
12151 bar
12152
12153 baz
12154 !! result
12155 <center>
12156 <p>foo
12157 </p>
12158 </center>
12159 <p>bar
12160 </p>
12161 <pre>baz
12162 </pre>
12163 !! end
12164
12165 !!test
12166 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
12167 !!options
12168 php
12169 !!input
12170 <span><s>x</span></s>
12171 !!result
12172 <p><span><s>x&lt;/span&gt;</s></span>
12173 </p>
12174 !!end
12175
12176 !!test
12177 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
12178 !!options
12179 parsoid
12180 !!input
12181 <span><s>x</span></s>
12182 !!result
12183 <p><span><s>x</s></span><s></s>
12184 </p>
12185 !!end
12186
12187 ###
12188 ### Language variants related tests
12189 ###
12190 !! test
12191 Self-link in language variants
12192 !! options
12193 title=[[Dunav]] language=sr
12194 !! input
12195 Both [[Dunav]] and [[Дунав]] are names for this river.
12196 !! result
12197 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
12198 </p>
12199 !!end
12200
12201 !! article
12202 Дуна
12203 !! text
12204 content
12205 !! endarticle
12206
12207 !! test
12208 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
12209 !! options
12210 title=[[Duna]] language=sr
12211 !! input
12212 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
12213 !! result
12214 <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.
12215 </p>
12216 !! end
12217
12218 !! test
12219 Link to pages in language variants
12220 !! options
12221 language=sr
12222 !! input
12223 Main Page can be written as [[Маин Паге]]
12224 !! result
12225 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
12226 </p>
12227 !!end
12228
12229
12230 !! test
12231 Multiple links to pages in language variants
12232 !! options
12233 language=sr
12234 !! input
12235 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
12236 !! result
12237 <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>.
12238 </p>
12239 !!end
12240
12241
12242 !! test
12243 Simple template in language variants
12244 !! options
12245 language=sr
12246 !! input
12247 {{тест}}
12248 !! result
12249 <p>This is a test template
12250 </p>
12251 !! end
12252
12253
12254 !! test
12255 Template with explicit namespace in language variants
12256 !! options
12257 language=sr
12258 !! input
12259 {{Template:тест}}
12260 !! result
12261 <p>This is a test template
12262 </p>
12263 !! end
12264
12265
12266 !! test
12267 Basic test for template parameter in language variants
12268 !! options
12269 language=sr
12270 !! input
12271 {{парамтест|param=foo}}
12272 !! result
12273 <p>This is a test template with parameter foo
12274 </p>
12275 !! end
12276
12277
12278 !! test
12279 Simple category in language variants
12280 !! options
12281 language=sr cat
12282 !! input
12283 [[Category:МедиаWики Усер'с Гуиде]]
12284 !! result
12285 <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>
12286 !! end
12287
12288
12289 !! article
12290 Category:分类
12291 !! text
12292 blah
12293 !! endarticle
12294
12295 !! article
12296 Category:分類
12297 !! text
12298 blah
12299 !! endarticle
12300
12301 !! test
12302 Don't convert blue categorylinks to another variant (bug 33210)
12303 !! options
12304 language=zh cat
12305 !! input
12306 [[A]][[Category:分类]]
12307 !! result
12308 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
12309 !! end
12310
12311
12312 !! test
12313 Stripping -{}- tags (language variants)
12314 !! options
12315 language=sr
12316 !! input
12317 Latin proverb: -{Ne nuntium necare}-
12318 !! result
12319 <p>Latin proverb: Ne nuntium necare
12320 </p>
12321 !! end
12322
12323
12324 !! test
12325 Prevent conversion with -{}- tags (language variants)
12326 !! options
12327 language=sr variant=sr-ec
12328 !! input
12329 Latinski: -{Ne nuntium necare}-
12330 !! result
12331 <p>Латински: Ne nuntium necare
12332 </p>
12333 !! end
12334
12335
12336 !! test
12337 Prevent conversion of text with -{}- tags (language variants)
12338 !! options
12339 language=sr variant=sr-ec
12340 !! input
12341 Latinski: -{Ne nuntium necare}-
12342 !! result
12343 <p>Латински: Ne nuntium necare
12344 </p>
12345 !! end
12346
12347
12348 !! test
12349 Prevent conversion of links with -{}- tags (language variants)
12350 !! options
12351 language=sr variant=sr-ec
12352 !! input
12353 -{[[Main Page]]}-
12354 !! result
12355 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12356 </p>
12357 !! end
12358
12359
12360 !! test
12361 -{}- tags within headlines (within html for parserConvert())
12362 !! options
12363 language=sr variant=sr-ec
12364 !! input
12365 == -{Naslov}- ==
12366 !! result
12367 <h2><span class="mw-headline" id="-.7BNaslov.7D-">Naslov</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Уредите одељак „Naslov“">уреди</a>]</span></h2>
12368
12369 !! end
12370
12371
12372 !! test
12373 Explicit definition of language variant alternatives
12374 !! options
12375 language=zh variant=zh-tw
12376 !! input
12377 -{zh:China;zh-tw:Taiwan}-, not China
12378 !! result
12379 <p>Taiwan, not China
12380 </p>
12381 !! end
12382
12383
12384 !! test
12385 Conversion around HTML tags
12386 !! options
12387 language=sr variant=sr-ec
12388 !! input
12389 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
12390 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
12391 !! result
12392 <p>
12393 <span title="ЛаCтин">ски</span>
12394 </p>
12395 !! end
12396
12397
12398 !! test
12399 Explicit session-wise language variant mapping (A flag and - flag)
12400 !! options
12401 language=zh variant=zh-tw
12402 !! input
12403 Taiwan is not China.
12404 But -{A|zh:China;zh-tw:Taiwan}- is China,
12405 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
12406 and -{China}- is China.
12407 !! result
12408 <p>Taiwan is not China.
12409 But Taiwan is Taiwan,
12410 (This should be stripped!)
12411 and China is China.
12412 </p>
12413 !! end
12414
12415 !! test
12416 Explicit session-wise language variant mapping (H flag for hide)
12417 !! options
12418 language=zh variant=zh-tw
12419 !! input
12420 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
12421 Taiwan is China.
12422 !! result
12423 <p>(This should be stripped!)
12424 Taiwan is Taiwan.
12425 </p>
12426 !! end
12427
12428 !! test
12429 Adding explicit conversion rule for title (T flag)
12430 !! options
12431 language=zh variant=zh-tw showtitle
12432 !! input
12433 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12434 !! result
12435 Taiwan
12436 <p>Should be stripped!
12437 </p>
12438 !! end
12439
12440 !! test
12441 Testing that changing the language variant here in the tests actually works
12442 !! options
12443 language=zh variant=zh showtitle
12444 !! input
12445 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12446 !! result
12447 China
12448 <p>Should be stripped!
12449 </p>
12450 !! end
12451
12452 !! test
12453 Recursive conversion of alt and title attrs shouldn't clear converter state
12454 !! options
12455 language=zh variant=zh-cn showtitle
12456 !! input
12457 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
12458 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
12459 !! result
12460 China
12461 <p>
12462 Should be stripped<span title="Exclamation">!</span>
12463 </p>
12464 !! end
12465
12466 !! test
12467 Bug 24072: more test on conversion rule for title
12468 !! options
12469 language=zh variant=zh-tw showtitle
12470 !! input
12471 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12472 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
12473 !! result
12474 Taiwan
12475 <p>This should be stripped!
12476 This won't take interferes with the title rule.
12477 </p>
12478 !! end
12479
12480 !! test
12481 Partly disable title conversion if variant == main language code
12482 !! options
12483 language=zh variant=zh title=[[ZH]] showtitle
12484 !! input
12485 -{T|zh-cn:CN;zh-tw:TW}-
12486 !! result
12487 ZH
12488 <p>
12489 </p>
12490 !! end
12491
12492 !! test
12493 Partly disable title conversion if variant == main language code, more
12494 !! options
12495 language=zh variant=zh title=[[ZH]] showtitle
12496 !! input
12497 -{T|TW}-
12498 !! result
12499 ZH
12500 <p>
12501 </p>
12502 !! end
12503
12504 !! test
12505 Raw output of variant escape tags (R flag)
12506 !! options
12507 language=zh variant=zh-tw
12508 !! input
12509 Raw: -{R|zh:China;zh-tw:Taiwan}-
12510 !! result
12511 <p>Raw: zh:China;zh-tw:Taiwan
12512 </p>
12513 !! end
12514
12515 !! test
12516 Nested using of manual convert syntax
12517 !! options
12518 language=zh variant=zh-hk
12519 !! input
12520 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
12521 !! result
12522 <p>Nested: Hello Hong Kong!
12523 </p>
12524 !! end
12525
12526 !! test
12527 Proper conversion of text in external links
12528 !! options
12529 language=sr variant=sr-ec
12530 !! input
12531 http://www.google.com
12532 gopher://www.google.com
12533 [http://www.google.com http://www.google.com]
12534 [gopher://www.google.com gopher://www.google.com]
12535 [https://www.google.com irc://www.google.com]
12536 [ftp://www.google.com www.google.com/ftp://dir]
12537 [//www.google.com www.google.com]
12538 !! result
12539 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12540 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12541 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12542 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12543 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
12544 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
12545 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
12546 </p>
12547 !! end
12548
12549 !! test
12550 Do not convert roman numbers to language variants
12551 !! options
12552 language=sr variant=sr-ec
12553 !! input
12554 Fridrih IV je car.
12555 !! result
12556 <p>Фридрих IV је цар.
12557 </p>
12558 !! end
12559
12560 !! test
12561 Unclosed language converter markup "-{"
12562 !! options
12563 language=sr
12564 !! input
12565 -{T|hello
12566 !! result
12567 <p>-{T|hello
12568 </p>
12569 !! end
12570
12571 !! test
12572 Don't convert raw rule "-{R|=&gt;}-" to "=>"
12573 !! options
12574 language=sr
12575 !! input
12576 -{R|=&gt;}-
12577 !! result
12578 <p>=&gt;
12579 </p>
12580 !!end
12581
12582 !!article
12583 Template:Bullet
12584 !!text
12585 * Bar
12586 !!endarticle
12587
12588 !! test
12589 Bug 529: Uncovered bullet
12590 !! input
12591 * Foo {{bullet}}
12592 !! result
12593 <ul><li> Foo
12594 </li><li> Bar
12595 </li></ul>
12596
12597 !! end
12598
12599 # Plain MediaWiki does not remove empty lists, but tidy actually does.
12600 # Templates in Wikipedia rely on this behavior, as tidy has always been
12601 # enabled there. These tests are normally run *without* tidy, so specify the
12602 # full output here.
12603 # To test realistic parsing behavior, apply a tidy-like transformation to both
12604 # the expected output and your parser's output.
12605 !! test
12606 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
12607 !! input
12608 ******* Foo {{bullet}}
12609 !! result
12610 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
12611 </li></ul>
12612 </li></ul>
12613 </li></ul>
12614 </li></ul>
12615 </li></ul>
12616 </li></ul>
12617 </li><li> Bar
12618 </li></ul>
12619
12620 !! end
12621
12622 !! test
12623 Bug 529: Uncovered table already at line-start
12624 !! input
12625 x
12626
12627 {{table}}
12628 y
12629 !! result
12630 <p>x
12631 </p>
12632 <table>
12633 <tr>
12634 <td> 1 </td>
12635 <td> 2
12636 </td></tr>
12637 <tr>
12638 <td> 3 </td>
12639 <td> 4
12640 </td></tr></table>
12641 <p>y
12642 </p>
12643 !! end
12644
12645 !! test
12646 Bug 529: Uncovered bullet in parser function result
12647 !! input
12648 * Foo {{lc:{{bullet}} }}
12649 !! result
12650 <ul><li> Foo
12651 </li><li> bar
12652 </li></ul>
12653
12654 !! end
12655
12656 !! test
12657 Bug 5678: Double-parsed template argument
12658 !! input
12659 {{lc:{{{1}}}|hello}}
12660 !! result
12661 <p>{{{1}}}
12662 </p>
12663 !! end
12664
12665 !! test
12666 Bug 5678: Double-parsed template invocation
12667 !! input
12668 {{lc:{{paramtest {{!}} param = hello }} }}
12669 !! result
12670 <p>{{paramtest | param = hello }}
12671 </p>
12672 !! end
12673
12674 !! test
12675 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
12676 !! options
12677 language=cs
12678 title=[[Main Page]]
12679 !! input
12680 {{PRVNÍVELKÉ:ěščř}}
12681 {{prvnívelké:ěščř}}
12682 {{PRVNÍMALÉ:ěščř}}
12683 {{prvnímalé:ěščř}}
12684 {{MALÁ:ěščř}}
12685 {{malá:ěščř}}
12686 {{VELKÁ:ěščř}}
12687 {{velká:ěščř}}
12688 !! result
12689 <p>Ěščř
12690 Ěščř
12691 ěščř
12692 ěščř
12693 ěščř
12694 ěščř
12695 ĚŠČŘ
12696 ĚŠČŘ
12697 </p>
12698 !! end
12699
12700 !! test
12701 Morwen/13: Unclosed link followed by heading
12702 !! input
12703 [[link
12704 ==heading==
12705 !! result
12706 <p>[[link
12707 </p>
12708 <h2><span class="mw-headline" id="heading">heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span></h2>
12709
12710 !! end
12711
12712 !! test
12713 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
12714 !! input
12715 {{foo|
12716 =heading=
12717 !! result
12718 <p>{{foo|
12719 </p>
12720 <h1><span class="mw-headline" id="heading">heading</span></h1>
12721
12722 !! end
12723
12724 !! test
12725 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
12726 !! input
12727 {{foo|
12728 ==heading==
12729 !! result
12730 <p>{{foo|
12731 </p>
12732 <h2><span class="mw-headline" id="heading">heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span></h2>
12733
12734 !! end
12735
12736 !! test
12737 Tildes in comments
12738 !! options
12739 pst
12740 !! input
12741 <!-- ~~~~ -->
12742 !! result
12743 <!-- ~~~~ -->
12744 !! end
12745
12746 !! test
12747 Paragraphs inside divs (no extra line breaks)
12748 !! input
12749 <div>Line one
12750
12751 Line two</div>
12752 !! result
12753 <div>Line one
12754 Line two</div>
12755
12756 !! end
12757
12758 !! test
12759 Paragraphs inside divs (extra line break on open)
12760 !! input
12761 <div>
12762 Line one
12763
12764 Line two</div>
12765 !! result
12766 <div>
12767 <p>Line one
12768 </p>
12769 Line two</div>
12770
12771 !! end
12772
12773 !! test
12774 Paragraphs inside divs (extra line break on close)
12775 !! input
12776 <div>Line one
12777
12778 Line two
12779 </div>
12780 !! result
12781 <div>Line one
12782 <p>Line two
12783 </p>
12784 </div>
12785
12786 !! end
12787
12788 !! test
12789 Paragraphs inside divs (extra line break on open and close)
12790 !! input
12791 <div>
12792 Line one
12793
12794 Line two
12795 </div>
12796 !! result
12797 <div>
12798 <p>Line one
12799 </p><p>Line two
12800 </p>
12801 </div>
12802
12803 !! end
12804
12805 !! test
12806 Nesting tags, paragraphs on lines which begin with <div>
12807 !! options
12808 disabled
12809 !! input
12810 <div></div><strong>A
12811 B</strong>
12812 !! result
12813 <div></div>
12814 <p><strong>A
12815 B</strong>
12816 </p>
12817 !! end
12818
12819 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
12820 !! test
12821 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
12822 !! options
12823 disabled
12824 !! input
12825 <blockquote>Line one
12826
12827 Line two</blockquote>
12828 !! result
12829 <blockquote>Line one
12830 Line two</blockquote>
12831
12832 !! end
12833
12834 !! test
12835 Bug 6200: paragraphs inside blockquotes (extra line break on open)
12836 !! options
12837 disabled
12838 !! input
12839 <blockquote>
12840 Line one
12841
12842 Line two</blockquote>
12843 !! result
12844 <blockquote>
12845 <p>Line one
12846 </p>
12847 Line two</blockquote>
12848
12849 !! end
12850
12851 !! test
12852 Bug 6200: paragraphs inside blockquotes (extra line break on close)
12853 !! options
12854 disabled
12855 !! input
12856 <blockquote>Line one
12857
12858 Line two
12859 </blockquote>
12860 !! result
12861 <blockquote>Line one
12862 <p>Line two
12863 </p>
12864 </blockquote>
12865
12866 !! end
12867
12868 !! test
12869 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
12870 !! options
12871 disabled
12872 !! input
12873 <blockquote>
12874 Line one
12875
12876 Line two
12877 </blockquote>
12878 !! result
12879 <blockquote>
12880 <p>Line one
12881 </p><p>Line two
12882 </p>
12883 </blockquote>
12884
12885 !! end
12886
12887 !! test
12888 Paragraphs inside blockquotes/divs (no extra line breaks)
12889 !! input
12890 <blockquote><div>Line one
12891
12892 Line two</div></blockquote>
12893 !! result
12894 <blockquote><div>Line one
12895 Line two</div></blockquote>
12896
12897 !! end
12898
12899 !! test
12900 Paragraphs inside blockquotes/divs (extra line break on open)
12901 !! input
12902 <blockquote><div>
12903 Line one
12904
12905 Line two</div></blockquote>
12906 !! result
12907 <blockquote><div>
12908 <p>Line one
12909 </p>
12910 Line two</div></blockquote>
12911
12912 !! end
12913
12914 !! test
12915 Paragraphs inside blockquotes/divs (extra line break on close)
12916 !! input
12917 <blockquote><div>Line one
12918
12919 Line two
12920 </div></blockquote>
12921 !! result
12922 <blockquote><div>Line one
12923 <p>Line two
12924 </p>
12925 </div></blockquote>
12926
12927 !! end
12928
12929 !! test
12930 Paragraphs inside blockquotes/divs (extra line break on open and close)
12931 !! input
12932 <blockquote><div>
12933 Line one
12934
12935 Line two
12936 </div></blockquote>
12937 !! result
12938 <blockquote><div>
12939 <p>Line one
12940 </p><p>Line two
12941 </p>
12942 </div></blockquote>
12943
12944 !! end
12945
12946 !! test
12947 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
12948 !! options
12949 wgLinkHolderBatchSize=0
12950 !! input
12951 [[meatball:1]]
12952 [[meatball:2]]
12953 [[meatball:3]]
12954 !! result
12955 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
12956 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
12957 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
12958 </p>
12959 !! end
12960
12961 !! test
12962 Free external link invading image caption
12963 !! input
12964 [[Image:Foobar.jpg|thumb|http://x|hello]]
12965 !! result
12966 <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>
12967
12968 !! end
12969
12970 !! test
12971 Bug 15196: localised external link numbers
12972 !! options
12973 language=fa
12974 !! input
12975 [http://en.wikipedia.org/]
12976 !! result
12977 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
12978 </p>
12979 !! end
12980
12981 !! test
12982 Multibyte character in padleft
12983 !! input
12984 {{padleft:-Hello|7|Æ}}
12985 !! result
12986 <p>Æ-Hello
12987 </p>
12988 !! end
12989
12990 !! test
12991 Multibyte character in padright
12992 !! input
12993 {{padright:Hello-|7|Æ}}
12994 !! result
12995 <p>Hello-Æ
12996 </p>
12997 !! end
12998
12999 !!test
13000 formatdate parser function
13001 !!input
13002 {{#formatdate:2009-03-24}}
13003 !! result
13004 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
13005 </p>
13006 !! end
13007
13008 !!test
13009 formatdate parser function, with default format
13010 !!input
13011 {{#formatdate:2009-03-24|mdy}}
13012 !! result
13013 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
13014 </p>
13015 !! end
13016
13017 !! test
13018 Spacing of numbers in formatted dates
13019 !! input
13020 {{#formatdate:January 15}}
13021 !! result
13022 <p><span class="mw-formatted-date" title="01-15">January 15</span>
13023 </p>
13024 !! end
13025
13026 !! test
13027 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
13028 !! options
13029 language=nl title=[[MediaWiki:Common.css]]
13030 !! input
13031 {{#formatdate:2009-03-24|dmy}}
13032 !! result
13033 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
13034 </p>
13035 !! end
13036
13037 #
13038 #
13039 #
13040
13041 #
13042 # Edit comments
13043 #
13044
13045 !! test
13046 Edit comment with link
13047 !! options
13048 comment
13049 !! input
13050 I like the [[Main Page]] a lot
13051 !! result
13052 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
13053 !!end
13054
13055 !! test
13056 Edit comment with link and link text
13057 !! options
13058 comment
13059 !! input
13060 I like the [[Main Page|best pages]] a lot
13061 !! result
13062 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13063 !!end
13064
13065 !! test
13066 Edit comment with link and link text with suffix
13067 !! options
13068 comment
13069 !! input
13070 I like the [[Main Page|best page]]s a lot
13071 !! result
13072 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13073 !!end
13074
13075 !! test
13076 Edit comment with section link (non-local, eg in history list)
13077 !! options
13078 comment title=[[Main Page]]
13079 !! input
13080 /* External links */ removed bogus entries
13081 !! result
13082 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13083 !!end
13084
13085 !! test
13086 Edit comment with section link and text before it (non-local, eg in history list)
13087 !! options
13088 comment title=[[Main Page]]
13089 !! input
13090 pre-comment text /* External links */ removed bogus entries
13091 !! result
13092 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>
13093 !!end
13094
13095 !! test
13096 Edit comment with section link (local, eg in diff view)
13097 !! options
13098 comment local title=[[Main Page]]
13099 !! input
13100 /* External links */ removed bogus entries
13101 !! result
13102 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13103 !!end
13104
13105 !! test
13106 Edit comment with subpage link (bug 14080)
13107 !! options
13108 comment
13109 subpage
13110 title=[[Subpage test]]
13111 !! input
13112 Poked at a [[/subpage]] here...
13113 !! result
13114 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
13115 !!end
13116
13117 !! test
13118 Edit comment with subpage link and link text (bug 14080)
13119 !! options
13120 comment
13121 subpage
13122 title=[[Subpage test]]
13123 !! input
13124 Poked at a [[/subpage|neat little page]] here...
13125 !! result
13126 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
13127 !!end
13128
13129 !! test
13130 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
13131 !! options
13132 comment
13133 title=[[Subpage test]]
13134 !! input
13135 Poked at a [[/subpage]] here...
13136 !! result
13137 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...
13138 !!end
13139
13140 !! test
13141 Edit comment with bare anchor link (local, as on diff)
13142 !! options
13143 comment
13144 local
13145 title=[[Main Page]]
13146 !!input
13147 [[#section]]
13148 !! result
13149 <a href="#section">#section</a>
13150 !! end
13151
13152 !! test
13153 Edit comment with bare anchor link (non-local, as on history)
13154 !! options
13155 comment
13156 title=[[Main Page]]
13157 !!input
13158 [[#section]]
13159 !! result
13160 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
13161 !! end
13162
13163 !! test
13164 Anchor starting with underscore
13165 !!input
13166 [[#_ref|One]]
13167 !! result
13168 <p><a href="#_ref">One</a>
13169 </p>
13170 !! end
13171
13172 !! test
13173 Id starting with underscore
13174 !!input
13175 <div id="_ref"></div>
13176 !! result
13177 <div id="_ref"></div>
13178
13179 !! end
13180
13181 !! test
13182 Space normalisation on autocomment (bug 22784)
13183 !! options
13184 comment
13185 title=[[Main Page]]
13186 !!input
13187 /* __hello__world__ */
13188 !! result
13189 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
13190 !! end
13191
13192 !! test
13193 percent-encoding and + signs in comments (Bug 26410)
13194 !! options
13195 comment
13196 !!input
13197 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
13198 !! result
13199 <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>
13200 !! end
13201
13202 !! test
13203 Bad images - basic functionality
13204 !! options
13205 disabled
13206 !! input
13207 [[File:Bad.jpg]]
13208 !! result
13209 !! end
13210
13211 !! test
13212 Bad images - bug 16039: text after bad image disappears
13213 !! options
13214 disabled
13215 !! input
13216 Foo bar
13217 [[File:Bad.jpg]]
13218 Bar foo
13219 !! result
13220 <p>Foo bar
13221 </p><p>Bar foo
13222 </p>
13223 !! end
13224
13225 !! test
13226 Verify that displaytitle works (bug #22501) no displaytitle
13227 !! options
13228 showtitle
13229 !! config
13230 wgAllowDisplayTitle=true
13231 wgRestrictDisplayTitle=false
13232 !! input
13233 this is not the the title
13234 !! result
13235 Parser test
13236 <p>this is not the the title
13237 </p>
13238 !! end
13239
13240 !! test
13241 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
13242 !! options
13243 showtitle
13244 title=[[Screen]]
13245 !! config
13246 wgAllowDisplayTitle=true
13247 wgRestrictDisplayTitle=false
13248 !! input
13249 this is not the the title
13250 {{DISPLAYTITLE:whatever}}
13251 !! result
13252 whatever
13253 <p>this is not the the title
13254 </p>
13255 !! end
13256
13257 !! test
13258 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
13259 !! options
13260 showtitle
13261 title=[[Screen]]
13262 !! config
13263 wgAllowDisplayTitle=true
13264 wgRestrictDisplayTitle=true
13265 !! input
13266 this is not the the title
13267 {{DISPLAYTITLE:whatever}}
13268 !! result
13269 Screen
13270 <p>this is not the the title
13271 </p>
13272 !! end
13273
13274 !! test
13275 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
13276 !! options
13277 showtitle
13278 title=[[Screen]]
13279 !! config
13280 wgAllowDisplayTitle=true
13281 wgRestrictDisplayTitle=true
13282 !! input
13283 this is not the the title
13284 {{DISPLAYTITLE:screen}}
13285 !! result
13286 screen
13287 <p>this is not the the title
13288 </p>
13289 !! end
13290
13291 !! test
13292 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
13293 !! options
13294 showtitle
13295 title=[[Screen]]
13296 !! config
13297 wgAllowDisplayTitle=false
13298 !! input
13299 this is not the the title
13300 {{DISPLAYTITLE:screen}}
13301 !! result
13302 Screen
13303 <p>this is not the the title
13304 <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>
13305 </p>
13306 !! end
13307
13308 !! test
13309 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
13310 !! options
13311 showtitle
13312 title=[[Screen]]
13313 !! config
13314 wgAllowDisplayTitle=false
13315 !! input
13316 this is not the the title
13317 !! result
13318 Screen
13319 <p>this is not the the title
13320 </p>
13321 !! end
13322
13323 !! test
13324 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
13325 !! options
13326 showtitle
13327 title=[[Screen]]
13328 !! config
13329 wgAllowDisplayTitle=true
13330 wgRestrictDisplayTitle=true
13331 !! input
13332 this is not the the title
13333 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
13334 !! result
13335 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
13336 <p>this is not the the title
13337 </p>
13338 !! end
13339
13340 !! test
13341 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
13342 !! options
13343 showtitle
13344 title=[[Screen]]
13345 !! config
13346 wgAllowDisplayTitle=true
13347 wgRestrictDisplayTitle=true
13348 !! input
13349 this is not the the title
13350 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
13351 !! result
13352 <span style="color: red;">s</span>creen
13353 <p>this is not the the title
13354 </p>
13355 !! end
13356
13357 !! test
13358 preload: check <noinclude> and <includeonly>
13359 !! options
13360 preload
13361 !! input
13362 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
13363 !! result
13364 Hello kind world.
13365 !! end
13366
13367 !! test
13368 preload: check <onlyinclude>
13369 !! options
13370 preload
13371 !! input
13372 Goodbye <onlyinclude>Hello world</onlyinclude>
13373 !! result
13374 Hello world
13375 !! end
13376
13377 !! test
13378 preload: can pass tags through if we want to
13379 !! options
13380 preload
13381 !! input
13382 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
13383 !! result
13384 <includeonly>Hello world</includeonly>
13385 !! end
13386
13387 !! test
13388 preload: check that it doesn't try to do tricks
13389 !! options
13390 preload
13391 !! input
13392 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13393 !! result
13394 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13395 !! end
13396
13397 !! test
13398 Play a bit with r67090 and bug 3158
13399 !! options
13400 disabled
13401 !! input
13402 <div style="width:50% !important">&nbsp;</div>
13403 <div style="width:50%&nbsp;!important">&nbsp;</div>
13404 <div style="width:50%&#160;!important">&nbsp;</div>
13405 <div style="border : solid;">&nbsp;</div>
13406 !! result
13407 <div style="width:50% !important">&nbsp;</div>
13408 <div style="width:50% !important">&nbsp;</div>
13409 <div style="width:50% !important">&nbsp;</div>
13410 <div style="border&#160;: solid;">&nbsp;</div>
13411
13412 !! end
13413
13414 !! test
13415 HTML5 data attributes
13416 !! input
13417 <span data-foo="bar">Baz</span>
13418 <p data-abc-def_hij="">Quuz</p>
13419 !! result
13420 <p><span data-foo="bar">Baz</span>
13421 </p>
13422 <p data-abc-def_hij="">Quuz</p>
13423
13424 !! end
13425
13426 !! test
13427 percent-encoding and + signs in internal links (Bug 26410)
13428 !! input
13429 [[User:+%]] [[Page+title%]]
13430 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
13431 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
13432 [[%33%45]] [[%33%45+]]
13433 !! result
13434 <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>
13435 <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>
13436 <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>
13437 <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>
13438 </p>
13439 !! end
13440
13441 !! test
13442 Special characters in embedded file links (bug 27679)
13443 !! input
13444 [[File:Contains & ampersand.jpg]]
13445 [[File:Does not exist.jpg|Title with & ampersand]]
13446 !! result
13447 <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>
13448 <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>
13449 </p>
13450 !! end
13451
13452
13453 !! test
13454 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
13455 !! input
13456 Text&apos;s been normalized?
13457 !! result
13458 <p>Text&#39;s been normalized?
13459 </p>
13460 !! end
13461
13462 !! test
13463 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
13464 !! input
13465 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
13466 !! result
13467 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
13468 </p>
13469 !! end
13470
13471 !! test
13472 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
13473 !! input
13474 [http://www.example.org/ ideograms]
13475 !! result
13476 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
13477 </p>
13478 !! end
13479
13480 !! test
13481 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
13482 !! input
13483 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
13484 !! result
13485 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
13486 </p>
13487 !! end
13488
13489 !! article
13490 Mediawiki:loop1
13491 !! text
13492 {{Identical|A}}
13493 !! endarticle
13494
13495 !! article
13496 Mediawiki:loop2
13497 !! text
13498 {{Identical|B}}
13499 !! endarticle
13500
13501 !! article
13502 Template:Identical
13503 !! text
13504 {{int:loop1}}
13505 {{int:loop2}}
13506 !! endarticle
13507
13508 !! test
13509 Bug 31098 Template which includes system messages which includes the template
13510 !! input
13511 {{Identical}}
13512 !! result
13513 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13514 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13515 </p>
13516 !! end
13517
13518 !! test
13519 Bug31490 Turkish: ucfirst 'blah'
13520 !! options
13521 language=tr
13522 !! input
13523 {{ucfirst:blah}}
13524 !! result
13525 <p>Blah
13526 </p>
13527 !! end
13528
13529 !! test
13530 Bug31490 Turkish: ucfirst 'ix'
13531 !! options
13532 language=tr
13533 !! input
13534 {{ucfirst:ix}}
13535 !! result
13536 <p>İx
13537 </p>
13538 !! end
13539
13540 !! test
13541 Bug31490 Turkish: lcfirst 'BLAH'
13542 !! options
13543 language=tr
13544 !! input
13545 {{lcfirst:BLAH}}
13546 !! result
13547 <p>bLAH
13548 </p>
13549 !! end
13550
13551 !! test
13552 Bug31490 Turkish: ucfırst (with a dotless i)
13553 !! options
13554 language=tr
13555 !! input
13556 {{ucfırst:blah}}
13557 !! result
13558 <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>
13559 </p>
13560 !! end
13561
13562 !! test
13563 Bug31490 ucfırst (with a dotless i) with English language
13564 !! options
13565 language=en
13566 !! input
13567 {{ucfırst:blah}}
13568 !! result
13569 <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>
13570 </p>
13571 !! end
13572
13573 !! test
13574 Bug 26375: TOC with italics
13575 !! options
13576 title=[[Main Page]]
13577 !! input
13578 __TOC__
13579 == ''Lost'' episodes ==
13580 !! result
13581 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13582 <ul>
13583 <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>
13584 </ul>
13585 </td></tr></table>
13586 <h2><span class="mw-headline" id="Lost_episodes"><i>Lost</i> episodes</span><span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Lost episodes">edit</a>]</span></h2>
13587
13588 !! end
13589
13590 !! test
13591 Bug 26375: TOC with bold
13592 !! options
13593 title=[[Main Page]]
13594 !! input
13595 __TOC__
13596 == '''should be bold''' then normal text ==
13597 !! result
13598 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13599 <ul>
13600 <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>
13601 </ul>
13602 </td></tr></table>
13603 <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">[<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></h2>
13604
13605 !! end
13606
13607 !! test
13608 Bug 33845: Headings become cursive in TOC when they contain an image
13609 !! options
13610 title=[[Main Page]]
13611 !! input
13612 __TOC__
13613 == Image [[Image:foobar.jpg]] ==
13614 !! result
13615 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13616 <ul>
13617 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
13618 </ul>
13619 </td></tr></table>
13620 <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">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Image">edit</a>]</span></h2>
13621
13622 !! end
13623
13624 !! test
13625 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
13626 !! options
13627 title=[[Main Page]]
13628 !! input
13629 __TOC__
13630 == <blockquote>Quote</blockquote> ==
13631 !! result
13632 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13633 <ul>
13634 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
13635 </ul>
13636 </td></tr></table>
13637 <h2><span class="mw-headline" id="Quote"><blockquote>Quote</blockquote></span><span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Quote">edit</a>]</span></h2>
13638
13639 !! end
13640
13641 !! test
13642 Unclosed tags in TOC
13643 !! options
13644 title=[[Main Page]]
13645 !! input
13646 __TOC__
13647 == Proof: 2 < 3 ==
13648 <small>Hanc marginis exiguitas non caperet.</small>
13649 QED
13650 !! result
13651 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13652 <ul>
13653 <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>
13654 </ul>
13655 </td></tr></table>
13656 <h2><span class="mw-headline" id="Proof:_2_.3C_3">Proof: 2 &lt; 3</span><span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Proof: 2 &lt; 3">edit</a>]</span></h2>
13657 <p><small>Hanc marginis exiguitas non caperet.</small>
13658 QED
13659 </p>
13660 !! end
13661
13662 !! test
13663 Multiple tags in TOC
13664 !! input
13665 __TOC__
13666 == <i>Foo</i> <b>Bar</b> ==
13667
13668 == <i>Foo</i> <blockquote>Bar</blockquote> ==
13669 !! result
13670 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13671 <ul>
13672 <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>
13673 <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>
13674 </ul>
13675 </td></tr></table>
13676 <h2><span class="mw-headline" id="Foo_Bar"><i>Foo</i> <b>Bar</b></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo Bar">edit</a>]</span></h2>
13677 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i> <blockquote>Bar</blockquote></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a>]</span></h2>
13678
13679 !! end
13680
13681 !! test
13682 Tags with parameters in TOC
13683 !! input
13684 __TOC__
13685 == <sup class="in-h2">Hello</sup> ==
13686
13687 == <sup class="a > b">Evilbye</sup> ==
13688 !! result
13689 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13690 <ul>
13691 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
13692 <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>
13693 </ul>
13694 </td></tr></table>
13695 <h2><span class="mw-headline" id="Hello"><sup class="in-h2">Hello</sup></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Hello">edit</a>]</span></h2>
13696 <h2><span class="mw-headline" id="b.22.3EEvilbye"><sup> b"&gt;Evilbye</sup></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b&quot;>Evilbye">edit</a>]</span></h2>
13697
13698 !! end
13699
13700 !! test
13701 span tags with directionality in TOC
13702 !! input
13703 __TOC__
13704 == <span dir="ltr">C++</span> ==
13705
13706 == <span dir="rtl">זבנג!</span> ==
13707
13708 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
13709
13710 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
13711
13712 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
13713 !! result
13714 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13715 <ul>
13716 <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>
13717 <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>
13718 <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>
13719 <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>
13720 <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>
13721 </ul>
13722 </td></tr></table>
13723 <h2><span class="mw-headline" id="C.2B.2B"><span dir="ltr">C++</span></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: C++">edit</a>]</span></h2>
13724 <h2><span class="mw-headline" id=".D7.96.D7.91.D7.A0.D7.92.21"><span dir="rtl">זבנג!</span></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: זבנג!">edit</a>]</span></h2>
13725 <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">[<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></h2>
13726 <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">[<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></h2>
13727 <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">[<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></h2>
13728
13729 !! end
13730
13731 !! article
13732 MediaWiki:Bug32057
13733 !! text
13734 == {{int:headline_sample}} ==
13735 !! endarticle
13736
13737 !! test
13738 Bug 32057: Title needed when expanding <h> nodes.
13739 !! options
13740 title=[[Main Page]]
13741 !! input
13742 {{int:Bug32057}}
13743 !! result
13744 <h2><span class="mw-headline" id="Headline_text">Headline text</span><span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Headline text">edit</a>]</span></h2>
13745
13746 !! end
13747
13748 !! test
13749 Strip marker in urlencode
13750 !! input
13751 {{urlencode:x<nowiki/>y}}
13752 {{urlencode:x<nowiki/>y|wiki}}
13753 {{urlencode:x<nowiki/>y|path}}
13754 !! result
13755 <p>xy
13756 xy
13757 xy
13758 </p>
13759 !! end
13760
13761 !! test
13762 Strip marker in lc
13763 !! input
13764 {{lc:x<nowiki/>y}}
13765 !! result
13766 <p>xy
13767 </p>
13768 !! end
13769
13770 !! test
13771 Strip marker in uc
13772 !! input
13773 {{uc:x<nowiki/>y}}
13774 !! result
13775 <p>XY
13776 </p>
13777 !! end
13778
13779 !! test
13780 Strip marker in formatNum
13781 !! input
13782 {{formatnum:1<nowiki/>2}}
13783 {{formatnum:1<nowiki/>2|R}}
13784 !! result
13785 <p>12
13786 12
13787 </p>
13788 !! end
13789
13790 !! test
13791 Check noCommafy in formatNum
13792 !! options
13793 language=be-tarask
13794 !! input
13795 {{formatnum:123456.78}}
13796 {{formatnum:123456.78|NOSEP}}
13797 !! result
13798 <p>123 456,78
13799 123456.78
13800 </p>
13801 !! end
13802
13803 !! test
13804 Strip marker in grammar
13805 !! options
13806 language=fi
13807 !! input
13808 {{grammar:elative|foo<nowiki/>bar}}
13809 !! result
13810 <p>foobarista
13811 </p>
13812 !! end
13813
13814 !! test
13815 Strip marker in padleft
13816 !! input
13817 {{padleft:|2|x<nowiki/>y}}
13818 !! result
13819 <p>xy
13820 </p>
13821 !! end
13822
13823 !! test
13824 Strip marker in padright
13825 !! input
13826 {{padright:|2|x<nowiki/>y}}
13827 !! result
13828 <p>xy
13829 </p>
13830 !! end
13831
13832 !! test
13833 Strip marker in anchorencode
13834 !! input
13835 {{anchorencode:x<nowiki/>y}}
13836 !! result
13837 <p>xy
13838 </p>
13839 !! end
13840
13841 !! test
13842 nowiki inside link inside heading (bug 18295)
13843 !! input
13844 ==[[foo|x<nowiki>y</nowiki>z]]==
13845 !! result
13846 <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">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: xyz">edit</a>]</span></h2>
13847
13848 !! end
13849
13850 !! test
13851 new support for bdi element (bug 31817)
13852 !! input
13853 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
13854 !! result
13855 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
13856
13857 !!end
13858
13859 !! test
13860 Ignore pipe between table row attributes
13861 !! input
13862 {|
13863 | quux
13864 |- id=foo | style='color: red'
13865 | bar
13866 |}
13867 !! result
13868 <table>
13869 <tr>
13870 <td> quux
13871 </td></tr>
13872 <tr id="foo" style="color: red">
13873 <td> bar
13874 </td></tr></table>
13875
13876 !! end
13877
13878 !!test
13879 Gallery override link with WikiLink (bug 34852)
13880 !! input
13881 <gallery>
13882 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
13883 </gallery>
13884 !! result
13885 <ul class="gallery">
13886 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13887 <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>
13888 <div class="gallerytext">
13889 <p>caption
13890 </p>
13891 </div>
13892 </div></li>
13893 </ul>
13894
13895 !! end
13896
13897 !!test
13898 Gallery override link with absolute external link (bug 34852)
13899 !! input
13900 <gallery>
13901 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
13902 </gallery>
13903 !! result
13904 <ul class="gallery">
13905 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13906 <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>
13907 <div class="gallerytext">
13908 <p>caption
13909 </p>
13910 </div>
13911 </div></li>
13912 </ul>
13913
13914 !! end
13915
13916 !!test
13917 Gallery override link with malicious javascript (bug 34852)
13918 !! input
13919 <gallery>
13920 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
13921 </gallery>
13922 !! result
13923 <ul class="gallery">
13924 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13925 <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>
13926 <div class="gallerytext">
13927 <p>caption
13928 </p>
13929 </div>
13930 </div></li>
13931 </ul>
13932
13933 !! end
13934
13935 !!test
13936 Gallery with invalid title as link (bug 43964)
13937 !! input
13938 <gallery>
13939 File:foobar.jpg|link=<
13940 </gallery>
13941 !! result
13942 <ul class="gallery">
13943 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13944 <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>
13945 <div class="gallerytext">
13946 </div>
13947 </div></li>
13948 </ul>
13949
13950 !! end
13951
13952 !!test
13953 Language parser function
13954 !! input
13955 {{#language:ar}}
13956 !! result
13957 <p>العربية
13958 </p>
13959 !! end
13960
13961 !!test
13962 Padleft and padright as substr
13963 !! input
13964 {{padleft:|3|abcde}}
13965 {{padright:|3|abcde}}
13966 !! result
13967 <p>abc
13968 abc
13969 </p>
13970 !! end
13971
13972 !!test
13973 Bug 34939 - Case insensitive link parsing ([HttP://])
13974 !! input
13975 [HttP://MediaWiki.Org/]
13976 !! result
13977 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
13978 </p>
13979 !! end
13980
13981 !!test
13982 Bug 34939 - Case insensitive link parsing ([HttP:// title])
13983 !! input
13984 [HttP://MediaWiki.Org/ MediaWiki]
13985 !! result
13986 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
13987 </p>
13988 !! end
13989
13990 !!test
13991 Bug 34939 - Case insensitive link parsing (HttP://)
13992 !! input
13993 HttP://MediaWiki.Org/
13994 !! result
13995 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
13996 </p>
13997 !! end
13998
13999
14000 ###
14001 ### Parsoids-specific tests
14002 ### Parsoid-PHP parser incompatibilities
14003 ###
14004 !!test
14005 1. SOL-sensitive wikitext tokens as template-args
14006 !!options
14007 parsoid=wt2html,wt2wt
14008 !!input
14009 {{echo|*a}}
14010 {{echo|#a}}
14011 {{echo|:a}}
14012 !!result
14013 <span about="#mwt1" typeof="mw:Transclusion">
14014 </span><ul about="#mwt1"><li>a</li></ul>
14015 <span about="#mwt2" typeof="mw:Transclusion">
14016 </span><ol about="#mwt2"><li>a</li></ol>
14017 <span about="#mwt3" typeof="mw:Transclusion">
14018 </span><dl about="#mwt3"><dd>a</dd></dl>
14019 !!end
14020
14021 #### The following section of tests are primarily to test
14022 #### wikitext escaping capabilities of Parsoid. Given that
14023 #### escaping can be done any number of ways, the wikitext (input)
14024 #### is always adjusted to reflect how Parsoid adds nowiki
14025 #### escape tags.
14026 ####
14027 #### We are marking several tests as parsoid-only since the
14028 #### HTML in the result section is different from what the
14029 #### PHP parser generates for it.
14030
14031
14032 #### --------------- Headings ---------------
14033 #### 0. Unnested
14034 #### 1. Nested inside html <h1>=foo=</h1>
14035 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
14036 #### 3. Nested inside html with wikitext split by html tags
14037 #### 4. No escape needed
14038 #### 5. Empty headings <h1></h1>
14039 #### 6. Heading chars in SOL context
14040 #### ----------------------------------------
14041 !! test
14042 Headings: 0. Unnested
14043 !! options
14044 parsoid
14045 !! input
14046 <nowiki>=foo=</nowiki>
14047
14048 <nowiki> =foo= </nowiki>
14049 <!--cmt-->
14050 <nowiki>=foo=</nowiki>
14051
14052 =foo''a''<nowiki>=</nowiki>
14053 !! result
14054 <p><span typeof="mw:Nowiki">=foo=</span></p>
14055
14056 <p><span typeof="mw:Nowiki"> =foo= </span>
14057 <!--cmt-->
14058 <span typeof="mw:Nowiki">=foo=</span></p>
14059
14060 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
14061 !!end
14062
14063 !! test
14064 Headings: 1. Nested inside html
14065 !! options
14066 parsoid
14067 !! input
14068 =<nowiki>=foo=</nowiki>=
14069 ==<nowiki>=foo=</nowiki>==
14070 ===<nowiki>=foo=</nowiki>===
14071 ====<nowiki>=foo=</nowiki>====
14072 =====<nowiki>=foo=</nowiki>=====
14073 ======<nowiki>=foo=</nowiki>======
14074 !! result
14075 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
14076 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
14077 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
14078 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
14079 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
14080 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
14081 !!end
14082
14083 !! test
14084 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
14085 !! options
14086 parsoid
14087 !! input
14088 =foo=
14089 <nowiki>*bar</nowiki>
14090 =foo=
14091 =bar
14092 =foo=
14093 <nowiki>=bar=</nowiki>
14094 !! result
14095 <h1>foo</h1>*bar
14096 <h1>foo</h1>=bar
14097 <h1>foo</h1>=bar=
14098 !!end
14099
14100 !! test
14101 Headings: 3. Nested inside html with wikitext split by html tags
14102 !! options
14103 parsoid
14104 !! input
14105 =='''bold'''<nowiki>foo=</nowiki>=
14106 !! result
14107 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
14108 !!end
14109
14110 !! test
14111 Headings: 4a. No escaping needed (testing just h1 and h2)
14112 !! options
14113 parsoid
14114 !! input
14115 ==foo=
14116 =foo==
14117 = =foo= =
14118 ==foo= bar=
14119 ===foo==
14120 ==foo===
14121 =''=''foo==
14122 =<nowiki>=</nowiki>=
14123 !! result
14124 <h1>=foo</h1>
14125 <h1>foo=</h1>
14126 <h1> =foo= </h1>
14127 <h1>=foo= bar</h1>
14128 <h2>=foo</h2>
14129 <h2>foo=</h2>
14130 <h1><i>=</i>foo=</h1>
14131 <h1><span typeof="mw:Nowiki">=</span></h1>
14132 !!end
14133
14134 !! test
14135 Headings: 4b. No escaping needed (inside p-tags)
14136 !! options
14137 parsoid
14138 !! input
14139 ===
14140 =foo= x
14141 =foo= <s></s>
14142 !! result
14143 <p>===
14144 =foo= x
14145 =foo= <s></s>
14146 </p>
14147 !!end
14148
14149 !! test
14150 Headings: 5. Empty headings
14151 !! options
14152 parsoid
14153 !! input
14154 =<nowiki/>=
14155 ==<nowiki/>==
14156 ===<nowiki/>===
14157 ====<nowiki/>====
14158 =====<nowiki/>=====
14159 ======<nowiki/>======
14160 !! result
14161 <h1></h1>
14162 <h2></h2>
14163 <h3></h3>
14164 <h4></h4>
14165 <h5></h5>
14166 <h6></h6>
14167 !!end
14168
14169 !! test
14170 Headings: 6. Heading chars in SOL context
14171 !! options
14172 parsoid
14173 !! input
14174 <!--cmt--><nowiki>=h1=</nowiki>
14175 <!--cmt--><nowiki> =h1= </nowiki>
14176 !! result
14177 <p><!--cmt--><span typeof="mw:Nowiki">=h1=</span>
14178 <!--cmt--><span typeof="mw:Nowiki"> =h1= </span></p>
14179 !!end
14180
14181 #### --------------- Lists ---------------
14182 #### 0. Outside nests (*foo, etc.)
14183 #### 1. Nested inside html <ul><li>*foo</li></ul>
14184 #### 2. Inside definition lists
14185 #### 3. Only bullets at start should be escaped
14186 #### 4. No escapes needed
14187 #### 5. No unnecessary escapes
14188 #### 6. Escape bullets in SOL position
14189 #### 7. Escape bullets in a multi-line context
14190 #### ----------------------------------------
14191
14192 !! test
14193 Lists: 0. Outside nests
14194 !! input
14195 <nowiki>*foo</nowiki>
14196
14197 <nowiki>#foo</nowiki>
14198 !! result
14199 <p>*foo
14200 </p><p>#foo
14201 </p>
14202 !!end
14203
14204 !! test
14205 Lists: 1. Nested inside html
14206 !! input
14207 *<nowiki>*foo</nowiki>
14208
14209 *<nowiki>#foo</nowiki>
14210
14211 *<nowiki>:foo</nowiki>
14212
14213 *<nowiki>;foo</nowiki>
14214
14215 #<nowiki>*foo</nowiki>
14216
14217 #<nowiki>#foo</nowiki>
14218
14219 #<nowiki>:foo</nowiki>
14220
14221 #<nowiki>;foo</nowiki>
14222 !! result
14223 <ul><li>*foo
14224 </li></ul>
14225 <ul><li>#foo
14226 </li></ul>
14227 <ul><li>:foo
14228 </li></ul>
14229 <ul><li>;foo
14230 </li></ul>
14231 <ol><li>*foo
14232 </li></ol>
14233 <ol><li>#foo
14234 </li></ol>
14235 <ol><li>:foo
14236 </li></ol>
14237 <ol><li>;foo
14238 </li></ol>
14239
14240 !!end
14241
14242 !! test
14243 Lists: 2. Inside definition lists
14244 !! input
14245 ;<nowiki>;foo</nowiki>
14246
14247 ;<nowiki>:foo</nowiki>
14248
14249 ;<nowiki>:foo</nowiki>
14250 :bar
14251
14252 :<nowiki>:foo</nowiki>
14253 !! result
14254 <dl><dt>;foo
14255 </dt></dl>
14256 <dl><dt>:foo
14257 </dt></dl>
14258 <dl><dt>:foo
14259 </dt><dd>bar
14260 </dd></dl>
14261 <dl><dd>:foo
14262 </dd></dl>
14263
14264 !!end
14265
14266 !! test
14267 Lists: 3. Only bullets at start of text should be escaped
14268 !! input
14269 *<nowiki>*foo*bar</nowiki>
14270
14271 *<nowiki>*foo</nowiki>''it''*bar
14272 !! result
14273 <ul><li>*foo*bar
14274 </li></ul>
14275 <ul><li>*foo<i>it</i>*bar
14276 </li></ul>
14277
14278 !!end
14279
14280 !! test
14281 Lists: 4. No escapes needed
14282 !! options
14283 parsoid
14284 !! input
14285 *foo*bar
14286
14287 *''foo''*bar
14288
14289 *[[Foo]]: bar
14290 !! result
14291 <ul><li>foo*bar
14292 </li></ul>
14293 <ul><li><i>foo</i>*bar
14294 </li></ul>
14295 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
14296 </li></ul>
14297 !!end
14298
14299 !! test
14300 Lists: 5. No unnecessary escapes
14301 !! input
14302 * bar <span><nowiki>[[foo]]</nowiki></span>
14303
14304 *=bar <span><nowiki>[[foo]]</nowiki></span>
14305
14306 *[[bar <span><nowiki>[[foo]]</nowiki></span>
14307
14308 *]]bar <span><nowiki>[[foo]]</nowiki></span>
14309
14310 *=bar <span>foo]]</span>=
14311
14312 * <s></s>: a
14313 !! result
14314 <ul><li> bar <span>[[foo]]</span>
14315 </li></ul>
14316 <ul><li>=bar <span>[[foo]]</span>
14317 </li></ul>
14318 <ul><li>[[bar <span>[[foo]]</span>
14319 </li></ul>
14320 <ul><li>]]bar <span>[[foo]]</span>
14321 </li></ul>
14322 <ul><li>=bar <span>foo]]</span>=
14323 </li></ul>
14324 <ul><li> <s></s>: a
14325 </li></ul>
14326
14327 !!end
14328
14329 !! test
14330 Lists: 6. Escape bullets in SOL position
14331 !! options
14332 parsoid
14333 !! input
14334 <!--cmt--><nowiki>*foo</nowiki>
14335 !! result
14336 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
14337 !!end
14338
14339 !! test
14340 Lists: 7. Escape bullets in a multi-line context
14341 !! input
14342 <nowiki>a
14343 *b</nowiki>
14344 !! result
14345 <p>a
14346 *b
14347 </p>
14348 !!end
14349
14350 #### --------------- HRs ---------------
14351 #### 1. Single line
14352 #### -----------------------------------
14353
14354 !! test
14355 HRs: 1. Single line
14356 !! options
14357 parsoid
14358 !! input
14359 ----<nowiki>----</nowiki>
14360 ----=foo=
14361 ----*foo
14362 !! result
14363 <hr><span typeof="mw:Nowiki">----</span>
14364 <hr>=foo=
14365 <hr>*foo
14366 !! end
14367
14368 #### --------------- Tables ---------------
14369 #### 1a. Simple example
14370 #### 1b. No escaping needed (!foo)
14371 #### 1c. No escaping needed (|foo)
14372 #### 1d. No escaping needed (|}foo)
14373 ####
14374 #### 2a. Nested in td (<td>foo|bar</td>)
14375 #### 2b. Nested in td (<td>foo||bar</td>)
14376 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
14377 ####
14378 #### 3a. Nested in th (<th>foo!bar</th>)
14379 #### 3b. Nested in th (<th>foo!!bar</th>)
14380 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
14381 ####
14382 #### 4a. Escape -
14383 #### 4b. Escape +
14384 #### 4c. No escaping needed
14385 #### --------------------------------------
14386
14387 !! test
14388 Tables: 1a. Simple example
14389 !! input
14390 <nowiki>{|
14391 |}</nowiki>
14392 !! result
14393 <p>{|
14394 |}
14395 </p>
14396 !! end
14397
14398 !! test
14399 Tables: 1b. No escaping needed
14400 !! input
14401 !foo
14402 !! result
14403 <p>!foo
14404 </p>
14405 !! end
14406
14407 !! test
14408 Tables: 1c. No escaping needed
14409 !! input
14410 |foo
14411 !! result
14412 <p>|foo
14413 </p>
14414 !! end
14415
14416 !! test
14417 Tables: 1d. No escaping needed
14418 !! input
14419 |}foo
14420 !! result
14421 <p>|}foo
14422 </p>
14423 !! end
14424
14425 !! test
14426 Tables: 2a. Nested in td
14427 !! options
14428 parsoid
14429 !! input
14430 {|
14431 |<nowiki>foo|bar</nowiki>
14432 |}
14433 !! result
14434 <table><tbody><tr>
14435 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
14436 !! end
14437
14438 !! test
14439 Tables: 2b. Nested in td
14440 !! options
14441 parsoid
14442 !! input
14443 {|
14444 |<nowiki>foo||bar</nowiki>
14445 |''it''<nowiki>foo||bar</nowiki>
14446 |}
14447 !! result
14448 <table><tbody><tr>
14449 <td><span typeof="mw:Nowiki">foo||bar</span></td>
14450 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
14451 !! end
14452
14453 !! test
14454 Tables: 2c. Nested in td -- no escaping needed
14455 !! options
14456 parsoid
14457 !! input
14458 {|
14459 |foo!!bar
14460 |}
14461 !! result
14462 <table><tbody><tr><td>foo!!bar
14463 </td></tr></tbody></table>
14464
14465 !! end
14466
14467 !! test
14468 Tables: 3a. Nested in th
14469 !! options
14470 parsoid
14471 !! input
14472 {|
14473 !foo!bar
14474 |}
14475 !! result
14476 <table><tbody><tr><th>foo!bar
14477 </th></tr></tbody></table>
14478
14479 !! end
14480
14481 !! test
14482 Tables: 3b. Nested in th
14483 !! options
14484 parsoid
14485 !! input
14486 {|
14487 !<nowiki>foo!!bar</nowiki>
14488 |}
14489 !! result
14490 <table>
14491 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
14492 </tbody></table>
14493 !! end
14494
14495 !! test
14496 Tables: 3c. Nested in th -- no escaping needed
14497 !! options
14498 parsoid
14499 !! input
14500 {|
14501 !<nowiki>foo||bar</nowiki>
14502 |}
14503 !! result
14504 <table><tbody><tr>
14505 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
14506 !! end
14507
14508 !! test
14509 Tables: 4a. Escape -
14510 !! options
14511 parsoid
14512 !! input
14513 {|
14514 |-
14515 !-bar
14516 |-
14517 |<nowiki>-bar</nowiki>
14518 |}
14519 !! result
14520 <table><tbody>
14521 <tr><th>-bar</th></tr>
14522 <tr>
14523 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
14524 !! end
14525
14526 !! test
14527 Tables: 4b. Escape +
14528 !! options
14529 parsoid
14530 !! input
14531 {|
14532 |-
14533 !+bar
14534 |-
14535 |<nowiki>+bar</nowiki>
14536 |}
14537 !! result
14538 <table><tbody>
14539 <tr><th>+bar</th></tr>
14540 <tr>
14541 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
14542 !! end
14543
14544 !! test
14545 Tables: 4c. No escaping needed
14546 !! options
14547 parsoid
14548 !! input
14549 {|
14550 |-
14551 |foo-bar
14552 |foo+bar
14553 |-
14554 |''foo''-bar
14555 |''foo''+bar
14556 |}
14557 !! result
14558 <table><tbody>
14559 <tr><td>foo-bar</td><td>foo+bar</td></tr>
14560 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
14561 </tbody></table>
14562 !! end
14563
14564 ### SSS FIXME: Disabled right now because accurate html2wt
14565 ### on this snippet requires data-parsoid flags that we've
14566 ### stripped out of these tests. We should scheme how we
14567 ### we want to handle these kind of tests that require
14568 ### data-parsoid flags for accurate html2wt serialization
14569
14570 !! test
14571 Tables: 4d. No escaping needed
14572 !! options
14573 disabled
14574 !! input
14575 {|
14576 ||+1
14577 ||-2
14578 |}
14579 !! result
14580 <table>
14581 <tr>
14582 <td>+1
14583 </td>
14584 <td>-2
14585 </td></tr></table>
14586
14587 !! end
14588
14589 #### --------------- Links ---------------
14590 #### 1. Quote marks in link text
14591 #### 2. Wikilinks: Escapes needed
14592 #### 3. Wikilinks: No escapes needed
14593 #### 4. Extlinks: Escapes needed
14594 #### 5. Extlinks: No escapes needed
14595 #### --------------------------------------
14596 !! test
14597 Links 1. Quote marks in link text
14598 !! options
14599 parsoid
14600 !! input
14601 [[Foo|<nowiki>Foo''boo''</nowiki>]]
14602 !! result
14603 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
14604 !! end
14605
14606 !! test
14607 Links 2. WikiLinks: Escapes needed
14608 !! options
14609 parsoid
14610 !! input
14611 [[Foo|<nowiki>[Foobar]</nowiki>]]
14612 [[Foo|<nowiki>Foobar]</nowiki>]]
14613 [[Foo|x [Foobar] x]]
14614 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
14615 [[Foo|<nowiki>[[Bar]]</nowiki>]]
14616 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
14617 [[Foo|<nowiki>|Bar</nowiki>]]
14618 [[Foo|<nowiki>]]bar</nowiki>]]
14619 [[Foo|<nowiki>[[bar</nowiki>]]
14620 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
14621 !! result
14622 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
14623 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
14624 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
14625 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
14626 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
14627 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
14628 <a href="Foo" rel="mw:WikiLink">|Bar</a>
14629 <a href="Foo" rel="mw:WikiLink">]]bar</a>
14630 <a href="Foo" rel="mw:WikiLink">[[bar</a>
14631 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
14632 !! end
14633
14634 !! test
14635 Links 3. WikiLinks: No escapes needed
14636 !! options
14637 parsoid
14638 !! input
14639 [[Foo|[Foobar]]
14640 [[Foo|foo|bar]]
14641 !! result
14642 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
14643 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
14644 !! end
14645
14646 !! test
14647 Links 4. ExtLinks: Escapes needed
14648 !! options
14649 parsoid
14650 !! input
14651 [http://google.com <nowiki>[google]</nowiki>]
14652 [http://google.com <nowiki>google]</nowiki>]
14653 !! result
14654 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
14655 <a href="http://google.com" rel="mw:ExtLink">google]</a>
14656 !! end
14657
14658 !! test
14659 Links 5. ExtLinks: No escapes needed
14660 !! options
14661 parsoid
14662 !! input
14663 [http://google.com [google]
14664 !! result
14665 <a href="http://google.com" rel="mw:ExtLink">[google</a>
14666 !! end
14667
14668 #### --------------- Quotes ---------------
14669 #### 1. Quotes inside <b> and <i>
14670 #### 2. Link fragments separated by <i> and <b> tags
14671 #### 3. Link fragments inside <i> and <b>
14672 #### --------------------------------------
14673 !! test
14674 1. Quotes inside <b> and <i>
14675 !! input
14676 ''<nowiki>'foo'</nowiki>''
14677 ''<nowiki>''foo''</nowiki>''
14678 ''<nowiki>'''foo'''</nowiki>''
14679 '''<nowiki>'foo'</nowiki>'''
14680 '''<nowiki>''foo''</nowiki>'''
14681 '''<nowiki>'''foo'''</nowiki>'''
14682 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
14683 !! result
14684 <p><i>'foo'</i>
14685 <i>''foo''</i>
14686 <i>'''foo'''</i>
14687 <b>'foo'</b>
14688 <b>''foo''</b>
14689 <b>'''foo'''</b>
14690 <b>foo'<i>bar'</i>baz</b>
14691 </p>
14692 !! end
14693
14694 !! test
14695 2. Link fragments separated by <i> and <b> tags
14696 !! input
14697 [[''foo''<nowiki>hello]]</nowiki>
14698
14699 [['''foo'''<nowiki>hello]]</nowiki>
14700 !! result
14701 <p>[[<i>foo</i>hello]]
14702 </p><p>[[<b>foo</b>hello]]
14703 </p>
14704 !! end
14705
14706 !! test
14707 2. Link fragments inside <i> and <b>
14708 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
14709 this is one of the shortcomings of this format)
14710 !! input
14711 ''[[foo''<nowiki>]]</nowiki>
14712
14713 '''[[foo'''<nowiki>]]</nowiki>
14714 !! result
14715 <p><i>[[foo</i>]]
14716 </p><p><b>[[foo</b>]]
14717 </p>
14718 !! end
14719
14720 #### --------------- Paragraphs ---------------
14721 #### 1. No unnecessary escapes
14722 #### --------------------------------------
14723
14724 !! test
14725 1. No unnecessary escapes
14726 !! input
14727 bar <span><nowiki>[[foo]]</nowiki></span>
14728
14729 =bar <span><nowiki>[[foo]]</nowiki></span>
14730
14731 [[bar <span><nowiki>[[foo]]</nowiki></span>
14732
14733 ]]bar <span><nowiki>[[foo]]</nowiki></span>
14734
14735 =bar <span>foo]]</span><nowiki>=</nowiki>
14736 !! result
14737 <p>bar <span>[[foo]]</span>
14738 </p><p>=bar <span>[[foo]]</span>
14739 </p><p>[[bar <span>[[foo]]</span>
14740 </p><p>]]bar <span>[[foo]]</span>
14741 </p><p>=bar <span>foo]]</span>=
14742 </p>
14743 !!end
14744
14745 #### --------------- PRE ------------------
14746 #### 1. Leading space in SOL context should be escaped
14747 #### --------------------------------------
14748 !! test
14749 1. Leading space in SOL context should be escaped
14750 !! options
14751 parsoid
14752 !! input
14753 <nowiki> foo</nowiki>
14754 <!--cmt--><nowiki> foo</nowiki>
14755 !! result
14756 <p> foo
14757 <!--cmt--> foo
14758 </p>
14759 !! end
14760
14761 #### --------------- HTML tags ---------------
14762 #### 1. a tags
14763 #### 2. other tags
14764 #### 3. multi-line html tag
14765 #### --------------------------------------
14766 !! test
14767 1. a tags
14768 !! options
14769 parsoid
14770 !! input
14771 <a href="http://google.com">google</a>
14772 !! result
14773 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
14774 !! end
14775
14776 !! test
14777 2. other tags
14778 !! input
14779 <nowiki><div>foo</div>
14780 <div style="color:red">foo</div></nowiki>
14781 !! result
14782 <p>&lt;div&gt;foo&lt;/div&gt;
14783 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
14784 </p>
14785 !! end
14786
14787 !! test
14788 3. multi-line html tag
14789 !! input
14790 <nowiki><div
14791 >foo</div
14792 ></nowiki>
14793 !! result
14794 <p>&lt;div
14795 &gt;foo&lt;/div
14796 &gt;
14797 </p>
14798 !! end
14799
14800 #### --------------- Others ---------------
14801 !! test
14802 Escaping nowikis
14803 !! input
14804 &lt;nowiki&gt;foo&lt;/nowiki&gt;
14805 !! result
14806 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
14807 </p>
14808 !! end
14809 !! test
14810
14811 Tag-like HTML structures are passed through as text
14812 !! input
14813 <x y>
14814
14815 <x.y>
14816
14817 <x-y>
14818
14819 1>2
14820
14821 x<y
14822
14823 a>b
14824
14825 1<d e>f
14826 !! result
14827 <p>&lt;x y&gt;
14828 </p><p>&lt;x.y&gt;
14829 </p><p>&lt;x-y&gt;
14830 </p><p>1&gt;2
14831 </p><p>x&lt;y
14832 </p><p>a&gt;b
14833 </p><p>1&lt;d e&gt;f
14834 </p>
14835 !! end
14836
14837
14838 # This fails in the PHP parser (see bug 40670,
14839 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
14840 !! test
14841 Tag names followed by punctuation should not be recognized as tags
14842 !! options
14843 parsoid
14844 !! input
14845 <s.ome> text
14846 !! result
14847 <p>&lt;s.ome&gt; text
14848 </p>
14849 !! end
14850
14851 !! test
14852 HTML tag with necessary entities in attributes
14853 !! input
14854 <span title="&amp;amp;">foo</span>
14855 !! result
14856 <p><span title="&amp;amp;">foo</span>
14857 </p>
14858 !! end
14859
14860 !! test
14861 HTML tag with 'unnecessary' entity encoding in attributes
14862 !! input
14863 <span title="&amp;">foo</span>
14864 !! result
14865 <p><span title="&amp;">foo</span>
14866 </p>
14867 !! end
14868
14869 !! test
14870 HTML tag with broken attribute value quoting
14871 !! input
14872 <span title="Hello world>Foo</span>
14873 !! result
14874 <p><span>Foo</span>
14875 </p>
14876 !! end
14877
14878 !! test
14879 Parsoid-only: HTML tag with broken attribute value quoting
14880 !! options
14881 parsoid
14882 !! input
14883 <span title="Hello world>Foo</span>
14884 !! result
14885 <p><span title="Hello world">Foo</span>
14886 </p>
14887 !! end
14888
14889 !! test
14890 Table with broken attribute value quoting
14891 !! input
14892 {|
14893 | title="Hello world|Foo
14894 |}
14895 !! result
14896 <table>
14897 <tr>
14898 <td>Foo
14899 </td></tr></table>
14900
14901 !! end
14902
14903 !! test
14904 Table with broken attribute value quoting on consecutive lines
14905 !! input
14906 {|
14907 | title="Hello world|Foo
14908 | style="color:red|Bar
14909 |}
14910 !! result
14911 <table>
14912 <tr>
14913 <td>Foo
14914 </td>
14915 <td>Bar
14916 </td></tr></table>
14917
14918 !! end
14919
14920 !! test
14921 Parsoid-only: Table with broken attribute value quoting on consecutive lines
14922 !! options
14923 parsoid
14924 !! input
14925 {|
14926 | title="Hello world|Foo
14927 | style="color:red|Bar
14928 |}
14929 !! result
14930 <table><tbody>
14931 <tr>
14932 <td title="Hello world">Foo
14933 </td><td style="color: red">Bar
14934 </td></tr></tbody></table>
14935
14936 !! end
14937
14938 !! test
14939 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
14940 !! options
14941 parsoid
14942 !! input
14943 {{}}
14944 !! result
14945 {{}}
14946 !! end
14947
14948 !! test
14949 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
14950 !! options
14951 parsoid
14952 !! input
14953 }}{{
14954 !! result
14955 }}{{
14956 !! end
14957
14958 !!test
14959 Accept empty td cell attribute
14960 !!input
14961 {|
14962 | align="center" | foo || |
14963 |}
14964 !!result
14965 <table>
14966 <tr>
14967 <td align="center"> foo </td>
14968 <td>
14969 </td></tr></table>
14970
14971 !!end
14972
14973 !!test
14974 Non-empty attributes in th-cells
14975 !!input
14976 {|
14977 ! Foo !! style="color: red" | Bar
14978 |}
14979 !!result
14980 <table>
14981 <tr>
14982 <th> Foo </th>
14983 <th style="color: red"> Bar
14984 </th></tr></table>
14985
14986 !!end
14987
14988 !!test
14989 Accept empty attributes in th-cells
14990 !!input
14991 {|
14992 !| foo !!| bar
14993 |}
14994 !!result
14995 <table>
14996 <tr>
14997 <th> foo </th>
14998 <th> bar
14999 </th></tr></table>
15000
15001 !!end
15002
15003 !!test
15004 Empty table rows go away
15005 !!input
15006 {|
15007 | Hello
15008 | there
15009 |- class="foo"
15010 |-
15011 |}
15012 !! result
15013 <table>
15014 <tr>
15015 <td> Hello
15016 </td>
15017 <td> there
15018 </td></tr>
15019
15020 </table>
15021
15022 !! end
15023
15024 ###
15025 ### Parsoid-centric tests for testing RTing of inter-element separators
15026 ### Edge cases not tested by existing parser tests and specific to
15027 ### Parsoid-specific serialization strategies.
15028 ###
15029
15030 !!test
15031 RT-ed inter-element separators should be valid separators
15032 !!input
15033 {|
15034 |- [[foo]]
15035 |}
15036 !!result
15037 <table>
15038
15039 </table>
15040
15041 !!end
15042
15043 !!test
15044 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
15045 (Parsoid-only since PHP parser relies on Tidy for correct output)
15046 !!options
15047 parsoid
15048 !!input
15049 {|
15050 |<small>foo
15051 bar
15052 |}
15053
15054 {|
15055 |<small>foo<small>
15056 |}
15057 !!result
15058 !!end
15059
15060 !!test
15061 Empty TD followed by TD with tpl-generated attribute
15062 !!input
15063 {|
15064 |-
15065 |
15066 |{{echo|style='color:red'}}|foo
15067 |}
15068 !!result
15069 <table>
15070
15071 <tr>
15072 <td>
15073 </td>
15074 <td>foo
15075 </td></tr></table>
15076
15077 !!end
15078
15079 !!test
15080 Indented table with an empty td
15081 !!input
15082 {|
15083 |-
15084 |
15085 |foo
15086 |}
15087 !!result
15088 <table>
15089
15090 <tr>
15091 <td>
15092 </td>
15093 <td>foo
15094 </td></tr></table>
15095
15096 !!end
15097
15098 !!test
15099 Empty TR followed by a template-generated TR
15100 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
15101 !!options
15102 parsoid=wt2html,wt2wt
15103 !!input
15104 {|
15105 |-
15106 {{echo|<tr><td>foo</td></tr>}}
15107 |}
15108 !!result
15109 <table>
15110 <tbody>
15111 <tr></tr>
15112 <tr typeof="mw:Transclusion">
15113 <td>foo</td></tr></tbody></table>
15114 !!end
15115
15116 ## PHP and parsoid output differ for this, and since this is primarily
15117 ## for testing Parsoid's serializer, marking this Parsoid only
15118 !!test
15119 Empty TR followed by mixed-ws-comment line should RT correctly
15120 !!options
15121 parsoid
15122 !!input
15123 {|
15124 |-
15125 <!--c-->
15126 |-
15127 <!--c--> <!--d-->
15128 |}
15129 !!result
15130 <table>
15131 <tbody>
15132 <tr>
15133 <td> <!--c--></td></tr>
15134 <tr>
15135 <td><!--c--> <!--d--></td></tr>
15136 </tbody></table>
15137
15138 !!end
15139
15140 !!test
15141 Multi-line image caption generated by templates with/without trailing newlines
15142 !!options
15143 parsoid
15144 !!input
15145 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
15146 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
15147 !!result
15148 <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>
15149 <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>
15150
15151 !!end
15152
15153 ## PHP emits broken html for this, and since this is primarily
15154 ## a Parsoid serializer test, marking this Parsoid only
15155 !!test
15156 Improperly nested inline or quotes tags with whitespace in between
15157 !!options
15158 parsoid
15159 !!input
15160 <span> <s>x</span> </s>
15161 ''' ''x''' ''
15162 !!result
15163 <p><span> <s>x</s></span><s> </s>
15164 <b> <i>x</i></b><i> </i>
15165 </p>
15166 !!end
15167
15168
15169 TODO:
15170 more images
15171 more tables
15172 character entities
15173 and much more
15174 Try for 100% code coverage