Merge "Simplify the logic to decide whether to show "variant" and "noconvertlink...
[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 an equals sign
3974 !! input
3975 [[Special:BookSources/isbn=4-00-026157-6]]
3976 !! result
3977 <p><a href="/wiki/Special:BookSources/isbn%3D4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a>
3978 </p>
3979 !! end
3980
3981 !! article
3982 Foo~bar
3983 !! text
3984 Just a test of an article title containing a tilde.
3985 !! endarticle
3986
3987 # note that links containing signatures, like [[Foo~~~~]], are
3988 # massaged by the pre-save transform (PST) and so the tildes are never
3989 # seen by the parser.
3990 !! test
3991 Link containing a tilde
3992 !! input
3993 [[Foo~bar]]
3994 !! result
3995 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
3996 </p>
3997 !! end
3998
3999 !! test
4000 Link containing double-single-quotes '' (bug 4598)
4001 !! input
4002 [[Lista d''e paise d''o munno]]
4003 !! result
4004 <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>
4005 </p>
4006 !! end
4007
4008 !! test
4009 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4010 !! input
4011 Some [[Link|pretty ''italics'' and stuff]]!
4012 !! result
4013 <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>!
4014 </p>
4015 !! end
4016
4017 !! test
4018 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4019 !! input
4020 ''Some [[Link|pretty ''italics'' and stuff]]!
4021 !! result
4022 <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>
4023 </p>
4024 !! end
4025
4026 !! test
4027 Link with double quotes in title part (literal) and alternate part (interpreted)
4028 !! input
4029 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4030
4031 [[''Pentecoste'']]
4032
4033 [[''Pentecoste''|Pentecoste]]
4034
4035 [[''Pentecoste''|''Pentecoste'']]
4036 !! result
4037 <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>
4038 </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>
4039 </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>
4040 </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>
4041 </p>
4042 !! end
4043
4044 !! test
4045 Broken image links with HTML captions (bug 39700)
4046 !! input
4047 [[File:Nonexistent|<script></script>]]
4048 [[File:Nonexistent|100px|<script></script>]]
4049 [[File:Nonexistent|&lt;]]
4050 [[File:Nonexistent|a<i>b</i>c]]
4051 !! result
4052 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4053 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4054 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4055 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4056 </p>
4057 !! end
4058
4059 !! test
4060 Plain link to URL
4061 !! input
4062 [[http://www.example.com]]
4063 !! result
4064 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4065 </p>
4066 !! end
4067
4068 !! test
4069 Plain link to URL with link text
4070 !! input
4071 [[http://www.example.com Link text]]
4072 !! result
4073 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4074 </p>
4075 !! end
4076
4077 !! test
4078 Plain link to protocol-relative URL
4079 !! input
4080 [[//www.example.com]]
4081 !! result
4082 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4083 </p>
4084 !! end
4085
4086 !! test
4087 Plain link to protocol-relative URL with link text
4088 !! input
4089 [[//www.example.com Link text]]
4090 !! result
4091 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4092 </p>
4093 !! end
4094
4095 !! test
4096 Plain link to page with question mark in title
4097 !! input
4098 [[A?b]]
4099
4100 [[A?b|Baz]]
4101 !! result
4102 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4103 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4104 </p>
4105 !! end
4106
4107
4108 # I'm fairly sure the expected result here is wrong.
4109 # We want these to be URL links, not pseudo-pages with URLs for titles....
4110 # However the current output is also pretty screwy.
4111 #
4112 # ----
4113 # I'm changing it to match the current output--it arguably makes more
4114 # sense in the light of the test above. Old expected result was:
4115 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4116 #</p>
4117 # But I think this test is bordering on "garbage in, garbage out" anyway.
4118 # -- wtm
4119 !! test
4120 Piped link to URL
4121 !! input
4122 Piped link to URL: [[http://www.example.com|an example URL]]
4123 !! result
4124 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4125 </p>
4126 !! end
4127
4128 !! test
4129 BUG 2: [[page|http://url/]] should link to page, not http://url/
4130 !! input
4131 [[Main Page|http://url/]]
4132 !! result
4133 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4134 </p>
4135 !! end
4136
4137 !! test
4138 BUG 337: Escaped self-links should be bold
4139 !! options
4140 title=[[Bug462]]
4141 !! input
4142 [[Bu&#103;462]] [[Bug462]]
4143 !! result
4144 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4145 </p>
4146 !! end
4147
4148 !! test
4149 Self-link to section should not be bold
4150 !! options
4151 title=[[Main Page]]
4152 !! input
4153 [[Main Page#section]]
4154 !! result
4155 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4156 </p>
4157 !! end
4158
4159 !! article
4160 00
4161 !! text
4162 This is 00.
4163 !! endarticle
4164
4165 !!test
4166 Self-link to numeric title
4167 !!options
4168 title=[[0]]
4169 !!input
4170 [[0]]
4171 !!result
4172 <p><strong class="selflink">0</strong>
4173 </p>
4174 !!end
4175
4176 !!test
4177 Link to numeric-equivalent title
4178 !!options
4179 title=[[0]]
4180 !!input
4181 [[00]]
4182 !!result
4183 <p><a href="/wiki/00" title="00">00</a>
4184 </p>
4185 !!end
4186
4187 !! test
4188 <nowiki> inside a link
4189 !! input
4190 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4191 !! result
4192 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4193 </p>
4194 !! end
4195
4196 !! test
4197 Non-breaking spaces in title
4198 !! input
4199 [[&nbsp; Main &nbsp; Page &nbsp;]]
4200 !! result
4201 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4202 </p>
4203 !!end
4204
4205 !! test
4206 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4207 !! options
4208 language=ca
4209 !! input
4210 '''[[Main Page]]'''
4211 !! result
4212 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4213 </p>
4214 !! end
4215
4216 !! test
4217 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4218 !! options
4219 language=ca
4220 !! input
4221 ''[[Main Page]]''
4222 !! result
4223 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4224 </p>
4225 !! end
4226
4227 !! test
4228 Internal link with en linktrail: no apostrophes (bug 27473)
4229 !! options
4230 language=en
4231 !! input
4232 [[Something]]'nice
4233 !! result
4234 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4235 </p>
4236 !! end
4237
4238 !! test
4239 Internal link with ca linktrail with apostrophes (bug 27473)
4240 !! options
4241 language=ca
4242 !! input
4243 [[Something]]'nice
4244 !! result
4245 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4246 </p>
4247 !! end
4248
4249 !! test
4250 Internal link with kaa linktrail with apostrophes (bug 27473)
4251 !! options
4252 language=kaa
4253 !! input
4254 [[Something]]'nice
4255 !! result
4256 <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>
4257 </p>
4258 !! end
4259
4260 !! article
4261 Söfnuður
4262 !! text
4263 Test.
4264 !! endarticle
4265
4266 !! test
4267 Internal link with is linkprefix
4268 !! options
4269 language=is
4270 !! input
4271 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
4272 !! result
4273 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
4274 </p>
4275 !! end
4276
4277 !! test
4278 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4279 !! input
4280 [[Foo| bar]]
4281
4282 [[Foo| ''bar'']]
4283
4284 [http://wp.org foo]
4285
4286 [http://wp.org ''foo'']
4287 !! result
4288 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
4289 </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>
4290 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4291 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4292 </p>
4293 !! end
4294
4295 ###
4296 ### Interwiki links (see maintenance/interwiki.sql)
4297 ###
4298
4299 !! test
4300 Inline interwiki link
4301 !! input
4302 [[MeatBall:SoftSecurity]]
4303 !! result
4304 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4305 </p>
4306 !! end
4307
4308 !! test
4309 Inline interwiki link with empty title (bug 2372)
4310 !! input
4311 [[MeatBall:]]
4312 !! result
4313 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4314 </p>
4315 !! end
4316
4317 !! test
4318 Interwiki link encoding conversion (bug 1636)
4319 !! input
4320 *[[Wikipedia:ro:Olteni&#0355;a]]
4321 *[[Wikipedia:ro:Olteni&#355;a]]
4322 !! result
4323 <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>
4324 </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>
4325 </li></ul>
4326
4327 !! end
4328
4329 !! test
4330 Interwiki link with fragment (bug 2130)
4331 !! input
4332 [[MeatBall:SoftSecurity#foo]]
4333 !! result
4334 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4335 </p>
4336 !! end
4337
4338 !! test
4339 Interlanguage link
4340 !! input
4341 Blah blah blah
4342 [[zh:Chinese]]
4343 !!result
4344 <p>Blah blah blah
4345 </p>
4346 !! end
4347
4348 !! test
4349 Double interlanguage link
4350 !! input
4351 Blah blah blah
4352 [[es:Spanish]]
4353 [[zh:Chinese]]
4354 !!result
4355 <p>Blah blah blah
4356 </p>
4357 !! end
4358
4359 !! test
4360 Interlanguage link, with prefix links
4361 !! options
4362 language=ln
4363 !! input
4364 Blah blah blah
4365 [[zh:Chinese]]
4366 !!result
4367 <p>Blah blah blah
4368 </p>
4369 !! end
4370
4371 !! test
4372 Double interlanguage link, with prefix links (bug 8897)
4373 !! options
4374 language=ln
4375 !! input
4376 Blah blah blah
4377 [[es:Spanish]]
4378 [[zh:Chinese]]
4379 !!result
4380 <p>Blah blah blah
4381 </p>
4382 !! end
4383
4384 !! test
4385 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4386 !! options
4387 language=ln
4388 !! input
4389 [[WW&nbsp;II]]
4390 !!result
4391 <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>
4392 </p>
4393 !! end
4394
4395 ##
4396 ## XHTML tidiness
4397 ###
4398
4399 !! test
4400 <br> to <br />
4401 !! input
4402 1<br>2<br />3
4403 !! result
4404 <p>1<br />2<br />3
4405 </p>
4406 !! end
4407
4408 !! test
4409 Broken br tag sanitization
4410 !! input
4411 </br>
4412 !! result
4413 <p>&lt;/br&gt;
4414 </p>
4415 !! end
4416
4417 !! test
4418 Incorrecly removing closing slashes from correctly formed XHTML
4419 !! input
4420 <br style="clear:both;" />
4421 !! result
4422 <p><br style="clear:both;" />
4423 </p>
4424 !! end
4425
4426 !! test
4427 Failing to transform badly formed HTML into correct XHTML
4428 !! input
4429 <br style="clear: left;">
4430 <br style="clear: right;">
4431 <br style="clear: both;">
4432 !! result
4433 <p><br style="clear: left;" />
4434 <br style="clear: right;" />
4435 <br style="clear: both;" />
4436 </p>
4437 !!end
4438
4439 !! test
4440 Handling html with a div self-closing tag
4441 !! input
4442 <div title />
4443 <div title/>
4444 <div title/ >
4445 <div title=bar />
4446 <div title=bar/>
4447 <div title=bar/ >
4448 !! result
4449 <p>&lt;div title /&gt;
4450 &lt;div title/&gt;
4451 </p>
4452 <div>
4453 <p>&lt;div title=bar /&gt;
4454 &lt;div title=bar/&gt;
4455 </p>
4456 <div title="bar/"></div>
4457 </div>
4458
4459 !! end
4460
4461 !! test
4462 Handling html with a br self-closing tag
4463 !! input
4464 <br title />
4465 <br title/>
4466 <br title/ >
4467 <br title=bar />
4468 <br title=bar/>
4469 <br title=bar/ >
4470 !! result
4471 <p><br title="title" />
4472 <br title="title" />
4473 <br />
4474 <br title="bar" />
4475 <br title="bar" />
4476 <br title="bar/" />
4477 </p>
4478 !! end
4479
4480 !! test
4481 Horizontal ruler (should it add that extra space?)
4482 !! input
4483 <hr>
4484 <hr >
4485 foo <hr
4486 > bar
4487 !! result
4488 <hr />
4489 <hr />
4490 foo <hr /> bar
4491
4492 !! end
4493
4494 !! test
4495 Horizontal ruler -- 4+ dashes render hr
4496 !! input
4497 ----
4498 !! result
4499 <hr />
4500
4501 !! end
4502
4503 !! test
4504 Horizontal ruler -- eats additional dashes on the same line
4505 !! input
4506 ---------
4507 !! result
4508 <hr />
4509
4510 !! end
4511
4512 !! test
4513 Horizontal ruler -- does not collapse dashes on consecutive lines
4514 !! input
4515 ----
4516 ----
4517 !! result
4518 <hr />
4519 <hr />
4520
4521 !! end
4522
4523 !! test
4524 Horizontal ruler -- <4 dashes render as plain text
4525 !! input
4526 ---
4527 !! result
4528 <p>---
4529 </p>
4530 !! end
4531
4532 !! test
4533 Horizontal ruler -- Supports content following dashes on same line
4534 !! input
4535 ---- Foo
4536 !! result
4537 <hr /> Foo
4538
4539 !! end
4540
4541 ###
4542 ### Block-level elements
4543 ###
4544 !! test
4545 Common list
4546 !! input
4547 *Common list
4548 * item 2
4549 *item 3
4550 !! result
4551 <ul><li>Common list
4552 </li><li> item 2
4553 </li><li>item 3
4554 </li></ul>
4555
4556 !! end
4557
4558 !! test
4559 Numbered list
4560 !! input
4561 #Numbered list
4562 #item 2
4563 # item 3
4564 !! result
4565 <ol><li>Numbered list
4566 </li><li>item 2
4567 </li><li> item 3
4568 </li></ol>
4569
4570 !! end
4571
4572 !! test
4573 Mixed list
4574 !! input
4575 *Mixed list
4576 *# with numbers
4577 ** and bullets
4578 *# and numbers
4579 *bullets again
4580 **bullet level 2
4581 ***bullet level 3
4582 ***#Number on level 4
4583 **bullet level 2
4584 **#Number on level 3
4585 **#Number on level 3
4586 *#number level 2
4587 *Level 1
4588 *** Level 3
4589 #** Level 3, but ordered
4590 !! result
4591 <ul><li>Mixed list
4592 <ol><li> with numbers
4593 </li></ol>
4594 <ul><li> and bullets
4595 </li></ul>
4596 <ol><li> and numbers
4597 </li></ol>
4598 </li><li>bullets again
4599 <ul><li>bullet level 2
4600 <ul><li>bullet level 3
4601 <ol><li>Number on level 4
4602 </li></ol>
4603 </li></ul>
4604 </li><li>bullet level 2
4605 <ol><li>Number on level 3
4606 </li><li>Number on level 3
4607 </li></ol>
4608 </li></ul>
4609 <ol><li>number level 2
4610 </li></ol>
4611 </li><li>Level 1
4612 <ul><li><ul><li> Level 3
4613 </li></ul>
4614 </li></ul>
4615 </li></ul>
4616 <ol><li><ul><li><ul><li> Level 3, but ordered
4617 </li></ul>
4618 </li></ul>
4619 </li></ol>
4620
4621 !! end
4622
4623 !! test
4624 Nested lists 1
4625 !! input
4626 *foo
4627 **bar
4628 !! result
4629 <ul><li>foo
4630 <ul><li>bar
4631 </li></ul>
4632 </li></ul>
4633
4634 !! end
4635
4636 !! test
4637 Nested lists 2
4638 !! input
4639 **foo
4640 *bar
4641 !! result
4642 <ul><li><ul><li>foo
4643 </li></ul>
4644 </li><li>bar
4645 </li></ul>
4646
4647 !! end
4648
4649 !! test
4650 Nested lists 3 (first element empty)
4651 !! input
4652 *
4653 **bar
4654 !! result
4655 <ul><li>
4656 <ul><li>bar
4657 </li></ul>
4658 </li></ul>
4659
4660 !! end
4661
4662 !! test
4663 Nested lists 4 (first element empty)
4664 !! input
4665 **
4666 *bar
4667 !! result
4668 <ul><li><ul><li>
4669 </li></ul>
4670 </li><li>bar
4671 </li></ul>
4672
4673 !! end
4674
4675 !! test
4676 Nested lists 5 (both elements empty)
4677 !! input
4678 **
4679 *
4680 !! result
4681 <ul><li><ul><li>
4682 </li></ul>
4683 </li><li>
4684 </li></ul>
4685
4686 !! end
4687
4688 !! test
4689 Nested lists 6 (both elements empty)
4690 !! input
4691 *
4692 **
4693 !! result
4694 <ul><li>
4695 <ul><li>
4696 </li></ul>
4697 </li></ul>
4698
4699 !! end
4700
4701 !! test
4702 Nested lists 7 (skip initial nesting levels)
4703 !! input
4704 *** foo
4705 !! result
4706 <ul><li><ul><li><ul><li> foo
4707 </li></ul>
4708 </li></ul>
4709 </li></ul>
4710
4711 !! end
4712
4713 !! test
4714 Nested lists 8 (multiple nesting transitions)
4715 !! input
4716 * foo
4717 *** bar
4718 ** baz
4719 * boo
4720 !! result
4721 <ul><li> foo
4722 <ul><li><ul><li> bar
4723 </li></ul>
4724 </li><li> baz
4725 </li></ul>
4726 </li><li> boo
4727 </li></ul>
4728
4729 !! end
4730
4731 !! test
4732 1. Lists with start-of-line-transparent tokens before bullets: Comments
4733 !! input
4734 *foo
4735 *<!--cmt-->bar
4736 <!--cmt-->*baz
4737 !! result
4738 <ul><li>foo
4739 </li><li>bar
4740 </li><li>baz
4741 </li></ul>
4742
4743 !! end
4744
4745 !! test
4746 2. Lists with start-of-line-transparent tokens before bullets: Template close
4747 !! input
4748 *foo {{echo|bar
4749 }}*baz
4750 !! result
4751 <ul><li>foo bar
4752 </li><li>baz
4753 </li></ul>
4754
4755 !! end
4756
4757 !! test
4758 Unbalanced closing block tags break a list
4759 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4760 !! options
4761 disabled
4762 !! input
4763 <div>
4764 *a</div><div>
4765 *b</div>
4766 !! result
4767 <div>
4768 <ul><li>a
4769 </li></ul></div><div>
4770 <ul><li>b
4771 </li></ul></div>
4772 !! end
4773
4774 !! test
4775 Unbalanced closing non-block tags don't break a list
4776 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4777 !! options
4778 disabled
4779 !! input
4780 <span>
4781 *a</span><span>
4782 *b</span>
4783 !! result
4784 <p><span></span>
4785 </p>
4786 <ul><li>a<span></span>
4787 </li><li>b
4788 </li></ul>
4789 !! end
4790
4791 !! test
4792 Unclosed formatting tags that straddle lists are closed and reopened
4793 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4794 !! options
4795 disabled
4796 !! input
4797 # <s> a
4798 # b </s>
4799 !! result
4800 <ol><li> <s> a </s>
4801 </li><li> <s> b </s>
4802 </li></ol>
4803 !! end
4804
4805 !!test
4806 List embedded in a non-block tag
4807 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
4808 !! options
4809 parsoid
4810 !!input
4811 <small>
4812 * foo
4813 </small>
4814 !!result
4815 <p><small></small></p>
4816 <small>
4817 <ul>
4818 <li> foo</li>
4819 </ul>
4820 </small>
4821 <p><small></small></p>
4822 !!end
4823
4824 !! test
4825 List items are not parsed correctly following a <pre> block (bug 785)
4826 !! input
4827 * <pre>foo</pre>
4828 * <pre>bar</pre>
4829 * zar
4830 !! result
4831 <ul><li> <pre>foo</pre>
4832 </li><li> <pre>bar</pre>
4833 </li><li> zar
4834 </li></ul>
4835
4836 !! end
4837
4838 !! test
4839 List items from template
4840 !! input
4841
4842 {{inner list}}
4843 * item 2
4844
4845 * item 0
4846 {{inner list}}
4847 * item 2
4848
4849 * item 0
4850 * notSOL{{inner list}}
4851 * item 2
4852 !! result
4853 <ul><li> item 1
4854 </li><li> item 2
4855 </li></ul>
4856 <ul><li> item 0
4857 </li><li> item 1
4858 </li><li> item 2
4859 </li></ul>
4860 <ul><li> item 0
4861 </li><li> notSOL
4862 </li><li> item 1
4863 </li><li> item 2
4864 </li></ul>
4865
4866 !! end
4867
4868 !! test
4869 List interrupted by empty line or heading
4870 !! input
4871 * foo
4872
4873 ** bar
4874 == A heading ==
4875 * Another list item
4876 !! result
4877 <ul><li> foo
4878 </li></ul>
4879 <ul><li><ul><li> bar
4880 </li></ul>
4881 </li></ul>
4882 <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>
4883 <ul><li> Another list item
4884 </li></ul>
4885
4886 !!end
4887
4888 !!test
4889 Multiple list tags generated by templates
4890 !!input
4891 {{echo|<li>}}a
4892 {{echo|<li>}}b
4893 {{echo|<li>}}c
4894 !!result
4895 <li>a
4896 <li>b
4897 <li>c</li>
4898 </li>
4899 </li>
4900
4901 !!end
4902
4903 !!test
4904 Single-comment whitespace lines dont break lists, but multi-comment whitespace lines do
4905 !!input
4906 *a
4907 <!--This line will NOT split the list-->
4908 *b
4909 <!--This line will NOT split the list either-->
4910 *c
4911 <!--foo--> <!--This line with more than 1 comment will split the list-->
4912 *d
4913 !!result
4914 <ul><li>a
4915 </li><li>b
4916 </li><li>c
4917 </li></ul>
4918 <ul><li>d
4919 </li></ul>
4920
4921 !!end
4922
4923 ###
4924 ### Magic Words
4925 ###
4926
4927 !! test
4928 Magic Word: {{CURRENTDAY}}
4929 !! input
4930 {{CURRENTDAY}}
4931 !! result
4932 <p>1
4933 </p>
4934 !! end
4935
4936 !! test
4937 Magic Word: {{CURRENTDAY2}}
4938 !! input
4939 {{CURRENTDAY2}}
4940 !! result
4941 <p>01
4942 </p>
4943 !! end
4944
4945 !! test
4946 Magic Word: {{CURRENTDAYNAME}}
4947 !! input
4948 {{CURRENTDAYNAME}}
4949 !! result
4950 <p>Thursday
4951 </p>
4952 !! end
4953
4954 !! test
4955 Magic Word: {{CURRENTDOW}}
4956 !! input
4957 {{CURRENTDOW}}
4958 !! result
4959 <p>4
4960 </p>
4961 !! end
4962
4963 !! test
4964 Magic Word: {{CURRENTMONTH}}
4965 !! input
4966 {{CURRENTMONTH}}
4967 !! result
4968 <p>01
4969 </p>
4970 !! end
4971
4972 !! test
4973 Magic Word: {{CURRENTMONTHABBREV}}
4974 !! input
4975 {{CURRENTMONTHABBREV}}
4976 !! result
4977 <p>Jan
4978 </p>
4979 !! end
4980
4981 !! test
4982 Magic Word: {{CURRENTMONTHNAME}}
4983 !! input
4984 {{CURRENTMONTHNAME}}
4985 !! result
4986 <p>January
4987 </p>
4988 !! end
4989
4990 !! test
4991 Magic Word: {{CURRENTMONTHNAMEGEN}}
4992 !! input
4993 {{CURRENTMONTHNAMEGEN}}
4994 !! result
4995 <p>January
4996 </p>
4997 !! end
4998
4999 !! test
5000 Magic Word: {{CURRENTTIME}}
5001 !! input
5002 {{CURRENTTIME}}
5003 !! result
5004 <p>00:02
5005 </p>
5006 !! end
5007
5008 !! test
5009 Magic Word: {{CURRENTWEEK}} (@bug 4594)
5010 !! input
5011 {{CURRENTWEEK}}
5012 !! result
5013 <p>1
5014 </p>
5015 !! end
5016
5017 !! test
5018 Magic Word: {{CURRENTYEAR}}
5019 !! input
5020 {{CURRENTYEAR}}
5021 !! result
5022 <p>1970
5023 </p>
5024 !! end
5025
5026 !! test
5027 Magic Word: {{FULLPAGENAME}}
5028 !! options
5029 title=[[User:Ævar Arnfjörð Bjarmason]]
5030 !! input
5031 {{FULLPAGENAME}}
5032 !! result
5033 <p>User:Ævar Arnfjörð Bjarmason
5034 </p>
5035 !! end
5036
5037 !! test
5038 Magic Word: {{FULLPAGENAMEE}}
5039 !! options
5040 title=[[User:Ævar Arnfjörð Bjarmason]]
5041 !! input
5042 {{FULLPAGENAMEE}}
5043 !! result
5044 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5045 </p>
5046 !! end
5047
5048 !! test
5049 Magic Word: {{NAMESPACE}}
5050 !! options
5051 title=[[User:Ævar Arnfjörð Bjarmason]]
5052 !! input
5053 {{NAMESPACE}}
5054 !! result
5055 <p>User
5056 </p>
5057 !! end
5058
5059 !! test
5060 Magic Word: {{NAMESPACEE}}
5061 !! options
5062 title=[[User:Ævar Arnfjörð Bjarmason]]
5063 !! input
5064 {{NAMESPACEE}}
5065 !! result
5066 <p>User
5067 </p>
5068 !! end
5069
5070 !! test
5071 Magic Word: {{NAMESPACENUMBER}}
5072 !! options
5073 title=[[User:Ævar Arnfjörð Bjarmason]]
5074 !! input
5075 {{NAMESPACENUMBER}}
5076 !! result
5077 <p>2
5078 </p>
5079 !! end
5080
5081 !! test
5082 Magic Word: {{NUMBEROFFILES}}
5083 !! input
5084 {{NUMBEROFFILES}}
5085 !! result
5086 <p>3
5087 </p>
5088 !! end
5089
5090 !! test
5091 Magic Word: {{PAGENAME}}
5092 !! options
5093 title=[[User:Ævar Arnfjörð Bjarmason]]
5094 !! input
5095 {{PAGENAME}}
5096 !! result
5097 <p>Ævar Arnfjörð Bjarmason
5098 </p>
5099 !! end
5100
5101 !! test
5102 Magic Word: {{PAGENAME}} with metacharacters
5103 !! options
5104 title=[['foo & bar = baz']]
5105 !! input
5106 ''{{PAGENAME}}''
5107 !! result
5108 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
5109 </p>
5110 !! end
5111
5112 !! test
5113 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
5114 !! options
5115 title=[[*RFC 1234 http://example.com/]]
5116 !! input
5117 {{PAGENAME}}
5118 !! result
5119 <p>&#42;RFC&#32;1234 http&#58;//example.com/
5120 </p>
5121 !! end
5122
5123 !! test
5124 Magic Word: {{PAGENAMEE}}
5125 !! options
5126 title=[[User:Ævar Arnfjörð Bjarmason]]
5127 !! input
5128 {{PAGENAMEE}}
5129 !! result
5130 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5131 </p>
5132 !! end
5133
5134 !! test
5135 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
5136 !! options
5137 title=[[*RFC 1234 http://example.com/]]
5138 !! input
5139 {{PAGENAMEE}}
5140 !! result
5141 <p>&#42;RFC_1234_http&#58;//example.com/
5142 </p>
5143 !! end
5144
5145 !! test
5146 Magic Word: {{REVISIONID}}
5147 !! input
5148 {{REVISIONID}}
5149 !! result
5150 <p>1337
5151 </p>
5152 !! end
5153
5154 !! test
5155 Magic Word: {{SCRIPTPATH}}
5156 !! input
5157 {{SCRIPTPATH}}
5158 !! result
5159 <p>/
5160 </p>
5161 !! end
5162
5163 !! test
5164 Magic Word: {{SERVER}}
5165 !! input
5166 {{SERVER}}
5167 !! result
5168 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5169 </p>
5170 !! end
5171
5172 !! test
5173 Magic Word: {{SERVERNAME}}
5174 !! input
5175 {{SERVERNAME}}
5176 !! result
5177 <p>example.org
5178 </p>
5179 !! end
5180
5181 !! test
5182 Magic Word: {{SITENAME}}
5183 !! input
5184 {{SITENAME}}
5185 !! result
5186 <p>MediaWiki
5187 </p>
5188 !! end
5189
5190 !! test
5191 Case-sensitive magic words, when cased differently, should just be template transclusions
5192 !! input
5193 {{CurrentMonth}}
5194 {{currentday}}
5195 {{cURreNTweEK}}
5196 {{currentHour}}
5197 !! result
5198 <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>
5199 <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>
5200 <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>
5201 <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>
5202 </p>
5203 !! end
5204
5205 !! test
5206 Case-insensitive magic words should still work with weird casing.
5207 !! input
5208 {{sErVeRNaMe}}
5209 {{LCFirst:AOEU}}
5210 {{ucFIRST:aoeu}}
5211 {{SERver}}
5212 !! result
5213 <p>example.org
5214 aOEU
5215 Aoeu
5216 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5217 </p>
5218 !! end
5219
5220 !! test
5221 Namespace 1 {{ns:1}}
5222 !! input
5223 {{ns:1}}
5224 !! result
5225 <p>Talk
5226 </p>
5227 !! end
5228
5229 !! test
5230 Namespace 1 {{ns:01}}
5231 !! input
5232 {{ns:01}}
5233 !! result
5234 <p>Talk
5235 </p>
5236 !! end
5237
5238 !! test
5239 Namespace 0 {{ns:0}} (bug 4783)
5240 !! input
5241 {{ns:0}}
5242 !! result
5243
5244 !! end
5245
5246 !! test
5247 Namespace 0 {{ns:00}} (bug 4783)
5248 !! input
5249 {{ns:00}}
5250 !! result
5251
5252 !! end
5253
5254 !! test
5255 Namespace -1 {{ns:-1}}
5256 !! input
5257 {{ns:-1}}
5258 !! result
5259 <p>Special
5260 </p>
5261 !! end
5262
5263 !! test
5264 Namespace User {{ns:User}}
5265 !! input
5266 {{ns:User}}
5267 !! result
5268 <p>User
5269 </p>
5270 !! end
5271
5272 !! test
5273 Namespace User talk {{ns:User_talk}}
5274 !! input
5275 {{ns:User_talk}}
5276 !! result
5277 <p>User talk
5278 </p>
5279 !! end
5280
5281 !! test
5282 Namespace User talk {{ns:uSeR tAlK}}
5283 !! input
5284 {{ns:uSeR tAlK}}
5285 !! result
5286 <p>User talk
5287 </p>
5288 !! end
5289
5290 !! test
5291 Namespace File {{ns:File}}
5292 !! input
5293 {{ns:File}}
5294 !! result
5295 <p>File
5296 </p>
5297 !! end
5298
5299 !! test
5300 Namespace File {{ns:Image}}
5301 !! input
5302 {{ns:Image}}
5303 !! result
5304 <p>File
5305 </p>
5306 !! end
5307
5308 !! test
5309 Namespace (lang=de) Benutzer {{ns:User}}
5310 !! options
5311 language=de
5312 !! input
5313 {{ns:User}}
5314 !! result
5315 <p>Benutzer
5316 </p>
5317 !! end
5318
5319 !! test
5320 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
5321 !! options
5322 language=de
5323 !! input
5324 {{ns:3}}
5325 !! result
5326 <p>Benutzer Diskussion
5327 </p>
5328 !! end
5329
5330
5331 !! test
5332 Urlencode
5333 !! input
5334 {{urlencode:hi world?!}}
5335 {{urlencode:hi world?!|WIKI}}
5336 {{urlencode:hi world?!|PATH}}
5337 {{urlencode:hi world?!|QUERY}}
5338 !! result
5339 <p>hi+world%3F%21
5340 hi_world%3F!
5341 hi%20world%3F%21
5342 hi+world%3F%21
5343 </p>
5344 !! end
5345
5346 ###
5347 ### Magic links
5348 ###
5349 !! test
5350 Magic links: internal link to RFC (bug 479)
5351 !! input
5352 [[RFC 123]]
5353 !! result
5354 <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>
5355 </p>
5356 !! end
5357
5358 !! test
5359 Magic links: RFC (bug 479)
5360 !! input
5361 RFC 822
5362 !! result
5363 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
5364 </p>
5365 !! end
5366
5367 !! test
5368 Magic links: ISBN (bug 1937)
5369 !! input
5370 ISBN 0-306-40615-2
5371 !! result
5372 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
5373 </p>
5374 !! end
5375
5376 !! test
5377 Magic links: PMID incorrectly converts space to underscore
5378 !! input
5379 PMID 1234
5380 !! result
5381 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
5382 </p>
5383 !! end
5384
5385 ###
5386 ### Templates
5387 ####
5388
5389 !! test
5390 Nonexistent template
5391 !! input
5392 {{thistemplatedoesnotexist}}
5393 !! result
5394 <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>
5395 </p>
5396 !! end
5397
5398 !! test
5399 Template with invalid target containing tags
5400 !! input
5401 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5402 !! result
5403 <p>{{a<b>b</b>|foo|a=b|a = b}}
5404 </p>
5405 !! end
5406
5407 !! test
5408 Template with invalid target containing unclosed tag
5409 !! input
5410 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5411 !! result
5412 <p>{{a<b>|foo|a=b|a = b}}</b>
5413 </p>
5414 !! end
5415
5416 !! article
5417 Template:test
5418 !! text
5419 This is a test template
5420 !! endarticle
5421
5422 !! test
5423 Simple template
5424 !! input
5425 {{test}}
5426 !! result
5427 <p>This is a test template
5428 </p>
5429 !! end
5430
5431 !! test
5432 Template with explicit namespace
5433 !! input
5434 {{Template:test}}
5435 !! result
5436 <p>This is a test template
5437 </p>
5438 !! end
5439
5440
5441 !! article
5442 Template:paramtest
5443 !! text
5444 This is a test template with parameter {{{param}}}
5445 !! endarticle
5446
5447 !! test
5448 Template parameter
5449 !! input
5450 {{paramtest|param=foo}}
5451 !! result
5452 <p>This is a test template with parameter foo
5453 </p>
5454 !! end
5455
5456 !! article
5457 Template:paramtestnum
5458 !! text
5459 [[{{{1}}}|{{{2}}}]]
5460 !! endarticle
5461
5462 !! test
5463 Template unnamed parameter
5464 !! input
5465 {{paramtestnum|Main Page|the main page}}
5466 !! result
5467 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
5468 </p>
5469 !! end
5470
5471 !! article
5472 Template:templatesimple
5473 !! text
5474 (test)
5475 !! endarticle
5476
5477 !! article
5478 Template:templateredirect
5479 !! text
5480 #redirect [[Template:templatesimple]]
5481 !! endarticle
5482
5483 !! article
5484 Template:templateasargtestnum
5485 !! text
5486 {{{{{1}}}}}
5487 !! endarticle
5488
5489 !! article
5490 Template:templateasargtest
5491 !! text
5492 {{template{{{templ}}}}}
5493 !! endarticle
5494
5495 !! article
5496 Template:templateasargtest2
5497 !! text
5498 {{{{{templ}}}}}
5499 !! endarticle
5500
5501 !! test
5502 Template with template name as unnamed argument
5503 !! input
5504 {{templateasargtestnum|templatesimple}}
5505 !! result
5506 <p>(test)
5507 </p>
5508 !! end
5509
5510 !! test
5511 Template with template name as argument
5512 !! input
5513 {{templateasargtest|templ=simple}}
5514 !! result
5515 <p>(test)
5516 </p>
5517 !! end
5518
5519 !! test
5520 Template with template name as argument (2)
5521 !! input
5522 {{templateasargtest2|templ=templatesimple}}
5523 !! result
5524 <p>(test)
5525 </p>
5526 !! end
5527
5528 !! article
5529 Template:templateasargtestdefault
5530 !! text
5531 {{{{{templ|templatesimple}}}}}
5532 !! endarticle
5533
5534 !! article
5535 Template:templa
5536 !! text
5537 '''templ'''
5538 !! endarticle
5539
5540 !! test
5541 Template with default value
5542 !! input
5543 {{templateasargtestdefault}}
5544 !! result
5545 <p>(test)
5546 </p>
5547 !! end
5548
5549 !! test
5550 Template with default value (value set)
5551 !! input
5552 {{templateasargtestdefault|templ=templa}}
5553 !! result
5554 <p><b>templ</b>
5555 </p>
5556 !! end
5557
5558 !! test
5559 Template redirect
5560 !! input
5561 {{templateredirect}}
5562 !! result
5563 <p>(test)
5564 </p>
5565 !! end
5566
5567 !! test
5568 Template with argument in separate line
5569 !! input
5570 {{ templateasargtest |
5571 templ = simple }}
5572 !! result
5573 <p>(test)
5574 </p>
5575 !! end
5576
5577 !! test
5578 Template with complex template as argument
5579 !! input
5580 {{paramtest|
5581 param ={{ templateasargtest |
5582 templ = simple }}}}
5583 !! result
5584 <p>This is a test template with parameter (test)
5585 </p>
5586 !! end
5587
5588 !! test
5589 Template with thumb image (with link in description)
5590 !! input
5591 {{paramtest|
5592 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
5593 !! result
5594 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>
5595
5596 !! end
5597
5598 !! article
5599 Template:complextemplate
5600 !! text
5601 {{{1}}} {{paramtest|
5602 param ={{{param}}}}}
5603 !! endarticle
5604
5605 !! test
5606 Template with complex arguments
5607 !! input
5608 {{complextemplate|
5609 param ={{ templateasargtest |
5610 templ = simple }}|[[Template:complextemplate|link]]}}
5611 !! result
5612 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
5613 </p>
5614 !! end
5615
5616 !! test
5617 BUG 553: link with two variables in a piped link
5618 !! input
5619 {|
5620 |[[{{{1}}}|{{{2}}}]]
5621 |}
5622 !! result
5623 <table>
5624 <tr>
5625 <td>[[{{{1}}}|{{{2}}}]]
5626 </td></tr></table>
5627
5628 !! end
5629
5630 !! test
5631 Magic variable as template parameter
5632 !! input
5633 {{paramtest|param={{SITENAME}}}}
5634 !! result
5635 <p>This is a test template with parameter MediaWiki
5636 </p>
5637 !! end
5638
5639 !! article
5640 Template:linktest
5641 !! text
5642 [[{{{param}}}|link]]
5643 !! endarticle
5644
5645 !! test
5646 Template parameter as link source
5647 !! input
5648 {{linktest|param=Main Page}}
5649 !! result
5650 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
5651 </p>
5652 !! end
5653
5654 !!test
5655 Template-generated attribute string (k='v')
5656 !!input
5657 <span {{attr_str|id|v1}}>bar</span>
5658 !!result
5659 <p><span id="v1">bar</span>
5660 </p>
5661 !!end
5662
5663 !!article
5664 Template:paramtest2
5665 !! text
5666 including another template, {{paramtest|param={{{arg}}}}}
5667 !! endarticle
5668
5669 !! test
5670 Template passing argument to another template
5671 !! input
5672 {{paramtest2|arg='hmm'}}
5673 !! result
5674 <p>including another template, This is a test template with parameter 'hmm'
5675 </p>
5676 !! end
5677
5678 !! article
5679 Template:Linktest2
5680 !! text
5681 Main Page
5682 !! endarticle
5683
5684 !! test
5685 Template as link source
5686 !! input
5687 [[{{linktest2}}]]
5688
5689 [[{{linktest2}}|Main Page]]
5690
5691 [[{{linktest2}}]]Page
5692 !! result
5693 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5694 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5695 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
5696 </p>
5697 !! end
5698
5699
5700 !! article
5701 Template:loop1
5702 !! text
5703 {{loop2}}
5704 !! endarticle
5705
5706 !! article
5707 Template:loop2
5708 !! text
5709 {{loop1}}
5710 !! endarticle
5711
5712 !! test
5713 Template infinite loop
5714 !! input
5715 {{loop1}}
5716 !! result
5717 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
5718 </p>
5719 !! end
5720
5721 !! test
5722 Template from main namespace
5723 !! input
5724 {{:Main Page}}
5725 !! result
5726 <p>blah blah
5727 </p>
5728 !! end
5729
5730 !! article
5731 Template:table
5732 !! text
5733 {|
5734 | 1 || 2
5735 |-
5736 | 3 || 4
5737 |}
5738 !! endarticle
5739
5740 !! test
5741 BUG 529: Template with table, not included at beginning of line
5742 !! input
5743 foo {{table}}
5744 !! result
5745 <p>foo
5746 </p>
5747 <table>
5748 <tr>
5749 <td> 1 </td>
5750 <td> 2
5751 </td></tr>
5752 <tr>
5753 <td> 3 </td>
5754 <td> 4
5755 </td></tr></table>
5756
5757 !! end
5758
5759 !! test
5760 BUG 523: Template shouldn't eat newline (or add an extra one before table)
5761 !! input
5762 foo
5763 {{table}}
5764 !! result
5765 <p>foo
5766 </p>
5767 <table>
5768 <tr>
5769 <td> 1 </td>
5770 <td> 2
5771 </td></tr>
5772 <tr>
5773 <td> 3 </td>
5774 <td> 4
5775 </td></tr></table>
5776
5777 !! end
5778
5779 !! test
5780 BUG 41: Template parameters shown as broken links
5781 !! input
5782 {{{parameter}}}
5783 !! result
5784 <p>{{{parameter}}}
5785 </p>
5786 !! end
5787
5788 !! test
5789 Template with targets containing wikilinks
5790 !! input
5791 {{[[foo]]}}
5792
5793 {{[[{{echo|foo}}]]}}
5794
5795 {{{{echo|[[foo}}]]}}
5796 !! result
5797 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5798 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5799 </p><p>{{[[foo}}]]
5800 </p>
5801 !! end
5802
5803 !! article
5804 Template:MSGNW test
5805 !! text
5806 ''None'' of '''this''' should be
5807 * interpreted
5808 but rather passed unmodified
5809 {{test}}
5810 !! endarticle
5811
5812 # hmm, fix this or just deprecate msgnw and document its behavior?
5813 !! test
5814 msgnw keyword
5815 !! options
5816 disabled
5817 !! input
5818 {{msgnw:MSGNW test}}
5819 !! result
5820 <p>''None'' of '''this''' should be
5821 * interpreted
5822 but rather passed unmodified
5823 {{test}}
5824 </p>
5825 !! end
5826
5827 !! test
5828 int keyword
5829 !! input
5830 {{int:youhavenewmessages|lots of money|not!}}
5831 !! result
5832 <p>You have lots of money (not!).
5833 </p>
5834 !! end
5835
5836 !! article
5837 Template:Includes
5838 !! text
5839 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5840 !! endarticle
5841
5842 !! test
5843 <includeonly> and <noinclude> being included
5844 !! input
5845 {{Includes}}
5846 !! result
5847 <p>Foobar
5848 </p>
5849 !! end
5850
5851 !! article
5852 Template:Includes2
5853 !! text
5854 <onlyinclude>Foo</onlyinclude>bar
5855 !! endarticle
5856
5857 !! test
5858 <onlyinclude> being included
5859 !! input
5860 {{Includes2}}
5861 !! result
5862 <p>Foo
5863 </p>
5864 !! end
5865
5866
5867 !! article
5868 Template:Includes3
5869 !! text
5870 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
5871 !! endarticle
5872
5873 !! test
5874 <onlyinclude> and <includeonly> being included
5875 !! input
5876 {{Includes3}}
5877 !! result
5878 <p>Foo
5879 </p>
5880 !! end
5881
5882 !! test
5883 <includeonly> and <noinclude> on a page
5884 !! input
5885 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5886 !! result
5887 <p>Foozar
5888 </p>
5889 !! end
5890
5891 !! test
5892 Un-closed <noinclude>
5893 !! input
5894 <noinclude>
5895 !! result
5896 !! end
5897
5898 !! test
5899 <onlyinclude> on a page
5900 !! input
5901 <onlyinclude>Foo</onlyinclude>bar
5902 !! result
5903 <p>Foobar
5904 </p>
5905 !! end
5906
5907 !! test
5908 Un-closed <onlyinclude>
5909 !! input
5910 <onlyinclude>
5911 !! result
5912 !! end
5913
5914 !!test
5915 Self-closed noinclude, includeonly, onlyinclude tags
5916 !!input
5917 <noinclude />
5918 <includeonly />
5919 <onlyinclude />
5920 !!result
5921 <p><br />
5922 </p>
5923 !!end
5924
5925 !!test
5926 Unbalanced includeonly and noinclude tags
5927 !!input
5928 {|
5929 |a</noinclude>
5930 |b</noinclude></noinclude>
5931 |c</noinclude></includeonly>
5932 |d</includeonly></includeonly>
5933 |}
5934 !!result
5935 <table>
5936 <tr>
5937 <td>a
5938 </td>
5939 <td>b
5940 </td>
5941 <td>c&lt;/includeonly&gt;
5942 </td>
5943 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
5944 </td></tr></table>
5945
5946 !!end
5947
5948 !! article
5949 Template:Includeonly section
5950 !! text
5951 <includeonly>
5952 ==Includeonly section==
5953 </includeonly>
5954 ==Section T-1==
5955 !!endarticle
5956
5957 !! test
5958 Bug 6563: Edit link generation for section shown by <includeonly>
5959 !! input
5960 {{includeonly section}}
5961 !! result
5962 <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>
5963 <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>
5964
5965 !! end
5966
5967 # Uses same input as the contents of [[Template:Includeonly section]]
5968 !! test
5969 Bug 6563: Section extraction for section shown by <includeonly>
5970 !! options
5971 section=T-2
5972 !! input
5973 <includeonly>
5974 ==Includeonly section==
5975 </includeonly>
5976 ==Section T-2==
5977 !! result
5978 ==Section T-2==
5979 !! end
5980
5981 !! test
5982 Bug 6563: Edit link generation for section suppressed by <includeonly>
5983 !! input
5984 <includeonly>
5985 ==Includeonly section==
5986 </includeonly>
5987 ==Section 1==
5988 !! result
5989 <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>
5990
5991 !! end
5992
5993 !! test
5994 Bug 6563: Section extraction for section suppressed by <includeonly>
5995 !! options
5996 section=1
5997 !! input
5998 <includeonly>
5999 ==Includeonly section==
6000 </includeonly>
6001 ==Section 1==
6002 !! result
6003 ==Section 1==
6004 !! end
6005
6006 !! test
6007 Un-closed <includeonly>
6008 !! input
6009 <includeonly>
6010 !! result
6011 !! end
6012
6013 ###
6014 ### <includeonly> and <noinclude> in attributes
6015 ###
6016 !!test
6017 0. includeonly around the entire attribute
6018 !!input
6019 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
6020 !!result
6021 <p><span id="v2">bar</span>
6022 </p>
6023 !!end
6024
6025 !!test
6026 1. includeonly in html attr key
6027 !!input
6028 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
6029 !!result
6030 <p><span id="foo">bar</span>
6031 </p>
6032 !!end
6033
6034 !!test
6035 2. includeonly in html attr value
6036 !!input
6037 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
6038 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
6039 !!result
6040 <p><span id="v1">bar</span>
6041 <span id="v1">bar</span>
6042 </p>
6043 !!end
6044
6045 !!test
6046 3. includeonly in part of an attr value
6047 !!input
6048 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
6049 !!result
6050 <p><span style="color:red;">bar</span>
6051 </p>
6052 !!end
6053
6054 ###
6055 ### Testing parsing of templates where a template arg
6056 ### has the same name as the template itself.
6057 ###
6058
6059 !! article
6060 Template:quote
6061 !! text
6062 {{{quote|{{{1}}}}}}
6063 !! endarticle
6064
6065 !!test
6066 Templates: Template Name/Arg clash: 1. Use of positional param
6067 !!input
6068 {{quote|foo}}
6069 !!result
6070 <p>foo
6071 </p>
6072 !!end
6073
6074 !!test
6075 Templates: Template Name/Arg clash: 2. Use of named param
6076 !!input
6077 {{quote|quote=foo}}
6078 !!result
6079 <p>foo
6080 </p>
6081 !!end
6082
6083 !!test
6084 Templates: Template Name/Arg clash: 3. Use of named param with empty input
6085 !!input
6086 {{quote|quote}}
6087 !!result
6088 <p>quote
6089 </p>
6090 !!end
6091
6092 ###
6093 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
6094 ###
6095
6096 !!test
6097 Templates: 1. Simple use
6098 !!input
6099 {{echo|Foo}}
6100 !!result
6101 <p>Foo
6102 </p>
6103 !!end
6104
6105 !!test
6106 Templates: 2. Inside a block tag
6107 !!input
6108 <div>{{echo|Foo}}</div>
6109 !!result
6110 <div>Foo</div>
6111
6112 !!end
6113
6114 !!test
6115 Templates: P-wrapping: 1a. Templates on consecutive lines
6116 !!input
6117 {{echo|Foo}}
6118 {{echo|bar}}
6119 !!result
6120 <p>Foo
6121 bar
6122 </p>
6123 !!end
6124
6125 !!test
6126 Templates: P-wrapping: 1b. Templates on consecutive lines
6127 !!input
6128 Foo
6129
6130 {{echo|bar}}
6131 {{echo|baz}}
6132 !!result
6133 <p>Foo
6134 </p><p>bar
6135 baz
6136 </p>
6137 !!end
6138
6139 !!test
6140 Templates: P-wrapping: 1c. Templates on consecutive lines
6141 !!input
6142 {{echo|Foo}}
6143 {{echo|bar}} <div>baz</div>
6144 !!result
6145 <p>Foo
6146 </p>
6147 bar <div>baz</div>
6148
6149 !!end
6150
6151 !!test
6152 Templates: Inline Text: 1. Multiple tmeplate uses
6153 !!input
6154 {{echo|Foo}}bar{{echo|baz}}
6155 !!result
6156 <p>Foobarbaz
6157 </p>
6158 !!end
6159
6160 !!test
6161 Templates: Inline Text: 2. Back-to-back template uses
6162 !!input
6163 {{echo|Foo}}{{echo|bar}}
6164 !!result
6165 <p>Foobar
6166 </p>
6167 !!end
6168
6169 !!test
6170 Templates: Block Tags: 1. Multiple template uses
6171 !!input
6172 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
6173 !!result
6174 <div>Foo</div><div>bar</div><div>baz</div>
6175
6176 !!end
6177
6178 !!test
6179 Templates: Block Tags: 2. Back-to-back template uses
6180 !!input
6181 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
6182 !!result
6183 <div>Foo</div><div>bar</div>
6184
6185 !!end
6186
6187 !!test
6188 Templates: Links: 1. Simple example
6189 !!input
6190 {{echo|[[Foo|bar]]}}
6191 !!result
6192 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6193 </p>
6194 !!end
6195
6196 !!test
6197 Templates: Links: 2. Generation of link href
6198 !!input
6199 [[{{echo|Foo}}|bar]]
6200 !!result
6201 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6202 </p>
6203 !!end
6204
6205 !!test
6206 Templates: Links: 3. Generation of part of a link href
6207 !!input
6208 [[Fo{{echo|o}}|bar]]
6209
6210 [[Foo{{echo|bar}}]]
6211
6212 [[Foo{{echo|bar}}baz]]
6213
6214 [[Foo{{echo|bar}}|bar]]
6215
6216 [[:Foo{{echo|bar}}]]
6217
6218 [[:Foo{{echo|bar}}|bar]]
6219 !!result
6220 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6221 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6222 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
6223 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6224 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6225 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6226 </p>
6227 !!end
6228
6229 !!test
6230 Templates: Links: 4. Multiple templates generating link href
6231 !!input
6232 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
6233 !!result
6234 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6235 </p>
6236 !!end
6237
6238 !!test
6239 Templates: Links: 5. Generation of link text
6240 !!input
6241 [[Foo|{{echo|bar}}]]
6242 !!result
6243 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6244 </p>
6245 !!end
6246
6247 !!test
6248 Templates: Links: 5. Nested templates (only outermost template should be marked)
6249 !!input
6250 {{echo|[[{{echo|Foo}}|bar]]}}
6251 !!result
6252 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6253 </p>
6254 !!end
6255
6256 !!test
6257 Templates: HTML Tag: 1. Generation of HTML attr. key
6258 !!input
6259 <div {{echo|style}}="color:red;">foo</div>
6260 !!result
6261 <div style="color:red;">foo</div>
6262
6263 !!end
6264
6265 !!test
6266 Templates: HTML Tag: 2. Generation of HTML attr. value
6267 !!input
6268 <div style={{echo|'color:red;'}}>foo</div>
6269 !!result
6270 <div style="color:red;">foo</div>
6271
6272 !!end
6273
6274 !!test
6275 Templates: HTML Tag: 3. Generation of HTML attr key and value
6276 !!input
6277 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
6278 !!result
6279 <div style="color:red;">foo</div>
6280
6281 !!end
6282
6283 !!test
6284 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
6285 !!input
6286 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
6287 !!result
6288 <div title="This is a long title with just one piece templated">foo</div>
6289
6290 !!end
6291
6292 !!test
6293 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
6294 !!input
6295 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
6296 !!result
6297 <div title="This is a long title with just one piece templated">foo</div>
6298
6299 !!end
6300
6301 !!test
6302 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
6303 !!input
6304 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
6305 !!result
6306 <div title="This is a long title with just one piece templated">foo</div>
6307
6308 !!end
6309
6310 !!test
6311 Templates: HTML Tag: 7. Generation of partial attribute key string
6312 !!input
6313 <div st{{echo|yle}}="color:red;">foo</div>
6314 !!result
6315 <div style="color:red;">foo</div>
6316
6317 !!end
6318
6319 !!test
6320 Templates: HTML Tables: 1. Generating start of a HTML table
6321 !!input
6322 {{echo|<table><tr><td>foo</td>}}</tr></table>
6323 !!result
6324 <table><tr><td>foo</td></tr></table>
6325
6326 !!end
6327
6328 !!test
6329 Templates: HTML Tables: 2a. Generating middle of a HTML table
6330 !!input
6331 <table><tr>{{echo|<td>foo</td>}}</tr></table>
6332 !!result
6333 <table><tr><td>foo</td></tr></table>
6334
6335 !!end
6336
6337 !!test
6338 Templates: HTML Tables: 2b. Generating middle of a HTML table
6339 !!input
6340 <table>{{echo|<tr><td>foo</td></tr>}}</table>
6341 !!result
6342 <table><tr><td>foo</td></tr></table>
6343
6344 !!end
6345
6346 !!test
6347 Templates: HTML Tables: 3. Generating end of a HTML table
6348 !!input
6349 <table><tr>{{echo|<td>foo</td></tr></table>}}
6350 !!result
6351 <table><tr><td>foo</td></tr></table>
6352
6353 !!end
6354
6355 !!test
6356 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
6357 !!input
6358 {{echo|<table>}}<tr><td>foo</td></tr></table>
6359 !!result
6360 <table><tr><td>foo</td></tr></table>
6361
6362 !!end
6363
6364 !!test
6365 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
6366 !!input
6367 <table>{{echo|<tr>}}<td>foo</td></tr></table>
6368 !!result
6369 <table><tr><td>foo</td></tr></table>
6370
6371 !!end
6372
6373 !!test
6374 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
6375 !!input
6376 <table><tr>{{echo|<td>}}foo</td></tr></table>
6377 !!result
6378 <table><tr><td>foo</td></tr></table>
6379
6380 !!end
6381
6382 !!test
6383 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
6384 !!input
6385 <table><tr><td>foo{{echo|</td>}}</tr></table>
6386 !!result
6387 <table><tr><td>foo</td></tr></table>
6388
6389 !!end
6390
6391 !!test
6392 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
6393 !!input
6394 <table><tr><td>foo</td>{{echo|</tr>}}</table>
6395 !!result
6396 <table><tr><td>foo</td></tr></table>
6397
6398 !!end
6399
6400 !!test
6401 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
6402 !!input
6403 <table><tr><td>foo</td></tr>{{echo|</table>}}
6404 !!result
6405 <table><tr><td>foo</td></tr></table>
6406
6407 !!end
6408
6409 !!test
6410 Templates: Wiki Tables: 1a. Fostering of entire template content
6411 !!input
6412 {|
6413 {{echo|a}}
6414 |}
6415 !!result
6416 <table>
6417 a
6418 <tr><td></td></tr></table>
6419
6420 !!end
6421
6422 !!test
6423 Templates: Wiki Tables: 1b. Fostering of entire template content
6424 !!input
6425 {|
6426 {{echo|<div>}}
6427 foo
6428 {{echo|</div>}}
6429 |}
6430 !!result
6431 <table>
6432 <div>
6433 <p>foo
6434 </p>
6435 </div>
6436 <tr><td></td></tr></table>
6437
6438 !!end
6439
6440 !!test
6441 Templates: Wiki Tables: 2. Fostering of partial template content
6442 !!input
6443 {|
6444 {{echo|a
6445 <div>b</div>}}
6446 |}
6447 !!result
6448 <table>
6449 a
6450 <div>b</div>
6451 <tr><td></td></tr></table>
6452
6453 !!end
6454
6455 !!test
6456 Templates: Wiki Tables: 3. td-content via multiple templates
6457 !!input
6458 {|
6459 {{echo|{{pipe}}a}}{{echo|b}}
6460 |}
6461 !!result
6462 <table>
6463 <tr>
6464 <td>ab
6465 </td></tr></table>
6466
6467 !!end
6468
6469 !!test
6470 Templates: Wiki Tables: 4. Templated tags, no content
6471 !!input
6472 {{tbl-start}}
6473 {{tbl-end}}
6474 !!result
6475 <table>
6476 <tr><td></td></tr></table>
6477
6478 !!end
6479
6480 !!test
6481 Templates: Wiki Tables: 5. Templated tags, regular td-tags
6482 !!input
6483 {{tbl-start}}
6484 |foo
6485 {{tbl-end}}
6486 !!result
6487 <table>
6488 <tr>
6489 <td>foo
6490 </td></tr></table>
6491
6492 !!end
6493
6494 !!test
6495 Templates: Wiki Tables: 6. Templated tags, templated td-tags
6496 !!input
6497 {{tbl-start}}
6498 {{!}}foo
6499 {{tbl-end}}
6500 !!result
6501 <table>
6502 <tr>
6503 <td>foo
6504 </td></tr></table>
6505
6506 !!end
6507
6508 !!test
6509 Templates: Lists: Multi-line list-items via templates
6510 !!input
6511 *{{echo|a {{nonexistent|
6512 unused}}}}
6513 *{{echo|b {{nonexistent|
6514 unused}}}}
6515 !!result
6516 <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>
6517 </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>
6518 </li></ul>
6519
6520 !!end
6521
6522 !!test
6523 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
6524 !!input
6525 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
6526 !!result
6527 <p><i>ab</i>c<i>d</i>e
6528 </p>
6529 !!end
6530
6531 !!test
6532 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
6533 (PHP parser generates misnested html)
6534 !! options
6535 disabled
6536 !!input
6537 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
6538 !!result
6539 <p><span><i>a</i></span><i><span>b</span></i><span>c</span><i>d</i><span>e</span></p>
6540 !!end
6541
6542 !!test
6543 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
6544 (PHP parser generates misnested html)
6545 !! options
6546 disabled
6547 !!input
6548 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
6549 !!result
6550 <div><i>a</i></div>
6551 <div><i>b</i>c<i>d</i></div>
6552 <div>e</div>
6553 !!end
6554
6555 !!test
6556 Templates: Ugly nesting: 4. Divs opened/closed across templates
6557 !!input
6558 a<div>b{{echo|c</div>d}}e
6559 !!result
6560 a<div>bc</div>de
6561
6562 !!end
6563
6564 !!test
6565 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
6566 (Parsoid-centric)
6567 !! options
6568 parsoid
6569 !!input
6570 {|
6571 |{{echo|foo</table>}}
6572 |bar
6573 |}
6574 !!result
6575 <table about="#mwt1" typeof="mw:Object/Template ">
6576 <tbody><tr><td>foo</td></tr></tbody></table><span about="#mwt1">
6577 bar</span><span about="#mwt1">
6578 </span>
6579 !!end
6580
6581 !!test
6582 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
6583 (Parsoid-centric)
6584 !! options
6585 parsoid
6586 !!input
6587 <table>
6588 <tr>
6589 <td>
6590 <table>
6591 <tr>
6592 <td>1. {{echo|foo </table>}}</td>
6593 <td> bar </td>
6594 <td>2. {{echo|baz </table>}}</td>
6595 </tr>
6596 <tr>
6597 <td>abc</td>
6598 </tr>
6599 </table>
6600 </td>
6601 </tr>
6602 <tr>
6603 <td>xyz</td>
6604 </tr>
6605 </table>
6606 !!result
6607 <table about="#mwt1" typeof="mw:Object/Template">
6608 <tbody><tr >
6609 <td >
6610 <table >
6611 <tbody><tr >
6612 <td >1. foo </td></tr></tbody></table></td>
6613 <td > bar </td>
6614 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
6615 </span><span about="#mwt1">
6616
6617 abc</span><span about="#mwt1">
6618 </span><span about="#mwt1">
6619 </span><span about="#mwt1">
6620 </span><span about="#mwt1">
6621 </span><span about="#mwt1">
6622
6623 xyz</span><span about="#mwt1">
6624 </span><span about="#mwt1">
6625 </span>
6626 !!end
6627
6628 !! test
6629 Templates: Ugly templates: 3. newline-only template parameter
6630 !! input
6631 foo {{echo|
6632 }}
6633 !! result
6634 <p>foo
6635 </p>
6636 !! end
6637
6638 # This looks like a bug: a single newline triggers p/br for some reason.
6639 !! test
6640 Templates: Ugly templates: 4. newline-only template parameter inconsistency
6641 !! input
6642 {{echo|
6643 }}
6644 !! result
6645 <p><br />
6646 </p>
6647 !! end
6648
6649
6650 !!test
6651 Parser Functions: 1. Simple example
6652 !!input
6653 {{uc:foo}}
6654 !!result
6655 <p>FOO
6656 </p>
6657 !!end
6658
6659 !!test
6660 Parser Functions: 2. Nested use (only outermost should be marked up)
6661 !!input
6662 {{uc:{{lc:FOO}}}}
6663 !!result
6664 <p>FOO
6665 </p>
6666 !!end
6667
6668 ###
6669 ### Pre-save transform tests
6670 ###
6671 !! test
6672 pre-save transform: subst:
6673 !! options
6674 PST
6675 !! input
6676 {{subst:test}}
6677 !! result
6678 This is a test template
6679 !! end
6680
6681 !! test
6682 pre-save transform: normal template
6683 !! options
6684 PST
6685 !! input
6686 {{test}}
6687 !! result
6688 {{test}}
6689 !! end
6690
6691 !! test
6692 pre-save transform: nonexistent template
6693 !! options
6694 PST
6695 !! input
6696 {{thistemplatedoesnotexist}}
6697 !! result
6698 {{thistemplatedoesnotexist}}
6699 !! end
6700
6701
6702 !! test
6703 pre-save transform: subst magic variables
6704 !! options
6705 PST
6706 !! input
6707 {{subst:SITENAME}}
6708 !! result
6709 MediaWiki
6710 !! end
6711
6712 # This is bug 89, which I fixed. -- wtm
6713 !! test
6714 pre-save transform: subst: templates with parameters
6715 !! options
6716 pst
6717 !! input
6718 {{subst:paramtest|param="something else"}}
6719 !! result
6720 This is a test template with parameter "something else"
6721 !! end
6722
6723 !! article
6724 Template:nowikitest
6725 !! text
6726 <nowiki>'''not wiki'''</nowiki>
6727 !! endarticle
6728
6729 !! test
6730 pre-save transform: nowiki in subst (bug 1188)
6731 !! options
6732 pst
6733 !! input
6734 {{subst:nowikitest}}
6735 !! result
6736 <nowiki>'''not wiki'''</nowiki>
6737 !! end
6738
6739
6740 !! article
6741 Template:commenttest
6742 !! text
6743 This template has <!-- a comment --> in it.
6744 !! endarticle
6745
6746 !! test
6747 pre-save transform: comment in subst (bug 1936)
6748 !! options
6749 pst
6750 !! input
6751 {{subst:commenttest}}
6752 !! result
6753 This template has <!-- a comment --> in it.
6754 !! end
6755
6756 !! test
6757 pre-save transform: unclosed tag
6758 !! options
6759 pst noxml
6760 !! input
6761 <nowiki>'''not wiki'''
6762 !! result
6763 <nowiki>'''not wiki'''
6764 !! end
6765
6766 !! test
6767 pre-save transform: mixed tag case
6768 !! options
6769 pst noxml
6770 !! input
6771 <NOwiki>'''not wiki'''</noWIKI>
6772 !! result
6773 <NOwiki>'''not wiki'''</noWIKI>
6774 !! end
6775
6776 !! test
6777 pre-save transform: unclosed comment in <nowiki>
6778 !! options
6779 pst noxml
6780 !! input
6781 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6782 !! result
6783 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6784 !!end
6785
6786 !! article
6787 Template:dangerous
6788 !!text
6789 <span onmouseover="alert('crap')">Oh no</span>
6790 !!endarticle
6791
6792 !!test
6793 (confirming safety of fix for subst bug 1936)
6794 !! input
6795 {{Template:dangerous}}
6796 !! result
6797 <p><span>Oh no</span>
6798 </p>
6799 !! end
6800
6801 !! test
6802 pre-save transform: comment containing gallery (bug 5024)
6803 !! options
6804 pst
6805 !! input
6806 <!-- <gallery>data</gallery> -->
6807 !!result
6808 <!-- <gallery>data</gallery> -->
6809 !!end
6810
6811 !! test
6812 pre-save transform: comment containing extension
6813 !! options
6814 pst
6815 !! input
6816 <!-- <tag>data</tag> -->
6817 !!result
6818 <!-- <tag>data</tag> -->
6819 !!end
6820
6821 !! test
6822 pre-save transform: comment containing nowiki
6823 !! options
6824 pst
6825 !! input
6826 <!-- <nowiki>data</nowiki> -->
6827 !!result
6828 <!-- <nowiki>data</nowiki> -->
6829 !!end
6830
6831 !! test
6832 pre-save transform: <noinclude> in subst (bug 3298)
6833 !! options
6834 pst
6835 !! input
6836 {{subst:Includes}}
6837 !! result
6838 Foobar
6839 !! end
6840
6841 !! test
6842 pre-save transform: <onlyinclude> in subst (bug 3298)
6843 !! options
6844 pst
6845 !! input
6846 {{subst:Includes2}}
6847 !! result
6848 Foo
6849 !! end
6850
6851 !! article
6852 Template:SubstTest
6853 !!text
6854 {{<includeonly>subst:</includeonly>Includes}}
6855 !! endarticle
6856
6857 !! article
6858 Template:SafeSubstTest
6859 !! text
6860 {{<includeonly>safesubst:</includeonly>Includes}}
6861 !! endarticle
6862
6863 !! test
6864 bug 22297: safesubst: works during PST
6865 !! options
6866 pst
6867 !! input
6868 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
6869 !! result
6870 FoobarFoobar
6871 !! end
6872
6873 !! test
6874 bug 22297: safesubst: works during normal parse
6875 !! input
6876 {{SafeSubstTest}}
6877 !! result
6878 <p>Foobar
6879 </p>
6880 !! end
6881
6882 !! test:
6883 subst: does not work during normal parse
6884 !! input
6885 {{SubstTest}}
6886 !! result
6887 <p>{{subst:Includes}}
6888 </p>
6889 !! end
6890
6891 !! test
6892 pre-save transform: context links ("pipe trick")
6893 !! options
6894 pst
6895 !! input
6896 [[Article (context)|]]
6897 [[Bar:Article|]]
6898 [[:Bar:Article|]]
6899 [[Bar:Article (context)|]]
6900 [[:Bar:Article (context)|]]
6901 [[|Article]]
6902 [[|Article (context)]]
6903 [[Bar:X (Y) Z|]]
6904 [[:Bar:X (Y) Z|]]
6905 !! result
6906 [[Article (context)|Article]]
6907 [[Bar:Article|Article]]
6908 [[:Bar:Article|Article]]
6909 [[Bar:Article (context)|Article]]
6910 [[:Bar:Article (context)|Article]]
6911 [[Article]]
6912 [[Article (context)]]
6913 [[Bar:X (Y) Z|X (Y) Z]]
6914 [[:Bar:X (Y) Z|X (Y) Z]]
6915 !! end
6916
6917 !! test
6918 pre-save transform: context links ("pipe trick") with interwiki prefix
6919 !! options
6920 pst
6921 !! input
6922 [[interwiki:Article|]]
6923 [[:interwiki:Article|]]
6924 [[interwiki:Bar:Article|]]
6925 [[:interwiki:Bar:Article|]]
6926 !! result
6927 [[interwiki:Article|Article]]
6928 [[:interwiki:Article|Article]]
6929 [[interwiki:Bar:Article|Bar:Article]]
6930 [[:interwiki:Bar:Article|Bar:Article]]
6931 !! end
6932
6933 !! test
6934 pre-save transform: context links ("pipe trick") with parens in title
6935 !! options
6936 pst title=[[Somearticle (context)]]
6937 !! input
6938 [[|Article]]
6939 !! result
6940 [[Article (context)|Article]]
6941 !! end
6942
6943 !! test
6944 pre-save transform: context links ("pipe trick") with comma in title
6945 !! options
6946 pst title=[[Someplace, Somewhere]]
6947 !! input
6948 [[|Otherplace]]
6949 [[Otherplace, Elsewhere|]]
6950 [[Otherplace, Elsewhere, Anywhere|]]
6951 !! result
6952 [[Otherplace, Somewhere|Otherplace]]
6953 [[Otherplace, Elsewhere|Otherplace]]
6954 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
6955 !! end
6956
6957 !! test
6958 pre-save transform: context links ("pipe trick") with parens and comma
6959 !! options
6960 pst title=[[Someplace (IGNORED), Somewhere]]
6961 !! input
6962 [[|Otherplace]]
6963 [[Otherplace (place), Elsewhere|]]
6964 !! result
6965 [[Otherplace, Somewhere|Otherplace]]
6966 [[Otherplace (place), Elsewhere|Otherplace]]
6967 !! end
6968
6969 !! test
6970 pre-save transform: context links ("pipe trick") with comma and parens
6971 !! options
6972 pst title=[[Who, me? (context)]]
6973 !! input
6974 [[|Yes, you.]]
6975 [[Me, Myself, and I (1937 song)|]]
6976 !! result
6977 [[Yes, you. (context)|Yes, you.]]
6978 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
6979 !! end
6980
6981 !! test
6982 pre-save transform: context links ("pipe trick") with namespace
6983 !! options
6984 pst title=[[Ns:Somearticle]]
6985 !! input
6986 [[|Article]]
6987 !! result
6988 [[Ns:Article|Article]]
6989 !! end
6990
6991 !! test
6992 pre-save transform: context links ("pipe trick") with namespace and parens
6993 !! options
6994 pst title=[[Ns:Somearticle (context)]]
6995 !! input
6996 [[|Article]]
6997 !! result
6998 [[Ns:Article (context)|Article]]
6999 !! end
7000
7001 !! test
7002 pre-save transform: context links ("pipe trick") with namespace and comma
7003 !! options
7004 pst title=[[Ns:Somearticle, Context, Whatever]]
7005 !! input
7006 [[|Article]]
7007 !! result
7008 [[Ns:Article, Context, Whatever|Article]]
7009 !! end
7010
7011 !! test
7012 pre-save transform: context links ("pipe trick") with namespace, comma and parens
7013 !! options
7014 pst title=[[Ns:Somearticle, Context (context)]]
7015 !! input
7016 [[|Article]]
7017 !! result
7018 [[Ns:Article (context)|Article]]
7019 !! end
7020
7021 !! test
7022 pre-save transform: context links ("pipe trick") with namespace, parens and comma
7023 !! options
7024 pst title=[[Ns:Somearticle (IGNORED), Context]]
7025 !! input
7026 [[|Article]]
7027 !! result
7028 [[Ns:Article, Context|Article]]
7029 !! end
7030
7031 !! test
7032 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
7033 !! options
7034 pst
7035 !! input
7036 [[Article(context)|]]
7037 [[Bar:Article(context)|]]
7038 [[:Bar:Article(context)|]]
7039 [[|Article(context)]]
7040 [[Bar:X(Y)Z|]]
7041 [[:Bar:X(Y)Z|]]
7042 !! result
7043 [[Article(context)|Article]]
7044 [[Bar:Article(context)|Article]]
7045 [[:Bar:Article(context)|Article]]
7046 [[Article(context)]]
7047 [[Bar:X(Y)Z|X(Y)Z]]
7048 [[:Bar:X(Y)Z|X(Y)Z]]
7049 !! end
7050
7051 !! test
7052 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
7053 !! options
7054 pst
7055 !! input
7056 [[Article (context)|]]
7057 [[Bar:Article (context)|]]
7058 [[:Bar:Article (context)|]]
7059 [[|Article (context)]]
7060 [[Bar:X (Y) Z|]]
7061 [[:Bar:X (Y) Z|]]
7062 !! result
7063 [[Article (context)|Article]]
7064 [[Bar:Article (context)|Article]]
7065 [[:Bar:Article (context)|Article]]
7066 [[Article (context)]]
7067 [[Bar:X (Y) Z|X (Y) Z]]
7068 [[:Bar:X (Y) Z|X (Y) Z]]
7069 !! end
7070
7071 !! test
7072 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
7073 !! options
7074 pst
7075 !! input
7076 [[Article(context)|]]
7077 [[Bar:Article(context)|]]
7078 [[:Bar:Article(context)|]]
7079 [[|Article(context)]]
7080 [[Bar:X(Y)Z|]]
7081 [[:Bar:X(Y)Z|]]
7082 !! result
7083 [[Article(context)|Article]]
7084 [[Bar:Article(context)|Article]]
7085 [[:Bar:Article(context)|Article]]
7086 [[Article(context)]]
7087 [[Bar:X(Y)Z|X(Y)Z]]
7088 [[:Bar:X(Y)Z|X(Y)Z]]
7089 !! end
7090
7091 !! test
7092 pre-save transform: context links ("pipe trick") with commas (bug 21660)
7093 !! options
7094 pst
7095 !! input
7096 [[Article (context), context|]]
7097 [[Article (context),context|]]
7098 [[Bar:Article (context), context|]]
7099 [[Bar:Article (context),context|]]
7100 [[:Bar:Article (context), context|]]
7101 [[:Bar:Article (context),context|]]
7102 !! result
7103 [[Article (context), context|Article]]
7104 [[Article (context),context|Article]]
7105 [[Bar:Article (context), context|Article]]
7106 [[Bar:Article (context),context|Article]]
7107 [[:Bar:Article (context), context|Article]]
7108 [[:Bar:Article (context),context|Article]]
7109 !! end
7110
7111 !! test
7112 pre-save transform: trim trailing empty lines
7113 !! options
7114 pst
7115 !! input
7116 Empty lines are trimmed
7117
7118
7119
7120
7121 !! result
7122 Empty lines are trimmed
7123 !! end
7124
7125 !! test
7126 pre-save transform: Signature expansion
7127 !! options
7128 pst
7129 !! input
7130 * ~~~
7131 * <noinclude>~~~</noinclude>
7132 * <includeonly>~~~</includeonly>
7133 * <onlyinclude>~~~</onlyinclude>
7134 !! result
7135 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
7136 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
7137 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
7138 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
7139 !! end
7140
7141
7142 !! test
7143 pre-save transform: Signature expansion in nowiki tags (bug 93)
7144 !! options
7145 pst disabled
7146 !! input
7147 Shall not expand:
7148
7149 <nowiki>~~~~</nowiki>
7150
7151 <includeonly><nowiki>~~~~</nowiki></includeonly>
7152
7153 <noinclude><nowiki>~~~~</nowiki></noinclude>
7154
7155 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7156
7157 {{subst:Foo}} shall be converted to FOO
7158
7159 As well as inside noinclude/onlyinclude
7160 <noinclude>{{subst:Foo}}</noinclude>
7161 <onlyinclude>{{subst:Foo}}</onlyinclude>
7162
7163 But not inside includeonly
7164 <includeonly>{{subst:Foo}}</includeonly>
7165 !! result
7166 Shall not expand:
7167
7168 <nowiki>~~~~</nowiki>
7169
7170 <includeonly><nowiki>~~~~</nowiki></includeonly>
7171
7172 <noinclude><nowiki>~~~~</nowiki></noinclude>
7173
7174 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7175
7176 FOO shall be converted to FOO
7177
7178 As well as inside noinclude/onlyinclude
7179 <noinclude>FOO</noinclude>
7180 <onlyinclude>FOO</onlyinclude>
7181
7182 But not inside includeonly
7183 <includeonly>{{subst:Foo}}</includeonly>
7184 !! end
7185
7186 ###
7187 ### Message transform tests
7188 ###
7189 !! test
7190 message transform: magic variables
7191 !! options
7192 msg
7193 !! input
7194 {{SITENAME}}
7195 !! result
7196 MediaWiki
7197 !! end
7198
7199 !! test
7200 message transform: should not transform wiki markup
7201 !! options
7202 msg
7203 !! input
7204 ''test''
7205 !! result
7206 ''test''
7207 !! end
7208
7209 !! test
7210 message transform: <noinclude> in transcluded template (bug 4926)
7211 !! options
7212 msg
7213 !! input
7214 {{Includes}}
7215 !! result
7216 Foobar
7217 !! end
7218
7219 !! test
7220 message transform: <onlyinclude> in transcluded template (bug 4926)
7221 !! options
7222 msg
7223 !! input
7224 {{Includes2}}
7225 !! result
7226 Foo
7227 !! end
7228
7229 !! test
7230 {{#special:}} page name, known
7231 !! options
7232 msg
7233 !! input
7234 {{#special:Recentchanges}}
7235 !! result
7236 Special:RecentChanges
7237 !! end
7238
7239 !! test
7240 {{#special:}} page name with subpage, known
7241 !! options
7242 msg
7243 !! input
7244 {{#special:Recentchanges/param}}
7245 !! result
7246 Special:RecentChanges/param
7247 !! end
7248
7249 !! test
7250 {{#special:}} page name, unknown
7251 !! options
7252 msg
7253 !! input
7254 {{#special:foobarnonexistent}}
7255 !! result
7256 No such special page
7257 !! end
7258
7259 !! test
7260 {{#speciale:}} page name, known
7261 !! options
7262 msg
7263 !! input
7264 {{#speciale:Recentchanges}}
7265 !! result
7266 Special:RecentChanges
7267 !! end
7268
7269 !! test
7270 {{#speciale:}} page name with subpage, known
7271 !! options
7272 msg
7273 !! input
7274 {{#speciale:Recentchanges/param}}
7275 !! result
7276 Special:RecentChanges/param
7277 !! end
7278
7279 !! test
7280 {{#speciale:}} page name, unknown
7281 !! options
7282 msg
7283 !! input
7284 {{#speciale:foobarnonexistent}}
7285 !! result
7286 No_such_special_page
7287 !! end
7288
7289 ###
7290 ### Images
7291 ###
7292 !! test
7293 Simple image
7294 !! input
7295 [[Image:foobar.jpg]]
7296 !! result
7297 <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>
7298 </p>
7299 !! end
7300
7301 !! test
7302 Right-aligned image
7303 !! input
7304 [[Image:foobar.jpg|right]]
7305 !! result
7306 <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>
7307
7308 !! end
7309
7310 !! test
7311 Simple image (using File: namespace, now canonical)
7312 !! input
7313 [[File:foobar.jpg]]
7314 !! result
7315 <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>
7316 </p>
7317 !! end
7318
7319 !! test
7320 Image with caption
7321 !! input
7322 [[Image:foobar.jpg|right|Caption text]]
7323 !! result
7324 <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>
7325
7326 !! end
7327
7328 !! test
7329 Image with empty attribute
7330 !! input
7331 [[Image:foobar.jpg|right||Caption text]]
7332 !! result
7333 <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>
7334
7335 !! end
7336
7337 !! test
7338 Image with link tails
7339 !! input
7340 123[[Image:foobar.jpg]]456
7341 123[[Image:foobar.jpg|right]]456
7342 123[[Image:foobar.jpg|thumb]]456
7343 !! result
7344 <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
7345 </p>
7346 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
7347 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
7348
7349 !! end
7350
7351 !! test
7352 Image with multiple captions -- only last one is accepted
7353 !! input
7354 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
7355 !! result
7356 <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>
7357
7358 !! end
7359
7360 !! test
7361 Image with width attribute at different positions
7362 !! input
7363 [[Image:foobar.jpg|200px|right|Caption]]
7364 [[Image:foobar.jpg|right|200px|Caption]]
7365 [[Image:foobar.jpg|right|Caption|200px]]
7366 !! result
7367 <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>
7368 <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>
7369 <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>
7370
7371 !! end
7372
7373 !! test
7374 Image with link parameter, wiki target
7375 !! input
7376 [[Image:foobar.jpg|link=Target page]]
7377 !! result
7378 <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>
7379 </p>
7380 !! end
7381
7382 !! test
7383 Image with link parameter, URL target
7384 !! input
7385 [[Image:foobar.jpg|link=http://example.com/]]
7386 !! result
7387 <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>
7388 </p>
7389 !! end
7390
7391 !! test
7392 Image with link parameter, wgExternalLinkTarget
7393 !! input
7394 [[Image:foobar.jpg|link=http://example.com/]]
7395 !! config
7396 wgExternalLinkTarget='foobar'
7397 !! result
7398 <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>
7399 </p>
7400 !! end
7401
7402 !! test
7403 Image with link parameter, wgNoFollowLinks set to false
7404 !! input
7405 [[Image:foobar.jpg|link=http://example.com/]]
7406 !! config
7407 wgNoFollowLinks=false
7408 !! result
7409 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7410 </p>
7411 !! end
7412
7413 !! test
7414 Image with link parameter, wgNoFollowDomainExceptions
7415 !! input
7416 [[Image:foobar.jpg|link=http://example.com/]]
7417 !! config
7418 wgNoFollowDomainExceptions='example.com'
7419 !! result
7420 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7421 </p>
7422 !! end
7423
7424 !! test
7425 Image with link parameter, wgExternalLinkTarget, unnamed parameter
7426 !! input
7427 [[Image:foobar.jpg|link=http://example.com/|Title]]
7428 !! config
7429 wgExternalLinkTarget='foobar'
7430 !! result
7431 <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>
7432 </p>
7433 !! end
7434
7435 !! test
7436 Image with empty link parameter
7437 !! input
7438 [[Image:foobar.jpg|link=]]
7439 !! result
7440 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
7441 </p>
7442 !! end
7443
7444 !! test
7445 Image with link parameter (wiki target) and unnamed parameter
7446 !! input
7447 [[Image:foobar.jpg|link=Target page|Title]]
7448 !! result
7449 <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>
7450 </p>
7451 !! end
7452
7453 !! test
7454 Image with link parameter (URL target) and unnamed parameter
7455 !! input
7456 [[Image:foobar.jpg|link=http://example.com/|Title]]
7457 !! result
7458 <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>
7459 </p>
7460 !! end
7461
7462 !! test
7463 Thumbnail image with link parameter
7464 !! options
7465 php
7466 !! input
7467 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
7468 !! result
7469 <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>
7470
7471 !! end
7472
7473 !! test
7474 Manually-specified thumbnail image
7475 !! options
7476 php
7477 !! input
7478 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
7479 !! result
7480 <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>
7481
7482 !! end
7483
7484 !! test
7485 Manually-specified thumbnail image with explicit link to wiki page
7486 !! options
7487 php
7488 !! input
7489 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
7490 !! result
7491 <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>
7492
7493 !! end
7494
7495 !! test
7496 Manually-specified thumbnail image with explicit link to url
7497 !! options
7498 php
7499 !! input
7500 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
7501 !! result
7502 <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>
7503
7504 !! end
7505
7506 !! test
7507 Manually-specified thumbnail image with explicit no link
7508 !! options
7509 php
7510 !! input
7511 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
7512 !! result
7513 <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>
7514
7515 !! end
7516
7517 !! test
7518 Manually-specified thumbnail image with explicit link and alt text
7519 !! options
7520 php
7521 !! input
7522 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
7523 !! result
7524 <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>
7525
7526 !! end
7527
7528 !! test
7529 Image with frame and link
7530 !! input
7531 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
7532 !! result
7533 <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>
7534
7535 !! end
7536
7537 !! test
7538 Image with frame and link and explicit alt
7539 !! input
7540 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
7541 !! result
7542 <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>
7543
7544 !! end
7545
7546 !! test
7547 Image with wiki markup in implicit alt
7548 !! input
7549 [[Image:Foobar.jpg|testing '''bold''' in alt]]
7550 !! result
7551 <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>
7552 </p>
7553 !! end
7554
7555 !! test
7556 Image with wiki markup in explicit alt
7557 !! input
7558 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
7559 !! result
7560 <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>
7561 </p>
7562 !! end
7563
7564 !! test
7565 Link to image page- image page normally doesn't exists, hence edit link
7566 Add test with existing image page
7567 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
7568 !! input
7569 [[:Image:test]]
7570 !! result
7571 <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>
7572 </p>
7573 !! end
7574
7575 !! test
7576 bug 18784 Link to non-existent image page with caption should use caption as link text
7577 !! input
7578 [[:Image:test|caption]]
7579 !! result
7580 <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>
7581 </p>
7582 !! end
7583
7584 !! test
7585 Frameless image caption with a free URL
7586 !! input
7587 [[Image:foobar.jpg|http://example.com]]
7588 !! result
7589 <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>
7590 </p>
7591 !! end
7592
7593 !! test
7594 Thumbnail image caption with a free URL
7595 !! input
7596 [[Image:foobar.jpg|thumb|http://example.com]]
7597 !! result
7598 <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>
7599
7600 !! end
7601
7602 !! test
7603 Thumbnail image caption with a free URL and explicit alt
7604 !! input
7605 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
7606 !! result
7607 <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>
7608
7609 !! end
7610
7611 !! test
7612 BUG 1887: A ISBN with a thumbnail
7613 !! input
7614 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
7615 !! result
7616 <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>
7617
7618 !! end
7619
7620 !! test
7621 BUG 1887: A RFC with a thumbnail
7622 !! input
7623 [[Image:foobar.jpg|thumb|This is RFC 12354]]
7624 !! result
7625 <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>
7626
7627 !! end
7628
7629 !! test
7630 BUG 1887: A mailto link with a thumbnail
7631 !! input
7632 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
7633 !! result
7634 <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>
7635
7636 !! end
7637
7638 # Pending resolution to bug 368
7639 !! test
7640 BUG 648: Frameless image caption with a link
7641 !! input
7642 [[Image:foobar.jpg|text with a [[link]] in it]]
7643 !! result
7644 <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>
7645 </p>
7646 !! end
7647
7648 !! test
7649 BUG 648: Frameless image caption with a link (suffix)
7650 !! input
7651 [[Image:foobar.jpg|text with a [[link]]foo in it]]
7652 !! result
7653 <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>
7654 </p>
7655 !! end
7656
7657 !! test
7658 BUG 648: Frameless image caption with an interwiki link
7659 !! input
7660 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
7661 !! result
7662 <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>
7663 </p>
7664 !! end
7665
7666 !! test
7667 BUG 648: Frameless image caption with a piped interwiki link
7668 !! input
7669 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
7670 !! result
7671 <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>
7672 </p>
7673 !! end
7674
7675 !! test
7676 Escape HTML special chars in image alt text
7677 !! input
7678 [[Image:foobar.jpg|& < > "]]
7679 !! result
7680 <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>
7681 </p>
7682 !! end
7683
7684 !! test
7685 BUG 499: Alt text should have &#1234;, not &amp;1234;
7686 !! input
7687 [[Image:foobar.jpg|&#9792;]]
7688 !! result
7689 <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>
7690 </p>
7691 !! end
7692
7693 !! test
7694 Broken image caption with link
7695 !! input
7696 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
7697 !! result
7698 <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.
7699 </p>
7700 !! end
7701
7702 !! test
7703 Image caption containing another image
7704 !! input
7705 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
7706 !! result
7707 <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>
7708
7709 !! end
7710
7711 !! test
7712 Image caption containing a newline
7713 !! input
7714 [[Image:Foobar.jpg|This
7715 *is some text]]
7716 !! result
7717 <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>
7718 </p>
7719 !!end
7720
7721 !!test
7722 Parsoid: Image caption containing leading space
7723 (The leading space should not trigger nowiki escaping in wt2wt mode)
7724 !! input
7725 [[Image:Foobar.jpg|thumb| bar]]
7726 !! result
7727 <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>
7728
7729 !!end
7730
7731 !! test
7732 Bug 3090: External links other than http: in image captions
7733 !! input
7734 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
7735 !! result
7736 <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>
7737
7738 !! end
7739
7740 !! test
7741 Custom class
7742 !! input
7743 [[Image:foobar.jpg|a|class=b]]
7744 !! result
7745 <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>
7746 </p>
7747 !! end
7748
7749 !! test
7750 Localized image handling (1).
7751 !! options
7752 language=es
7753 !! input
7754 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
7755 !! result
7756 <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>
7757
7758 !! end
7759
7760 !! test
7761 Localized image handling (2).
7762 !! options
7763 language=es
7764 !! input
7765 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
7766 !! result
7767 <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>
7768
7769 !! end
7770
7771 !! test
7772 "border", "frameless" and "class" attributes on an image.
7773 !! input
7774 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
7775 !! result
7776 <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>
7777 </p>
7778 !! end
7779
7780 !! article
7781 File:Barfoo.jpg
7782 !! text
7783 #REDIRECT [[File:Barfoo.jpg]]
7784 !! endarticle
7785
7786 !! test
7787 Redirected image
7788 !! input
7789 [[Image:Barfoo.jpg]]
7790 !! result
7791 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
7792 </p>
7793 !! end
7794
7795 !! test
7796 Missing image with uploads disabled
7797 !! options
7798 wgEnableUploads=0
7799 !! input
7800 [[Image:Foobaz.jpg]]
7801 !! result
7802 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
7803 </p>
7804 !! end
7805
7806
7807 ###
7808 ### Subpages
7809 ###
7810 !! article
7811 Subpage test/subpage
7812 !! text
7813 foo
7814 !! endarticle
7815
7816 !! test
7817 Subpage link
7818 !! options
7819 subpage title=[[Subpage test]]
7820 !! input
7821 [[/subpage]]
7822 !! result
7823 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
7824 </p>
7825 !! end
7826
7827 !! test
7828 Subpage noslash link
7829 !! options
7830 subpage title=[[Subpage test]]
7831 !!input
7832 [[/subpage/]]
7833 !! result
7834 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
7835 </p>
7836 !! end
7837
7838 !! test
7839 Disabled subpages
7840 !! input
7841 [[/subpage]]
7842 !! result
7843 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
7844 </p>
7845 !! end
7846
7847 !! test
7848 BUG 561: {{/Subpage}}
7849 !! options
7850 subpage title=[[Page]]
7851 !! input
7852 {{/Subpage}}
7853 !! result
7854 <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>
7855 </p>
7856 !! end
7857
7858 ###
7859 ### Categories
7860 ###
7861 !! article
7862 Category:MediaWiki User's Guide
7863 !! text
7864 blah
7865 !! endarticle
7866
7867 !! test
7868 Link to category
7869 !! input
7870 [[:Category:MediaWiki User's Guide]]
7871 !! result
7872 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
7873 </p>
7874 !! end
7875
7876 !! test
7877 Simple category
7878 !! options
7879 cat
7880 !! input
7881 [[Category:MediaWiki User's Guide]]
7882 !! result
7883 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7884 !! end
7885
7886 !! test
7887 PAGESINCATEGORY invalid title fatal (r33546 fix)
7888 !! input
7889 {{PAGESINCATEGORY:<bogus>}}
7890 !! result
7891 <p>0
7892 </p>
7893 !! end
7894
7895 !! test
7896 Category with different sort key
7897 !! options
7898 cat
7899 !! input
7900 [[Category:MediaWiki User's Guide|Foo]]
7901 !! result
7902 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7903 !! end
7904
7905 !! test
7906 Category with identical sort key
7907 !! options
7908 cat
7909 !! input
7910 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7911 !! result
7912 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7913 !! end
7914
7915 !! test
7916 Category with empty sort key
7917 !! options
7918 cat
7919 pst
7920 !! input
7921 [[Category:MediaWiki User's Guide|]]
7922 !! result
7923 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7924 !! end
7925
7926 !! test
7927 Category with empty sort key and parentheses
7928 !! options
7929 cat
7930 pst
7931 !! input
7932 [[Category:Foo (bar)|]]
7933 !! result
7934 [[Category:Foo (bar)|Foo]]
7935 !! end
7936
7937 !! test
7938 Category with link tail
7939 !! options
7940 cat
7941 pst
7942 !! input
7943 123[[Category:Foo]]456
7944 !! result
7945 123[[Category:Foo]]456
7946 !! end
7947
7948 !! test
7949 Category with template
7950 !! options
7951 cat
7952 pst
7953 !! input
7954 [[Category:{{echo|Foo}}]]
7955 !! result
7956 [[Category:{{echo|Foo}}]]
7957 !! end
7958
7959 !! test
7960 Category with template in sort key
7961 !! options
7962 cat
7963 pst
7964 !! input
7965 [[Category:Foo|{{echo|Bar}}]]
7966 !! result
7967 [[Category:Foo|{{echo|Bar}}]]
7968 !! end
7969
7970 !! test
7971 Category with template in sort key and title
7972 !! options
7973 cat
7974 pst
7975 !! input
7976 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
7977 !! result
7978 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
7979 !! end
7980
7981 !! test
7982 Category / paragraph interactions
7983 !! input
7984 Foo [[Category:Baz]] Bar
7985
7986 Foo [[Category:Baz]]
7987 Bar
7988
7989 Foo
7990 [[Category:Baz]]
7991 Bar
7992
7993 Foo
7994 [[Category:Baz]] Bar
7995
7996 Foo
7997 [[Category:Baz]]
7998 [[Category:Baz]]
7999 [[Category:Baz]]
8000 Bar
8001
8002 [[Category:Baz]]
8003 [[Category:Baz]]
8004 [[Category:Baz]]
8005
8006 [[Category:Baz]]
8007 {{echo|[[Category:Baz]]}}
8008 [[Category:Baz]]
8009 !! result
8010 <p>Foo Bar
8011 </p><p>Foo
8012 Bar
8013 </p><p>Foo
8014 Bar
8015 </p><p>Foo Bar
8016 </p><p>Foo
8017 Bar
8018 </p>
8019 !! end
8020
8021 ###
8022 ### Inter-language links
8023 ###
8024 !! test
8025 Inter-language links
8026 !! options
8027 ill
8028 !! input
8029 [[es:Alimento]]
8030 [[fr:Nourriture]]
8031 [[zh:&#39135;&#21697;]]
8032 !! result
8033 es:Alimento fr:Nourriture zh:食品
8034 !! end
8035
8036 !! test
8037 Duplicate interlanguage links (bug 24502)
8038 !! options
8039 ill
8040 !! input
8041 [[es:1]]
8042 [[es:2]]
8043 [[fr:1]]
8044 [[fr:2]]
8045 !! result
8046 es:1 fr:1
8047 !! end
8048
8049 ###
8050 ### Sections
8051 ###
8052 !! test
8053 Basic section headings
8054 !! input
8055 == Headline 1 ==
8056 Some text
8057
8058 ==Headline 2==
8059 More
8060 ===Smaller headline===
8061 Blah blah
8062 !! result
8063 <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>
8064 <p>Some text
8065 </p>
8066 <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>
8067 <p>More
8068 </p>
8069 <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>
8070 <p>Blah blah
8071 </p>
8072 !! end
8073
8074 !! test
8075 Section headings with TOC
8076 !! input
8077 == Headline 1 ==
8078 === Subheadline 1 ===
8079 ===== Skipping a level =====
8080 ====== Skipping a level ======
8081
8082 == Headline 2 ==
8083 Some text
8084 ===Another headline===
8085 !! result
8086 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8087 <ul>
8088 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
8089 <ul>
8090 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
8091 <ul>
8092 <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>
8093 <ul>
8094 <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>
8095 </ul>
8096 </li>
8097 </ul>
8098 </li>
8099 </ul>
8100 </li>
8101 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
8102 <ul>
8103 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
8104 </ul>
8105 </li>
8106 </ul>
8107 </td></tr></table>
8108 <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>
8109 <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>
8110 <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>
8111 <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>
8112 <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>
8113 <p>Some text
8114 </p>
8115 <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>
8116
8117 !! end
8118
8119 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
8120 !! test
8121 Handling of sections up to level 6 and beyond
8122 !! input
8123 = Level 1 Heading=
8124 == Level 2 Heading==
8125 === Level 3 Heading===
8126 ==== Level 4 Heading====
8127 ===== Level 5 Heading=====
8128 ====== Level 6 Heading======
8129 ======= Level 7 Heading=======
8130 ======== Level 8 Heading========
8131 ========= Level 9 Heading=========
8132 ========== Level 10 Heading==========
8133 !! result
8134 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8135 <ul>
8136 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
8137 <ul>
8138 <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>
8139 <ul>
8140 <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>
8141 <ul>
8142 <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>
8143 <ul>
8144 <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>
8145 <ul>
8146 <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>
8147 <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>
8148 <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>
8149 <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>
8150 <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>
8151 </ul>
8152 </li>
8153 </ul>
8154 </li>
8155 </ul>
8156 </li>
8157 </ul>
8158 </li>
8159 </ul>
8160 </li>
8161 </ul>
8162 </td></tr></table>
8163 <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>
8164 <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>
8165 <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>
8166 <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>
8167 <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>
8168 <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>
8169 <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>
8170 <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>
8171 <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>
8172 <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>
8173
8174 !! end
8175
8176 !! test
8177 TOC regression (bug 9764)
8178 !! input
8179 == title 1 ==
8180 === title 1.1 ===
8181 ==== title 1.1.1 ====
8182 === title 1.2 ===
8183 == title 2 ==
8184 === title 2.1 ===
8185 !! result
8186 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8187 <ul>
8188 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8189 <ul>
8190 <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>
8191 <ul>
8192 <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>
8193 </ul>
8194 </li>
8195 <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>
8196 </ul>
8197 </li>
8198 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8199 <ul>
8200 <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>
8201 </ul>
8202 </li>
8203 </ul>
8204 </td></tr></table>
8205 <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>
8206 <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>
8207 <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>
8208 <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>
8209 <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>
8210 <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>
8211
8212 !! end
8213
8214 !! test
8215 TOC with wgMaxTocLevel=3 (bug 6204)
8216 !! options
8217 wgMaxTocLevel=3
8218 !! input
8219 == title 1 ==
8220 === title 1.1 ===
8221 ==== title 1.1.1 ====
8222 === title 1.2 ===
8223 == title 2 ==
8224 === title 2.1 ===
8225 !! result
8226 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8227 <ul>
8228 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8229 <ul>
8230 <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>
8231 <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>
8232 </ul>
8233 </li>
8234 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8235 <ul>
8236 <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>
8237 </ul>
8238 </li>
8239 </ul>
8240 </td></tr></table>
8241 <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>
8242 <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>
8243 <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>
8244 <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>
8245 <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>
8246 <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>
8247
8248 !! end
8249
8250 !! test
8251 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
8252 !! options
8253 wgMaxTocLevel=3
8254 !! input
8255 ==Section 1==
8256 ===Section 1.1===
8257 ====Section 1.1.1====
8258 ====Section 1.1.1.1====
8259 ==Section 2==
8260 !! result
8261 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8262 <ul>
8263 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
8264 <ul>
8265 <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>
8266 </ul>
8267 </li>
8268 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
8269 </ul>
8270 </td></tr></table>
8271 <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>
8272 <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>
8273 <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>
8274 <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>
8275 <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>
8276
8277 !! end
8278
8279
8280 !! test
8281 Resolving duplicate section names
8282 !! input
8283 == Foo bar ==
8284 == Foo bar ==
8285 !! result
8286 <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>
8287 <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>
8288
8289 !! end
8290
8291 !! test
8292 Resolving duplicate section names with differing case (bug 10721)
8293 !! input
8294 == Foo bar ==
8295 == Foo Bar ==
8296 !! result
8297 <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>
8298 <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>
8299
8300 !! end
8301
8302 !! article
8303 Template:sections
8304 !! text
8305 ===Section 1===
8306 ==Section 2==
8307 !! endarticle
8308
8309 !! test
8310 Template with sections, __NOTOC__
8311 !! input
8312 __NOTOC__
8313 ==Section 0==
8314 {{sections}}
8315 ==Section 4==
8316 !! result
8317 <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>
8318 <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>
8319 <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>
8320 <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>
8321
8322 !! end
8323
8324 !! test
8325 __NOEDITSECTION__ keyword
8326 !! input
8327 __NOEDITSECTION__
8328 ==Section 1==
8329 ==Section 2==
8330 !! result
8331 <h2> <span class="mw-headline" id="Section_1">Section 1</span></h2>
8332 <h2> <span class="mw-headline" id="Section_2">Section 2</span></h2>
8333
8334 !! end
8335
8336 !! test
8337 Link inside a section heading
8338 !! input
8339 ==Section with a [[Main Page|link]] in it==
8340 !! result
8341 <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>
8342
8343 !! end
8344
8345 !! test
8346 TOC regression (bug 12077)
8347 !! input
8348 __TOC__
8349 == title 1 ==
8350 === title 1.1 ===
8351 == title 2 ==
8352 !! result
8353 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8354 <ul>
8355 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8356 <ul>
8357 <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>
8358 </ul>
8359 </li>
8360 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
8361 </ul>
8362 </td></tr></table>
8363 <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>
8364 <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>
8365 <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>
8366
8367 !! end
8368
8369 !! test
8370 BUG 1219 URL next to image (good)
8371 !! input
8372 http://example.com [[Image:foobar.jpg]]
8373 !! result
8374 <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>
8375 </p>
8376 !!end
8377
8378 !! test
8379 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
8380 !! input
8381 ===
8382 The line above must have a trailing space!
8383 === <!--
8384 --> <!-- -->
8385 But just in case it doesn't...
8386 !! result
8387 <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>
8388 <p>The line above must have a trailing space!
8389 </p>
8390 <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>
8391 <p>But just in case it doesn't...
8392 </p>
8393 !! end
8394
8395 !! test
8396 Header with special characters (bug 25462)
8397 !! input
8398 The tooltips shall not show entities to the user (ie. be double escaped)
8399
8400 == text > text ==
8401 section 1
8402
8403 == text < text ==
8404 section 2
8405
8406 == text & text ==
8407 section 3
8408
8409 == text ' text ==
8410 section 4
8411
8412 == text " text ==
8413 section 5
8414 !! result
8415 <p>The tooltips shall not show entities to the user (ie. be double escaped)
8416 </p>
8417 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8418 <ul>
8419 <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>
8420 <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>
8421 <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>
8422 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
8423 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
8424 </ul>
8425 </td></tr></table>
8426 <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>
8427 <p>section 1
8428 </p>
8429 <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>
8430 <p>section 2
8431 </p>
8432 <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>
8433 <p>section 3
8434 </p>
8435 <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>
8436 <p>section 4
8437 </p>
8438 <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>
8439 <p>section 5
8440 </p>
8441 !! end
8442
8443 !! test
8444 Headers with excess '=' characters
8445 (Are similar tests necessary beyond the 1st level?)
8446 !! input
8447 =foo==
8448 ==foo=
8449 =''italic'' heading==
8450 ==''italic'' heading=
8451 !! result
8452 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8453 <ul>
8454 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
8455 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
8456 <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>
8457 <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>
8458 </ul>
8459 </td></tr></table>
8460 <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>
8461 <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>
8462 <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>
8463 <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>
8464
8465 !! end
8466
8467 !! test
8468 HTML headers vs TOC (bug 23393)
8469 (__NOEDITSECTION__ for clearer output, doesn't matter here)
8470 !! input
8471 <h1>Header 1</h1>
8472 == Header 1.1 ==
8473 == Header 1.2 ==
8474
8475 <h1>Header 2
8476 </h1>
8477 == Header 2.1 ==
8478 == Header 2.2 ==
8479 __NOEDITSECTION__
8480 !! result
8481 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8482 <ul>
8483 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
8484 <ul>
8485 <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>
8486 <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>
8487 </ul>
8488 </li>
8489 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
8490 <ul>
8491 <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>
8492 <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>
8493 </ul>
8494 </li>
8495 </ul>
8496 </td></tr></table>
8497 <h1> <span class="mw-headline" id="Header_1">Header 1</span></h1>
8498 <h2> <span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
8499 <h2> <span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
8500 <h1> <span class="mw-headline" id="Header_2">Header 2</span></h1>
8501 <h2> <span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
8502 <h2> <span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
8503
8504 !! end
8505
8506 !! test
8507 BUG 1219 URL next to image (broken)
8508 !! input
8509 http://example.com[[Image:foobar.jpg]]
8510 !! result
8511 <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>
8512 </p>
8513 !!end
8514
8515 !! test
8516 Bug 1186 news: in the middle of text
8517 !! input
8518 http://en.wikinews.org/wiki/Wikinews:Workplace
8519 !! result
8520 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
8521 </p>
8522 !!end
8523
8524
8525 !! test
8526 Namespaced link must have a title
8527 !! input
8528 [[Project:]]
8529 !! result
8530 <p>[[Project:]]
8531 </p>
8532 !!end
8533
8534 !! test
8535 Namespaced link must have a title (bad fragment version)
8536 !! input
8537 [[Project:#fragment]]
8538 !! result
8539 <p>[[Project:#fragment]]
8540 </p>
8541 !!end
8542
8543
8544 ###
8545 ### HTML tags and HTML attributes
8546 ###
8547
8548 !! test
8549 div with no attributes
8550 !! input
8551 <div>HTML rocks</div>
8552 !! result
8553 <div>HTML rocks</div>
8554
8555 !! end
8556
8557 !! test
8558 div with double-quoted attribute
8559 !! input
8560 <div id="rock">HTML rocks</div>
8561 !! result
8562 <div id="rock">HTML rocks</div>
8563
8564 !! end
8565
8566 !! test
8567 div with single-quoted attribute
8568 !! input
8569 <div id='rock'>HTML rocks</div>
8570 !! result
8571 <div id="rock">HTML rocks</div>
8572
8573 !! end
8574
8575 !! test
8576 div with unquoted attribute
8577 !! input
8578 <div id=rock>HTML rocks</div>
8579 !! result
8580 <div id="rock">HTML rocks</div>
8581
8582 !! end
8583
8584 !! test
8585 div with illegal double attributes
8586 !! input
8587 <div id="a" id="b">HTML rocks</div>
8588 !! result
8589 <div id="b">HTML rocks</div>
8590
8591 !!end
8592
8593 # FIXME: produce empty string instead of "class" in the PHP parser, following
8594 # the HTML5 spec.
8595 !! test
8596 div with empty attribute value, space before equals
8597 !! options
8598 disabled
8599 !! input
8600 <div class =>HTML rocks</div>
8601 !! result
8602 <div class="">HTML rocks</div>
8603
8604 !! end
8605
8606 # The PHP parser escapes the opening brace to &#123; for some reason, so
8607 # disabled this test for it.
8608 !! test
8609 div with braces in attribute value
8610 !! options
8611 disabled
8612 !! input
8613 <div title="{}">Foo</div>
8614 !! result
8615 <div title="{}">Foo</div>
8616 !! end
8617
8618 # This it very inconsistent in the PHP parser: it returns
8619 # class="class" if there is a space between the name and the equal sign (see
8620 # 'div with empty attribute value, space before equals'), but strips the
8621 # attribute completely if the space is missing. We hope that not much content
8622 # depends on this, so are implementing the behavior below in Parsoid for
8623 # consistencies' sake. Disabled for the PHP parser.
8624 # FIXME: fix this behavior in the PHP parser?
8625 !! test
8626 div with empty attribute value, no space before equals
8627 !! options
8628 disabled
8629 !! input
8630 <div class=>HTML rocks</div>
8631 !! result
8632 <div class="">HTML rocks</div>
8633
8634 !! end
8635
8636 !! test
8637 HTML multiple attributes correction
8638 !! input
8639 <p class="error" class="awesome">Awesome!</p>
8640 !! result
8641 <p class="awesome">Awesome!</p>
8642
8643 !!end
8644
8645 !! test
8646 Table multiple attributes correction
8647 !! input
8648 {|
8649 !+ class="error" class="awesome"| status
8650 |}
8651 !! result
8652 <table>
8653 <tr>
8654 <th class="awesome"> status
8655 </th></tr></table>
8656
8657 !!end
8658
8659 !! test
8660 DIV IN UPPERCASE
8661 !! input
8662 <DIV ID="x">HTML ROCKS</DIV>
8663 !! result
8664 <div id="x">HTML ROCKS</div>
8665
8666 !!end
8667
8668 !! test
8669 Non-ASCII pseudo-tags are rendered as text
8670 !! input
8671 <khyô>
8672 !! result
8673 <p>&lt;khyô&gt;
8674 </p>
8675 !! end
8676
8677 !! test
8678 Pseudo-tag with URL 'name' renders as url link
8679 !! input
8680 <http://example.com/>
8681 !! result
8682 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
8683 </p>
8684 !! end
8685
8686 !! test
8687 text with amp in the middle of nowhere
8688 !! input
8689 Remember AT&T?
8690 !!result
8691 <p>Remember AT&amp;T?
8692 </p>
8693 !! end
8694
8695 !! test
8696 text with character entity: eacute
8697 !! input
8698 I always thought &eacute; was a cute letter.
8699 !! result
8700 <p>I always thought &#233; was a cute letter.
8701 </p>
8702 !! end
8703
8704 !! test
8705 text with entity-escaped character entity-like string: eacute
8706 !! input
8707 I always thought &amp;eacute; was a cute letter.
8708 !! result
8709 <p>I always thought &amp;eacute; was a cute letter.
8710 </p>
8711 !! end
8712
8713 !! test
8714 text with undefined character entity: xacute
8715 !! input
8716 I always thought &xacute; was a cute letter.
8717 !! result
8718 <p>I always thought &amp;xacute; was a cute letter.
8719 </p>
8720 !! end
8721
8722
8723 ###
8724 ### Media links
8725 ###
8726
8727 !! test
8728 Media link
8729 !! input
8730 [[Media:Foobar.jpg]]
8731 !! result
8732 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
8733 </p>
8734 !! end
8735
8736 !! test
8737 Media link with text
8738 !! input
8739 [[Media:Foobar.jpg|A neat file to look at]]
8740 !! result
8741 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
8742 </p>
8743 !! end
8744
8745 # FIXME: this is still bad HTML tag nesting
8746 !! test
8747 Media link with nasty text
8748 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
8749 !! input
8750 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
8751 !! result
8752 <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>
8753
8754 !! end
8755
8756 !! test
8757 Media link to nonexistent file (bug 1702)
8758 !! input
8759 [[Media:No such.jpg]]
8760 !! result
8761 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
8762 </p>
8763 !! end
8764
8765 !! test
8766 Image link to nonexistent file (bug 1850 - good)
8767 !! input
8768 [[Image:No such.jpg]]
8769 !! result
8770 <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>
8771 </p>
8772 !! end
8773
8774 !! test
8775 :Image link to nonexistent file (bug 1850 - bad)
8776 !! input
8777 [[:Image:No such.jpg]]
8778 !! result
8779 <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>
8780 </p>
8781 !! end
8782
8783
8784
8785 !! test
8786 Character reference normalization in link text (bug 1938)
8787 !! input
8788 [[Main Page|this&that]]
8789 !! result
8790 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
8791 </p>
8792 !!end
8793
8794 !! article
8795 אַ
8796 !! text
8797 Test for unicode normalization
8798
8799 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
8800 !! endarticle
8801
8802 !! test
8803 (bug 19451) Links should refer to the normalized form.
8804 !! input
8805 [[&#xFB2E;]]
8806 [[&#x5d0;&#x5b7;]]
8807 [[&#x5d0;ַ]]
8808 [[א&#x5b7;]]
8809 [[אַ]]
8810 !! result
8811 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
8812 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
8813 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
8814 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
8815 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
8816 </p>
8817 !! end
8818
8819 !! test
8820 Empty attribute crash test (bug 2067)
8821 !! input
8822 <font color="">foo</font>
8823 !! result
8824 <p><font color="">foo</font>
8825 </p>
8826 !! end
8827
8828 !! test
8829 Empty attribute crash test single-quotes (bug 2067)
8830 !! input
8831 <font color=''>foo</font>
8832 !! result
8833 <p><font color="">foo</font>
8834 </p>
8835 !! end
8836
8837 !! test
8838 Attribute test: equals, then nothing
8839 !! input
8840 <font color=>foo</font>
8841 !! result
8842 <p><font>foo</font>
8843 </p>
8844 !! end
8845
8846 !! test
8847 Attribute test: unquoted value
8848 !! input
8849 <font color=x>foo</font>
8850 !! result
8851 <p><font color="x">foo</font>
8852 </p>
8853 !! end
8854
8855 !! test
8856 Attribute test: unquoted but illegal value (hash)
8857 !! input
8858 <font color=#x>foo</font>
8859 !! result
8860 <p><font color="#x">foo</font>
8861 </p>
8862 !! end
8863
8864 !! test
8865 Attribute test: no value
8866 !! input
8867 <font color>foo</font>
8868 !! result
8869 <p><font color="color">foo</font>
8870 </p>
8871 !! end
8872
8873 !! test
8874 Bug 2095: link with three closing brackets
8875 !! input
8876 [[Main Page]]]
8877 !! result
8878 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
8879 </p>
8880 !! end
8881
8882 !! test
8883 Bug 2095: link with pipe and three closing brackets
8884 !! input
8885 [[Main Page|link]]]
8886 !! result
8887 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
8888 </p>
8889 !! end
8890
8891 !! test
8892 Bug 2095: link with pipe and three closing brackets, version 2
8893 !! input
8894 [[Main Page|[http://example.com/]]]
8895 !! result
8896 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
8897 </p>
8898 !! end
8899
8900
8901 ###
8902 ### Safety
8903 ###
8904
8905 !! article
8906 Template:Dangerous attribute
8907 !! text
8908 " onmouseover="alert(document.cookie)
8909 !! endarticle
8910
8911 !! article
8912 Template:Dangerous style attribute
8913 !! text
8914 border-size: expression(alert(document.cookie))
8915 !! endarticle
8916
8917 !! article
8918 Template:Div style
8919 !! text
8920 <div style="float: right; {{{1}}}">Magic div</div>
8921 !! endarticle
8922
8923 !! test
8924 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
8925 !! input
8926 <div title="{{test}}"></div>
8927 !! result
8928 <div title="This is a test template"></div>
8929
8930 !! end
8931
8932 !! test
8933 Bug 2304: HTML attribute safety (dangerous template; 2309)
8934 !! input
8935 <div title="{{dangerous attribute}}"></div>
8936 !! result
8937 <div title=""></div>
8938
8939 !! end
8940
8941 !! test
8942 Bug 2304: HTML attribute safety (dangerous style template; 2309)
8943 !! input
8944 <div style="{{dangerous style attribute}}"></div>
8945 !! result
8946 <div style="/* insecure input */"></div>
8947
8948 !! end
8949
8950 !! test
8951 Bug 2304: HTML attribute safety (safe parameter; 2309)
8952 !! input
8953 {{div style|width: 200px}}
8954 !! result
8955 <div style="float: right; width: 200px">Magic div</div>
8956
8957 !! end
8958
8959 !! test
8960 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
8961 !! input
8962 {{div style|width: expression(alert(document.cookie))}}
8963 !! result
8964 <div style="/* insecure input */">Magic div</div>
8965
8966 !! end
8967
8968 !! test
8969 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
8970 !! input
8971 {{div style|"><script>alert(document.cookie)</script>}}
8972 !! result
8973 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
8974
8975 !! end
8976
8977 !! test
8978 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
8979 !! input
8980 {{div style|" ><script>alert(document.cookie)</script>}}
8981 !! result
8982 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
8983
8984 !! end
8985
8986 !! test
8987 Bug 2304: HTML attribute safety (link)
8988 !! input
8989 <div title="[[Main Page]]"></div>
8990 !! result
8991 <div title="&#91;&#91;Main Page]]"></div>
8992
8993 !! end
8994
8995 !! test
8996 Bug 2304: HTML attribute safety (italics)
8997 !! input
8998 <div title="''foobar''"></div>
8999 !! result
9000 <div title="&#39;&#39;foobar&#39;&#39;"></div>
9001
9002 !! end
9003
9004 !! test
9005 Bug 2304: HTML attribute safety (bold)
9006 !! input
9007 <div title="'''foobar'''"></div>
9008 !! result
9009 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
9010
9011 !! end
9012
9013
9014 !! test
9015 Bug 2304: HTML attribute safety (ISBN)
9016 !! input
9017 <div title="ISBN 1234567890"></div>
9018 !! result
9019 <div title="&#73;SBN 1234567890"></div>
9020
9021 !! end
9022
9023 !! test
9024 Bug 2304: HTML attribute safety (RFC)
9025 !! input
9026 <div title="RFC 1234"></div>
9027 !! result
9028 <div title="&#82;FC 1234"></div>
9029
9030 !! end
9031
9032 !! test
9033 Bug 2304: HTML attribute safety (PMID)
9034 !! input
9035 <div title="PMID 1234567890"></div>
9036 !! result
9037 <div title="&#80;MID 1234567890"></div>
9038
9039 !! end
9040
9041 !! test
9042 Bug 2304: HTML attribute safety (web link)
9043 !! input
9044 <div title="http://example.com/"></div>
9045 !! result
9046 <div title="http&#58;//example.com/"></div>
9047
9048 !! end
9049
9050 !! test
9051 Bug 2304: HTML attribute safety (named web link)
9052 !! input
9053 <div title="[http://example.com/ link]"></div>
9054 !! result
9055 <div title="&#91;http&#58;//example.com/ link]"></div>
9056
9057 !! end
9058
9059 !! test
9060 Bug 3244: HTML attribute safety (extension; safe)
9061 !! input
9062 <div style="<nowiki>background:blue</nowiki>"></div>
9063 !! result
9064 <div style="background:blue"></div>
9065
9066 !! end
9067
9068 !! test
9069 Bug 3244: HTML attribute safety (extension; unsafe)
9070 !! input
9071 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
9072 !! result
9073 <div style="/* insecure input */"></div>
9074
9075 !! end
9076
9077 # More MSIE fun discovered by Tom Gilder
9078
9079 !! test
9080 MSIE CSS safety test: spurious slash
9081 !! input
9082 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
9083 !! result
9084 <div style="/* insecure input */">evil</div>
9085
9086 !! end
9087
9088 !! test
9089 MSIE CSS safety test: hex code
9090 !! input
9091 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
9092 !! result
9093 <div style="/* insecure input */">evil</div>
9094
9095 !! end
9096
9097 !! test
9098 MSIE CSS safety test: comment in url
9099 !! input
9100 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
9101 !! result
9102 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
9103
9104 !! end
9105
9106 !! test
9107 MSIE CSS safety test: comment in expression
9108 !! input
9109 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
9110 !! result
9111 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
9112
9113 !! end
9114
9115
9116 !! test
9117 Table attribute legitimate extension
9118 !! input
9119 {|
9120 !+ style="<nowiki>color:blue</nowiki>"| status
9121 |}
9122 !! result
9123 <table>
9124 <tr>
9125 <th style="color:blue"> status
9126 </th></tr></table>
9127
9128 !!end
9129
9130 !! test
9131 Table attribute safety
9132 !! input
9133 {|
9134 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
9135 |}
9136 !! result
9137 <table>
9138 <tr>
9139 <th style="/* insecure input */"> status
9140 </th></tr></table>
9141
9142 !! end
9143
9144 !! test
9145 CSS line continuation 1
9146 !! input
9147 <div style="background-image: u\&#10;rl(test.jpg);"></div>
9148 !! result
9149 <div style="/* insecure input */"></div>
9150
9151 !! end
9152
9153 !! test
9154 CSS line continuation 2
9155 !! input
9156 <div style="background-image: u\&#13;rl(test.jpg); "></div>
9157 !! result
9158 <div style="/* insecure input */"></div>
9159
9160 !! end
9161
9162 !! article
9163 Template:Identity
9164 !! text
9165 {{{1}}}
9166 !! endarticle
9167
9168 !! test
9169 Expansion of multi-line templates in attribute values (bug 6255)
9170 !! input
9171 <div style="background: {{identity|#00FF00}}">-</div>
9172 !! result
9173 <div style="background: #00FF00">-</div>
9174
9175 !! end
9176
9177
9178 !! test
9179 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
9180 !! input
9181 <div style="background:
9182 #00FF00">-</div>
9183 !! result
9184 <div style="background: #00FF00">-</div>
9185
9186 !! end
9187
9188 !! test
9189 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
9190 !! input
9191 <div style="background: &#10;#00FF00">-</div>
9192 !! result
9193 <div style="background: &#10;#00FF00">-</div>
9194
9195 !! end
9196
9197 ###
9198 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
9199 ###
9200 !! test
9201 Parser hook: empty input
9202 !! input
9203 <tag></tag>
9204 !! result
9205 <pre>
9206 ''
9207 array (
9208 )
9209 </pre>
9210
9211 !! end
9212
9213 !! test
9214 Parser hook: empty input using terminated empty elements
9215 !! input
9216 <tag/>
9217 !! result
9218 <pre>
9219 NULL
9220 array (
9221 )
9222 </pre>
9223
9224 !! end
9225
9226 !! test
9227 Parser hook: empty input using terminated empty elements (space before)
9228 !! input
9229 <tag />
9230 !! result
9231 <pre>
9232 NULL
9233 array (
9234 )
9235 </pre>
9236
9237 !! end
9238
9239 !! test
9240 Parser hook: basic input
9241 !! input
9242 <tag>input</tag>
9243 !! result
9244 <pre>
9245 'input'
9246 array (
9247 )
9248 </pre>
9249
9250 !! end
9251
9252
9253 !! test
9254 Parser hook: case insensitive
9255 !! input
9256 <TAG>input</TAG>
9257 !! result
9258 <pre>
9259 'input'
9260 array (
9261 )
9262 </pre>
9263
9264 !! end
9265
9266
9267 !! test
9268 Parser hook: case insensitive, redux
9269 !! input
9270 <TaG>input</TAg>
9271 !! result
9272 <pre>
9273 'input'
9274 array (
9275 )
9276 </pre>
9277
9278 !! end
9279
9280 !! test
9281 Parser hook: nested tags
9282 !! options
9283 noxml
9284 !! input
9285 <tag><tag></tag></tag>
9286 !! result
9287 <pre>
9288 '<tag>'
9289 array (
9290 )
9291 </pre>&lt;/tag&gt;
9292
9293 !! end
9294
9295 !! test
9296 Parser hook: basic arguments
9297 !! input
9298 <tag width=200 height = "100" depth = '50' square></tag>
9299 !! result
9300 <pre>
9301 ''
9302 array (
9303 'width' => '200',
9304 'height' => '100',
9305 'depth' => '50',
9306 'square' => 'square',
9307 )
9308 </pre>
9309
9310 !! end
9311
9312 !! test
9313 Parser hook: argument containing a forward slash (bug 5344)
9314 !! input
9315 <tag filename='/tmp/bla'></tag>
9316 !! result
9317 <pre>
9318 ''
9319 array (
9320 'filename' => '/tmp/bla',
9321 )
9322 </pre>
9323
9324 !! end
9325
9326 !! test
9327 Parser hook: empty input using terminated empty elements (bug 2374)
9328 !! input
9329 <tag foo=bar/>text
9330 !! result
9331 <pre>
9332 NULL
9333 array (
9334 'foo' => 'bar',
9335 )
9336 </pre>text
9337
9338 !! end
9339
9340 # </tag> should be output literally since there is no matching tag that begins it
9341 !! test
9342 Parser hook: basic arguments using terminated empty elements (bug 2374)
9343 !! input
9344 <tag width=200 height = "100" depth = '50' square/>
9345 other stuff
9346 </tag>
9347 !! result
9348 <pre>
9349 NULL
9350 array (
9351 'width' => '200',
9352 'height' => '100',
9353 'depth' => '50',
9354 'square' => 'square',
9355 )
9356 </pre>
9357 <p>other stuff
9358 &lt;/tag&gt;
9359 </p>
9360 !! end
9361
9362 ###
9363 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
9364 ###
9365
9366 !! test
9367 Parser hook: static parser hook not inside a comment
9368 !! input
9369 <statictag>hello, world</statictag>
9370 <statictag action=flush/>
9371 !! result
9372 <p>hello, world
9373 </p>
9374 !! end
9375
9376
9377 !! test
9378 Parser hook: static parser hook inside a comment
9379 !! input
9380 <!-- <statictag>hello, world</statictag> -->
9381 <statictag action=flush/>
9382 !! result
9383 <p><br />
9384 </p>
9385 !! end
9386
9387 # Nested template calls; this case was broken by Parser.php rev 1.506,
9388 # since reverted.
9389
9390 !! article
9391 Template:One-parameter
9392 !! text
9393 (My parameter is: {{{1}}})
9394 !! endarticle
9395
9396 !! article
9397 Template:Map-one-parameter
9398 !! text
9399 {{{{{1}}}|{{{2}}}}}
9400 !! endarticle
9401
9402 !! test
9403 Nested template calls
9404 !! input
9405 {{Map-one-parameter|One-parameter|param}}
9406 !! result
9407 <p>(My parameter is: param)
9408 </p>
9409 !! end
9410
9411
9412 ###
9413 ### Sanitizer
9414 ###
9415 !! test
9416 Sanitizer: Closing of open tags
9417 !! input
9418 <s></s><table></table>
9419 !! result
9420 <s></s><table></table>
9421
9422 !! end
9423
9424 !! test
9425 Sanitizer: Closing of open but not closed tags
9426 !! input
9427 <s>foo
9428 !! result
9429 <p><s>foo</s>
9430 </p>
9431 !! end
9432
9433 !! test
9434 Sanitizer: Closing of closed but not open tags
9435 !! input
9436 </s>
9437 !! result
9438 <p>&lt;/s&gt;
9439 </p>
9440 !! end
9441
9442 !! test
9443 Sanitizer: Closing of closed but not open table tags
9444 !! input
9445 Table not started</td></tr></table>
9446 !! result
9447 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
9448 </p>
9449 !! end
9450
9451 !! test
9452 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
9453 !! input
9454 <span id="æ: v">byte</span>[[#æ: v|backlink]]
9455 !! result
9456 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
9457 </p>
9458 !! end
9459
9460 !! test
9461 Sanitizer: Validating the contents of the id attribute (bug 4515)
9462 !! options
9463 disabled
9464 !! input
9465 <br id=9 />
9466 !! result
9467 Something, but definitely not <br id="9" />...
9468 !! end
9469
9470 !! test
9471 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
9472 !! options
9473 disabled
9474 !! input
9475 <br id="foo" /><br id="foo" />
9476 !! result
9477 Something need to be done. foo-2 ?
9478 !! end
9479
9480 !! test
9481 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
9482 !! input
9483 <div itemscope>
9484 <meta itemprop="hello" content="world">
9485 <meta http-equiv="refresh" content="5">
9486 <meta itemprop="hello" http-equiv="refresh" content="5">
9487 <link itemprop="hello" href="{{SERVER}}">
9488 <link rel="stylesheet" href="{{SERVER}}">
9489 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
9490 </div>
9491 !! result
9492 <div itemscope="itemscope">
9493 <p> <meta itemprop="hello" content="world" />
9494 &lt;meta http-equiv="refresh" content="5"&gt;
9495 <meta itemprop="hello" content="5" />
9496 </p>
9497 <link itemprop="hello" href="http&#58;//example.org" />
9498 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
9499 <link itemprop="hello" href="http&#58;//example.org" />
9500 </div>
9501
9502 !! end
9503
9504 !! test
9505 Language converter: output gets cut off unexpectedly (bug 5757)
9506 !! options
9507 language=zh
9508 !! input
9509 this bit is safe: }-
9510
9511 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
9512
9513 then we get cut off here: }-
9514
9515 all additional text is vanished
9516 !! result
9517 <p>this bit is safe: }-
9518 </p><p>but if we add a conversion instance: xxx
9519 </p><p>then we get cut off here: }-
9520 </p><p>all additional text is vanished
9521 </p>
9522 !! end
9523
9524 !! test
9525 Self closed html pairs (bug 5487)
9526 !! options
9527 !! input
9528 <center><font id="bug" />Centered text</center>
9529 <div><font id="bug2" />In div text</div>
9530 !! result
9531 <center>&lt;font id="bug" /&gt;Centered text</center>
9532 <div>&lt;font id="bug2" /&gt;In div text</div>
9533
9534 !! end
9535
9536 #
9537 #
9538 #
9539
9540 !! test
9541 Punctuation: nbsp before exclamation
9542 !! input
9543 C'est grave !
9544 !! result
9545 <p>C'est grave&#160;!
9546 </p>
9547 !! end
9548
9549 !! test
9550 Punctuation: CSS !important (bug 11874)
9551 !! input
9552 <div style="width:50% !important">important</div>
9553 !! result
9554 <div style="width:50% !important">important</div>
9555
9556 !!end
9557
9558 !! test
9559 Punctuation: CSS ! important (bug 11874; with space after)
9560 !! input
9561 <div style="width:50% ! important">important</div>
9562 !! result
9563 <div style="width:50% ! important">important</div>
9564
9565 !!end
9566
9567
9568 !! test
9569 HTML bullet list, closed tags (bug 5497)
9570 !! input
9571 <ul>
9572 <li>One</li>
9573 <li>Two</li>
9574 </ul>
9575 !! result
9576 <ul>
9577 <li>One</li>
9578 <li>Two</li>
9579 </ul>
9580
9581 !! end
9582
9583 !! test
9584 HTML bullet list, unclosed tags (bug 5497)
9585 !! options
9586 disabled
9587 !! input
9588 <ul>
9589 <li>One
9590 <li>Two
9591 </ul>
9592 !! result
9593 <ul>
9594 <li>One
9595 </li><li>Two
9596 </li></ul>
9597
9598 !! end
9599
9600 !! test
9601 HTML ordered list, closed tags (bug 5497)
9602 !! input
9603 <ol>
9604 <li>One</li>
9605 <li>Two</li>
9606 </ol>
9607 !! result
9608 <ol>
9609 <li>One</li>
9610 <li>Two</li>
9611 </ol>
9612
9613 !! end
9614
9615 !! test
9616 HTML ordered list, unclosed tags (bug 5497)
9617 !! options
9618 disabled
9619 !! input
9620 <ol>
9621 <li>One
9622 <li>Two
9623 </ol>
9624 !! result
9625 <ol>
9626 <li>One
9627 </li><li>Two
9628 </li></ol>
9629
9630 !! end
9631
9632 !! test
9633 HTML nested bullet list, closed tags (bug 5497)
9634 !! input
9635 <ul>
9636 <li>One</li>
9637 <li>Two:
9638 <ul>
9639 <li>Sub-one</li>
9640 <li>Sub-two</li>
9641 </ul>
9642 </li>
9643 </ul>
9644 !! result
9645 <ul>
9646 <li>One</li>
9647 <li>Two:
9648 <ul>
9649 <li>Sub-one</li>
9650 <li>Sub-two</li>
9651 </ul>
9652 </li>
9653 </ul>
9654
9655 !! end
9656
9657 !! test
9658 HTML nested bullet list, open tags (bug 5497)
9659 !! options
9660 disabled
9661 !! input
9662 <ul>
9663 <li>One
9664 <li>Two:
9665 <ul>
9666 <li>Sub-one
9667 <li>Sub-two
9668 </ul>
9669 </ul>
9670 !! result
9671 <ul>
9672 <li>One
9673 </li><li>Two:
9674 <ul>
9675 <li>Sub-one
9676 </li><li>Sub-two
9677 </li></ul>
9678 </li></ul>
9679
9680 !! end
9681
9682 !! test
9683 HTML nested ordered list, closed tags (bug 5497)
9684 !! input
9685 <ol>
9686 <li>One</li>
9687 <li>Two:
9688 <ol>
9689 <li>Sub-one</li>
9690 <li>Sub-two</li>
9691 </ol>
9692 </li>
9693 </ol>
9694 !! result
9695 <ol>
9696 <li>One</li>
9697 <li>Two:
9698 <ol>
9699 <li>Sub-one</li>
9700 <li>Sub-two</li>
9701 </ol>
9702 </li>
9703 </ol>
9704
9705 !! end
9706
9707 !! test
9708 HTML nested ordered list, open tags (bug 5497)
9709 !! options
9710 disabled
9711 !! input
9712 <ol>
9713 <li>One
9714 <li>Two:
9715 <ol>
9716 <li>Sub-one
9717 <li>Sub-two
9718 </ol>
9719 </ol>
9720 !! result
9721 <ol>
9722 <li>One
9723 </li><li>Two:
9724 <ol>
9725 <li>Sub-one
9726 </li><li>Sub-two
9727 </li></ol>
9728 </li></ol>
9729
9730 !! end
9731
9732 !! test
9733 HTML ordered list item with parameters oddity
9734 !! input
9735 <ol><li id="fragment">One</li></ol>
9736 !! result
9737 <ol><li id="fragment">One</li></ol>
9738
9739 !! end
9740
9741 !!test
9742 bug 5918: autonumbering
9743 !! input
9744 [http://first/] [http://second] [ftp://ftp]
9745
9746 ftp://inlineftp
9747
9748 [mailto:enclosed@mail.tld With target]
9749
9750 [mailto:enclosed@mail.tld]
9751
9752 mailto:inline@mail.tld
9753 !! result
9754 <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>
9755 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
9756 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
9757 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
9758 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
9759 </p>
9760 !! end
9761
9762
9763 #
9764 # Security and HTML correctness
9765 # From Nick Jenkins' fuzz testing
9766 #
9767
9768 !! test
9769 Fuzz testing: Parser13
9770 !! input
9771 {|
9772 | http://a|
9773 !! result
9774 <table>
9775 <tr>
9776 <td>
9777 </td>
9778 </tr>
9779 </table>
9780
9781 !! end
9782
9783 !! test
9784 Fuzz testing: Parser14
9785 !! input
9786 == onmouseover= ==
9787 http://__TOC__
9788 !! result
9789 <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>
9790 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9791 <ul>
9792 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
9793 </ul>
9794 </td></tr></table>
9795
9796 !! end
9797
9798 !! test
9799 Fuzz testing: Parser14-table
9800 !! input
9801 ==a==
9802 {| STYLE=__TOC__
9803 !! result
9804 <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>
9805 <table style="&#95;_TOC&#95;_">
9806 <tr><td></td></tr>
9807 </table>
9808
9809 !! end
9810
9811 # Known to produce bogus xml (extra </td>)
9812 !! test
9813 Fuzz testing: Parser16
9814 !! options
9815 noxml
9816 !! input
9817 {|
9818 !https://||||||
9819 !! result
9820 <table>
9821 <tr>
9822 <th>https://</th>
9823 <th></th>
9824 <th></th>
9825 <th>
9826 </td>
9827 </tr>
9828 </table>
9829
9830 !! end
9831
9832 !! test
9833 Fuzz testing: Parser21
9834 !! input
9835 {|
9836 ! irc://{{ftp://a" onmouseover="alert('hello world');"
9837 |
9838 !! result
9839 <table>
9840 <tr>
9841 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
9842 </th>
9843 <td>
9844 </td>
9845 </tr>
9846 </table>
9847
9848 !! end
9849
9850 !! test
9851 Fuzz testing: Parser22
9852 !! input
9853 http://===r:::https://b
9854
9855 {|
9856 !!result
9857 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
9858 </p>
9859 <table>
9860 <tr><td></td></tr>
9861 </table>
9862
9863 !! end
9864
9865 # Known to produce bad XML for now
9866 !! test
9867 Fuzz testing: Parser24
9868 !! options
9869 noxml
9870 !! input
9871 {|
9872 {{{|
9873 <u CLASS=
9874 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
9875 <br style="onmouseover='alert(document.cookie);' " />
9876
9877 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9878 |
9879 !! result
9880 <table>
9881 {{{|
9882 <u class="&#124;">}}}} &gt;
9883 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
9884
9885 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9886 <tr>
9887 <td></u>
9888 </td>
9889 </tr>
9890 </table>
9891
9892 !! end
9893
9894 # Note: the current result listed for this is not what the original one was,
9895 # but the original bug was JavaScript injection, which is fixed in any case.
9896 # It's not clear that the original result listed was any more correct than the
9897 # current one. Original result:
9898 # <p>{{{|
9899 # </p>
9900 # <li class="&#124;&#124;">
9901 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9902 !!test
9903 Fuzz testing: Parser25 (bug 6055)
9904 !! input
9905 {{{
9906 |
9907 <LI CLASS=||
9908 >
9909 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
9910 !! result
9911 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9912 </p>
9913 !! end
9914
9915 !!test
9916 Fuzz testing: URL adjacent extension (with space, clean)
9917 !! options
9918 !! input
9919 http://example.com <nowiki>junk</nowiki>
9920 !! result
9921 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
9922 </p>
9923 !!end
9924
9925 !!test
9926 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
9927 !! options
9928 !! input
9929 http://example.com<nowiki>junk</nowiki>
9930 !! result
9931 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
9932 </p>
9933 !!end
9934
9935 !!test
9936 Fuzz testing: URL adjacent extension (no space, dirty; pre)
9937 !! options
9938 !! input
9939 http://example.com<pre>junk</pre>
9940 !! result
9941 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
9942
9943 !!end
9944
9945 !!test
9946 Fuzz testing: image with bogus manual thumbnail
9947 !!input
9948 [[Image:foobar.jpg|thumbnail= ]]
9949 !!result
9950 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
9951
9952 !!end
9953
9954 !! test
9955 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
9956 !! input
9957 <pre dir="&#10;"></pre>
9958 !! result
9959 <pre dir="&#10;"></pre>
9960
9961 !! end
9962
9963 !! test
9964 Parsing optional HTML elements (Bug 6171)
9965 !! options
9966 !! input
9967 <table>
9968 <tr>
9969 <td> Some tabular data</td>
9970 <td> More tabular data ...
9971 <td> And yet som tabular data</td>
9972 </tr>
9973 </table>
9974 !! result
9975 <table>
9976 <tr>
9977 <td> Some tabular data</td>
9978 <td> More tabular data ...
9979 </td><td> And yet som tabular data</td>
9980 </tr>
9981 </table>
9982
9983 !! end
9984
9985 !! test
9986 Correct handling of <td>, <tr> (Bug 6171)
9987 !! options
9988 !! input
9989 <table>
9990 <tr>
9991 <td> Some tabular data</td>
9992 <td> More tabular data ...</td>
9993 <td> And yet som tabular data</td>
9994 </tr>
9995 </table>
9996 !! result
9997 <table>
9998 <tr>
9999 <td> Some tabular data</td>
10000 <td> More tabular data ...</td>
10001 <td> And yet som tabular data</td>
10002 </tr>
10003 </table>
10004
10005 !! end
10006
10007
10008 !! test
10009 Parsing crashing regression (fr:JavaScript)
10010 !! input
10011 </body></x>
10012 !! result
10013 <p>&lt;/body&gt;&lt;/x&gt;
10014 </p>
10015 !! end
10016
10017 !! test
10018 Inline wiki vs wiki block nesting
10019 !! input
10020 '''Bold paragraph
10021
10022 New wiki paragraph
10023 !! result
10024 <p><b>Bold paragraph</b>
10025 </p><p>New wiki paragraph
10026 </p>
10027 !! end
10028
10029 !! test
10030 Inline HTML vs wiki block nesting
10031 !! options
10032 disabled
10033 !! input
10034 <b>Bold paragraph
10035
10036 New wiki paragraph
10037 !! result
10038 <p><b>Bold paragraph</b>
10039 </p><p>New wiki paragraph
10040 </p>
10041 !! end
10042
10043 # Original result was this:
10044 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
10045 # </p>
10046 # While that might be marginally more intuitive, maybe, the six-apostrophe
10047 # construct is clearly pathological and the result stated here (which is what
10048 # the parser actually does) is about as reasonable as anything.
10049 !!test
10050 Mixing markup for italics and bold
10051 !! options
10052 !! input
10053 '''bold''''''bold''bolditalics'''''
10054 !! result
10055 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
10056 </p>
10057 !! end
10058
10059
10060 !! article
10061 Xyzzyx
10062 !! text
10063 Article for special page transclusion test
10064 !! endarticle
10065
10066 !! test
10067 Special page transclusion
10068 !! options
10069 !! input
10070 {{Special:Prefixindex/Xyzzyx}}
10071 !! result
10072 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10073
10074 !! end
10075
10076 !! test
10077 Special page transclusion twice (bug 5021)
10078 !! options
10079 !! input
10080 {{Special:Prefixindex/Xyzzyx}}
10081 {{Special:Prefixindex/Xyzzyx}}
10082 !! result
10083 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10084 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10085
10086 !! end
10087
10088 !! test
10089 Transclusion of default MediaWiki message
10090 !! input
10091 {{MediaWiki:Mainpage}}
10092 !!result
10093 <p>Main Page
10094 </p>
10095 !! end
10096
10097 !! test
10098 Transclusion of nonexistent MediaWiki message
10099 !! input
10100 {{MediaWiki:Mainpagexxx}}
10101 !!result
10102 <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>
10103 </p>
10104 !! end
10105
10106 !! test
10107 Transclusion of MediaWiki message with underscore
10108 !! input
10109 {{MediaWiki:history_short}}
10110 !! result
10111 <p>History
10112 </p>
10113 !! end
10114
10115 !! test
10116 Transclusion of MediaWiki message with space
10117 !! input
10118 {{MediaWiki:history short}}
10119 !! result
10120 <p>History
10121 </p>
10122 !! end
10123
10124 !! test
10125 Invalid header with following text
10126 !! input
10127 = x = y
10128 !! result
10129 <p>= x = y
10130 </p>
10131 !! end
10132
10133
10134 !! test
10135 Section extraction test (section 0)
10136 !! options
10137 section=0
10138 !! input
10139 start
10140 ==a==
10141 ===aa===
10142 ====aaa====
10143 ==b==
10144 ===ba===
10145 ===bb===
10146 ====bba====
10147 ===bc===
10148 ==c==
10149 ===ca===
10150 !! result
10151 start
10152 !! end
10153
10154 !! test
10155 Section extraction test (section 1)
10156 !! options
10157 section=1
10158 !! input
10159 start
10160 ==a==
10161 ===aa===
10162 ====aaa====
10163 ==b==
10164 ===ba===
10165 ===bb===
10166 ====bba====
10167 ===bc===
10168 ==c==
10169 ===ca===
10170 !! result
10171 ==a==
10172 ===aa===
10173 ====aaa====
10174 !! end
10175
10176 !! test
10177 Section extraction test (section 2)
10178 !! options
10179 section=2
10180 !! input
10181 start
10182 ==a==
10183 ===aa===
10184 ====aaa====
10185 ==b==
10186 ===ba===
10187 ===bb===
10188 ====bba====
10189 ===bc===
10190 ==c==
10191 ===ca===
10192 !! result
10193 ===aa===
10194 ====aaa====
10195 !! end
10196
10197 !! test
10198 Section extraction test (section 3)
10199 !! options
10200 section=3
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 ====aaa====
10215 !! end
10216
10217 !! test
10218 Section extraction test (section 4)
10219 !! options
10220 section=4
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 ==b==
10235 ===ba===
10236 ===bb===
10237 ====bba====
10238 ===bc===
10239 !! end
10240
10241 !! test
10242 Section extraction test (section 5)
10243 !! options
10244 section=5
10245 !! input
10246 start
10247 ==a==
10248 ===aa===
10249 ====aaa====
10250 ==b==
10251 ===ba===
10252 ===bb===
10253 ====bba====
10254 ===bc===
10255 ==c==
10256 ===ca===
10257 !! result
10258 ===ba===
10259 !! end
10260
10261 !! test
10262 Section extraction test (section 6)
10263 !! options
10264 section=6
10265 !! input
10266 start
10267 ==a==
10268 ===aa===
10269 ====aaa====
10270 ==b==
10271 ===ba===
10272 ===bb===
10273 ====bba====
10274 ===bc===
10275 ==c==
10276 ===ca===
10277 !! result
10278 ===bb===
10279 ====bba====
10280 !! end
10281
10282 !! test
10283 Section extraction test (section 7)
10284 !! options
10285 section=7
10286 !! input
10287 start
10288 ==a==
10289 ===aa===
10290 ====aaa====
10291 ==b==
10292 ===ba===
10293 ===bb===
10294 ====bba====
10295 ===bc===
10296 ==c==
10297 ===ca===
10298 !! result
10299 ====bba====
10300 !! end
10301
10302 !! test
10303 Section extraction test (section 8)
10304 !! options
10305 section=8
10306 !! input
10307 start
10308 ==a==
10309 ===aa===
10310 ====aaa====
10311 ==b==
10312 ===ba===
10313 ===bb===
10314 ====bba====
10315 ===bc===
10316 ==c==
10317 ===ca===
10318 !! result
10319 ===bc===
10320 !! end
10321
10322 !! test
10323 Section extraction test (section 9)
10324 !! options
10325 section=9
10326 !! input
10327 start
10328 ==a==
10329 ===aa===
10330 ====aaa====
10331 ==b==
10332 ===ba===
10333 ===bb===
10334 ====bba====
10335 ===bc===
10336 ==c==
10337 ===ca===
10338 !! result
10339 ==c==
10340 ===ca===
10341 !! end
10342
10343 !! test
10344 Section extraction test (section 10)
10345 !! options
10346 section=10
10347 !! input
10348 start
10349 ==a==
10350 ===aa===
10351 ====aaa====
10352 ==b==
10353 ===ba===
10354 ===bb===
10355 ====bba====
10356 ===bc===
10357 ==c==
10358 ===ca===
10359 !! result
10360 ===ca===
10361 !! end
10362
10363 !! test
10364 Section extraction test (nonexistent section 11)
10365 !! options
10366 section=11
10367 !! input
10368 start
10369 ==a==
10370 ===aa===
10371 ====aaa====
10372 ==b==
10373 ===ba===
10374 ===bb===
10375 ====bba====
10376 ===bc===
10377 ==c==
10378 ===ca===
10379 !! result
10380 !! end
10381
10382 !! test
10383 Section extraction test with bogus heading (section 1)
10384 !! options
10385 section=1
10386 !! input
10387 ==a==
10388 ==bogus== not a legal section
10389 ==b==
10390 !! result
10391 ==a==
10392 ==bogus== not a legal section
10393 !! end
10394
10395 !! test
10396 Section extraction test with bogus heading (section 2)
10397 !! options
10398 section=2
10399 !! input
10400 ==a==
10401 ==bogus== not a legal section
10402 ==b==
10403 !! result
10404 ==b==
10405 !! end
10406
10407 !! test
10408 Section extraction test with comment after heading (section 1)
10409 !! options
10410 section=1
10411 !! input
10412 ==a==
10413 ==b== <!-- -->
10414 ==c==
10415 !! result
10416 ==a==
10417 !! end
10418
10419 !! test
10420 Section extraction test with comment after heading (section 2)
10421 !! options
10422 section=2
10423 !! input
10424 ==a==
10425 ==b== <!-- -->
10426 ==c==
10427 !! result
10428 ==b== <!-- -->
10429 !! end
10430
10431 !! test
10432 Section extraction test with bogus <nowiki> heading (section 1)
10433 !! options
10434 section=1
10435 !! input
10436 ==a==
10437 ==bogus== <nowiki>not a legal section</nowiki>
10438 ==b==
10439 !! result
10440 ==a==
10441 ==bogus== <nowiki>not a legal section</nowiki>
10442 !! end
10443
10444 !! test
10445 Section extraction test with bogus <nowiki> heading (section 2)
10446 !! options
10447 section=2
10448 !! input
10449 ==a==
10450 ==bogus== <nowiki>not a legal section</nowiki>
10451 ==b==
10452 !! result
10453 ==b==
10454 !! end
10455
10456
10457 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
10458 # instead of respecting commented sections
10459 !! test
10460 Section extraction prefixed by comment (section 1)
10461 !! options
10462 section=1
10463 !! input
10464 <!-- -->==sec1==
10465 ==sec2==
10466 !!result
10467 ==sec2==
10468 !!end
10469
10470 !! test
10471 Section extraction prefixed by comment (section 2)
10472 !! options
10473 section=2
10474 !! input
10475 <!-- -->==sec1==
10476 ==sec2==
10477 !!result
10478
10479 !!end
10480
10481
10482 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
10483 # instead of respecting HTML-style headings
10484 !! test
10485 Section extraction, mixed wiki and html (section 1)
10486 !! options
10487 section=1
10488 !! input
10489 <h2>unmarked</h2>
10490 unmarked
10491 ==1==
10492 one
10493 ==2==
10494 two
10495 !! result
10496 ==1==
10497 one
10498 !! end
10499
10500 !! test
10501 Section extraction, mixed wiki and html (section 2)
10502 !! options
10503 section=2
10504 !! input
10505 <h2>unmarked</h2>
10506 unmarked
10507 ==1==
10508 one
10509 ==2==
10510 two
10511 !! result
10512 ==2==
10513 two
10514 !! end
10515
10516
10517 # Formerly testing for bug 3342
10518 !! test
10519 Section extraction, heading surrounded by <noinclude>
10520 !! options
10521 section=1
10522 !! input
10523 <noinclude>==unmarked==</noinclude>
10524 ==marked==
10525 !! result
10526 ==marked==
10527 !!end
10528
10529 # Test behavior of bug 19910
10530 !! test
10531 Sectiion with all-equals
10532 !! options
10533 section=2
10534 !! input
10535 ===
10536 The line above must have a trailing space
10537 === <!--
10538 --> <!-- -->
10539 But just in case it doesn't...
10540 !! result
10541 === <!--
10542 --> <!-- -->
10543 But just in case it doesn't...
10544 !! end
10545
10546 !! test
10547 Section replacement test (section 0)
10548 !! options
10549 replace=0,"xxx"
10550 !! input
10551 start
10552 ==a==
10553 ===aa===
10554 ====aaa====
10555 ==b==
10556 ===ba===
10557 ===bb===
10558 ====bba====
10559 ===bc===
10560 ==c==
10561 ===ca===
10562 !! result
10563 xxx
10564
10565 ==a==
10566 ===aa===
10567 ====aaa====
10568 ==b==
10569 ===ba===
10570 ===bb===
10571 ====bba====
10572 ===bc===
10573 ==c==
10574 ===ca===
10575 !! end
10576
10577 !! test
10578 Section replacement test (section 1)
10579 !! options
10580 replace=1,"xxx"
10581 !! input
10582 start
10583 ==a==
10584 ===aa===
10585 ====aaa====
10586 ==b==
10587 ===ba===
10588 ===bb===
10589 ====bba====
10590 ===bc===
10591 ==c==
10592 ===ca===
10593 !! result
10594 start
10595 xxx
10596
10597 ==b==
10598 ===ba===
10599 ===bb===
10600 ====bba====
10601 ===bc===
10602 ==c==
10603 ===ca===
10604 !! end
10605
10606 !! test
10607 Section replacement test (section 2)
10608 !! options
10609 replace=2,"xxx"
10610 !! input
10611 start
10612 ==a==
10613 ===aa===
10614 ====aaa====
10615 ==b==
10616 ===ba===
10617 ===bb===
10618 ====bba====
10619 ===bc===
10620 ==c==
10621 ===ca===
10622 !! result
10623 start
10624 ==a==
10625 xxx
10626
10627 ==b==
10628 ===ba===
10629 ===bb===
10630 ====bba====
10631 ===bc===
10632 ==c==
10633 ===ca===
10634 !! end
10635
10636 !! test
10637 Section replacement test (section 3)
10638 !! options
10639 replace=3,"xxx"
10640 !! input
10641 start
10642 ==a==
10643 ===aa===
10644 ====aaa====
10645 ==b==
10646 ===ba===
10647 ===bb===
10648 ====bba====
10649 ===bc===
10650 ==c==
10651 ===ca===
10652 !! result
10653 start
10654 ==a==
10655 ===aa===
10656 xxx
10657
10658 ==b==
10659 ===ba===
10660 ===bb===
10661 ====bba====
10662 ===bc===
10663 ==c==
10664 ===ca===
10665 !! end
10666
10667 !! test
10668 Section replacement test (section 4)
10669 !! options
10670 replace=4,"xxx"
10671 !! input
10672 start
10673 ==a==
10674 ===aa===
10675 ====aaa====
10676 ==b==
10677 ===ba===
10678 ===bb===
10679 ====bba====
10680 ===bc===
10681 ==c==
10682 ===ca===
10683 !! result
10684 start
10685 ==a==
10686 ===aa===
10687 ====aaa====
10688 xxx
10689
10690 ==c==
10691 ===ca===
10692 !! end
10693
10694 !! test
10695 Section replacement test (section 5)
10696 !! options
10697 replace=5,"xxx"
10698 !! input
10699 start
10700 ==a==
10701 ===aa===
10702 ====aaa====
10703 ==b==
10704 ===ba===
10705 ===bb===
10706 ====bba====
10707 ===bc===
10708 ==c==
10709 ===ca===
10710 !! result
10711 start
10712 ==a==
10713 ===aa===
10714 ====aaa====
10715 ==b==
10716 xxx
10717
10718 ===bb===
10719 ====bba====
10720 ===bc===
10721 ==c==
10722 ===ca===
10723 !! end
10724
10725 !! test
10726 Section replacement test (section 6)
10727 !! options
10728 replace=6,"xxx"
10729 !! input
10730 start
10731 ==a==
10732 ===aa===
10733 ====aaa====
10734 ==b==
10735 ===ba===
10736 ===bb===
10737 ====bba====
10738 ===bc===
10739 ==c==
10740 ===ca===
10741 !! result
10742 start
10743 ==a==
10744 ===aa===
10745 ====aaa====
10746 ==b==
10747 ===ba===
10748 xxx
10749
10750 ===bc===
10751 ==c==
10752 ===ca===
10753 !! end
10754
10755 !! test
10756 Section replacement test (section 7)
10757 !! options
10758 replace=7,"xxx"
10759 !! input
10760 start
10761 ==a==
10762 ===aa===
10763 ====aaa====
10764 ==b==
10765 ===ba===
10766 ===bb===
10767 ====bba====
10768 ===bc===
10769 ==c==
10770 ===ca===
10771 !! result
10772 start
10773 ==a==
10774 ===aa===
10775 ====aaa====
10776 ==b==
10777 ===ba===
10778 ===bb===
10779 xxx
10780
10781 ===bc===
10782 ==c==
10783 ===ca===
10784 !! end
10785
10786 !! test
10787 Section replacement test (section 8)
10788 !! options
10789 replace=8,"xxx"
10790 !! input
10791 start
10792 ==a==
10793 ===aa===
10794 ====aaa====
10795 ==b==
10796 ===ba===
10797 ===bb===
10798 ====bba====
10799 ===bc===
10800 ==c==
10801 ===ca===
10802 !! result
10803 start
10804 ==a==
10805 ===aa===
10806 ====aaa====
10807 ==b==
10808 ===ba===
10809 ===bb===
10810 ====bba====
10811 xxx
10812
10813 ==c==
10814 ===ca===
10815 !!end
10816
10817 !! test
10818 Section replacement test (section 9)
10819 !! options
10820 replace=9,"xxx"
10821 !! input
10822 start
10823 ==a==
10824 ===aa===
10825 ====aaa====
10826 ==b==
10827 ===ba===
10828 ===bb===
10829 ====bba====
10830 ===bc===
10831 ==c==
10832 ===ca===
10833 !! result
10834 start
10835 ==a==
10836 ===aa===
10837 ====aaa====
10838 ==b==
10839 ===ba===
10840 ===bb===
10841 ====bba====
10842 ===bc===
10843 xxx
10844 !! end
10845
10846 !! test
10847 Section replacement test (section 10)
10848 !! options
10849 replace=10,"xxx"
10850 !! input
10851 start
10852 ==a==
10853 ===aa===
10854 ====aaa====
10855 ==b==
10856 ===ba===
10857 ===bb===
10858 ====bba====
10859 ===bc===
10860 ==c==
10861 ===ca===
10862 !! result
10863 start
10864 ==a==
10865 ===aa===
10866 ====aaa====
10867 ==b==
10868 ===ba===
10869 ===bb===
10870 ====bba====
10871 ===bc===
10872 ==c==
10873 xxx
10874 !! end
10875
10876 !! test
10877 Section replacement test with initial whitespace (bug 13728)
10878 !! options
10879 replace=2,"xxx"
10880 !! input
10881 Preformatted initial line
10882 ==a==
10883 ===a===
10884 !! result
10885 Preformatted initial line
10886 ==a==
10887 xxx
10888 !! end
10889
10890
10891 !! test
10892 Section extraction, heading followed by pre with 20 spaces (bug 6398)
10893 !! options
10894 section=1
10895 !! input
10896 ==a==
10897 a
10898 !! result
10899 ==a==
10900 a
10901 !! end
10902
10903 !! test
10904 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
10905 !! options
10906 section=1
10907 !! input
10908 ==a==
10909 a
10910 !! result
10911 ==a==
10912 a
10913 !! end
10914
10915
10916 !! test
10917 Section extraction, <pre> around bogus header (bug 10309)
10918 !! options
10919 noxml section=2
10920 !! input
10921 == Section One ==
10922 <pre>
10923 =======
10924 </pre>
10925
10926 == Section Two ==
10927 stuff
10928 !! result
10929 == Section Two ==
10930 stuff
10931 !! end
10932
10933 !! test
10934 Section replacement, <pre> around bogus header (bug 10309)
10935 !! options
10936 noxml replace=2,"xxx"
10937 !! input
10938 == Section One ==
10939 <pre>
10940 =======
10941 </pre>
10942
10943 == Section Two ==
10944 stuff
10945 !! result
10946 == Section One ==
10947 <pre>
10948 =======
10949 </pre>
10950
10951 xxx
10952 !! end
10953
10954
10955
10956 !! test
10957 Handling of &#x0A; in URLs
10958 !! input
10959 **irc://&#x0A;a
10960 !! result
10961 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
10962 </li></ul>
10963 </li></ul>
10964
10965 !!end
10966
10967 !! test
10968 5 quotes, code coverage +1 line (php)
10969 !! options
10970 php
10971 !! input
10972 '''''
10973 !! result
10974 !! end
10975 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
10976 !! test
10977 5 quotes, code coverage +1 line (parsoid)
10978 !! options
10979 parsoid
10980 !! input
10981 '''''
10982 !! result
10983 <p><i><b></b></i></p>
10984 !! end
10985
10986 !! test
10987 Special:Search page linking.
10988 !! input
10989 {{Special:search}}
10990 !! result
10991 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
10992 </p>
10993 !! end
10994
10995 !! test
10996 Say the magic word
10997 !! input
10998 * {{PAGENAME}}
10999 * {{BASEPAGENAME}}
11000 * {{SUBPAGENAME}}
11001 * {{SUBPAGENAMEE}}
11002 * {{ROOTPAGENAME}}
11003 * {{ROOTPAGENAMEE}}
11004 * {{BASEPAGENAME}}
11005 * {{BASEPAGENAMEE}}
11006 * {{TALKPAGENAME}}
11007 * {{TALKPAGENAMEE}}
11008 * {{SUBJECTPAGENAME}}
11009 * {{SUBJECTPAGENAMEE}}
11010 * {{NAMESPACEE}}
11011 * {{NAMESPACE}}
11012 * {{TALKSPACE}}
11013 * {{TALKSPACEE}}
11014 * {{SUBJECTSPACE}}
11015 * {{SUBJECTSPACEE}}
11016 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
11017 !! result
11018 <ul><li> Parser test
11019 </li><li> Parser test
11020 </li><li> Parser test
11021 </li><li> Parser_test
11022 </li><li> Parser test
11023 </li><li> Parser_test
11024 </li><li> Parser test
11025 </li><li> Parser_test
11026 </li><li> Talk:Parser test
11027 </li><li> Talk:Parser_test
11028 </li><li> Parser test
11029 </li><li> Parser_test
11030 </li><li>
11031 </li><li>
11032 </li><li> Talk
11033 </li><li> Talk
11034 </li><li>
11035 </li><li>
11036 </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>
11037 </li></ul>
11038
11039 !! end
11040 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
11041
11042 !! test
11043 Gallery
11044 !! input
11045 <gallery>
11046 image1.png |
11047 image2.gif|||||
11048
11049 image3|
11050 image4 |300px| centre
11051 image5.svg| http://///////
11052 [[x|xx]]]]
11053 * image6
11054 </gallery>
11055 !! result
11056 <ul class="gallery">
11057 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11058 <div style="height: 150px;">Image1.png</div>
11059 <div class="gallerytext">
11060 </div>
11061 </div></li>
11062 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11063 <div style="height: 150px;">Image2.gif</div>
11064 <div class="gallerytext">
11065 <p>||||
11066 </p>
11067 </div>
11068 </div></li>
11069 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11070 <div style="height: 150px;">Image3</div>
11071 <div class="gallerytext">
11072 </div>
11073 </div></li>
11074 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11075 <div style="height: 150px;">Image4</div>
11076 <div class="gallerytext">
11077 <p>300px| centre
11078 </p>
11079 </div>
11080 </div></li>
11081 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11082 <div style="height: 150px;">Image5.svg</div>
11083 <div class="gallerytext">
11084 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
11085 </p>
11086 </div>
11087 </div></li>
11088 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11089 <div style="height: 150px;">* image6</div>
11090 <div class="gallerytext">
11091 </div>
11092 </div></li>
11093 </ul>
11094
11095 !! end
11096
11097 !! test
11098 Gallery (with options)
11099 !! input
11100 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
11101 File:Nonexistant.jpg|caption
11102 File:Nonexistant.jpg
11103 image:foobar.jpg|some '''caption''' [[Main Page]]
11104 image:foobar.jpg
11105 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
11106 </gallery>
11107 !! result
11108 <ul class="gallery" style="max-width: 226px;_width: 226px;">
11109 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
11110 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11111 <div style="height: 70px;">Nonexistant.jpg</div>
11112 <div class="gallerytext">
11113 <p>caption
11114 </p>
11115 </div>
11116 </div></li>
11117 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11118 <div style="height: 70px;">Nonexistant.jpg</div>
11119 <div class="gallerytext">
11120 </div>
11121 </div></li>
11122 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11123 <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>
11124 <div class="gallerytext">
11125 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11126 </p>
11127 </div>
11128 </div></li>
11129 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11130 <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>
11131 <div class="gallerytext">
11132 </div>
11133 </div></li>
11134 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11135 <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>
11136 <div class="gallerytext">
11137 <p>Blabla|blabla.
11138 </p>
11139 </div>
11140 </div></li>
11141 </ul>
11142
11143 !! end
11144
11145 !! test
11146 Gallery with wikitext inside caption
11147 !! input
11148 <gallery>
11149 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
11150 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
11151 </gallery>
11152 !! result
11153 <ul class="gallery">
11154 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11155 <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>
11156 <div class="gallerytext">
11157 <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>
11158 </p>
11159 </div>
11160 </div></li>
11161 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11162 <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>
11163 <div class="gallerytext">
11164 <p>This is a test template
11165 </p>
11166 </div>
11167 </div></li>
11168 </ul>
11169
11170 !! end
11171
11172 !! test
11173 gallery (with showfilename option)
11174 !! input
11175 <gallery showfilename>
11176 File:Nonexistant.jpg|caption
11177 File:Nonexistant.jpg
11178 image:foobar.jpg|some '''caption''' [[Main Page]]
11179 File:Foobar.jpg
11180 </gallery>
11181 !! result
11182 <ul class="gallery">
11183 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11184 <div style="height: 150px;">Nonexistant.jpg</div>
11185 <div class="gallerytext">
11186 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11187 caption
11188 </p>
11189 </div>
11190 </div></li>
11191 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11192 <div style="height: 150px;">Nonexistant.jpg</div>
11193 <div class="gallerytext">
11194 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11195 </p>
11196 </div>
11197 </div></li>
11198 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11199 <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>
11200 <div class="gallerytext">
11201 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11202 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11203 </p>
11204 </div>
11205 </div></li>
11206 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11207 <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>
11208 <div class="gallerytext">
11209 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11210 </p>
11211 </div>
11212 </div></li>
11213 </ul>
11214
11215 !! end
11216
11217 !! test
11218 Gallery (with namespace-less filenames)
11219 !! input
11220 <gallery>
11221 File:Nonexistant.jpg
11222 Nonexistant.jpg
11223 image:foobar.jpg
11224 foobar.jpg
11225 </gallery>
11226 !! result
11227 <ul class="gallery">
11228 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11229 <div style="height: 150px;">Nonexistant.jpg</div>
11230 <div class="gallerytext">
11231 </div>
11232 </div></li>
11233 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11234 <div style="height: 150px;">Nonexistant.jpg</div>
11235 <div class="gallerytext">
11236 </div>
11237 </div></li>
11238 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11239 <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>
11240 <div class="gallerytext">
11241 </div>
11242 </div></li>
11243 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11244 <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>
11245 <div class="gallerytext">
11246 </div>
11247 </div></li>
11248 </ul>
11249
11250 !! end
11251
11252 !! test
11253 HTML Hex character encoding (spells the word "JavaScript")
11254 !! input
11255 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
11256 !! result
11257 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
11258 </p>
11259 !! end
11260
11261 !! test
11262 HTML Hex character encoding bogus encoding (bug 26437 regression check)
11263 !! input
11264 &#xsee;&#XSEE;
11265 !! result
11266 <p>&amp;#xsee;&amp;#XSEE;
11267 </p>
11268 !! end
11269
11270 !! test
11271 HTML Hex character encoding mixed case
11272 !! input
11273 &#xEE;&#Xee;
11274 !! result
11275 <p>&#xee;&#xee;
11276 </p>
11277 !! end
11278
11279 !! test
11280 __FORCETOC__ override
11281 !! input
11282 __NEWSECTIONLINK__
11283 __FORCETOC__
11284 !! result
11285 <p><br />
11286 </p>
11287 !! end
11288
11289 !! test
11290 ISBN code coverage
11291 !! input
11292 ISBN 978-0-1234-56&#x20;789
11293 !! result
11294 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
11295 </p>
11296 !! end
11297
11298 !! test
11299 ISBN followed by 5 spaces
11300 !! input
11301 ISBN
11302 !! result
11303 <p>ISBN
11304 </p>
11305 !! end
11306
11307 !! test
11308 Double ISBN
11309 !! input
11310 ISBN ISBN 1234567890
11311 !! result
11312 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
11313 </p>
11314 !! end
11315
11316 !! test
11317 Bug 22905: <abbr> followed by ISBN followed by </a>
11318 !! input
11319 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
11320 !! result
11321 <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>
11322 </p>
11323 !! end
11324
11325 !! test
11326 Double RFC
11327 !! input
11328 RFC RFC 1234
11329 !! result
11330 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
11331 </p>
11332 !! end
11333
11334 !! test
11335 Double RFC with a wiki link
11336 !! input
11337 RFC [[RFC 1234]]
11338 !! result
11339 <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>
11340 </p>
11341 !! end
11342
11343 !! test
11344 RFC code coverage
11345 !! input
11346 RFC 983&#x20;987
11347 !! result
11348 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
11349 </p>
11350 !! end
11351
11352 !! test
11353 Centre-aligned image
11354 !! input
11355 [[Image:foobar.jpg|centre]]
11356 !! result
11357 <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>
11358
11359 !!end
11360
11361 !! test
11362 None-aligned image
11363 !! input
11364 [[Image:foobar.jpg|none]]
11365 !! result
11366 <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>
11367
11368 !!end
11369
11370 !! test
11371 Width + Height sized image (using px) (height is ignored)
11372 !! input
11373 [[Image:foobar.jpg|640x480px]]
11374 !! result
11375 <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>
11376 </p>
11377 !!end
11378
11379 !! test
11380 Width-sized image (using px, no following whitespace)
11381 !! input
11382 [[Image:foobar.jpg|640px]]
11383 !! result
11384 <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>
11385 </p>
11386 !!end
11387
11388 !! test
11389 Width-sized image (using px, with following whitespace - test regression from r39467)
11390 !! input
11391 [[Image:foobar.jpg|640px ]]
11392 !! result
11393 <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>
11394 </p>
11395 !!end
11396
11397 !! test
11398 Width-sized image (using px, with preceding whitespace - test regression from r39467)
11399 !! input
11400 [[Image:foobar.jpg| 640px]]
11401 !! result
11402 <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>
11403 </p>
11404 !!end
11405
11406 !! test
11407 Another italics / bold test
11408 !! input
11409 ''' ''x'
11410 !! result
11411 <pre>'<i> </i>x'
11412 </pre>
11413 !!end
11414
11415 # Note the results may be incorrect, as parserTest output included this:
11416 # XML error: Mismatched tag at byte 6120:
11417 # ...<dd> </dt></dl> </dd...
11418 !! test
11419 dt/dd/dl test
11420 !! options
11421 disabled
11422 !! input
11423 :;;;::
11424 !! result
11425 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
11426 </dd></dl>
11427 </dd></dl>
11428 </dt></dl>
11429 </dt></dl>
11430 </dt></dl>
11431 </dd></dl>
11432
11433 !!end
11434
11435
11436 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
11437 !! test
11438 Images with the "|" character in the comment
11439 !! input
11440 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
11441 !! result
11442 <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>
11443
11444 !!end
11445
11446 !! test
11447 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
11448 !! input
11449 <html><script>alert(1);</script></html>
11450 !! result
11451 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
11452 </p>
11453 !! end
11454
11455 !! test
11456 HTML with raw HTML ($wgRawHtml==true)
11457 !! options
11458 rawhtml
11459 !! input
11460 <html><script>alert(1);</script></html>
11461 !! result
11462 <p><script>alert(1);</script>
11463 </p>
11464 !! end
11465
11466 !! test
11467 Parents of subpages, one level up
11468 !! options
11469 subpage title=[[Subpage test/L1/L2/L3]]
11470 !! input
11471 [[../|L2]]
11472 !! result
11473 <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>
11474 </p>
11475 !! end
11476
11477
11478 !! test
11479 Parents of subpages, one level up, not named
11480 !! options
11481 subpage title=[[Subpage test/L1/L2/L3]]
11482 !! input
11483 [[../]]
11484 !! result
11485 <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>
11486 </p>
11487 !! end
11488
11489
11490
11491 !! test
11492 Parents of subpages, two levels up
11493 !! options
11494 subpage title=[[Subpage test/L1/L2/L3]]
11495 !! input
11496 [[../../|L1]]2
11497
11498 [[../../|L1]]l
11499 !! result
11500 <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
11501 </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>
11502 </p>
11503 !! end
11504
11505 !! test
11506 Parents of subpages, two levels up, without trailing slash or name.
11507 !! options
11508 subpage title=[[Subpage test/L1/L2/L3]]
11509 !! input
11510 [[../..]]
11511 !! result
11512 <p>[[../..]]
11513 </p>
11514 !! end
11515
11516 !! test
11517 Parents of subpages, two levels up, with lots of extra trailing slashes.
11518 !! options
11519 subpage title=[[Subpage test/L1/L2/L3]]
11520 !! input
11521 [[../../////]]
11522 !! result
11523 <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>
11524 </p>
11525 !! end
11526
11527 !! test
11528 Definition list code coverage
11529 !! input
11530 ; title : def
11531 ; title : def
11532 ;title: def
11533 !! result
11534 <dl><dt> title &#160;</dt><dd> def
11535 </dd><dt> title&#160;</dt><dd> def
11536 </dd><dt>title</dt><dd> def
11537 </dd></dl>
11538
11539 !! end
11540
11541 !! test
11542 Don't fall for the self-closing div
11543 !! input
11544 <div>hello world</div/>
11545 !! result
11546 <div>hello world</div>
11547
11548 !! end
11549
11550 !! test
11551 MSGNW magic word
11552 !! input
11553 {{MSGNW:msg}}
11554 !! result
11555 <p>&#91;&#91;:Template:Msg&#93;&#93;
11556 </p>
11557 !! end
11558
11559 !! test
11560 RAW magic word
11561 !! input
11562 {{RAW:QUERTY}}
11563 !! result
11564 <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>
11565 </p>
11566 !! end
11567
11568 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
11569 !! test
11570 Always escape literal '>' in output, not just after '<'
11571 !! input
11572 ><>
11573 !! result
11574 <p>&gt;&lt;&gt;
11575 </p>
11576 !! end
11577
11578 !! test
11579 Template caching
11580 !! input
11581 {{Test}}
11582 {{Test}}
11583 !! result
11584 <p>This is a test template
11585 This is a test template
11586 </p>
11587 !! end
11588
11589
11590 !! article
11591 MediaWiki:Fake
11592 !! text
11593 ==header==
11594 !! endarticle
11595
11596 !! test
11597 Inclusion of !userCanEdit() content
11598 !! input
11599 {{MediaWiki:Fake}}
11600 !! result
11601 <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>
11602
11603 !! end
11604
11605
11606 !! test
11607 Out-of-order TOC heading levels
11608 !! input
11609 ==2==
11610 ======6======
11611 ===3===
11612 =1=
11613 =====5=====
11614 ==2==
11615 !! result
11616 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11617 <ul>
11618 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
11619 <ul>
11620 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
11621 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
11622 </ul>
11623 </li>
11624 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
11625 <ul>
11626 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
11627 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
11628 </ul>
11629 </li>
11630 </ul>
11631 </td></tr></table>
11632 <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>
11633 <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>
11634 <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>
11635 <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>
11636 <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>
11637 <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>
11638
11639 !! end
11640
11641
11642 !! test
11643 ISBN with a dummy number
11644 !! input
11645 ISBN ---
11646 !! result
11647 <p>ISBN ---
11648 </p>
11649 !! end
11650
11651
11652 !! test
11653 ISBN with space-delimited number
11654 !! input
11655 ISBN 92 9017 032 8
11656 !! result
11657 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
11658 </p>
11659 !! end
11660
11661
11662 !! test
11663 ISBN with multiple spaces, no number
11664 !! input
11665 ISBN foo
11666 !! result
11667 <p>ISBN foo
11668 </p>
11669 !! end
11670
11671
11672 !! test
11673 ISBN length
11674 !! input
11675 ISBN 123456789
11676
11677 ISBN 1234567890
11678
11679 ISBN 12345678901
11680 !! result
11681 <p>ISBN 123456789
11682 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
11683 </p><p>ISBN 12345678901
11684 </p>
11685 !! end
11686
11687
11688 !! test
11689 ISBN with trailing year (bug 8110)
11690 !! input
11691 ISBN 1-234-56789-0 - 2006
11692
11693 ISBN 1 234 56789 0 - 2006
11694 !! result
11695 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
11696 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
11697 </p>
11698 !! end
11699
11700
11701 !! test
11702 anchorencode
11703 !! input
11704 {{anchorencode:foo bar©#%n}}
11705 !! result
11706 <p>foo_bar.C2.A9.23.25n
11707 </p>
11708 !! end
11709
11710 !! test
11711 anchorencode trims spaces
11712 !! input
11713 {{anchorencode: __pretty__please__}}
11714 !! result
11715 <p>pretty_please
11716 </p>
11717 !! end
11718
11719 !! test
11720 anchorencode deals with links
11721 !! input
11722 {{anchorencode: [[hello|world]] [[hi]]}}
11723 !! result
11724 <p>world_hi
11725 </p>
11726 !! end
11727
11728 !! test
11729 anchorencode deals with templates
11730 !! input
11731 {{anchorencode: {{Foo}} }}
11732 !! result
11733 <p>FOO
11734 </p>
11735 !! end
11736
11737 !! test
11738 anchorencode encodes like the TOC generator: (bug 18431)
11739 !! input
11740 === _ +:.3A%3A&&amp;]] ===
11741 {{anchorencode: _ +:.3A%3A&&amp;]] }}
11742 __NOEDITSECTION__
11743 !! result
11744 <h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
11745 <p>.2B:.3A.253A.26.26.5D.5D
11746 </p>
11747 !! end
11748
11749 # Expected output in the following test is not necessarily expected (there
11750 # should probably be <p> tags inside the <blockquote> in the output) -- it's
11751 # only testing for well-formedness.
11752 !! test
11753 Bug 6200: blockquotes and paragraph formatting
11754 !! input
11755 <blockquote>
11756 foo
11757 </blockquote>
11758
11759 bar
11760
11761 baz
11762 !! result
11763 <blockquote>
11764 foo
11765 </blockquote>
11766 <p>bar
11767 </p>
11768 <pre>baz
11769 </pre>
11770 !! end
11771
11772 !! test
11773 Bug 8293: Use of center tag ruins paragraph formatting
11774 !! input
11775 <center>
11776 foo
11777 </center>
11778
11779 bar
11780
11781 baz
11782 !! result
11783 <center>
11784 <p>foo
11785 </p>
11786 </center>
11787 <p>bar
11788 </p>
11789 <pre>baz
11790 </pre>
11791 !! end
11792
11793 !!test
11794 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
11795 !!options
11796 php
11797 !!input
11798 <span><s>x</span></s>
11799 !!result
11800 <p><span><s>x&lt;/span&gt;</s></span>
11801 </p>
11802 !!end
11803
11804 !!test
11805 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
11806 !!options
11807 parsoid
11808 !!input
11809 <span><s>x</span></s>
11810 !!result
11811 <p><span><s>x</s></span><s></s>
11812 </p>
11813 !!end
11814
11815 ###
11816 ### Language variants related tests
11817 ###
11818 !! test
11819 Self-link in language variants
11820 !! options
11821 title=[[Dunav]] language=sr
11822 !! input
11823 Both [[Dunav]] and [[Дунав]] are names for this river.
11824 !! result
11825 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
11826 </p>
11827 !!end
11828
11829 !! article
11830 Дуна
11831 !! text
11832 content
11833 !! endarticle
11834
11835 !! test
11836 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
11837 !! options
11838 title=[[Duna]] language=sr
11839 !! input
11840 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
11841 !! result
11842 <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.
11843 </p>
11844 !! end
11845
11846 !! test
11847 Link to pages in language variants
11848 !! options
11849 language=sr
11850 !! input
11851 Main Page can be written as [[Маин Паге]]
11852 !! result
11853 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
11854 </p>
11855 !!end
11856
11857
11858 !! test
11859 Multiple links to pages in language variants
11860 !! options
11861 language=sr
11862 !! input
11863 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
11864 !! result
11865 <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>.
11866 </p>
11867 !!end
11868
11869
11870 !! test
11871 Simple template in language variants
11872 !! options
11873 language=sr
11874 !! input
11875 {{тест}}
11876 !! result
11877 <p>This is a test template
11878 </p>
11879 !! end
11880
11881
11882 !! test
11883 Template with explicit namespace in language variants
11884 !! options
11885 language=sr
11886 !! input
11887 {{Template:тест}}
11888 !! result
11889 <p>This is a test template
11890 </p>
11891 !! end
11892
11893
11894 !! test
11895 Basic test for template parameter in language variants
11896 !! options
11897 language=sr
11898 !! input
11899 {{парамтест|param=foo}}
11900 !! result
11901 <p>This is a test template with parameter foo
11902 </p>
11903 !! end
11904
11905
11906 !! test
11907 Simple category in language variants
11908 !! options
11909 language=sr cat
11910 !! input
11911 [[Category:МедиаWики Усер'с Гуиде]]
11912 !! result
11913 <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>
11914 !! end
11915
11916
11917 !! article
11918 Category:分类
11919 !! text
11920 blah
11921 !! endarticle
11922
11923 !! article
11924 Category:分類
11925 !! text
11926 blah
11927 !! endarticle
11928
11929 !! test
11930 Don't convert blue categorylinks to another variant (bug 33210)
11931 !! options
11932 language=zh cat
11933 !! input
11934 [[A]][[Category:分类]]
11935 !! result
11936 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
11937 !! end
11938
11939
11940 !! test
11941 Stripping -{}- tags (language variants)
11942 !! options
11943 language=sr
11944 !! input
11945 Latin proverb: -{Ne nuntium necare}-
11946 !! result
11947 <p>Latin proverb: Ne nuntium necare
11948 </p>
11949 !! end
11950
11951
11952 !! test
11953 Prevent conversion with -{}- tags (language variants)
11954 !! options
11955 language=sr variant=sr-ec
11956 !! input
11957 Latinski: -{Ne nuntium necare}-
11958 !! result
11959 <p>Латински: Ne nuntium necare
11960 </p>
11961 !! end
11962
11963
11964 !! test
11965 Prevent conversion of text with -{}- tags (language variants)
11966 !! options
11967 language=sr variant=sr-ec
11968 !! input
11969 Latinski: -{Ne nuntium necare}-
11970 !! result
11971 <p>Латински: Ne nuntium necare
11972 </p>
11973 !! end
11974
11975
11976 !! test
11977 Prevent conversion of links with -{}- tags (language variants)
11978 !! options
11979 language=sr variant=sr-ec
11980 !! input
11981 -{[[Main Page]]}-
11982 !! result
11983 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11984 </p>
11985 !! end
11986
11987
11988 !! test
11989 -{}- tags within headlines (within html for parserConvert())
11990 !! options
11991 language=sr variant=sr-ec
11992 !! input
11993 == -{Naslov}- ==
11994 !! result
11995 <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>
11996
11997 !! end
11998
11999
12000 !! test
12001 Explicit definition of language variant alternatives
12002 !! options
12003 language=zh variant=zh-tw
12004 !! input
12005 -{zh:China;zh-tw:Taiwan}-, not China
12006 !! result
12007 <p>Taiwan, not China
12008 </p>
12009 !! end
12010
12011
12012 !! test
12013 Conversion around HTML tags
12014 !! options
12015 language=sr variant=sr-ec
12016 !! input
12017 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
12018 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
12019 !! result
12020 <p>
12021 <span title="ЛаCтин">ски</span>
12022 </p>
12023 !! end
12024
12025
12026 !! test
12027 Explicit session-wise language variant mapping (A flag and - flag)
12028 !! options
12029 language=zh variant=zh-tw
12030 !! input
12031 Taiwan is not China.
12032 But -{A|zh:China;zh-tw:Taiwan}- is China,
12033 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
12034 and -{China}- is China.
12035 !! result
12036 <p>Taiwan is not China.
12037 But Taiwan is Taiwan,
12038 (This should be stripped!)
12039 and China is China.
12040 </p>
12041 !! end
12042
12043 !! test
12044 Explicit session-wise language variant mapping (H flag for hide)
12045 !! options
12046 language=zh variant=zh-tw
12047 !! input
12048 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
12049 Taiwan is China.
12050 !! result
12051 <p>(This should be stripped!)
12052 Taiwan is Taiwan.
12053 </p>
12054 !! end
12055
12056 !! test
12057 Adding explicit conversion rule for title (T flag)
12058 !! options
12059 language=zh variant=zh-tw showtitle
12060 !! input
12061 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12062 !! result
12063 Taiwan
12064 <p>Should be stripped!
12065 </p>
12066 !! end
12067
12068 !! test
12069 Testing that changing the language variant here in the tests actually works
12070 !! options
12071 language=zh variant=zh showtitle
12072 !! input
12073 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12074 !! result
12075 China
12076 <p>Should be stripped!
12077 </p>
12078 !! end
12079
12080 !! test
12081 Recursive conversion of alt and title attrs shouldn't clear converter state
12082 !! options
12083 language=zh variant=zh-cn showtitle
12084 !! input
12085 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
12086 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
12087 !! result
12088 China
12089 <p>
12090 Should be stripped<span title="Exclamation">!</span>
12091 </p>
12092 !! end
12093
12094 !! test
12095 Bug 24072: more test on conversion rule for title
12096 !! options
12097 language=zh variant=zh-tw showtitle
12098 !! input
12099 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12100 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
12101 !! result
12102 Taiwan
12103 <p>This should be stripped!
12104 This won't take interferes with the title rule.
12105 </p>
12106 !! end
12107
12108 !! test
12109 Raw output of variant escape tags (R flag)
12110 !! options
12111 language=zh variant=zh-tw
12112 !! input
12113 Raw: -{R|zh:China;zh-tw:Taiwan}-
12114 !! result
12115 <p>Raw: zh:China;zh-tw:Taiwan
12116 </p>
12117 !! end
12118
12119 !! test
12120 Nested using of manual convert syntax
12121 !! options
12122 language=zh variant=zh-hk
12123 !! input
12124 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
12125 !! result
12126 <p>Nested: Hello Hong Kong!
12127 </p>
12128 !! end
12129
12130 !! test
12131 Proper conversion of text in external links
12132 !! options
12133 language=sr variant=sr-ec
12134 !! input
12135 http://www.google.com
12136 gopher://www.google.com
12137 [http://www.google.com http://www.google.com]
12138 [gopher://www.google.com gopher://www.google.com]
12139 [https://www.google.com irc://www.google.com]
12140 [ftp://www.google.com www.google.com/ftp://dir]
12141 [//www.google.com www.google.com]
12142 !! result
12143 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12144 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12145 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12146 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12147 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
12148 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
12149 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
12150 </p>
12151 !! end
12152
12153 !! test
12154 Do not convert roman numbers to language variants
12155 !! options
12156 language=sr variant=sr-ec
12157 !! input
12158 Fridrih IV je car.
12159 !! result
12160 <p>Фридрих IV је цар.
12161 </p>
12162 !! end
12163
12164 !! test
12165 Unclosed language converter markup "-{"
12166 !! options
12167 language=sr
12168 !! input
12169 -{T|hello
12170 !! result
12171 <p>-{T|hello
12172 </p>
12173 !! end
12174
12175 !! test
12176 Don't convert raw rule "-{R|=&gt;}-" to "=>"
12177 !! options
12178 language=sr
12179 !! input
12180 -{R|=&gt;}-
12181 !! result
12182 <p>=&gt;
12183 </p>
12184 !!end
12185
12186 !!article
12187 Template:Bullet
12188 !!text
12189 * Bar
12190 !!endarticle
12191
12192 !! test
12193 Bug 529: Uncovered bullet
12194 !! input
12195 * Foo {{bullet}}
12196 !! result
12197 <ul><li> Foo
12198 </li><li> Bar
12199 </li></ul>
12200
12201 !! end
12202
12203 # Plain MediaWiki does not remove empty lists, but tidy actually does.
12204 # Templates in Wikipedia rely on this behavior, as tidy has always been
12205 # enabled there. These tests are normally run *without* tidy, so specify the
12206 # full output here.
12207 # To test realistic parsing behavior, apply a tidy-like transformation to both
12208 # the expected output and your parser's output.
12209 !! test
12210 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
12211 !! input
12212 ******* Foo {{bullet}}
12213 !! result
12214 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
12215 </li></ul>
12216 </li></ul>
12217 </li></ul>
12218 </li></ul>
12219 </li></ul>
12220 </li></ul>
12221 </li><li> Bar
12222 </li></ul>
12223
12224 !! end
12225
12226 !! test
12227 Bug 529: Uncovered table already at line-start
12228 !! input
12229 x
12230
12231 {{table}}
12232 y
12233 !! result
12234 <p>x
12235 </p>
12236 <table>
12237 <tr>
12238 <td> 1 </td>
12239 <td> 2
12240 </td></tr>
12241 <tr>
12242 <td> 3 </td>
12243 <td> 4
12244 </td></tr></table>
12245 <p>y
12246 </p>
12247 !! end
12248
12249 !! test
12250 Bug 529: Uncovered bullet in parser function result
12251 !! input
12252 * Foo {{lc:{{bullet}} }}
12253 !! result
12254 <ul><li> Foo
12255 </li><li> bar
12256 </li></ul>
12257
12258 !! end
12259
12260 !! test
12261 Bug 5678: Double-parsed template argument
12262 !! input
12263 {{lc:{{{1}}}|hello}}
12264 !! result
12265 <p>{{{1}}}
12266 </p>
12267 !! end
12268
12269 !! test
12270 Bug 5678: Double-parsed template invocation
12271 !! input
12272 {{lc:{{paramtest {{!}} param = hello }} }}
12273 !! result
12274 <p>{{paramtest | param = hello }}
12275 </p>
12276 !! end
12277
12278 !! test
12279 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
12280 !! options
12281 language=cs
12282 title=[[Main Page]]
12283 !! input
12284 {{PRVNÍVELKÉ:ěščř}}
12285 {{prvnívelké:ěščř}}
12286 {{PRVNÍMALÉ:ěščř}}
12287 {{prvnímalé:ěščř}}
12288 {{MALÁ:ěščř}}
12289 {{malá:ěščř}}
12290 {{VELKÁ:ěščř}}
12291 {{velká:ěščř}}
12292 !! result
12293 <p>Ěščř
12294 Ěščř
12295 ěščř
12296 ěščř
12297 ěščř
12298 ěščř
12299 ĚŠČŘ
12300 ĚŠČŘ
12301 </p>
12302 !! end
12303
12304 !! test
12305 Morwen/13: Unclosed link followed by heading
12306 !! input
12307 [[link
12308 ==heading==
12309 !! result
12310 <p>[[link
12311 </p>
12312 <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>
12313
12314 !! end
12315
12316 !! test
12317 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
12318 !! input
12319 {{foo|
12320 =heading=
12321 !! result
12322 <p>{{foo|
12323 </p>
12324 <h1> <span class="mw-headline" id="heading">heading</span></h1>
12325
12326 !! end
12327
12328 !! test
12329 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
12330 !! input
12331 {{foo|
12332 ==heading==
12333 !! result
12334 <p>{{foo|
12335 </p>
12336 <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>
12337
12338 !! end
12339
12340 !! test
12341 Tildes in comments
12342 !! options
12343 pst
12344 !! input
12345 <!-- ~~~~ -->
12346 !! result
12347 <!-- ~~~~ -->
12348 !! end
12349
12350 !! test
12351 Paragraphs inside divs (no extra line breaks)
12352 !! input
12353 <div>Line one
12354
12355 Line two</div>
12356 !! result
12357 <div>Line one
12358 Line two</div>
12359
12360 !! end
12361
12362 !! test
12363 Paragraphs inside divs (extra line break on open)
12364 !! input
12365 <div>
12366 Line one
12367
12368 Line two</div>
12369 !! result
12370 <div>
12371 <p>Line one
12372 </p>
12373 Line two</div>
12374
12375 !! end
12376
12377 !! test
12378 Paragraphs inside divs (extra line break on close)
12379 !! input
12380 <div>Line one
12381
12382 Line two
12383 </div>
12384 !! result
12385 <div>Line one
12386 <p>Line two
12387 </p>
12388 </div>
12389
12390 !! end
12391
12392 !! test
12393 Paragraphs inside divs (extra line break on open and close)
12394 !! input
12395 <div>
12396 Line one
12397
12398 Line two
12399 </div>
12400 !! result
12401 <div>
12402 <p>Line one
12403 </p><p>Line two
12404 </p>
12405 </div>
12406
12407 !! end
12408
12409 !! test
12410 Nesting tags, paragraphs on lines which begin with <div>
12411 !! options
12412 disabled
12413 !! input
12414 <div></div><strong>A
12415 B</strong>
12416 !! result
12417 <div></div>
12418 <p><strong>A
12419 B</strong>
12420 </p>
12421 !! end
12422
12423 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
12424 !! test
12425 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
12426 !! options
12427 disabled
12428 !! input
12429 <blockquote>Line one
12430
12431 Line two</blockquote>
12432 !! result
12433 <blockquote>Line one
12434 Line two</blockquote>
12435
12436 !! end
12437
12438 !! test
12439 Bug 6200: paragraphs inside blockquotes (extra line break on open)
12440 !! options
12441 disabled
12442 !! input
12443 <blockquote>
12444 Line one
12445
12446 Line two</blockquote>
12447 !! result
12448 <blockquote>
12449 <p>Line one
12450 </p>
12451 Line two</blockquote>
12452
12453 !! end
12454
12455 !! test
12456 Bug 6200: paragraphs inside blockquotes (extra line break on close)
12457 !! options
12458 disabled
12459 !! input
12460 <blockquote>Line one
12461
12462 Line two
12463 </blockquote>
12464 !! result
12465 <blockquote>Line one
12466 <p>Line two
12467 </p>
12468 </blockquote>
12469
12470 !! end
12471
12472 !! test
12473 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
12474 !! options
12475 disabled
12476 !! input
12477 <blockquote>
12478 Line one
12479
12480 Line two
12481 </blockquote>
12482 !! result
12483 <blockquote>
12484 <p>Line one
12485 </p><p>Line two
12486 </p>
12487 </blockquote>
12488
12489 !! end
12490
12491 !! test
12492 Paragraphs inside blockquotes/divs (no extra line breaks)
12493 !! input
12494 <blockquote><div>Line one
12495
12496 Line two</div></blockquote>
12497 !! result
12498 <blockquote><div>Line one
12499 Line two</div></blockquote>
12500
12501 !! end
12502
12503 !! test
12504 Paragraphs inside blockquotes/divs (extra line break on open)
12505 !! input
12506 <blockquote><div>
12507 Line one
12508
12509 Line two</div></blockquote>
12510 !! result
12511 <blockquote><div>
12512 <p>Line one
12513 </p>
12514 Line two</div></blockquote>
12515
12516 !! end
12517
12518 !! test
12519 Paragraphs inside blockquotes/divs (extra line break on close)
12520 !! input
12521 <blockquote><div>Line one
12522
12523 Line two
12524 </div></blockquote>
12525 !! result
12526 <blockquote><div>Line one
12527 <p>Line two
12528 </p>
12529 </div></blockquote>
12530
12531 !! end
12532
12533 !! test
12534 Paragraphs inside blockquotes/divs (extra line break on open and close)
12535 !! input
12536 <blockquote><div>
12537 Line one
12538
12539 Line two
12540 </div></blockquote>
12541 !! result
12542 <blockquote><div>
12543 <p>Line one
12544 </p><p>Line two
12545 </p>
12546 </div></blockquote>
12547
12548 !! end
12549
12550 !! test
12551 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
12552 !! options
12553 wgLinkHolderBatchSize=0
12554 !! input
12555 [[meatball:1]]
12556 [[meatball:2]]
12557 [[meatball:3]]
12558 !! result
12559 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
12560 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
12561 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
12562 </p>
12563 !! end
12564
12565 !! test
12566 Free external link invading image caption
12567 !! input
12568 [[Image:Foobar.jpg|thumb|http://x|hello]]
12569 !! result
12570 <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>
12571
12572 !! end
12573
12574 !! test
12575 Bug 15196: localised external link numbers
12576 !! options
12577 language=fa
12578 !! input
12579 [http://en.wikipedia.org/]
12580 !! result
12581 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
12582 </p>
12583 !! end
12584
12585 !! test
12586 Multibyte character in padleft
12587 !! input
12588 {{padleft:-Hello|7|Æ}}
12589 !! result
12590 <p>Æ-Hello
12591 </p>
12592 !! end
12593
12594 !! test
12595 Multibyte character in padright
12596 !! input
12597 {{padright:Hello-|7|Æ}}
12598 !! result
12599 <p>Hello-Æ
12600 </p>
12601 !! end
12602
12603 !!test
12604 formatdate parser function
12605 !!input
12606 {{#formatdate:2009-03-24}}
12607 !! result
12608 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
12609 </p>
12610 !! end
12611
12612 !!test
12613 formatdate parser function, with default format
12614 !!input
12615 {{#formatdate:2009-03-24|mdy}}
12616 !! result
12617 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
12618 </p>
12619 !! end
12620
12621 !! test
12622 Spacing of numbers in formatted dates
12623 !! input
12624 {{#formatdate:January 15}}
12625 !! result
12626 <p><span class="mw-formatted-date" title="01-15">January 15</span>
12627 </p>
12628 !! end
12629
12630 !! test
12631 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
12632 !! options
12633 language=nl title=[[MediaWiki:Common.css]]
12634 !! input
12635 {{#formatdate:2009-03-24|dmy}}
12636 !! result
12637 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
12638 </p>
12639 !! end
12640
12641 #
12642 #
12643 #
12644
12645 #
12646 # Edit comments
12647 #
12648
12649 !! test
12650 Edit comment with link
12651 !! options
12652 comment
12653 !! input
12654 I like the [[Main Page]] a lot
12655 !! result
12656 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
12657 !!end
12658
12659 !! test
12660 Edit comment with link and link text
12661 !! options
12662 comment
12663 !! input
12664 I like the [[Main Page|best pages]] a lot
12665 !! result
12666 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
12667 !!end
12668
12669 !! test
12670 Edit comment with link and link text with suffix
12671 !! options
12672 comment
12673 !! input
12674 I like the [[Main Page|best page]]s a lot
12675 !! result
12676 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
12677 !!end
12678
12679 !! test
12680 Edit comment with section link (non-local, eg in history list)
12681 !! options
12682 comment title=[[Main Page]]
12683 !! input
12684 /* External links */ removed bogus entries
12685 !! result
12686 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12687 !!end
12688
12689 !! test
12690 Edit comment with section link and text before it (non-local, eg in history list)
12691 !! options
12692 comment title=[[Main Page]]
12693 !! input
12694 pre-comment text /* External links */ removed bogus entries
12695 !! result
12696 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>
12697 !!end
12698
12699 !! test
12700 Edit comment with section link (local, eg in diff view)
12701 !! options
12702 comment local title=[[Main Page]]
12703 !! input
12704 /* External links */ removed bogus entries
12705 !! result
12706 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12707 !!end
12708
12709 !! test
12710 Edit comment with subpage link (bug 14080)
12711 !! options
12712 comment
12713 subpage
12714 title=[[Subpage test]]
12715 !! input
12716 Poked at a [[/subpage]] here...
12717 !! result
12718 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
12719 !!end
12720
12721 !! test
12722 Edit comment with subpage link and link text (bug 14080)
12723 !! options
12724 comment
12725 subpage
12726 title=[[Subpage test]]
12727 !! input
12728 Poked at a [[/subpage|neat little page]] here...
12729 !! result
12730 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
12731 !!end
12732
12733 !! test
12734 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
12735 !! options
12736 comment
12737 title=[[Subpage test]]
12738 !! input
12739 Poked at a [[/subpage]] here...
12740 !! result
12741 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...
12742 !!end
12743
12744 !! test
12745 Edit comment with bare anchor link (local, as on diff)
12746 !! options
12747 comment
12748 local
12749 title=[[Main Page]]
12750 !!input
12751 [[#section]]
12752 !! result
12753 <a href="#section">#section</a>
12754 !! end
12755
12756 !! test
12757 Edit comment with bare anchor link (non-local, as on history)
12758 !! options
12759 comment
12760 title=[[Main Page]]
12761 !!input
12762 [[#section]]
12763 !! result
12764 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
12765 !! end
12766
12767 !! test
12768 Anchor starting with underscore
12769 !!input
12770 [[#_ref|One]]
12771 !! result
12772 <p><a href="#_ref">One</a>
12773 </p>
12774 !! end
12775
12776 !! test
12777 Id starting with underscore
12778 !!input
12779 <div id="_ref"></div>
12780 !! result
12781 <div id="_ref"></div>
12782
12783 !! end
12784
12785 !! test
12786 Space normalisation on autocomment (bug 22784)
12787 !! options
12788 comment
12789 title=[[Main Page]]
12790 !!input
12791 /* __hello__world__ */
12792 !! result
12793 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
12794 !! end
12795
12796 !! test
12797 percent-encoding and + signs in comments (Bug 26410)
12798 !! options
12799 comment
12800 !!input
12801 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
12802 !! result
12803 <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>
12804 !! end
12805
12806 !! test
12807 Bad images - basic functionality
12808 !! options
12809 disabled
12810 !! input
12811 [[File:Bad.jpg]]
12812 !! result
12813 !! end
12814
12815 !! test
12816 Bad images - bug 16039: text after bad image disappears
12817 !! options
12818 disabled
12819 !! input
12820 Foo bar
12821 [[File:Bad.jpg]]
12822 Bar foo
12823 !! result
12824 <p>Foo bar
12825 </p><p>Bar foo
12826 </p>
12827 !! end
12828
12829 !! test
12830 Verify that displaytitle works (bug #22501) no displaytitle
12831 !! options
12832 showtitle
12833 !! config
12834 wgAllowDisplayTitle=true
12835 wgRestrictDisplayTitle=false
12836 !! input
12837 this is not the the title
12838 !! result
12839 Parser test
12840 <p>this is not the the title
12841 </p>
12842 !! end
12843
12844 !! test
12845 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
12846 !! options
12847 showtitle
12848 title=[[Screen]]
12849 !! config
12850 wgAllowDisplayTitle=true
12851 wgRestrictDisplayTitle=false
12852 !! input
12853 this is not the the title
12854 {{DISPLAYTITLE:whatever}}
12855 !! result
12856 whatever
12857 <p>this is not the the title
12858 </p>
12859 !! end
12860
12861 !! test
12862 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
12863 !! options
12864 showtitle
12865 title=[[Screen]]
12866 !! config
12867 wgAllowDisplayTitle=true
12868 wgRestrictDisplayTitle=true
12869 !! input
12870 this is not the the title
12871 {{DISPLAYTITLE:whatever}}
12872 !! result
12873 Screen
12874 <p>this is not the the title
12875 </p>
12876 !! end
12877
12878 !! test
12879 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
12880 !! options
12881 showtitle
12882 title=[[Screen]]
12883 !! config
12884 wgAllowDisplayTitle=true
12885 wgRestrictDisplayTitle=true
12886 !! input
12887 this is not the the title
12888 {{DISPLAYTITLE:screen}}
12889 !! result
12890 screen
12891 <p>this is not the the title
12892 </p>
12893 !! end
12894
12895 !! test
12896 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
12897 !! options
12898 showtitle
12899 title=[[Screen]]
12900 !! config
12901 wgAllowDisplayTitle=false
12902 !! input
12903 this is not the the title
12904 {{DISPLAYTITLE:screen}}
12905 !! result
12906 Screen
12907 <p>this is not the the title
12908 <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>
12909 </p>
12910 !! end
12911
12912 !! test
12913 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
12914 !! options
12915 showtitle
12916 title=[[Screen]]
12917 !! config
12918 wgAllowDisplayTitle=false
12919 !! input
12920 this is not the the title
12921 !! result
12922 Screen
12923 <p>this is not the the title
12924 </p>
12925 !! end
12926
12927 !! test
12928 preload: check <noinclude> and <includeonly>
12929 !! options
12930 preload
12931 !! input
12932 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
12933 !! result
12934 Hello kind world.
12935 !! end
12936
12937 !! test
12938 preload: check <onlyinclude>
12939 !! options
12940 preload
12941 !! input
12942 Goodbye <onlyinclude>Hello world</onlyinclude>
12943 !! result
12944 Hello world
12945 !! end
12946
12947 !! test
12948 preload: can pass tags through if we want to
12949 !! options
12950 preload
12951 !! input
12952 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
12953 !! result
12954 <includeonly>Hello world</includeonly>
12955 !! end
12956
12957 !! test
12958 preload: check that it doesn't try to do tricks
12959 !! options
12960 preload
12961 !! input
12962 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12963 !! result
12964 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12965 !! end
12966
12967 !! test
12968 Play a bit with r67090 and bug 3158
12969 !! options
12970 disabled
12971 !! input
12972 <div style="width:50% !important">&nbsp;</div>
12973 <div style="width:50%&nbsp;!important">&nbsp;</div>
12974 <div style="width:50%&#160;!important">&nbsp;</div>
12975 <div style="border : solid;">&nbsp;</div>
12976 !! result
12977 <div style="width:50% !important">&nbsp;</div>
12978 <div style="width:50% !important">&nbsp;</div>
12979 <div style="width:50% !important">&nbsp;</div>
12980 <div style="border&#160;: solid;">&nbsp;</div>
12981
12982 !! end
12983
12984 !! test
12985 HTML5 data attributes
12986 !! input
12987 <span data-foo="bar">Baz</span>
12988 <p data-abc-def_hij="">Quuz</p>
12989 !! result
12990 <p><span data-foo="bar">Baz</span>
12991 </p>
12992 <p data-abc-def_hij="">Quuz</p>
12993
12994 !! end
12995
12996 !! test
12997 percent-encoding and + signs in internal links (Bug 26410)
12998 !! input
12999 [[User:+%]] [[Page+title%]]
13000 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
13001 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
13002 [[%33%45]] [[%33%45+]]
13003 !! result
13004 <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>
13005 <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>
13006 <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>
13007 <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>
13008 </p>
13009 !! end
13010
13011 !! test
13012 Special characters in embedded file links (bug 27679)
13013 !! input
13014 [[File:Contains & ampersand.jpg]]
13015 [[File:Does not exist.jpg|Title with & ampersand]]
13016 !! result
13017 <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>
13018 <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>
13019 </p>
13020 !! end
13021
13022
13023 !! test
13024 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
13025 !! input
13026 Text&apos;s been normalized?
13027 !! result
13028 <p>Text&#39;s been normalized?
13029 </p>
13030 !! end
13031
13032 !! test
13033 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
13034 !! input
13035 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
13036 !! result
13037 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
13038 </p>
13039 !! end
13040
13041 !! test
13042 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
13043 !! input
13044 [http://www.example.org/ ideograms]
13045 !! result
13046 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
13047 </p>
13048 !! end
13049
13050 !! test
13051 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
13052 !! input
13053 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
13054 !! result
13055 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
13056 </p>
13057 !! end
13058
13059 !! article
13060 Mediawiki:loop1
13061 !! text
13062 {{Identical|A}}
13063 !! endarticle
13064
13065 !! article
13066 Mediawiki:loop2
13067 !! text
13068 {{Identical|B}}
13069 !! endarticle
13070
13071 !! article
13072 Template:Identical
13073 !! text
13074 {{int:loop1}}
13075 {{int:loop2}}
13076 !! endarticle
13077
13078 !! test
13079 Bug 31098 Template which includes system messages which includes the template
13080 !! input
13081 {{Identical}}
13082 !! result
13083 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13084 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13085 </p>
13086 !! end
13087
13088 !! test
13089 Bug31490 Turkish: ucfirst 'blah'
13090 !! options
13091 language=tr
13092 !! input
13093 {{ucfirst:blah}}
13094 !! result
13095 <p>Blah
13096 </p>
13097 !! end
13098
13099 !! test
13100 Bug31490 Turkish: ucfirst 'ix'
13101 !! options
13102 language=tr
13103 !! input
13104 {{ucfirst:ix}}
13105 !! result
13106 <p>İx
13107 </p>
13108 !! end
13109
13110 !! test
13111 Bug31490 Turkish: lcfirst 'BLAH'
13112 !! options
13113 language=tr
13114 !! input
13115 {{lcfirst:BLAH}}
13116 !! result
13117 <p>bLAH
13118 </p>
13119 !! end
13120
13121 !! test
13122 Bug31490 Turkish: ucfırst (with a dotless i)
13123 !! options
13124 language=tr
13125 !! input
13126 {{ucfırst:blah}}
13127 !! result
13128 <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>
13129 </p>
13130 !! end
13131
13132 !! test
13133 Bug31490 ucfırst (with a dotless i) with English language
13134 !! options
13135 language=en
13136 !! input
13137 {{ucfırst:blah}}
13138 !! result
13139 <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>
13140 </p>
13141 !! end
13142
13143 !! test
13144 Bug 26375: TOC with italics
13145 !! options
13146 title=[[Main Page]]
13147 !! input
13148 __TOC__
13149 == ''Lost'' episodes ==
13150 !! result
13151 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13152 <ul>
13153 <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>
13154 </ul>
13155 </td></tr></table>
13156 <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>
13157
13158 !! end
13159
13160 !! test
13161 Bug 26375: TOC with bold
13162 !! options
13163 title=[[Main Page]]
13164 !! input
13165 __TOC__
13166 == '''should be bold''' then normal text ==
13167 !! result
13168 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13169 <ul>
13170 <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>
13171 </ul>
13172 </td></tr></table>
13173 <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>
13174
13175 !! end
13176
13177 !! test
13178 Bug 33845: Headings become cursive in TOC when they contain an image
13179 !! options
13180 title=[[Main Page]]
13181 !! input
13182 __TOC__
13183 == Image [[Image:foobar.jpg]] ==
13184 !! result
13185 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13186 <ul>
13187 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
13188 </ul>
13189 </td></tr></table>
13190 <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>
13191
13192 !! end
13193
13194 !! test
13195 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
13196 !! options
13197 title=[[Main Page]]
13198 !! input
13199 __TOC__
13200 == <blockquote>Quote</blockquote> ==
13201 !! result
13202 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13203 <ul>
13204 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
13205 </ul>
13206 </td></tr></table>
13207 <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>
13208
13209 !! end
13210
13211 !! test
13212 Unclosed tags in TOC
13213 !! options
13214 title=[[Main Page]]
13215 !! input
13216 __TOC__
13217 == Proof: 2 < 3 ==
13218 <small>Hanc marginis exiguitas non caperet.</small>
13219 QED
13220 !! result
13221 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13222 <ul>
13223 <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>
13224 </ul>
13225 </td></tr></table>
13226 <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>
13227 <p><small>Hanc marginis exiguitas non caperet.</small>
13228 QED
13229 </p>
13230 !! end
13231
13232 !! test
13233 Multiple tags in TOC
13234 !! input
13235 __TOC__
13236 == <i>Foo</i> <b>Bar</b> ==
13237
13238 == <i>Foo</i> <blockquote>Bar</blockquote> ==
13239 !! result
13240 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13241 <ul>
13242 <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>
13243 <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>
13244 </ul>
13245 </td></tr></table>
13246 <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>
13247 <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>
13248
13249 !! end
13250
13251 !! test
13252 Tags with parameters in TOC
13253 !! input
13254 __TOC__
13255 == <sup class="in-h2">Hello</sup> ==
13256
13257 == <sup class="a > b">Evilbye</sup> ==
13258 !! result
13259 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13260 <ul>
13261 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
13262 <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>
13263 </ul>
13264 </td></tr></table>
13265 <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>
13266 <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>
13267
13268 !! end
13269
13270 !! test
13271 span tags with directionality in TOC
13272 !! input
13273 __TOC__
13274 == <span dir="ltr">C++</span> ==
13275
13276 == <span dir="rtl">זבנג!</span> ==
13277
13278 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
13279
13280 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
13281
13282 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
13283 !! result
13284 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13285 <ul>
13286 <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>
13287 <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>
13288 <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>
13289 <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>
13290 <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>
13291 </ul>
13292 </td></tr></table>
13293 <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>
13294 <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>
13295 <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>
13296 <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>
13297 <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>
13298
13299 !! end
13300
13301 !! article
13302 MediaWiki:Bug32057
13303 !! text
13304 == {{int:headline_sample}} ==
13305 !! endarticle
13306
13307 !! test
13308 Bug 32057: Title needed when expanding <h> nodes.
13309 !! options
13310 title=[[Main Page]]
13311 !! input
13312 {{int:Bug32057}}
13313 !! result
13314 <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>
13315
13316 !! end
13317
13318 !! test
13319 Strip marker in urlencode
13320 !! input
13321 {{urlencode:x<nowiki/>y}}
13322 {{urlencode:x<nowiki/>y|wiki}}
13323 {{urlencode:x<nowiki/>y|path}}
13324 !! result
13325 <p>xy
13326 xy
13327 xy
13328 </p>
13329 !! end
13330
13331 !! test
13332 Strip marker in lc
13333 !! input
13334 {{lc:x<nowiki/>y}}
13335 !! result
13336 <p>xy
13337 </p>
13338 !! end
13339
13340 !! test
13341 Strip marker in uc
13342 !! input
13343 {{uc:x<nowiki/>y}}
13344 !! result
13345 <p>XY
13346 </p>
13347 !! end
13348
13349 !! test
13350 Strip marker in formatNum
13351 !! input
13352 {{formatnum:1<nowiki/>2}}
13353 {{formatnum:1<nowiki/>2|R}}
13354 !! result
13355 <p>12
13356 12
13357 </p>
13358 !! end
13359
13360 !! test
13361 Check noCommafy in formatNum
13362 !! options
13363 language=be-tarask
13364 !! input
13365 {{formatnum:123456.78}}
13366 {{formatnum:123456.78|NOSEP}}
13367 !! result
13368 <p>123 456,78
13369 123456.78
13370 </p>
13371 !! end
13372
13373 !! test
13374 Strip marker in grammar
13375 !! options
13376 language=fi
13377 !! input
13378 {{grammar:elative|foo<nowiki/>bar}}
13379 !! result
13380 <p>foobarista
13381 </p>
13382 !! end
13383
13384 !! test
13385 Strip marker in padleft
13386 !! input
13387 {{padleft:|2|x<nowiki/>y}}
13388 !! result
13389 <p>xy
13390 </p>
13391 !! end
13392
13393 !! test
13394 Strip marker in padright
13395 !! input
13396 {{padright:|2|x<nowiki/>y}}
13397 !! result
13398 <p>xy
13399 </p>
13400 !! end
13401
13402 !! test
13403 Strip marker in anchorencode
13404 !! input
13405 {{anchorencode:x<nowiki/>y}}
13406 !! result
13407 <p>xy
13408 </p>
13409 !! end
13410
13411 !! test
13412 nowiki inside link inside heading (bug 18295)
13413 !! input
13414 ==[[foo|x<nowiki>y</nowiki>z]]==
13415 !! result
13416 <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>
13417
13418 !! end
13419
13420 !! test
13421 new support for bdi element (bug 31817)
13422 !! input
13423 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
13424 !! result
13425 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
13426
13427 !!end
13428
13429 !! test
13430 Ignore pipe between table row attributes
13431 !! input
13432 {|
13433 | quux
13434 |- id=foo | style='color: red'
13435 | bar
13436 |}
13437 !! result
13438 <table>
13439 <tr>
13440 <td> quux
13441 </td></tr>
13442 <tr id="foo" style="color: red">
13443 <td> bar
13444 </td></tr></table>
13445
13446 !! end
13447
13448 !!test
13449 Gallery override link with WikiLink (bug 34852)
13450 !! input
13451 <gallery>
13452 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
13453 </gallery>
13454 !! result
13455 <ul class="gallery">
13456 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13457 <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>
13458 <div class="gallerytext">
13459 <p>caption
13460 </p>
13461 </div>
13462 </div></li>
13463 </ul>
13464
13465 !! end
13466
13467 !!test
13468 Gallery override link with absolute external link (bug 34852)
13469 !! input
13470 <gallery>
13471 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
13472 </gallery>
13473 !! result
13474 <ul class="gallery">
13475 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13476 <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>
13477 <div class="gallerytext">
13478 <p>caption
13479 </p>
13480 </div>
13481 </div></li>
13482 </ul>
13483
13484 !! end
13485
13486 !!test
13487 Gallery override link with malicious javascript (bug 34852)
13488 !! input
13489 <gallery>
13490 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
13491 </gallery>
13492 !! result
13493 <ul class="gallery">
13494 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13495 <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>
13496 <div class="gallerytext">
13497 <p>caption
13498 </p>
13499 </div>
13500 </div></li>
13501 </ul>
13502
13503 !! end
13504
13505 !!test
13506 Gallery with invalid title as link (bug 43964)
13507 !! input
13508 <gallery>
13509 File:foobar.jpg|link=<
13510 </gallery>
13511 !! result
13512 <ul class="gallery">
13513 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13514 <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>
13515 <div class="gallerytext">
13516 </div>
13517 </div></li>
13518 </ul>
13519
13520 !! end
13521
13522 !!test
13523 Language parser function
13524 !! input
13525 {{#language:ar}}
13526 !! result
13527 <p>العربية
13528 </p>
13529 !! end
13530
13531 !!test
13532 Padleft and padright as substr
13533 !! input
13534 {{padleft:|3|abcde}}
13535 {{padright:|3|abcde}}
13536 !! result
13537 <p>abc
13538 abc
13539 </p>
13540 !! end
13541
13542 !!test
13543 Bug 34939 - Case insensitive link parsing ([HttP://])
13544 !! input
13545 [HttP://MediaWiki.Org/]
13546 !! result
13547 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
13548 </p>
13549 !! end
13550
13551 !!test
13552 Bug 34939 - Case insensitive link parsing ([HttP:// title])
13553 !! input
13554 [HttP://MediaWiki.Org/ MediaWiki]
13555 !! result
13556 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
13557 </p>
13558 !! end
13559
13560 !!test
13561 Bug 34939 - Case insensitive link parsing (HttP://)
13562 !! input
13563 HttP://MediaWiki.Org/
13564 !! result
13565 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
13566 </p>
13567 !! end
13568
13569 ###
13570 ### Parsoids-specific tests
13571 ### Parsoid-PHP parser incompatibilities
13572 ###
13573 !!test
13574 1. SOL-sensitive wikitext tokens as template-args
13575 !!options
13576 disabled
13577 !!input
13578 {{echo|*a}}
13579 {{echo|#a}}
13580 {{echo|:a}}
13581 !!result
13582 <p>*a
13583 #a
13584 :a
13585 </p>
13586 !!end
13587
13588 #### The following section of tests are primarily to test
13589 #### wikitext escaping capabilities of Parsoid.
13590 #### A lot of the tests are disabled for the PHP parser either
13591 #### because of minor newline diffs or other reasons.
13592 #### As Parsoid serializer can handle newlines and other HTML
13593 #### more robustly, some of these tests might get reenabled
13594 #### for the PHP parser.
13595
13596 #### --------------- Headings ---------------
13597 #### 0. Unnested
13598 #### 1. Nested inside html <h1>=foo=</h1>
13599 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
13600 #### 3. Nested inside html with wikitext split by html tags
13601 #### 4. No escape needed
13602 #### 5. Empty headings <h1></h1>
13603 #### 6. Heading chars in SOL context
13604 #### ----------------------------------------
13605 !! test
13606 Headings: 0. Unnested
13607 !! input
13608 <nowiki>=foo=</nowiki>
13609
13610 <nowiki>=foo</nowiki>''a''=
13611 !! result
13612 <p>=foo=
13613 </p><p>=foo<i>a</i>=
13614 </p>
13615 !!end
13616
13617 !! test
13618 Headings: 1. Nested inside html
13619 !! options
13620 disabled
13621 !! input
13622 =<nowiki>=foo=</nowiki>=
13623 ==<nowiki>=foo=</nowiki>==
13624 ===<nowiki>=foo=</nowiki>===
13625 ====<nowiki>=foo=</nowiki>====
13626 =====<nowiki>=foo=</nowiki>=====
13627 ======<nowiki>=foo=</nowiki>======
13628 !! result
13629 <h1>=foo=</h1>
13630 <h2>=foo=</h2>
13631 <h3>=foo=</h3>
13632 <h4>=foo=</h4>
13633 <h5>=foo=</h5>
13634 <h6>=foo=</h6>
13635 !!end
13636
13637 !! test
13638 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
13639 !! options
13640 disabled
13641 !! input
13642 =foo=
13643 <nowiki>*bar</nowiki>
13644 =foo=
13645 =bar
13646 =foo=
13647 <nowiki>=bar=</nowiki>
13648 !! result
13649 <h1>foo</h1>*bar
13650 <h1>foo</h1>=bar
13651 <h1>foo</h1>=bar=
13652 !!end
13653
13654 !! test
13655 Headings: 3. Nested inside html with wikitext split by html tags
13656 !! options
13657 disabled
13658 !! input
13659 =<nowiki>=</nowiki>'''bold'''foo==
13660 !! result
13661 <h1>=<b>bold</b>foo=</h1>
13662 !!end
13663
13664 !! test
13665 Headings: 4. No escaping needed (testing just h1 and h2)
13666 !! options
13667 disabled
13668 !! input
13669 ==foo=
13670 =foo==
13671 ===foo==
13672 ==foo===
13673 =''=''foo==
13674 ===
13675 !! result
13676 <h1>=foo</h1>
13677 <h1>foo=</h1>
13678 <h2>=foo</h2>
13679 <h2>foo=</h2>
13680 <h1><i>=</i>foo=</h1>
13681 <h1>=</h1>
13682 !!end
13683
13684 !! test
13685 Headings: 5. Empty headings
13686 !! options
13687 disabled
13688 !! input
13689 =<nowiki></nowiki>=
13690 ==<nowiki></nowiki>==
13691 ===<nowiki></nowiki>===
13692 ====<nowiki></nowiki>====
13693 =====<nowiki></nowiki>=====
13694 ======<nowiki></nowiki>======
13695 !! result
13696 <h1></h1>
13697 <h2></h2>
13698 <h3></h3>
13699 <h4></h4>
13700 <h5></h5>
13701 <h6></h6>
13702 !!end
13703
13704 !! test
13705 Headings: 6. Heading chars in SOL context
13706 !! options
13707 disabled
13708 !! input
13709 <!--cmt--><nowiki>=h1=</nowiki>
13710 !! result
13711 <p><!--cmt-->=h1=
13712 </p>
13713 !!end
13714
13715 #### --------------- Lists ---------------
13716 #### 0. Outside nests (*foo, etc.)
13717 #### 1. Nested inside html <ul><li>*foo</li></ul>
13718 #### 2. Inside definition lists
13719 #### 3. Only bullets at start should be escaped
13720 #### 4. No escapes needed
13721 #### 5. No unnecessary escapes
13722 #### 6. Escape bullets in SOL position
13723 #### 7. Escape bullets in a multi-line context
13724 #### ----------------------------------------
13725
13726 !! test
13727 Lists: 0. Outside nests
13728 !! input
13729 <nowiki>*foo</nowiki>
13730
13731 <nowiki>#foo</nowiki>
13732 !! result
13733 <p>*foo
13734 </p><p>#foo
13735 </p>
13736 !!end
13737
13738 !! test
13739 Lists: 1. Nested inside html
13740 !! input
13741 *<nowiki>*foo</nowiki>
13742
13743 *<nowiki>#foo</nowiki>
13744
13745 *<nowiki>:foo</nowiki>
13746
13747 *<nowiki>;foo</nowiki>
13748
13749 #<nowiki>*foo</nowiki>
13750
13751 #<nowiki>#foo</nowiki>
13752
13753 #<nowiki>:foo</nowiki>
13754
13755 #<nowiki>;foo</nowiki>
13756 !! result
13757 <ul><li>*foo
13758 </li></ul>
13759 <ul><li>#foo
13760 </li></ul>
13761 <ul><li>:foo
13762 </li></ul>
13763 <ul><li>;foo
13764 </li></ul>
13765 <ol><li>*foo
13766 </li></ol>
13767 <ol><li>#foo
13768 </li></ol>
13769 <ol><li>:foo
13770 </li></ol>
13771 <ol><li>;foo
13772 </li></ol>
13773
13774 !!end
13775
13776 !! test
13777 Lists: 2. Inside definition lists
13778 !! input
13779 ;<nowiki>;foo</nowiki>
13780
13781 ;<nowiki>:foo</nowiki>
13782
13783 ;<nowiki>:foo</nowiki>
13784 :bar
13785
13786 :<nowiki>:foo</nowiki>
13787 !! result
13788 <dl><dt>;foo
13789 </dt></dl>
13790 <dl><dt>:foo
13791 </dt></dl>
13792 <dl><dt>:foo
13793 </dt><dd>bar
13794 </dd></dl>
13795 <dl><dd>:foo
13796 </dd></dl>
13797
13798 !!end
13799
13800 !! test
13801 Lists: 3. Only bullets at start of text should be escaped
13802 !! input
13803 *<nowiki>*foo*bar</nowiki>
13804
13805 *<nowiki>*foo</nowiki>''it''*bar
13806 !! result
13807 <ul><li>*foo*bar
13808 </li></ul>
13809 <ul><li>*foo<i>it</i>*bar
13810 </li></ul>
13811
13812 !!end
13813
13814 !! test
13815 Lists: 4. No escapes needed
13816 !! options
13817 disabled
13818 !! input
13819 *foo*bar
13820
13821 *''foo''*bar
13822
13823 *[[Foo]]: bar
13824 !! result
13825 <ul><li>foo*bar
13826 </li></ul>
13827 <ul><li><i>foo</i>*bar
13828 </li></ul>
13829 <ul><li><a href="Foo" rel="mw:WikiLink">Foo</a>: bar
13830 </li></ul>
13831 !!end
13832
13833 !! test
13834 Lists: 5. No unnecessary escapes
13835 !! input
13836 * bar <span><nowiki>[[foo]]</nowiki></span>
13837
13838 *=bar <span><nowiki>[[foo]]</nowiki></span>
13839
13840 *[[bar <span><nowiki>[[foo]]</nowiki></span>
13841
13842 *<nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
13843
13844 *=bar <span>foo]]</span>=
13845 !! result
13846 <ul><li> bar <span>[[foo]]</span>
13847 </li></ul>
13848 <ul><li>=bar <span>[[foo]]</span>
13849 </li></ul>
13850 <ul><li>[[bar <span>[[foo]]</span>
13851 </li></ul>
13852 <ul><li>]]bar <span>[[foo]]</span>
13853 </li></ul>
13854 <ul><li>=bar <span>foo]]</span>=
13855 </li></ul>
13856
13857 !!end
13858
13859 !! test
13860 Lists: 6. Escape bullets in SOL position
13861 !! options
13862 disabled
13863 !! input
13864 <!--cmt--><nowiki>*foo</nowiki>
13865 !! result
13866 <p><!--cmt-->*foo
13867 </p>
13868 !!end
13869
13870 !! test
13871 Lists: 7. Escape bullets in a multi-line context
13872 !! input
13873 <nowiki>a
13874 *b</nowiki>
13875 !! result
13876 <p>a
13877 *b
13878 </p>
13879 !!end
13880
13881 #### --------------- HRs ---------------
13882 #### 1. Single line
13883 #### -----------------------------------
13884
13885 !! test
13886 HRs: 1. Single line
13887 !! options
13888 disabled
13889 !! input
13890 ----
13891 <nowiki>----</nowiki>
13892 ----
13893 <nowiki>=foo=</nowiki>
13894 ----
13895 <nowiki>*foo</nowiki>
13896 !! result
13897 <hr/>----
13898 <hr/>=foo=
13899 <hr/>*foo
13900 !! end
13901
13902 #### --------------- Tables ---------------
13903 #### 1a. Simple example
13904 #### 1b. No escaping needed (!foo)
13905 #### 1c. No escaping needed (|foo)
13906 #### 1d. No escaping needed (|}foo)
13907 ####
13908 #### 2a. Nested in td (<td>foo|bar</td>)
13909 #### 2b. Nested in td (<td>foo||bar</td>)
13910 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
13911 ####
13912 #### 3a. Nested in th (<th>foo!bar</th>)
13913 #### 3b. Nested in th (<th>foo!!bar</th>)
13914 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
13915 ####
13916 #### 4a. Escape -
13917 #### 4b. Escape +
13918 #### 4c. No escaping needed
13919 #### --------------------------------------
13920
13921 !! test
13922 Tables: 1a. Simple example
13923 !! input
13924 <nowiki>{|
13925 |}</nowiki>
13926 !! result
13927 <p>{|
13928 |}
13929 </p>
13930 !! end
13931
13932 !! test
13933 Tables: 1b. No escaping needed
13934 !! input
13935 !foo
13936 !! result
13937 <p>!foo
13938 </p>
13939 !! end
13940
13941 !! test
13942 Tables: 1c. No escaping needed
13943 !! input
13944 |foo
13945 !! result
13946 <p>|foo
13947 </p>
13948 !! end
13949
13950 !! test
13951 Tables: 1d. No escaping needed
13952 !! input
13953 |}foo
13954 !! result
13955 <p>|}foo
13956 </p>
13957 !! end
13958
13959 !! test
13960 Tables: 2a. Nested in td
13961 !! options
13962 disabled
13963 !! input
13964 {|
13965 |<nowiki>foo|bar</nowiki>
13966 |}
13967 !! result
13968 <table>
13969 <tr><td>foo|bar
13970 </td></tr></table>
13971
13972 !! end
13973
13974 !! test
13975 Tables: 2b. Nested in td
13976 !! options
13977 disabled
13978 !! input
13979 {|
13980 |<nowiki>foo||bar</nowiki>
13981 |''it''<nowiki>foo||bar</nowiki>
13982 |}
13983 !! result
13984 <table>
13985 <tr><td>foo||bar
13986 </td><td><i>it</i>foo||bar
13987 </td></tr></table>
13988
13989 !! end
13990
13991 !! test
13992 Tables: 2c. Nested in td -- no escaping needed
13993 !! options
13994 disabled
13995 !! input
13996 {|
13997 |foo!!bar
13998 |}
13999 !! result
14000 <table>
14001 <tr><td>foo!!bar
14002 </td></tr></table>
14003
14004 !! end
14005
14006 !! test
14007 Tables: 3a. Nested in th
14008 !! options
14009 disabled
14010 !! input
14011 {|
14012 !foo!bar
14013 |}
14014 !! result
14015 <table>
14016 <tr><th>foo!bar
14017 </th></tr></table>
14018
14019 !! end
14020
14021 !! test
14022 Tables: 3b. Nested in th
14023 !! options
14024 disabled
14025 !! input
14026 {|
14027 !<nowiki>foo!!bar</nowiki>
14028 |}
14029 !! result
14030 <table>
14031 <tr><th>foo!!bar
14032 </th></tr></table>
14033
14034 !! end
14035
14036 !! test
14037 Tables: 3c. Nested in th -- no escaping needed
14038 !! options
14039 disabled
14040 !! input
14041 {|
14042 !foo||bar
14043 |}
14044 !! result
14045 <table>
14046 <tr><th>foo||bar
14047 </th></tr></table>
14048
14049 !! end
14050
14051 !! test
14052 Tables: 4a. Escape -
14053 !! options
14054 disabled
14055 !! input
14056 {|
14057 |-
14058 !-bar
14059 |-
14060 |<nowiki>-bar</nowiki>
14061 |}
14062 !! result
14063 <table><tbody>
14064 <tr><th>-bar</th></tr>
14065 <tr><td>-bar</td></tr>
14066 </tbody></table>
14067 !! end
14068
14069 !! test
14070 Tables: 4b. Escape +
14071 !! options
14072 disabled
14073 !! input
14074 {|
14075 |-
14076 !+bar
14077 |-
14078 |<nowiki>+bar</nowiki>
14079 |}
14080 !! result
14081 <table><tbody>
14082 <tr><th>+bar</th></tr>
14083 <tr><td>+bar</td></tr>
14084 </tbody></table>
14085 !! end
14086
14087 !! test
14088 Tables: 4c. No escaping needed
14089 !! options
14090 disabled
14091 !! input
14092 {|
14093 |-
14094 |foo-bar
14095 |foo+bar
14096 |-
14097 |''foo''-bar
14098 |''foo''+bar
14099 |}
14100 !! result
14101 <table><tbody>
14102 <tr><td>foo-bar</td><td>foo+bar</td></tr>
14103 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
14104 </tbody></table>
14105 !! end
14106
14107 !! test
14108 Tables: 4d. No escaping needed
14109 !! input
14110 {|
14111 ||+1
14112 ||-2
14113 |}
14114 !! result
14115 <table>
14116 <tr>
14117 <td>+1
14118 </td>
14119 <td>-2
14120 </td></tr></table>
14121
14122 !! end
14123
14124 #### --------------- Links ---------------
14125 #### 1. Quote marks in link text
14126 #### 2. Wikilinks: Escapes needed
14127 #### 3. Wikilinks: No escapes needed
14128 #### 4. Extlinks: Escapes needed
14129 #### 5. Extlinks: No escapes needed
14130 #### --------------------------------------
14131 !! test
14132 Links 1. Quote marks in link text
14133 !! options
14134 disabled
14135 !! input
14136 [[Foo|<nowiki>Foo''boo''</nowiki>]]
14137 !! result
14138 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
14139 !! end
14140
14141 !! test
14142 Links 2. WikiLinks: Escapes needed
14143 !! options
14144 disabled
14145 !! input
14146 [[Foo|<nowiki>[Foobar]</nowiki>]]
14147 [[Foo|<nowiki>Foobar]</nowiki>]]
14148 [[Foo|<nowiki>x [Foobar] x</nowiki>]]
14149 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
14150 [[Foo|<nowiki>[[Bar]]</nowiki>]]
14151 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
14152 [[Foo|<nowiki>|Bar</nowiki>]]
14153 !! result
14154 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
14155 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
14156 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
14157 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
14158 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
14159 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
14160 <a href="Foo" rel="mw:WikiLink">|Bar</a>
14161 !! end
14162
14163 !! test
14164 Links 3. WikiLinks: No escapes needed
14165 !! options
14166 disabled
14167 !! input
14168 [[Foo|[Foobar]]
14169 [[Foo|foo|bar]]
14170 !! result
14171 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
14172 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
14173 !! end
14174
14175 !! test
14176 Links 4. ExtLinks: Escapes needed
14177 !! options
14178 disabled
14179 !! input
14180 [http://google.com <nowiki>[google]</nowiki>]
14181 [http://google.com <nowiki>google]</nowiki>]
14182 !! result
14183 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
14184 <a href="http://google.com" rel="mw:ExtLink">google]</a>
14185 !! end
14186
14187 !! test
14188 Links 5. ExtLinks: No escapes needed
14189 !! options
14190 disabled
14191 !! input
14192 [http://google.com [google]
14193 !! result
14194 <a href="http://google.com" rel="mw:ExtLink">[google</a>
14195 !! end
14196
14197 #### --------------- Quotes ---------------
14198 #### 1. Quotes inside <b> and <i>
14199 #### 2. Link fragments separated by <i> and <b> tags
14200 #### 3. Link fragments inside <i> and <b>
14201 #### --------------------------------------
14202 !! test
14203 1. Quotes inside <b> and <i>
14204 !! input
14205 ''<nowiki>'foo'</nowiki>''
14206 ''<nowiki>''foo''</nowiki>''
14207 ''<nowiki>'''foo'''</nowiki>''
14208 '''<nowiki>'foo'</nowiki>'''
14209 '''<nowiki>''foo''</nowiki>'''
14210 '''<nowiki>'''foo'''</nowiki>'''
14211 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
14212 !! result
14213 <p><i>'foo'</i>
14214 <i>''foo''</i>
14215 <i>'''foo'''</i>
14216 <b>'foo'</b>
14217 <b>''foo''</b>
14218 <b>'''foo'''</b>
14219 <b>foo'<i>bar'</i>baz</b>
14220 </p>
14221 !! end
14222
14223 !! test
14224 2. Link fragments separated by <i> and <b> tags
14225 !! input
14226 [[''foo''<nowiki>hello]]</nowiki>
14227
14228 [['''foo'''<nowiki>hello]]</nowiki>
14229 !! result
14230 <p>[[<i>foo</i>hello]]
14231 </p><p>[[<b>foo</b>hello]]
14232 </p>
14233 !! end
14234
14235 !! test
14236 2. Link fragments inside <i> and <b>
14237 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
14238 this is one of the shortcomings of this format)
14239 !! input
14240 ''[[foo''<nowiki>]]</nowiki>
14241
14242 '''[[foo'''<nowiki>]]</nowiki>
14243 !! result
14244 <p><i>[[foo</i>]]
14245 </p><p><b>[[foo</b>]]
14246 </p>
14247 !! end
14248
14249 #### --------------- Paragraphs ---------------
14250 #### 1. No unnecessary escapes
14251 #### --------------------------------------
14252
14253 !! test
14254 1. No unnecessary escapes
14255 !! input
14256 bar <span><nowiki>[[foo]]</nowiki></span>
14257
14258 =bar <span><nowiki>[[foo]]</nowiki></span>
14259
14260 [[bar <span><nowiki>[[foo]]</nowiki></span>
14261
14262 <nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
14263
14264 <nowiki>=bar </nowiki><span>foo]]</span>=
14265 !! result
14266 <p>bar <span>[[foo]]</span>
14267 </p><p>=bar <span>[[foo]]</span>
14268 </p><p>[[bar <span>[[foo]]</span>
14269 </p><p>]]bar <span>[[foo]]</span>
14270 </p><p>=bar <span>foo]]</span>=
14271 </p>
14272 !!end
14273
14274 #### --------------- PRE ------------------
14275 #### 1. Leading space in SOL context should be escaped
14276 #### --------------------------------------
14277 !! test
14278 1. Leading space in SOL context should be escaped
14279 !! options
14280 disabled
14281 !! input
14282 <nowiki> foo</nowiki>
14283 <!--cmt--><nowiki> foo</nowiki>
14284 !! result
14285 <p> foo
14286 <!--cmt--> foo
14287 </p>
14288 !! end
14289
14290 #### --------------- HTML tags ---------------
14291 #### 1. a tags
14292 #### 2. other tags
14293 #### 3. multi-line html tag
14294 #### --------------------------------------
14295 !! test
14296 1. a tags
14297 !! options
14298 disabled
14299 !! input
14300 <a href="http://google.com">google</a>
14301 !! result
14302 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
14303 !! end
14304
14305 !! test
14306 2. other tags
14307 !! input
14308 <nowiki><div>foo</div>
14309 <div style="color:red">foo</div></nowiki>
14310 !! result
14311 <p>&lt;div&gt;foo&lt;/div&gt;
14312 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
14313 </p>
14314 !! end
14315
14316 !! test
14317 3. multi-line html tag
14318 !! input
14319 <nowiki><div
14320 >foo</div
14321 ></nowiki>
14322 !! result
14323 <p>&lt;div
14324 &gt;foo&lt;/div
14325 &gt;
14326 </p>
14327 !! end
14328
14329 #### --------------- Others ---------------
14330 !! test
14331 Escaping nowikis
14332 !! input
14333 &lt;nowiki&gt;foo&lt;/nowiki&gt;
14334 !! result
14335 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
14336 </p>
14337 !! end
14338
14339 !! test
14340 Tag-like HTML structures are passed through as text
14341 !! input
14342 <x y>
14343
14344 <x.y>
14345
14346 <x-y>
14347
14348 1>2
14349
14350 x<y
14351
14352 a>b
14353
14354 1<d e>f
14355 !! result
14356 <p>&lt;x y&gt;
14357 </p><p>&lt;x.y&gt;
14358 </p><p>&lt;x-y&gt;
14359 </p><p>1&gt;2
14360 </p><p>x&lt;y
14361 </p><p>a&gt;b
14362 </p><p>1&lt;d e&gt;f
14363 </p>
14364 !! end
14365
14366
14367 # This fails in the PHP parser (see bug 40670,
14368 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
14369 !! test
14370 Tag names followed by punctuation should not be recognized as tags
14371 !! options
14372 disabled
14373 !! input
14374 <s.ome> text
14375 !! result
14376 <p>&lt;s.ome&gt text
14377 </p>
14378 !! end
14379
14380 !! test
14381 HTML tag with necessary entities in attributes
14382 !! input
14383 <span title="&amp;amp;">foo</span>
14384 !! result
14385 <p><span title="&amp;amp;">foo</span>
14386 </p>
14387 !! end
14388
14389 !! test
14390 HTML tag with 'unnecessary' entity encoding in attributes
14391 !! input
14392 <span title="&amp;">foo</span>
14393 !! result
14394 <p><span title="&amp;">foo</span>
14395 </p>
14396 !! end
14397
14398 !! test
14399 HTML tag with broken attribute value quoting
14400 !! input
14401 <span title="Hello world>Foo</span>
14402 !! result
14403 <p><span>Foo</span>
14404 </p>
14405 !! end
14406
14407 !! test
14408 Parsoid-only: HTML tag with broken attribute value quoting
14409 !! options
14410 parsoid
14411 !! input
14412 <span title="Hello world>Foo</span>
14413 !! result
14414 <p><span title="Hello world">Foo</span>
14415 </p>
14416 !! end
14417
14418 !! test
14419 Table with broken attribute value quoting
14420 !! input
14421 {|
14422 | title="Hello world|Foo
14423 |}
14424 !! result
14425 <table>
14426 <tr>
14427 <td>Foo
14428 </td></tr></table>
14429
14430 !! end
14431
14432 !! test
14433 Table with broken attribute value quoting on consecutive lines
14434 !! input
14435 {|
14436 | title="Hello world|Foo
14437 | style="color:red|Bar
14438 |}
14439 !! result
14440 <table>
14441 <tr>
14442 <td>Foo
14443 </td>
14444 <td>Bar
14445 </td></tr></table>
14446
14447 !! end
14448
14449 !! test
14450 Parsoid-only: Table with broken attribute value quoting on consecutive lines
14451 !! options
14452 parsoid
14453 !! input
14454 {|
14455 | title="Hello world|Foo
14456 | style="color:red|Bar
14457 |}
14458 !! result
14459 <table>
14460 <tr>
14461 <td title="Hello world">Foo
14462 </td><td style="color: red">Bar
14463 </td></tr></table>
14464
14465 !! end
14466
14467 !! test
14468 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
14469 !! options
14470 parsoid
14471 !! input
14472 {{}}
14473 !! result
14474 {{}}
14475 !! end
14476
14477 !! test
14478 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
14479 !! options
14480 parsoid
14481 !! input
14482 }}{{
14483 !! result
14484 }}{{
14485 !! end
14486
14487 !!test
14488 Accept empty td cell attribute
14489 !!input
14490 {|
14491 | align="center" | foo || |
14492 |}
14493 !!result
14494 <table>
14495 <tr>
14496 <td align="center"> foo </td>
14497 <td>
14498 </td></tr></table>
14499
14500 !!end
14501
14502 !!test
14503 Non-empty attributes in th-cells
14504 !!input
14505 {|
14506 ! Foo !! style="color: red" | Bar
14507 |}
14508 !!result
14509 <table>
14510 <tr>
14511 <th> Foo </th>
14512 <th style="color: red"> Bar
14513 </th></tr></table>
14514
14515 !!end
14516
14517 !!test
14518 Accept empty attributes in th-cells
14519 !!input
14520 {|
14521 !| foo !!| bar
14522 |}
14523 !!result
14524 <table>
14525 <tr>
14526 <th> foo </th>
14527 <th> bar
14528 </th></tr></table>
14529
14530 !!end
14531
14532 !!test
14533 Empty table rows go away
14534 !!input
14535 {|
14536 | Hello
14537 | there
14538 |- class="foo"
14539 |-
14540 |}
14541 !! result
14542 <table>
14543 <tr>
14544 <td> Hello
14545 </td>
14546 <td> there
14547 </td></tr>
14548
14549 </table>
14550
14551 !! end
14552
14553 ###
14554 ### Parsoid-centric tests for testing RTing of inter-element separators
14555 ### Edge cases not tested by existing parser tests and specific to
14556 ### Parsoid-specific serialization strategies.
14557 ###
14558
14559 !!test
14560 RT-ed inter-element separators should be valid separators
14561 !!input
14562 {|
14563 |- [[foo]]
14564 |}
14565 !!result
14566 <table>
14567
14568 </table>
14569
14570 !!end
14571
14572 !!test
14573 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
14574 (Parsoid-only since PHP parser relies on Tidy for correct output)
14575 !!options
14576 parsoid
14577 !!input
14578 {|
14579 |<small>foo
14580 bar
14581 |}
14582
14583 {|
14584 |<small>foo<small>
14585 |}
14586 !!result
14587 !!end
14588
14589 !!test
14590 Empty TD followed by TD with tpl-generated attribute
14591 !!input
14592 {|
14593 |-
14594 |
14595 |{{echo|style='color:red'}}|foo
14596 |}
14597 !!result
14598 <table>
14599
14600 <tr>
14601 <td>
14602 </td>
14603 <td>foo
14604 </td></tr></table>
14605
14606 !!end
14607
14608 !!test
14609 Indented table with an empty td
14610 !!input
14611 {|
14612 |-
14613 |
14614 |foo
14615 |}
14616 !!result
14617 <table>
14618
14619 <tr>
14620 <td>
14621 </td>
14622 <td>foo
14623 </td></tr></table>
14624
14625 !!end
14626
14627 !!test
14628 Empty TR followed by a template-generated TR
14629 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
14630 !!options
14631 parsoid
14632 !!input
14633 {|
14634 |-
14635 {{echo|<tr><td>foo</td></tr>}}
14636 |}
14637 !!result
14638 <table>
14639 <tbody>
14640 <tr>
14641 </tr>
14642 <tr>
14643 <td>foo</td></tr></tbody></table>
14644 !!end
14645
14646 ## PHP and parsoid output differ for this, and since this is primarily
14647 ## for testing Parsoid's serializer, marking this Parsoid only
14648 !!test
14649 Empty TR followed by mixed-ws-comment line should RT correctly
14650 !!options
14651 parsoid
14652 !!input
14653 {|
14654 |-
14655 <!--c-->
14656 |-
14657 <!--c--> <!--d-->
14658 |}
14659 !!result
14660 <table>
14661 <tbody>
14662 <tr>
14663 <td> <!--c--></td></tr>
14664 <tr>
14665 <td><!--c--> <!--d--></td></tr>
14666 </table>
14667
14668 !!end
14669
14670 !!test
14671 Multi-line image caption generated by templates with/without trailing newlines
14672 !!options
14673 parsoid
14674 !!input
14675 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
14676 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
14677 !!result
14678 <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>
14679 <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>
14680
14681 !!end
14682
14683 ## PHP emits broken html for this, and since this is primarily
14684 ## a Parsoid serializer test, marking this Parsoid only
14685 !!test
14686 Improperly nested inline or quotes tags with whitespace in between
14687 !!options
14688 parsoid
14689 !!input
14690 <span> <s>x</span> </s>
14691 ''' ''x''' ''
14692 !!result
14693 <p><span> <s>x</s></span><s> </s>
14694 <b> <i>x</i></b><i> </i></span>
14695 </p>
14696 !!end
14697
14698 TODO:
14699 more images
14700 more tables
14701 character entities
14702 and much more
14703 Try for 100% code coverage