Merge "5 new tests (3 Parsoid serializer, 2 parser) & fixed 4 tests."
[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 Parsing an URL
308 !! input
309 http://fr.wikipedia.org/wiki/🍺
310 <!-- EasterEgg we love beer, better be able be able to link to it -->
311 !! result
312 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
313 </p>
314 !! end
315
316 !! test
317 Simple list
318 !! input
319 * Item 1
320 * Item 2
321 !! result
322 <ul><li> Item 1
323 </li><li> Item 2
324 </li></ul>
325
326 !! end
327
328 !! test
329 Italics and bold
330 !! input
331 * plain
332 * plain''italic''plain
333 * plain''italic''plain''italic''plain
334 * plain'''bold'''plain
335 * plain'''bold'''plain'''bold'''plain
336 * plain''italic''plain'''bold'''plain
337 * plain'''bold'''plain''italic''plain
338 * plain''italic'''bold-italic'''italic''plain
339 * plain'''bold''bold-italic''bold'''plain
340 * plain'''''bold-italic'''italic''plain
341 * plain'''''bold-italic''bold'''plain
342 * plain''italic'''bold-italic'''''plain
343 * plain'''bold''bold-italic'''''plain
344 * plain l'''italic''plain
345 * plain l''''bold''' plain
346 !! result
347 <ul><li> plain
348 </li><li> plain<i>italic</i>plain
349 </li><li> plain<i>italic</i>plain<i>italic</i>plain
350 </li><li> plain<b>bold</b>plain
351 </li><li> plain<b>bold</b>plain<b>bold</b>plain
352 </li><li> plain<i>italic</i>plain<b>bold</b>plain
353 </li><li> plain<b>bold</b>plain<i>italic</i>plain
354 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
355 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
356 </li><li> plain<i><b>bold-italic</b>italic</i>plain
357 </li><li> plain<b><i>bold-italic</i>bold</b>plain
358 </li><li> plain<i>italic<b>bold-italic</b></i>plain
359 </li><li> plain<b>bold<i>bold-italic</i></b>plain
360 </li><li> plain l'<i>italic</i>plain
361 </li><li> plain l'<b>bold</b> plain
362 </li></ul>
363
364 !! end
365
366 # this example taken from the simple/Moon article
367 !! test
368 Italics and possessives
369 !! input
370 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
371 !! result
372 <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
373 </p>
374 !! end
375
376 ###
377 ### 2-quote opening sequence tests
378 ###
379 !! test
380 Italics and bold: 2-quote opening sequence: (2,2)
381 !! input
382 ''foo''
383 !! result
384 <p><i>foo</i>
385 </p>
386 !!end
387
388
389 !! test
390 Italics and bold: 2-quote opening sequence: (2,3)
391 !! input
392 ''foo'''
393 !! result
394 <p><i>foo'</i>
395 </p>
396 !!end
397
398
399 !! test
400 Italics and bold: 2-quote opening sequence: (2,4)
401 !! input
402 ''foo''''
403 !! result
404 <p><i>foo''</i>
405 </p>
406 !!end
407
408
409 !! test
410 Italics and bold: 2-quote opening sequence: (2,5) (php)
411 !! options
412 php
413 !! input
414 ''foo'''''
415 !! result
416 <p><i>foo</i>
417 </p>
418 !!end
419 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
420 !! test
421 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
422 !! options
423 parsoid
424 !! input
425 ''foo'''''
426 !! result
427 <p><i>foo</i><b></b>
428 </p>
429 !!end
430
431
432 ###
433 ### 3-quote opening sequence tests
434 ###
435
436 !! test
437 Italics and bold: 3-quote opening sequence: (3,2)
438 !! input
439 '''foo''
440 !! result
441 <p>'<i>foo</i>
442 </p>
443 !!end
444
445
446 !! test
447 Italics and bold: 3-quote opening sequence: (3,3)
448 !! input
449 '''foo'''
450 !! result
451 <p><b>foo</b>
452 </p>
453 !!end
454
455
456 !! test
457 Italics and bold: 3-quote opening sequence: (3,4)
458 !! input
459 '''foo''''
460 !! result
461 <p><b>foo'</b>
462 </p>
463 !!end
464
465
466 !! test
467 Italics and bold: 3-quote opening sequence: (3,5) (php)
468 !! options
469 php
470 !! input
471 '''foo'''''
472 !! result
473 <p><b>foo</b>
474 </p>
475 !!end
476 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
477 !! test
478 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
479 !! options
480 parsoid
481 !! input
482 '''foo'''''
483 !! result
484 <p><b>foo<i></i></b>
485 </p>
486 !!end
487
488
489 ###
490 ### 4-quote opening sequence tests
491 ###
492
493 !! test
494 Italics and bold: 4-quote opening sequence: (4,2)
495 !! input
496 ''''foo''
497 !! result
498 <p>''<i>foo</i>
499 </p>
500 !!end
501
502
503 !! test
504 Italics and bold: 4-quote opening sequence: (4,3)
505 !! input
506 ''''foo'''
507 !! result
508 <p>'<b>foo</b>
509 </p>
510 !!end
511
512
513 !! test
514 Italics and bold: 4-quote opening sequence: (4,4)
515 !! input
516 ''''foo''''
517 !! result
518 <p>'<b>foo'</b>
519 </p>
520 !!end
521
522
523 !! test
524 Italics and bold: 4-quote opening sequence: (4,5) (php)
525 !! options
526 php
527 !! input
528 ''''foo'''''
529 !! result
530 <p>'<b>foo</b>
531 </p>
532 !!end
533 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
534 !! test
535 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
536 !! options
537 parsoid
538 !! input
539 ''''foo'''''
540 !! result
541 <p>'<b>foo<i></i></b>
542 </p>
543 !!end
544
545
546 ###
547 ### 5-quote opening sequence tests
548 ###
549
550 !! test
551 Italics and bold: 5-quote opening sequence: (5,2) (php)
552 !! options
553 php
554 !! input
555 '''''foo''
556 !! result
557 <p><b><i>foo</i></b>
558 </p>
559 !!end
560 # Parsoid reverses the nesting order, compared to the PHP parser
561 !! test
562 Italics and bold: 5-quote opening sequence: (5,2) (parsoid)
563 !! options
564 parsoid
565 !! input
566 '''''foo''
567 !! result
568 <p><i><b>foo</b></i>
569 </p>
570 !!end
571
572
573 !! test
574 Italics and bold: 5-quote opening sequence: (5,3)
575 !! input
576 '''''foo'''
577 !! result
578 <p><i><b>foo</b></i>
579 </p>
580 !!end
581
582
583 !! test
584 Italics and bold: 5-quote opening sequence: (5,4)
585 !! input
586 '''''foo''''
587 !! result
588 <p><i><b>foo'</b></i>
589 </p>
590 !!end
591
592
593 !! test
594 Italics and bold: 5-quote opening sequence: (5,5)
595 !! input
596 '''''foo'''''
597 !! result
598 <p><i><b>foo</b></i>
599 </p>
600 !!end
601
602 ###
603 ### multiple quote sequences in a line
604 ###
605 !! test
606 Italics and bold: multiple quote sequences: (2,4,2)
607 !! input
608 ''foo''''bar''
609 !! result
610 <p><i>foo'<b>bar</b></i>
611 </p>
612 !!end
613
614
615 !! test
616 Italics and bold: multiple quote sequences: (2,4,3)
617 !! input
618 ''foo''''bar'''
619 !! result
620 <p><i>foo'<b>bar</b></i>
621 </p>
622 !!end
623
624
625 !! test
626 Italics and bold: multiple quote sequences: (2,4,4)
627 !! input
628 ''foo''''bar''''
629 !! result
630 <p><i>foo'<b>bar'</b></i>
631 </p>
632 !!end
633
634
635 !! test
636 Italics and bold: multiple quote sequences: (3,4,2) (php)
637 !! options
638 php
639 !! input
640 '''foo''''bar''
641 !! result
642 <p><b>foo'</b>bar
643 </p>
644 !!end
645 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
646 !! test
647 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
648 !! options
649 parsoid
650 !! input
651 '''foo''''bar''
652 !! result
653 <p><b>foo'</b>bar<i></i>
654 </p>
655 !!end
656
657
658 !! test
659 Italics and bold: multiple quote sequences: (3,4,3) (php)
660 !! options
661 php
662 !! input
663 '''foo''''bar'''
664 !! result
665 <p><b>foo'</b>bar
666 </p>
667 !!end
668 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
669 !! test
670 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
671 !! options
672 parsoid
673 !! input
674 '''foo''''bar'''
675 !! result
676 <p><b>foo'</b>bar<b></b>
677 </p>
678 !!end
679
680 ###
681 ### other quote tests
682 ###
683 !! test
684 Italics and bold: other quote tests: (2,3,5)
685 !! input
686 ''this is about '''foo's family'''''
687 !! result
688 <p><i>this is about <b>foo's family</b></i>
689 </p>
690 !!end
691
692
693 !! test
694 Italics and bold: other quote tests: (2,(3,3),2)
695 !! input
696 ''this is about '''foo's''' family''
697 !! result
698 <p><i>this is about <b>foo's</b> family</i>
699 </p>
700 !!end
701
702
703 !! test
704 Italics and bold: other quote tests: (3,2,3,2)
705 !! input
706 '''this is about ''foo'''s family''
707 !! result
708 <p><b>this is about <i>foo</i></b><i>s family</i>
709 </p>
710 !!end
711
712
713 # The Parsoid team believes the PHP parser's output on this test is wrong.
714 # It only checks for convert-to-bold-on-single-character-word when the word
715 # matches with a bold tag ("'''") that is *odd* in the list of quote tokens.
716 # This means that the bold token in position 2 (0-indexed) gets converted by
717 # parsoid, but doesn't get changed by the PHP parser.
718 !! test
719 Italics and bold: other quote tests: (3,2,3,3) (php)
720 !! options
721 php
722 !! input
723 '''this is about ''foo'''s family'''
724 !! result
725 <p>'<i>this is about </i>foo<b>s family</b>
726 </p>
727 !!end
728 # This is the output the Parsoid team believes to be correct.
729 !! test
730 Italics and bold: other quote tests: (3,2,3,3) (parsoid)
731 !! options
732 parsoid
733 !! input
734 '''this is about ''foo'''s family'''
735 !! result
736 <p><b>this is about <i>foo'</i>s family</b>
737 </p>
738 !!end
739
740
741 !! test
742 Italics and bold: other quote tests: (3,(2,2),3)
743 !! input
744 '''this is about ''foo's'' family'''
745 !! result
746 <p><b>this is about <i>foo's</i> family</b>
747 </p>
748 !!end
749
750
751 !! test
752 Italicized possessive
753 !! input
754 The ''[[Main Page]]'''s talk page.
755 !! result
756 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
757 </p>
758 !! end
759
760 ###
761 ### Non-html5 tags
762 ###
763
764 !! test
765 Non-html5 tags should be accepted
766 !! input
767 <center>''foo''</center>
768 <big>''foo''</big>
769 <font>''foo''</font>
770 <strike>''foo''</strike>
771 <tt>''foo''</tt>
772 !! result
773 <center><i>foo</i></center>
774 <p><big><i>foo</i></big>
775 <font><i>foo</i></font>
776 <strike><i>foo</i></strike>
777 <tt><i>foo</i></tt>
778 </p>
779 !! end
780
781 ###
782 ### <nowiki> test cases
783 ###
784
785 !! test
786 <nowiki> unordered list
787 !! input
788 <nowiki>* This is not an unordered list item.</nowiki>
789 !! result
790 <p>* This is not an unordered list item.
791 </p>
792 !! end
793
794 !! test
795 <nowiki> spacing
796 !! input
797 <nowiki>Lorem ipsum dolor
798
799 sed abit.
800 sed nullum.
801
802 :and a colon
803 </nowiki>
804 !! result
805 <p>Lorem ipsum dolor
806
807 sed abit.
808 sed nullum.
809
810 :and a colon
811
812 </p>
813 !! end
814
815 !! test
816 nowiki 3
817 !! input
818 :There is not nowiki.
819 :There is <nowiki>nowiki</nowiki>.
820
821 #There is not nowiki.
822 #There is <nowiki>nowiki</nowiki>.
823
824 *There is not nowiki.
825 *There is <nowiki>nowiki</nowiki>.
826 !! result
827 <dl><dd>There is not nowiki.
828 </dd><dd>There is nowiki.
829 </dd></dl>
830 <ol><li>There is not nowiki.
831 </li><li>There is nowiki.
832 </li></ol>
833 <ul><li>There is not nowiki.
834 </li><li>There is nowiki.
835 </li></ul>
836
837 !! end
838
839 !! test
840 Entities inside <nowiki>
841 !! input
842 <nowiki>&lt;</nowiki>
843 !! result
844 <p>&lt;
845 </p>
846 !! end
847
848
849 ###
850 ### Comments
851 ###
852 !! test
853 Comments and Indent-Pre
854 !! input
855 <!-- comment 1 --> asdf
856
857 <!-- comment 1 --> asdf
858 <!-- comment 2 -->
859
860 <!-- comment 1 --> asdf
861 <!-- comment 2 -->xyz
862
863 <!-- comment 1 --> asdf
864 <!-- comment 2 --> xyz
865 !! result
866 <pre>asdf
867 </pre>
868 <pre>asdf
869 </pre>
870 <pre>asdf
871 </pre>
872 <p>xyz
873 </p>
874 <pre>asdf
875 xyz
876 </pre>
877 !! end
878
879 !! test
880 Comment test 2a
881 !! input
882 asdf
883 <!-- comment 1 -->
884 jkl
885 !! result
886 <p>asdf
887 jkl
888 </p>
889 !! end
890
891 !! test
892 Comment test 2b
893 !! input
894 asdf
895 <!-- comment 1 -->
896
897 jkl
898 !! result
899 <p>asdf
900 </p><p>jkl
901 </p>
902 !! end
903
904 !! test
905 Comment test 3
906 !! input
907 asdf
908 <!-- comment 1 -->
909 <!-- comment 2 -->
910 jkl
911 !! result
912 <p>asdf
913 jkl
914 </p>
915 !! end
916
917 !! test
918 Comment test 4
919 !! input
920 asdf<!-- comment 1 -->jkl
921 !! result
922 <p>asdfjkl
923 </p>
924 !! end
925
926 !! test
927 Comment spacing
928 !! input
929 a
930 <!-- foo --> b <!-- bar -->
931 c
932 !! result
933 <p>a
934 </p>
935 <pre> b
936 </pre>
937 <p>c
938 </p>
939 !! end
940
941 !! test
942 Comment whitespace
943 !! input
944 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
945 !! result
946
947 !! end
948
949 !! test
950 Comment semantics and delimiters
951 !! input
952 <!-- --><!----><!-----><!------>
953 !! result
954
955 !! end
956
957 !! test
958 Comment semantics and delimiters, redux
959 !! input
960 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
961 -- foo -- funky huh? ... -->
962 !! result
963
964 !! end
965
966 !! test
967 Comment semantics and delimiters: directors cut
968 !! input
969 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
970 everything starting with < followed by !-- until the first -- and > we see,
971 that wouldn't be valid XML however, since in XML -- has to terminate a comment
972 -->-->
973 !! result
974 <p>--&gt;
975 </p>
976 !! end
977
978 !! test
979 Comment semantics: nesting
980 !! input
981 <!--<!-- no, we're not going to do anything fancy here -->-->
982 !! result
983 <p>--&gt;
984 </p>
985 !! end
986
987 !! test
988 Comment semantics: unclosed comment at end
989 !! input
990 <!--This comment will run out to the end of the document
991 !! result
992
993 !! end
994
995 !! test
996 Comment in template title
997 !! input
998 {{f<!---->oo}}
999 !! result
1000 <p>FOO
1001 </p>
1002 !! end
1003
1004 !! test
1005 Comment on its own line post-expand
1006 !! input
1007 a
1008 {{blank}}<!---->
1009 b
1010 !! result
1011 <p>a
1012 </p><p>b
1013 </p>
1014 !! end
1015
1016 !! test
1017 Comment on its own line post-expand with non-significant whitespace
1018 !! input
1019 a
1020 {{blank}} <!---->
1021 b
1022 !! result
1023 <p>a
1024 </p><p>b
1025 </p>
1026 !! end
1027
1028 ###
1029 ### paragraph wraping tests
1030 ###
1031 !! test
1032 No block tags
1033 !! input
1034 a
1035
1036 b
1037 !! result
1038 <p>a
1039 </p><p>b
1040 </p>
1041 !! end
1042 !! test
1043 Block tag on one line
1044 !! input
1045 a <div>foo</div>
1046
1047 b
1048 !! result
1049 a <div>foo</div>
1050 <p>b
1051 </p>
1052 !! end
1053
1054 !! test
1055 Block tag on both lines
1056 !! input
1057 a <div>foo</div>
1058
1059 b <div>foo</div>
1060 !! result
1061 a <div>foo</div>
1062 b <div>foo</div>
1063
1064 !! end
1065
1066 !! test
1067 Multiple lines without block tags
1068 !! input
1069 <div>foo</div> a
1070 b
1071 c
1072 d<!--foo--> e
1073 x <div>foo</div> z
1074 !! result
1075 <div>foo</div> a
1076 <p>b
1077 c
1078 d e
1079 </p>
1080 x <div>foo</div> z
1081
1082 !! end
1083
1084 !! test
1085 Empty lines between lines with block tags
1086 !! input
1087 <div></div>
1088
1089
1090 <div></div>a
1091
1092 b
1093 <div>a</div>b
1094
1095 <div>b</div>d
1096
1097
1098 <div>e</div>
1099 !! result
1100 <div></div>
1101 <p><br />
1102 </p>
1103 <div></div>a
1104 <p>b
1105 </p>
1106 <div>a</div>b
1107 <div>b</div>d
1108 <p><br />
1109 </p>
1110 <div>e</div>
1111
1112 !! end
1113
1114 ###
1115 ### Preformatted text
1116 ###
1117 !! test
1118 Preformatted text
1119 !! input
1120 This is some
1121 Preformatted text
1122 With ''italic''
1123 And '''bold'''
1124 And a [[Main Page|link]]
1125 !! result
1126 <pre>This is some
1127 Preformatted text
1128 With <i>italic</i>
1129 And <b>bold</b>
1130 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1131 </pre>
1132 !! end
1133
1134 !! test
1135 Ident preformatting with inline content
1136 !! input
1137 a
1138 ''b''
1139 !! result
1140 <pre>a
1141 <i>b</i>
1142 </pre>
1143 !! end
1144
1145 !! test
1146 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1147 !! input
1148 <pre><nowiki>
1149 <b>
1150 <cite>
1151 <em>
1152 </nowiki></pre>
1153 !! result
1154 <pre>
1155 &lt;b&gt;
1156 &lt;cite&gt;
1157 &lt;em&gt;
1158 </pre>
1159
1160 !! end
1161
1162 !! test
1163 Regression with preformatted in <center>
1164 !! input
1165 <center>
1166 Blah
1167 </center>
1168 !! result
1169 <center>
1170 <pre>Blah
1171 </pre>
1172 </center>
1173
1174 !! end
1175
1176 # Expected output in the following test is not really expected (there should be
1177 # <pre> in the output) -- it's only testing for well-formedness.
1178 !! test
1179 Bug 6200: Preformatted in <blockquote>
1180 !! input
1181 <blockquote>
1182 Blah
1183 </blockquote>
1184 !! result
1185 <blockquote>
1186 Blah
1187 </blockquote>
1188
1189 !! end
1190
1191 !! test
1192 <pre> with attributes (bug 3202)
1193 !! input
1194 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1195 !! result
1196 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1197
1198 !! end
1199
1200 !! test
1201 <pre> with width attribute (bug 3202)
1202 !! input
1203 <pre width="8">Narrow screen goodies</pre>
1204 !! result
1205 <pre width="8">Narrow screen goodies</pre>
1206
1207 !! end
1208
1209 !! test
1210 <pre> with forbidden attribute (bug 3202)
1211 !! input
1212 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1213 !! result
1214 <pre width="8">Narrow screen goodies</pre>
1215
1216 !! end
1217
1218 !! test
1219 Entities inside <pre>
1220 !! input
1221 <pre>&lt;</pre>
1222 !! result
1223 <pre>&lt;</pre>
1224
1225 !! end
1226
1227 !! test
1228 <pre> with forbidden attribute values (bug 3202)
1229 !! input
1230 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1231 !! result
1232 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1233
1234 !! end
1235
1236 !! test
1237 <nowiki> inside <pre> (bug 13238)
1238 !! input
1239 <pre>
1240 <nowiki>
1241 </pre>
1242 <pre>
1243 <nowiki></nowiki>
1244 </pre>
1245 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1246 !! result
1247 <pre>
1248 &lt;nowiki&gt;
1249 </pre>
1250 <pre>
1251
1252 </pre>
1253 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1254
1255 !! end
1256
1257 !! test
1258 <nowiki> and <pre> preference (first one wins)
1259 !! input
1260 <pre>
1261 <nowiki>
1262 </pre>
1263 </nowiki>
1264 </pre>
1265
1266 <nowiki>
1267 <pre>
1268 <nowiki>
1269 </pre>
1270 </nowiki>
1271 </pre>
1272
1273 !! result
1274 <pre>
1275 &lt;nowiki&gt;
1276 </pre>
1277 <p>&lt;/nowiki&gt;
1278 &lt;/pre&gt;
1279 </p><p>
1280 &lt;pre&gt;
1281 &lt;nowiki&gt;
1282 &lt;/pre&gt;
1283
1284 &lt;/pre&gt;
1285 </p>
1286 !! end
1287
1288 !! test
1289 </pre> inside nowiki
1290 !! input
1291 <nowiki></pre></nowiki>
1292 !! result
1293 <p>&lt;/pre&gt;
1294 </p>
1295 !! end
1296
1297 !!test
1298 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1299 !!input
1300 {{echo|}}
1301 !!result
1302
1303 !!end
1304
1305 !!test
1306 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1307 !!input
1308 {{echo|
1309 foo}}
1310 !!result
1311 <p>foo
1312 </p>
1313 !!end
1314
1315 !! test
1316 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1317 !! input
1318 {{echo|a
1319 b}}
1320 !!result
1321 <pre>a
1322 </pre>
1323 <p>b
1324 </p>
1325 !!end
1326
1327 !! test
1328 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1329 !! input
1330 {{echo|a
1331 b
1332 c
1333 d
1334 e
1335 }}
1336 !!result
1337 <pre>a
1338 </pre>
1339 <p>b
1340 c
1341 </p>
1342 <pre>d
1343 </pre>
1344 <p>e
1345 </p>
1346 !!end
1347
1348 !!test
1349 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1350 !!input
1351 {{echo| foo}}
1352
1353 {{echo| foo}}{{echo| bar}}
1354
1355 {{echo| foo}}
1356 {{echo| bar}}
1357
1358 {{echo|<!--cmt--> foo}}
1359
1360 <!--cmt-->{{echo| foo}}
1361
1362 {{echo|{{echo| }}bar}}
1363 !!result
1364 <pre>foo
1365 </pre>
1366 <pre>foo bar
1367 </pre>
1368 <pre>foo
1369 bar
1370 </pre>
1371 <pre>foo
1372 </pre>
1373 <pre>foo
1374 </pre>
1375 <pre>bar
1376 </pre>
1377 !!end
1378
1379 !! test
1380 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1381 !! input
1382 {{echo| }}a
1383
1384 {{echo|
1385 }}a
1386
1387 {{echo|
1388 b}}
1389
1390 {{echo|a
1391 }}b
1392
1393 {{echo|a
1394 }} b
1395 !!result
1396 <pre>a
1397 </pre>
1398 <p><br />
1399 </p>
1400 <pre>a
1401 </pre>
1402 <p><br />
1403 </p>
1404 <pre>b
1405 </pre>
1406 <p>a
1407 </p>
1408 <pre>b
1409 </pre>
1410 <p>a
1411 </p>
1412 <pre>b
1413 </pre>
1414 !!end
1415
1416 !! test
1417 Templates: Single-line variant of parameter whitespace stripping test
1418 !! input
1419 {{echo| a}}
1420
1421 {{echo|1= a}}
1422
1423 {{echo|{{echo| a}}}}
1424
1425 {{echo|1={{echo| a}}}}
1426 !! result
1427 <pre>a
1428 </pre>
1429 <p>a
1430 </p>
1431 <pre>a
1432 </pre>
1433 <p>a
1434 </p>
1435 !! end
1436
1437 !! test
1438 Templates: Strip whitespace from named parameters, but not positional ones
1439 !! input
1440 {{echo|
1441 foo}}
1442
1443 {{echo|
1444 * foo}}
1445
1446 {{echo| 1 =
1447 foo}}
1448
1449 {{echo| 1 =
1450 * foo}}
1451 !! result
1452 <pre>foo
1453 </pre>
1454 <p><br />
1455 </p>
1456 <ul><li> foo
1457 </li></ul>
1458 <p>foo
1459 </p>
1460 <ul><li> foo
1461 </li></ul>
1462
1463 !! end
1464
1465 ###
1466 ### Parsoid-centric tests for testing RT edge cases for pre
1467 ###
1468
1469 !!test
1470 1a. Indent-Pre and Comments
1471 !!input
1472 a
1473 <!--a-->
1474 c
1475 !!result
1476 <pre>a
1477 </pre>
1478 <p>c
1479 </p>
1480 !!end
1481
1482 !!test
1483 1b. Indent-Pre and Comments
1484 !!input
1485 a
1486 <!--a-->
1487 c
1488 !!result
1489 <pre>a
1490 </pre>
1491 <p>c
1492 </p>
1493 !!end
1494
1495 !!test
1496 1c. Indent-Pre and Comments
1497 !!input
1498 <!--a--> a
1499
1500 <!--a--> a
1501 !!result
1502 <pre> a
1503 </pre>
1504 <pre> a
1505 </pre>
1506 !!end
1507
1508 !!test
1509 2a. Indent-Pre and tables
1510 !!input
1511 {|
1512 |-
1513 !h1!!h2
1514 |foo||bar
1515 |}
1516 !!result
1517 <table>
1518
1519 <tr>
1520 <th>h1</th>
1521 <th>h2
1522 </th>
1523 <td>foo</td>
1524 <td>bar
1525 </td></tr></table>
1526
1527 !!end
1528
1529 !!test
1530 2b. Indent-Pre and tables
1531 !!input
1532 {|
1533 |-
1534 |foo
1535 |}
1536 !!result
1537 <table>
1538
1539 <tr>
1540 <td>foo
1541 </td></tr></table>
1542
1543 !!end
1544
1545 !!test
1546 2c. Indent-Pre and tables (bug 42252)
1547 !!input
1548 {|
1549 |+ foo
1550 ! | bar
1551 |}
1552 !!result
1553 <table>
1554 <caption> foo
1555 </caption>
1556 <tr>
1557 <th> bar
1558 </th></tr></table>
1559
1560 !!end
1561
1562 !!test
1563 3a. Indent-Pre and block tags (single-line html)
1564 !!input
1565 <p> foo </p>
1566 <div> foo </div>
1567 <span> foo </span>
1568 !!result
1569 <p> foo </p>
1570 <div> foo </div>
1571 <pre><span> foo </span>
1572 </pre>
1573 !!end
1574
1575 !!test
1576 3b. Indent-Pre and block tags (pre-content on separate line)
1577 !!input
1578 <p>
1579 foo
1580 </p>
1581
1582 <div>
1583 foo
1584 </div>
1585
1586 <center>
1587 foo
1588 </center>
1589
1590 <blockquote>
1591 foo
1592 </blockquote>
1593
1594 <table><tr><td>
1595 foo
1596 </td></tr></table>
1597
1598 <ul><li>
1599 foo
1600 </li></ul>
1601
1602 !!result
1603 <p>
1604 foo
1605 </p>
1606 <div>
1607 <pre>foo
1608 </pre>
1609 </div>
1610 <center>
1611 <pre>foo
1612 </pre>
1613 </center>
1614 <blockquote>
1615 foo
1616 </blockquote>
1617 <table><tr><td>
1618 <pre>foo
1619 </pre>
1620 </td></tr></table>
1621 <ul><li>
1622 foo
1623 </li></ul>
1624
1625 !!end
1626
1627 !!test
1628 4. Multiple spaces at start-of-line
1629 !!input
1630 <p> foo </p>
1631 foo
1632 {|
1633 |foo
1634 |}
1635 !!result
1636 <p> foo </p>
1637 <pre> foo
1638 </pre>
1639 <table>
1640 <tr>
1641 <td>foo
1642 </td></tr></table>
1643
1644 !!end
1645
1646 !! test
1647 5. White-space in indent-pre
1648 NOTE: the white-space char on 2nd line is significant
1649 !! input
1650 a<br/>
1651
1652 b
1653 !! result
1654 <pre>a<br />
1655
1656 b
1657 </pre>
1658 !! end
1659
1660 ###
1661 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1662 ###
1663
1664 !!test
1665 HTML-pre: 1. embedded newlines
1666 !!input
1667 <pre>foo</pre>
1668
1669 <pre>
1670 foo
1671 </pre>
1672
1673 <pre>
1674
1675 foo
1676 </pre>
1677
1678 <pre>
1679
1680
1681 foo
1682 </pre>
1683 !!result
1684 <pre>foo</pre>
1685 <pre>
1686 foo
1687 </pre>
1688 <pre>
1689
1690 foo
1691 </pre>
1692 <pre>
1693
1694
1695 foo
1696 </pre>
1697
1698 !!end
1699
1700 !!test
1701 HTML-pre: 2: indented text
1702 !!input
1703 <pre>
1704 foo
1705 </pre>
1706 !!result
1707 <pre>
1708 foo
1709 </pre>
1710
1711 !!end
1712
1713 !!test
1714 HTML-pre: 3: other wikitext
1715 !!input
1716 <pre>
1717 * foo
1718 # bar
1719 = no-h =
1720 '' no-italic ''
1721 [[ NoLink ]]
1722 </pre>
1723 !!result
1724 <pre>
1725 * foo
1726 # bar
1727 = no-h =
1728 '' no-italic ''
1729 [[ NoLink ]]
1730 </pre>
1731
1732 !!end
1733
1734 ###
1735 ### Definition lists
1736 ###
1737 !! test
1738 Simple definition
1739 !! input
1740 ; name : Definition
1741 !! result
1742 <dl><dt> name&#160;</dt><dd> Definition
1743 </dd></dl>
1744
1745 !! end
1746
1747 !! test
1748 Definition list for indentation only
1749 !! input
1750 : Indented text
1751 !! result
1752 <dl><dd> Indented text
1753 </dd></dl>
1754
1755 !! end
1756
1757 !! test
1758 Definition list with no space
1759 !! input
1760 ;name:Definition
1761 !! result
1762 <dl><dt>name</dt><dd>Definition
1763 </dd></dl>
1764
1765 !!end
1766
1767 !! test
1768 Definition list with URL link
1769 !! input
1770 ; http://example.com/ : definition
1771 !! result
1772 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
1773 </dd></dl>
1774
1775 !! end
1776
1777 !! test
1778 Definition list with bracketed URL link
1779 !! input
1780 ;[http://www.example.com/ Example]:Something about it
1781 !! result
1782 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
1783 </dd></dl>
1784
1785 !! end
1786
1787 !! test
1788 Definition list with wikilink containing colon
1789 !! input
1790 ; [[Help:FAQ]]: The least-read page on Wikipedia
1791 !! result
1792 <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
1793 </dd></dl>
1794
1795 !! end
1796
1797 # At Brion's and JeLuF's insistence... :)
1798 !! test
1799 Definition list with news link containing colon
1800 !! input
1801 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
1802 !! result
1803 <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!
1804 </dd></dl>
1805
1806 !! end
1807
1808 !! test
1809 Malformed definition list with colon
1810 !! input
1811 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
1812 !! result
1813 <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
1814 </dt></dl>
1815
1816 !! end
1817
1818 !! test
1819 Definition lists: colon in external link text
1820 !! input
1821 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
1822 !! result
1823 <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
1824 </dd></dl>
1825
1826 !! end
1827
1828 !! test
1829 Definition lists: colon in HTML attribute
1830 !! input
1831 ;<b style="display: inline">bold</b>
1832 !! result
1833 <dl><dt><b style="display: inline">bold</b>
1834 </dt></dl>
1835
1836 !! end
1837
1838 !! test
1839 Definition lists: self-closed tag
1840 !! input
1841 ;one<br/>two : two-line fun
1842 !! result
1843 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
1844 </dd></dl>
1845
1846 !! end
1847
1848 !! test
1849 Bug 11748: Literal closing tags
1850 !! input
1851 <dl>
1852 <dt>test 1</dt>
1853 <dd>test test test test test</dd>
1854 <dt>test 2</dt>
1855 <dd>test test test test test</dd>
1856 </dl>
1857 !! result
1858 <dl>
1859 <dt>test 1</dt>
1860 <dd>test test test test test</dd>
1861 <dt>test 2</dt>
1862 <dd>test test test test test</dd>
1863 </dl>
1864
1865 !! end
1866
1867 !! test
1868 Definition and unordered list using wiki syntax nested in unordered list using html tags.
1869 !! input
1870 <ul><li>
1871 ; term : description
1872 * unordered
1873 </li>
1874 </ul>
1875 !! result
1876 <ul><li>
1877 <dl><dt> term&#160;</dt><dd> description
1878 </dd></dl>
1879 <ul><li> unordered
1880 </li></ul>
1881 </li>
1882 </ul>
1883
1884 !! end
1885
1886 !! test
1887
1888 Definition list with empty definition and following paragraph
1889 !! input
1890 ; term:
1891 Paragraph text
1892 !! result
1893 <dl><dt> term</dt><dd>
1894 </dd></dl>
1895 <p>Paragraph text
1896 </p>
1897 !! end
1898
1899 !! test
1900 Nested definition lists using html syntax
1901 !! input
1902 <dl><dd>
1903 <dl>
1904 <dd>Foo</dd>
1905 </dl>
1906 </dd></dl>
1907 !! result
1908 <dl><dd>
1909 <dl>
1910 <dd>Foo</dd>
1911 </dl>
1912 </dd></dl>
1913
1914 !! end
1915
1916 !! test
1917 Definition Lists: No nesting: Multiple dd's
1918 !! input
1919 ;x
1920 :a
1921 :b
1922 !! result
1923 <dl><dt>x
1924 </dt><dd>a
1925 </dd><dd>b
1926 </dd></dl>
1927
1928 !! end
1929
1930 !! test
1931 Definition Lists: Indentation: Regular
1932 !! input
1933 :i1
1934 ::i2
1935 :::i3
1936 !! result
1937 <dl><dd>i1
1938 <dl><dd>i2
1939 <dl><dd>i3
1940 </dd></dl>
1941 </dd></dl>
1942 </dd></dl>
1943
1944 !! end
1945
1946 !! test
1947 Definition Lists: Indentation: Missing 1st level
1948 !! input
1949 ::i2
1950 :::i3
1951 !! result
1952 <dl><dd><dl><dd>i2
1953 <dl><dd>i3
1954 </dd></dl>
1955 </dd></dl>
1956 </dd></dl>
1957
1958 !! end
1959
1960 !! test
1961 Definition Lists: Indentation: Multi-level indent
1962 !! input
1963 :::i3
1964 !! result
1965 <dl><dd><dl><dd><dl><dd>i3
1966 </dd></dl>
1967 </dd></dl>
1968 </dd></dl>
1969
1970 !! end
1971
1972 !! test
1973 Definition Lists: Hacky use to indent tables
1974 !! input
1975 ::{|
1976 |foo
1977 |bar
1978 |}
1979 this text
1980 should be left alone
1981 !! result
1982 <dl><dd><dl><dd><table>
1983 <tr>
1984 <td>foo
1985 </td>
1986 <td>bar
1987 </td></tr></table></dd></dl></dd></dl>
1988 <p>this text
1989 should be left alone
1990 </p>
1991 !! end
1992 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
1993 ## as an empty dt item. It also ignores all but the last ";" when followed
1994 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
1995 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
1996 ## ";"s.
1997 ##
1998 ## Ex: ";;t2 ::d2" is transformed into:
1999 ##
2000 ## <dl>
2001 ## <dt>t2 </dt>
2002 ## <dd>
2003 ## <dl>
2004 ## <dt></dt>
2005 ## <dd>d2</dd>
2006 ## </dl>
2007 ## </dd>
2008 ## </dl>
2009 ##
2010 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2011 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2012 ##
2013 ## <dl>
2014 ## <dt>
2015 ## <dl>
2016 ## <dt>t2 </dt>
2017 ## <dd>:d2</dd>
2018 ## </dl>
2019 ## </dt>
2020 ## </dl>
2021 ##
2022 ## All Parsoid only definition list tests have this difference.
2023 ##
2024 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2025 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2026
2027 !! test
2028 Table / list interaction: indented table with lists in table contents
2029 !! input
2030 :{|
2031 |-
2032 | a
2033 * b
2034 |-
2035 | c
2036 * d
2037 |}
2038 !! result
2039 <dl><dd><table>
2040
2041 <tr>
2042 <td> a
2043 <ul><li> b
2044 </li></ul>
2045 </td></tr>
2046 <tr>
2047 <td> c
2048 <ul><li> d
2049 </li></ul>
2050 </td></tr></table></dd></dl>
2051
2052 !! end
2053
2054 !!test
2055 Table / list interaction: lists nested in tables nested in indented lists
2056 !!input
2057 :{|
2058 |
2059 :a
2060 :b
2061 |
2062 *c
2063 *d
2064 |}
2065
2066 *e
2067 *f
2068 !!result
2069 <dl><dd><table>
2070 <tr>
2071 <td>
2072 <dl><dd>a
2073 </dd><dd>b
2074 </dd></dl>
2075 </td>
2076 <td>
2077 <ul><li>c
2078 </li><li>d
2079 </li></ul>
2080 </td></tr></table></dd></dl>
2081 <ul><li>e
2082 </li><li>f
2083 </li></ul>
2084
2085 !!end
2086
2087 !! test
2088 Definition Lists: Nesting: Multi-level (Parsoid only)
2089 !! options
2090 parsoid
2091 !! input
2092 ;t1 :d1
2093 ;;t2 ::d2
2094 ;;;t3 :::d3
2095 !! result
2096 <dl>
2097 <dt>t1 </dt>
2098 <dd>d1</dd>
2099 <dt>
2100 <dl>
2101 <dt>t2 </dt>
2102 <dd>:d2</dd>
2103 <dt>
2104 <dl>
2105 <dt>t3 </dt>
2106 <dd>::d3</dd>
2107 </dl>
2108 </dt>
2109 </dl>
2110 </dt>
2111 </dl>
2112
2113
2114 !! end
2115
2116
2117 !! test
2118 Definition Lists: Nesting: Test 2 (Parsoid only)
2119 !! options
2120 parsoid
2121 !! input
2122 ;t1
2123 ::d2
2124 !! result
2125 <dl>
2126 <dt>t1</dt>
2127 <dd>
2128 <dl>
2129 <dd>d2</dd>
2130 </dl>
2131 </dd>
2132 </dl>
2133
2134 !! end
2135
2136
2137 !! test
2138 Definition Lists: Nesting: Test 3 (Parsoid only)
2139 !! options
2140 parsoid
2141 !! input
2142 :;t1
2143 ::::d2
2144 !! result
2145 <dl>
2146 <dd>
2147 <dl>
2148 <dt>t1</dt>
2149 <dd>
2150 <dl>
2151 <dd>
2152 <dl>
2153 <dd>d2</dd>
2154 </dl>
2155 </dd>
2156 </dl>
2157 </dd>
2158 </dl>
2159 </dd>
2160 </dl>
2161
2162 !! end
2163
2164
2165 !! test
2166 Definition Lists: Nesting: Test 4
2167 !! input
2168 ::;t3
2169 :::d3
2170 !! result
2171 <dl><dd><dl><dd><dl><dt>t3
2172 </dt><dd>d3
2173 </dd></dl>
2174 </dd></dl>
2175 </dd></dl>
2176
2177 !! end
2178
2179
2180 ## The Parsoid team believes the following three test exposes a
2181 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2182 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2183 !! test
2184 Definition Lists: Mixed Lists: Test 1 (php)
2185 !! options
2186 php
2187 !! input
2188 :;* foo
2189 ::* bar
2190 :; baz
2191 !! result
2192 <dl><dd><dl><dt><ul><li> foo
2193 </li><li> bar
2194 </li></ul>
2195 </dt></dl>
2196 <dl><dt> baz
2197 </dt></dl>
2198 </dd></dl>
2199
2200 !! end
2201 !! test
2202 Definition Lists: Mixed Lists: Test 1 (parsoid)
2203 !! options
2204 parsoid
2205 !! input
2206 :;* foo
2207 ::* bar
2208 :; baz
2209 !! result
2210 <dl><dd><dl><dt><ul><li> foo
2211 </li></ul></dt><dd><ul><li> bar
2212 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2213 !! end
2214
2215 !! test
2216 Definition Lists: Mixed Lists: Test 2
2217 !! input
2218 *: d1
2219 *: d2
2220 !! result
2221 <ul><li><dl><dd> d1
2222 </dd><dd> d2
2223 </dd></dl>
2224 </li></ul>
2225
2226 !! end
2227
2228
2229 !! test
2230 Definition Lists: Mixed Lists: Test 3
2231 !! input
2232 *::: d1
2233 *::: d2
2234 !! result
2235 <ul><li><dl><dd><dl><dd><dl><dd> d1
2236 </dd><dd> d2
2237 </dd></dl>
2238 </dd></dl>
2239 </dd></dl>
2240 </li></ul>
2241
2242 !! end
2243
2244
2245 !! test
2246 Definition Lists: Mixed Lists: Test 4
2247 !! input
2248 *;d1 :d2
2249 *;d3 :d4
2250 !! result
2251 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2252 </dd><dt>d3&#160;</dt><dd>d4
2253 </dd></dl>
2254 </li></ul>
2255
2256 !! end
2257
2258
2259 !! test
2260 Definition Lists: Mixed Lists: Test 5
2261 !! input
2262 *:d1
2263 *:: d2
2264 !! result
2265 <ul><li><dl><dd>d1
2266 <dl><dd> d2
2267 </dd></dl>
2268 </dd></dl>
2269 </li></ul>
2270
2271 !! end
2272
2273
2274 !! test
2275 Definition Lists: Mixed Lists: Test 6
2276 !! input
2277 #*:d1
2278 #*::: d3
2279 !! result
2280 <ol><li><ul><li><dl><dd>d1
2281 <dl><dd><dl><dd> d3
2282 </dd></dl>
2283 </dd></dl>
2284 </dd></dl>
2285 </li></ul>
2286 </li></ol>
2287
2288 !! end
2289
2290
2291 !! test
2292 Definition Lists: Mixed Lists: Test 7
2293 !! input
2294 :* d1
2295 :* d2
2296 !! result
2297 <dl><dd><ul><li> d1
2298 </li><li> d2
2299 </li></ul>
2300 </dd></dl>
2301
2302 !! end
2303
2304
2305 !! test
2306 Definition Lists: Mixed Lists: Test 8
2307 !! input
2308 :* d1
2309 ::* d2
2310 !! result
2311 <dl><dd><ul><li> d1
2312 </li></ul>
2313 <dl><dd><ul><li> d2
2314 </li></ul>
2315 </dd></dl>
2316 </dd></dl>
2317
2318 !! end
2319
2320
2321 !! test
2322 Definition Lists: Mixed Lists: Test 9
2323 !! input
2324 *;foo :bar
2325 !! result
2326 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2327 </dd></dl>
2328 </li></ul>
2329
2330 !! end
2331
2332
2333 !! test
2334 Definition Lists: Mixed Lists: Test 10
2335 !! input
2336 *#;foo :bar
2337 !! result
2338 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2339 </dd></dl>
2340 </li></ol>
2341 </li></ul>
2342
2343 !! end
2344
2345 # The Parsoid team disagrees with the PHP parser's seemingly-random
2346 # rules regarding dd/dt on the next two tests. Parsoid is more
2347 # consistent, and recognizes the shared nesting and keeps the
2348 # still-open tags around until the nesting is complete.
2349
2350 !! test
2351 Definition Lists: Mixed Lists: Test 11 (php)
2352 !! options
2353 php
2354 !! input
2355 *#*#;*;;foo :bar
2356 *#*#;boo :baz
2357 !! result
2358 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2359 </dt></dl>
2360 </dd></dl>
2361 </li></ul>
2362 </dd></dl>
2363 <dl><dt>boo&#160;</dt><dd>baz
2364 </dd></dl>
2365 </li></ol>
2366 </li></ul>
2367 </li></ol>
2368 </li></ul>
2369
2370 !! end
2371 !! test
2372 Definition Lists: Mixed Lists: Test 11 (parsoid)
2373 !! options
2374 parsoid
2375 !! input
2376 *#*#;*;;foo :bar
2377 *#*#;boo :baz
2378 !! result
2379 <ul><li><ol><li><ul><li><ol><li><dl><dt><ul><li><dl><dt><dl><dt>foo&nbsp;</dt><dd>bar
2380 </dd></dl></dt></dl></li></ul></dt><dt>boo&nbsp;</dt><dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2381 !! end
2382
2383
2384 !! test
2385 Definition Lists: Weird Ones: Test 1 (php)
2386 !! options
2387 php
2388 !! input
2389 *#;*::;; foo : bar (who uses this?)
2390 !! result
2391 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2392 </dt></dl>
2393 </dd></dl>
2394 </dd></dl>
2395 </dd></dl>
2396 </li></ul>
2397 </dd></dl>
2398 </li></ol>
2399 </li></ul>
2400
2401 !! end
2402 !! test
2403 Definition Lists: Weird Ones: Test 1 (parsoid)
2404 !! options
2405 parsoid
2406 !! input
2407 *#;*::;; foo : bar (who uses this?)
2408 !! result
2409 <ul><li><ol><li><dl><dt><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> foo&nbsp;</dt><dd> bar (who uses this?)</dd></dl></dt></dl></dd></dl></dd></dl></li></ul></dt></dl></li></ol></li></ul>
2410 !! end
2411
2412 ###
2413 ### External links
2414 ###
2415 !! test
2416 External links: non-bracketed
2417 !! input
2418 Non-bracketed: http://example.com
2419 !! result
2420 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2421 </p>
2422 !! end
2423
2424 !! test
2425 External links: numbered
2426 !! input
2427 Numbered: [http://example.com]
2428 Numbered: [http://example.net]
2429 Numbered: [http://example.com]
2430 !! result
2431 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2432 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2433 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2434 </p>
2435 !!end
2436
2437 !! test
2438 External links: specified text
2439 !! input
2440 Specified text: [http://example.com link]
2441 !! result
2442 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2443 </p>
2444 !!end
2445
2446 !! test
2447 External links: trail
2448 !! input
2449 Linktrails should not work for external links: [http://example.com link]s
2450 !! result
2451 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2452 </p>
2453 !! end
2454
2455 !! test
2456 External links: dollar sign in URL
2457 !! input
2458 http://example.com/1$2345
2459 !! result
2460 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2461 </p>
2462 !! end
2463
2464 !! test
2465 External links: dollar sign in URL (named)
2466 !! input
2467 [http://example.com/1$2345]
2468 !! result
2469 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2470 </p>
2471 !!end
2472
2473 !! test
2474 External links: open square bracket forbidden in URL (bug 4377)
2475 !! input
2476 http://example.com/1[2345
2477 !! result
2478 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2479 </p>
2480 !! end
2481
2482 !! test
2483 External links: open square bracket forbidden in URL (named) (bug 4377)
2484 !! input
2485 [http://example.com/1[2345]
2486 !! result
2487 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2488 </p>
2489 !!end
2490
2491 !! test
2492 External links: nowiki in URL link text (bug 6230)
2493 !!input
2494 [http://example.com/ <nowiki>''example site''</nowiki>]
2495 !! result
2496 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2497 </p>
2498 !! end
2499
2500 !! test
2501 External links: newline forbidden in text (bug 6230 regression check)
2502 !! input
2503 [http://example.com/ first
2504 second]
2505 !! result
2506 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2507 second]
2508 </p>
2509 !!end
2510
2511 !! test
2512 External links: Pipe char between url and text
2513 !! input
2514 [http://example.com | link]
2515 !! result
2516 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2517 </p>
2518 !!end
2519
2520 !! test
2521 External links: protocol-relative URL in brackets
2522 !! input
2523 [//example.com/ Test]
2524 !! result
2525 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2526 </p>
2527 !! end
2528
2529 !! test
2530 External links: protocol-relative URL in brackets without text
2531 !! input
2532 [//example.com]
2533 !! result
2534 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2535 </p>
2536 !! end
2537
2538 !! test
2539 External links: protocol-relative URL in free text is left alone
2540 !! input
2541 //example.com/Foo
2542 !! result
2543 <p>//example.com/Foo
2544 </p>
2545 !!end
2546
2547 !! test
2548 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2549 !! input
2550 foo//example.com/Foo
2551 !! result
2552 <p>foo//example.com/Foo
2553 </p>
2554 !! end
2555
2556 !! test
2557 External image
2558 !! input
2559 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2560 !! result
2561 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2562 </p>
2563 !! end
2564
2565 !! test
2566 External image from https
2567 !! input
2568 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2569 !! result
2570 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2571 </p>
2572 !! end
2573
2574 !! test
2575 Link to non-http image, no img tag
2576 !! input
2577 Link to non-http image, no img tag: ftp://example.com/test.jpg
2578 !! result
2579 <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>
2580 </p>
2581 !! end
2582
2583 !! test
2584 External links: terminating separator
2585 !! input
2586 Terminating separator: http://example.com/thing,
2587 !! result
2588 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2589 </p>
2590 !! end
2591
2592 !! test
2593 External links: intervening separator
2594 !! input
2595 Intervening separator: http://example.com/1,2,3
2596 !! result
2597 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2598 </p>
2599 !! end
2600
2601 !! test
2602 External links: old bug with URL in query
2603 !! input
2604 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2605 !! result
2606 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2607 </p>
2608 !! end
2609
2610 !! test
2611 External links: old URL-in-URL bug, mixed protocols
2612 !! input
2613 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2614 !! result
2615 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2616 </p>
2617 !!end
2618
2619 !! test
2620 External links: URL in text
2621 !! input
2622 URL in text: [http://example.com http://example.com]
2623 !! result
2624 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2625 </p>
2626 !! end
2627
2628 !! test
2629 External links: Clickable images
2630 !! input
2631 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2632 !! result
2633 <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>
2634 </p>
2635 !!end
2636
2637 !! test
2638 External links: raw ampersand
2639 !! input
2640 Old &amp; use: http://x&y
2641 !! result
2642 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2643 </p>
2644 !! end
2645
2646 !! test
2647 External links: encoded ampersand
2648 !! input
2649 Old &amp; use: http://x&amp;y
2650 !! result
2651 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2652 </p>
2653 !! end
2654
2655 !! test
2656 External links: encoded equals (bug 6102)
2657 !! input
2658 http://example.com/?foo&#61;bar
2659 !! result
2660 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2661 </p>
2662 !! end
2663
2664 !! test
2665 External links: [raw ampersand]
2666 !! input
2667 Old &amp; use: [http://x&y]
2668 !! result
2669 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2670 </p>
2671 !! end
2672
2673 !! test
2674 External links: [encoded ampersand]
2675 !! input
2676 Old &amp; use: [http://x&amp;y]
2677 !! result
2678 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2679 </p>
2680 !! end
2681
2682 !! test
2683 External links: [encoded equals] (bug 6102)
2684 !! input
2685 [http://example.com/?foo&#61;bar]
2686 !! result
2687 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2688 </p>
2689 !! end
2690
2691 !! test
2692 External links: [IDN ignored character reference in hostname; strip it right off]
2693 !! input
2694 [http://e&zwnj;xample.com/]
2695 !! result
2696 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2697 </p>
2698 !! end
2699
2700 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2701 # Where an external link could easily circumvent the sanitization of the text of
2702 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2703 # test demands a higher standard. That's a bit strange.
2704 #
2705 # Example:
2706 #
2707 # http://e‌xample.com -> [http://example.com|http://example.com]
2708 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2709 #
2710 # The first example is sanitized, but the second is not. Any security benefits
2711 # from this production are trivial to circumvent. Either remove this test and
2712 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2713 # the test accordingly.
2714 #
2715 # All our love,
2716 # The Parsoid team.
2717 !! test
2718 External links: IDN ignored character reference in hostname; strip it right off
2719 !! input
2720 http://e&zwnj;xample.com/
2721 !! result
2722 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
2723 </p>
2724 !! end
2725
2726 !! test
2727 External links: www.jpeg.org (bug 554)
2728 !! input
2729 http://www.jpeg.org
2730 !!result
2731 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
2732 </p>
2733 !! end
2734
2735 !! test
2736 External links: URL within URL (original bug 2)
2737 !! input
2738 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
2739 !! result
2740 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
2741 </p>
2742 !! end
2743
2744 !! test
2745 BUG 361: URL inside bracketed URL
2746 !! input
2747 [http://www.example.com/foo http://www.example.com/bar]
2748 !! result
2749 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
2750 </p>
2751 !! end
2752
2753 !! test
2754 BUG 361: URL within URL, not bracketed
2755 !! input
2756 http://www.example.com/foo?=http://www.example.com/bar
2757 !! result
2758 <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>
2759 </p>
2760 !! end
2761
2762 !! test
2763 BUG 289: ">"-token in URL-tail
2764 !! input
2765 http://www.example.com/<hello>
2766 !! result
2767 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
2768 </p>
2769 !!end
2770
2771 !! test
2772 BUG 289: literal ">"-token in URL-tail
2773 !! input
2774 http://www.example.com/<b>html</b>
2775 !! result
2776 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
2777 </p>
2778 !!end
2779
2780 !! test
2781 BUG 289: ">"-token in bracketed URL
2782 !! input
2783 [http://www.example.com/<hello> stuff]
2784 !! result
2785 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
2786 </p>
2787 !!end
2788
2789 !! test
2790 BUG 289: literal ">"-token in bracketed URL
2791 !! input
2792 [http://www.example.com/<b>html</b> stuff]
2793 !! result
2794 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
2795 </p>
2796 !!end
2797
2798 !! test
2799 BUG 289: literal double quote at end of URL
2800 !! input
2801 http://www.example.com/"hello"
2802 !! result
2803 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
2804 </p>
2805 !!end
2806
2807 !! test
2808 BUG 289: literal double quote in bracketed URL
2809 !! input
2810 [http://www.example.com/"hello" stuff]
2811 !! result
2812 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
2813 </p>
2814 !!end
2815
2816 !! test
2817 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
2818 !! input
2819 [http://www.example.com test]
2820 !! result
2821 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
2822 </p>
2823 !! end
2824
2825 !! test
2826 External links: link text with spaces
2827 !! input
2828 [http://www.example.com a b c]
2829 [http://www.example.com ''a'' ''b'']
2830 !! result
2831 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
2832 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
2833 </p>
2834 !! end
2835
2836 !! test
2837 External links: wiki links within external link (Bug 3695)
2838 !! input
2839 [http://example.com [[wikilink]] embedded in ext link]
2840 !! result
2841 <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>
2842 </p>
2843 !! end
2844
2845 !! test
2846 BUG 787: Links with one slash after the url protocol are invalid
2847 !! input
2848 http:/example.com
2849
2850 [http:/example.com title]
2851 !! result
2852 <p>http:/example.com
2853 </p><p>[http:/example.com title]
2854 </p>
2855 !! end
2856
2857 !! test
2858 Bracketed external links with template-generated invalid target
2859 !! input
2860 [{{echo|http:/example.com}} title]
2861 !! result
2862 <p>[http:/example.com title]
2863 </p>
2864 !! end
2865
2866 !! test
2867 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
2868 !! input
2869 ''[http://example.com text'']
2870 [http://example.com '''text]'''
2871 ''Something [http://example.com in italic'']
2872 ''Something [http://example.com mixed''''', even bold]'''
2873 '''''Now [http://example.com both''''']
2874 !! result
2875 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
2876 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
2877 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
2878 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
2879 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
2880 </p>
2881 !! end
2882
2883
2884 !! test
2885 Bug 4781: %26 in URL
2886 !! input
2887 http://www.example.com/?title=AT%26T
2888 !! result
2889 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
2890 </p>
2891 !! end
2892
2893 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
2894 # % is actually legal in HTML5. Any change in output would need testing though.
2895 !! test
2896 Bug 4781, 5267: %25 in URL
2897 !! input
2898 http://www.example.com/?title=100%25_Bran
2899 !! result
2900 <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>
2901 </p>
2902 !! end
2903
2904 !! test
2905 Bug 4781, 5267: %28, %29 in URL
2906 !! input
2907 http://www.example.com/?title=Ben-Hur_%281959_film%29
2908 !! result
2909 <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>
2910 </p>
2911 !! end
2912
2913
2914 !! test
2915 Bug 4781: %26 in autonumber URL
2916 !! input
2917 [http://www.example.com/?title=AT%26T]
2918 !! result
2919 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
2920 </p>
2921 !! end
2922
2923 !! test
2924 Bug 4781, 5267: %26 in autonumber URL
2925 !! input
2926 [http://www.example.com/?title=100%25_Bran]
2927 !! result
2928 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
2929 </p>
2930 !! end
2931
2932 !! test
2933 Bug 4781, 5267: %28, %29 in autonumber URL
2934 !! input
2935 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
2936 !! result
2937 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
2938 </p>
2939 !! end
2940
2941
2942 !! test
2943 Bug 4781: %26 in bracketed URL
2944 !! input
2945 [http://www.example.com/?title=AT%26T link]
2946 !! result
2947 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
2948 </p>
2949 !! end
2950
2951 !! test
2952 Bug 4781, 5267: %26 in bracketed URL
2953 !! input
2954 [http://www.example.com/?title=100%25_Bran link]
2955 !! result
2956 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
2957 </p>
2958 !! end
2959
2960 !! test
2961 Bug 4781, 5267: %28, %29 in bracketed URL
2962 !! input
2963 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
2964 !! result
2965 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
2966 </p>
2967 !! end
2968
2969 !! test
2970 External link containing double-single-quotes in text '' (bug 4598 sanity check)
2971 !! input
2972 Some [http://example.com/ pretty ''italics'' and stuff]!
2973 !! result
2974 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
2975 </p>
2976 !! end
2977
2978 !! test
2979 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
2980 !! input
2981 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
2982 !! result
2983 <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>
2984 </p>
2985 !! end
2986
2987 !! test
2988 External link containing double-single-quotes with no space separating the url from text in italics
2989 !! input
2990 [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]].]
2991 !! result
2992 <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>
2993 </p>
2994 !! end
2995
2996 !! test
2997 URL-encoding in URL functions (single parameter)
2998 !! input
2999 {{localurl:Some page|amp=&}}
3000 !! result
3001 <p>/index.php?title=Some_page&amp;amp=&amp;
3002 </p>
3003 !! end
3004
3005 !! test
3006 URL-encoding in URL functions (multiple parameters)
3007 !! input
3008 {{localurl:Some page|q=?&amp=&}}
3009 !! result
3010 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3011 </p>
3012 !! end
3013
3014 !! test
3015 Brackets in urls
3016 !! input
3017 http://example.com/index.php?foozoid%5B%5D=bar
3018
3019 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3020 !! result
3021 <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>
3022 </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>
3023 </p>
3024 !! end
3025
3026 !! test
3027 IPv6 urls (bug 21261)
3028 !! options
3029 disabled
3030 !! input
3031 http://[2404:130:0:1000::187:2]/index.php
3032 !! result
3033 <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>
3034 </p>
3035 !! end
3036
3037 !! test
3038 Non-extlinks in brackets
3039 !! input
3040 [foo]
3041 [foo bar]
3042 [foo ''bar'']
3043 [fool's] errand
3044 [fool's errand]
3045 [{{echo|foo}}]
3046 [{{echo|foo}} bar]
3047 [{{echo|foo}} ''bar'']
3048 [{{echo|foo}}l's] errand
3049 [{{echo|foo}}l's errand]
3050 [url={{echo|foo}}]
3051 [url=http://example.com]
3052 !! result
3053 <p>[foo]
3054 [foo bar]
3055 [foo <i>bar</i>]
3056 [fool's] errand
3057 [fool's errand]
3058 [foo]
3059 [foo bar]
3060 [foo <i>bar</i>]
3061 [fool's] errand
3062 [fool's errand]
3063 [url=foo]
3064 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3065 </p>
3066 !! end
3067
3068 ###
3069 ### Quotes
3070 ###
3071
3072 !! test
3073 Quotes
3074 !! input
3075 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3076
3077 Normal text. '''''Bold italic text.''''' Normal text.
3078 !!result
3079 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3080 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3081 </p>
3082 !! end
3083
3084
3085 !! test
3086 Unclosed and unmatched quotes (php)
3087 !! options
3088 php
3089 !! input
3090 '''''Bold italic text '''with bold deactivated''' in between.'''''
3091
3092 '''''Bold italic text ''with italic deactivated'' in between.'''''
3093
3094 '''Bold text..
3095
3096 ..spanning two paragraphs (should not work).'''
3097
3098 '''Bold tag left open
3099
3100 ''Italic tag left open
3101
3102 Normal text.
3103
3104 <!-- Unmatching number of opening, closing tags: -->
3105 '''This year''''s election ''should'' beat '''last year''''s.
3106
3107 ''Tom'''s car is bigger than ''Susan'''s.
3108
3109 Plain ''italic'''s plain
3110 !! result
3111 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3112 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3113 </p><p><b>Bold text..</b>
3114 </p><p>..spanning two paragraphs (should not work).
3115 </p><p><b>Bold tag left open</b>
3116 </p><p><i>Italic tag left open</i>
3117 </p><p>Normal text.
3118 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3119 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3120 </p><p>Plain <i>italic'</i>s plain
3121 </p>
3122 !! end
3123 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3124 # parser strips. The wikitext contains just the first half of the bold
3125 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3126 # differently than the PHP parser.)
3127 !! test
3128 Unclosed and unmatched quotes (parsoid)
3129 !! options
3130 parsoid
3131 !! input
3132 '''''Bold italic text '''with bold deactivated''' in between.'''''
3133
3134 '''''Bold italic text ''with italic deactivated'' in between.'''''
3135
3136 '''Bold text..
3137
3138 ..spanning two paragraphs (should not work).'''
3139
3140 '''Bold tag left open
3141
3142 ''Italic tag left open
3143
3144 Normal text.
3145
3146 <!-- Unmatching number of opening, closing tags: -->
3147 '''This year''''s election ''should'' beat '''last year''''s.
3148
3149 ''Tom'''s car is bigger than ''Susan'''s.
3150
3151 Plain ''italic'''s plain
3152 !! result
3153 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3154 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3155 </p><p><b>Bold text..</b>
3156 </p><p>..spanning two paragraphs (should not work).<b></b>
3157 </p><p><b>Bold tag left open</b>
3158 </p><p><i>Italic tag left open</i>
3159 </p><p>Normal text.
3160 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3161 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3162 </p><p>Plain <i>italic'</i>s plain
3163 </p>
3164 !! end
3165
3166 ###
3167 ### Tables
3168 ###
3169 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3170 ###
3171
3172 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3173 # is the bare minimun required by the spec, see:
3174 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3175 !! test
3176 A table with no data. (php)
3177 !! options
3178 php
3179 !! input
3180 {||}
3181 !! result
3182 !! end
3183 # Parsoid team replies: empty table tags are legal in HTML5
3184 !! test
3185 A table with no data. (parsoid)
3186 !! options
3187 parsoid
3188 !! input
3189 {||}
3190 !! result
3191 <table></table>
3192 !! end
3193
3194 # A table with nothing but a caption is invalid XHTML, we might want to render
3195 # this as <p>caption</p>
3196 !! test
3197 A table with nothing but a caption (php)
3198 !! options
3199 php
3200 !! input
3201 {|
3202 |+ caption
3203 |}
3204 !! result
3205 <table>
3206 <caption> caption
3207 </caption><tr><td></td></tr></table>
3208
3209 !! end
3210 # Parsoid team replies: table with only a caption is legal in HTML5
3211 !! test
3212 A table with nothing but a caption (parsoid)
3213 !! options
3214 parsoid
3215 !! input
3216 {|
3217 |+ caption
3218 |}
3219 !! result
3220 <table><caption> caption</caption></table>
3221 !! end
3222
3223 !! test
3224 A table with caption with default-spaced attributes and a table row
3225 !! input
3226 {|
3227 |+ style="color: red;" | caption1
3228 |-
3229 | foo
3230 |}
3231 !! result
3232 <table>
3233 <caption style="color: red;"> caption1
3234 </caption>
3235 <tr>
3236 <td> foo
3237 </td></tr></table>
3238
3239 !! end
3240
3241 !! test
3242 A table with captions with non-default spaced attributes and a table row
3243 !! input
3244 {|
3245 |+style="color: red;"|caption2
3246 |+ style="color: red;"| caption3
3247 |-
3248 | foo
3249 |}
3250 !! result
3251 <table>
3252 <caption style="color: red;">caption2
3253 </caption>
3254 <caption style="color: red;"> caption3
3255 </caption>
3256 <tr>
3257 <td> foo
3258 </td></tr></table>
3259
3260 !! end
3261
3262 !! test
3263 Table td-cell syntax variations
3264 !! input
3265 {|
3266 | foo bar foo | baz
3267 | foo bar foo || baz
3268 | style='color:red;' | baz
3269 | style='color:red;' || baz
3270 |}
3271 !! result
3272 <table>
3273 <tr>
3274 <td> baz
3275 </td>
3276 <td> foo bar foo </td>
3277 <td> baz
3278 </td>
3279 <td style="color:red;"> baz
3280 </td>
3281 <td> style='color:red;' </td>
3282 <td> baz
3283 </td></tr></table>
3284
3285 !! end
3286
3287 !! test
3288 Simple table
3289 !! input
3290 {|
3291 | 1 || 2
3292 |-
3293 | 3 || 4
3294 |}
3295 !! result
3296 <table>
3297 <tr>
3298 <td> 1 </td>
3299 <td> 2
3300 </td></tr>
3301 <tr>
3302 <td> 3 </td>
3303 <td> 4
3304 </td></tr></table>
3305
3306 !! end
3307
3308 !! test
3309 Simple table but with multiple dashes for row wikitext
3310 !! input
3311 {|
3312 | foo
3313 |-----
3314 | bar
3315 |}
3316 !! result
3317 <table>
3318 <tr>
3319 <td> foo
3320 </td></tr>
3321 <tr>
3322 <td> bar
3323 </td></tr></table>
3324
3325 !! end
3326 !! test
3327 Multiplication table
3328 !! input
3329 {| border="1" cellpadding="2"
3330 |+Multiplication table
3331 |-
3332 ! &times; !! 1 !! 2 !! 3
3333 |-
3334 ! 1
3335 | 1 || 2 || 3
3336 |-
3337 ! 2
3338 | 2 || 4 || 6
3339 |-
3340 ! 3
3341 | 3 || 6 || 9
3342 |-
3343 ! 4
3344 | 4 || 8 || 12
3345 |-
3346 ! 5
3347 | 5 || 10 || 15
3348 |}
3349 !! result
3350 <table border="1" cellpadding="2">
3351 <caption>Multiplication table
3352 </caption>
3353 <tr>
3354 <th> &#215; </th>
3355 <th> 1 </th>
3356 <th> 2 </th>
3357 <th> 3
3358 </th></tr>
3359 <tr>
3360 <th> 1
3361 </th>
3362 <td> 1 </td>
3363 <td> 2 </td>
3364 <td> 3
3365 </td></tr>
3366 <tr>
3367 <th> 2
3368 </th>
3369 <td> 2 </td>
3370 <td> 4 </td>
3371 <td> 6
3372 </td></tr>
3373 <tr>
3374 <th> 3
3375 </th>
3376 <td> 3 </td>
3377 <td> 6 </td>
3378 <td> 9
3379 </td></tr>
3380 <tr>
3381 <th> 4
3382 </th>
3383 <td> 4 </td>
3384 <td> 8 </td>
3385 <td> 12
3386 </td></tr>
3387 <tr>
3388 <th> 5
3389 </th>
3390 <td> 5 </td>
3391 <td> 10 </td>
3392 <td> 15
3393 </td></tr></table>
3394
3395 !! end
3396
3397 !! test
3398 Accept "||" in table headings
3399 !! input
3400 {|
3401 !h1 || h2
3402 |}
3403 !! result
3404 <table>
3405 <tr>
3406 <th>h1 </th>
3407 <th> h2
3408 </th></tr></table>
3409
3410 !! end
3411
3412 !! test
3413 Accept "||" in indented table headings
3414 !! input
3415 :{|
3416 !h1 || h2
3417 |}
3418 !! result
3419 <dl><dd><table>
3420 <tr>
3421 <th>h1 </th>
3422 <th> h2
3423 </th></tr></table></dd></dl>
3424
3425 !! end
3426
3427 !! test
3428 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3429 !! input
3430 {|
3431 !| h1
3432 || a
3433 |}
3434 !! result
3435 <table>
3436 <tr>
3437 <th> h1
3438 </th>
3439 <td> a
3440 </td></tr></table>
3441
3442 !! end
3443
3444 !!test
3445 Accept "| !" at start of line in tables (ignore !-attribute)
3446 !!input
3447 {|
3448 |-
3449 | !style="color:red" | bar
3450 |}
3451 !!result
3452 <table>
3453
3454 <tr>
3455 <td> bar
3456 </td></tr></table>
3457
3458 !!end
3459
3460 !!test
3461 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 +/-
3462 !!input
3463 {|
3464 |-
3465 |style='color:red;'|+1
3466 |style='color:blue;'|-1
3467 |-
3468 | 1 || 2 || 3
3469 | 1 ||+2 ||-3
3470 |-
3471 | +1
3472 | -1
3473 |}
3474 !!result
3475 <table>
3476
3477 <tr>
3478 <td style="color:red;">+1
3479 </td>
3480 <td style="color:blue;">-1
3481 </td></tr>
3482 <tr>
3483 <td> 1 </td>
3484 <td> 2 </td>
3485 <td> 3
3486 </td>
3487 <td> 1 </td>
3488 <td>+2 </td>
3489 <td>-3
3490 </td></tr>
3491 <tr>
3492 <td> +1
3493 </td>
3494 <td> -1
3495 </td></tr></table>
3496
3497 !!end
3498
3499 !! test
3500 Table rowspan
3501 !! input
3502 {| border=1
3503 | Cell 1, row 1
3504 |rowspan=2| Cell 2, row 1 (and 2)
3505 | Cell 3, row 1
3506 |-
3507 | Cell 1, row 2
3508 | Cell 3, row 2
3509 |}
3510 !! result
3511 <table border="1">
3512 <tr>
3513 <td> Cell 1, row 1
3514 </td>
3515 <td rowspan="2"> Cell 2, row 1 (and 2)
3516 </td>
3517 <td> Cell 3, row 1
3518 </td></tr>
3519 <tr>
3520 <td> Cell 1, row 2
3521 </td>
3522 <td> Cell 3, row 2
3523 </td></tr></table>
3524
3525 !! end
3526
3527 !! test
3528 Nested table
3529 !! input
3530 {| border=1
3531 | &alpha;
3532 |
3533 {| bgcolor=#ABCDEF border=2
3534 |nested
3535 |-
3536 |table
3537 |}
3538 |the original table again
3539 |}
3540 !! result
3541 <table border="1">
3542 <tr>
3543 <td> &#945;
3544 </td>
3545 <td>
3546 <table bgcolor="#ABCDEF" border="2">
3547 <tr>
3548 <td>nested
3549 </td></tr>
3550 <tr>
3551 <td>table
3552 </td></tr></table>
3553 </td>
3554 <td>the original table again
3555 </td></tr></table>
3556
3557 !! end
3558
3559 !! test
3560 Invalid attributes in table cell (bug 1830)
3561 !! input
3562 {|
3563 |Cell:|broken
3564 |}
3565 !! result
3566 <table>
3567 <tr>
3568 <td>broken
3569 </td></tr></table>
3570
3571 !! end
3572
3573
3574 !! test
3575 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3576 !! input
3577 {|
3578 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3579 !! result
3580 <table>
3581 <tr>
3582 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3583 <td>]" onmouseover="alert(document.cookie)"&gt;test
3584 </td>
3585 </tr>
3586 </table>
3587
3588 !! end
3589
3590
3591 !! test
3592 Indented table markup mixed with indented pre content (proposed in bug 6200)
3593 !! input
3594 <table>
3595 <tr>
3596 <td>
3597 Text that should be rendered preformatted
3598 </td>
3599 </tr>
3600 </table>
3601 !! result
3602 <table>
3603 <tr>
3604 <td>
3605 <pre>Text that should be rendered preformatted
3606 </pre>
3607 </td>
3608 </tr>
3609 </table>
3610
3611 !! end
3612
3613 !! test
3614 Template-generated table cell attributes and cell content
3615 !! input
3616 {|
3617 |{{table_attribs}}
3618 |}
3619 !! result
3620 <table>
3621 <tr>
3622 <td style="color: red"> Foo
3623 </td></tr></table>
3624
3625 !! end
3626
3627 !! test
3628 Table with row followed by newlines and table heading
3629 !! input
3630 {|
3631 |-
3632
3633 ! foo
3634 |}
3635 !! result
3636 <table>
3637
3638
3639 <tr>
3640 <th> foo
3641 </th></tr></table>
3642
3643 !! end
3644
3645 !! test
3646 Table with empty line following the start tag
3647 !! input
3648 {|
3649
3650 |-
3651 | foo
3652 |}
3653 !! result
3654 <table>
3655
3656
3657 <tr>
3658 <td> foo
3659 </td></tr></table>
3660
3661 !! end
3662
3663 # FIXME: Preserve the attribute properly (with an empty string as value) in
3664 # the PHP parser. Parsoid implements the behavior below.
3665 !! test
3666 Table attributes with empty value
3667 !! options
3668 disabled
3669 !! input
3670 {|
3671 | style=| hello
3672 |}
3673 !! result
3674 <table>
3675 <tr>
3676 <td style=""> hello
3677 </td></tr></table>
3678
3679 !! end
3680
3681 !! test
3682 Wikitext table with a lot of comments
3683 !! input
3684 {|
3685 <!-- c0 -->
3686 | foo
3687 <!-- c1 -->
3688 |- <!-- c2 -->
3689 <!-- c3 -->
3690 |<!-- c4 -->
3691 <!-- c5 -->
3692 |}
3693 !! result
3694 <table>
3695 <tr>
3696 <td> foo
3697 </td></tr>
3698 <tr>
3699 <td>
3700 </td></tr></table>
3701
3702 !! end
3703
3704 !! test
3705 Wikitext table with double-line table cell
3706 !! input
3707 {|
3708 |a
3709 b
3710 |}
3711 !! result
3712 <table>
3713 <tr>
3714 <td>a
3715 <p>b
3716 </p>
3717 </td></tr></table>
3718
3719 !! end
3720
3721 !! test
3722 Table cell with a single comment
3723 !! input
3724 {|
3725 | <!-- c1 -->
3726 | a
3727 |}
3728 !! result
3729 <table>
3730 <tr>
3731 <td>
3732 </td>
3733 <td> a
3734 </td></tr></table>
3735
3736 !! end
3737
3738 # The expected HTML structure in this test is debatable. The PHP parser does
3739 # not parse this kind of table at all. The main focus for Parsoid is on
3740 # round-tripping, so this output is ok for now. TODO: revisit!
3741 !! test
3742 Wikitext table with html-syntax row (Parsoid)
3743 !! options
3744 parsoid
3745 !! input
3746 {|
3747 |-
3748 <td>foo</td>
3749 |}
3750 !! result
3751 <table>
3752 <tbody>
3753 <tr>
3754 <td>foo</td></tr></tbody></table>
3755 !! end
3756
3757 ###
3758 ### Internal links
3759 ###
3760 !! test
3761 Plain link, capitalized
3762 !! input
3763 [[Main Page]]
3764 !! result
3765 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
3766 </p>
3767 !! end
3768
3769 !! test
3770 Plain link, uncapitalized
3771 !! input
3772 [[main Page]]
3773 !! result
3774 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
3775 </p>
3776 !! end
3777
3778 !! test
3779 Piped link
3780 !! input
3781 [[Main Page|The Main Page]]
3782 !! result
3783 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
3784 </p>
3785 !! end
3786
3787 !! test
3788 Broken link
3789 !! input
3790 [[Zigzagzogzagzig]]
3791 !! result
3792 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
3793 </p>
3794 !! end
3795
3796 !! test
3797 Broken link with fragment
3798 !! input
3799 [[Zigzagzogzagzig#zug]]
3800 !! result
3801 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
3802 </p>
3803 !! end
3804
3805 !! test
3806 Special page link with fragment
3807 !! input
3808 [[Special:Version#anchor]]
3809 !! result
3810 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
3811 </p>
3812 !! end
3813
3814 !! test
3815 Nonexistent special page link with fragment
3816 !! input
3817 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
3818 !! result
3819 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
3820 </p>
3821 !! end
3822
3823 !! test
3824 Link with prefix
3825 !! input
3826 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
3827 !! result
3828 <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>
3829 </p>
3830 !! end
3831
3832 !! test
3833 Link with suffix
3834 !! input
3835 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
3836 !! result
3837 <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>!!!
3838 </p>
3839 !! end
3840
3841 !! article
3842 prefixed article
3843 !! text
3844 Some text
3845 !! endarticle
3846
3847 !! test
3848 Bug 43661: Piped links with identical prefixes
3849 !! input
3850 [[prefixed article|prefixed articles with spaces]]
3851
3852 [[prefixed article|prefixed articlesaoeu]]
3853
3854 [[Main Page|Main Page test]]
3855 !! result
3856 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
3857 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
3858 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
3859 </p>
3860 !! end
3861
3862
3863 !! test
3864 Link with HTML entity in suffix / tail
3865 !! input
3866 [[Main Page]]&quot;, [[Main Page]]&#97;
3867 !! result
3868 <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;
3869 </p>
3870 !! end
3871
3872 !! test
3873 Link with 3 brackets
3874 !! input
3875 [[[main page]]]
3876 !! result
3877 <p>[[[main page]]]
3878 </p>
3879 !! end
3880
3881 !! test
3882 Piped link with 3 brackets
3883 !! input
3884 [[[main page|the main page]]]
3885 !! result
3886 <p>[[[main page|the main page]]]
3887 </p>
3888 !! end
3889
3890 !! test
3891 Link with multiple pipes
3892 !! input
3893 [[Main Page|The|Main|Page]]
3894 !! result
3895 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
3896 </p>
3897 !! end
3898
3899 !! test
3900 Link to namespaces
3901 !! input
3902 [[Talk:Parser testing]], [[Meta:Disclaimers]]
3903 !! result
3904 <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>
3905 </p>
3906 !! end
3907
3908 !! test
3909 Piped link to namespace
3910 !! input
3911 [[Meta:Disclaimers|The disclaimers]]
3912 !! result
3913 <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>
3914 </p>
3915 !! end
3916
3917 !! test
3918 Link containing }
3919 !! input
3920 [[Usually caused by a typo (oops}]]
3921 !! result
3922 <p>[[Usually caused by a typo (oops}]]
3923 </p>
3924 !! end
3925
3926 !! test
3927 Link containing % (not as a hex sequence)
3928 !! input
3929 [[7% Solution]]
3930 !! result
3931 <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>
3932 </p>
3933 !! end
3934
3935 !! test
3936 Link containing % as a single hex sequence interpreted to char
3937 !! input
3938 [[7%25 Solution]]
3939 !! result
3940 <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>
3941 </p>
3942 !!end
3943
3944 !! test
3945 Link containing % as a double hex sequence interpreted to hex sequence
3946 !! input
3947 [[7%2525 Solution]]
3948 !! result
3949 <p>[[7%2525 Solution]]
3950 </p>
3951 !!end
3952
3953 !! test
3954 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
3955 Example for such a section: == < ==
3956 !! input
3957 [[%23%3c]][[%23%3e]]
3958 !! result
3959 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
3960 </p>
3961 !! end
3962
3963 !! test
3964 Link containing "<#" and ">#" as a hex sequences
3965 !! input
3966 [[%3c%23]][[%3e%23]]
3967 !! result
3968 <p>[[%3c%23]][[%3e%23]]
3969 </p>
3970 !! end
3971
3972 !! test
3973 Link containing double-single-quotes '' (bug 4598)
3974 !! input
3975 [[Lista d''e paise d''o munno]]
3976 !! result
3977 <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>
3978 </p>
3979 !! end
3980
3981 !! test
3982 Link containing double-single-quotes '' in text (bug 4598 sanity check)
3983 !! input
3984 Some [[Link|pretty ''italics'' and stuff]]!
3985 !! result
3986 <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>!
3987 </p>
3988 !! end
3989
3990 !! test
3991 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
3992 !! input
3993 ''Some [[Link|pretty ''italics'' and stuff]]!
3994 !! result
3995 <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>
3996 </p>
3997 !! end
3998
3999 !! test
4000 Link with double quotes in title part (literal) and alternate part (interpreted)
4001 !! input
4002 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4003
4004 [[''Pentecoste'']]
4005
4006 [[''Pentecoste''|Pentecoste]]
4007
4008 [[''Pentecoste''|''Pentecoste'']]
4009 !! result
4010 <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>
4011 </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>
4012 </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>
4013 </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>
4014 </p>
4015 !! end
4016
4017 !! test
4018 Broken image links with HTML captions (bug 39700)
4019 !! input
4020 [[File:Nonexistent|<script></script>]]
4021 [[File:Nonexistent|100px|<script></script>]]
4022 [[File:Nonexistent|&lt;]]
4023 [[File:Nonexistent|a<i>b</i>c]]
4024 !! result
4025 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4026 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4027 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4028 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4029 </p>
4030 !! end
4031
4032 !! test
4033 Plain link to URL
4034 !! input
4035 [[http://www.example.com]]
4036 !! result
4037 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4038 </p>
4039 !! end
4040
4041 !! test
4042 Plain link to URL with link text
4043 !! input
4044 [[http://www.example.com Link text]]
4045 !! result
4046 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4047 </p>
4048 !! end
4049
4050 !! test
4051 Plain link to protocol-relative URL
4052 !! input
4053 [[//www.example.com]]
4054 !! result
4055 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4056 </p>
4057 !! end
4058
4059 !! test
4060 Plain link to protocol-relative URL with link text
4061 !! input
4062 [[//www.example.com Link text]]
4063 !! result
4064 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4065 </p>
4066 !! end
4067
4068 !! test
4069 Plain link to page with question mark in title
4070 !! input
4071 [[A?b]]
4072
4073 [[A?b|Baz]]
4074 !! result
4075 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4076 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4077 </p>
4078 !! end
4079
4080
4081 # I'm fairly sure the expected result here is wrong.
4082 # We want these to be URL links, not pseudo-pages with URLs for titles....
4083 # However the current output is also pretty screwy.
4084 #
4085 # ----
4086 # I'm changing it to match the current output--it arguably makes more
4087 # sense in the light of the test above. Old expected result was:
4088 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4089 #</p>
4090 # But I think this test is bordering on "garbage in, garbage out" anyway.
4091 # -- wtm
4092 !! test
4093 Piped link to URL
4094 !! input
4095 Piped link to URL: [[http://www.example.com|an example URL]]
4096 !! result
4097 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4098 </p>
4099 !! end
4100
4101 !! test
4102 BUG 2: [[page|http://url/]] should link to page, not http://url/
4103 !! input
4104 [[Main Page|http://url/]]
4105 !! result
4106 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4107 </p>
4108 !! end
4109
4110 !! test
4111 BUG 337: Escaped self-links should be bold
4112 !! options
4113 title=[[Bug462]]
4114 !! input
4115 [[Bu&#103;462]] [[Bug462]]
4116 !! result
4117 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4118 </p>
4119 !! end
4120
4121 !! test
4122 Self-link to section should not be bold
4123 !! options
4124 title=[[Main Page]]
4125 !! input
4126 [[Main Page#section]]
4127 !! result
4128 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4129 </p>
4130 !! end
4131
4132 !! article
4133 00
4134 !! text
4135 This is 00.
4136 !! endarticle
4137
4138 !!test
4139 Self-link to numeric title
4140 !!options
4141 title=[[0]]
4142 !!input
4143 [[0]]
4144 !!result
4145 <p><strong class="selflink">0</strong>
4146 </p>
4147 !!end
4148
4149 !!test
4150 Link to numeric-equivalent title
4151 !!options
4152 title=[[0]]
4153 !!input
4154 [[00]]
4155 !!result
4156 <p><a href="/wiki/00" title="00">00</a>
4157 </p>
4158 !!end
4159
4160 !! test
4161 <nowiki> inside a link
4162 !! input
4163 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4164 !! result
4165 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4166 </p>
4167 !! end
4168
4169 !! test
4170 Non-breaking spaces in title
4171 !! input
4172 [[&nbsp; Main &nbsp; Page &nbsp;]]
4173 !! result
4174 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4175 </p>
4176 !!end
4177
4178 !! test
4179 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4180 !! options
4181 language=ca
4182 !! input
4183 '''[[Main Page]]'''
4184 !! result
4185 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4186 </p>
4187 !! end
4188
4189 !! test
4190 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4191 !! options
4192 language=ca
4193 !! input
4194 ''[[Main Page]]''
4195 !! result
4196 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4197 </p>
4198 !! end
4199
4200 !! test
4201 Internal link with en linktrail: no apostrophes (bug 27473)
4202 !! options
4203 language=en
4204 !! input
4205 [[Something]]'nice
4206 !! result
4207 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4208 </p>
4209 !! end
4210
4211 !! test
4212 Internal link with ca linktrail with apostrophes (bug 27473)
4213 !! options
4214 language=ca
4215 !! input
4216 [[Something]]'nice
4217 !! result
4218 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4219 </p>
4220 !! end
4221
4222 !! test
4223 Internal link with kaa linktrail with apostrophes (bug 27473)
4224 !! options
4225 language=kaa
4226 !! input
4227 [[Something]]'nice
4228 !! result
4229 <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>
4230 </p>
4231 !! end
4232
4233 !! test
4234 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4235 !! input
4236 [[Foo| bar]]
4237
4238 [[Foo| ''bar'']]
4239
4240 [http://wp.org foo]
4241
4242 [http://wp.org ''foo'']
4243 !! result
4244 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
4245 </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>
4246 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4247 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4248 </p>
4249 !! end
4250
4251 ###
4252 ### Interwiki links (see maintenance/interwiki.sql)
4253 ###
4254
4255 !! test
4256 Inline interwiki link
4257 !! input
4258 [[MeatBall:SoftSecurity]]
4259 !! result
4260 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4261 </p>
4262 !! end
4263
4264 !! test
4265 Inline interwiki link with empty title (bug 2372)
4266 !! input
4267 [[MeatBall:]]
4268 !! result
4269 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4270 </p>
4271 !! end
4272
4273 !! test
4274 Interwiki link encoding conversion (bug 1636)
4275 !! input
4276 *[[Wikipedia:ro:Olteni&#0355;a]]
4277 *[[Wikipedia:ro:Olteni&#355;a]]
4278 !! result
4279 <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>
4280 </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>
4281 </li></ul>
4282
4283 !! end
4284
4285 !! test
4286 Interwiki link with fragment (bug 2130)
4287 !! input
4288 [[MeatBall:SoftSecurity#foo]]
4289 !! result
4290 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4291 </p>
4292 !! end
4293
4294 !! test
4295 Interlanguage link
4296 !! input
4297 Blah blah blah
4298 [[zh:Chinese]]
4299 !!result
4300 <p>Blah blah blah
4301 </p>
4302 !! end
4303
4304 !! test
4305 Double interlanguage link
4306 !! input
4307 Blah blah blah
4308 [[es:Spanish]]
4309 [[zh:Chinese]]
4310 !!result
4311 <p>Blah blah blah
4312 </p>
4313 !! end
4314
4315 !! test
4316 Interlanguage link, with prefix links
4317 !! options
4318 language=ln
4319 !! input
4320 Blah blah blah
4321 [[zh:Chinese]]
4322 !!result
4323 <p>Blah blah blah
4324 </p>
4325 !! end
4326
4327 !! test
4328 Double interlanguage link, with prefix links (bug 8897)
4329 !! options
4330 language=ln
4331 !! input
4332 Blah blah blah
4333 [[es:Spanish]]
4334 [[zh:Chinese]]
4335 !!result
4336 <p>Blah blah blah
4337 </p>
4338 !! end
4339
4340 !! test
4341 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4342 !! options
4343 language=ln
4344 !! input
4345 [[WW&nbsp;II]]
4346 !!result
4347 <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>
4348 </p>
4349 !! end
4350
4351 ##
4352 ## XHTML tidiness
4353 ###
4354
4355 !! test
4356 <br> to <br />
4357 !! input
4358 1<br>2<br />3
4359 !! result
4360 <p>1<br />2<br />3
4361 </p>
4362 !! end
4363
4364 !! test
4365 Broken br tag sanitization
4366 !! input
4367 </br>
4368 !! result
4369 <p>&lt;/br&gt;
4370 </p>
4371 !! end
4372
4373 !! test
4374 Incorrecly removing closing slashes from correctly formed XHTML
4375 !! input
4376 <br style="clear:both;" />
4377 !! result
4378 <p><br style="clear:both;" />
4379 </p>
4380 !! end
4381
4382 !! test
4383 Failing to transform badly formed HTML into correct XHTML
4384 !! input
4385 <br style="clear: left;">
4386 <br style="clear: right;">
4387 <br style="clear: both;">
4388 !! result
4389 <p><br style="clear: left;" />
4390 <br style="clear: right;" />
4391 <br style="clear: both;" />
4392 </p>
4393 !!end
4394
4395 !! test
4396 Handling html with a div self-closing tag
4397 !! input
4398 <div title />
4399 <div title/>
4400 <div title/ >
4401 <div title=bar />
4402 <div title=bar/>
4403 <div title=bar/ >
4404 !! result
4405 <p>&lt;div title /&gt;
4406 &lt;div title/&gt;
4407 </p>
4408 <div>
4409 <p>&lt;div title=bar /&gt;
4410 &lt;div title=bar/&gt;
4411 </p>
4412 <div title="bar/"></div>
4413 </div>
4414
4415 !! end
4416
4417 !! test
4418 Handling html with a br self-closing tag
4419 !! input
4420 <br title />
4421 <br title/>
4422 <br title/ >
4423 <br title=bar />
4424 <br title=bar/>
4425 <br title=bar/ >
4426 !! result
4427 <p><br title="title" />
4428 <br title="title" />
4429 <br />
4430 <br title="bar" />
4431 <br title="bar" />
4432 <br title="bar/" />
4433 </p>
4434 !! end
4435
4436 !! test
4437 Horizontal ruler (should it add that extra space?)
4438 !! input
4439 <hr>
4440 <hr >
4441 foo <hr
4442 > bar
4443 !! result
4444 <hr />
4445 <hr />
4446 foo <hr /> bar
4447
4448 !! end
4449
4450 !! test
4451 Horizontal ruler -- 4+ dashes render hr
4452 !! input
4453 ----
4454 !! result
4455 <hr />
4456
4457 !! end
4458
4459 !! test
4460 Horizontal ruler -- eats additional dashes on the same line
4461 !! input
4462 ---------
4463 !! result
4464 <hr />
4465
4466 !! end
4467
4468 !! test
4469 Horizontal ruler -- does not collapse dashes on consecutive lines
4470 !! input
4471 ----
4472 ----
4473 !! result
4474 <hr />
4475 <hr />
4476
4477 !! end
4478
4479 !! test
4480 Horizontal ruler -- <4 dashes render as plain text
4481 !! input
4482 ---
4483 !! result
4484 <p>---
4485 </p>
4486 !! end
4487
4488 !! test
4489 Horizontal ruler -- Supports content following dashes on same line
4490 !! input
4491 ---- Foo
4492 !! result
4493 <hr /> Foo
4494
4495 !! end
4496
4497 ###
4498 ### Block-level elements
4499 ###
4500 !! test
4501 Common list
4502 !! input
4503 *Common list
4504 * item 2
4505 *item 3
4506 !! result
4507 <ul><li>Common list
4508 </li><li> item 2
4509 </li><li>item 3
4510 </li></ul>
4511
4512 !! end
4513
4514 !! test
4515 Numbered list
4516 !! input
4517 #Numbered list
4518 #item 2
4519 # item 3
4520 !! result
4521 <ol><li>Numbered list
4522 </li><li>item 2
4523 </li><li> item 3
4524 </li></ol>
4525
4526 !! end
4527
4528 !! test
4529 Mixed list
4530 !! input
4531 *Mixed list
4532 *# with numbers
4533 ** and bullets
4534 *# and numbers
4535 *bullets again
4536 **bullet level 2
4537 ***bullet level 3
4538 ***#Number on level 4
4539 **bullet level 2
4540 **#Number on level 3
4541 **#Number on level 3
4542 *#number level 2
4543 *Level 1
4544 *** Level 3
4545 #** Level 3, but ordered
4546 !! result
4547 <ul><li>Mixed list
4548 <ol><li> with numbers
4549 </li></ol>
4550 <ul><li> and bullets
4551 </li></ul>
4552 <ol><li> and numbers
4553 </li></ol>
4554 </li><li>bullets again
4555 <ul><li>bullet level 2
4556 <ul><li>bullet level 3
4557 <ol><li>Number on level 4
4558 </li></ol>
4559 </li></ul>
4560 </li><li>bullet level 2
4561 <ol><li>Number on level 3
4562 </li><li>Number on level 3
4563 </li></ol>
4564 </li></ul>
4565 <ol><li>number level 2
4566 </li></ol>
4567 </li><li>Level 1
4568 <ul><li><ul><li> Level 3
4569 </li></ul>
4570 </li></ul>
4571 </li></ul>
4572 <ol><li><ul><li><ul><li> Level 3, but ordered
4573 </li></ul>
4574 </li></ul>
4575 </li></ol>
4576
4577 !! end
4578
4579 !! test
4580 Nested lists 1
4581 !! input
4582 *foo
4583 **bar
4584 !! result
4585 <ul><li>foo
4586 <ul><li>bar
4587 </li></ul>
4588 </li></ul>
4589
4590 !! end
4591
4592 !! test
4593 Nested lists 2
4594 !! input
4595 **foo
4596 *bar
4597 !! result
4598 <ul><li><ul><li>foo
4599 </li></ul>
4600 </li><li>bar
4601 </li></ul>
4602
4603 !! end
4604
4605 !! test
4606 Nested lists 3 (first element empty)
4607 !! input
4608 *
4609 **bar
4610 !! result
4611 <ul><li>
4612 <ul><li>bar
4613 </li></ul>
4614 </li></ul>
4615
4616 !! end
4617
4618 !! test
4619 Nested lists 4 (first element empty)
4620 !! input
4621 **
4622 *bar
4623 !! result
4624 <ul><li><ul><li>
4625 </li></ul>
4626 </li><li>bar
4627 </li></ul>
4628
4629 !! end
4630
4631 !! test
4632 Nested lists 5 (both elements empty)
4633 !! input
4634 **
4635 *
4636 !! result
4637 <ul><li><ul><li>
4638 </li></ul>
4639 </li><li>
4640 </li></ul>
4641
4642 !! end
4643
4644 !! test
4645 Nested lists 6 (both elements empty)
4646 !! input
4647 *
4648 **
4649 !! result
4650 <ul><li>
4651 <ul><li>
4652 </li></ul>
4653 </li></ul>
4654
4655 !! end
4656
4657 !! test
4658 Nested lists 7 (skip initial nesting levels)
4659 !! input
4660 *** foo
4661 !! result
4662 <ul><li><ul><li><ul><li> foo
4663 </li></ul>
4664 </li></ul>
4665 </li></ul>
4666
4667 !! end
4668
4669 !! test
4670 Nested lists 8 (multiple nesting transitions)
4671 !! input
4672 * foo
4673 *** bar
4674 ** baz
4675 * boo
4676 !! result
4677 <ul><li> foo
4678 <ul><li><ul><li> bar
4679 </li></ul>
4680 </li><li> baz
4681 </li></ul>
4682 </li><li> boo
4683 </li></ul>
4684
4685 !! end
4686
4687 !! test
4688 1. Lists with start-of-line-transparent tokens before bullets: Comments
4689 !! input
4690 *foo
4691 *<!--cmt-->bar
4692 <!--cmt-->*baz
4693 !! result
4694 <ul><li>foo
4695 </li><li>bar
4696 </li><li>baz
4697 </li></ul>
4698
4699 !! end
4700
4701 !! test
4702 2. Lists with start-of-line-transparent tokens before bullets: Template close
4703 !! input
4704 *foo {{echo|bar
4705 }}*baz
4706 !! result
4707 <ul><li>foo bar
4708 </li><li>baz
4709 </li></ul>
4710
4711 !! end
4712
4713 !! test
4714 Unbalanced closing block tags break a list
4715 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4716 !! options
4717 disabled
4718 !! input
4719 <div>
4720 *a</div><div>
4721 *b</div>
4722 !! result
4723 <div>
4724 <ul><li>a
4725 </li></ul></div><div>
4726 <ul><li>b
4727 </li></ul></div>
4728 !! end
4729
4730 !! test
4731 Unbalanced closing non-block tags don't break a list
4732 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4733 !! options
4734 disabled
4735 !! input
4736 <span>
4737 *a</span><span>
4738 *b</span>
4739 !! result
4740 <p><span></span>
4741 </p>
4742 <ul><li>a<span></span>
4743 </li><li>b
4744 </li></ul>
4745 !! end
4746
4747 !! test
4748 Unclosed formatting tags that straddle lists are closed and reopened
4749 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4750 !! options
4751 disabled
4752 !! input
4753 # <s> a
4754 # b </s>
4755 !! result
4756 <ol><li> <s> a </s>
4757 </li><li> <s> b </s>
4758 </li></ol>
4759 !! end
4760
4761 !!test
4762 List embedded in a non-block tag
4763 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
4764 !! options
4765 parsoid
4766 !!input
4767 <small>
4768 * foo
4769 </small>
4770 !!result
4771 <p><small></small></p>
4772 <small>
4773 <ul>
4774 <li> foo</li>
4775 </ul>
4776 </small>
4777 <p><small></small></p>
4778 !!end
4779
4780 !! test
4781 List items are not parsed correctly following a <pre> block (bug 785)
4782 !! input
4783 * <pre>foo</pre>
4784 * <pre>bar</pre>
4785 * zar
4786 !! result
4787 <ul><li> <pre>foo</pre>
4788 </li><li> <pre>bar</pre>
4789 </li><li> zar
4790 </li></ul>
4791
4792 !! end
4793
4794 !! test
4795 List items from template
4796 !! input
4797
4798 {{inner list}}
4799 * item 2
4800
4801 * item 0
4802 {{inner list}}
4803 * item 2
4804
4805 * item 0
4806 * notSOL{{inner list}}
4807 * item 2
4808 !! result
4809 <ul><li> item 1
4810 </li><li> item 2
4811 </li></ul>
4812 <ul><li> item 0
4813 </li><li> item 1
4814 </li><li> item 2
4815 </li></ul>
4816 <ul><li> item 0
4817 </li><li> notSOL
4818 </li><li> item 1
4819 </li><li> item 2
4820 </li></ul>
4821
4822 !! end
4823
4824 !! test
4825 List interrupted by empty line or heading
4826 !! input
4827 * foo
4828
4829 ** bar
4830 == A heading ==
4831 * Another list item
4832 !! result
4833 <ul><li> foo
4834 </li></ul>
4835 <ul><li><ul><li> bar
4836 </li></ul>
4837 </li></ul>
4838 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a>]</span> <span class="mw-headline" id="A_heading">A heading</span></h2>
4839 <ul><li> Another list item
4840 </li></ul>
4841
4842 !!end
4843
4844 !!test
4845 Multiple list tags generated by templates
4846 !!input
4847 {{echo|<li>}}a
4848 {{echo|<li>}}b
4849 {{echo|<li>}}c
4850 !!result
4851 <li>a
4852 <li>b
4853 <li>c</li>
4854 </li>
4855 </li>
4856
4857 !!end
4858
4859 !!test
4860 Single-comment whitespace lines dont break lists, but multi-comment whitespace lines do
4861 !!input
4862 *a
4863 <!--This line will NOT split the list-->
4864 *b
4865 <!--This line will NOT split the list either-->
4866 *c
4867 <!--foo--> <!--This line with more than 1 comment will split the list-->
4868 *d
4869 !!result
4870 <ul><li>a
4871 </li><li>b
4872 </li><li>c
4873 </li></ul>
4874 <ul><li>d
4875 </li></ul>
4876
4877 !!end
4878
4879 ###
4880 ### Magic Words
4881 ###
4882
4883 !! test
4884 Magic Word: {{CURRENTDAY}}
4885 !! input
4886 {{CURRENTDAY}}
4887 !! result
4888 <p>1
4889 </p>
4890 !! end
4891
4892 !! test
4893 Magic Word: {{CURRENTDAY2}}
4894 !! input
4895 {{CURRENTDAY2}}
4896 !! result
4897 <p>01
4898 </p>
4899 !! end
4900
4901 !! test
4902 Magic Word: {{CURRENTDAYNAME}}
4903 !! input
4904 {{CURRENTDAYNAME}}
4905 !! result
4906 <p>Thursday
4907 </p>
4908 !! end
4909
4910 !! test
4911 Magic Word: {{CURRENTDOW}}
4912 !! input
4913 {{CURRENTDOW}}
4914 !! result
4915 <p>4
4916 </p>
4917 !! end
4918
4919 !! test
4920 Magic Word: {{CURRENTMONTH}}
4921 !! input
4922 {{CURRENTMONTH}}
4923 !! result
4924 <p>01
4925 </p>
4926 !! end
4927
4928 !! test
4929 Magic Word: {{CURRENTMONTHABBREV}}
4930 !! input
4931 {{CURRENTMONTHABBREV}}
4932 !! result
4933 <p>Jan
4934 </p>
4935 !! end
4936
4937 !! test
4938 Magic Word: {{CURRENTMONTHNAME}}
4939 !! input
4940 {{CURRENTMONTHNAME}}
4941 !! result
4942 <p>January
4943 </p>
4944 !! end
4945
4946 !! test
4947 Magic Word: {{CURRENTMONTHNAMEGEN}}
4948 !! input
4949 {{CURRENTMONTHNAMEGEN}}
4950 !! result
4951 <p>January
4952 </p>
4953 !! end
4954
4955 !! test
4956 Magic Word: {{CURRENTTIME}}
4957 !! input
4958 {{CURRENTTIME}}
4959 !! result
4960 <p>00:02
4961 </p>
4962 !! end
4963
4964 !! test
4965 Magic Word: {{CURRENTWEEK}} (@bug 4594)
4966 !! input
4967 {{CURRENTWEEK}}
4968 !! result
4969 <p>1
4970 </p>
4971 !! end
4972
4973 !! test
4974 Magic Word: {{CURRENTYEAR}}
4975 !! input
4976 {{CURRENTYEAR}}
4977 !! result
4978 <p>1970
4979 </p>
4980 !! end
4981
4982 !! test
4983 Magic Word: {{FULLPAGENAME}}
4984 !! options
4985 title=[[User:Ævar Arnfjörð Bjarmason]]
4986 !! input
4987 {{FULLPAGENAME}}
4988 !! result
4989 <p>User:Ævar Arnfjörð Bjarmason
4990 </p>
4991 !! end
4992
4993 !! test
4994 Magic Word: {{FULLPAGENAMEE}}
4995 !! options
4996 title=[[User:Ævar Arnfjörð Bjarmason]]
4997 !! input
4998 {{FULLPAGENAMEE}}
4999 !! result
5000 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5001 </p>
5002 !! end
5003
5004 !! test
5005 Magic Word: {{NAMESPACE}}
5006 !! options
5007 title=[[User:Ævar Arnfjörð Bjarmason]]
5008 !! input
5009 {{NAMESPACE}}
5010 !! result
5011 <p>User
5012 </p>
5013 !! end
5014
5015 !! test
5016 Magic Word: {{NAMESPACEE}}
5017 !! options
5018 title=[[User:Ævar Arnfjörð Bjarmason]]
5019 !! input
5020 {{NAMESPACEE}}
5021 !! result
5022 <p>User
5023 </p>
5024 !! end
5025
5026 !! test
5027 Magic Word: {{NAMESPACENUMBER}}
5028 !! options
5029 title=[[User:Ævar Arnfjörð Bjarmason]]
5030 !! input
5031 {{NAMESPACENUMBER}}
5032 !! result
5033 <p>2
5034 </p>
5035 !! end
5036
5037 !! test
5038 Magic Word: {{NUMBEROFFILES}}
5039 !! input
5040 {{NUMBEROFFILES}}
5041 !! result
5042 <p>3
5043 </p>
5044 !! end
5045
5046 !! test
5047 Magic Word: {{PAGENAME}}
5048 !! options
5049 title=[[User:Ævar Arnfjörð Bjarmason]]
5050 !! input
5051 {{PAGENAME}}
5052 !! result
5053 <p>Ævar Arnfjörð Bjarmason
5054 </p>
5055 !! end
5056
5057 !! test
5058 Magic Word: {{PAGENAME}} with metacharacters
5059 !! options
5060 title=[['foo & bar = baz']]
5061 !! input
5062 ''{{PAGENAME}}''
5063 !! result
5064 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
5065 </p>
5066 !! end
5067
5068 !! test
5069 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
5070 !! options
5071 title=[[*RFC 1234 http://example.com/]]
5072 !! input
5073 {{PAGENAME}}
5074 !! result
5075 <p>&#42;RFC&#32;1234 http&#58;//example.com/
5076 </p>
5077 !! end
5078
5079 !! test
5080 Magic Word: {{PAGENAMEE}}
5081 !! options
5082 title=[[User:Ævar Arnfjörð Bjarmason]]
5083 !! input
5084 {{PAGENAMEE}}
5085 !! result
5086 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5087 </p>
5088 !! end
5089
5090 !! test
5091 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
5092 !! options
5093 title=[[*RFC 1234 http://example.com/]]
5094 !! input
5095 {{PAGENAMEE}}
5096 !! result
5097 <p>&#42;RFC_1234_http&#58;//example.com/
5098 </p>
5099 !! end
5100
5101 !! test
5102 Magic Word: {{REVISIONID}}
5103 !! input
5104 {{REVISIONID}}
5105 !! result
5106 <p>1337
5107 </p>
5108 !! end
5109
5110 !! test
5111 Magic Word: {{SCRIPTPATH}}
5112 !! input
5113 {{SCRIPTPATH}}
5114 !! result
5115 <p>/
5116 </p>
5117 !! end
5118
5119 !! test
5120 Magic Word: {{SERVER}}
5121 !! input
5122 {{SERVER}}
5123 !! result
5124 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5125 </p>
5126 !! end
5127
5128 !! test
5129 Magic Word: {{SERVERNAME}}
5130 !! input
5131 {{SERVERNAME}}
5132 !! result
5133 <p>example.org
5134 </p>
5135 !! end
5136
5137 !! test
5138 Magic Word: {{SITENAME}}
5139 !! input
5140 {{SITENAME}}
5141 !! result
5142 <p>MediaWiki
5143 </p>
5144 !! end
5145
5146 !! test
5147 Case-sensitive magic words, when cased differently, should just be template transclusions
5148 !! input
5149 {{CurrentMonth}}
5150 {{currentday}}
5151 {{cURreNTweEK}}
5152 {{currentHour}}
5153 !! result
5154 <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>
5155 <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>
5156 <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>
5157 <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>
5158 </p>
5159 !! end
5160
5161 !! test
5162 Case-insensitive magic words should still work with weird casing.
5163 !! input
5164 {{sErVeRNaMe}}
5165 {{LCFirst:AOEU}}
5166 {{ucFIRST:aoeu}}
5167 {{SERver}}
5168 !! result
5169 <p>example.org
5170 aOEU
5171 Aoeu
5172 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5173 </p>
5174 !! end
5175
5176 !! test
5177 Namespace 1 {{ns:1}}
5178 !! input
5179 {{ns:1}}
5180 !! result
5181 <p>Talk
5182 </p>
5183 !! end
5184
5185 !! test
5186 Namespace 1 {{ns:01}}
5187 !! input
5188 {{ns:01}}
5189 !! result
5190 <p>Talk
5191 </p>
5192 !! end
5193
5194 !! test
5195 Namespace 0 {{ns:0}} (bug 4783)
5196 !! input
5197 {{ns:0}}
5198 !! result
5199
5200 !! end
5201
5202 !! test
5203 Namespace 0 {{ns:00}} (bug 4783)
5204 !! input
5205 {{ns:00}}
5206 !! result
5207
5208 !! end
5209
5210 !! test
5211 Namespace -1 {{ns:-1}}
5212 !! input
5213 {{ns:-1}}
5214 !! result
5215 <p>Special
5216 </p>
5217 !! end
5218
5219 !! test
5220 Namespace User {{ns:User}}
5221 !! input
5222 {{ns:User}}
5223 !! result
5224 <p>User
5225 </p>
5226 !! end
5227
5228 !! test
5229 Namespace User talk {{ns:User_talk}}
5230 !! input
5231 {{ns:User_talk}}
5232 !! result
5233 <p>User talk
5234 </p>
5235 !! end
5236
5237 !! test
5238 Namespace User talk {{ns:uSeR tAlK}}
5239 !! input
5240 {{ns:uSeR tAlK}}
5241 !! result
5242 <p>User talk
5243 </p>
5244 !! end
5245
5246 !! test
5247 Namespace File {{ns:File}}
5248 !! input
5249 {{ns:File}}
5250 !! result
5251 <p>File
5252 </p>
5253 !! end
5254
5255 !! test
5256 Namespace File {{ns:Image}}
5257 !! input
5258 {{ns:Image}}
5259 !! result
5260 <p>File
5261 </p>
5262 !! end
5263
5264 !! test
5265 Namespace (lang=de) Benutzer {{ns:User}}
5266 !! options
5267 language=de
5268 !! input
5269 {{ns:User}}
5270 !! result
5271 <p>Benutzer
5272 </p>
5273 !! end
5274
5275 !! test
5276 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
5277 !! options
5278 language=de
5279 !! input
5280 {{ns:3}}
5281 !! result
5282 <p>Benutzer Diskussion
5283 </p>
5284 !! end
5285
5286
5287 !! test
5288 Urlencode
5289 !! input
5290 {{urlencode:hi world?!}}
5291 {{urlencode:hi world?!|WIKI}}
5292 {{urlencode:hi world?!|PATH}}
5293 {{urlencode:hi world?!|QUERY}}
5294 !! result
5295 <p>hi+world%3F%21
5296 hi_world%3F!
5297 hi%20world%3F%21
5298 hi+world%3F%21
5299 </p>
5300 !! end
5301
5302 ###
5303 ### Magic links
5304 ###
5305 !! test
5306 Magic links: internal link to RFC (bug 479)
5307 !! input
5308 [[RFC 123]]
5309 !! result
5310 <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>
5311 </p>
5312 !! end
5313
5314 !! test
5315 Magic links: RFC (bug 479)
5316 !! input
5317 RFC 822
5318 !! result
5319 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
5320 </p>
5321 !! end
5322
5323 !! test
5324 Magic links: ISBN (bug 1937)
5325 !! input
5326 ISBN 0-306-40615-2
5327 !! result
5328 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
5329 </p>
5330 !! end
5331
5332 !! test
5333 Magic links: PMID incorrectly converts space to underscore
5334 !! input
5335 PMID 1234
5336 !! result
5337 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
5338 </p>
5339 !! end
5340
5341 ###
5342 ### Templates
5343 ####
5344
5345 !! test
5346 Nonexistent template
5347 !! input
5348 {{thistemplatedoesnotexist}}
5349 !! result
5350 <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>
5351 </p>
5352 !! end
5353
5354 !! test
5355 Template with invalid target containing tags
5356 !! input
5357 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5358 !! result
5359 <p>{{a<b>b</b>|foo|a=b|a = b}}
5360 </p>
5361 !! end
5362
5363 !! test
5364 Template with invalid target containing unclosed tag
5365 !! input
5366 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5367 !! result
5368 <p>{{a<b>|foo|a=b|a = b}}</b>
5369 </p>
5370 !! end
5371
5372 !! article
5373 Template:test
5374 !! text
5375 This is a test template
5376 !! endarticle
5377
5378 !! test
5379 Simple template
5380 !! input
5381 {{test}}
5382 !! result
5383 <p>This is a test template
5384 </p>
5385 !! end
5386
5387 !! test
5388 Template with explicit namespace
5389 !! input
5390 {{Template:test}}
5391 !! result
5392 <p>This is a test template
5393 </p>
5394 !! end
5395
5396
5397 !! article
5398 Template:paramtest
5399 !! text
5400 This is a test template with parameter {{{param}}}
5401 !! endarticle
5402
5403 !! test
5404 Template parameter
5405 !! input
5406 {{paramtest|param=foo}}
5407 !! result
5408 <p>This is a test template with parameter foo
5409 </p>
5410 !! end
5411
5412 !! article
5413 Template:paramtestnum
5414 !! text
5415 [[{{{1}}}|{{{2}}}]]
5416 !! endarticle
5417
5418 !! test
5419 Template unnamed parameter
5420 !! input
5421 {{paramtestnum|Main Page|the main page}}
5422 !! result
5423 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
5424 </p>
5425 !! end
5426
5427 !! article
5428 Template:templatesimple
5429 !! text
5430 (test)
5431 !! endarticle
5432
5433 !! article
5434 Template:templateredirect
5435 !! text
5436 #redirect [[Template:templatesimple]]
5437 !! endarticle
5438
5439 !! article
5440 Template:templateasargtestnum
5441 !! text
5442 {{{{{1}}}}}
5443 !! endarticle
5444
5445 !! article
5446 Template:templateasargtest
5447 !! text
5448 {{template{{{templ}}}}}
5449 !! endarticle
5450
5451 !! article
5452 Template:templateasargtest2
5453 !! text
5454 {{{{{templ}}}}}
5455 !! endarticle
5456
5457 !! test
5458 Template with template name as unnamed argument
5459 !! input
5460 {{templateasargtestnum|templatesimple}}
5461 !! result
5462 <p>(test)
5463 </p>
5464 !! end
5465
5466 !! test
5467 Template with template name as argument
5468 !! input
5469 {{templateasargtest|templ=simple}}
5470 !! result
5471 <p>(test)
5472 </p>
5473 !! end
5474
5475 !! test
5476 Template with template name as argument (2)
5477 !! input
5478 {{templateasargtest2|templ=templatesimple}}
5479 !! result
5480 <p>(test)
5481 </p>
5482 !! end
5483
5484 !! article
5485 Template:templateasargtestdefault
5486 !! text
5487 {{{{{templ|templatesimple}}}}}
5488 !! endarticle
5489
5490 !! article
5491 Template:templa
5492 !! text
5493 '''templ'''
5494 !! endarticle
5495
5496 !! test
5497 Template with default value
5498 !! input
5499 {{templateasargtestdefault}}
5500 !! result
5501 <p>(test)
5502 </p>
5503 !! end
5504
5505 !! test
5506 Template with default value (value set)
5507 !! input
5508 {{templateasargtestdefault|templ=templa}}
5509 !! result
5510 <p><b>templ</b>
5511 </p>
5512 !! end
5513
5514 !! test
5515 Template redirect
5516 !! input
5517 {{templateredirect}}
5518 !! result
5519 <p>(test)
5520 </p>
5521 !! end
5522
5523 !! test
5524 Template with argument in separate line
5525 !! input
5526 {{ templateasargtest |
5527 templ = simple }}
5528 !! result
5529 <p>(test)
5530 </p>
5531 !! end
5532
5533 !! test
5534 Template with complex template as argument
5535 !! input
5536 {{paramtest|
5537 param ={{ templateasargtest |
5538 templ = simple }}}}
5539 !! result
5540 <p>This is a test template with parameter (test)
5541 </p>
5542 !! end
5543
5544 !! test
5545 Template with thumb image (with link in description)
5546 !! input
5547 {{paramtest|
5548 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
5549 !! result
5550 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>
5551
5552 !! end
5553
5554 !! article
5555 Template:complextemplate
5556 !! text
5557 {{{1}}} {{paramtest|
5558 param ={{{param}}}}}
5559 !! endarticle
5560
5561 !! test
5562 Template with complex arguments
5563 !! input
5564 {{complextemplate|
5565 param ={{ templateasargtest |
5566 templ = simple }}|[[Template:complextemplate|link]]}}
5567 !! result
5568 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
5569 </p>
5570 !! end
5571
5572 !! test
5573 BUG 553: link with two variables in a piped link
5574 !! input
5575 {|
5576 |[[{{{1}}}|{{{2}}}]]
5577 |}
5578 !! result
5579 <table>
5580 <tr>
5581 <td>[[{{{1}}}|{{{2}}}]]
5582 </td></tr></table>
5583
5584 !! end
5585
5586 !! test
5587 Magic variable as template parameter
5588 !! input
5589 {{paramtest|param={{SITENAME}}}}
5590 !! result
5591 <p>This is a test template with parameter MediaWiki
5592 </p>
5593 !! end
5594
5595 !! article
5596 Template:linktest
5597 !! text
5598 [[{{{param}}}|link]]
5599 !! endarticle
5600
5601 !! test
5602 Template parameter as link source
5603 !! input
5604 {{linktest|param=Main Page}}
5605 !! result
5606 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
5607 </p>
5608 !! end
5609
5610 !!test
5611 Template-generated attribute string (k='v')
5612 !!input
5613 <span {{attr_str|id|v1}}>bar</span>
5614 !!result
5615 <p><span id="v1">bar</span>
5616 </p>
5617 !!end
5618
5619 !!article
5620 Template:paramtest2
5621 !! text
5622 including another template, {{paramtest|param={{{arg}}}}}
5623 !! endarticle
5624
5625 !! test
5626 Template passing argument to another template
5627 !! input
5628 {{paramtest2|arg='hmm'}}
5629 !! result
5630 <p>including another template, This is a test template with parameter 'hmm'
5631 </p>
5632 !! end
5633
5634 !! article
5635 Template:Linktest2
5636 !! text
5637 Main Page
5638 !! endarticle
5639
5640 !! test
5641 Template as link source
5642 !! input
5643 [[{{linktest2}}]]
5644
5645 [[{{linktest2}}|Main Page]]
5646
5647 [[{{linktest2}}]]Page
5648 !! result
5649 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5650 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5651 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
5652 </p>
5653 !! end
5654
5655
5656 !! article
5657 Template:loop1
5658 !! text
5659 {{loop2}}
5660 !! endarticle
5661
5662 !! article
5663 Template:loop2
5664 !! text
5665 {{loop1}}
5666 !! endarticle
5667
5668 !! test
5669 Template infinite loop
5670 !! input
5671 {{loop1}}
5672 !! result
5673 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
5674 </p>
5675 !! end
5676
5677 !! test
5678 Template from main namespace
5679 !! input
5680 {{:Main Page}}
5681 !! result
5682 <p>blah blah
5683 </p>
5684 !! end
5685
5686 !! article
5687 Template:table
5688 !! text
5689 {|
5690 | 1 || 2
5691 |-
5692 | 3 || 4
5693 |}
5694 !! endarticle
5695
5696 !! test
5697 BUG 529: Template with table, not included at beginning of line
5698 !! input
5699 foo {{table}}
5700 !! result
5701 <p>foo
5702 </p>
5703 <table>
5704 <tr>
5705 <td> 1 </td>
5706 <td> 2
5707 </td></tr>
5708 <tr>
5709 <td> 3 </td>
5710 <td> 4
5711 </td></tr></table>
5712
5713 !! end
5714
5715 !! test
5716 BUG 523: Template shouldn't eat newline (or add an extra one before table)
5717 !! input
5718 foo
5719 {{table}}
5720 !! result
5721 <p>foo
5722 </p>
5723 <table>
5724 <tr>
5725 <td> 1 </td>
5726 <td> 2
5727 </td></tr>
5728 <tr>
5729 <td> 3 </td>
5730 <td> 4
5731 </td></tr></table>
5732
5733 !! end
5734
5735 !! test
5736 BUG 41: Template parameters shown as broken links
5737 !! input
5738 {{{parameter}}}
5739 !! result
5740 <p>{{{parameter}}}
5741 </p>
5742 !! end
5743
5744 !! test
5745 Template with targets containing wikilinks
5746 !! input
5747 {{[[foo]]}}
5748
5749 {{[[{{echo|foo}}]]}}
5750
5751 {{{{echo|[[foo}}]]}}
5752 !! result
5753 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5754 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5755 </p><p>{{[[foo}}]]
5756 </p>
5757 !! end
5758
5759 !! article
5760 Template:MSGNW test
5761 !! text
5762 ''None'' of '''this''' should be
5763 * interpreted
5764 but rather passed unmodified
5765 {{test}}
5766 !! endarticle
5767
5768 # hmm, fix this or just deprecate msgnw and document its behavior?
5769 !! test
5770 msgnw keyword
5771 !! options
5772 disabled
5773 !! input
5774 {{msgnw:MSGNW test}}
5775 !! result
5776 <p>''None'' of '''this''' should be
5777 * interpreted
5778 but rather passed unmodified
5779 {{test}}
5780 </p>
5781 !! end
5782
5783 !! test
5784 int keyword
5785 !! input
5786 {{int:youhavenewmessages|lots of money|not!}}
5787 !! result
5788 <p>You have lots of money (not!).
5789 </p>
5790 !! end
5791
5792 !! article
5793 Template:Includes
5794 !! text
5795 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5796 !! endarticle
5797
5798 !! test
5799 <includeonly> and <noinclude> being included
5800 !! input
5801 {{Includes}}
5802 !! result
5803 <p>Foobar
5804 </p>
5805 !! end
5806
5807 !! article
5808 Template:Includes2
5809 !! text
5810 <onlyinclude>Foo</onlyinclude>bar
5811 !! endarticle
5812
5813 !! test
5814 <onlyinclude> being included
5815 !! input
5816 {{Includes2}}
5817 !! result
5818 <p>Foo
5819 </p>
5820 !! end
5821
5822
5823 !! article
5824 Template:Includes3
5825 !! text
5826 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
5827 !! endarticle
5828
5829 !! test
5830 <onlyinclude> and <includeonly> being included
5831 !! input
5832 {{Includes3}}
5833 !! result
5834 <p>Foo
5835 </p>
5836 !! end
5837
5838 !! test
5839 <includeonly> and <noinclude> on a page
5840 !! input
5841 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5842 !! result
5843 <p>Foozar
5844 </p>
5845 !! end
5846
5847 !! test
5848 Un-closed <noinclude>
5849 !! input
5850 <noinclude>
5851 !! result
5852 !! end
5853
5854 !! test
5855 <onlyinclude> on a page
5856 !! input
5857 <onlyinclude>Foo</onlyinclude>bar
5858 !! result
5859 <p>Foobar
5860 </p>
5861 !! end
5862
5863 !! test
5864 Un-closed <onlyinclude>
5865 !! input
5866 <onlyinclude>
5867 !! result
5868 !! end
5869
5870 !!test
5871 Self-closed noinclude, includeonly, onlyinclude tags
5872 !!input
5873 <noinclude />
5874 <includeonly />
5875 <onlyinclude />
5876 !!result
5877 <p><br />
5878 </p>
5879 !!end
5880
5881 !!test
5882 Unbalanced includeonly and noinclude tags
5883 !!input
5884 {|
5885 |a</noinclude>
5886 |b</noinclude></noinclude>
5887 |c</noinclude></includeonly>
5888 |d</includeonly></includeonly>
5889 |}
5890 !!result
5891 <table>
5892 <tr>
5893 <td>a
5894 </td>
5895 <td>b
5896 </td>
5897 <td>c&lt;/includeonly&gt;
5898 </td>
5899 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
5900 </td></tr></table>
5901
5902 !!end
5903
5904 !! article
5905 Template:Includeonly section
5906 !! text
5907 <includeonly>
5908 ==Includeonly section==
5909 </includeonly>
5910 ==Section T-1==
5911 !!endarticle
5912
5913 !! test
5914 Bug 6563: Edit link generation for section shown by <includeonly>
5915 !! input
5916 {{includeonly section}}
5917 !! result
5918 <h2><span class="editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a>]</span> <span class="mw-headline" id="Includeonly_section">Includeonly section</span></h2>
5919 <h2><span class="editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a>]</span> <span class="mw-headline" id="Section_T-1">Section T-1</span></h2>
5920
5921 !! end
5922
5923 # Uses same input as the contents of [[Template:Includeonly section]]
5924 !! test
5925 Bug 6563: Section extraction for section shown by <includeonly>
5926 !! options
5927 section=T-2
5928 !! input
5929 <includeonly>
5930 ==Includeonly section==
5931 </includeonly>
5932 ==Section T-2==
5933 !! result
5934 ==Section T-2==
5935 !! end
5936
5937 !! test
5938 Bug 6563: Edit link generation for section suppressed by <includeonly>
5939 !! input
5940 <includeonly>
5941 ==Includeonly section==
5942 </includeonly>
5943 ==Section 1==
5944 !! result
5945 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a>]</span> <span class="mw-headline" id="Section_1">Section 1</span></h2>
5946
5947 !! end
5948
5949 !! test
5950 Bug 6563: Section extraction for section suppressed by <includeonly>
5951 !! options
5952 section=1
5953 !! input
5954 <includeonly>
5955 ==Includeonly section==
5956 </includeonly>
5957 ==Section 1==
5958 !! result
5959 ==Section 1==
5960 !! end
5961
5962 !! test
5963 Un-closed <includeonly>
5964 !! input
5965 <includeonly>
5966 !! result
5967 !! end
5968
5969 ###
5970 ### <includeonly> and <noinclude> in attributes
5971 ###
5972 !!test
5973 0. includeonly around the entire attribute
5974 !!input
5975 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
5976 !!result
5977 <p><span id="v2">bar</span>
5978 </p>
5979 !!end
5980
5981 !!test
5982 1. includeonly in html attr key
5983 !!input
5984 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
5985 !!result
5986 <p><span id="foo">bar</span>
5987 </p>
5988 !!end
5989
5990 !!test
5991 2. includeonly in html attr value
5992 !!input
5993 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
5994 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
5995 !!result
5996 <p><span id="v1">bar</span>
5997 <span id="v1">bar</span>
5998 </p>
5999 !!end
6000
6001 !!test
6002 3. includeonly in part of an attr value
6003 !!input
6004 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
6005 !!result
6006 <p><span style="color:red;">bar</span>
6007 </p>
6008 !!end
6009
6010 ###
6011 ### Testing parsing of templates where a template arg
6012 ### has the same name as the template itself.
6013 ###
6014
6015 !! article
6016 Template:quote
6017 !! text
6018 {{{quote|{{{1}}}}}}
6019 !! endarticle
6020
6021 !!test
6022 Templates: Template Name/Arg clash: 1. Use of positional param
6023 !!input
6024 {{quote|foo}}
6025 !!result
6026 <p>foo
6027 </p>
6028 !!end
6029
6030 !!test
6031 Templates: Template Name/Arg clash: 2. Use of named param
6032 !!input
6033 {{quote|quote=foo}}
6034 !!result
6035 <p>foo
6036 </p>
6037 !!end
6038
6039 !!test
6040 Templates: Template Name/Arg clash: 3. Use of named param with empty input
6041 !!input
6042 {{quote|quote}}
6043 !!result
6044 <p>quote
6045 </p>
6046 !!end
6047
6048 ###
6049 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
6050 ###
6051
6052 !!test
6053 Templates: 1. Simple use
6054 !!input
6055 {{echo|Foo}}
6056 !!result
6057 <p>Foo
6058 </p>
6059 !!end
6060
6061 !!test
6062 Templates: 2. Inside a block tag
6063 !!input
6064 <div>{{echo|Foo}}</div>
6065 !!result
6066 <div>Foo</div>
6067
6068 !!end
6069
6070 !!test
6071 Templates: P-wrapping: 1a. Templates on consecutive lines
6072 !!input
6073 {{echo|Foo}}
6074 {{echo|bar}}
6075 !!result
6076 <p>Foo
6077 bar
6078 </p>
6079 !!end
6080
6081 !!test
6082 Templates: P-wrapping: 1b. Templates on consecutive lines
6083 !!input
6084 Foo
6085
6086 {{echo|bar}}
6087 {{echo|baz}}
6088 !!result
6089 <p>Foo
6090 </p><p>bar
6091 baz
6092 </p>
6093 !!end
6094
6095 !!test
6096 Templates: P-wrapping: 1c. Templates on consecutive lines
6097 !!input
6098 {{echo|Foo}}
6099 {{echo|bar}} <div>baz</div>
6100 !!result
6101 <p>Foo
6102 </p>
6103 bar <div>baz</div>
6104
6105 !!end
6106
6107 !!test
6108 Templates: Inline Text: 1. Multiple tmeplate uses
6109 !!input
6110 {{echo|Foo}}bar{{echo|baz}}
6111 !!result
6112 <p>Foobarbaz
6113 </p>
6114 !!end
6115
6116 !!test
6117 Templates: Inline Text: 2. Back-to-back template uses
6118 !!input
6119 {{echo|Foo}}{{echo|bar}}
6120 !!result
6121 <p>Foobar
6122 </p>
6123 !!end
6124
6125 !!test
6126 Templates: Block Tags: 1. Multiple template uses
6127 !!input
6128 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
6129 !!result
6130 <div>Foo</div><div>bar</div><div>baz</div>
6131
6132 !!end
6133
6134 !!test
6135 Templates: Block Tags: 2. Back-to-back template uses
6136 !!input
6137 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
6138 !!result
6139 <div>Foo</div><div>bar</div>
6140
6141 !!end
6142
6143 !!test
6144 Templates: Links: 1. Simple example
6145 !!input
6146 {{echo|[[Foo|bar]]}}
6147 !!result
6148 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6149 </p>
6150 !!end
6151
6152 !!test
6153 Templates: Links: 2. Generation of link href
6154 !!input
6155 [[{{echo|Foo}}|bar]]
6156 !!result
6157 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6158 </p>
6159 !!end
6160
6161 !!test
6162 Templates: Links: 3. Generation of part of a link href
6163 !!input
6164 [[Fo{{echo|o}}|bar]]
6165
6166 [[Foo{{echo|bar}}]]
6167
6168 [[Foo{{echo|bar}}baz]]
6169
6170 [[Foo{{echo|bar}}|bar]]
6171
6172 [[:Foo{{echo|bar}}]]
6173
6174 [[:Foo{{echo|bar}}|bar]]
6175 !!result
6176 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6177 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6178 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
6179 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6180 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6181 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6182 </p>
6183 !!end
6184
6185 !!test
6186 Templates: Links: 4. Multiple templates generating link href
6187 !!input
6188 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
6189 !!result
6190 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6191 </p>
6192 !!end
6193
6194 !!test
6195 Templates: Links: 5. Generation of link text
6196 !!input
6197 [[Foo|{{echo|bar}}]]
6198 !!result
6199 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6200 </p>
6201 !!end
6202
6203 !!test
6204 Templates: Links: 5. Nested templates (only outermost template should be marked)
6205 !!input
6206 {{echo|[[{{echo|Foo}}|bar]]}}
6207 !!result
6208 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6209 </p>
6210 !!end
6211
6212 !!test
6213 Templates: HTML Tag: 1. Generation of HTML attr. key
6214 !!input
6215 <div {{echo|style}}="color:red;">foo</div>
6216 !!result
6217 <div style="color:red;">foo</div>
6218
6219 !!end
6220
6221 !!test
6222 Templates: HTML Tag: 2. Generation of HTML attr. value
6223 !!input
6224 <div style={{echo|'color:red;'}}>foo</div>
6225 !!result
6226 <div style="color:red;">foo</div>
6227
6228 !!end
6229
6230 !!test
6231 Templates: HTML Tag: 3. Generation of HTML attr key and value
6232 !!input
6233 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
6234 !!result
6235 <div style="color:red;">foo</div>
6236
6237 !!end
6238
6239 !!test
6240 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
6241 !!input
6242 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
6243 !!result
6244 <div title="This is a long title with just one piece templated">foo</div>
6245
6246 !!end
6247
6248 !!test
6249 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
6250 !!input
6251 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
6252 !!result
6253 <div title="This is a long title with just one piece templated">foo</div>
6254
6255 !!end
6256
6257 !!test
6258 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
6259 !!input
6260 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
6261 !!result
6262 <div title="This is a long title with just one piece templated">foo</div>
6263
6264 !!end
6265
6266 !!test
6267 Templates: HTML Tag: 7. Generation of partial attribute key string
6268 !!input
6269 <div st{{echo|yle}}="color:red;">foo</div>
6270 !!result
6271 <div style="color:red;">foo</div>
6272
6273 !!end
6274
6275 !!test
6276 Templates: HTML Tables: 1. Generating start of a HTML table
6277 !!input
6278 {{echo|<table><tr><td>foo</td>}}</tr></table>
6279 !!result
6280 <table><tr><td>foo</td></tr></table>
6281
6282 !!end
6283
6284 !!test
6285 Templates: HTML Tables: 2a. Generating middle of a HTML table
6286 !!input
6287 <table><tr>{{echo|<td>foo</td>}}</tr></table>
6288 !!result
6289 <table><tr><td>foo</td></tr></table>
6290
6291 !!end
6292
6293 !!test
6294 Templates: HTML Tables: 2b. Generating middle of a HTML table
6295 !!input
6296 <table>{{echo|<tr><td>foo</td></tr>}}</table>
6297 !!result
6298 <table><tr><td>foo</td></tr></table>
6299
6300 !!end
6301
6302 !!test
6303 Templates: HTML Tables: 3. Generating end of a HTML table
6304 !!input
6305 <table><tr>{{echo|<td>foo</td></tr></table>}}
6306 !!result
6307 <table><tr><td>foo</td></tr></table>
6308
6309 !!end
6310
6311 !!test
6312 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
6313 !!input
6314 {{echo|<table>}}<tr><td>foo</td></tr></table>
6315 !!result
6316 <table><tr><td>foo</td></tr></table>
6317
6318 !!end
6319
6320 !!test
6321 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
6322 !!input
6323 <table>{{echo|<tr>}}<td>foo</td></tr></table>
6324 !!result
6325 <table><tr><td>foo</td></tr></table>
6326
6327 !!end
6328
6329 !!test
6330 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
6331 !!input
6332 <table><tr>{{echo|<td>}}foo</td></tr></table>
6333 !!result
6334 <table><tr><td>foo</td></tr></table>
6335
6336 !!end
6337
6338 !!test
6339 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
6340 !!input
6341 <table><tr><td>foo{{echo|</td>}}</tr></table>
6342 !!result
6343 <table><tr><td>foo</td></tr></table>
6344
6345 !!end
6346
6347 !!test
6348 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
6349 !!input
6350 <table><tr><td>foo</td>{{echo|</tr>}}</table>
6351 !!result
6352 <table><tr><td>foo</td></tr></table>
6353
6354 !!end
6355
6356 !!test
6357 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
6358 !!input
6359 <table><tr><td>foo</td></tr>{{echo|</table>}}
6360 !!result
6361 <table><tr><td>foo</td></tr></table>
6362
6363 !!end
6364
6365 !!test
6366 Templates: Wiki Tables: 1a. Fostering of entire template content
6367 !!input
6368 {|
6369 {{echo|a}}
6370 |}
6371 !!result
6372 <table>
6373 a
6374 <tr><td></td></tr></table>
6375
6376 !!end
6377
6378 !!test
6379 Templates: Wiki Tables: 1b. Fostering of entire template content
6380 !!input
6381 {|
6382 {{echo|<div>}}
6383 foo
6384 {{echo|</div>}}
6385 |}
6386 !!result
6387 <table>
6388 <div>
6389 <p>foo
6390 </p>
6391 </div>
6392 <tr><td></td></tr></table>
6393
6394 !!end
6395
6396 !!test
6397 Templates: Wiki Tables: 2. Fostering of partial template content
6398 !!input
6399 {|
6400 {{echo|a
6401 <div>b</div>}}
6402 |}
6403 !!result
6404 <table>
6405 a
6406 <div>b</div>
6407 <tr><td></td></tr></table>
6408
6409 !!end
6410
6411 !!test
6412 Templates: Wiki Tables: 3. td-content via multiple templates
6413 !!input
6414 {|
6415 {{echo|{{pipe}}a}}{{echo|b}}
6416 |}
6417 !!result
6418 <table>
6419 <tr>
6420 <td>ab
6421 </td></tr></table>
6422
6423 !!end
6424
6425 !!test
6426 Templates: Wiki Tables: 4. Templated tags, no content
6427 !!input
6428 {{tbl-start}}
6429 {{tbl-end}}
6430 !!result
6431 <table>
6432 <tr><td></td></tr></table>
6433
6434 !!end
6435
6436 !!test
6437 Templates: Wiki Tables: 5. Templated tags, regular td-tags
6438 !!input
6439 {{tbl-start}}
6440 |foo
6441 {{tbl-end}}
6442 !!result
6443 <table>
6444 <tr>
6445 <td>foo
6446 </td></tr></table>
6447
6448 !!end
6449
6450 !!test
6451 Templates: Wiki Tables: 6. Templated tags, templated td-tags
6452 !!input
6453 {{tbl-start}}
6454 {{!}}foo
6455 {{tbl-end}}
6456 !!result
6457 <table>
6458 <tr>
6459 <td>foo
6460 </td></tr></table>
6461
6462 !!end
6463
6464 !!test
6465 Templates: Lists: Multi-line list-items via templates
6466 !!input
6467 *{{echo|a {{nonexistent|
6468 unused}}}}
6469 *{{echo|b {{nonexistent|
6470 unused}}}}
6471 !!result
6472 <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>
6473 </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>
6474 </li></ul>
6475
6476 !!end
6477
6478 !!test
6479 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
6480 !!input
6481 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
6482 !!result
6483 <p><i>ab</i>c<i>d</i>e
6484 </p>
6485 !!end
6486
6487 !!test
6488 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
6489 (PHP parser generates misnested html)
6490 !! options
6491 disabled
6492 !!input
6493 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
6494 !!result
6495 <p><span><i>a</i></span><i><span>b</span></i><span>c</span><i>d</i><span>e</span></p>
6496 !!end
6497
6498 !!test
6499 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
6500 (PHP parser generates misnested html)
6501 !! options
6502 disabled
6503 !!input
6504 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
6505 !!result
6506 <div><i>a</i></div>
6507 <div><i>b</i>c<i>d</i></div>
6508 <div>e</div>
6509 !!end
6510
6511 !!test
6512 Templates: Ugly nesting: 4. Divs opened/closed across templates
6513 !!input
6514 a<div>b{{echo|c</div>d}}e
6515 !!result
6516 a<div>bc</div>de
6517
6518 !!end
6519
6520 !!test
6521 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
6522 (Parsoid-centric)
6523 !! options
6524 parsoid
6525 !!input
6526 {|
6527 |{{echo|foo</table>}}
6528 |bar
6529 |}
6530 !!result
6531 <table about="#mwt1" typeof="mw:Object/Template ">
6532 <tbody><tr><td>foo</td></tr></tbody></table><span about="#mwt1">
6533 bar</span><span about="#mwt1">
6534 </span>
6535 !!end
6536
6537 !!test
6538 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
6539 (Parsoid-centric)
6540 !! options
6541 parsoid
6542 !!input
6543 <table>
6544 <tr>
6545 <td>
6546 <table>
6547 <tr>
6548 <td>1. {{echo|foo </table>}}</td>
6549 <td> bar </td>
6550 <td>2. {{echo|baz </table>}}</td>
6551 </tr>
6552 <tr>
6553 <td>abc</td>
6554 </tr>
6555 </table>
6556 </td>
6557 </tr>
6558 <tr>
6559 <td>xyz</td>
6560 </tr>
6561 </table>
6562 !!result
6563 <table about="#mwt1" typeof="mw:Object/Template">
6564 <tbody><tr >
6565 <td >
6566 <table >
6567 <tbody><tr >
6568 <td >1. foo </td></tr></tbody></table></td>
6569 <td > bar </td>
6570 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
6571 </span><span about="#mwt1">
6572
6573 abc</span><span about="#mwt1">
6574 </span><span about="#mwt1">
6575 </span><span about="#mwt1">
6576 </span><span about="#mwt1">
6577 </span><span about="#mwt1">
6578
6579 xyz</span><span about="#mwt1">
6580 </span><span about="#mwt1">
6581 </span>
6582 !!end
6583
6584 !! test
6585 Templates: Ugly templates: 3. newline-only template parameter
6586 !! input
6587 foo {{echo|
6588 }}
6589 !! result
6590 <p>foo
6591 </p>
6592 !! end
6593
6594 # This looks like a bug: a single newline triggers p/br for some reason.
6595 !! test
6596 Templates: Ugly templates: 4. newline-only template parameter inconsistency
6597 !! input
6598 {{echo|
6599 }}
6600 !! result
6601 <p><br />
6602 </p>
6603 !! end
6604
6605
6606 !!test
6607 Parser Functions: 1. Simple example
6608 !!input
6609 {{uc:foo}}
6610 !!result
6611 <p>FOO
6612 </p>
6613 !!end
6614
6615 !!test
6616 Parser Functions: 2. Nested use (only outermost should be marked up)
6617 !!input
6618 {{uc:{{lc:FOO}}}}
6619 !!result
6620 <p>FOO
6621 </p>
6622 !!end
6623
6624 ###
6625 ### Pre-save transform tests
6626 ###
6627 !! test
6628 pre-save transform: subst:
6629 !! options
6630 PST
6631 !! input
6632 {{subst:test}}
6633 !! result
6634 This is a test template
6635 !! end
6636
6637 !! test
6638 pre-save transform: normal template
6639 !! options
6640 PST
6641 !! input
6642 {{test}}
6643 !! result
6644 {{test}}
6645 !! end
6646
6647 !! test
6648 pre-save transform: nonexistent template
6649 !! options
6650 PST
6651 !! input
6652 {{thistemplatedoesnotexist}}
6653 !! result
6654 {{thistemplatedoesnotexist}}
6655 !! end
6656
6657
6658 !! test
6659 pre-save transform: subst magic variables
6660 !! options
6661 PST
6662 !! input
6663 {{subst:SITENAME}}
6664 !! result
6665 MediaWiki
6666 !! end
6667
6668 # This is bug 89, which I fixed. -- wtm
6669 !! test
6670 pre-save transform: subst: templates with parameters
6671 !! options
6672 pst
6673 !! input
6674 {{subst:paramtest|param="something else"}}
6675 !! result
6676 This is a test template with parameter "something else"
6677 !! end
6678
6679 !! article
6680 Template:nowikitest
6681 !! text
6682 <nowiki>'''not wiki'''</nowiki>
6683 !! endarticle
6684
6685 !! test
6686 pre-save transform: nowiki in subst (bug 1188)
6687 !! options
6688 pst
6689 !! input
6690 {{subst:nowikitest}}
6691 !! result
6692 <nowiki>'''not wiki'''</nowiki>
6693 !! end
6694
6695
6696 !! article
6697 Template:commenttest
6698 !! text
6699 This template has <!-- a comment --> in it.
6700 !! endarticle
6701
6702 !! test
6703 pre-save transform: comment in subst (bug 1936)
6704 !! options
6705 pst
6706 !! input
6707 {{subst:commenttest}}
6708 !! result
6709 This template has <!-- a comment --> in it.
6710 !! end
6711
6712 !! test
6713 pre-save transform: unclosed tag
6714 !! options
6715 pst noxml
6716 !! input
6717 <nowiki>'''not wiki'''
6718 !! result
6719 <nowiki>'''not wiki'''
6720 !! end
6721
6722 !! test
6723 pre-save transform: mixed tag case
6724 !! options
6725 pst noxml
6726 !! input
6727 <NOwiki>'''not wiki'''</noWIKI>
6728 !! result
6729 <NOwiki>'''not wiki'''</noWIKI>
6730 !! end
6731
6732 !! test
6733 pre-save transform: unclosed comment in <nowiki>
6734 !! options
6735 pst noxml
6736 !! input
6737 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6738 !! result
6739 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6740 !!end
6741
6742 !! article
6743 Template:dangerous
6744 !!text
6745 <span onmouseover="alert('crap')">Oh no</span>
6746 !!endarticle
6747
6748 !!test
6749 (confirming safety of fix for subst bug 1936)
6750 !! input
6751 {{Template:dangerous}}
6752 !! result
6753 <p><span>Oh no</span>
6754 </p>
6755 !! end
6756
6757 !! test
6758 pre-save transform: comment containing gallery (bug 5024)
6759 !! options
6760 pst
6761 !! input
6762 <!-- <gallery>data</gallery> -->
6763 !!result
6764 <!-- <gallery>data</gallery> -->
6765 !!end
6766
6767 !! test
6768 pre-save transform: comment containing extension
6769 !! options
6770 pst
6771 !! input
6772 <!-- <tag>data</tag> -->
6773 !!result
6774 <!-- <tag>data</tag> -->
6775 !!end
6776
6777 !! test
6778 pre-save transform: comment containing nowiki
6779 !! options
6780 pst
6781 !! input
6782 <!-- <nowiki>data</nowiki> -->
6783 !!result
6784 <!-- <nowiki>data</nowiki> -->
6785 !!end
6786
6787 !! test
6788 pre-save transform: <noinclude> in subst (bug 3298)
6789 !! options
6790 pst
6791 !! input
6792 {{subst:Includes}}
6793 !! result
6794 Foobar
6795 !! end
6796
6797 !! test
6798 pre-save transform: <onlyinclude> in subst (bug 3298)
6799 !! options
6800 pst
6801 !! input
6802 {{subst:Includes2}}
6803 !! result
6804 Foo
6805 !! end
6806
6807 !! article
6808 Template:SubstTest
6809 !!text
6810 {{<includeonly>subst:</includeonly>Includes}}
6811 !! endarticle
6812
6813 !! article
6814 Template:SafeSubstTest
6815 !! text
6816 {{<includeonly>safesubst:</includeonly>Includes}}
6817 !! endarticle
6818
6819 !! test
6820 bug 22297: safesubst: works during PST
6821 !! options
6822 pst
6823 !! input
6824 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
6825 !! result
6826 FoobarFoobar
6827 !! end
6828
6829 !! test
6830 bug 22297: safesubst: works during normal parse
6831 !! input
6832 {{SafeSubstTest}}
6833 !! result
6834 <p>Foobar
6835 </p>
6836 !! end
6837
6838 !! test:
6839 subst: does not work during normal parse
6840 !! input
6841 {{SubstTest}}
6842 !! result
6843 <p>{{subst:Includes}}
6844 </p>
6845 !! end
6846
6847 !! test
6848 pre-save transform: context links ("pipe trick")
6849 !! options
6850 pst
6851 !! input
6852 [[Article (context)|]]
6853 [[Bar:Article|]]
6854 [[:Bar:Article|]]
6855 [[Bar:Article (context)|]]
6856 [[:Bar:Article (context)|]]
6857 [[|Article]]
6858 [[|Article (context)]]
6859 [[Bar:X (Y) Z|]]
6860 [[:Bar:X (Y) Z|]]
6861 !! result
6862 [[Article (context)|Article]]
6863 [[Bar:Article|Article]]
6864 [[:Bar:Article|Article]]
6865 [[Bar:Article (context)|Article]]
6866 [[:Bar:Article (context)|Article]]
6867 [[Article]]
6868 [[Article (context)]]
6869 [[Bar:X (Y) Z|X (Y) Z]]
6870 [[:Bar:X (Y) Z|X (Y) Z]]
6871 !! end
6872
6873 !! test
6874 pre-save transform: context links ("pipe trick") with interwiki prefix
6875 !! options
6876 pst
6877 !! input
6878 [[interwiki:Article|]]
6879 [[:interwiki:Article|]]
6880 [[interwiki:Bar:Article|]]
6881 [[:interwiki:Bar:Article|]]
6882 !! result
6883 [[interwiki:Article|Article]]
6884 [[:interwiki:Article|Article]]
6885 [[interwiki:Bar:Article|Bar:Article]]
6886 [[:interwiki:Bar:Article|Bar:Article]]
6887 !! end
6888
6889 !! test
6890 pre-save transform: context links ("pipe trick") with parens in title
6891 !! options
6892 pst title=[[Somearticle (context)]]
6893 !! input
6894 [[|Article]]
6895 !! result
6896 [[Article (context)|Article]]
6897 !! end
6898
6899 !! test
6900 pre-save transform: context links ("pipe trick") with comma in title
6901 !! options
6902 pst title=[[Someplace, Somewhere]]
6903 !! input
6904 [[|Otherplace]]
6905 [[Otherplace, Elsewhere|]]
6906 [[Otherplace, Elsewhere, Anywhere|]]
6907 !! result
6908 [[Otherplace, Somewhere|Otherplace]]
6909 [[Otherplace, Elsewhere|Otherplace]]
6910 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
6911 !! end
6912
6913 !! test
6914 pre-save transform: context links ("pipe trick") with parens and comma
6915 !! options
6916 pst title=[[Someplace (IGNORED), Somewhere]]
6917 !! input
6918 [[|Otherplace]]
6919 [[Otherplace (place), Elsewhere|]]
6920 !! result
6921 [[Otherplace, Somewhere|Otherplace]]
6922 [[Otherplace (place), Elsewhere|Otherplace]]
6923 !! end
6924
6925 !! test
6926 pre-save transform: context links ("pipe trick") with comma and parens
6927 !! options
6928 pst title=[[Who, me? (context)]]
6929 !! input
6930 [[|Yes, you.]]
6931 [[Me, Myself, and I (1937 song)|]]
6932 !! result
6933 [[Yes, you. (context)|Yes, you.]]
6934 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
6935 !! end
6936
6937 !! test
6938 pre-save transform: context links ("pipe trick") with namespace
6939 !! options
6940 pst title=[[Ns:Somearticle]]
6941 !! input
6942 [[|Article]]
6943 !! result
6944 [[Ns:Article|Article]]
6945 !! end
6946
6947 !! test
6948 pre-save transform: context links ("pipe trick") with namespace and parens
6949 !! options
6950 pst title=[[Ns:Somearticle (context)]]
6951 !! input
6952 [[|Article]]
6953 !! result
6954 [[Ns:Article (context)|Article]]
6955 !! end
6956
6957 !! test
6958 pre-save transform: context links ("pipe trick") with namespace and comma
6959 !! options
6960 pst title=[[Ns:Somearticle, Context, Whatever]]
6961 !! input
6962 [[|Article]]
6963 !! result
6964 [[Ns:Article, Context, Whatever|Article]]
6965 !! end
6966
6967 !! test
6968 pre-save transform: context links ("pipe trick") with namespace, comma and parens
6969 !! options
6970 pst title=[[Ns:Somearticle, Context (context)]]
6971 !! input
6972 [[|Article]]
6973 !! result
6974 [[Ns:Article (context)|Article]]
6975 !! end
6976
6977 !! test
6978 pre-save transform: context links ("pipe trick") with namespace, parens and comma
6979 !! options
6980 pst title=[[Ns:Somearticle (IGNORED), Context]]
6981 !! input
6982 [[|Article]]
6983 !! result
6984 [[Ns:Article, Context|Article]]
6985 !! end
6986
6987 !! test
6988 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
6989 !! options
6990 pst
6991 !! input
6992 [[Article(context)|]]
6993 [[Bar:Article(context)|]]
6994 [[:Bar:Article(context)|]]
6995 [[|Article(context)]]
6996 [[Bar:X(Y)Z|]]
6997 [[:Bar:X(Y)Z|]]
6998 !! result
6999 [[Article(context)|Article]]
7000 [[Bar:Article(context)|Article]]
7001 [[:Bar:Article(context)|Article]]
7002 [[Article(context)]]
7003 [[Bar:X(Y)Z|X(Y)Z]]
7004 [[:Bar:X(Y)Z|X(Y)Z]]
7005 !! end
7006
7007 !! test
7008 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
7009 !! options
7010 pst
7011 !! input
7012 [[Article (context)|]]
7013 [[Bar:Article (context)|]]
7014 [[:Bar:Article (context)|]]
7015 [[|Article (context)]]
7016 [[Bar:X (Y) Z|]]
7017 [[:Bar:X (Y) Z|]]
7018 !! result
7019 [[Article (context)|Article]]
7020 [[Bar:Article (context)|Article]]
7021 [[:Bar:Article (context)|Article]]
7022 [[Article (context)]]
7023 [[Bar:X (Y) Z|X (Y) Z]]
7024 [[:Bar:X (Y) Z|X (Y) Z]]
7025 !! end
7026
7027 !! test
7028 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
7029 !! options
7030 pst
7031 !! input
7032 [[Article(context)|]]
7033 [[Bar:Article(context)|]]
7034 [[:Bar:Article(context)|]]
7035 [[|Article(context)]]
7036 [[Bar:X(Y)Z|]]
7037 [[:Bar:X(Y)Z|]]
7038 !! result
7039 [[Article(context)|Article]]
7040 [[Bar:Article(context)|Article]]
7041 [[:Bar:Article(context)|Article]]
7042 [[Article(context)]]
7043 [[Bar:X(Y)Z|X(Y)Z]]
7044 [[:Bar:X(Y)Z|X(Y)Z]]
7045 !! end
7046
7047 !! test
7048 pre-save transform: context links ("pipe trick") with commas (bug 21660)
7049 !! options
7050 pst
7051 !! input
7052 [[Article (context), context|]]
7053 [[Article (context),context|]]
7054 [[Bar:Article (context), context|]]
7055 [[Bar:Article (context),context|]]
7056 [[:Bar:Article (context), context|]]
7057 [[:Bar:Article (context),context|]]
7058 !! result
7059 [[Article (context), context|Article]]
7060 [[Article (context),context|Article]]
7061 [[Bar:Article (context), context|Article]]
7062 [[Bar:Article (context),context|Article]]
7063 [[:Bar:Article (context), context|Article]]
7064 [[:Bar:Article (context),context|Article]]
7065 !! end
7066
7067 !! test
7068 pre-save transform: trim trailing empty lines
7069 !! options
7070 pst
7071 !! input
7072 Empty lines are trimmed
7073
7074
7075
7076
7077 !! result
7078 Empty lines are trimmed
7079 !! end
7080
7081 !! test
7082 pre-save transform: Signature expansion
7083 !! options
7084 pst
7085 !! input
7086 * ~~~
7087 * <noinclude>~~~</noinclude>
7088 * <includeonly>~~~</includeonly>
7089 * <onlyinclude>~~~</onlyinclude>
7090 !! result
7091 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
7092 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
7093 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
7094 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
7095 !! end
7096
7097
7098 !! test
7099 pre-save transform: Signature expansion in nowiki tags (bug 93)
7100 !! options
7101 pst disabled
7102 !! input
7103 Shall not expand:
7104
7105 <nowiki>~~~~</nowiki>
7106
7107 <includeonly><nowiki>~~~~</nowiki></includeonly>
7108
7109 <noinclude><nowiki>~~~~</nowiki></noinclude>
7110
7111 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7112
7113 {{subst:Foo}} shall be converted to FOO
7114
7115 As well as inside noinclude/onlyinclude
7116 <noinclude>{{subst:Foo}}</noinclude>
7117 <onlyinclude>{{subst:Foo}}</onlyinclude>
7118
7119 But not inside includeonly
7120 <includeonly>{{subst:Foo}}</includeonly>
7121 !! result
7122 Shall not expand:
7123
7124 <nowiki>~~~~</nowiki>
7125
7126 <includeonly><nowiki>~~~~</nowiki></includeonly>
7127
7128 <noinclude><nowiki>~~~~</nowiki></noinclude>
7129
7130 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7131
7132 FOO shall be converted to FOO
7133
7134 As well as inside noinclude/onlyinclude
7135 <noinclude>FOO</noinclude>
7136 <onlyinclude>FOO</onlyinclude>
7137
7138 But not inside includeonly
7139 <includeonly>{{subst:Foo}}</includeonly>
7140 !! end
7141
7142 ###
7143 ### Message transform tests
7144 ###
7145 !! test
7146 message transform: magic variables
7147 !! options
7148 msg
7149 !! input
7150 {{SITENAME}}
7151 !! result
7152 MediaWiki
7153 !! end
7154
7155 !! test
7156 message transform: should not transform wiki markup
7157 !! options
7158 msg
7159 !! input
7160 ''test''
7161 !! result
7162 ''test''
7163 !! end
7164
7165 !! test
7166 message transform: <noinclude> in transcluded template (bug 4926)
7167 !! options
7168 msg
7169 !! input
7170 {{Includes}}
7171 !! result
7172 Foobar
7173 !! end
7174
7175 !! test
7176 message transform: <onlyinclude> in transcluded template (bug 4926)
7177 !! options
7178 msg
7179 !! input
7180 {{Includes2}}
7181 !! result
7182 Foo
7183 !! end
7184
7185 !! test
7186 {{#special:}} page name, known
7187 !! options
7188 msg
7189 !! input
7190 {{#special:Recentchanges}}
7191 !! result
7192 Special:RecentChanges
7193 !! end
7194
7195 !! test
7196 {{#special:}} page name with subpage, known
7197 !! options
7198 msg
7199 !! input
7200 {{#special:Recentchanges/param}}
7201 !! result
7202 Special:RecentChanges/param
7203 !! end
7204
7205 !! test
7206 {{#special:}} page name, unknown
7207 !! options
7208 msg
7209 !! input
7210 {{#special:foobarnonexistent}}
7211 !! result
7212 No such special page
7213 !! end
7214
7215 !! test
7216 {{#speciale:}} page name, known
7217 !! options
7218 msg
7219 !! input
7220 {{#speciale:Recentchanges}}
7221 !! result
7222 Special:RecentChanges
7223 !! end
7224
7225 !! test
7226 {{#speciale:}} page name with subpage, known
7227 !! options
7228 msg
7229 !! input
7230 {{#speciale:Recentchanges/param}}
7231 !! result
7232 Special:RecentChanges/param
7233 !! end
7234
7235 !! test
7236 {{#speciale:}} page name, unknown
7237 !! options
7238 msg
7239 !! input
7240 {{#speciale:foobarnonexistent}}
7241 !! result
7242 No_such_special_page
7243 !! end
7244
7245 ###
7246 ### Images
7247 ###
7248 !! test
7249 Simple image
7250 !! input
7251 [[Image:foobar.jpg]]
7252 !! result
7253 <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>
7254 </p>
7255 !! end
7256
7257 !! test
7258 Right-aligned image
7259 !! input
7260 [[Image:foobar.jpg|right]]
7261 !! result
7262 <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>
7263
7264 !! end
7265
7266 !! test
7267 Simple image (using File: namespace, now canonical)
7268 !! input
7269 [[File:foobar.jpg]]
7270 !! result
7271 <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>
7272 </p>
7273 !! end
7274
7275 !! test
7276 Image with caption
7277 !! input
7278 [[Image:foobar.jpg|right|Caption text]]
7279 !! result
7280 <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>
7281
7282 !! end
7283
7284 !! test
7285 Image with empty attribute
7286 !! input
7287 [[Image:foobar.jpg|right||Caption text]]
7288 !! result
7289 <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>
7290
7291 !! end
7292
7293 !! test
7294 Image with link tails
7295 !! input
7296 123[[Image:foobar.jpg]]456
7297 123[[Image:foobar.jpg|right]]456
7298 123[[Image:foobar.jpg|thumb]]456
7299 !! result
7300 <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
7301 </p>
7302 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
7303 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
7304
7305 !! end
7306
7307 !! test
7308 Image with multiple captions -- only last one is accepted
7309 !! input
7310 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
7311 !! result
7312 <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>
7313
7314 !! end
7315
7316 !! test
7317 Image with width attribute at different positions
7318 !! input
7319 [[Image:foobar.jpg|200px|right|Caption]]
7320 [[Image:foobar.jpg|right|200px|Caption]]
7321 [[Image:foobar.jpg|right|Caption|200px]]
7322 !! result
7323 <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>
7324 <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>
7325 <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>
7326
7327 !! end
7328
7329 !! test
7330 Image with link parameter, wiki target
7331 !! input
7332 [[Image:foobar.jpg|link=Target page]]
7333 !! result
7334 <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>
7335 </p>
7336 !! end
7337
7338 !! test
7339 Image with link parameter, URL target
7340 !! input
7341 [[Image:foobar.jpg|link=http://example.com/]]
7342 !! result
7343 <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>
7344 </p>
7345 !! end
7346
7347 !! test
7348 Image with link parameter, wgExternalLinkTarget
7349 !! input
7350 [[Image:foobar.jpg|link=http://example.com/]]
7351 !! config
7352 wgExternalLinkTarget='foobar'
7353 !! result
7354 <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>
7355 </p>
7356 !! end
7357
7358 !! test
7359 Image with link parameter, wgNoFollowLinks set to false
7360 !! input
7361 [[Image:foobar.jpg|link=http://example.com/]]
7362 !! config
7363 wgNoFollowLinks=false
7364 !! result
7365 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7366 </p>
7367 !! end
7368
7369 !! test
7370 Image with link parameter, wgNoFollowDomainExceptions
7371 !! input
7372 [[Image:foobar.jpg|link=http://example.com/]]
7373 !! config
7374 wgNoFollowDomainExceptions='example.com'
7375 !! result
7376 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7377 </p>
7378 !! end
7379
7380 !! test
7381 Image with link parameter, wgExternalLinkTarget, unnamed parameter
7382 !! input
7383 [[Image:foobar.jpg|link=http://example.com/|Title]]
7384 !! config
7385 wgExternalLinkTarget='foobar'
7386 !! result
7387 <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>
7388 </p>
7389 !! end
7390
7391 !! test
7392 Image with empty link parameter
7393 !! input
7394 [[Image:foobar.jpg|link=]]
7395 !! result
7396 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
7397 </p>
7398 !! end
7399
7400 !! test
7401 Image with link parameter (wiki target) and unnamed parameter
7402 !! input
7403 [[Image:foobar.jpg|link=Target page|Title]]
7404 !! result
7405 <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>
7406 </p>
7407 !! end
7408
7409 !! test
7410 Image with link parameter (URL target) and unnamed parameter
7411 !! input
7412 [[Image:foobar.jpg|link=http://example.com/|Title]]
7413 !! result
7414 <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>
7415 </p>
7416 !! end
7417
7418 !! test
7419 Thumbnail image with link parameter
7420 !! options
7421 php
7422 !! input
7423 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
7424 !! result
7425 <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>
7426
7427 !! end
7428
7429 !! test
7430 Manually-specified thumbnail image
7431 !! options
7432 php
7433 !! input
7434 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
7435 !! result
7436 <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>
7437
7438 !! end
7439
7440 !! test
7441 Manually-specified thumbnail image with explicit link to wiki page
7442 !! options
7443 php
7444 !! input
7445 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
7446 !! result
7447 <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>
7448
7449 !! end
7450
7451 !! test
7452 Manually-specified thumbnail image with explicit link to url
7453 !! options
7454 php
7455 !! input
7456 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
7457 !! result
7458 <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>
7459
7460 !! end
7461
7462 !! test
7463 Manually-specified thumbnail image with explicit no link
7464 !! options
7465 php
7466 !! input
7467 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
7468 !! result
7469 <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>
7470
7471 !! end
7472
7473 !! test
7474 Manually-specified thumbnail image with explicit link and alt text
7475 !! options
7476 php
7477 !! input
7478 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
7479 !! result
7480 <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>
7481
7482 !! end
7483
7484 !! test
7485 Image with frame and link
7486 !! input
7487 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
7488 !! result
7489 <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>
7490
7491 !! end
7492
7493 !! test
7494 Image with frame and link and explicit alt
7495 !! input
7496 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
7497 !! result
7498 <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>
7499
7500 !! end
7501
7502 !! test
7503 Image with wiki markup in implicit alt
7504 !! input
7505 [[Image:Foobar.jpg|testing '''bold''' in alt]]
7506 !! result
7507 <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>
7508 </p>
7509 !! end
7510
7511 !! test
7512 Image with wiki markup in explicit alt
7513 !! input
7514 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
7515 !! result
7516 <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>
7517 </p>
7518 !! end
7519
7520 !! test
7521 Link to image page- image page normally doesn't exists, hence edit link
7522 Add test with existing image page
7523 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
7524 !! input
7525 [[:Image:test]]
7526 !! result
7527 <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>
7528 </p>
7529 !! end
7530
7531 !! test
7532 bug 18784 Link to non-existent image page with caption should use caption as link text
7533 !! input
7534 [[:Image:test|caption]]
7535 !! result
7536 <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>
7537 </p>
7538 !! end
7539
7540 !! test
7541 Frameless image caption with a free URL
7542 !! input
7543 [[Image:foobar.jpg|http://example.com]]
7544 !! result
7545 <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>
7546 </p>
7547 !! end
7548
7549 !! test
7550 Thumbnail image caption with a free URL
7551 !! input
7552 [[Image:foobar.jpg|thumb|http://example.com]]
7553 !! result
7554 <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>
7555
7556 !! end
7557
7558 !! test
7559 Thumbnail image caption with a free URL and explicit alt
7560 !! input
7561 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
7562 !! result
7563 <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>
7564
7565 !! end
7566
7567 !! test
7568 BUG 1887: A ISBN with a thumbnail
7569 !! input
7570 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
7571 !! result
7572 <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>
7573
7574 !! end
7575
7576 !! test
7577 BUG 1887: A RFC with a thumbnail
7578 !! input
7579 [[Image:foobar.jpg|thumb|This is RFC 12354]]
7580 !! result
7581 <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>
7582
7583 !! end
7584
7585 !! test
7586 BUG 1887: A mailto link with a thumbnail
7587 !! input
7588 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
7589 !! result
7590 <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>
7591
7592 !! end
7593
7594 # Pending resolution to bug 368
7595 !! test
7596 BUG 648: Frameless image caption with a link
7597 !! input
7598 [[Image:foobar.jpg|text with a [[link]] in it]]
7599 !! result
7600 <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>
7601 </p>
7602 !! end
7603
7604 !! test
7605 BUG 648: Frameless image caption with a link (suffix)
7606 !! input
7607 [[Image:foobar.jpg|text with a [[link]]foo in it]]
7608 !! result
7609 <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>
7610 </p>
7611 !! end
7612
7613 !! test
7614 BUG 648: Frameless image caption with an interwiki link
7615 !! input
7616 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
7617 !! result
7618 <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>
7619 </p>
7620 !! end
7621
7622 !! test
7623 BUG 648: Frameless image caption with a piped interwiki link
7624 !! input
7625 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
7626 !! result
7627 <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>
7628 </p>
7629 !! end
7630
7631 !! test
7632 Escape HTML special chars in image alt text
7633 !! input
7634 [[Image:foobar.jpg|& < > "]]
7635 !! result
7636 <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>
7637 </p>
7638 !! end
7639
7640 !! test
7641 BUG 499: Alt text should have &#1234;, not &amp;1234;
7642 !! input
7643 [[Image:foobar.jpg|&#9792;]]
7644 !! result
7645 <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>
7646 </p>
7647 !! end
7648
7649 !! test
7650 Broken image caption with link
7651 !! input
7652 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
7653 !! result
7654 <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.
7655 </p>
7656 !! end
7657
7658 !! test
7659 Image caption containing another image
7660 !! input
7661 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
7662 !! result
7663 <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>
7664
7665 !! end
7666
7667 !! test
7668 Image caption containing a newline
7669 !! input
7670 [[Image:Foobar.jpg|This
7671 *is some text]]
7672 !! result
7673 <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>
7674 </p>
7675 !!end
7676
7677 !!test
7678 Parsoid: Image caption containing leading space
7679 (The leading space should not trigger nowiki escaping in wt2wt mode)
7680 !! input
7681 [[Image:Foobar.jpg|thumb| bar]]
7682 !! result
7683 <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>
7684
7685 !!end
7686
7687 !! test
7688 Bug 3090: External links other than http: in image captions
7689 !! input
7690 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
7691 !! result
7692 <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>
7693
7694 !! end
7695
7696 !! test
7697 Custom class
7698 !! input
7699 [[Image:foobar.jpg|a|class=b]]
7700 !! result
7701 <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>
7702 </p>
7703 !! end
7704
7705 !! test
7706 Localized image handling (1).
7707 !! options
7708 language=es
7709 !! input
7710 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
7711 !! result
7712 <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>
7713
7714 !! end
7715
7716 !! test
7717 Localized image handling (2).
7718 !! options
7719 language=es
7720 !! input
7721 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
7722 !! result
7723 <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>
7724
7725 !! end
7726
7727 !! test
7728 "border", "frameless" and "class" attributes on an image.
7729 !! input
7730 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
7731 !! result
7732 <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>
7733 </p>
7734 !! end
7735
7736 !! article
7737 File:Barfoo.jpg
7738 !! text
7739 #REDIRECT [[File:Barfoo.jpg]]
7740 !! endarticle
7741
7742 !! test
7743 Redirected image
7744 !! input
7745 [[Image:Barfoo.jpg]]
7746 !! result
7747 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
7748 </p>
7749 !! end
7750
7751 !! test
7752 Missing image with uploads disabled
7753 !! options
7754 wgEnableUploads=0
7755 !! input
7756 [[Image:Foobaz.jpg]]
7757 !! result
7758 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
7759 </p>
7760 !! end
7761
7762
7763 ###
7764 ### Subpages
7765 ###
7766 !! article
7767 Subpage test/subpage
7768 !! text
7769 foo
7770 !! endarticle
7771
7772 !! test
7773 Subpage link
7774 !! options
7775 subpage title=[[Subpage test]]
7776 !! input
7777 [[/subpage]]
7778 !! result
7779 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
7780 </p>
7781 !! end
7782
7783 !! test
7784 Subpage noslash link
7785 !! options
7786 subpage title=[[Subpage test]]
7787 !!input
7788 [[/subpage/]]
7789 !! result
7790 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
7791 </p>
7792 !! end
7793
7794 !! test
7795 Disabled subpages
7796 !! input
7797 [[/subpage]]
7798 !! result
7799 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
7800 </p>
7801 !! end
7802
7803 !! test
7804 BUG 561: {{/Subpage}}
7805 !! options
7806 subpage title=[[Page]]
7807 !! input
7808 {{/Subpage}}
7809 !! result
7810 <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>
7811 </p>
7812 !! end
7813
7814 ###
7815 ### Categories
7816 ###
7817 !! article
7818 Category:MediaWiki User's Guide
7819 !! text
7820 blah
7821 !! endarticle
7822
7823 !! test
7824 Link to category
7825 !! input
7826 [[:Category:MediaWiki User's Guide]]
7827 !! result
7828 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
7829 </p>
7830 !! end
7831
7832 !! test
7833 Simple category
7834 !! options
7835 cat
7836 !! input
7837 [[Category:MediaWiki User's Guide]]
7838 !! result
7839 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7840 !! end
7841
7842 !! test
7843 PAGESINCATEGORY invalid title fatal (r33546 fix)
7844 !! input
7845 {{PAGESINCATEGORY:<bogus>}}
7846 !! result
7847 <p>0
7848 </p>
7849 !! end
7850
7851 !! test
7852 Category with different sort key
7853 !! options
7854 cat
7855 !! input
7856 [[Category:MediaWiki User's Guide|Foo]]
7857 !! result
7858 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7859 !! end
7860
7861 !! test
7862 Category with identical sort key
7863 !! options
7864 cat
7865 !! input
7866 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7867 !! result
7868 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7869 !! end
7870
7871 !! test
7872 Category with empty sort key
7873 !! options
7874 cat
7875 pst
7876 !! input
7877 [[Category:MediaWiki User's Guide|]]
7878 !! result
7879 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7880 !! end
7881
7882 !! test
7883 Category with empty sort key and parentheses
7884 !! options
7885 cat
7886 pst
7887 !! input
7888 [[Category:Foo (bar)|]]
7889 !! result
7890 [[Category:Foo (bar)|Foo]]
7891 !! end
7892
7893 !! test
7894 Category with link tail
7895 !! options
7896 cat
7897 pst
7898 !! input
7899 123[[Category:Foo]]456
7900 !! result
7901 123[[Category:Foo]]456
7902 !! end
7903
7904 !! test
7905 Category with template
7906 !! options
7907 cat
7908 pst
7909 !! input
7910 [[Category:{{echo|Foo}}]]
7911 !! result
7912 [[Category:{{echo|Foo}}]]
7913 !! end
7914
7915 !! test
7916 Category with template in sort key
7917 !! options
7918 cat
7919 pst
7920 !! input
7921 [[Category:Foo|{{echo|Bar}}]]
7922 !! result
7923 [[Category:Foo|{{echo|Bar}}]]
7924 !! end
7925
7926 !! test
7927 Category with template in sort key and title
7928 !! options
7929 cat
7930 pst
7931 !! input
7932 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
7933 !! result
7934 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
7935 !! end
7936
7937 !! test
7938 Category / paragraph interactions
7939 !! input
7940 Foo [[Category:Baz]] Bar
7941
7942 Foo [[Category:Baz]]
7943 Bar
7944
7945 Foo
7946 [[Category:Baz]]
7947 Bar
7948
7949 Foo
7950 [[Category:Baz]] Bar
7951
7952 Foo
7953 [[Category:Baz]]
7954 [[Category:Baz]]
7955 [[Category:Baz]]
7956 Bar
7957
7958 [[Category:Baz]]
7959 [[Category:Baz]]
7960 [[Category:Baz]]
7961
7962 [[Category:Baz]]
7963 {{echo|[[Category:Baz]]}}
7964 [[Category:Baz]]
7965 !! result
7966 <p>Foo Bar
7967 </p><p>Foo
7968 Bar
7969 </p><p>Foo
7970 Bar
7971 </p><p>Foo Bar
7972 </p><p>Foo
7973 Bar
7974 </p>
7975 !! end
7976
7977 ###
7978 ### Inter-language links
7979 ###
7980 !! test
7981 Inter-language links
7982 !! options
7983 ill
7984 !! input
7985 [[es:Alimento]]
7986 [[fr:Nourriture]]
7987 [[zh:&#39135;&#21697;]]
7988 !! result
7989 es:Alimento fr:Nourriture zh:食品
7990 !! end
7991
7992 !! test
7993 Duplicate interlanguage links (bug 24502)
7994 !! options
7995 ill
7996 !! input
7997 [[es:1]]
7998 [[es:2]]
7999 [[fr:1]]
8000 [[fr:2]]
8001 !! result
8002 es:1 fr:1
8003 !! end
8004
8005 ###
8006 ### Sections
8007 ###
8008 !! test
8009 Basic section headings
8010 !! input
8011 == Headline 1 ==
8012 Some text
8013
8014 ==Headline 2==
8015 More
8016 ===Smaller headline===
8017 Blah blah
8018 !! result
8019 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span> <span class="mw-headline" id="Headline_1">Headline 1</span></h2>
8020 <p>Some text
8021 </p>
8022 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline 2">edit</a>]</span> <span class="mw-headline" id="Headline_2">Headline 2</span></h2>
8023 <p>More
8024 </p>
8025 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Smaller headline">edit</a>]</span> <span class="mw-headline" id="Smaller_headline">Smaller headline</span></h3>
8026 <p>Blah blah
8027 </p>
8028 !! end
8029
8030 !! test
8031 Section headings with TOC
8032 !! input
8033 == Headline 1 ==
8034 === Subheadline 1 ===
8035 ===== Skipping a level =====
8036 ====== Skipping a level ======
8037
8038 == Headline 2 ==
8039 Some text
8040 ===Another headline===
8041 !! result
8042 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8043 <ul>
8044 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
8045 <ul>
8046 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
8047 <ul>
8048 <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>
8049 <ul>
8050 <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>
8051 </ul>
8052 </li>
8053 </ul>
8054 </li>
8055 </ul>
8056 </li>
8057 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
8058 <ul>
8059 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
8060 </ul>
8061 </li>
8062 </ul>
8063 </td></tr></table>
8064 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span> <span class="mw-headline" id="Headline_1">Headline 1</span></h2>
8065 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a>]</span> <span class="mw-headline" id="Subheadline_1">Subheadline 1</span></h3>
8066 <h5><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a>]</span> <span class="mw-headline" id="Skipping_a_level">Skipping a level</span></h5>
8067 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Skipping a level">edit</a>]</span> <span class="mw-headline" id="Skipping_a_level_2">Skipping a level</span></h6>
8068 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a>]</span> <span class="mw-headline" id="Headline_2">Headline 2</span></h2>
8069 <p>Some text
8070 </p>
8071 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Another headline">edit</a>]</span> <span class="mw-headline" id="Another_headline">Another headline</span></h3>
8072
8073 !! end
8074
8075 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
8076 !! test
8077 Handling of sections up to level 6 and beyond
8078 !! input
8079 = Level 1 Heading=
8080 == Level 2 Heading==
8081 === Level 3 Heading===
8082 ==== Level 4 Heading====
8083 ===== Level 5 Heading=====
8084 ====== Level 6 Heading======
8085 ======= Level 7 Heading=======
8086 ======== Level 8 Heading========
8087 ========= Level 9 Heading=========
8088 ========== Level 10 Heading==========
8089 !! result
8090 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8091 <ul>
8092 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
8093 <ul>
8094 <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>
8095 <ul>
8096 <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>
8097 <ul>
8098 <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>
8099 <ul>
8100 <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>
8101 <ul>
8102 <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>
8103 <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>
8104 <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>
8105 <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>
8106 <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>
8107 </ul>
8108 </li>
8109 </ul>
8110 </li>
8111 </ul>
8112 </li>
8113 </ul>
8114 </li>
8115 </ul>
8116 </li>
8117 </ul>
8118 </td></tr></table>
8119 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a>]</span> <span class="mw-headline" id="Level_1_Heading">Level 1 Heading</span></h1>
8120 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a>]</span> <span class="mw-headline" id="Level_2_Heading">Level 2 Heading</span></h2>
8121 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a>]</span> <span class="mw-headline" id="Level_3_Heading">Level 3 Heading</span></h3>
8122 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a>]</span> <span class="mw-headline" id="Level_4_Heading">Level 4 Heading</span></h4>
8123 <h5><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a>]</span> <span class="mw-headline" id="Level_5_Heading">Level 5 Heading</span></h5>
8124 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a>]</span> <span class="mw-headline" id="Level_6_Heading">Level 6 Heading</span></h6>
8125 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: = Level 7 Heading=">edit</a>]</span> <span class="mw-headline" id=".3D_Level_7_Heading.3D">= Level 7 Heading=</span></h6>
8126 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: == Level 8 Heading==">edit</a>]</span> <span class="mw-headline" id=".3D.3D_Level_8_Heading.3D.3D">== Level 8 Heading==</span></h6>
8127 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: === Level 9 Heading===">edit</a>]</span> <span class="mw-headline" id=".3D.3D.3D_Level_9_Heading.3D.3D.3D">=== Level 9 Heading===</span></h6>
8128 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ==== Level 10 Heading====">edit</a>]</span> <span class="mw-headline" id=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D">==== Level 10 Heading====</span></h6>
8129
8130 !! end
8131
8132 !! test
8133 TOC regression (bug 9764)
8134 !! input
8135 == title 1 ==
8136 === title 1.1 ===
8137 ==== title 1.1.1 ====
8138 === title 1.2 ===
8139 == title 2 ==
8140 === title 2.1 ===
8141 !! result
8142 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8143 <ul>
8144 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8145 <ul>
8146 <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>
8147 <ul>
8148 <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>
8149 </ul>
8150 </li>
8151 <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>
8152 </ul>
8153 </li>
8154 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8155 <ul>
8156 <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>
8157 </ul>
8158 </li>
8159 </ul>
8160 </td></tr></table>
8161 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline" id="title_1">title 1</span></h2>
8162 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1">title 1.1</span></h3>
8163 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1.1">title 1.1.1</span></h4>
8164 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span> <span class="mw-headline" id="title_1.2">title 1.2</span></h3>
8165 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline" id="title_2">title 2</span></h2>
8166 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span> <span class="mw-headline" id="title_2.1">title 2.1</span></h3>
8167
8168 !! end
8169
8170 !! test
8171 TOC with wgMaxTocLevel=3 (bug 6204)
8172 !! options
8173 wgMaxTocLevel=3
8174 !! input
8175 == title 1 ==
8176 === title 1.1 ===
8177 ==== title 1.1.1 ====
8178 === title 1.2 ===
8179 == title 2 ==
8180 === title 2.1 ===
8181 !! result
8182 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8183 <ul>
8184 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8185 <ul>
8186 <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>
8187 <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>
8188 </ul>
8189 </li>
8190 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8191 <ul>
8192 <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>
8193 </ul>
8194 </li>
8195 </ul>
8196 </td></tr></table>
8197 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline" id="title_1">title 1</span></h2>
8198 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1">title 1.1</span></h3>
8199 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1.1">title 1.1.1</span></h4>
8200 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span> <span class="mw-headline" id="title_1.2">title 1.2</span></h3>
8201 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline" id="title_2">title 2</span></h2>
8202 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span> <span class="mw-headline" id="title_2.1">title 2.1</span></h3>
8203
8204 !! end
8205
8206 !! test
8207 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
8208 !! options
8209 wgMaxTocLevel=3
8210 !! input
8211 ==Section 1==
8212 ===Section 1.1===
8213 ====Section 1.1.1====
8214 ====Section 1.1.1.1====
8215 ==Section 2==
8216 !! result
8217 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8218 <ul>
8219 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
8220 <ul>
8221 <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>
8222 </ul>
8223 </li>
8224 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
8225 </ul>
8226 </td></tr></table>
8227 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a>]</span> <span class="mw-headline" id="Section_1">Section 1</span></h2>
8228 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 1.1">edit</a>]</span> <span class="mw-headline" id="Section_1.1">Section 1.1</span></h3>
8229 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Section 1.1.1">edit</a>]</span> <span class="mw-headline" id="Section_1.1.1">Section 1.1.1</span></h4>
8230 <h4><span class="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> <span class="mw-headline" id="Section_1.1.1.1">Section 1.1.1.1</span></h4>
8231 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Section 2">edit</a>]</span> <span class="mw-headline" id="Section_2">Section 2</span></h2>
8232
8233 !! end
8234
8235
8236 !! test
8237 Resolving duplicate section names
8238 !! input
8239 == Foo bar ==
8240 == Foo bar ==
8241 !! result
8242 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline" id="Foo_bar">Foo bar</span></h2>
8243 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline" id="Foo_bar_2">Foo bar</span></h2>
8244
8245 !! end
8246
8247 !! test
8248 Resolving duplicate section names with differing case (bug 10721)
8249 !! input
8250 == Foo bar ==
8251 == Foo Bar ==
8252 !! result
8253 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline" id="Foo_bar">Foo bar</span></h2>
8254 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a>]</span> <span class="mw-headline" id="Foo_Bar_2">Foo Bar</span></h2>
8255
8256 !! end
8257
8258 !! article
8259 Template:sections
8260 !! text
8261 ===Section 1===
8262 ==Section 2==
8263 !! endarticle
8264
8265 !! test
8266 Template with sections, __NOTOC__
8267 !! input
8268 __NOTOC__
8269 ==Section 0==
8270 {{sections}}
8271 ==Section 4==
8272 !! result
8273 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 0">edit</a>]</span> <span class="mw-headline" id="Section_0">Section 0</span></h2>
8274 <h3><span class="editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-1" title="Template:Sections">edit</a>]</span> <span class="mw-headline" id="Section_1">Section 1</span></h3>
8275 <h2><span class="editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-2" title="Template:Sections">edit</a>]</span> <span class="mw-headline" id="Section_2">Section 2</span></h2>
8276 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 4">edit</a>]</span> <span class="mw-headline" id="Section_4">Section 4</span></h2>
8277
8278 !! end
8279
8280 !! test
8281 __NOEDITSECTION__ keyword
8282 !! input
8283 __NOEDITSECTION__
8284 ==Section 1==
8285 ==Section 2==
8286 !! result
8287 <h2> <span class="mw-headline" id="Section_1">Section 1</span></h2>
8288 <h2> <span class="mw-headline" id="Section_2">Section 2</span></h2>
8289
8290 !! end
8291
8292 !! test
8293 Link inside a section heading
8294 !! input
8295 ==Section with a [[Main Page|link]] in it==
8296 !! result
8297 <h2><span class="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> <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></h2>
8298
8299 !! end
8300
8301 !! test
8302 TOC regression (bug 12077)
8303 !! input
8304 __TOC__
8305 == title 1 ==
8306 === title 1.1 ===
8307 == title 2 ==
8308 !! result
8309 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8310 <ul>
8311 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8312 <ul>
8313 <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>
8314 </ul>
8315 </li>
8316 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
8317 </ul>
8318 </td></tr></table>
8319 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline" id="title_1">title 1</span></h2>
8320 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1">title 1.1</span></h3>
8321 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline" id="title_2">title 2</span></h2>
8322
8323 !! end
8324
8325 !! test
8326 BUG 1219 URL next to image (good)
8327 !! input
8328 http://example.com [[Image:foobar.jpg]]
8329 !! result
8330 <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>
8331 </p>
8332 !!end
8333
8334 !! test
8335 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
8336 !! input
8337 ===
8338 The line above must have a trailing space!
8339 === <!--
8340 --> <!-- -->
8341 But just in case it doesn't...
8342 !! result
8343 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: =">edit</a>]</span> <span class="mw-headline" id=".3D">=</span></h1>
8344 <p>The line above must have a trailing space!
8345 </p>
8346 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =">edit</a>]</span> <span class="mw-headline" id=".3D_2">=</span></h1>
8347 <p>But just in case it doesn't...
8348 </p>
8349 !! end
8350
8351 !! test
8352 Header with special characters (bug 25462)
8353 !! input
8354 The tooltips shall not show entities to the user (ie. be double escaped)
8355
8356 == text > text ==
8357 section 1
8358
8359 == text < text ==
8360 section 2
8361
8362 == text & text ==
8363 section 3
8364
8365 == text ' text ==
8366 section 4
8367
8368 == text " text ==
8369 section 5
8370 !! result
8371 <p>The tooltips shall not show entities to the user (ie. be double escaped)
8372 </p>
8373 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8374 <ul>
8375 <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>
8376 <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>
8377 <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>
8378 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
8379 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
8380 </ul>
8381 </td></tr></table>
8382 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: text > text">edit</a>]</span> <span class="mw-headline" id="text_.3E_text">text &gt; text</span></h2>
8383 <p>section 1
8384 </p>
8385 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: text &lt; text">edit</a>]</span> <span class="mw-headline" id="text_.3C_text">text &lt; text</span></h2>
8386 <p>section 2
8387 </p>
8388 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: text &amp; text">edit</a>]</span> <span class="mw-headline" id="text_.26_text">text &amp; text</span></h2>
8389 <p>section 3
8390 </p>
8391 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: text ' text">edit</a>]</span> <span class="mw-headline" id="text_.27_text">text ' text</span></h2>
8392 <p>section 4
8393 </p>
8394 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: text &quot; text">edit</a>]</span> <span class="mw-headline" id="text_.22_text">text " text</span></h2>
8395 <p>section 5
8396 </p>
8397 !! end
8398
8399 !! test
8400 Headers with excess '=' characters
8401 (Are similar tests necessary beyond the 1st level?)
8402 !! input
8403 =foo==
8404 ==foo=
8405 =''italic'' heading==
8406 ==''italic'' heading=
8407 !! result
8408 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8409 <ul>
8410 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
8411 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
8412 <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>
8413 <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>
8414 </ul>
8415 </td></tr></table>
8416 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: foo=">edit</a>]</span> <span class="mw-headline" id="foo.3D">foo=</span></h1>
8417 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =foo">edit</a>]</span> <span class="mw-headline" id=".3Dfoo">=foo</span></h1>
8418 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: italic heading=">edit</a>]</span> <span class="mw-headline" id="italic_heading.3D"><i>italic</i> heading=</span></h1>
8419 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: =italic heading">edit</a>]</span> <span class="mw-headline" id=".3Ditalic_heading">=<i>italic</i> heading</span></h1>
8420
8421 !! end
8422
8423 !! test
8424 HTML headers vs TOC (bug 23393)
8425 (__NOEDITSECTION__ for clearer output, doesn't matter here)
8426 !! input
8427 <h1>Header 1</h1>
8428 == Header 1.1 ==
8429 == Header 1.2 ==
8430
8431 <h1>Header 2
8432 </h1>
8433 == Header 2.1 ==
8434 == Header 2.2 ==
8435 __NOEDITSECTION__
8436 !! result
8437 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8438 <ul>
8439 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
8440 <ul>
8441 <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>
8442 <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>
8443 </ul>
8444 </li>
8445 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
8446 <ul>
8447 <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>
8448 <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>
8449 </ul>
8450 </li>
8451 </ul>
8452 </td></tr></table>
8453 <h1> <span class="mw-headline" id="Header_1">Header 1</span></h1>
8454 <h2> <span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
8455 <h2> <span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
8456 <h1> <span class="mw-headline" id="Header_2">Header 2</span></h1>
8457 <h2> <span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
8458 <h2> <span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
8459
8460 !! end
8461
8462 !! test
8463 BUG 1219 URL next to image (broken)
8464 !! input
8465 http://example.com[[Image:foobar.jpg]]
8466 !! result
8467 <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>
8468 </p>
8469 !!end
8470
8471 !! test
8472 Bug 1186 news: in the middle of text
8473 !! input
8474 http://en.wikinews.org/wiki/Wikinews:Workplace
8475 !! result
8476 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
8477 </p>
8478 !!end
8479
8480
8481 !! test
8482 Namespaced link must have a title
8483 !! input
8484 [[Project:]]
8485 !! result
8486 <p>[[Project:]]
8487 </p>
8488 !!end
8489
8490 !! test
8491 Namespaced link must have a title (bad fragment version)
8492 !! input
8493 [[Project:#fragment]]
8494 !! result
8495 <p>[[Project:#fragment]]
8496 </p>
8497 !!end
8498
8499
8500 ###
8501 ### HTML tags and HTML attributes
8502 ###
8503
8504 !! test
8505 div with no attributes
8506 !! input
8507 <div>HTML rocks</div>
8508 !! result
8509 <div>HTML rocks</div>
8510
8511 !! end
8512
8513 !! test
8514 div with double-quoted attribute
8515 !! input
8516 <div id="rock">HTML rocks</div>
8517 !! result
8518 <div id="rock">HTML rocks</div>
8519
8520 !! end
8521
8522 !! test
8523 div with single-quoted attribute
8524 !! input
8525 <div id='rock'>HTML rocks</div>
8526 !! result
8527 <div id="rock">HTML rocks</div>
8528
8529 !! end
8530
8531 !! test
8532 div with unquoted attribute
8533 !! input
8534 <div id=rock>HTML rocks</div>
8535 !! result
8536 <div id="rock">HTML rocks</div>
8537
8538 !! end
8539
8540 !! test
8541 div with illegal double attributes
8542 !! input
8543 <div id="a" id="b">HTML rocks</div>
8544 !! result
8545 <div id="b">HTML rocks</div>
8546
8547 !!end
8548
8549 # FIXME: produce empty string instead of "class" in the PHP parser, following
8550 # the HTML5 spec.
8551 !! test
8552 div with empty attribute value, space before equals
8553 !! options
8554 disabled
8555 !! input
8556 <div class =>HTML rocks</div>
8557 !! result
8558 <div class="">HTML rocks</div>
8559
8560 !! end
8561
8562 # The PHP parser escapes the opening brace to &#123; for some reason, so
8563 # disabled this test for it.
8564 !! test
8565 div with braces in attribute value
8566 !! options
8567 disabled
8568 !! input
8569 <div title="{}">Foo</div>
8570 !! result
8571 <div title="{}">Foo</div>
8572 !! end
8573
8574 # This it very inconsistent in the PHP parser: it returns
8575 # class="class" if there is a space between the name and the equal sign (see
8576 # 'div with empty attribute value, space before equals'), but strips the
8577 # attribute completely if the space is missing. We hope that not much content
8578 # depends on this, so are implementing the behavior below in Parsoid for
8579 # consistencies' sake. Disabled for the PHP parser.
8580 # FIXME: fix this behavior in the PHP parser?
8581 !! test
8582 div with empty attribute value, no space before equals
8583 !! options
8584 disabled
8585 !! input
8586 <div class=>HTML rocks</div>
8587 !! result
8588 <div class="">HTML rocks</div>
8589
8590 !! end
8591
8592 !! test
8593 HTML multiple attributes correction
8594 !! input
8595 <p class="error" class="awesome">Awesome!</p>
8596 !! result
8597 <p class="awesome">Awesome!</p>
8598
8599 !!end
8600
8601 !! test
8602 Table multiple attributes correction
8603 !! input
8604 {|
8605 !+ class="error" class="awesome"| status
8606 |}
8607 !! result
8608 <table>
8609 <tr>
8610 <th class="awesome"> status
8611 </th></tr></table>
8612
8613 !!end
8614
8615 !! test
8616 DIV IN UPPERCASE
8617 !! input
8618 <DIV ID="x">HTML ROCKS</DIV>
8619 !! result
8620 <div id="x">HTML ROCKS</div>
8621
8622 !!end
8623
8624 !! test
8625 Non-ASCII pseudo-tags are rendered as text
8626 !! input
8627 <khyô>
8628 !! result
8629 <p>&lt;khyô&gt;
8630 </p>
8631 !! end
8632
8633 !! test
8634 Pseudo-tag with URL 'name' renders as url link
8635 !! input
8636 <http://example.com/>
8637 !! result
8638 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
8639 </p>
8640 !! end
8641
8642 !! test
8643 text with amp in the middle of nowhere
8644 !! input
8645 Remember AT&T?
8646 !!result
8647 <p>Remember AT&amp;T?
8648 </p>
8649 !! end
8650
8651 !! test
8652 text with character entity: eacute
8653 !! input
8654 I always thought &eacute; was a cute letter.
8655 !! result
8656 <p>I always thought &#233; was a cute letter.
8657 </p>
8658 !! end
8659
8660 !! test
8661 text with entity-escaped character entity-like string: eacute
8662 !! input
8663 I always thought &amp;eacute; was a cute letter.
8664 !! result
8665 <p>I always thought &amp;eacute; was a cute letter.
8666 </p>
8667 !! end
8668
8669 !! test
8670 text with undefined character entity: xacute
8671 !! input
8672 I always thought &xacute; was a cute letter.
8673 !! result
8674 <p>I always thought &amp;xacute; was a cute letter.
8675 </p>
8676 !! end
8677
8678
8679 ###
8680 ### Media links
8681 ###
8682
8683 !! test
8684 Media link
8685 !! input
8686 [[Media:Foobar.jpg]]
8687 !! result
8688 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
8689 </p>
8690 !! end
8691
8692 !! test
8693 Media link with text
8694 !! input
8695 [[Media:Foobar.jpg|A neat file to look at]]
8696 !! result
8697 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
8698 </p>
8699 !! end
8700
8701 # FIXME: this is still bad HTML tag nesting
8702 !! test
8703 Media link with nasty text
8704 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
8705 !! input
8706 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
8707 !! result
8708 <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>
8709
8710 !! end
8711
8712 !! test
8713 Media link to nonexistent file (bug 1702)
8714 !! input
8715 [[Media:No such.jpg]]
8716 !! result
8717 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
8718 </p>
8719 !! end
8720
8721 !! test
8722 Image link to nonexistent file (bug 1850 - good)
8723 !! input
8724 [[Image:No such.jpg]]
8725 !! result
8726 <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>
8727 </p>
8728 !! end
8729
8730 !! test
8731 :Image link to nonexistent file (bug 1850 - bad)
8732 !! input
8733 [[:Image:No such.jpg]]
8734 !! result
8735 <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>
8736 </p>
8737 !! end
8738
8739
8740
8741 !! test
8742 Character reference normalization in link text (bug 1938)
8743 !! input
8744 [[Main Page|this&that]]
8745 !! result
8746 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
8747 </p>
8748 !!end
8749
8750 !! article
8751 אַ
8752 !! text
8753 Test for unicode normalization
8754
8755 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
8756 !! endarticle
8757
8758 !! test
8759 (bug 19451) Links should refer to the normalized form.
8760 !! input
8761 [[&#xFB2E;]]
8762 [[&#x5d0;&#x5b7;]]
8763 [[&#x5d0;ַ]]
8764 [[א&#x5b7;]]
8765 [[אַ]]
8766 !! result
8767 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
8768 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
8769 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
8770 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
8771 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
8772 </p>
8773 !! end
8774
8775 !! test
8776 Empty attribute crash test (bug 2067)
8777 !! input
8778 <font color="">foo</font>
8779 !! result
8780 <p><font color="">foo</font>
8781 </p>
8782 !! end
8783
8784 !! test
8785 Empty attribute crash test single-quotes (bug 2067)
8786 !! input
8787 <font color=''>foo</font>
8788 !! result
8789 <p><font color="">foo</font>
8790 </p>
8791 !! end
8792
8793 !! test
8794 Attribute test: equals, then nothing
8795 !! input
8796 <font color=>foo</font>
8797 !! result
8798 <p><font>foo</font>
8799 </p>
8800 !! end
8801
8802 !! test
8803 Attribute test: unquoted value
8804 !! input
8805 <font color=x>foo</font>
8806 !! result
8807 <p><font color="x">foo</font>
8808 </p>
8809 !! end
8810
8811 !! test
8812 Attribute test: unquoted but illegal value (hash)
8813 !! input
8814 <font color=#x>foo</font>
8815 !! result
8816 <p><font color="#x">foo</font>
8817 </p>
8818 !! end
8819
8820 !! test
8821 Attribute test: no value
8822 !! input
8823 <font color>foo</font>
8824 !! result
8825 <p><font color="color">foo</font>
8826 </p>
8827 !! end
8828
8829 !! test
8830 Bug 2095: link with three closing brackets
8831 !! input
8832 [[Main Page]]]
8833 !! result
8834 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
8835 </p>
8836 !! end
8837
8838 !! test
8839 Bug 2095: link with pipe and three closing brackets
8840 !! input
8841 [[Main Page|link]]]
8842 !! result
8843 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
8844 </p>
8845 !! end
8846
8847 !! test
8848 Bug 2095: link with pipe and three closing brackets, version 2
8849 !! input
8850 [[Main Page|[http://example.com/]]]
8851 !! result
8852 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
8853 </p>
8854 !! end
8855
8856
8857 ###
8858 ### Safety
8859 ###
8860
8861 !! article
8862 Template:Dangerous attribute
8863 !! text
8864 " onmouseover="alert(document.cookie)
8865 !! endarticle
8866
8867 !! article
8868 Template:Dangerous style attribute
8869 !! text
8870 border-size: expression(alert(document.cookie))
8871 !! endarticle
8872
8873 !! article
8874 Template:Div style
8875 !! text
8876 <div style="float: right; {{{1}}}">Magic div</div>
8877 !! endarticle
8878
8879 !! test
8880 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
8881 !! input
8882 <div title="{{test}}"></div>
8883 !! result
8884 <div title="This is a test template"></div>
8885
8886 !! end
8887
8888 !! test
8889 Bug 2304: HTML attribute safety (dangerous template; 2309)
8890 !! input
8891 <div title="{{dangerous attribute}}"></div>
8892 !! result
8893 <div title=""></div>
8894
8895 !! end
8896
8897 !! test
8898 Bug 2304: HTML attribute safety (dangerous style template; 2309)
8899 !! input
8900 <div style="{{dangerous style attribute}}"></div>
8901 !! result
8902 <div style="/* insecure input */"></div>
8903
8904 !! end
8905
8906 !! test
8907 Bug 2304: HTML attribute safety (safe parameter; 2309)
8908 !! input
8909 {{div style|width: 200px}}
8910 !! result
8911 <div style="float: right; width: 200px">Magic div</div>
8912
8913 !! end
8914
8915 !! test
8916 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
8917 !! input
8918 {{div style|width: expression(alert(document.cookie))}}
8919 !! result
8920 <div style="/* insecure input */">Magic div</div>
8921
8922 !! end
8923
8924 !! test
8925 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
8926 !! input
8927 {{div style|"><script>alert(document.cookie)</script>}}
8928 !! result
8929 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
8930
8931 !! end
8932
8933 !! test
8934 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
8935 !! input
8936 {{div style|" ><script>alert(document.cookie)</script>}}
8937 !! result
8938 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
8939
8940 !! end
8941
8942 !! test
8943 Bug 2304: HTML attribute safety (link)
8944 !! input
8945 <div title="[[Main Page]]"></div>
8946 !! result
8947 <div title="&#91;&#91;Main Page]]"></div>
8948
8949 !! end
8950
8951 !! test
8952 Bug 2304: HTML attribute safety (italics)
8953 !! input
8954 <div title="''foobar''"></div>
8955 !! result
8956 <div title="&#39;&#39;foobar&#39;&#39;"></div>
8957
8958 !! end
8959
8960 !! test
8961 Bug 2304: HTML attribute safety (bold)
8962 !! input
8963 <div title="'''foobar'''"></div>
8964 !! result
8965 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
8966
8967 !! end
8968
8969
8970 !! test
8971 Bug 2304: HTML attribute safety (ISBN)
8972 !! input
8973 <div title="ISBN 1234567890"></div>
8974 !! result
8975 <div title="&#73;SBN 1234567890"></div>
8976
8977 !! end
8978
8979 !! test
8980 Bug 2304: HTML attribute safety (RFC)
8981 !! input
8982 <div title="RFC 1234"></div>
8983 !! result
8984 <div title="&#82;FC 1234"></div>
8985
8986 !! end
8987
8988 !! test
8989 Bug 2304: HTML attribute safety (PMID)
8990 !! input
8991 <div title="PMID 1234567890"></div>
8992 !! result
8993 <div title="&#80;MID 1234567890"></div>
8994
8995 !! end
8996
8997 !! test
8998 Bug 2304: HTML attribute safety (web link)
8999 !! input
9000 <div title="http://example.com/"></div>
9001 !! result
9002 <div title="http&#58;//example.com/"></div>
9003
9004 !! end
9005
9006 !! test
9007 Bug 2304: HTML attribute safety (named web link)
9008 !! input
9009 <div title="[http://example.com/ link]"></div>
9010 !! result
9011 <div title="&#91;http&#58;//example.com/ link]"></div>
9012
9013 !! end
9014
9015 !! test
9016 Bug 3244: HTML attribute safety (extension; safe)
9017 !! input
9018 <div style="<nowiki>background:blue</nowiki>"></div>
9019 !! result
9020 <div style="background:blue"></div>
9021
9022 !! end
9023
9024 !! test
9025 Bug 3244: HTML attribute safety (extension; unsafe)
9026 !! input
9027 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
9028 !! result
9029 <div style="/* insecure input */"></div>
9030
9031 !! end
9032
9033 # More MSIE fun discovered by Tom Gilder
9034
9035 !! test
9036 MSIE CSS safety test: spurious slash
9037 !! input
9038 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
9039 !! result
9040 <div style="/* insecure input */">evil</div>
9041
9042 !! end
9043
9044 !! test
9045 MSIE CSS safety test: hex code
9046 !! input
9047 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
9048 !! result
9049 <div style="/* insecure input */">evil</div>
9050
9051 !! end
9052
9053 !! test
9054 MSIE CSS safety test: comment in url
9055 !! input
9056 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
9057 !! result
9058 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
9059
9060 !! end
9061
9062 !! test
9063 MSIE CSS safety test: comment in expression
9064 !! input
9065 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
9066 !! result
9067 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
9068
9069 !! end
9070
9071
9072 !! test
9073 Table attribute legitimate extension
9074 !! input
9075 {|
9076 !+ style="<nowiki>color:blue</nowiki>"| status
9077 |}
9078 !! result
9079 <table>
9080 <tr>
9081 <th style="color:blue"> status
9082 </th></tr></table>
9083
9084 !!end
9085
9086 !! test
9087 Table attribute safety
9088 !! input
9089 {|
9090 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
9091 |}
9092 !! result
9093 <table>
9094 <tr>
9095 <th style="/* insecure input */"> status
9096 </th></tr></table>
9097
9098 !! end
9099
9100 !! test
9101 CSS line continuation 1
9102 !! input
9103 <div style="background-image: u\&#10;rl(test.jpg);"></div>
9104 !! result
9105 <div style="/* insecure input */"></div>
9106
9107 !! end
9108
9109 !! test
9110 CSS line continuation 2
9111 !! input
9112 <div style="background-image: u\&#13;rl(test.jpg); "></div>
9113 !! result
9114 <div style="/* insecure input */"></div>
9115
9116 !! end
9117
9118 !! article
9119 Template:Identity
9120 !! text
9121 {{{1}}}
9122 !! endarticle
9123
9124 !! test
9125 Expansion of multi-line templates in attribute values (bug 6255)
9126 !! input
9127 <div style="background: {{identity|#00FF00}}">-</div>
9128 !! result
9129 <div style="background: #00FF00">-</div>
9130
9131 !! end
9132
9133
9134 !! test
9135 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
9136 !! input
9137 <div style="background:
9138 #00FF00">-</div>
9139 !! result
9140 <div style="background: #00FF00">-</div>
9141
9142 !! end
9143
9144 !! test
9145 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
9146 !! input
9147 <div style="background: &#10;#00FF00">-</div>
9148 !! result
9149 <div style="background: &#10;#00FF00">-</div>
9150
9151 !! end
9152
9153 ###
9154 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
9155 ###
9156 !! test
9157 Parser hook: empty input
9158 !! input
9159 <tag></tag>
9160 !! result
9161 <pre>
9162 ''
9163 array (
9164 )
9165 </pre>
9166
9167 !! end
9168
9169 !! test
9170 Parser hook: empty input using terminated empty elements
9171 !! input
9172 <tag/>
9173 !! result
9174 <pre>
9175 NULL
9176 array (
9177 )
9178 </pre>
9179
9180 !! end
9181
9182 !! test
9183 Parser hook: empty input using terminated empty elements (space before)
9184 !! input
9185 <tag />
9186 !! result
9187 <pre>
9188 NULL
9189 array (
9190 )
9191 </pre>
9192
9193 !! end
9194
9195 !! test
9196 Parser hook: basic input
9197 !! input
9198 <tag>input</tag>
9199 !! result
9200 <pre>
9201 'input'
9202 array (
9203 )
9204 </pre>
9205
9206 !! end
9207
9208
9209 !! test
9210 Parser hook: case insensitive
9211 !! input
9212 <TAG>input</TAG>
9213 !! result
9214 <pre>
9215 'input'
9216 array (
9217 )
9218 </pre>
9219
9220 !! end
9221
9222
9223 !! test
9224 Parser hook: case insensitive, redux
9225 !! input
9226 <TaG>input</TAg>
9227 !! result
9228 <pre>
9229 'input'
9230 array (
9231 )
9232 </pre>
9233
9234 !! end
9235
9236 !! test
9237 Parser hook: nested tags
9238 !! options
9239 noxml
9240 !! input
9241 <tag><tag></tag></tag>
9242 !! result
9243 <pre>
9244 '<tag>'
9245 array (
9246 )
9247 </pre>&lt;/tag&gt;
9248
9249 !! end
9250
9251 !! test
9252 Parser hook: basic arguments
9253 !! input
9254 <tag width=200 height = "100" depth = '50' square></tag>
9255 !! result
9256 <pre>
9257 ''
9258 array (
9259 'width' => '200',
9260 'height' => '100',
9261 'depth' => '50',
9262 'square' => 'square',
9263 )
9264 </pre>
9265
9266 !! end
9267
9268 !! test
9269 Parser hook: argument containing a forward slash (bug 5344)
9270 !! input
9271 <tag filename='/tmp/bla'></tag>
9272 !! result
9273 <pre>
9274 ''
9275 array (
9276 'filename' => '/tmp/bla',
9277 )
9278 </pre>
9279
9280 !! end
9281
9282 !! test
9283 Parser hook: empty input using terminated empty elements (bug 2374)
9284 !! input
9285 <tag foo=bar/>text
9286 !! result
9287 <pre>
9288 NULL
9289 array (
9290 'foo' => 'bar',
9291 )
9292 </pre>text
9293
9294 !! end
9295
9296 # </tag> should be output literally since there is no matching tag that begins it
9297 !! test
9298 Parser hook: basic arguments using terminated empty elements (bug 2374)
9299 !! input
9300 <tag width=200 height = "100" depth = '50' square/>
9301 other stuff
9302 </tag>
9303 !! result
9304 <pre>
9305 NULL
9306 array (
9307 'width' => '200',
9308 'height' => '100',
9309 'depth' => '50',
9310 'square' => 'square',
9311 )
9312 </pre>
9313 <p>other stuff
9314 &lt;/tag&gt;
9315 </p>
9316 !! end
9317
9318 ###
9319 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
9320 ###
9321
9322 !! test
9323 Parser hook: static parser hook not inside a comment
9324 !! input
9325 <statictag>hello, world</statictag>
9326 <statictag action=flush/>
9327 !! result
9328 <p>hello, world
9329 </p>
9330 !! end
9331
9332
9333 !! test
9334 Parser hook: static parser hook inside a comment
9335 !! input
9336 <!-- <statictag>hello, world</statictag> -->
9337 <statictag action=flush/>
9338 !! result
9339 <p><br />
9340 </p>
9341 !! end
9342
9343 # Nested template calls; this case was broken by Parser.php rev 1.506,
9344 # since reverted.
9345
9346 !! article
9347 Template:One-parameter
9348 !! text
9349 (My parameter is: {{{1}}})
9350 !! endarticle
9351
9352 !! article
9353 Template:Map-one-parameter
9354 !! text
9355 {{{{{1}}}|{{{2}}}}}
9356 !! endarticle
9357
9358 !! test
9359 Nested template calls
9360 !! input
9361 {{Map-one-parameter|One-parameter|param}}
9362 !! result
9363 <p>(My parameter is: param)
9364 </p>
9365 !! end
9366
9367
9368 ###
9369 ### Sanitizer
9370 ###
9371 !! test
9372 Sanitizer: Closing of open tags
9373 !! input
9374 <s></s><table></table>
9375 !! result
9376 <s></s><table></table>
9377
9378 !! end
9379
9380 !! test
9381 Sanitizer: Closing of open but not closed tags
9382 !! input
9383 <s>foo
9384 !! result
9385 <p><s>foo</s>
9386 </p>
9387 !! end
9388
9389 !! test
9390 Sanitizer: Closing of closed but not open tags
9391 !! input
9392 </s>
9393 !! result
9394 <p>&lt;/s&gt;
9395 </p>
9396 !! end
9397
9398 !! test
9399 Sanitizer: Closing of closed but not open table tags
9400 !! input
9401 Table not started</td></tr></table>
9402 !! result
9403 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
9404 </p>
9405 !! end
9406
9407 !! test
9408 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
9409 !! input
9410 <span id="æ: v">byte</span>[[#æ: v|backlink]]
9411 !! result
9412 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
9413 </p>
9414 !! end
9415
9416 !! test
9417 Sanitizer: Validating the contents of the id attribute (bug 4515)
9418 !! options
9419 disabled
9420 !! input
9421 <br id=9 />
9422 !! result
9423 Something, but definitely not <br id="9" />...
9424 !! end
9425
9426 !! test
9427 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
9428 !! options
9429 disabled
9430 !! input
9431 <br id="foo" /><br id="foo" />
9432 !! result
9433 Something need to be done. foo-2 ?
9434 !! end
9435
9436 !! test
9437 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
9438 !! input
9439 <div itemscope>
9440 <meta itemprop="hello" content="world">
9441 <meta http-equiv="refresh" content="5">
9442 <meta itemprop="hello" http-equiv="refresh" content="5">
9443 <link itemprop="hello" href="{{SERVER}}">
9444 <link rel="stylesheet" href="{{SERVER}}">
9445 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
9446 </div>
9447 !! result
9448 <div itemscope="itemscope">
9449 <p> <meta itemprop="hello" content="world" />
9450 &lt;meta http-equiv="refresh" content="5"&gt;
9451 <meta itemprop="hello" content="5" />
9452 </p>
9453 <link itemprop="hello" href="http&#58;//example.org" />
9454 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
9455 <link itemprop="hello" href="http&#58;//example.org" />
9456 </div>
9457
9458 !! end
9459
9460 !! test
9461 Language converter: output gets cut off unexpectedly (bug 5757)
9462 !! options
9463 language=zh
9464 !! input
9465 this bit is safe: }-
9466
9467 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
9468
9469 then we get cut off here: }-
9470
9471 all additional text is vanished
9472 !! result
9473 <p>this bit is safe: }-
9474 </p><p>but if we add a conversion instance: xxx
9475 </p><p>then we get cut off here: }-
9476 </p><p>all additional text is vanished
9477 </p>
9478 !! end
9479
9480 !! test
9481 Self closed html pairs (bug 5487)
9482 !! options
9483 !! input
9484 <center><font id="bug" />Centered text</center>
9485 <div><font id="bug2" />In div text</div>
9486 !! result
9487 <center>&lt;font id="bug" /&gt;Centered text</center>
9488 <div>&lt;font id="bug2" /&gt;In div text</div>
9489
9490 !! end
9491
9492 #
9493 #
9494 #
9495
9496 !! test
9497 Punctuation: nbsp before exclamation
9498 !! input
9499 C'est grave !
9500 !! result
9501 <p>C'est grave&#160;!
9502 </p>
9503 !! end
9504
9505 !! test
9506 Punctuation: CSS !important (bug 11874)
9507 !! input
9508 <div style="width:50% !important">important</div>
9509 !! result
9510 <div style="width:50% !important">important</div>
9511
9512 !!end
9513
9514 !! test
9515 Punctuation: CSS ! important (bug 11874; with space after)
9516 !! input
9517 <div style="width:50% ! important">important</div>
9518 !! result
9519 <div style="width:50% ! important">important</div>
9520
9521 !!end
9522
9523
9524 !! test
9525 HTML bullet list, closed tags (bug 5497)
9526 !! input
9527 <ul>
9528 <li>One</li>
9529 <li>Two</li>
9530 </ul>
9531 !! result
9532 <ul>
9533 <li>One</li>
9534 <li>Two</li>
9535 </ul>
9536
9537 !! end
9538
9539 !! test
9540 HTML bullet list, unclosed tags (bug 5497)
9541 !! options
9542 disabled
9543 !! input
9544 <ul>
9545 <li>One
9546 <li>Two
9547 </ul>
9548 !! result
9549 <ul>
9550 <li>One
9551 </li><li>Two
9552 </li></ul>
9553
9554 !! end
9555
9556 !! test
9557 HTML ordered list, closed tags (bug 5497)
9558 !! input
9559 <ol>
9560 <li>One</li>
9561 <li>Two</li>
9562 </ol>
9563 !! result
9564 <ol>
9565 <li>One</li>
9566 <li>Two</li>
9567 </ol>
9568
9569 !! end
9570
9571 !! test
9572 HTML ordered list, unclosed tags (bug 5497)
9573 !! options
9574 disabled
9575 !! input
9576 <ol>
9577 <li>One
9578 <li>Two
9579 </ol>
9580 !! result
9581 <ol>
9582 <li>One
9583 </li><li>Two
9584 </li></ol>
9585
9586 !! end
9587
9588 !! test
9589 HTML nested bullet list, closed tags (bug 5497)
9590 !! input
9591 <ul>
9592 <li>One</li>
9593 <li>Two:
9594 <ul>
9595 <li>Sub-one</li>
9596 <li>Sub-two</li>
9597 </ul>
9598 </li>
9599 </ul>
9600 !! result
9601 <ul>
9602 <li>One</li>
9603 <li>Two:
9604 <ul>
9605 <li>Sub-one</li>
9606 <li>Sub-two</li>
9607 </ul>
9608 </li>
9609 </ul>
9610
9611 !! end
9612
9613 !! test
9614 HTML nested bullet list, open tags (bug 5497)
9615 !! options
9616 disabled
9617 !! input
9618 <ul>
9619 <li>One
9620 <li>Two:
9621 <ul>
9622 <li>Sub-one
9623 <li>Sub-two
9624 </ul>
9625 </ul>
9626 !! result
9627 <ul>
9628 <li>One
9629 </li><li>Two:
9630 <ul>
9631 <li>Sub-one
9632 </li><li>Sub-two
9633 </li></ul>
9634 </li></ul>
9635
9636 !! end
9637
9638 !! test
9639 HTML nested ordered list, closed tags (bug 5497)
9640 !! input
9641 <ol>
9642 <li>One</li>
9643 <li>Two:
9644 <ol>
9645 <li>Sub-one</li>
9646 <li>Sub-two</li>
9647 </ol>
9648 </li>
9649 </ol>
9650 !! result
9651 <ol>
9652 <li>One</li>
9653 <li>Two:
9654 <ol>
9655 <li>Sub-one</li>
9656 <li>Sub-two</li>
9657 </ol>
9658 </li>
9659 </ol>
9660
9661 !! end
9662
9663 !! test
9664 HTML nested ordered list, open tags (bug 5497)
9665 !! options
9666 disabled
9667 !! input
9668 <ol>
9669 <li>One
9670 <li>Two:
9671 <ol>
9672 <li>Sub-one
9673 <li>Sub-two
9674 </ol>
9675 </ol>
9676 !! result
9677 <ol>
9678 <li>One
9679 </li><li>Two:
9680 <ol>
9681 <li>Sub-one
9682 </li><li>Sub-two
9683 </li></ol>
9684 </li></ol>
9685
9686 !! end
9687
9688 !! test
9689 HTML ordered list item with parameters oddity
9690 !! input
9691 <ol><li id="fragment">One</li></ol>
9692 !! result
9693 <ol><li id="fragment">One</li></ol>
9694
9695 !! end
9696
9697 !!test
9698 bug 5918: autonumbering
9699 !! input
9700 [http://first/] [http://second] [ftp://ftp]
9701
9702 ftp://inlineftp
9703
9704 [mailto:enclosed@mail.tld With target]
9705
9706 [mailto:enclosed@mail.tld]
9707
9708 mailto:inline@mail.tld
9709 !! result
9710 <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>
9711 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
9712 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
9713 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
9714 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
9715 </p>
9716 !! end
9717
9718
9719 #
9720 # Security and HTML correctness
9721 # From Nick Jenkins' fuzz testing
9722 #
9723
9724 !! test
9725 Fuzz testing: Parser13
9726 !! input
9727 {|
9728 | http://a|
9729 !! result
9730 <table>
9731 <tr>
9732 <td>
9733 </td>
9734 </tr>
9735 </table>
9736
9737 !! end
9738
9739 !! test
9740 Fuzz testing: Parser14
9741 !! input
9742 == onmouseover= ==
9743 http://__TOC__
9744 !! result
9745 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a>]</span> <span class="mw-headline" id="onmouseover.3D">onmouseover=</span></h2>
9746 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9747 <ul>
9748 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
9749 </ul>
9750 </td></tr></table>
9751
9752 !! end
9753
9754 !! test
9755 Fuzz testing: Parser14-table
9756 !! input
9757 ==a==
9758 {| STYLE=__TOC__
9759 !! result
9760 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a>]</span> <span class="mw-headline" id="a">a</span></h2>
9761 <table style="&#95;_TOC&#95;_">
9762 <tr><td></td></tr>
9763 </table>
9764
9765 !! end
9766
9767 # Known to produce bogus xml (extra </td>)
9768 !! test
9769 Fuzz testing: Parser16
9770 !! options
9771 noxml
9772 !! input
9773 {|
9774 !https://||||||
9775 !! result
9776 <table>
9777 <tr>
9778 <th>https://</th>
9779 <th></th>
9780 <th></th>
9781 <th>
9782 </td>
9783 </tr>
9784 </table>
9785
9786 !! end
9787
9788 !! test
9789 Fuzz testing: Parser21
9790 !! input
9791 {|
9792 ! irc://{{ftp://a" onmouseover="alert('hello world');"
9793 |
9794 !! result
9795 <table>
9796 <tr>
9797 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
9798 </th>
9799 <td>
9800 </td>
9801 </tr>
9802 </table>
9803
9804 !! end
9805
9806 !! test
9807 Fuzz testing: Parser22
9808 !! input
9809 http://===r:::https://b
9810
9811 {|
9812 !!result
9813 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
9814 </p>
9815 <table>
9816 <tr><td></td></tr>
9817 </table>
9818
9819 !! end
9820
9821 # Known to produce bad XML for now
9822 !! test
9823 Fuzz testing: Parser24
9824 !! options
9825 noxml
9826 !! input
9827 {|
9828 {{{|
9829 <u CLASS=
9830 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
9831 <br style="onmouseover='alert(document.cookie);' " />
9832
9833 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9834 |
9835 !! result
9836 <table>
9837 {{{|
9838 <u class="&#124;">}}}} &gt;
9839 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
9840
9841 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9842 <tr>
9843 <td></u>
9844 </td>
9845 </tr>
9846 </table>
9847
9848 !! end
9849
9850 # Note: the current result listed for this is not what the original one was,
9851 # but the original bug was JavaScript injection, which is fixed in any case.
9852 # It's not clear that the original result listed was any more correct than the
9853 # current one. Original result:
9854 # <p>{{{|
9855 # </p>
9856 # <li class="&#124;&#124;">
9857 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9858 !!test
9859 Fuzz testing: Parser25 (bug 6055)
9860 !! input
9861 {{{
9862 |
9863 <LI CLASS=||
9864 >
9865 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
9866 !! result
9867 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9868 </p>
9869 !! end
9870
9871 !!test
9872 Fuzz testing: URL adjacent extension (with space, clean)
9873 !! options
9874 !! input
9875 http://example.com <nowiki>junk</nowiki>
9876 !! result
9877 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
9878 </p>
9879 !!end
9880
9881 !!test
9882 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
9883 !! options
9884 !! input
9885 http://example.com<nowiki>junk</nowiki>
9886 !! result
9887 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
9888 </p>
9889 !!end
9890
9891 !!test
9892 Fuzz testing: URL adjacent extension (no space, dirty; pre)
9893 !! options
9894 !! input
9895 http://example.com<pre>junk</pre>
9896 !! result
9897 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
9898
9899 !!end
9900
9901 !!test
9902 Fuzz testing: image with bogus manual thumbnail
9903 !!input
9904 [[Image:foobar.jpg|thumbnail= ]]
9905 !!result
9906 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
9907
9908 !!end
9909
9910 !! test
9911 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
9912 !! input
9913 <pre dir="&#10;"></pre>
9914 !! result
9915 <pre dir="&#10;"></pre>
9916
9917 !! end
9918
9919 !! test
9920 Parsing optional HTML elements (Bug 6171)
9921 !! options
9922 !! input
9923 <table>
9924 <tr>
9925 <td> Some tabular data</td>
9926 <td> More tabular data ...
9927 <td> And yet som tabular data</td>
9928 </tr>
9929 </table>
9930 !! result
9931 <table>
9932 <tr>
9933 <td> Some tabular data</td>
9934 <td> More tabular data ...
9935 </td><td> And yet som tabular data</td>
9936 </tr>
9937 </table>
9938
9939 !! end
9940
9941 !! test
9942 Correct handling of <td>, <tr> (Bug 6171)
9943 !! options
9944 !! input
9945 <table>
9946 <tr>
9947 <td> Some tabular data</td>
9948 <td> More tabular data ...</td>
9949 <td> And yet som tabular data</td>
9950 </tr>
9951 </table>
9952 !! result
9953 <table>
9954 <tr>
9955 <td> Some tabular data</td>
9956 <td> More tabular data ...</td>
9957 <td> And yet som tabular data</td>
9958 </tr>
9959 </table>
9960
9961 !! end
9962
9963
9964 !! test
9965 Parsing crashing regression (fr:JavaScript)
9966 !! input
9967 </body></x>
9968 !! result
9969 <p>&lt;/body&gt;&lt;/x&gt;
9970 </p>
9971 !! end
9972
9973 !! test
9974 Inline wiki vs wiki block nesting
9975 !! input
9976 '''Bold paragraph
9977
9978 New wiki paragraph
9979 !! result
9980 <p><b>Bold paragraph</b>
9981 </p><p>New wiki paragraph
9982 </p>
9983 !! end
9984
9985 !! test
9986 Inline HTML vs wiki block nesting
9987 !! options
9988 disabled
9989 !! input
9990 <b>Bold paragraph
9991
9992 New wiki paragraph
9993 !! result
9994 <p><b>Bold paragraph</b>
9995 </p><p>New wiki paragraph
9996 </p>
9997 !! end
9998
9999 # Original result was this:
10000 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
10001 # </p>
10002 # While that might be marginally more intuitive, maybe, the six-apostrophe
10003 # construct is clearly pathological and the result stated here (which is what
10004 # the parser actually does) is about as reasonable as anything.
10005 !!test
10006 Mixing markup for italics and bold
10007 !! options
10008 !! input
10009 '''bold''''''bold''bolditalics'''''
10010 !! result
10011 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
10012 </p>
10013 !! end
10014
10015
10016 !! article
10017 Xyzzyx
10018 !! text
10019 Article for special page transclusion test
10020 !! endarticle
10021
10022 !! test
10023 Special page transclusion
10024 !! options
10025 !! input
10026 {{Special:Prefixindex/Xyzzyx}}
10027 !! result
10028 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10029
10030 !! end
10031
10032 !! test
10033 Special page transclusion twice (bug 5021)
10034 !! options
10035 !! input
10036 {{Special:Prefixindex/Xyzzyx}}
10037 {{Special:Prefixindex/Xyzzyx}}
10038 !! result
10039 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10040 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10041
10042 !! end
10043
10044 !! test
10045 Transclusion of default MediaWiki message
10046 !! input
10047 {{MediaWiki:Mainpage}}
10048 !!result
10049 <p>Main Page
10050 </p>
10051 !! end
10052
10053 !! test
10054 Transclusion of nonexistent MediaWiki message
10055 !! input
10056 {{MediaWiki:Mainpagexxx}}
10057 !!result
10058 <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>
10059 </p>
10060 !! end
10061
10062 !! test
10063 Transclusion of MediaWiki message with underscore
10064 !! input
10065 {{MediaWiki:history_short}}
10066 !! result
10067 <p>History
10068 </p>
10069 !! end
10070
10071 !! test
10072 Transclusion of MediaWiki message with space
10073 !! input
10074 {{MediaWiki:history short}}
10075 !! result
10076 <p>History
10077 </p>
10078 !! end
10079
10080 !! test
10081 Invalid header with following text
10082 !! input
10083 = x = y
10084 !! result
10085 <p>= x = y
10086 </p>
10087 !! end
10088
10089
10090 !! test
10091 Section extraction test (section 0)
10092 !! options
10093 section=0
10094 !! input
10095 start
10096 ==a==
10097 ===aa===
10098 ====aaa====
10099 ==b==
10100 ===ba===
10101 ===bb===
10102 ====bba====
10103 ===bc===
10104 ==c==
10105 ===ca===
10106 !! result
10107 start
10108 !! end
10109
10110 !! test
10111 Section extraction test (section 1)
10112 !! options
10113 section=1
10114 !! input
10115 start
10116 ==a==
10117 ===aa===
10118 ====aaa====
10119 ==b==
10120 ===ba===
10121 ===bb===
10122 ====bba====
10123 ===bc===
10124 ==c==
10125 ===ca===
10126 !! result
10127 ==a==
10128 ===aa===
10129 ====aaa====
10130 !! end
10131
10132 !! test
10133 Section extraction test (section 2)
10134 !! options
10135 section=2
10136 !! input
10137 start
10138 ==a==
10139 ===aa===
10140 ====aaa====
10141 ==b==
10142 ===ba===
10143 ===bb===
10144 ====bba====
10145 ===bc===
10146 ==c==
10147 ===ca===
10148 !! result
10149 ===aa===
10150 ====aaa====
10151 !! end
10152
10153 !! test
10154 Section extraction test (section 3)
10155 !! options
10156 section=3
10157 !! input
10158 start
10159 ==a==
10160 ===aa===
10161 ====aaa====
10162 ==b==
10163 ===ba===
10164 ===bb===
10165 ====bba====
10166 ===bc===
10167 ==c==
10168 ===ca===
10169 !! result
10170 ====aaa====
10171 !! end
10172
10173 !! test
10174 Section extraction test (section 4)
10175 !! options
10176 section=4
10177 !! input
10178 start
10179 ==a==
10180 ===aa===
10181 ====aaa====
10182 ==b==
10183 ===ba===
10184 ===bb===
10185 ====bba====
10186 ===bc===
10187 ==c==
10188 ===ca===
10189 !! result
10190 ==b==
10191 ===ba===
10192 ===bb===
10193 ====bba====
10194 ===bc===
10195 !! end
10196
10197 !! test
10198 Section extraction test (section 5)
10199 !! options
10200 section=5
10201 !! input
10202 start
10203 ==a==
10204 ===aa===
10205 ====aaa====
10206 ==b==
10207 ===ba===
10208 ===bb===
10209 ====bba====
10210 ===bc===
10211 ==c==
10212 ===ca===
10213 !! result
10214 ===ba===
10215 !! end
10216
10217 !! test
10218 Section extraction test (section 6)
10219 !! options
10220 section=6
10221 !! input
10222 start
10223 ==a==
10224 ===aa===
10225 ====aaa====
10226 ==b==
10227 ===ba===
10228 ===bb===
10229 ====bba====
10230 ===bc===
10231 ==c==
10232 ===ca===
10233 !! result
10234 ===bb===
10235 ====bba====
10236 !! end
10237
10238 !! test
10239 Section extraction test (section 7)
10240 !! options
10241 section=7
10242 !! input
10243 start
10244 ==a==
10245 ===aa===
10246 ====aaa====
10247 ==b==
10248 ===ba===
10249 ===bb===
10250 ====bba====
10251 ===bc===
10252 ==c==
10253 ===ca===
10254 !! result
10255 ====bba====
10256 !! end
10257
10258 !! test
10259 Section extraction test (section 8)
10260 !! options
10261 section=8
10262 !! input
10263 start
10264 ==a==
10265 ===aa===
10266 ====aaa====
10267 ==b==
10268 ===ba===
10269 ===bb===
10270 ====bba====
10271 ===bc===
10272 ==c==
10273 ===ca===
10274 !! result
10275 ===bc===
10276 !! end
10277
10278 !! test
10279 Section extraction test (section 9)
10280 !! options
10281 section=9
10282 !! input
10283 start
10284 ==a==
10285 ===aa===
10286 ====aaa====
10287 ==b==
10288 ===ba===
10289 ===bb===
10290 ====bba====
10291 ===bc===
10292 ==c==
10293 ===ca===
10294 !! result
10295 ==c==
10296 ===ca===
10297 !! end
10298
10299 !! test
10300 Section extraction test (section 10)
10301 !! options
10302 section=10
10303 !! input
10304 start
10305 ==a==
10306 ===aa===
10307 ====aaa====
10308 ==b==
10309 ===ba===
10310 ===bb===
10311 ====bba====
10312 ===bc===
10313 ==c==
10314 ===ca===
10315 !! result
10316 ===ca===
10317 !! end
10318
10319 !! test
10320 Section extraction test (nonexistent section 11)
10321 !! options
10322 section=11
10323 !! input
10324 start
10325 ==a==
10326 ===aa===
10327 ====aaa====
10328 ==b==
10329 ===ba===
10330 ===bb===
10331 ====bba====
10332 ===bc===
10333 ==c==
10334 ===ca===
10335 !! result
10336 !! end
10337
10338 !! test
10339 Section extraction test with bogus heading (section 1)
10340 !! options
10341 section=1
10342 !! input
10343 ==a==
10344 ==bogus== not a legal section
10345 ==b==
10346 !! result
10347 ==a==
10348 ==bogus== not a legal section
10349 !! end
10350
10351 !! test
10352 Section extraction test with bogus heading (section 2)
10353 !! options
10354 section=2
10355 !! input
10356 ==a==
10357 ==bogus== not a legal section
10358 ==b==
10359 !! result
10360 ==b==
10361 !! end
10362
10363 !! test
10364 Section extraction test with comment after heading (section 1)
10365 !! options
10366 section=1
10367 !! input
10368 ==a==
10369 ==b== <!-- -->
10370 ==c==
10371 !! result
10372 ==a==
10373 !! end
10374
10375 !! test
10376 Section extraction test with comment after heading (section 2)
10377 !! options
10378 section=2
10379 !! input
10380 ==a==
10381 ==b== <!-- -->
10382 ==c==
10383 !! result
10384 ==b== <!-- -->
10385 !! end
10386
10387 !! test
10388 Section extraction test with bogus <nowiki> heading (section 1)
10389 !! options
10390 section=1
10391 !! input
10392 ==a==
10393 ==bogus== <nowiki>not a legal section</nowiki>
10394 ==b==
10395 !! result
10396 ==a==
10397 ==bogus== <nowiki>not a legal section</nowiki>
10398 !! end
10399
10400 !! test
10401 Section extraction test with bogus <nowiki> heading (section 2)
10402 !! options
10403 section=2
10404 !! input
10405 ==a==
10406 ==bogus== <nowiki>not a legal section</nowiki>
10407 ==b==
10408 !! result
10409 ==b==
10410 !! end
10411
10412
10413 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
10414 # instead of respecting commented sections
10415 !! test
10416 Section extraction prefixed by comment (section 1)
10417 !! options
10418 section=1
10419 !! input
10420 <!-- -->==sec1==
10421 ==sec2==
10422 !!result
10423 ==sec2==
10424 !!end
10425
10426 !! test
10427 Section extraction prefixed by comment (section 2)
10428 !! options
10429 section=2
10430 !! input
10431 <!-- -->==sec1==
10432 ==sec2==
10433 !!result
10434
10435 !!end
10436
10437
10438 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
10439 # instead of respecting HTML-style headings
10440 !! test
10441 Section extraction, mixed wiki and html (section 1)
10442 !! options
10443 section=1
10444 !! input
10445 <h2>unmarked</h2>
10446 unmarked
10447 ==1==
10448 one
10449 ==2==
10450 two
10451 !! result
10452 ==1==
10453 one
10454 !! end
10455
10456 !! test
10457 Section extraction, mixed wiki and html (section 2)
10458 !! options
10459 section=2
10460 !! input
10461 <h2>unmarked</h2>
10462 unmarked
10463 ==1==
10464 one
10465 ==2==
10466 two
10467 !! result
10468 ==2==
10469 two
10470 !! end
10471
10472
10473 # Formerly testing for bug 3342
10474 !! test
10475 Section extraction, heading surrounded by <noinclude>
10476 !! options
10477 section=1
10478 !! input
10479 <noinclude>==unmarked==</noinclude>
10480 ==marked==
10481 !! result
10482 ==marked==
10483 !!end
10484
10485 # Test behavior of bug 19910
10486 !! test
10487 Sectiion with all-equals
10488 !! options
10489 section=2
10490 !! input
10491 ===
10492 The line above must have a trailing space
10493 === <!--
10494 --> <!-- -->
10495 But just in case it doesn't...
10496 !! result
10497 === <!--
10498 --> <!-- -->
10499 But just in case it doesn't...
10500 !! end
10501
10502 !! test
10503 Section replacement test (section 0)
10504 !! options
10505 replace=0,"xxx"
10506 !! input
10507 start
10508 ==a==
10509 ===aa===
10510 ====aaa====
10511 ==b==
10512 ===ba===
10513 ===bb===
10514 ====bba====
10515 ===bc===
10516 ==c==
10517 ===ca===
10518 !! result
10519 xxx
10520
10521 ==a==
10522 ===aa===
10523 ====aaa====
10524 ==b==
10525 ===ba===
10526 ===bb===
10527 ====bba====
10528 ===bc===
10529 ==c==
10530 ===ca===
10531 !! end
10532
10533 !! test
10534 Section replacement test (section 1)
10535 !! options
10536 replace=1,"xxx"
10537 !! input
10538 start
10539 ==a==
10540 ===aa===
10541 ====aaa====
10542 ==b==
10543 ===ba===
10544 ===bb===
10545 ====bba====
10546 ===bc===
10547 ==c==
10548 ===ca===
10549 !! result
10550 start
10551 xxx
10552
10553 ==b==
10554 ===ba===
10555 ===bb===
10556 ====bba====
10557 ===bc===
10558 ==c==
10559 ===ca===
10560 !! end
10561
10562 !! test
10563 Section replacement test (section 2)
10564 !! options
10565 replace=2,"xxx"
10566 !! input
10567 start
10568 ==a==
10569 ===aa===
10570 ====aaa====
10571 ==b==
10572 ===ba===
10573 ===bb===
10574 ====bba====
10575 ===bc===
10576 ==c==
10577 ===ca===
10578 !! result
10579 start
10580 ==a==
10581 xxx
10582
10583 ==b==
10584 ===ba===
10585 ===bb===
10586 ====bba====
10587 ===bc===
10588 ==c==
10589 ===ca===
10590 !! end
10591
10592 !! test
10593 Section replacement test (section 3)
10594 !! options
10595 replace=3,"xxx"
10596 !! input
10597 start
10598 ==a==
10599 ===aa===
10600 ====aaa====
10601 ==b==
10602 ===ba===
10603 ===bb===
10604 ====bba====
10605 ===bc===
10606 ==c==
10607 ===ca===
10608 !! result
10609 start
10610 ==a==
10611 ===aa===
10612 xxx
10613
10614 ==b==
10615 ===ba===
10616 ===bb===
10617 ====bba====
10618 ===bc===
10619 ==c==
10620 ===ca===
10621 !! end
10622
10623 !! test
10624 Section replacement test (section 4)
10625 !! options
10626 replace=4,"xxx"
10627 !! input
10628 start
10629 ==a==
10630 ===aa===
10631 ====aaa====
10632 ==b==
10633 ===ba===
10634 ===bb===
10635 ====bba====
10636 ===bc===
10637 ==c==
10638 ===ca===
10639 !! result
10640 start
10641 ==a==
10642 ===aa===
10643 ====aaa====
10644 xxx
10645
10646 ==c==
10647 ===ca===
10648 !! end
10649
10650 !! test
10651 Section replacement test (section 5)
10652 !! options
10653 replace=5,"xxx"
10654 !! input
10655 start
10656 ==a==
10657 ===aa===
10658 ====aaa====
10659 ==b==
10660 ===ba===
10661 ===bb===
10662 ====bba====
10663 ===bc===
10664 ==c==
10665 ===ca===
10666 !! result
10667 start
10668 ==a==
10669 ===aa===
10670 ====aaa====
10671 ==b==
10672 xxx
10673
10674 ===bb===
10675 ====bba====
10676 ===bc===
10677 ==c==
10678 ===ca===
10679 !! end
10680
10681 !! test
10682 Section replacement test (section 6)
10683 !! options
10684 replace=6,"xxx"
10685 !! input
10686 start
10687 ==a==
10688 ===aa===
10689 ====aaa====
10690 ==b==
10691 ===ba===
10692 ===bb===
10693 ====bba====
10694 ===bc===
10695 ==c==
10696 ===ca===
10697 !! result
10698 start
10699 ==a==
10700 ===aa===
10701 ====aaa====
10702 ==b==
10703 ===ba===
10704 xxx
10705
10706 ===bc===
10707 ==c==
10708 ===ca===
10709 !! end
10710
10711 !! test
10712 Section replacement test (section 7)
10713 !! options
10714 replace=7,"xxx"
10715 !! input
10716 start
10717 ==a==
10718 ===aa===
10719 ====aaa====
10720 ==b==
10721 ===ba===
10722 ===bb===
10723 ====bba====
10724 ===bc===
10725 ==c==
10726 ===ca===
10727 !! result
10728 start
10729 ==a==
10730 ===aa===
10731 ====aaa====
10732 ==b==
10733 ===ba===
10734 ===bb===
10735 xxx
10736
10737 ===bc===
10738 ==c==
10739 ===ca===
10740 !! end
10741
10742 !! test
10743 Section replacement test (section 8)
10744 !! options
10745 replace=8,"xxx"
10746 !! input
10747 start
10748 ==a==
10749 ===aa===
10750 ====aaa====
10751 ==b==
10752 ===ba===
10753 ===bb===
10754 ====bba====
10755 ===bc===
10756 ==c==
10757 ===ca===
10758 !! result
10759 start
10760 ==a==
10761 ===aa===
10762 ====aaa====
10763 ==b==
10764 ===ba===
10765 ===bb===
10766 ====bba====
10767 xxx
10768
10769 ==c==
10770 ===ca===
10771 !!end
10772
10773 !! test
10774 Section replacement test (section 9)
10775 !! options
10776 replace=9,"xxx"
10777 !! input
10778 start
10779 ==a==
10780 ===aa===
10781 ====aaa====
10782 ==b==
10783 ===ba===
10784 ===bb===
10785 ====bba====
10786 ===bc===
10787 ==c==
10788 ===ca===
10789 !! result
10790 start
10791 ==a==
10792 ===aa===
10793 ====aaa====
10794 ==b==
10795 ===ba===
10796 ===bb===
10797 ====bba====
10798 ===bc===
10799 xxx
10800 !! end
10801
10802 !! test
10803 Section replacement test (section 10)
10804 !! options
10805 replace=10,"xxx"
10806 !! input
10807 start
10808 ==a==
10809 ===aa===
10810 ====aaa====
10811 ==b==
10812 ===ba===
10813 ===bb===
10814 ====bba====
10815 ===bc===
10816 ==c==
10817 ===ca===
10818 !! result
10819 start
10820 ==a==
10821 ===aa===
10822 ====aaa====
10823 ==b==
10824 ===ba===
10825 ===bb===
10826 ====bba====
10827 ===bc===
10828 ==c==
10829 xxx
10830 !! end
10831
10832 !! test
10833 Section replacement test with initial whitespace (bug 13728)
10834 !! options
10835 replace=2,"xxx"
10836 !! input
10837 Preformatted initial line
10838 ==a==
10839 ===a===
10840 !! result
10841 Preformatted initial line
10842 ==a==
10843 xxx
10844 !! end
10845
10846
10847 !! test
10848 Section extraction, heading followed by pre with 20 spaces (bug 6398)
10849 !! options
10850 section=1
10851 !! input
10852 ==a==
10853 a
10854 !! result
10855 ==a==
10856 a
10857 !! end
10858
10859 !! test
10860 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
10861 !! options
10862 section=1
10863 !! input
10864 ==a==
10865 a
10866 !! result
10867 ==a==
10868 a
10869 !! end
10870
10871
10872 !! test
10873 Section extraction, <pre> around bogus header (bug 10309)
10874 !! options
10875 noxml section=2
10876 !! input
10877 == Section One ==
10878 <pre>
10879 =======
10880 </pre>
10881
10882 == Section Two ==
10883 stuff
10884 !! result
10885 == Section Two ==
10886 stuff
10887 !! end
10888
10889 !! test
10890 Section replacement, <pre> around bogus header (bug 10309)
10891 !! options
10892 noxml replace=2,"xxx"
10893 !! input
10894 == Section One ==
10895 <pre>
10896 =======
10897 </pre>
10898
10899 == Section Two ==
10900 stuff
10901 !! result
10902 == Section One ==
10903 <pre>
10904 =======
10905 </pre>
10906
10907 xxx
10908 !! end
10909
10910
10911
10912 !! test
10913 Handling of &#x0A; in URLs
10914 !! input
10915 **irc://&#x0A;a
10916 !! result
10917 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
10918 </li></ul>
10919 </li></ul>
10920
10921 !!end
10922
10923 !! test
10924 5 quotes, code coverage +1 line (php)
10925 !! options
10926 php
10927 !! input
10928 '''''
10929 !! result
10930 !! end
10931 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
10932 !! test
10933 5 quotes, code coverage +1 line (parsoid)
10934 !! options
10935 parsoid
10936 !! input
10937 '''''
10938 !! result
10939 <p><i><b></b></i></p>
10940 !! end
10941
10942 !! test
10943 Special:Search page linking.
10944 !! input
10945 {{Special:search}}
10946 !! result
10947 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
10948 </p>
10949 !! end
10950
10951 !! test
10952 Say the magic word
10953 !! input
10954 * {{PAGENAME}}
10955 * {{BASEPAGENAME}}
10956 * {{SUBPAGENAME}}
10957 * {{SUBPAGENAMEE}}
10958 * {{BASEPAGENAME}}
10959 * {{BASEPAGENAMEE}}
10960 * {{TALKPAGENAME}}
10961 * {{TALKPAGENAMEE}}
10962 * {{SUBJECTPAGENAME}}
10963 * {{SUBJECTPAGENAMEE}}
10964 * {{NAMESPACEE}}
10965 * {{NAMESPACE}}
10966 * {{TALKSPACE}}
10967 * {{TALKSPACEE}}
10968 * {{SUBJECTSPACE}}
10969 * {{SUBJECTSPACEE}}
10970 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
10971 !! result
10972 <ul><li> Parser test
10973 </li><li> Parser test
10974 </li><li> Parser test
10975 </li><li> Parser_test
10976 </li><li> Parser test
10977 </li><li> Parser_test
10978 </li><li> Talk:Parser test
10979 </li><li> Talk:Parser_test
10980 </li><li> Parser test
10981 </li><li> Parser_test
10982 </li><li>
10983 </li><li>
10984 </li><li> Talk
10985 </li><li> Talk
10986 </li><li>
10987 </li><li>
10988 </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>
10989 </li></ul>
10990
10991 !! end
10992 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
10993
10994 !! test
10995 Gallery
10996 !! input
10997 <gallery>
10998 image1.png |
10999 image2.gif|||||
11000
11001 image3|
11002 image4 |300px| centre
11003 image5.svg| http://///////
11004 [[x|xx]]]]
11005 * image6
11006 </gallery>
11007 !! result
11008 <ul class="gallery">
11009 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11010 <div style="height: 150px;">Image1.png</div>
11011 <div class="gallerytext">
11012 </div>
11013 </div></li>
11014 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11015 <div style="height: 150px;">Image2.gif</div>
11016 <div class="gallerytext">
11017 <p>||||
11018 </p>
11019 </div>
11020 </div></li>
11021 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11022 <div style="height: 150px;">Image3</div>
11023 <div class="gallerytext">
11024 </div>
11025 </div></li>
11026 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11027 <div style="height: 150px;">Image4</div>
11028 <div class="gallerytext">
11029 <p>300px| centre
11030 </p>
11031 </div>
11032 </div></li>
11033 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11034 <div style="height: 150px;">Image5.svg</div>
11035 <div class="gallerytext">
11036 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
11037 </p>
11038 </div>
11039 </div></li>
11040 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11041 <div style="height: 150px;">* image6</div>
11042 <div class="gallerytext">
11043 </div>
11044 </div></li>
11045 </ul>
11046
11047 !! end
11048
11049 !! test
11050 Gallery (with options)
11051 !! input
11052 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
11053 File:Nonexistant.jpg|caption
11054 File:Nonexistant.jpg
11055 image:foobar.jpg|some '''caption''' [[Main Page]]
11056 image:foobar.jpg
11057 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
11058 </gallery>
11059 !! result
11060 <ul class="gallery" style="max-width: 226px;_width: 226px;">
11061 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
11062 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11063 <div style="height: 70px;">Nonexistant.jpg</div>
11064 <div class="gallerytext">
11065 <p>caption
11066 </p>
11067 </div>
11068 </div></li>
11069 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11070 <div style="height: 70px;">Nonexistant.jpg</div>
11071 <div class="gallerytext">
11072 </div>
11073 </div></li>
11074 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11075 <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>
11076 <div class="gallerytext">
11077 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11078 </p>
11079 </div>
11080 </div></li>
11081 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11082 <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>
11083 <div class="gallerytext">
11084 </div>
11085 </div></li>
11086 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11087 <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>
11088 <div class="gallerytext">
11089 <p>Blabla|blabla.
11090 </p>
11091 </div>
11092 </div></li>
11093 </ul>
11094
11095 !! end
11096
11097 !! test
11098 Gallery with wikitext inside caption
11099 !! input
11100 <gallery>
11101 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
11102 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
11103 </gallery>
11104 !! result
11105 <ul class="gallery">
11106 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11107 <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>
11108 <div class="gallerytext">
11109 <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>
11110 </p>
11111 </div>
11112 </div></li>
11113 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11114 <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>
11115 <div class="gallerytext">
11116 <p>This is a test template
11117 </p>
11118 </div>
11119 </div></li>
11120 </ul>
11121
11122 !! end
11123
11124 !! test
11125 gallery (with showfilename option)
11126 !! input
11127 <gallery showfilename>
11128 File:Nonexistant.jpg|caption
11129 File:Nonexistant.jpg
11130 image:foobar.jpg|some '''caption''' [[Main Page]]
11131 File:Foobar.jpg
11132 </gallery>
11133 !! result
11134 <ul class="gallery">
11135 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11136 <div style="height: 150px;">Nonexistant.jpg</div>
11137 <div class="gallerytext">
11138 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11139 caption
11140 </p>
11141 </div>
11142 </div></li>
11143 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11144 <div style="height: 150px;">Nonexistant.jpg</div>
11145 <div class="gallerytext">
11146 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11147 </p>
11148 </div>
11149 </div></li>
11150 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11151 <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>
11152 <div class="gallerytext">
11153 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11154 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11155 </p>
11156 </div>
11157 </div></li>
11158 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11159 <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>
11160 <div class="gallerytext">
11161 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11162 </p>
11163 </div>
11164 </div></li>
11165 </ul>
11166
11167 !! end
11168
11169 !! test
11170 Gallery (with namespace-less filenames)
11171 !! input
11172 <gallery>
11173 File:Nonexistant.jpg
11174 Nonexistant.jpg
11175 image:foobar.jpg
11176 foobar.jpg
11177 </gallery>
11178 !! result
11179 <ul class="gallery">
11180 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11181 <div style="height: 150px;">Nonexistant.jpg</div>
11182 <div class="gallerytext">
11183 </div>
11184 </div></li>
11185 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11186 <div style="height: 150px;">Nonexistant.jpg</div>
11187 <div class="gallerytext">
11188 </div>
11189 </div></li>
11190 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11191 <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>
11192 <div class="gallerytext">
11193 </div>
11194 </div></li>
11195 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11196 <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>
11197 <div class="gallerytext">
11198 </div>
11199 </div></li>
11200 </ul>
11201
11202 !! end
11203
11204 !! test
11205 HTML Hex character encoding (spells the word "JavaScript")
11206 !! input
11207 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
11208 !! result
11209 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
11210 </p>
11211 !! end
11212
11213 !! test
11214 HTML Hex character encoding bogus encoding (bug 26437 regression check)
11215 !! input
11216 &#xsee;&#XSEE;
11217 !! result
11218 <p>&amp;#xsee;&amp;#XSEE;
11219 </p>
11220 !! end
11221
11222 !! test
11223 HTML Hex character encoding mixed case
11224 !! input
11225 &#xEE;&#Xee;
11226 !! result
11227 <p>&#xee;&#xee;
11228 </p>
11229 !! end
11230
11231 !! test
11232 __FORCETOC__ override
11233 !! input
11234 __NEWSECTIONLINK__
11235 __FORCETOC__
11236 !! result
11237 <p><br />
11238 </p>
11239 !! end
11240
11241 !! test
11242 ISBN code coverage
11243 !! input
11244 ISBN 978-0-1234-56&#x20;789
11245 !! result
11246 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
11247 </p>
11248 !! end
11249
11250 !! test
11251 ISBN followed by 5 spaces
11252 !! input
11253 ISBN
11254 !! result
11255 <p>ISBN
11256 </p>
11257 !! end
11258
11259 !! test
11260 Double ISBN
11261 !! input
11262 ISBN ISBN 1234567890
11263 !! result
11264 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
11265 </p>
11266 !! end
11267
11268 !! test
11269 Bug 22905: <abbr> followed by ISBN followed by </a>
11270 !! input
11271 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
11272 !! result
11273 <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>
11274 </p>
11275 !! end
11276
11277 !! test
11278 Double RFC
11279 !! input
11280 RFC RFC 1234
11281 !! result
11282 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
11283 </p>
11284 !! end
11285
11286 !! test
11287 Double RFC with a wiki link
11288 !! input
11289 RFC [[RFC 1234]]
11290 !! result
11291 <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>
11292 </p>
11293 !! end
11294
11295 !! test
11296 RFC code coverage
11297 !! input
11298 RFC 983&#x20;987
11299 !! result
11300 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
11301 </p>
11302 !! end
11303
11304 !! test
11305 Centre-aligned image
11306 !! input
11307 [[Image:foobar.jpg|centre]]
11308 !! result
11309 <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>
11310
11311 !!end
11312
11313 !! test
11314 None-aligned image
11315 !! input
11316 [[Image:foobar.jpg|none]]
11317 !! result
11318 <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>
11319
11320 !!end
11321
11322 !! test
11323 Width + Height sized image (using px) (height is ignored)
11324 !! input
11325 [[Image:foobar.jpg|640x480px]]
11326 !! result
11327 <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>
11328 </p>
11329 !!end
11330
11331 !! test
11332 Width-sized image (using px, no following whitespace)
11333 !! input
11334 [[Image:foobar.jpg|640px]]
11335 !! result
11336 <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>
11337 </p>
11338 !!end
11339
11340 !! test
11341 Width-sized image (using px, with following whitespace - test regression from r39467)
11342 !! input
11343 [[Image:foobar.jpg|640px ]]
11344 !! result
11345 <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>
11346 </p>
11347 !!end
11348
11349 !! test
11350 Width-sized image (using px, with preceding whitespace - test regression from r39467)
11351 !! input
11352 [[Image:foobar.jpg| 640px]]
11353 !! result
11354 <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>
11355 </p>
11356 !!end
11357
11358 !! test
11359 Another italics / bold test
11360 !! input
11361 ''' ''x'
11362 !! result
11363 <pre>'<i> </i>x'
11364 </pre>
11365 !!end
11366
11367 # Note the results may be incorrect, as parserTest output included this:
11368 # XML error: Mismatched tag at byte 6120:
11369 # ...<dd> </dt></dl> </dd...
11370 !! test
11371 dt/dd/dl test
11372 !! options
11373 disabled
11374 !! input
11375 :;;;::
11376 !! result
11377 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
11378 </dd></dl>
11379 </dd></dl>
11380 </dt></dl>
11381 </dt></dl>
11382 </dt></dl>
11383 </dd></dl>
11384
11385 !!end
11386
11387
11388 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
11389 !! test
11390 Images with the "|" character in the comment
11391 !! input
11392 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
11393 !! result
11394 <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>
11395
11396 !!end
11397
11398 !! test
11399 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
11400 !! input
11401 <html><script>alert(1);</script></html>
11402 !! result
11403 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
11404 </p>
11405 !! end
11406
11407 !! test
11408 HTML with raw HTML ($wgRawHtml==true)
11409 !! options
11410 rawhtml
11411 !! input
11412 <html><script>alert(1);</script></html>
11413 !! result
11414 <p><script>alert(1);</script>
11415 </p>
11416 !! end
11417
11418 !! test
11419 Parents of subpages, one level up
11420 !! options
11421 subpage title=[[Subpage test/L1/L2/L3]]
11422 !! input
11423 [[../|L2]]
11424 !! result
11425 <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>
11426 </p>
11427 !! end
11428
11429
11430 !! test
11431 Parents of subpages, one level up, not named
11432 !! options
11433 subpage title=[[Subpage test/L1/L2/L3]]
11434 !! input
11435 [[../]]
11436 !! result
11437 <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>
11438 </p>
11439 !! end
11440
11441
11442
11443 !! test
11444 Parents of subpages, two levels up
11445 !! options
11446 subpage title=[[Subpage test/L1/L2/L3]]
11447 !! input
11448 [[../../|L1]]2
11449
11450 [[../../|L1]]l
11451 !! result
11452 <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
11453 </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>
11454 </p>
11455 !! end
11456
11457 !! test
11458 Parents of subpages, two levels up, without trailing slash or name.
11459 !! options
11460 subpage title=[[Subpage test/L1/L2/L3]]
11461 !! input
11462 [[../..]]
11463 !! result
11464 <p>[[../..]]
11465 </p>
11466 !! end
11467
11468 !! test
11469 Parents of subpages, two levels up, with lots of extra trailing slashes.
11470 !! options
11471 subpage title=[[Subpage test/L1/L2/L3]]
11472 !! input
11473 [[../../////]]
11474 !! result
11475 <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>
11476 </p>
11477 !! end
11478
11479 !! test
11480 Definition list code coverage
11481 !! input
11482 ; title : def
11483 ; title : def
11484 ;title: def
11485 !! result
11486 <dl><dt> title &#160;</dt><dd> def
11487 </dd><dt> title&#160;</dt><dd> def
11488 </dd><dt>title</dt><dd> def
11489 </dd></dl>
11490
11491 !! end
11492
11493 !! test
11494 Don't fall for the self-closing div
11495 !! input
11496 <div>hello world</div/>
11497 !! result
11498 <div>hello world</div>
11499
11500 !! end
11501
11502 !! test
11503 MSGNW magic word
11504 !! input
11505 {{MSGNW:msg}}
11506 !! result
11507 <p>&#91;&#91;:Template:Msg&#93;&#93;
11508 </p>
11509 !! end
11510
11511 !! test
11512 RAW magic word
11513 !! input
11514 {{RAW:QUERTY}}
11515 !! result
11516 <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>
11517 </p>
11518 !! end
11519
11520 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
11521 !! test
11522 Always escape literal '>' in output, not just after '<'
11523 !! input
11524 ><>
11525 !! result
11526 <p>&gt;&lt;&gt;
11527 </p>
11528 !! end
11529
11530 !! test
11531 Template caching
11532 !! input
11533 {{Test}}
11534 {{Test}}
11535 !! result
11536 <p>This is a test template
11537 This is a test template
11538 </p>
11539 !! end
11540
11541
11542 !! article
11543 MediaWiki:Fake
11544 !! text
11545 ==header==
11546 !! endarticle
11547
11548 !! test
11549 Inclusion of !userCanEdit() content
11550 !! input
11551 {{MediaWiki:Fake}}
11552 !! result
11553 <h2><span class="editsection">[<a href="/index.php?title=MediaWiki:Fake&amp;action=edit&amp;section=T-1" title="MediaWiki:Fake">edit</a>]</span> <span class="mw-headline" id="header">header</span></h2>
11554
11555 !! end
11556
11557
11558 !! test
11559 Out-of-order TOC heading levels
11560 !! input
11561 ==2==
11562 ======6======
11563 ===3===
11564 =1=
11565 =====5=====
11566 ==2==
11567 !! result
11568 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11569 <ul>
11570 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
11571 <ul>
11572 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
11573 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
11574 </ul>
11575 </li>
11576 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
11577 <ul>
11578 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
11579 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
11580 </ul>
11581 </li>
11582 </ul>
11583 </td></tr></table>
11584 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 2">edit</a>]</span> <span class="mw-headline" id="2">2</span></h2>
11585 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: 6">edit</a>]</span> <span class="mw-headline" id="6">6</span></h6>
11586 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: 3">edit</a>]</span> <span class="mw-headline" id="3">3</span></h3>
11587 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 1">edit</a>]</span> <span class="mw-headline" id="1">1</span></h1>
11588 <h5><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: 5">edit</a>]</span> <span class="mw-headline" id="5">5</span></h5>
11589 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: 2">edit</a>]</span> <span class="mw-headline" id="2_2">2</span></h2>
11590
11591 !! end
11592
11593
11594 !! test
11595 ISBN with a dummy number
11596 !! input
11597 ISBN ---
11598 !! result
11599 <p>ISBN ---
11600 </p>
11601 !! end
11602
11603
11604 !! test
11605 ISBN with space-delimited number
11606 !! input
11607 ISBN 92 9017 032 8
11608 !! result
11609 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
11610 </p>
11611 !! end
11612
11613
11614 !! test
11615 ISBN with multiple spaces, no number
11616 !! input
11617 ISBN foo
11618 !! result
11619 <p>ISBN foo
11620 </p>
11621 !! end
11622
11623
11624 !! test
11625 ISBN length
11626 !! input
11627 ISBN 123456789
11628
11629 ISBN 1234567890
11630
11631 ISBN 12345678901
11632 !! result
11633 <p>ISBN 123456789
11634 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
11635 </p><p>ISBN 12345678901
11636 </p>
11637 !! end
11638
11639
11640 !! test
11641 ISBN with trailing year (bug 8110)
11642 !! input
11643 ISBN 1-234-56789-0 - 2006
11644
11645 ISBN 1 234 56789 0 - 2006
11646 !! result
11647 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
11648 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
11649 </p>
11650 !! end
11651
11652
11653 !! test
11654 anchorencode
11655 !! input
11656 {{anchorencode:foo bar©#%n}}
11657 !! result
11658 <p>foo_bar.C2.A9.23.25n
11659 </p>
11660 !! end
11661
11662 !! test
11663 anchorencode trims spaces
11664 !! input
11665 {{anchorencode: __pretty__please__}}
11666 !! result
11667 <p>pretty_please
11668 </p>
11669 !! end
11670
11671 !! test
11672 anchorencode deals with links
11673 !! input
11674 {{anchorencode: [[hello|world]] [[hi]]}}
11675 !! result
11676 <p>world_hi
11677 </p>
11678 !! end
11679
11680 !! test
11681 anchorencode deals with templates
11682 !! input
11683 {{anchorencode: {{Foo}} }}
11684 !! result
11685 <p>FOO
11686 </p>
11687 !! end
11688
11689 !! test
11690 anchorencode encodes like the TOC generator: (bug 18431)
11691 !! input
11692 === _ +:.3A%3A&&amp;]] ===
11693 {{anchorencode: _ +:.3A%3A&&amp;]] }}
11694 __NOEDITSECTION__
11695 !! result
11696 <h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
11697 <p>.2B:.3A.253A.26.26.5D.5D
11698 </p>
11699 !! end
11700
11701 # Expected output in the following test is not necessarily expected (there
11702 # should probably be <p> tags inside the <blockquote> in the output) -- it's
11703 # only testing for well-formedness.
11704 !! test
11705 Bug 6200: blockquotes and paragraph formatting
11706 !! input
11707 <blockquote>
11708 foo
11709 </blockquote>
11710
11711 bar
11712
11713 baz
11714 !! result
11715 <blockquote>
11716 foo
11717 </blockquote>
11718 <p>bar
11719 </p>
11720 <pre>baz
11721 </pre>
11722 !! end
11723
11724 !! test
11725 Bug 8293: Use of center tag ruins paragraph formatting
11726 !! input
11727 <center>
11728 foo
11729 </center>
11730
11731 bar
11732
11733 baz
11734 !! result
11735 <center>
11736 <p>foo
11737 </p>
11738 </center>
11739 <p>bar
11740 </p>
11741 <pre>baz
11742 </pre>
11743 !! end
11744
11745 !!test
11746 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
11747 !!options
11748 php
11749 !!input
11750 <span><s>x</span></s>
11751 !!result
11752 <p><span><s>x&lt;/span&gt;</s></span>
11753 </p>
11754 !!end
11755
11756 !!test
11757 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
11758 !!options
11759 parsoid
11760 !!input
11761 <span><s>x</span></s>
11762 !!result
11763 <p><span><s>x</s></span><s></s>
11764 </p>
11765 !!end
11766
11767 ###
11768 ### Language variants related tests
11769 ###
11770 !! test
11771 Self-link in language variants
11772 !! options
11773 title=[[Dunav]] language=sr
11774 !! input
11775 Both [[Dunav]] and [[Дунав]] are names for this river.
11776 !! result
11777 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
11778 </p>
11779 !!end
11780
11781 !! article
11782 Дуна
11783 !! text
11784 content
11785 !! endarticle
11786
11787 !! test
11788 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
11789 !! options
11790 title=[[Duna]] language=sr
11791 !! input
11792 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
11793 !! result
11794 <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.
11795 </p>
11796 !! end
11797
11798 !! test
11799 Link to pages in language variants
11800 !! options
11801 language=sr
11802 !! input
11803 Main Page can be written as [[Маин Паге]]
11804 !! result
11805 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
11806 </p>
11807 !!end
11808
11809
11810 !! test
11811 Multiple links to pages in language variants
11812 !! options
11813 language=sr
11814 !! input
11815 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
11816 !! result
11817 <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>.
11818 </p>
11819 !!end
11820
11821
11822 !! test
11823 Simple template in language variants
11824 !! options
11825 language=sr
11826 !! input
11827 {{тест}}
11828 !! result
11829 <p>This is a test template
11830 </p>
11831 !! end
11832
11833
11834 !! test
11835 Template with explicit namespace in language variants
11836 !! options
11837 language=sr
11838 !! input
11839 {{Template:тест}}
11840 !! result
11841 <p>This is a test template
11842 </p>
11843 !! end
11844
11845
11846 !! test
11847 Basic test for template parameter in language variants
11848 !! options
11849 language=sr
11850 !! input
11851 {{парамтест|param=foo}}
11852 !! result
11853 <p>This is a test template with parameter foo
11854 </p>
11855 !! end
11856
11857
11858 !! test
11859 Simple category in language variants
11860 !! options
11861 language=sr cat
11862 !! input
11863 [[Category:МедиаWики Усер'с Гуиде]]
11864 !! result
11865 <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>
11866 !! end
11867
11868
11869 !! article
11870 Category:分类
11871 !! text
11872 blah
11873 !! endarticle
11874
11875 !! article
11876 Category:分類
11877 !! text
11878 blah
11879 !! endarticle
11880
11881 !! test
11882 Don't convert blue categorylinks to another variant (bug 33210)
11883 !! options
11884 language=zh cat
11885 !! input
11886 [[A]][[Category:分类]]
11887 !! result
11888 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
11889 !! end
11890
11891
11892 !! test
11893 Stripping -{}- tags (language variants)
11894 !! options
11895 language=sr
11896 !! input
11897 Latin proverb: -{Ne nuntium necare}-
11898 !! result
11899 <p>Latin proverb: Ne nuntium necare
11900 </p>
11901 !! end
11902
11903
11904 !! test
11905 Prevent conversion with -{}- tags (language variants)
11906 !! options
11907 language=sr variant=sr-ec
11908 !! input
11909 Latinski: -{Ne nuntium necare}-
11910 !! result
11911 <p>Латински: Ne nuntium necare
11912 </p>
11913 !! end
11914
11915
11916 !! test
11917 Prevent conversion of text with -{}- tags (language variants)
11918 !! options
11919 language=sr variant=sr-ec
11920 !! input
11921 Latinski: -{Ne nuntium necare}-
11922 !! result
11923 <p>Латински: Ne nuntium necare
11924 </p>
11925 !! end
11926
11927
11928 !! test
11929 Prevent conversion of links with -{}- tags (language variants)
11930 !! options
11931 language=sr variant=sr-ec
11932 !! input
11933 -{[[Main Page]]}-
11934 !! result
11935 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11936 </p>
11937 !! end
11938
11939
11940 !! test
11941 -{}- tags within headlines (within html for parserConvert())
11942 !! options
11943 language=sr variant=sr-ec
11944 !! input
11945 == -{Naslov}- ==
11946 !! result
11947 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Уредите одељак „Naslov“">уреди</a>]</span> <span class="mw-headline" id="-.7BNaslov.7D-">Naslov</span></h2>
11948
11949 !! end
11950
11951
11952 !! test
11953 Explicit definition of language variant alternatives
11954 !! options
11955 language=zh variant=zh-tw
11956 !! input
11957 -{zh:China;zh-tw:Taiwan}-, not China
11958 !! result
11959 <p>Taiwan, not China
11960 </p>
11961 !! end
11962
11963
11964 !! test
11965 Conversion around HTML tags
11966 !! options
11967 language=sr variant=sr-ec
11968 !! input
11969 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
11970 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
11971 !! result
11972 <p>
11973 <span title="ЛаCтин">ски</span>
11974 </p>
11975 !! end
11976
11977
11978 !! test
11979 Explicit session-wise language variant mapping (A flag and - flag)
11980 !! options
11981 language=zh variant=zh-tw
11982 !! input
11983 Taiwan is not China.
11984 But -{A|zh:China;zh-tw:Taiwan}- is China,
11985 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
11986 and -{China}- is China.
11987 !! result
11988 <p>Taiwan is not China.
11989 But Taiwan is Taiwan,
11990 (This should be stripped!)
11991 and China is China.
11992 </p>
11993 !! end
11994
11995 !! test
11996 Explicit session-wise language variant mapping (H flag for hide)
11997 !! options
11998 language=zh variant=zh-tw
11999 !! input
12000 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
12001 Taiwan is China.
12002 !! result
12003 <p>(This should be stripped!)
12004 Taiwan is Taiwan.
12005 </p>
12006 !! end
12007
12008 !! test
12009 Adding explicit conversion rule for title (T flag)
12010 !! options
12011 language=zh variant=zh-tw showtitle
12012 !! input
12013 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12014 !! result
12015 Taiwan
12016 <p>Should be stripped!
12017 </p>
12018 !! end
12019
12020 !! test
12021 Testing that changing the language variant here in the tests actually works
12022 !! options
12023 language=zh variant=zh showtitle
12024 !! input
12025 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12026 !! result
12027 China
12028 <p>Should be stripped!
12029 </p>
12030 !! end
12031
12032 !! test
12033 Recursive conversion of alt and title attrs shouldn't clear converter state
12034 !! options
12035 language=zh variant=zh-cn showtitle
12036 !! input
12037 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
12038 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
12039 !! result
12040 China
12041 <p>
12042 Should be stripped<span title="Exclamation">!</span>
12043 </p>
12044 !! end
12045
12046 !! test
12047 Bug 24072: more test on conversion rule for title
12048 !! options
12049 language=zh variant=zh-tw showtitle
12050 !! input
12051 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12052 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
12053 !! result
12054 Taiwan
12055 <p>This should be stripped!
12056 This won't take interferes with the title rule.
12057 </p>
12058 !! end
12059
12060 !! test
12061 Raw output of variant escape tags (R flag)
12062 !! options
12063 language=zh variant=zh-tw
12064 !! input
12065 Raw: -{R|zh:China;zh-tw:Taiwan}-
12066 !! result
12067 <p>Raw: zh:China;zh-tw:Taiwan
12068 </p>
12069 !! end
12070
12071 !! test
12072 Nested using of manual convert syntax
12073 !! options
12074 language=zh variant=zh-hk
12075 !! input
12076 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
12077 !! result
12078 <p>Nested: Hello Hong Kong!
12079 </p>
12080 !! end
12081
12082 !! test
12083 Proper conversion of text in external links
12084 !! options
12085 language=sr variant=sr-ec
12086 !! input
12087 http://www.google.com
12088 gopher://www.google.com
12089 [http://www.google.com http://www.google.com]
12090 [gopher://www.google.com gopher://www.google.com]
12091 [https://www.google.com irc://www.google.com]
12092 [ftp://www.google.com www.google.com/ftp://dir]
12093 [//www.google.com www.google.com]
12094 !! result
12095 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12096 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12097 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12098 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12099 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
12100 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
12101 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
12102 </p>
12103 !! end
12104
12105 !! test
12106 Do not convert roman numbers to language variants
12107 !! options
12108 language=sr variant=sr-ec
12109 !! input
12110 Fridrih IV je car.
12111 !! result
12112 <p>Фридрих IV је цар.
12113 </p>
12114 !! end
12115
12116 !! test
12117 Unclosed language converter markup "-{"
12118 !! options
12119 language=sr
12120 !! input
12121 -{T|hello
12122 !! result
12123 <p>-{T|hello
12124 </p>
12125 !! end
12126
12127 !! test
12128 Don't convert raw rule "-{R|=&gt;}-" to "=>"
12129 !! options
12130 language=sr
12131 !! input
12132 -{R|=&gt;}-
12133 !! result
12134 <p>=&gt;
12135 </p>
12136 !!end
12137
12138 !!article
12139 Template:Bullet
12140 !!text
12141 * Bar
12142 !!endarticle
12143
12144 !! test
12145 Bug 529: Uncovered bullet
12146 !! input
12147 * Foo {{bullet}}
12148 !! result
12149 <ul><li> Foo
12150 </li><li> Bar
12151 </li></ul>
12152
12153 !! end
12154
12155 # Plain MediaWiki does not remove empty lists, but tidy actually does.
12156 # Templates in Wikipedia rely on this behavior, as tidy has always been
12157 # enabled there. These tests are normally run *without* tidy, so specify the
12158 # full output here.
12159 # To test realistic parsing behavior, apply a tidy-like transformation to both
12160 # the expected output and your parser's output.
12161 !! test
12162 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
12163 !! input
12164 ******* Foo {{bullet}}
12165 !! result
12166 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
12167 </li></ul>
12168 </li></ul>
12169 </li></ul>
12170 </li></ul>
12171 </li></ul>
12172 </li></ul>
12173 </li><li> Bar
12174 </li></ul>
12175
12176 !! end
12177
12178 !! test
12179 Bug 529: Uncovered table already at line-start
12180 !! input
12181 x
12182
12183 {{table}}
12184 y
12185 !! result
12186 <p>x
12187 </p>
12188 <table>
12189 <tr>
12190 <td> 1 </td>
12191 <td> 2
12192 </td></tr>
12193 <tr>
12194 <td> 3 </td>
12195 <td> 4
12196 </td></tr></table>
12197 <p>y
12198 </p>
12199 !! end
12200
12201 !! test
12202 Bug 529: Uncovered bullet in parser function result
12203 !! input
12204 * Foo {{lc:{{bullet}} }}
12205 !! result
12206 <ul><li> Foo
12207 </li><li> bar
12208 </li></ul>
12209
12210 !! end
12211
12212 !! test
12213 Bug 5678: Double-parsed template argument
12214 !! input
12215 {{lc:{{{1}}}|hello}}
12216 !! result
12217 <p>{{{1}}}
12218 </p>
12219 !! end
12220
12221 !! test
12222 Bug 5678: Double-parsed template invocation
12223 !! input
12224 {{lc:{{paramtest {{!}} param = hello }} }}
12225 !! result
12226 <p>{{paramtest | param = hello }}
12227 </p>
12228 !! end
12229
12230 !! test
12231 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
12232 !! options
12233 language=cs
12234 title=[[Main Page]]
12235 !! input
12236 {{PRVNÍVELKÉ:ěščř}}
12237 {{prvnívelké:ěščř}}
12238 {{PRVNÍMALÉ:ěščř}}
12239 {{prvnímalé:ěščř}}
12240 {{MALÁ:ěščř}}
12241 {{malá:ěščř}}
12242 {{VELKÁ:ěščř}}
12243 {{velká:ěščř}}
12244 !! result
12245 <p>Ěščř
12246 Ěščř
12247 ěščř
12248 ěščř
12249 ěščř
12250 ěščř
12251 ĚŠČŘ
12252 ĚŠČŘ
12253 </p>
12254 !! end
12255
12256 !! test
12257 Morwen/13: Unclosed link followed by heading
12258 !! input
12259 [[link
12260 ==heading==
12261 !! result
12262 <p>[[link
12263 </p>
12264 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span> <span class="mw-headline" id="heading">heading</span></h2>
12265
12266 !! end
12267
12268 !! test
12269 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
12270 !! input
12271 {{foo|
12272 =heading=
12273 !! result
12274 <p>{{foo|
12275 </p>
12276 <h1> <span class="mw-headline" id="heading">heading</span></h1>
12277
12278 !! end
12279
12280 !! test
12281 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
12282 !! input
12283 {{foo|
12284 ==heading==
12285 !! result
12286 <p>{{foo|
12287 </p>
12288 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span> <span class="mw-headline" id="heading">heading</span></h2>
12289
12290 !! end
12291
12292 !! test
12293 Tildes in comments
12294 !! options
12295 pst
12296 !! input
12297 <!-- ~~~~ -->
12298 !! result
12299 <!-- ~~~~ -->
12300 !! end
12301
12302 !! test
12303 Paragraphs inside divs (no extra line breaks)
12304 !! input
12305 <div>Line one
12306
12307 Line two</div>
12308 !! result
12309 <div>Line one
12310 Line two</div>
12311
12312 !! end
12313
12314 !! test
12315 Paragraphs inside divs (extra line break on open)
12316 !! input
12317 <div>
12318 Line one
12319
12320 Line two</div>
12321 !! result
12322 <div>
12323 <p>Line one
12324 </p>
12325 Line two</div>
12326
12327 !! end
12328
12329 !! test
12330 Paragraphs inside divs (extra line break on close)
12331 !! input
12332 <div>Line one
12333
12334 Line two
12335 </div>
12336 !! result
12337 <div>Line one
12338 <p>Line two
12339 </p>
12340 </div>
12341
12342 !! end
12343
12344 !! test
12345 Paragraphs inside divs (extra line break on open and close)
12346 !! input
12347 <div>
12348 Line one
12349
12350 Line two
12351 </div>
12352 !! result
12353 <div>
12354 <p>Line one
12355 </p><p>Line two
12356 </p>
12357 </div>
12358
12359 !! end
12360
12361 !! test
12362 Nesting tags, paragraphs on lines which begin with <div>
12363 !! options
12364 disabled
12365 !! input
12366 <div></div><strong>A
12367 B</strong>
12368 !! result
12369 <div></div>
12370 <p><strong>A
12371 B</strong>
12372 </p>
12373 !! end
12374
12375 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
12376 !! test
12377 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
12378 !! options
12379 disabled
12380 !! input
12381 <blockquote>Line one
12382
12383 Line two</blockquote>
12384 !! result
12385 <blockquote>Line one
12386 Line two</blockquote>
12387
12388 !! end
12389
12390 !! test
12391 Bug 6200: paragraphs inside blockquotes (extra line break on open)
12392 !! options
12393 disabled
12394 !! input
12395 <blockquote>
12396 Line one
12397
12398 Line two</blockquote>
12399 !! result
12400 <blockquote>
12401 <p>Line one
12402 </p>
12403 Line two</blockquote>
12404
12405 !! end
12406
12407 !! test
12408 Bug 6200: paragraphs inside blockquotes (extra line break on close)
12409 !! options
12410 disabled
12411 !! input
12412 <blockquote>Line one
12413
12414 Line two
12415 </blockquote>
12416 !! result
12417 <blockquote>Line one
12418 <p>Line two
12419 </p>
12420 </blockquote>
12421
12422 !! end
12423
12424 !! test
12425 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
12426 !! options
12427 disabled
12428 !! input
12429 <blockquote>
12430 Line one
12431
12432 Line two
12433 </blockquote>
12434 !! result
12435 <blockquote>
12436 <p>Line one
12437 </p><p>Line two
12438 </p>
12439 </blockquote>
12440
12441 !! end
12442
12443 !! test
12444 Paragraphs inside blockquotes/divs (no extra line breaks)
12445 !! input
12446 <blockquote><div>Line one
12447
12448 Line two</div></blockquote>
12449 !! result
12450 <blockquote><div>Line one
12451 Line two</div></blockquote>
12452
12453 !! end
12454
12455 !! test
12456 Paragraphs inside blockquotes/divs (extra line break on open)
12457 !! input
12458 <blockquote><div>
12459 Line one
12460
12461 Line two</div></blockquote>
12462 !! result
12463 <blockquote><div>
12464 <p>Line one
12465 </p>
12466 Line two</div></blockquote>
12467
12468 !! end
12469
12470 !! test
12471 Paragraphs inside blockquotes/divs (extra line break on close)
12472 !! input
12473 <blockquote><div>Line one
12474
12475 Line two
12476 </div></blockquote>
12477 !! result
12478 <blockquote><div>Line one
12479 <p>Line two
12480 </p>
12481 </div></blockquote>
12482
12483 !! end
12484
12485 !! test
12486 Paragraphs inside blockquotes/divs (extra line break on open and close)
12487 !! input
12488 <blockquote><div>
12489 Line one
12490
12491 Line two
12492 </div></blockquote>
12493 !! result
12494 <blockquote><div>
12495 <p>Line one
12496 </p><p>Line two
12497 </p>
12498 </div></blockquote>
12499
12500 !! end
12501
12502 !! test
12503 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
12504 !! options
12505 wgLinkHolderBatchSize=0
12506 !! input
12507 [[meatball:1]]
12508 [[meatball:2]]
12509 [[meatball:3]]
12510 !! result
12511 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
12512 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
12513 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
12514 </p>
12515 !! end
12516
12517 !! test
12518 Free external link invading image caption
12519 !! input
12520 [[Image:Foobar.jpg|thumb|http://x|hello]]
12521 !! result
12522 <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>
12523
12524 !! end
12525
12526 !! test
12527 Bug 15196: localised external link numbers
12528 !! options
12529 language=fa
12530 !! input
12531 [http://en.wikipedia.org/]
12532 !! result
12533 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
12534 </p>
12535 !! end
12536
12537 !! test
12538 Multibyte character in padleft
12539 !! input
12540 {{padleft:-Hello|7|Æ}}
12541 !! result
12542 <p>Æ-Hello
12543 </p>
12544 !! end
12545
12546 !! test
12547 Multibyte character in padright
12548 !! input
12549 {{padright:Hello-|7|Æ}}
12550 !! result
12551 <p>Hello-Æ
12552 </p>
12553 !! end
12554
12555 !!test
12556 formatdate parser function
12557 !!input
12558 {{#formatdate:2009-03-24}}
12559 !! result
12560 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
12561 </p>
12562 !! end
12563
12564 !!test
12565 formatdate parser function, with default format
12566 !!input
12567 {{#formatdate:2009-03-24|mdy}}
12568 !! result
12569 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
12570 </p>
12571 !! end
12572
12573 !! test
12574 Spacing of numbers in formatted dates
12575 !! input
12576 {{#formatdate:January 15}}
12577 !! result
12578 <p><span class="mw-formatted-date" title="01-15">January 15</span>
12579 </p>
12580 !! end
12581
12582 !! test
12583 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
12584 !! options
12585 language=nl title=[[MediaWiki:Common.css]]
12586 !! input
12587 {{#formatdate:2009-03-24|dmy}}
12588 !! result
12589 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
12590 </p>
12591 !! end
12592
12593 #
12594 #
12595 #
12596
12597 #
12598 # Edit comments
12599 #
12600
12601 !! test
12602 Edit comment with link
12603 !! options
12604 comment
12605 !! input
12606 I like the [[Main Page]] a lot
12607 !! result
12608 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
12609 !!end
12610
12611 !! test
12612 Edit comment with link and link text
12613 !! options
12614 comment
12615 !! input
12616 I like the [[Main Page|best pages]] a lot
12617 !! result
12618 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
12619 !!end
12620
12621 !! test
12622 Edit comment with link and link text with suffix
12623 !! options
12624 comment
12625 !! input
12626 I like the [[Main Page|best page]]s a lot
12627 !! result
12628 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
12629 !!end
12630
12631 !! test
12632 Edit comment with section link (non-local, eg in history list)
12633 !! options
12634 comment title=[[Main Page]]
12635 !! input
12636 /* External links */ removed bogus entries
12637 !! result
12638 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12639 !!end
12640
12641 !! test
12642 Edit comment with section link and text before it (non-local, eg in history list)
12643 !! options
12644 comment title=[[Main Page]]
12645 !! input
12646 pre-comment text /* External links */ removed bogus entries
12647 !! result
12648 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>
12649 !!end
12650
12651 !! test
12652 Edit comment with section link (local, eg in diff view)
12653 !! options
12654 comment local title=[[Main Page]]
12655 !! input
12656 /* External links */ removed bogus entries
12657 !! result
12658 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12659 !!end
12660
12661 !! test
12662 Edit comment with subpage link (bug 14080)
12663 !! options
12664 comment
12665 subpage
12666 title=[[Subpage test]]
12667 !! input
12668 Poked at a [[/subpage]] here...
12669 !! result
12670 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
12671 !!end
12672
12673 !! test
12674 Edit comment with subpage link and link text (bug 14080)
12675 !! options
12676 comment
12677 subpage
12678 title=[[Subpage test]]
12679 !! input
12680 Poked at a [[/subpage|neat little page]] here...
12681 !! result
12682 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
12683 !!end
12684
12685 !! test
12686 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
12687 !! options
12688 comment
12689 title=[[Subpage test]]
12690 !! input
12691 Poked at a [[/subpage]] here...
12692 !! result
12693 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...
12694 !!end
12695
12696 !! test
12697 Edit comment with bare anchor link (local, as on diff)
12698 !! options
12699 comment
12700 local
12701 title=[[Main Page]]
12702 !!input
12703 [[#section]]
12704 !! result
12705 <a href="#section">#section</a>
12706 !! end
12707
12708 !! test
12709 Edit comment with bare anchor link (non-local, as on history)
12710 !! options
12711 comment
12712 title=[[Main Page]]
12713 !!input
12714 [[#section]]
12715 !! result
12716 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
12717 !! end
12718
12719 !! test
12720 Anchor starting with underscore
12721 !!input
12722 [[#_ref|One]]
12723 !! result
12724 <p><a href="#_ref">One</a>
12725 </p>
12726 !! end
12727
12728 !! test
12729 Id starting with underscore
12730 !!input
12731 <div id="_ref"></div>
12732 !! result
12733 <div id="_ref"></div>
12734
12735 !! end
12736
12737 !! test
12738 Space normalisation on autocomment (bug 22784)
12739 !! options
12740 comment
12741 title=[[Main Page]]
12742 !!input
12743 /* __hello__world__ */
12744 !! result
12745 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
12746 !! end
12747
12748 !! test
12749 percent-encoding and + signs in comments (Bug 26410)
12750 !! options
12751 comment
12752 !!input
12753 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
12754 !! result
12755 <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>
12756 !! end
12757
12758 !! test
12759 Bad images - basic functionality
12760 !! options
12761 disabled
12762 !! input
12763 [[File:Bad.jpg]]
12764 !! result
12765 !! end
12766
12767 !! test
12768 Bad images - bug 16039: text after bad image disappears
12769 !! options
12770 disabled
12771 !! input
12772 Foo bar
12773 [[File:Bad.jpg]]
12774 Bar foo
12775 !! result
12776 <p>Foo bar
12777 </p><p>Bar foo
12778 </p>
12779 !! end
12780
12781 !! test
12782 Verify that displaytitle works (bug #22501) no displaytitle
12783 !! options
12784 showtitle
12785 !! config
12786 wgAllowDisplayTitle=true
12787 wgRestrictDisplayTitle=false
12788 !! input
12789 this is not the the title
12790 !! result
12791 Parser test
12792 <p>this is not the the title
12793 </p>
12794 !! end
12795
12796 !! test
12797 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
12798 !! options
12799 showtitle
12800 title=[[Screen]]
12801 !! config
12802 wgAllowDisplayTitle=true
12803 wgRestrictDisplayTitle=false
12804 !! input
12805 this is not the the title
12806 {{DISPLAYTITLE:whatever}}
12807 !! result
12808 whatever
12809 <p>this is not the the title
12810 </p>
12811 !! end
12812
12813 !! test
12814 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
12815 !! options
12816 showtitle
12817 title=[[Screen]]
12818 !! config
12819 wgAllowDisplayTitle=true
12820 wgRestrictDisplayTitle=true
12821 !! input
12822 this is not the the title
12823 {{DISPLAYTITLE:whatever}}
12824 !! result
12825 Screen
12826 <p>this is not the the title
12827 </p>
12828 !! end
12829
12830 !! test
12831 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
12832 !! options
12833 showtitle
12834 title=[[Screen]]
12835 !! config
12836 wgAllowDisplayTitle=true
12837 wgRestrictDisplayTitle=true
12838 !! input
12839 this is not the the title
12840 {{DISPLAYTITLE:screen}}
12841 !! result
12842 screen
12843 <p>this is not the the title
12844 </p>
12845 !! end
12846
12847 !! test
12848 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
12849 !! options
12850 showtitle
12851 title=[[Screen]]
12852 !! config
12853 wgAllowDisplayTitle=false
12854 !! input
12855 this is not the the title
12856 {{DISPLAYTITLE:screen}}
12857 !! result
12858 Screen
12859 <p>this is not the the title
12860 <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>
12861 </p>
12862 !! end
12863
12864 !! test
12865 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
12866 !! options
12867 showtitle
12868 title=[[Screen]]
12869 !! config
12870 wgAllowDisplayTitle=false
12871 !! input
12872 this is not the the title
12873 !! result
12874 Screen
12875 <p>this is not the the title
12876 </p>
12877 !! end
12878
12879 !! test
12880 preload: check <noinclude> and <includeonly>
12881 !! options
12882 preload
12883 !! input
12884 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
12885 !! result
12886 Hello kind world.
12887 !! end
12888
12889 !! test
12890 preload: check <onlyinclude>
12891 !! options
12892 preload
12893 !! input
12894 Goodbye <onlyinclude>Hello world</onlyinclude>
12895 !! result
12896 Hello world
12897 !! end
12898
12899 !! test
12900 preload: can pass tags through if we want to
12901 !! options
12902 preload
12903 !! input
12904 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
12905 !! result
12906 <includeonly>Hello world</includeonly>
12907 !! end
12908
12909 !! test
12910 preload: check that it doesn't try to do tricks
12911 !! options
12912 preload
12913 !! input
12914 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12915 !! result
12916 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12917 !! end
12918
12919 !! test
12920 Play a bit with r67090 and bug 3158
12921 !! options
12922 disabled
12923 !! input
12924 <div style="width:50% !important">&nbsp;</div>
12925 <div style="width:50%&nbsp;!important">&nbsp;</div>
12926 <div style="width:50%&#160;!important">&nbsp;</div>
12927 <div style="border : solid;">&nbsp;</div>
12928 !! result
12929 <div style="width:50% !important">&nbsp;</div>
12930 <div style="width:50% !important">&nbsp;</div>
12931 <div style="width:50% !important">&nbsp;</div>
12932 <div style="border&#160;: solid;">&nbsp;</div>
12933
12934 !! end
12935
12936 !! test
12937 HTML5 data attributes
12938 !! input
12939 <span data-foo="bar">Baz</span>
12940 <p data-abc-def_hij="">Quuz</p>
12941 !! result
12942 <p><span data-foo="bar">Baz</span>
12943 </p>
12944 <p data-abc-def_hij="">Quuz</p>
12945
12946 !! end
12947
12948 !! test
12949 percent-encoding and + signs in internal links (Bug 26410)
12950 !! input
12951 [[User:+%]] [[Page+title%]]
12952 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
12953 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
12954 [[%33%45]] [[%33%45+]]
12955 !! result
12956 <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>
12957 <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>
12958 <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>
12959 <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>
12960 </p>
12961 !! end
12962
12963 !! test
12964 Special characters in embedded file links (bug 27679)
12965 !! input
12966 [[File:Contains & ampersand.jpg]]
12967 [[File:Does not exist.jpg|Title with & ampersand]]
12968 !! result
12969 <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>
12970 <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>
12971 </p>
12972 !! end
12973
12974
12975 !! test
12976 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
12977 !! input
12978 Text&apos;s been normalized?
12979 !! result
12980 <p>Text&#39;s been normalized?
12981 </p>
12982 !! end
12983
12984 !! test
12985 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
12986 !! input
12987 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
12988 !! result
12989 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
12990 </p>
12991 !! end
12992
12993 !! test
12994 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
12995 !! input
12996 [http://www.example.org/ ideograms]
12997 !! result
12998 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
12999 </p>
13000 !! end
13001
13002 !! test
13003 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
13004 !! input
13005 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
13006 !! result
13007 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
13008 </p>
13009 !! end
13010
13011 !! article
13012 Mediawiki:loop1
13013 !! text
13014 {{Identical|A}}
13015 !! endarticle
13016
13017 !! article
13018 Mediawiki:loop2
13019 !! text
13020 {{Identical|B}}
13021 !! endarticle
13022
13023 !! article
13024 Template:Identical
13025 !! text
13026 {{int:loop1}}
13027 {{int:loop2}}
13028 !! endarticle
13029
13030 !! test
13031 Bug 31098 Template which includes system messages which includes the template
13032 !! input
13033 {{Identical}}
13034 !! result
13035 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13036 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13037 </p>
13038 !! end
13039
13040 !! test
13041 Bug31490 Turkish: ucfirst 'blah'
13042 !! options
13043 language=tr
13044 !! input
13045 {{ucfirst:blah}}
13046 !! result
13047 <p>Blah
13048 </p>
13049 !! end
13050
13051 !! test
13052 Bug31490 Turkish: ucfirst 'ix'
13053 !! options
13054 language=tr
13055 !! input
13056 {{ucfirst:ix}}
13057 !! result
13058 <p>İx
13059 </p>
13060 !! end
13061
13062 !! test
13063 Bug31490 Turkish: lcfirst 'BLAH'
13064 !! options
13065 language=tr
13066 !! input
13067 {{lcfirst:BLAH}}
13068 !! result
13069 <p>bLAH
13070 </p>
13071 !! end
13072
13073 !! test
13074 Bug31490 Turkish: ucfırst (with a dotless i)
13075 !! options
13076 language=tr
13077 !! input
13078 {{ucfırst:blah}}
13079 !! result
13080 <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>
13081 </p>
13082 !! end
13083
13084 !! test
13085 Bug31490 ucfırst (with a dotless i) with English language
13086 !! options
13087 language=en
13088 !! input
13089 {{ucfırst:blah}}
13090 !! result
13091 <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>
13092 </p>
13093 !! end
13094
13095 !! test
13096 Bug 26375: TOC with italics
13097 !! options
13098 title=[[Main Page]]
13099 !! input
13100 __TOC__
13101 == ''Lost'' episodes ==
13102 !! result
13103 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13104 <ul>
13105 <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>
13106 </ul>
13107 </td></tr></table>
13108 <h2><span class="editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Lost episodes">edit</a>]</span> <span class="mw-headline" id="Lost_episodes"><i>Lost</i> episodes</span></h2>
13109
13110 !! end
13111
13112 !! test
13113 Bug 26375: TOC with bold
13114 !! options
13115 title=[[Main Page]]
13116 !! input
13117 __TOC__
13118 == '''should be bold''' then normal text ==
13119 !! result
13120 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13121 <ul>
13122 <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>
13123 </ul>
13124 </td></tr></table>
13125 <h2><span class="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> <span class="mw-headline" id="should_be_bold_then_normal_text"><b>should be bold</b> then normal text</span></h2>
13126
13127 !! end
13128
13129 !! test
13130 Bug 33845: Headings become cursive in TOC when they contain an image
13131 !! options
13132 title=[[Main Page]]
13133 !! input
13134 __TOC__
13135 == Image [[Image:foobar.jpg]] ==
13136 !! result
13137 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13138 <ul>
13139 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
13140 </ul>
13141 </td></tr></table>
13142 <h2><span class="editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Image">edit</a>]</span> <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></h2>
13143
13144 !! end
13145
13146 !! test
13147 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
13148 !! options
13149 title=[[Main Page]]
13150 !! input
13151 __TOC__
13152 == <blockquote>Quote</blockquote> ==
13153 !! result
13154 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13155 <ul>
13156 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
13157 </ul>
13158 </td></tr></table>
13159 <h2><span class="editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Quote">edit</a>]</span> <span class="mw-headline" id="Quote"><blockquote>Quote</blockquote></span></h2>
13160
13161 !! end
13162
13163 !! test
13164 Unclosed tags in TOC
13165 !! options
13166 title=[[Main Page]]
13167 !! input
13168 __TOC__
13169 == Proof: 2 < 3 ==
13170 <small>Hanc marginis exiguitas non caperet.</small>
13171 QED
13172 !! result
13173 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13174 <ul>
13175 <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>
13176 </ul>
13177 </td></tr></table>
13178 <h2><span class="editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Proof: 2 &lt; 3">edit</a>]</span> <span class="mw-headline" id="Proof:_2_.3C_3">Proof: 2 &lt; 3</span></h2>
13179 <p><small>Hanc marginis exiguitas non caperet.</small>
13180 QED
13181 </p>
13182 !! end
13183
13184 !! test
13185 Multiple tags in TOC
13186 !! input
13187 __TOC__
13188 == <i>Foo</i> <b>Bar</b> ==
13189
13190 == <i>Foo</i> <blockquote>Bar</blockquote> ==
13191 !! result
13192 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13193 <ul>
13194 <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>
13195 <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>
13196 </ul>
13197 </td></tr></table>
13198 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo Bar">edit</a>]</span> <span class="mw-headline" id="Foo_Bar"><i>Foo</i> <b>Bar</b></span></h2>
13199 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a>]</span> <span class="mw-headline" id="Foo_Bar_2"><i>Foo</i> <blockquote>Bar</blockquote></span></h2>
13200
13201 !! end
13202
13203 !! test
13204 Tags with parameters in TOC
13205 !! input
13206 __TOC__
13207 == <sup class="in-h2">Hello</sup> ==
13208
13209 == <sup class="a > b">Evilbye</sup> ==
13210 !! result
13211 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13212 <ul>
13213 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
13214 <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>
13215 </ul>
13216 </td></tr></table>
13217 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Hello">edit</a>]</span> <span class="mw-headline" id="Hello"><sup class="in-h2">Hello</sup></span></h2>
13218 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b&quot;>Evilbye">edit</a>]</span> <span class="mw-headline" id="b.22.3EEvilbye"><sup> b"&gt;Evilbye</sup></span></h2>
13219
13220 !! end
13221
13222 !! test
13223 span tags with directionality in TOC
13224 !! input
13225 __TOC__
13226 == <span dir="ltr">C++</span> ==
13227
13228 == <span dir="rtl">זבנג!</span> ==
13229
13230 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
13231
13232 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
13233
13234 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
13235 !! result
13236 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13237 <ul>
13238 <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>
13239 <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>
13240 <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>
13241 <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>
13242 <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>
13243 </ul>
13244 </td></tr></table>
13245 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: C++">edit</a>]</span> <span class="mw-headline" id="C.2B.2B"><span dir="ltr">C++</span></span></h2>
13246 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: זבנג!">edit</a>]</span> <span class="mw-headline" id=".D7.96.D7.91.D7.A0.D7.92.21"><span dir="rtl">זבנג!</span></span></h2>
13247 <h2><span class="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> <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></h2>
13248 <h2><span class="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> <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></h2>
13249 <h2><span class="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> <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></h2>
13250
13251 !! end
13252
13253 !! article
13254 MediaWiki:Bug32057
13255 !! text
13256 == {{int:headline_sample}} ==
13257 !! endarticle
13258
13259 !! test
13260 Bug 32057: Title needed when expanding <h> nodes.
13261 !! options
13262 title=[[Main Page]]
13263 !! input
13264 {{int:Bug32057}}
13265 !! result
13266 <h2><span class="editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Headline text">edit</a>]</span> <span class="mw-headline" id="Headline_text">Headline text</span></h2>
13267
13268 !! end
13269
13270 !! test
13271 Strip marker in urlencode
13272 !! input
13273 {{urlencode:x<nowiki/>y}}
13274 {{urlencode:x<nowiki/>y|wiki}}
13275 {{urlencode:x<nowiki/>y|path}}
13276 !! result
13277 <p>xy
13278 xy
13279 xy
13280 </p>
13281 !! end
13282
13283 !! test
13284 Strip marker in lc
13285 !! input
13286 {{lc:x<nowiki/>y}}
13287 !! result
13288 <p>xy
13289 </p>
13290 !! end
13291
13292 !! test
13293 Strip marker in uc
13294 !! input
13295 {{uc:x<nowiki/>y}}
13296 !! result
13297 <p>XY
13298 </p>
13299 !! end
13300
13301 !! test
13302 Strip marker in formatNum
13303 !! input
13304 {{formatnum:1<nowiki/>2}}
13305 {{formatnum:1<nowiki/>2|R}}
13306 !! result
13307 <p>12
13308 12
13309 </p>
13310 !! end
13311
13312 !! test
13313 Check noCommafy in formatNum
13314 !! options
13315 language=be-tarask
13316 !! input
13317 {{formatnum:123456.78}}
13318 {{formatnum:123456.78|NOSEP}}
13319 !! result
13320 <p>123 456,78
13321 123456.78
13322 </p>
13323 !! end
13324
13325 !! test
13326 Strip marker in grammar
13327 !! options
13328 language=fi
13329 !! input
13330 {{grammar:elative|foo<nowiki/>bar}}
13331 !! result
13332 <p>foobarista
13333 </p>
13334 !! end
13335
13336 !! test
13337 Strip marker in padleft
13338 !! input
13339 {{padleft:|2|x<nowiki/>y}}
13340 !! result
13341 <p>xy
13342 </p>
13343 !! end
13344
13345 !! test
13346 Strip marker in padright
13347 !! input
13348 {{padright:|2|x<nowiki/>y}}
13349 !! result
13350 <p>xy
13351 </p>
13352 !! end
13353
13354 !! test
13355 Strip marker in anchorencode
13356 !! input
13357 {{anchorencode:x<nowiki/>y}}
13358 !! result
13359 <p>xy
13360 </p>
13361 !! end
13362
13363 !! test
13364 nowiki inside link inside heading (bug 18295)
13365 !! input
13366 ==[[foo|x<nowiki>y</nowiki>z]]==
13367 !! result
13368 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: xyz">edit</a>]</span> <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></h2>
13369
13370 !! end
13371
13372 !! test
13373 new support for bdi element (bug 31817)
13374 !! input
13375 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
13376 !! result
13377 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
13378
13379 !!end
13380
13381 !! test
13382 Ignore pipe between table row attributes
13383 !! input
13384 {|
13385 | quux
13386 |- id=foo | style='color: red'
13387 | bar
13388 |}
13389 !! result
13390 <table>
13391 <tr>
13392 <td> quux
13393 </td></tr>
13394 <tr id="foo" style="color: red">
13395 <td> bar
13396 </td></tr></table>
13397
13398 !! end
13399
13400 !!test
13401 Gallery override link with WikiLink (bug 34852)
13402 !! input
13403 <gallery>
13404 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
13405 </gallery>
13406 !! result
13407 <ul class="gallery">
13408 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13409 <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>
13410 <div class="gallerytext">
13411 <p>caption
13412 </p>
13413 </div>
13414 </div></li>
13415 </ul>
13416
13417 !! end
13418
13419 !!test
13420 Gallery override link with absolute external link (bug 34852)
13421 !! input
13422 <gallery>
13423 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
13424 </gallery>
13425 !! result
13426 <ul class="gallery">
13427 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13428 <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>
13429 <div class="gallerytext">
13430 <p>caption
13431 </p>
13432 </div>
13433 </div></li>
13434 </ul>
13435
13436 !! end
13437
13438 !!test
13439 Gallery override link with malicious javascript (bug 34852)
13440 !! input
13441 <gallery>
13442 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
13443 </gallery>
13444 !! result
13445 <ul class="gallery">
13446 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13447 <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>
13448 <div class="gallerytext">
13449 <p>caption
13450 </p>
13451 </div>
13452 </div></li>
13453 </ul>
13454
13455 !! end
13456
13457 !!test
13458 Gallery with invalid title as link (bug 43964)
13459 !! input
13460 <gallery>
13461 File:foobar.jpg|link=<
13462 </gallery>
13463 !! result
13464 <ul class="gallery">
13465 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13466 <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>
13467 <div class="gallerytext">
13468 </div>
13469 </div></li>
13470 </ul>
13471
13472 !! end
13473
13474 !!test
13475 Language parser function
13476 !! input
13477 {{#language:ar}}
13478 !! result
13479 <p>العربية
13480 </p>
13481 !! end
13482
13483 !!test
13484 Padleft and padright as substr
13485 !! input
13486 {{padleft:|3|abcde}}
13487 {{padright:|3|abcde}}
13488 !! result
13489 <p>abc
13490 abc
13491 </p>
13492 !! end
13493
13494 !!test
13495 Bug 34939 - Case insensitive link parsing ([HttP://])
13496 !! input
13497 [HttP://MediaWiki.Org/]
13498 !! result
13499 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
13500 </p>
13501 !! end
13502
13503 !!test
13504 Bug 34939 - Case insensitive link parsing ([HttP:// title])
13505 !! input
13506 [HttP://MediaWiki.Org/ MediaWiki]
13507 !! result
13508 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
13509 </p>
13510 !! end
13511
13512 !!test
13513 Bug 34939 - Case insensitive link parsing (HttP://)
13514 !! input
13515 HttP://MediaWiki.Org/
13516 !! result
13517 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
13518 </p>
13519 !! end
13520
13521 ###
13522 ### Parsoids-specific tests
13523 ### Parsoid-PHP parser incompatibilities
13524 ###
13525 !!test
13526 1. SOL-sensitive wikitext tokens as template-args
13527 !!options
13528 disabled
13529 !!input
13530 {{echo|*a}}
13531 {{echo|#a}}
13532 {{echo|:a}}
13533 !!result
13534 <p>*a
13535 #a
13536 :a
13537 </p>
13538 !!end
13539
13540 #### The following section of tests are primarily to test
13541 #### wikitext escaping capabilities of Parsoid.
13542 #### A lot of the tests are disabled for the PHP parser either
13543 #### because of minor newline diffs or other reasons.
13544 #### As Parsoid serializer can handle newlines and other HTML
13545 #### more robustly, some of these tests might get reenabled
13546 #### for the PHP parser.
13547
13548 #### --------------- Headings ---------------
13549 #### 0. Unnested
13550 #### 1. Nested inside html <h1>=foo=</h1>
13551 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
13552 #### 3. Nested inside html with wikitext split by html tags
13553 #### 4. No escape needed
13554 #### 5. Empty headings <h1></h1>
13555 #### 6. Heading chars in SOL context
13556 #### ----------------------------------------
13557 !! test
13558 Headings: 0. Unnested
13559 !! input
13560 <nowiki>=foo=</nowiki>
13561
13562 <nowiki>=foo</nowiki>''a''=
13563 !! result
13564 <p>=foo=
13565 </p><p>=foo<i>a</i>=
13566 </p>
13567 !!end
13568
13569 !! test
13570 Headings: 1. Nested inside html
13571 !! options
13572 disabled
13573 !! input
13574 =<nowiki>=foo=</nowiki>=
13575 ==<nowiki>=foo=</nowiki>==
13576 ===<nowiki>=foo=</nowiki>===
13577 ====<nowiki>=foo=</nowiki>====
13578 =====<nowiki>=foo=</nowiki>=====
13579 ======<nowiki>=foo=</nowiki>======
13580 !! result
13581 <h1>=foo=</h1>
13582 <h2>=foo=</h2>
13583 <h3>=foo=</h3>
13584 <h4>=foo=</h4>
13585 <h5>=foo=</h5>
13586 <h6>=foo=</h6>
13587 !!end
13588
13589 !! test
13590 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
13591 !! options
13592 disabled
13593 !! input
13594 =foo=
13595 <nowiki>*bar</nowiki>
13596 =foo=
13597 =bar
13598 =foo=
13599 <nowiki>=bar=</nowiki>
13600 !! result
13601 <h1>foo</h1>*bar
13602 <h1>foo</h1>=bar
13603 <h1>foo</h1>=bar=
13604 !!end
13605
13606 !! test
13607 Headings: 3. Nested inside html with wikitext split by html tags
13608 !! options
13609 disabled
13610 !! input
13611 =<nowiki>=</nowiki>'''bold'''foo==
13612 !! result
13613 <h1>=<b>bold</b>foo=</h1>
13614 !!end
13615
13616 !! test
13617 Headings: 4. No escaping needed (testing just h1 and h2)
13618 !! options
13619 disabled
13620 !! input
13621 ==foo=
13622 =foo==
13623 ===foo==
13624 ==foo===
13625 =''=''foo==
13626 ===
13627 !! result
13628 <h1>=foo</h1>
13629 <h1>foo=</h1>
13630 <h2>=foo</h2>
13631 <h2>foo=</h2>
13632 <h1><i>=</i>foo=</h1>
13633 <h1>=</h1>
13634 !!end
13635
13636 !! test
13637 Headings: 5. Empty headings
13638 !! options
13639 disabled
13640 !! input
13641 =<nowiki></nowiki>=
13642 ==<nowiki></nowiki>==
13643 ===<nowiki></nowiki>===
13644 ====<nowiki></nowiki>====
13645 =====<nowiki></nowiki>=====
13646 ======<nowiki></nowiki>======
13647 !! result
13648 <h1></h1>
13649 <h2></h2>
13650 <h3></h3>
13651 <h4></h4>
13652 <h5></h5>
13653 <h6></h6>
13654 !!end
13655
13656 !! test
13657 Headings: 6. Heading chars in SOL context
13658 !! options
13659 disabled
13660 !! input
13661 <!--cmt--><nowiki>=h1=</nowiki>
13662 !! result
13663 <p><!--cmt-->=h1=
13664 </p>
13665 !!end
13666
13667 #### --------------- Lists ---------------
13668 #### 0. Outside nests (*foo, etc.)
13669 #### 1. Nested inside html <ul><li>*foo</li></ul>
13670 #### 2. Inside definition lists
13671 #### 3. Only bullets at start should be escaped
13672 #### 4. No escapes needed
13673 #### 5. No unnecessary escapes
13674 #### 6. Escape bullets in SOL position
13675 #### 7. Escape bullets in a multi-line context
13676 #### ----------------------------------------
13677
13678 !! test
13679 Lists: 0. Outside nests
13680 !! input
13681 <nowiki>*foo</nowiki>
13682
13683 <nowiki>#foo</nowiki>
13684 !! result
13685 <p>*foo
13686 </p><p>#foo
13687 </p>
13688 !!end
13689
13690 !! test
13691 Lists: 1. Nested inside html
13692 !! input
13693 *<nowiki>*foo</nowiki>
13694
13695 *<nowiki>#foo</nowiki>
13696
13697 *<nowiki>:foo</nowiki>
13698
13699 *<nowiki>;foo</nowiki>
13700
13701 #<nowiki>*foo</nowiki>
13702
13703 #<nowiki>#foo</nowiki>
13704
13705 #<nowiki>:foo</nowiki>
13706
13707 #<nowiki>;foo</nowiki>
13708 !! result
13709 <ul><li>*foo
13710 </li></ul>
13711 <ul><li>#foo
13712 </li></ul>
13713 <ul><li>:foo
13714 </li></ul>
13715 <ul><li>;foo
13716 </li></ul>
13717 <ol><li>*foo
13718 </li></ol>
13719 <ol><li>#foo
13720 </li></ol>
13721 <ol><li>:foo
13722 </li></ol>
13723 <ol><li>;foo
13724 </li></ol>
13725
13726 !!end
13727
13728 !! test
13729 Lists: 2. Inside definition lists
13730 !! input
13731 ;<nowiki>;foo</nowiki>
13732
13733 ;<nowiki>:foo</nowiki>
13734
13735 ;<nowiki>:foo</nowiki>
13736 :bar
13737
13738 :<nowiki>:foo</nowiki>
13739 !! result
13740 <dl><dt>;foo
13741 </dt></dl>
13742 <dl><dt>:foo
13743 </dt></dl>
13744 <dl><dt>:foo
13745 </dt><dd>bar
13746 </dd></dl>
13747 <dl><dd>:foo
13748 </dd></dl>
13749
13750 !!end
13751
13752 !! test
13753 Lists: 3. Only bullets at start of text should be escaped
13754 !! input
13755 *<nowiki>*foo*bar</nowiki>
13756
13757 *<nowiki>*foo</nowiki>''it''*bar
13758 !! result
13759 <ul><li>*foo*bar
13760 </li></ul>
13761 <ul><li>*foo<i>it</i>*bar
13762 </li></ul>
13763
13764 !!end
13765
13766 !! test
13767 Lists: 4. No escapes needed
13768 !! options
13769 disabled
13770 !! input
13771 *foo*bar
13772
13773 *''foo''*bar
13774
13775 *[[Foo]]: bar
13776 !! result
13777 <ul><li>foo*bar
13778 </li></ul>
13779 <ul><li><i>foo</i>*bar
13780 </li></ul>
13781 <ul><li><a href="Foo" rel="mw:WikiLink">Foo</a>: bar
13782 </li></ul>
13783 !!end
13784
13785 !! test
13786 Lists: 5. No unnecessary escapes
13787 !! input
13788 * bar <span><nowiki>[[foo]]</nowiki></span>
13789
13790 *=bar <span><nowiki>[[foo]]</nowiki></span>
13791
13792 *[[bar <span><nowiki>[[foo]]</nowiki></span>
13793
13794 *<nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
13795
13796 *=bar <span>foo]]</span>=
13797 !! result
13798 <ul><li> bar <span>[[foo]]</span>
13799 </li></ul>
13800 <ul><li>=bar <span>[[foo]]</span>
13801 </li></ul>
13802 <ul><li>[[bar <span>[[foo]]</span>
13803 </li></ul>
13804 <ul><li>]]bar <span>[[foo]]</span>
13805 </li></ul>
13806 <ul><li>=bar <span>foo]]</span>=
13807 </li></ul>
13808
13809 !!end
13810
13811 !! test
13812 Lists: 6. Escape bullets in SOL position
13813 !! options
13814 disabled
13815 !! input
13816 <!--cmt--><nowiki>*foo</nowiki>
13817 !! result
13818 <p><!--cmt-->*foo
13819 </p>
13820 !!end
13821
13822 !! test
13823 Lists: 7. Escape bullets in a multi-line context
13824 !! input
13825 <nowiki>a
13826 *b</nowiki>
13827 !! result
13828 <p>a
13829 *b
13830 </p>
13831 !!end
13832
13833 #### --------------- HRs ---------------
13834 #### 1. Single line
13835 #### -----------------------------------
13836
13837 !! test
13838 HRs: 1. Single line
13839 !! options
13840 disabled
13841 !! input
13842 ----
13843 <nowiki>----</nowiki>
13844 ----
13845 <nowiki>=foo=</nowiki>
13846 ----
13847 <nowiki>*foo</nowiki>
13848 !! result
13849 <hr/>----
13850 <hr/>=foo=
13851 <hr/>*foo
13852 !! end
13853
13854 #### --------------- Tables ---------------
13855 #### 1a. Simple example
13856 #### 1b. No escaping needed (!foo)
13857 #### 1c. No escaping needed (|foo)
13858 #### 1d. No escaping needed (|}foo)
13859 ####
13860 #### 2a. Nested in td (<td>foo|bar</td>)
13861 #### 2b. Nested in td (<td>foo||bar</td>)
13862 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
13863 ####
13864 #### 3a. Nested in th (<th>foo!bar</th>)
13865 #### 3b. Nested in th (<th>foo!!bar</th>)
13866 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
13867 ####
13868 #### 4a. Escape -
13869 #### 4b. Escape +
13870 #### 4c. No escaping needed
13871 #### --------------------------------------
13872
13873 !! test
13874 Tables: 1a. Simple example
13875 !! input
13876 <nowiki>{|
13877 |}</nowiki>
13878 !! result
13879 <p>{|
13880 |}
13881 </p>
13882 !! end
13883
13884 !! test
13885 Tables: 1b. No escaping needed
13886 !! input
13887 !foo
13888 !! result
13889 <p>!foo
13890 </p>
13891 !! end
13892
13893 !! test
13894 Tables: 1c. No escaping needed
13895 !! input
13896 |foo
13897 !! result
13898 <p>|foo
13899 </p>
13900 !! end
13901
13902 !! test
13903 Tables: 1d. No escaping needed
13904 !! input
13905 |}foo
13906 !! result
13907 <p>|}foo
13908 </p>
13909 !! end
13910
13911 !! test
13912 Tables: 2a. Nested in td
13913 !! options
13914 disabled
13915 !! input
13916 {|
13917 |<nowiki>foo|bar</nowiki>
13918 |}
13919 !! result
13920 <table>
13921 <tr><td>foo|bar
13922 </td></tr></table>
13923
13924 !! end
13925
13926 !! test
13927 Tables: 2b. Nested in td
13928 !! options
13929 disabled
13930 !! input
13931 {|
13932 |<nowiki>foo||bar</nowiki>
13933 |''it''<nowiki>foo||bar</nowiki>
13934 |}
13935 !! result
13936 <table>
13937 <tr><td>foo||bar
13938 </td><td><i>it</i>foo||bar
13939 </td></tr></table>
13940
13941 !! end
13942
13943 !! test
13944 Tables: 2c. Nested in td -- no escaping needed
13945 !! options
13946 disabled
13947 !! input
13948 {|
13949 |foo!!bar
13950 |}
13951 !! result
13952 <table>
13953 <tr><td>foo!!bar
13954 </td></tr></table>
13955
13956 !! end
13957
13958 !! test
13959 Tables: 3a. Nested in th
13960 !! options
13961 disabled
13962 !! input
13963 {|
13964 !foo!bar
13965 |}
13966 !! result
13967 <table>
13968 <tr><th>foo!bar
13969 </th></tr></table>
13970
13971 !! end
13972
13973 !! test
13974 Tables: 3b. Nested in th
13975 !! options
13976 disabled
13977 !! input
13978 {|
13979 !<nowiki>foo!!bar</nowiki>
13980 |}
13981 !! result
13982 <table>
13983 <tr><th>foo!!bar
13984 </th></tr></table>
13985
13986 !! end
13987
13988 !! test
13989 Tables: 3c. Nested in th -- no escaping needed
13990 !! options
13991 disabled
13992 !! input
13993 {|
13994 !foo||bar
13995 |}
13996 !! result
13997 <table>
13998 <tr><th>foo||bar
13999 </th></tr></table>
14000
14001 !! end
14002
14003 !! test
14004 Tables: 4a. Escape -
14005 !! options
14006 disabled
14007 !! input
14008 {|
14009 |-
14010 !-bar
14011 |-
14012 |<nowiki>-bar</nowiki>
14013 |}
14014 !! result
14015 <table><tbody>
14016 <tr><th>-bar</th></tr>
14017 <tr><td>-bar</td></tr>
14018 </tbody></table>
14019 !! end
14020
14021 !! test
14022 Tables: 4b. Escape +
14023 !! options
14024 disabled
14025 !! input
14026 {|
14027 |-
14028 !+bar
14029 |-
14030 |<nowiki>+bar</nowiki>
14031 |}
14032 !! result
14033 <table><tbody>
14034 <tr><th>+bar</th></tr>
14035 <tr><td>+bar</td></tr>
14036 </tbody></table>
14037 !! end
14038
14039 !! test
14040 Tables: 4c. No escaping needed
14041 !! options
14042 disabled
14043 !! input
14044 {|
14045 |-
14046 |foo-bar
14047 |foo+bar
14048 |-
14049 |''foo''-bar
14050 |''foo''+bar
14051 |}
14052 !! result
14053 <table><tbody>
14054 <tr><td>foo-bar</td><td>foo+bar</td></tr>
14055 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
14056 </tbody></table>
14057 !! end
14058
14059 !! test
14060 Tables: 4d. No escaping needed
14061 !! input
14062 {|
14063 ||+1
14064 ||-2
14065 |}
14066 !! result
14067 <table>
14068 <tr>
14069 <td>+1
14070 </td>
14071 <td>-2
14072 </td></tr></table>
14073
14074 !! end
14075
14076 #### --------------- Links ---------------
14077 #### 1. Quote marks in link text
14078 #### 2. Wikilinks: Escapes needed
14079 #### 3. Wikilinks: No escapes needed
14080 #### 4. Extlinks: Escapes needed
14081 #### 5. Extlinks: No escapes needed
14082 #### --------------------------------------
14083 !! test
14084 Links 1. Quote marks in link text
14085 !! options
14086 disabled
14087 !! input
14088 [[Foo|<nowiki>Foo''boo''</nowiki>]]
14089 !! result
14090 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
14091 !! end
14092
14093 !! test
14094 Links 2. WikiLinks: Escapes needed
14095 !! options
14096 disabled
14097 !! input
14098 [[Foo|<nowiki>[Foobar]</nowiki>]]
14099 [[Foo|<nowiki>Foobar]</nowiki>]]
14100 [[Foo|<nowiki>x [Foobar] x</nowiki>]]
14101 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
14102 [[Foo|<nowiki>[[Bar]]</nowiki>]]
14103 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
14104 [[Foo|<nowiki>|Bar</nowiki>]]
14105 !! result
14106 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
14107 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
14108 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
14109 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
14110 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
14111 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
14112 <a href="Foo" rel="mw:WikiLink">|Bar</a>
14113 !! end
14114
14115 !! test
14116 Links 3. WikiLinks: No escapes needed
14117 !! options
14118 disabled
14119 !! input
14120 [[Foo|[Foobar]]
14121 [[Foo|foo|bar]]
14122 !! result
14123 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
14124 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
14125 !! end
14126
14127 !! test
14128 Links 4. ExtLinks: Escapes needed
14129 !! options
14130 disabled
14131 !! input
14132 [http://google.com <nowiki>[google]</nowiki>]
14133 [http://google.com <nowiki>google]</nowiki>]
14134 !! result
14135 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
14136 <a href="http://google.com" rel="mw:ExtLink">google]</a>
14137 !! end
14138
14139 !! test
14140 Links 5. ExtLinks: No escapes needed
14141 !! options
14142 disabled
14143 !! input
14144 [http://google.com [google]
14145 !! result
14146 <a href="http://google.com" rel="mw:ExtLink">[google</a>
14147 !! end
14148
14149 #### --------------- Quotes ---------------
14150 #### 1. Quotes inside <b> and <i>
14151 #### 2. Link fragments separated by <i> and <b> tags
14152 #### 3. Link fragments inside <i> and <b>
14153 #### --------------------------------------
14154 !! test
14155 1. Quotes inside <b> and <i>
14156 !! input
14157 ''<nowiki>'foo'</nowiki>''
14158 ''<nowiki>''foo''</nowiki>''
14159 ''<nowiki>'''foo'''</nowiki>''
14160 '''<nowiki>'foo'</nowiki>'''
14161 '''<nowiki>''foo''</nowiki>'''
14162 '''<nowiki>'''foo'''</nowiki>'''
14163 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
14164 !! result
14165 <p><i>'foo'</i>
14166 <i>''foo''</i>
14167 <i>'''foo'''</i>
14168 <b>'foo'</b>
14169 <b>''foo''</b>
14170 <b>'''foo'''</b>
14171 <b>foo'<i>bar'</i>baz</b>
14172 </p>
14173 !! end
14174
14175 !! test
14176 2. Link fragments separated by <i> and <b> tags
14177 !! input
14178 [[''foo''<nowiki>hello]]</nowiki>
14179
14180 [['''foo'''<nowiki>hello]]</nowiki>
14181 !! result
14182 <p>[[<i>foo</i>hello]]
14183 </p><p>[[<b>foo</b>hello]]
14184 </p>
14185 !! end
14186
14187 !! test
14188 2. Link fragments inside <i> and <b>
14189 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
14190 this is one of the shortcomings of this format)
14191 !! input
14192 ''[[foo''<nowiki>]]</nowiki>
14193
14194 '''[[foo'''<nowiki>]]</nowiki>
14195 !! result
14196 <p><i>[[foo</i>]]
14197 </p><p><b>[[foo</b>]]
14198 </p>
14199 !! end
14200
14201 #### --------------- Paragraphs ---------------
14202 #### 1. No unnecessary escapes
14203 #### --------------------------------------
14204
14205 !! test
14206 1. No unnecessary escapes
14207 !! input
14208 bar <span><nowiki>[[foo]]</nowiki></span>
14209
14210 =bar <span><nowiki>[[foo]]</nowiki></span>
14211
14212 [[bar <span><nowiki>[[foo]]</nowiki></span>
14213
14214 <nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
14215
14216 <nowiki>=bar </nowiki><span>foo]]</span>=
14217 !! result
14218 <p>bar <span>[[foo]]</span>
14219 </p><p>=bar <span>[[foo]]</span>
14220 </p><p>[[bar <span>[[foo]]</span>
14221 </p><p>]]bar <span>[[foo]]</span>
14222 </p><p>=bar <span>foo]]</span>=
14223 </p>
14224 !!end
14225
14226 #### --------------- PRE ------------------
14227 #### 1. Leading space in SOL context should be escaped
14228 #### --------------------------------------
14229 !! test
14230 1. Leading space in SOL context should be escaped
14231 !! options
14232 disabled
14233 !! input
14234 <nowiki> foo</nowiki>
14235 <!--cmt--><nowiki> foo</nowiki>
14236 !! result
14237 <p> foo
14238 <!--cmt--> foo
14239 </p>
14240 !! end
14241
14242 #### --------------- HTML tags ---------------
14243 #### 1. a tags
14244 #### 2. other tags
14245 #### 3. multi-line html tag
14246 #### --------------------------------------
14247 !! test
14248 1. a tags
14249 !! options
14250 disabled
14251 !! input
14252 <a href="http://google.com">google</a>
14253 !! result
14254 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
14255 !! end
14256
14257 !! test
14258 2. other tags
14259 !! input
14260 <nowiki><div>foo</div>
14261 <div style="color:red">foo</div></nowiki>
14262 !! result
14263 <p>&lt;div&gt;foo&lt;/div&gt;
14264 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
14265 </p>
14266 !! end
14267
14268 !! test
14269 3. multi-line html tag
14270 !! input
14271 <nowiki><div
14272 >foo</div
14273 ></nowiki>
14274 !! result
14275 <p>&lt;div
14276 &gt;foo&lt;/div
14277 &gt;
14278 </p>
14279 !! end
14280
14281 #### --------------- Others ---------------
14282 !! test
14283 Escaping nowikis
14284 !! input
14285 &lt;nowiki&gt;foo&lt;/nowiki&gt;
14286 !! result
14287 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
14288 </p>
14289 !! end
14290
14291 !! test
14292 Tag-like HTML structures are passed through as text
14293 !! input
14294 <x y>
14295
14296 <x.y>
14297
14298 <x-y>
14299
14300 1>2
14301
14302 x<y
14303
14304 a>b
14305
14306 1<d e>f
14307 !! result
14308 <p>&lt;x y&gt;
14309 </p><p>&lt;x.y&gt;
14310 </p><p>&lt;x-y&gt;
14311 </p><p>1&gt;2
14312 </p><p>x&lt;y
14313 </p><p>a&gt;b
14314 </p><p>1&lt;d e&gt;f
14315 </p>
14316 !! end
14317
14318
14319 # This fails in the PHP parser (see bug 40670,
14320 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
14321 !! test
14322 Tag names followed by punctuation should not be recognized as tags
14323 !! options
14324 disabled
14325 !! input
14326 <s.ome> text
14327 !! result
14328 <p>&lt;s.ome&gt text
14329 </p>
14330 !! end
14331
14332 !! test
14333 HTML tag with necessary entities in attributes
14334 !! input
14335 <span title="&amp;amp;">foo</span>
14336 !! result
14337 <p><span title="&amp;amp;">foo</span>
14338 </p>
14339 !! end
14340
14341 !! test
14342 HTML tag with 'unnecessary' entity encoding in attributes
14343 !! input
14344 <span title="&amp;">foo</span>
14345 !! result
14346 <p><span title="&amp;">foo</span>
14347 </p>
14348 !! end
14349
14350 !! test
14351 HTML tag with broken attribute value quoting
14352 !! input
14353 <span title="Hello world>Foo</span>
14354 !! result
14355 <p><span>Foo</span>
14356 </p>
14357 !! end
14358
14359 !! test
14360 Parsoid-only: HTML tag with broken attribute value quoting
14361 !! options
14362 parsoid
14363 !! input
14364 <span title="Hello world>Foo</span>
14365 !! result
14366 <p><span title="Hello world">Foo</span>
14367 </p>
14368 !! end
14369
14370 !! test
14371 Table with broken attribute value quoting
14372 !! input
14373 {|
14374 | title="Hello world|Foo
14375 |}
14376 !! result
14377 <table>
14378 <tr>
14379 <td>Foo
14380 </td></tr></table>
14381
14382 !! end
14383
14384 !! test
14385 Table with broken attribute value quoting on consecutive lines
14386 !! input
14387 {|
14388 | title="Hello world|Foo
14389 | style="color:red|Bar
14390 |}
14391 !! result
14392 <table>
14393 <tr>
14394 <td>Foo
14395 </td>
14396 <td>Bar
14397 </td></tr></table>
14398
14399 !! end
14400
14401 !! test
14402 Parsoid-only: Table with broken attribute value quoting on consecutive lines
14403 !! options
14404 parsoid
14405 !! input
14406 {|
14407 | title="Hello world|Foo
14408 | style="color:red|Bar
14409 |}
14410 !! result
14411 <table>
14412 <tr>
14413 <td title="Hello world">Foo
14414 </td><td style="color: red">Bar
14415 </td></tr></table>
14416
14417 !! end
14418
14419 !! test
14420 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
14421 !! options
14422 parsoid
14423 !! input
14424 {{}}
14425 !! result
14426 {{}}
14427 !! end
14428
14429 !! test
14430 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
14431 !! options
14432 parsoid
14433 !! input
14434 }}{{
14435 !! result
14436 }}{{
14437 !! end
14438
14439 !!test
14440 Accept empty td cell attribute
14441 !!input
14442 {|
14443 | align="center" | foo || |
14444 |}
14445 !!result
14446 <table>
14447 <tr>
14448 <td align="center"> foo </td>
14449 <td>
14450 </td></tr></table>
14451
14452 !!end
14453
14454 !!test
14455 Non-empty attributes in th-cells
14456 !!input
14457 {|
14458 ! Foo !! style="color: red" | Bar
14459 |}
14460 !!result
14461 <table>
14462 <tr>
14463 <th> Foo </th>
14464 <th style="color: red"> Bar
14465 </th></tr></table>
14466
14467 !!end
14468
14469 !!test
14470 Accept empty attributes in th-cells
14471 !!input
14472 {|
14473 !| foo !!| bar
14474 |}
14475 !!result
14476 <table>
14477 <tr>
14478 <th> foo </th>
14479 <th> bar
14480 </th></tr></table>
14481
14482 !!end
14483
14484 !!test
14485 Empty table rows go away
14486 !!input
14487 {|
14488 | Hello
14489 | there
14490 |- class="foo"
14491 |-
14492 |}
14493 !! result
14494 <table>
14495 <tr>
14496 <td> Hello
14497 </td>
14498 <td> there
14499 </td></tr>
14500
14501 </table>
14502
14503 !! end
14504
14505 ###
14506 ### Parsoid-centric tests for testing RTing of inter-element separators
14507 ### Edge cases not tested by existing parser tests and specific to
14508 ### Parsoid-specific serialization strategies.
14509 ###
14510
14511 !!test
14512 RT-ed inter-element separators should be valid separators
14513 !!input
14514 {|
14515 |- [[foo]]
14516 |}
14517 !!result
14518 <table>
14519
14520 </table>
14521
14522 !!end
14523
14524 !!test
14525 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
14526 (Parsoid-only since PHP parser relies on Tidy for correct output)
14527 !!options
14528 parsoid
14529 !!input
14530 {|
14531 |<small>foo
14532 bar
14533 |}
14534
14535 {|
14536 |<small>foo<small>
14537 |}
14538 !!result
14539 !!end
14540
14541 !!test
14542 Empty TD followed by TD with tpl-generated attribute
14543 !!input
14544 {|
14545 |-
14546 |
14547 |{{echo|style='color:red'}}|foo
14548 |}
14549 !!result
14550 <table>
14551
14552 <tr>
14553 <td>
14554 </td>
14555 <td>foo
14556 </td></tr></table>
14557
14558 !!end
14559
14560 !!test
14561 Indented table with an empty td
14562 !!input
14563 {|
14564 |-
14565 |
14566 |foo
14567 |}
14568 !!result
14569 <table>
14570
14571 <tr>
14572 <td>
14573 </td>
14574 <td>foo
14575 </td></tr></table>
14576
14577 !!end
14578
14579 !!test
14580 Empty TR followed by a template-generated TR
14581 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
14582 !!options
14583 parsoid
14584 !!input
14585 {|
14586 |-
14587 {{echo|<tr><td>foo</td></tr>}}
14588 |}
14589 !!result
14590 <table>
14591 <tbody>
14592 <tr>
14593 </tr>
14594 <tr>
14595 <td>foo</td></tr></tbody></table>
14596 !!end
14597
14598 ## PHP and parsoid output differ for this, and since this is primarily
14599 ## for testing Parsoid's serializer, marking this Parsoid only
14600 !!test
14601 Empty TR followed by mixed-ws-comment line should RT correctly
14602 !!options
14603 parsoid
14604 !!input
14605 {|
14606 |-
14607 <!--c-->
14608 |-
14609 <!--c--> <!--d-->
14610 |}
14611 !!result
14612 <table>
14613 <tbody>
14614 <tr>
14615 <td> <!--c--></td></tr>
14616 <tr>
14617 <td><!--c--> <!--d--></td></tr>
14618 </table>
14619
14620 !!end
14621
14622 !!test
14623 Multi-line image caption generated by templates with/without trailing newlines
14624 !!options
14625 parsoid
14626 !!input
14627 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
14628 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
14629 !!result
14630 <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>
14631 <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>
14632
14633 !!end
14634
14635 ## PHP emits broken html for this, and since this is primarily
14636 ## a Parsoid serializer test, marking this Parsoid only
14637 !!test
14638 Improperly nested inline or quotes tags with whitespace in between
14639 !!options
14640 parsoid
14641 !!input
14642 <span> <s>x</span> </s>
14643 ''' ''x''' ''
14644 !!result
14645 <p><span> <s>x</s></span><s> </s>
14646 <b> <i>x</i></b><i> </i></span>
14647 </p>
14648 !!end
14649
14650 TODO:
14651 more images
14652 more tables
14653 character entities
14654 and much more
14655 Try for 100% code coverage