Merge "Move bold/italic parser tests from Parsoid's whitelist into upstream."
[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 ###
367 ### 2-quote opening sequence tests
368 ###
369 !! test
370 Italics and bold: 2-quote opening sequence: (2,2)
371 !! input
372 ''foo''
373 !! result
374 <p><i>foo</i>
375 </p>
376 !!end
377
378
379 !! test
380 Italics and bold: 2-quote opening sequence: (2,3)
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,4)
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,5) (php)
401 !! options
402 php
403 !! input
404 ''foo'''''
405 !! result
406 <p><i>foo</i>
407 </p>
408 !!end
409 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
410 !! test
411 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
412 !! options
413 parsoid
414 !! input
415 ''foo'''''
416 !! result
417 <p><i>foo</i><b></b>
418 </p>
419 !!end
420
421
422 ###
423 ### 3-quote opening sequence tests
424 ###
425
426 !! test
427 Italics and bold: 3-quote opening sequence: (3,2)
428 !! input
429 '''foo''
430 !! result
431 <p>'<i>foo</i>
432 </p>
433 !!end
434
435
436 !! test
437 Italics and bold: 3-quote opening sequence: (3,3)
438 !! input
439 '''foo'''
440 !! result
441 <p><b>foo</b>
442 </p>
443 !!end
444
445
446 !! test
447 Italics and bold: 3-quote opening sequence: (3,4)
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,5) (php)
458 !! options
459 php
460 !! input
461 '''foo'''''
462 !! result
463 <p><b>foo</b>
464 </p>
465 !!end
466 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
467 !! test
468 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
469 !! options
470 parsoid
471 !! input
472 '''foo'''''
473 !! result
474 <p><b>foo<i></i></b>
475 </p>
476 !!end
477
478
479 ###
480 ### 4-quote opening sequence tests
481 ###
482
483 !! test
484 Italics and bold: 4-quote opening sequence: (4,2)
485 !! input
486 ''''foo''
487 !! result
488 <p>''<i>foo</i>
489 </p>
490 !!end
491
492
493 !! test
494 Italics and bold: 4-quote opening sequence: (4,3)
495 !! input
496 ''''foo'''
497 !! result
498 <p>'<b>foo</b>
499 </p>
500 !!end
501
502
503 !! test
504 Italics and bold: 4-quote opening sequence: (4,4)
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,5) (php)
515 !! options
516 php
517 !! input
518 ''''foo'''''
519 !! result
520 <p>'<b>foo</b>
521 </p>
522 !!end
523 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
524 !! test
525 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
526 !! options
527 parsoid
528 !! input
529 ''''foo'''''
530 !! result
531 <p>'<b>foo<i></i></b>
532 </p>
533 !!end
534
535
536 ###
537 ### 5-quote opening sequence tests
538 ###
539
540 !! test
541 Italics and bold: 5-quote opening sequence: (5,2) (php)
542 !! options
543 php
544 !! input
545 '''''foo''
546 !! result
547 <p><b><i>foo</i></b>
548 </p>
549 !!end
550 # Parsoid reverses the nesting order, compared to the PHP parser
551 !! test
552 Italics and bold: 5-quote opening sequence: (5,2) (parsoid)
553 !! options
554 parsoid
555 !! input
556 '''''foo''
557 !! result
558 <p><i><b>foo</b></i>
559 </p>
560 !!end
561
562
563 !! test
564 Italics and bold: 5-quote opening sequence: (5,3)
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,4)
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,5)
585 !! input
586 '''''foo'''''
587 !! result
588 <p><i><b>foo</b></i>
589 </p>
590 !!end
591
592 ###
593 ### multiple quote sequences in a line
594 ###
595 !! test
596 Italics and bold: multiple quote sequences: (2,4,2)
597 !! input
598 ''foo''''bar''
599 !! result
600 <p><i>foo'<b>bar</b></i>
601 </p>
602 !!end
603
604
605 !! test
606 Italics and bold: multiple quote sequences: (2,4,3)
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,4)
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: (3,4,2) (php)
627 !! options
628 php
629 !! input
630 '''foo''''bar''
631 !! result
632 <p><b>foo'</b>bar
633 </p>
634 !!end
635 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
636 !! test
637 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
638 !! options
639 parsoid
640 !! input
641 '''foo''''bar''
642 !! result
643 <p><b>foo'</b>bar<i></i>
644 </p>
645 !!end
646
647
648 !! test
649 Italics and bold: multiple quote sequences: (3,4,3) (php)
650 !! options
651 php
652 !! input
653 '''foo''''bar'''
654 !! result
655 <p><b>foo'</b>bar
656 </p>
657 !!end
658 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
659 !! test
660 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
661 !! options
662 parsoid
663 !! input
664 '''foo''''bar'''
665 !! result
666 <p><b>foo'</b>bar<b></b>
667 </p>
668 !!end
669
670 ###
671 ### other quote tests
672 ###
673 !! test
674 Italics and bold: other quote tests: (2,3,5)
675 !! input
676 ''this is about '''foo's family'''''
677 !! result
678 <p><i>this is about <b>foo's family</b></i>
679 </p>
680 !!end
681
682
683 !! test
684 Italics and bold: other quote tests: (2,(3,3),2)
685 !! input
686 ''this is about '''foo's''' family''
687 !! result
688 <p><i>this is about <b>foo's</b> family</i>
689 </p>
690 !!end
691
692
693 !! test
694 Italics and bold: other quote tests: (3,2,3,2)
695 !! input
696 '''this is about ''foo'''s family''
697 !! result
698 <p><b>this is about <i>foo</i></b><i>s family</i>
699 </p>
700 !!end
701
702
703 # The Parsoid team believes the PHP parser's output on this test is wrong.
704 # It only checks for convert-to-bold-on-single-character-word when the word
705 # matches with a bold tag ("'''") that is *odd* in the list of quote tokens.
706 # This means that the bold token in position 2 (0-indexed) gets converted by
707 # parsoid, but doesn't get changed by the PHP parser.
708 !! test
709 Italics and bold: other quote tests: (3,2,3,3) (php)
710 !! options
711 php
712 !! input
713 '''this is about ''foo'''s family'''
714 !! result
715 <p>'<i>this is about </i>foo<b>s family</b>
716 </p>
717 !!end
718 # This is the output the Parsoid team believes to be correct.
719 !! test
720 Italics and bold: other quote tests: (3,2,3,3) (parsoid)
721 !! options
722 parsoid
723 !! input
724 '''this is about ''foo'''s family'''
725 !! result
726 <p><b>this is about <i>foo'</i>s family</b>
727 </p>
728 !!end
729
730
731 !! test
732 Italics and bold: other quote tests: (3,(2,2),3)
733 !! input
734 '''this is about ''foo's'' family'''
735 !! result
736 <p><b>this is about <i>foo's</i> family</b>
737 </p>
738 !!end
739
740
741 !! test
742 Italicized possessive
743 !! input
744 The ''[[Main Page]]'''s talk page.
745 !! result
746 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
747 </p>
748 !! end
749
750 ###
751 ### Non-html5 tags
752 ###
753
754 !! test
755 Non-html5 tags should be accepted
756 !! input
757 <center>''foo''</center>
758 <big>''foo''</big>
759 <font>''foo''</font>
760 <strike>''foo''</strike>
761 <tt>''foo''</tt>
762 !! result
763 <center><i>foo</i></center>
764 <p><big><i>foo</i></big>
765 <font><i>foo</i></font>
766 <strike><i>foo</i></strike>
767 <tt><i>foo</i></tt>
768 </p>
769 !! end
770
771 ###
772 ### <nowiki> test cases
773 ###
774
775 !! test
776 <nowiki> unordered list
777 !! input
778 <nowiki>* This is not an unordered list item.</nowiki>
779 !! result
780 <p>* This is not an unordered list item.
781 </p>
782 !! end
783
784 !! test
785 <nowiki> spacing
786 !! input
787 <nowiki>Lorem ipsum dolor
788
789 sed abit.
790 sed nullum.
791
792 :and a colon
793 </nowiki>
794 !! result
795 <p>Lorem ipsum dolor
796
797 sed abit.
798 sed nullum.
799
800 :and a colon
801
802 </p>
803 !! end
804
805 !! test
806 nowiki 3
807 !! input
808 :There is not nowiki.
809 :There is <nowiki>nowiki</nowiki>.
810
811 #There is not nowiki.
812 #There is <nowiki>nowiki</nowiki>.
813
814 *There is not nowiki.
815 *There is <nowiki>nowiki</nowiki>.
816 !! result
817 <dl><dd>There is not nowiki.
818 </dd><dd>There is nowiki.
819 </dd></dl>
820 <ol><li>There is not nowiki.
821 </li><li>There is nowiki.
822 </li></ol>
823 <ul><li>There is not nowiki.
824 </li><li>There is nowiki.
825 </li></ul>
826
827 !! end
828
829 !! test
830 Entities inside <nowiki>
831 !! input
832 <nowiki>&lt;</nowiki>
833 !! result
834 <p>&lt;
835 </p>
836 !! end
837
838
839 ###
840 ### Comments
841 ###
842 !! test
843 Comments and Indent-Pre
844 !! input
845 <!-- comment 1 --> asdf
846
847 <!-- comment 1 --> asdf
848 <!-- comment 2 -->
849
850 <!-- comment 1 --> asdf
851 <!-- comment 2 -->xyz
852
853 <!-- comment 1 --> asdf
854 <!-- comment 2 --> xyz
855 !! result
856 <pre>asdf
857 </pre>
858 <pre>asdf
859 </pre>
860 <pre>asdf
861 </pre>
862 <p>xyz
863 </p>
864 <pre>asdf
865 xyz
866 </pre>
867 !! end
868
869 !! test
870 Comment test 2a
871 !! input
872 asdf
873 <!-- comment 1 -->
874 jkl
875 !! result
876 <p>asdf
877 jkl
878 </p>
879 !! end
880
881 !! test
882 Comment test 2b
883 !! input
884 asdf
885 <!-- comment 1 -->
886
887 jkl
888 !! result
889 <p>asdf
890 </p><p>jkl
891 </p>
892 !! end
893
894 !! test
895 Comment test 3
896 !! input
897 asdf
898 <!-- comment 1 -->
899 <!-- comment 2 -->
900 jkl
901 !! result
902 <p>asdf
903 jkl
904 </p>
905 !! end
906
907 !! test
908 Comment test 4
909 !! input
910 asdf<!-- comment 1 -->jkl
911 !! result
912 <p>asdfjkl
913 </p>
914 !! end
915
916 !! test
917 Comment spacing
918 !! input
919 a
920 <!-- foo --> b <!-- bar -->
921 c
922 !! result
923 <p>a
924 </p>
925 <pre> b
926 </pre>
927 <p>c
928 </p>
929 !! end
930
931 !! test
932 Comment whitespace
933 !! input
934 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
935 !! result
936
937 !! end
938
939 !! test
940 Comment semantics and delimiters
941 !! input
942 <!-- --><!----><!-----><!------>
943 !! result
944
945 !! end
946
947 !! test
948 Comment semantics and delimiters, redux
949 !! input
950 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
951 -- foo -- funky huh? ... -->
952 !! result
953
954 !! end
955
956 !! test
957 Comment semantics and delimiters: directors cut
958 !! input
959 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
960 everything starting with < followed by !-- until the first -- and > we see,
961 that wouldn't be valid XML however, since in XML -- has to terminate a comment
962 -->-->
963 !! result
964 <p>--&gt;
965 </p>
966 !! end
967
968 !! test
969 Comment semantics: nesting
970 !! input
971 <!--<!-- no, we're not going to do anything fancy here -->-->
972 !! result
973 <p>--&gt;
974 </p>
975 !! end
976
977 !! test
978 Comment semantics: unclosed comment at end
979 !! input
980 <!--This comment will run out to the end of the document
981 !! result
982
983 !! end
984
985 !! test
986 Comment in template title
987 !! input
988 {{f<!---->oo}}
989 !! result
990 <p>FOO
991 </p>
992 !! end
993
994 !! test
995 Comment on its own line post-expand
996 !! input
997 a
998 {{blank}}<!---->
999 b
1000 !! result
1001 <p>a
1002 </p><p>b
1003 </p>
1004 !! end
1005
1006 !! test
1007 Comment on its own line post-expand with non-significant whitespace
1008 !! input
1009 a
1010 {{blank}} <!---->
1011 b
1012 !! result
1013 <p>a
1014 </p><p>b
1015 </p>
1016 !! end
1017
1018 ###
1019 ### paragraph wraping tests
1020 ###
1021 !! test
1022 No block tags
1023 !! input
1024 a
1025
1026 b
1027 !! result
1028 <p>a
1029 </p><p>b
1030 </p>
1031 !! end
1032 !! test
1033 Block tag on one line
1034 !! input
1035 a <div>foo</div>
1036
1037 b
1038 !! result
1039 a <div>foo</div>
1040 <p>b
1041 </p>
1042 !! end
1043
1044 !! test
1045 Block tag on both lines
1046 !! input
1047 a <div>foo</div>
1048
1049 b <div>foo</div>
1050 !! result
1051 a <div>foo</div>
1052 b <div>foo</div>
1053
1054 !! end
1055
1056 !! test
1057 Multiple lines without block tags
1058 !! input
1059 <div>foo</div> a
1060 b
1061 c
1062 d<!--foo--> e
1063 x <div>foo</div> z
1064 !! result
1065 <div>foo</div> a
1066 <p>b
1067 c
1068 d e
1069 </p>
1070 x <div>foo</div> z
1071
1072 !! end
1073
1074 !! test
1075 Empty lines between lines with block tags
1076 !! input
1077 <div></div>
1078
1079
1080 <div></div>a
1081
1082 b
1083 <div>a</div>b
1084
1085 <div>b</div>d
1086
1087
1088 <div>e</div>
1089 !! result
1090 <div></div>
1091 <p><br />
1092 </p>
1093 <div></div>a
1094 <p>b
1095 </p>
1096 <div>a</div>b
1097 <div>b</div>d
1098 <p><br />
1099 </p>
1100 <div>e</div>
1101
1102 !! end
1103
1104 ###
1105 ### Preformatted text
1106 ###
1107 !! test
1108 Preformatted text
1109 !! input
1110 This is some
1111 Preformatted text
1112 With ''italic''
1113 And '''bold'''
1114 And a [[Main Page|link]]
1115 !! result
1116 <pre>This is some
1117 Preformatted text
1118 With <i>italic</i>
1119 And <b>bold</b>
1120 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1121 </pre>
1122 !! end
1123
1124 !! test
1125 Ident preformatting with inline content
1126 !! input
1127 a
1128 ''b''
1129 !! result
1130 <pre>a
1131 <i>b</i>
1132 </pre>
1133 !! end
1134
1135 !! test
1136 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1137 !! input
1138 <pre><nowiki>
1139 <b>
1140 <cite>
1141 <em>
1142 </nowiki></pre>
1143 !! result
1144 <pre>
1145 &lt;b&gt;
1146 &lt;cite&gt;
1147 &lt;em&gt;
1148 </pre>
1149
1150 !! end
1151
1152 !! test
1153 Regression with preformatted in <center>
1154 !! input
1155 <center>
1156 Blah
1157 </center>
1158 !! result
1159 <center>
1160 <pre>Blah
1161 </pre>
1162 </center>
1163
1164 !! end
1165
1166 # Expected output in the following test is not really expected (there should be
1167 # <pre> in the output) -- it's only testing for well-formedness.
1168 !! test
1169 Bug 6200: Preformatted in <blockquote>
1170 !! input
1171 <blockquote>
1172 Blah
1173 </blockquote>
1174 !! result
1175 <blockquote>
1176 Blah
1177 </blockquote>
1178
1179 !! end
1180
1181 !! test
1182 <pre> with attributes (bug 3202)
1183 !! input
1184 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1185 !! result
1186 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1187
1188 !! end
1189
1190 !! test
1191 <pre> with width attribute (bug 3202)
1192 !! input
1193 <pre width="8">Narrow screen goodies</pre>
1194 !! result
1195 <pre width="8">Narrow screen goodies</pre>
1196
1197 !! end
1198
1199 !! test
1200 <pre> with forbidden attribute (bug 3202)
1201 !! input
1202 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1203 !! result
1204 <pre width="8">Narrow screen goodies</pre>
1205
1206 !! end
1207
1208 !! test
1209 Entities inside <pre>
1210 !! input
1211 <pre>&lt;</pre>
1212 !! result
1213 <pre>&lt;</pre>
1214
1215 !! end
1216
1217 !! test
1218 <pre> with forbidden attribute values (bug 3202)
1219 !! input
1220 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1221 !! result
1222 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1223
1224 !! end
1225
1226 !! test
1227 <nowiki> inside <pre> (bug 13238)
1228 !! input
1229 <pre>
1230 <nowiki>
1231 </pre>
1232 <pre>
1233 <nowiki></nowiki>
1234 </pre>
1235 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1236 !! result
1237 <pre>
1238 &lt;nowiki&gt;
1239 </pre>
1240 <pre>
1241
1242 </pre>
1243 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1244
1245 !! end
1246
1247 !! test
1248 <nowiki> and <pre> preference (first one wins)
1249 !! input
1250 <pre>
1251 <nowiki>
1252 </pre>
1253 </nowiki>
1254 </pre>
1255
1256 <nowiki>
1257 <pre>
1258 <nowiki>
1259 </pre>
1260 </nowiki>
1261 </pre>
1262
1263 !! result
1264 <pre>
1265 &lt;nowiki&gt;
1266 </pre>
1267 <p>&lt;/nowiki&gt;
1268 &lt;/pre&gt;
1269 </p><p>
1270 &lt;pre&gt;
1271 &lt;nowiki&gt;
1272 &lt;/pre&gt;
1273
1274 &lt;/pre&gt;
1275 </p>
1276 !! end
1277
1278 !! test
1279 </pre> inside nowiki
1280 !! input
1281 <nowiki></pre></nowiki>
1282 !! result
1283 <p>&lt;/pre&gt;
1284 </p>
1285 !! end
1286
1287 !!test
1288 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1289 !!input
1290 {{echo|}}
1291 !!result
1292
1293 !!end
1294
1295 !!test
1296 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1297 !!input
1298 {{echo|
1299 foo}}
1300 !!result
1301 <p>foo
1302 </p>
1303 !!end
1304
1305 !! test
1306 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1307 !! input
1308 {{echo|a
1309 b}}
1310 !!result
1311 <pre>a
1312 </pre>
1313 <p>b
1314 </p>
1315 !!end
1316
1317 !! test
1318 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1319 !! input
1320 {{echo|a
1321 b
1322 c
1323 d
1324 e
1325 }}
1326 !!result
1327 <pre>a
1328 </pre>
1329 <p>b
1330 c
1331 </p>
1332 <pre>d
1333 </pre>
1334 <p>e
1335 </p>
1336 !!end
1337
1338 !!test
1339 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1340 !!input
1341 {{echo| foo}}
1342
1343 {{echo| foo}}{{echo| bar}}
1344
1345 {{echo| foo}}
1346 {{echo| bar}}
1347
1348 {{echo|<!--cmt--> foo}}
1349
1350 <!--cmt-->{{echo| foo}}
1351
1352 {{echo|{{echo| }}bar}}
1353 !!result
1354 <pre>foo
1355 </pre>
1356 <pre>foo bar
1357 </pre>
1358 <pre>foo
1359 bar
1360 </pre>
1361 <pre>foo
1362 </pre>
1363 <pre>foo
1364 </pre>
1365 <pre>bar
1366 </pre>
1367 !!end
1368
1369 !! test
1370 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1371 !! input
1372 {{echo| }}a
1373
1374 {{echo|
1375 }}a
1376
1377 {{echo|
1378 b}}
1379
1380 {{echo|a
1381 }}b
1382
1383 {{echo|a
1384 }} b
1385 !!result
1386 <pre>a
1387 </pre>
1388 <p><br />
1389 </p>
1390 <pre>a
1391 </pre>
1392 <p><br />
1393 </p>
1394 <pre>b
1395 </pre>
1396 <p>a
1397 </p>
1398 <pre>b
1399 </pre>
1400 <p>a
1401 </p>
1402 <pre>b
1403 </pre>
1404 !!end
1405
1406 !! test
1407 Templates: Single-line variant of parameter whitespace stripping test
1408 !! input
1409 {{echo| a}}
1410
1411 {{echo|1= a}}
1412
1413 {{echo|{{echo| a}}}}
1414
1415 {{echo|1={{echo| a}}}}
1416 !! result
1417 <pre>a
1418 </pre>
1419 <p>a
1420 </p>
1421 <pre>a
1422 </pre>
1423 <p>a
1424 </p>
1425 !! end
1426
1427 !! test
1428 Templates: Strip whitespace from named parameters, but not positional ones
1429 !! input
1430 {{echo|
1431 foo}}
1432
1433 {{echo|
1434 * foo}}
1435
1436 {{echo| 1 =
1437 foo}}
1438
1439 {{echo| 1 =
1440 * foo}}
1441 !! result
1442 <pre>foo
1443 </pre>
1444 <p><br />
1445 </p>
1446 <ul><li> foo
1447 </li></ul>
1448 <p>foo
1449 </p>
1450 <ul><li> foo
1451 </li></ul>
1452
1453 !! end
1454
1455 ###
1456 ### Parsoid-centric tests for testing RT edge cases for pre
1457 ###
1458
1459 !!test
1460 1a. Indent-Pre and Comments
1461 !!input
1462 a
1463 <!--a-->
1464 c
1465 !!result
1466 <pre>a
1467 </pre>
1468 <p>c
1469 </p>
1470 !!end
1471
1472 !!test
1473 1b. Indent-Pre and Comments
1474 !!input
1475 a
1476 <!--a-->
1477 c
1478 !!result
1479 <pre>a
1480 </pre>
1481 <p>c
1482 </p>
1483 !!end
1484
1485 !!test
1486 1c. Indent-Pre and Comments
1487 !!input
1488 <!--a--> a
1489
1490 <!--a--> a
1491 !!result
1492 <pre> a
1493 </pre>
1494 <pre> a
1495 </pre>
1496 !!end
1497
1498 !!test
1499 2a. Indent-Pre and tables
1500 !!input
1501 {|
1502 |-
1503 !h1!!h2
1504 |foo||bar
1505 |}
1506 !!result
1507 <table>
1508
1509 <tr>
1510 <th>h1</th>
1511 <th>h2
1512 </th>
1513 <td>foo</td>
1514 <td>bar
1515 </td></tr></table>
1516
1517 !!end
1518
1519 !!test
1520 2b. Indent-Pre and tables
1521 !!input
1522 {|
1523 |-
1524 |foo
1525 |}
1526 !!result
1527 <table>
1528
1529 <tr>
1530 <td>foo
1531 </td></tr></table>
1532
1533 !!end
1534
1535 !!test
1536 2c. Indent-Pre and tables (bug 42252)
1537 !!input
1538 {|
1539 |+ foo
1540 ! | bar
1541 |}
1542 !!result
1543 <table>
1544 <caption> foo
1545 </caption>
1546 <tr>
1547 <th> bar
1548 </th></tr></table>
1549
1550 !!end
1551
1552 !!test
1553 3a. Indent-Pre and block tags (single-line html)
1554 !!input
1555 <p> foo </p>
1556 <div> foo </div>
1557 <span> foo </span>
1558 !!result
1559 <p> foo </p>
1560 <div> foo </div>
1561 <pre><span> foo </span>
1562 </pre>
1563 !!end
1564
1565 !!test
1566 3b. Indent-Pre and block tags (pre-content on separate line)
1567 !!input
1568 <p>
1569 foo
1570 </p>
1571
1572 <div>
1573 foo
1574 </div>
1575
1576 <center>
1577 foo
1578 </center>
1579
1580 <blockquote>
1581 foo
1582 </blockquote>
1583
1584 <table><tr><td>
1585 foo
1586 </td></tr></table>
1587
1588 <ul><li>
1589 foo
1590 </li></ul>
1591
1592 !!result
1593 <p>
1594 foo
1595 </p>
1596 <div>
1597 <pre>foo
1598 </pre>
1599 </div>
1600 <center>
1601 <pre>foo
1602 </pre>
1603 </center>
1604 <blockquote>
1605 foo
1606 </blockquote>
1607 <table><tr><td>
1608 <pre>foo
1609 </pre>
1610 </td></tr></table>
1611 <ul><li>
1612 foo
1613 </li></ul>
1614
1615 !!end
1616
1617 !!test
1618 4. Multiple spaces at start-of-line
1619 !!input
1620 <p> foo </p>
1621 foo
1622 {|
1623 |foo
1624 |}
1625 !!result
1626 <p> foo </p>
1627 <pre> foo
1628 </pre>
1629 <table>
1630 <tr>
1631 <td>foo
1632 </td></tr></table>
1633
1634 !!end
1635
1636 !! test
1637 5. White-space in indent-pre
1638 NOTE: the white-space char on 2nd line is significant
1639 !! input
1640 a<br/>
1641
1642 b
1643 !! result
1644 <pre>a<br />
1645
1646 b
1647 </pre>
1648 !! end
1649
1650 ###
1651 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1652 ###
1653
1654 !!test
1655 HTML-pre: 1. embedded newlines
1656 !!input
1657 <pre>foo</pre>
1658
1659 <pre>
1660 foo
1661 </pre>
1662
1663 <pre>
1664
1665 foo
1666 </pre>
1667
1668 <pre>
1669
1670
1671 foo
1672 </pre>
1673 !!result
1674 <pre>foo</pre>
1675 <pre>
1676 foo
1677 </pre>
1678 <pre>
1679
1680 foo
1681 </pre>
1682 <pre>
1683
1684
1685 foo
1686 </pre>
1687
1688 !!end
1689
1690 !!test
1691 HTML-pre: 2: indented text
1692 !!input
1693 <pre>
1694 foo
1695 </pre>
1696 !!result
1697 <pre>
1698 foo
1699 </pre>
1700
1701 !!end
1702
1703 !!test
1704 HTML-pre: 3: other wikitext
1705 !!input
1706 <pre>
1707 * foo
1708 # bar
1709 = no-h =
1710 '' no-italic ''
1711 [[ NoLink ]]
1712 </pre>
1713 !!result
1714 <pre>
1715 * foo
1716 # bar
1717 = no-h =
1718 '' no-italic ''
1719 [[ NoLink ]]
1720 </pre>
1721
1722 !!end
1723
1724 ###
1725 ### Definition lists
1726 ###
1727 !! test
1728 Simple definition
1729 !! input
1730 ; name : Definition
1731 !! result
1732 <dl><dt> name&#160;</dt><dd> Definition
1733 </dd></dl>
1734
1735 !! end
1736
1737 !! test
1738 Definition list for indentation only
1739 !! input
1740 : Indented text
1741 !! result
1742 <dl><dd> Indented text
1743 </dd></dl>
1744
1745 !! end
1746
1747 !! test
1748 Definition list with no space
1749 !! input
1750 ;name:Definition
1751 !! result
1752 <dl><dt>name</dt><dd>Definition
1753 </dd></dl>
1754
1755 !!end
1756
1757 !! test
1758 Definition list with URL link
1759 !! input
1760 ; http://example.com/ : definition
1761 !! result
1762 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
1763 </dd></dl>
1764
1765 !! end
1766
1767 !! test
1768 Definition list with bracketed URL link
1769 !! input
1770 ;[http://www.example.com/ Example]:Something about it
1771 !! result
1772 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
1773 </dd></dl>
1774
1775 !! end
1776
1777 !! test
1778 Definition list with wikilink containing colon
1779 !! input
1780 ; [[Help:FAQ]]: The least-read page on Wikipedia
1781 !! result
1782 <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
1783 </dd></dl>
1784
1785 !! end
1786
1787 # At Brion's and JeLuF's insistence... :)
1788 !! test
1789 Definition list with news link containing colon
1790 !! input
1791 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
1792 !! result
1793 <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!
1794 </dd></dl>
1795
1796 !! end
1797
1798 !! test
1799 Malformed definition list with colon
1800 !! input
1801 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
1802 !! result
1803 <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
1804 </dt></dl>
1805
1806 !! end
1807
1808 !! test
1809 Definition lists: colon in external link text
1810 !! input
1811 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
1812 !! result
1813 <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
1814 </dd></dl>
1815
1816 !! end
1817
1818 !! test
1819 Definition lists: colon in HTML attribute
1820 !! input
1821 ;<b style="display: inline">bold</b>
1822 !! result
1823 <dl><dt><b style="display: inline">bold</b>
1824 </dt></dl>
1825
1826 !! end
1827
1828 !! test
1829 Definition lists: self-closed tag
1830 !! input
1831 ;one<br/>two : two-line fun
1832 !! result
1833 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
1834 </dd></dl>
1835
1836 !! end
1837
1838 !! test
1839 Bug 11748: Literal closing tags
1840 !! input
1841 <dl>
1842 <dt>test 1</dt>
1843 <dd>test test test test test</dd>
1844 <dt>test 2</dt>
1845 <dd>test test test test test</dd>
1846 </dl>
1847 !! result
1848 <dl>
1849 <dt>test 1</dt>
1850 <dd>test test test test test</dd>
1851 <dt>test 2</dt>
1852 <dd>test test test test test</dd>
1853 </dl>
1854
1855 !! end
1856
1857 !! test
1858 Definition and unordered list using wiki syntax nested in unordered list using html tags.
1859 !! input
1860 <ul><li>
1861 ; term : description
1862 * unordered
1863 </li>
1864 </ul>
1865 !! result
1866 <ul><li>
1867 <dl><dt> term&#160;</dt><dd> description
1868 </dd></dl>
1869 <ul><li> unordered
1870 </li></ul>
1871 </li>
1872 </ul>
1873
1874 !! end
1875
1876 !! test
1877
1878 Definition list with empty definition and following paragraph
1879 !! input
1880 ; term:
1881 Paragraph text
1882 !! result
1883 <dl><dt> term</dt><dd>
1884 </dd></dl>
1885 <p>Paragraph text
1886 </p>
1887 !! end
1888
1889 !! test
1890 Nested definition lists using html syntax
1891 !! input
1892 <dl><dd>
1893 <dl>
1894 <dd>Foo</dd>
1895 </dl>
1896 </dd></dl>
1897 !! result
1898 <dl><dd>
1899 <dl>
1900 <dd>Foo</dd>
1901 </dl>
1902 </dd></dl>
1903
1904 !! end
1905
1906 !! test
1907 Definition Lists: No nesting: Multiple dd's
1908 !! input
1909 ;x
1910 :a
1911 :b
1912 !! result
1913 <dl><dt>x
1914 </dt><dd>a
1915 </dd><dd>b
1916 </dd></dl>
1917
1918 !! end
1919
1920 !! test
1921 Definition Lists: Indentation: Regular
1922 !! input
1923 :i1
1924 ::i2
1925 :::i3
1926 !! result
1927 <dl><dd>i1
1928 <dl><dd>i2
1929 <dl><dd>i3
1930 </dd></dl>
1931 </dd></dl>
1932 </dd></dl>
1933
1934 !! end
1935
1936 !! test
1937 Definition Lists: Indentation: Missing 1st level
1938 !! input
1939 ::i2
1940 :::i3
1941 !! result
1942 <dl><dd><dl><dd>i2
1943 <dl><dd>i3
1944 </dd></dl>
1945 </dd></dl>
1946 </dd></dl>
1947
1948 !! end
1949
1950 !! test
1951 Definition Lists: Indentation: Multi-level indent
1952 !! input
1953 :::i3
1954 !! result
1955 <dl><dd><dl><dd><dl><dd>i3
1956 </dd></dl>
1957 </dd></dl>
1958 </dd></dl>
1959
1960 !! end
1961
1962 !! test
1963 Definition Lists: Hacky use to indent tables
1964 !! input
1965 ::{|
1966 |foo
1967 |bar
1968 |}
1969 this text
1970 should be left alone
1971 !! result
1972 <dl><dd><dl><dd><table>
1973 <tr>
1974 <td>foo
1975 </td>
1976 <td>bar
1977 </td></tr></table></dd></dl></dd></dl>
1978 <p>this text
1979 should be left alone
1980 </p>
1981 !! end
1982 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
1983 ## as an empty dt item. It also ignores all but the last ";" when followed
1984 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
1985 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
1986 ## ";"s.
1987 ##
1988 ## Ex: ";;t2 ::d2" is transformed into:
1989 ##
1990 ## <dl>
1991 ## <dt>t2 </dt>
1992 ## <dd>
1993 ## <dl>
1994 ## <dt></dt>
1995 ## <dd>d2</dd>
1996 ## </dl>
1997 ## </dd>
1998 ## </dl>
1999 ##
2000 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2001 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2002 ##
2003 ## <dl>
2004 ## <dt>
2005 ## <dl>
2006 ## <dt>t2 </dt>
2007 ## <dd>:d2</dd>
2008 ## </dl>
2009 ## </dt>
2010 ## </dl>
2011 ##
2012 ## All Parsoid only definition list tests have this difference.
2013 ##
2014 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2015 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2016
2017 !! test
2018 Table / list interaction: indented table with lists in table contents
2019 !! input
2020 :{|
2021 |-
2022 | a
2023 * b
2024 |-
2025 | c
2026 * d
2027 |}
2028 !! result
2029 <dl><dd><table>
2030
2031 <tr>
2032 <td> a
2033 <ul><li> b
2034 </li></ul>
2035 </td></tr>
2036 <tr>
2037 <td> c
2038 <ul><li> d
2039 </li></ul>
2040 </td></tr></table></dd></dl>
2041
2042 !! end
2043
2044 !!test
2045 Table / list interaction: lists nested in tables nested in indented lists
2046 !!input
2047 :{|
2048 |
2049 :a
2050 :b
2051 |
2052 *c
2053 *d
2054 |}
2055
2056 *e
2057 *f
2058 !!result
2059 <dl><dd><table>
2060 <tr>
2061 <td>
2062 <dl><dd>a
2063 </dd><dd>b
2064 </dd></dl>
2065 </td>
2066 <td>
2067 <ul><li>c
2068 </li><li>d
2069 </li></ul>
2070 </td></tr></table></dd></dl>
2071 <ul><li>e
2072 </li><li>f
2073 </li></ul>
2074
2075 !!end
2076
2077 !! test
2078 Definition Lists: Nesting: Multi-level (Parsoid only)
2079 !! options
2080 parsoid
2081 !! input
2082 ;t1 :d1
2083 ;;t2 ::d2
2084 ;;;t3 :::d3
2085 !! result
2086 <dl>
2087 <dt>t1 </dt>
2088 <dd>d1</dd>
2089 <dt>
2090 <dl>
2091 <dt>t2 </dt>
2092 <dd>:d2</dd>
2093 <dt>
2094 <dl>
2095 <dt>t3 </dt>
2096 <dd>::d3</dd>
2097 </dl>
2098 </dt>
2099 </dl>
2100 </dt>
2101 </dl>
2102
2103
2104 !! end
2105
2106
2107 !! test
2108 Definition Lists: Nesting: Test 2 (Parsoid only)
2109 !! options
2110 parsoid
2111 !! input
2112 ;t1
2113 ::d2
2114 !! result
2115 <dl>
2116 <dt>t1</dt>
2117 <dd>
2118 <dl>
2119 <dd>d2</dd>
2120 </dl>
2121 </dd>
2122 </dl>
2123
2124 !! end
2125
2126
2127 !! test
2128 Definition Lists: Nesting: Test 3 (Parsoid only)
2129 !! options
2130 parsoid
2131 !! input
2132 :;t1
2133 ::::d2
2134 !! result
2135 <dl>
2136 <dd>
2137 <dl>
2138 <dt>t1</dt>
2139 <dd>
2140 <dl>
2141 <dd>
2142 <dl>
2143 <dd>d2</dd>
2144 </dl>
2145 </dd>
2146 </dl>
2147 </dd>
2148 </dl>
2149 </dd>
2150 </dl>
2151
2152 !! end
2153
2154
2155 !! test
2156 Definition Lists: Nesting: Test 4
2157 !! input
2158 ::;t3
2159 :::d3
2160 !! result
2161 <dl><dd><dl><dd><dl><dt>t3
2162 </dt><dd>d3
2163 </dd></dl>
2164 </dd></dl>
2165 </dd></dl>
2166
2167 !! end
2168
2169
2170 !! test
2171 Definition Lists: Mixed Lists: Test 1
2172 !! input
2173 :;* foo
2174 ::* bar
2175 :; baz
2176 !! result
2177 <dl><dd><dl><dt><ul><li> foo
2178 </li><li> bar
2179 </li></ul>
2180 </dt></dl>
2181 <dl><dt> baz
2182 </dt></dl>
2183 </dd></dl>
2184
2185 !! end
2186
2187
2188 !! test
2189 Definition Lists: Mixed Lists: Test 2
2190 !! input
2191 *: d1
2192 *: d2
2193 !! result
2194 <ul><li><dl><dd> d1
2195 </dd><dd> d2
2196 </dd></dl>
2197 </li></ul>
2198
2199 !! end
2200
2201
2202 !! test
2203 Definition Lists: Mixed Lists: Test 3
2204 !! input
2205 *::: d1
2206 *::: d2
2207 !! result
2208 <ul><li><dl><dd><dl><dd><dl><dd> d1
2209 </dd><dd> d2
2210 </dd></dl>
2211 </dd></dl>
2212 </dd></dl>
2213 </li></ul>
2214
2215 !! end
2216
2217
2218 !! test
2219 Definition Lists: Mixed Lists: Test 4
2220 !! input
2221 *;d1 :d2
2222 *;d3 :d4
2223 !! result
2224 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2225 </dd><dt>d3&#160;</dt><dd>d4
2226 </dd></dl>
2227 </li></ul>
2228
2229 !! end
2230
2231
2232 !! test
2233 Definition Lists: Mixed Lists: Test 5
2234 !! input
2235 *:d1
2236 *:: d2
2237 !! result
2238 <ul><li><dl><dd>d1
2239 <dl><dd> d2
2240 </dd></dl>
2241 </dd></dl>
2242 </li></ul>
2243
2244 !! end
2245
2246
2247 !! test
2248 Definition Lists: Mixed Lists: Test 6
2249 !! input
2250 #*:d1
2251 #*::: d3
2252 !! result
2253 <ol><li><ul><li><dl><dd>d1
2254 <dl><dd><dl><dd> d3
2255 </dd></dl>
2256 </dd></dl>
2257 </dd></dl>
2258 </li></ul>
2259 </li></ol>
2260
2261 !! end
2262
2263
2264 !! test
2265 Definition Lists: Mixed Lists: Test 7
2266 !! input
2267 :* d1
2268 :* d2
2269 !! result
2270 <dl><dd><ul><li> d1
2271 </li><li> d2
2272 </li></ul>
2273 </dd></dl>
2274
2275 !! end
2276
2277
2278 !! test
2279 Definition Lists: Mixed Lists: Test 8
2280 !! input
2281 :* d1
2282 ::* d2
2283 !! result
2284 <dl><dd><ul><li> d1
2285 </li></ul>
2286 <dl><dd><ul><li> d2
2287 </li></ul>
2288 </dd></dl>
2289 </dd></dl>
2290
2291 !! end
2292
2293
2294 !! test
2295 Definition Lists: Mixed Lists: Test 9
2296 !! input
2297 *;foo :bar
2298 !! result
2299 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2300 </dd></dl>
2301 </li></ul>
2302
2303 !! end
2304
2305
2306 !! test
2307 Definition Lists: Mixed Lists: Test 10
2308 !! input
2309 *#;foo :bar
2310 !! result
2311 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2312 </dd></dl>
2313 </li></ol>
2314 </li></ul>
2315
2316 !! end
2317
2318
2319 !! test
2320 Definition Lists: Mixed Lists: Test 11
2321 !! input
2322 *#*#;*;;foo :bar
2323 *#*#;boo :baz
2324 !! result
2325 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2326 </dt></dl>
2327 </dd></dl>
2328 </li></ul>
2329 </dd></dl>
2330 <dl><dt>boo&#160;</dt><dd>baz
2331 </dd></dl>
2332 </li></ol>
2333 </li></ul>
2334 </li></ol>
2335 </li></ul>
2336
2337 !! end
2338
2339
2340 !! test
2341 Definition Lists: Weird Ones: Test 1
2342 !! input
2343 *#;*::;; foo : bar (who uses this?)
2344 !! result
2345 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2346 </dt></dl>
2347 </dd></dl>
2348 </dd></dl>
2349 </dd></dl>
2350 </li></ul>
2351 </dd></dl>
2352 </li></ol>
2353 </li></ul>
2354
2355 !! end
2356
2357 ###
2358 ### External links
2359 ###
2360 !! test
2361 External links: non-bracketed
2362 !! input
2363 Non-bracketed: http://example.com
2364 !! result
2365 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2366 </p>
2367 !! end
2368
2369 !! test
2370 External links: numbered
2371 !! input
2372 Numbered: [http://example.com]
2373 Numbered: [http://example.net]
2374 Numbered: [http://example.com]
2375 !! result
2376 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2377 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2378 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2379 </p>
2380 !!end
2381
2382 !! test
2383 External links: specified text
2384 !! input
2385 Specified text: [http://example.com link]
2386 !! result
2387 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2388 </p>
2389 !!end
2390
2391 !! test
2392 External links: trail
2393 !! input
2394 Linktrails should not work for external links: [http://example.com link]s
2395 !! result
2396 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2397 </p>
2398 !! end
2399
2400 !! test
2401 External links: dollar sign in URL
2402 !! input
2403 http://example.com/1$2345
2404 !! result
2405 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2406 </p>
2407 !! end
2408
2409 !! test
2410 External links: dollar sign in URL (named)
2411 !! input
2412 [http://example.com/1$2345]
2413 !! result
2414 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2415 </p>
2416 !!end
2417
2418 !! test
2419 External links: open square bracket forbidden in URL (bug 4377)
2420 !! input
2421 http://example.com/1[2345
2422 !! result
2423 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2424 </p>
2425 !! end
2426
2427 !! test
2428 External links: open square bracket forbidden in URL (named) (bug 4377)
2429 !! input
2430 [http://example.com/1[2345]
2431 !! result
2432 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2433 </p>
2434 !!end
2435
2436 !! test
2437 External links: nowiki in URL link text (bug 6230)
2438 !!input
2439 [http://example.com/ <nowiki>''example site''</nowiki>]
2440 !! result
2441 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2442 </p>
2443 !! end
2444
2445 !! test
2446 External links: newline forbidden in text (bug 6230 regression check)
2447 !! input
2448 [http://example.com/ first
2449 second]
2450 !! result
2451 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2452 second]
2453 </p>
2454 !!end
2455
2456 !! test
2457 External links: Pipe char between url and text
2458 !! input
2459 [http://example.com | link]
2460 !! result
2461 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2462 </p>
2463 !!end
2464
2465 !! test
2466 External links: protocol-relative URL in brackets
2467 !! input
2468 [//example.com/ Test]
2469 !! result
2470 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2471 </p>
2472 !! end
2473
2474 !! test
2475 External links: protocol-relative URL in brackets without text
2476 !! input
2477 [//example.com]
2478 !! result
2479 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2480 </p>
2481 !! end
2482
2483 !! test
2484 External links: protocol-relative URL in free text is left alone
2485 !! input
2486 //example.com/Foo
2487 !! result
2488 <p>//example.com/Foo
2489 </p>
2490 !!end
2491
2492 !! test
2493 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2494 !! input
2495 foo//example.com/Foo
2496 !! result
2497 <p>foo//example.com/Foo
2498 </p>
2499 !! end
2500
2501 !! test
2502 External image
2503 !! input
2504 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2505 !! result
2506 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2507 </p>
2508 !! end
2509
2510 !! test
2511 External image from https
2512 !! input
2513 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2514 !! result
2515 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2516 </p>
2517 !! end
2518
2519 !! test
2520 Link to non-http image, no img tag
2521 !! input
2522 Link to non-http image, no img tag: ftp://example.com/test.jpg
2523 !! result
2524 <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>
2525 </p>
2526 !! end
2527
2528 !! test
2529 External links: terminating separator
2530 !! input
2531 Terminating separator: http://example.com/thing,
2532 !! result
2533 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2534 </p>
2535 !! end
2536
2537 !! test
2538 External links: intervening separator
2539 !! input
2540 Intervening separator: http://example.com/1,2,3
2541 !! result
2542 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2543 </p>
2544 !! end
2545
2546 !! test
2547 External links: old bug with URL in query
2548 !! input
2549 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2550 !! result
2551 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2552 </p>
2553 !! end
2554
2555 !! test
2556 External links: old URL-in-URL bug, mixed protocols
2557 !! input
2558 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2559 !! result
2560 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2561 </p>
2562 !!end
2563
2564 !! test
2565 External links: URL in text
2566 !! input
2567 URL in text: [http://example.com http://example.com]
2568 !! result
2569 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2570 </p>
2571 !! end
2572
2573 !! test
2574 External links: Clickable images
2575 !! input
2576 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2577 !! result
2578 <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>
2579 </p>
2580 !!end
2581
2582 !! test
2583 External links: raw ampersand
2584 !! input
2585 Old &amp; use: http://x&y
2586 !! result
2587 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2588 </p>
2589 !! end
2590
2591 !! test
2592 External links: encoded ampersand
2593 !! input
2594 Old &amp; use: http://x&amp;y
2595 !! result
2596 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2597 </p>
2598 !! end
2599
2600 !! test
2601 External links: encoded equals (bug 6102)
2602 !! input
2603 http://example.com/?foo&#61;bar
2604 !! result
2605 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2606 </p>
2607 !! end
2608
2609 !! test
2610 External links: [raw ampersand]
2611 !! input
2612 Old &amp; use: [http://x&y]
2613 !! result
2614 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2615 </p>
2616 !! end
2617
2618 !! test
2619 External links: [encoded ampersand]
2620 !! input
2621 Old &amp; use: [http://x&amp;y]
2622 !! result
2623 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2624 </p>
2625 !! end
2626
2627 !! test
2628 External links: [encoded equals] (bug 6102)
2629 !! input
2630 [http://example.com/?foo&#61;bar]
2631 !! result
2632 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2633 </p>
2634 !! end
2635
2636 !! test
2637 External links: [IDN ignored character reference in hostname; strip it right off]
2638 !! input
2639 [http://e&zwnj;xample.com/]
2640 !! result
2641 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2642 </p>
2643 !! end
2644
2645 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2646 # Where an external link could easily circumvent the sanitization of the text of
2647 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2648 # test demands a higher standard. That's a bit strange.
2649 #
2650 # Example:
2651 #
2652 # http://e‌xample.com -> [http://example.com|http://example.com]
2653 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2654 #
2655 # The first example is sanitized, but the second is not. Any security benefits
2656 # from this production are trivial to circumvent. Either remove this test and
2657 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2658 # the test accordingly.
2659 #
2660 # All our love,
2661 # The Parsoid team.
2662 !! test
2663 External links: IDN ignored character reference in hostname; strip it right off
2664 !! input
2665 http://e&zwnj;xample.com/
2666 !! result
2667 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
2668 </p>
2669 !! end
2670
2671 !! test
2672 External links: www.jpeg.org (bug 554)
2673 !! input
2674 http://www.jpeg.org
2675 !!result
2676 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
2677 </p>
2678 !! end
2679
2680 !! test
2681 External links: URL within URL (original bug 2)
2682 !! input
2683 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
2684 !! result
2685 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
2686 </p>
2687 !! end
2688
2689 !! test
2690 BUG 361: URL inside bracketed URL
2691 !! input
2692 [http://www.example.com/foo http://www.example.com/bar]
2693 !! result
2694 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
2695 </p>
2696 !! end
2697
2698 !! test
2699 BUG 361: URL within URL, not bracketed
2700 !! input
2701 http://www.example.com/foo?=http://www.example.com/bar
2702 !! result
2703 <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>
2704 </p>
2705 !! end
2706
2707 !! test
2708 BUG 289: ">"-token in URL-tail
2709 !! input
2710 http://www.example.com/<hello>
2711 !! result
2712 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
2713 </p>
2714 !!end
2715
2716 !! test
2717 BUG 289: literal ">"-token in URL-tail
2718 !! input
2719 http://www.example.com/<b>html</b>
2720 !! result
2721 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
2722 </p>
2723 !!end
2724
2725 !! test
2726 BUG 289: ">"-token in bracketed URL
2727 !! input
2728 [http://www.example.com/<hello> stuff]
2729 !! result
2730 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
2731 </p>
2732 !!end
2733
2734 !! test
2735 BUG 289: literal ">"-token in bracketed URL
2736 !! input
2737 [http://www.example.com/<b>html</b> stuff]
2738 !! result
2739 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
2740 </p>
2741 !!end
2742
2743 !! test
2744 BUG 289: literal double quote at end of URL
2745 !! input
2746 http://www.example.com/"hello"
2747 !! result
2748 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
2749 </p>
2750 !!end
2751
2752 !! test
2753 BUG 289: literal double quote in bracketed URL
2754 !! input
2755 [http://www.example.com/"hello" stuff]
2756 !! result
2757 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
2758 </p>
2759 !!end
2760
2761 !! test
2762 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
2763 !! input
2764 [http://www.example.com test]
2765 !! result
2766 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
2767 </p>
2768 !! end
2769
2770 !! test
2771 External links: link text with spaces
2772 !! input
2773 [http://www.example.com a b c]
2774 [http://www.example.com ''a'' ''b'']
2775 !! result
2776 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
2777 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
2778 </p>
2779 !! end
2780
2781 !! test
2782 External links: wiki links within external link (Bug 3695)
2783 !! input
2784 [http://example.com [[wikilink]] embedded in ext link]
2785 !! result
2786 <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>
2787 </p>
2788 !! end
2789
2790 !! test
2791 BUG 787: Links with one slash after the url protocol are invalid
2792 !! input
2793 http:/example.com
2794
2795 [http:/example.com title]
2796 !! result
2797 <p>http:/example.com
2798 </p><p>[http:/example.com title]
2799 </p>
2800 !! end
2801
2802 !! test
2803 Bracketed external links with template-generated invalid target
2804 !! input
2805 [{{echo|http:/example.com}} title]
2806 !! result
2807 <p>[http:/example.com title]
2808 </p>
2809 !! end
2810
2811 !! test
2812 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
2813 !! input
2814 ''[http://example.com text'']
2815 [http://example.com '''text]'''
2816 ''Something [http://example.com in italic'']
2817 ''Something [http://example.com mixed''''', even bold]'''
2818 '''''Now [http://example.com both''''']
2819 !! result
2820 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
2821 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
2822 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
2823 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
2824 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
2825 </p>
2826 !! end
2827
2828
2829 !! test
2830 Bug 4781: %26 in URL
2831 !! input
2832 http://www.example.com/?title=AT%26T
2833 !! result
2834 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
2835 </p>
2836 !! end
2837
2838 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
2839 # % is actually legal in HTML5. Any change in output would need testing though.
2840 !! test
2841 Bug 4781, 5267: %25 in URL
2842 !! input
2843 http://www.example.com/?title=100%25_Bran
2844 !! result
2845 <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>
2846 </p>
2847 !! end
2848
2849 !! test
2850 Bug 4781, 5267: %28, %29 in URL
2851 !! input
2852 http://www.example.com/?title=Ben-Hur_%281959_film%29
2853 !! result
2854 <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>
2855 </p>
2856 !! end
2857
2858
2859 !! test
2860 Bug 4781: %26 in autonumber URL
2861 !! input
2862 [http://www.example.com/?title=AT%26T]
2863 !! result
2864 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
2865 </p>
2866 !! end
2867
2868 !! test
2869 Bug 4781, 5267: %26 in autonumber URL
2870 !! input
2871 [http://www.example.com/?title=100%25_Bran]
2872 !! result
2873 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
2874 </p>
2875 !! end
2876
2877 !! test
2878 Bug 4781, 5267: %28, %29 in autonumber URL
2879 !! input
2880 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
2881 !! result
2882 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
2883 </p>
2884 !! end
2885
2886
2887 !! test
2888 Bug 4781: %26 in bracketed URL
2889 !! input
2890 [http://www.example.com/?title=AT%26T link]
2891 !! result
2892 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
2893 </p>
2894 !! end
2895
2896 !! test
2897 Bug 4781, 5267: %26 in bracketed URL
2898 !! input
2899 [http://www.example.com/?title=100%25_Bran link]
2900 !! result
2901 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
2902 </p>
2903 !! end
2904
2905 !! test
2906 Bug 4781, 5267: %28, %29 in bracketed URL
2907 !! input
2908 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
2909 !! result
2910 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
2911 </p>
2912 !! end
2913
2914 !! test
2915 External link containing double-single-quotes in text '' (bug 4598 sanity check)
2916 !! input
2917 Some [http://example.com/ pretty ''italics'' and stuff]!
2918 !! result
2919 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
2920 </p>
2921 !! end
2922
2923 !! test
2924 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
2925 !! input
2926 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
2927 !! result
2928 <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>
2929 </p>
2930 !! end
2931
2932 !! test
2933 External link containing double-single-quotes with no space separating the url from text in italics
2934 !! input
2935 [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]].]
2936 !! result
2937 <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>
2938 </p>
2939 !! end
2940
2941 !! test
2942 URL-encoding in URL functions (single parameter)
2943 !! input
2944 {{localurl:Some page|amp=&}}
2945 !! result
2946 <p>/index.php?title=Some_page&amp;amp=&amp;
2947 </p>
2948 !! end
2949
2950 !! test
2951 URL-encoding in URL functions (multiple parameters)
2952 !! input
2953 {{localurl:Some page|q=?&amp=&}}
2954 !! result
2955 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
2956 </p>
2957 !! end
2958
2959 !! test
2960 Brackets in urls
2961 !! input
2962 http://example.com/index.php?foozoid%5B%5D=bar
2963
2964 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
2965 !! result
2966 <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>
2967 </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>
2968 </p>
2969 !! end
2970
2971 !! test
2972 IPv6 urls (bug 21261)
2973 !! options
2974 disabled
2975 !! input
2976 http://[2404:130:0:1000::187:2]/index.php
2977 !! result
2978 <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>
2979 </p>
2980 !! end
2981
2982 !! test
2983 Non-extlinks in brackets
2984 !! input
2985 [foo]
2986 [foo bar]
2987 [foo ''bar'']
2988 [fool's] errand
2989 [fool's errand]
2990 [{{echo|foo}}]
2991 [{{echo|foo}} bar]
2992 [{{echo|foo}} ''bar'']
2993 [{{echo|foo}}l's] errand
2994 [{{echo|foo}}l's errand]
2995 [url={{echo|foo}}]
2996 [url=http://example.com]
2997 !! result
2998 <p>[foo]
2999 [foo bar]
3000 [foo <i>bar</i>]
3001 [fool's] errand
3002 [fool's errand]
3003 [foo]
3004 [foo bar]
3005 [foo <i>bar</i>]
3006 [fool's] errand
3007 [fool's errand]
3008 [url=foo]
3009 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3010 </p>
3011 !! end
3012
3013 ###
3014 ### Quotes
3015 ###
3016
3017 !! test
3018 Quotes
3019 !! input
3020 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3021
3022 Normal text. '''''Bold italic text.''''' Normal text.
3023 !!result
3024 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3025 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3026 </p>
3027 !! end
3028
3029
3030 !! test
3031 Unclosed and unmatched quotes (php)
3032 !! options
3033 php
3034 !! input
3035 '''''Bold italic text '''with bold deactivated''' in between.'''''
3036
3037 '''''Bold italic text ''with italic deactivated'' in between.'''''
3038
3039 '''Bold text..
3040
3041 ..spanning two paragraphs (should not work).'''
3042
3043 '''Bold tag left open
3044
3045 ''Italic tag left open
3046
3047 Normal text.
3048
3049 <!-- Unmatching number of opening, closing tags: -->
3050 '''This year''''s election ''should'' beat '''last year''''s.
3051
3052 ''Tom'''s car is bigger than ''Susan'''s.
3053
3054 Plain ''italic'''s plain
3055 !! result
3056 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3057 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3058 </p><p><b>Bold text..</b>
3059 </p><p>..spanning two paragraphs (should not work).
3060 </p><p><b>Bold tag left open</b>
3061 </p><p><i>Italic tag left open</i>
3062 </p><p>Normal text.
3063 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3064 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3065 </p><p>Plain <i>italic'</i>s plain
3066 </p>
3067 !! end
3068 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3069 # parser strips. The wikitext contains just the first half of the bold
3070 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3071 # differently than the PHP parser.)
3072 !! test
3073 Unclosed and unmatched quotes (parsoid)
3074 !! options
3075 parsoid
3076 !! input
3077 '''''Bold italic text '''with bold deactivated''' in between.'''''
3078
3079 '''''Bold italic text ''with italic deactivated'' in between.'''''
3080
3081 '''Bold text..
3082
3083 ..spanning two paragraphs (should not work).'''
3084
3085 '''Bold tag left open
3086
3087 ''Italic tag left open
3088
3089 Normal text.
3090
3091 <!-- Unmatching number of opening, closing tags: -->
3092 '''This year''''s election ''should'' beat '''last year''''s.
3093
3094 ''Tom'''s car is bigger than ''Susan'''s.
3095
3096 Plain ''italic'''s plain
3097 !! result
3098 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3099 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3100 </p><p><b>Bold text..</b>
3101 </p><p>..spanning two paragraphs (should not work).<b></b>
3102 </p><p><b>Bold tag left open</b>
3103 </p><p><i>Italic tag left open</i>
3104 </p><p>Normal text.
3105 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3106 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3107 </p><p>Plain <i>italic'</i>s plain
3108 </p>
3109 !! end
3110
3111 ###
3112 ### Tables
3113 ###
3114 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3115 ###
3116
3117 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3118 # is the bare minimun required by the spec, see:
3119 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3120 !! test
3121 A table with no data.
3122 !! input
3123 {||}
3124 !! result
3125 !! end
3126
3127 # A table with nothing but a caption is invalid XHTML, we might want to render
3128 # this as <p>caption</p>
3129 !! test
3130 A table with nothing but a caption
3131 !! input
3132 {|
3133 |+ caption
3134 |}
3135 !! result
3136 <table>
3137 <caption> caption
3138 </caption><tr><td></td></tr></table>
3139
3140 !! end
3141
3142 !! test
3143 A table with caption with default-spaced attributes and a table row
3144 !! input
3145 {|
3146 |+ style="color: red;" | caption1
3147 |-
3148 | foo
3149 |}
3150 !! result
3151 <table>
3152 <caption style="color: red;"> caption1
3153 </caption>
3154 <tr>
3155 <td> foo
3156 </td></tr></table>
3157
3158 !! end
3159
3160 !! test
3161 A table with captions with non-default spaced attributes and a table row
3162 !! input
3163 {|
3164 |+style="color: red;"|caption2
3165 |+ style="color: red;"| caption3
3166 |-
3167 | foo
3168 |}
3169 !! result
3170 <table>
3171 <caption style="color: red;">caption2
3172 </caption>
3173 <caption style="color: red;"> caption3
3174 </caption>
3175 <tr>
3176 <td> foo
3177 </td></tr></table>
3178
3179 !! end
3180
3181 !! test
3182 Table td-cell syntax variations
3183 !! input
3184 {|
3185 | foo bar foo | baz
3186 | foo bar foo || baz
3187 | style='color:red;' | baz
3188 | style='color:red;' || baz
3189 |}
3190 !! result
3191 <table>
3192 <tr>
3193 <td> baz
3194 </td>
3195 <td> foo bar foo </td>
3196 <td> baz
3197 </td>
3198 <td style="color:red;"> baz
3199 </td>
3200 <td> style='color:red;' </td>
3201 <td> baz
3202 </td></tr></table>
3203
3204 !! end
3205
3206 !! test
3207 Simple table
3208 !! input
3209 {|
3210 | 1 || 2
3211 |-
3212 | 3 || 4
3213 |}
3214 !! result
3215 <table>
3216 <tr>
3217 <td> 1 </td>
3218 <td> 2
3219 </td></tr>
3220 <tr>
3221 <td> 3 </td>
3222 <td> 4
3223 </td></tr></table>
3224
3225 !! end
3226
3227 !! test
3228 Simple table but with multiple dashes for row wikitext
3229 !! input
3230 {|
3231 | foo
3232 |-----
3233 | bar
3234 |}
3235 !! result
3236 <table>
3237 <tr>
3238 <td> foo
3239 </td></tr>
3240 <tr>
3241 <td> bar
3242 </td></tr></table>
3243
3244 !! end
3245 !! test
3246 Multiplication table
3247 !! input
3248 {| border="1" cellpadding="2"
3249 |+Multiplication table
3250 |-
3251 ! &times; !! 1 !! 2 !! 3
3252 |-
3253 ! 1
3254 | 1 || 2 || 3
3255 |-
3256 ! 2
3257 | 2 || 4 || 6
3258 |-
3259 ! 3
3260 | 3 || 6 || 9
3261 |-
3262 ! 4
3263 | 4 || 8 || 12
3264 |-
3265 ! 5
3266 | 5 || 10 || 15
3267 |}
3268 !! result
3269 <table border="1" cellpadding="2">
3270 <caption>Multiplication table
3271 </caption>
3272 <tr>
3273 <th> &#215; </th>
3274 <th> 1 </th>
3275 <th> 2 </th>
3276 <th> 3
3277 </th></tr>
3278 <tr>
3279 <th> 1
3280 </th>
3281 <td> 1 </td>
3282 <td> 2 </td>
3283 <td> 3
3284 </td></tr>
3285 <tr>
3286 <th> 2
3287 </th>
3288 <td> 2 </td>
3289 <td> 4 </td>
3290 <td> 6
3291 </td></tr>
3292 <tr>
3293 <th> 3
3294 </th>
3295 <td> 3 </td>
3296 <td> 6 </td>
3297 <td> 9
3298 </td></tr>
3299 <tr>
3300 <th> 4
3301 </th>
3302 <td> 4 </td>
3303 <td> 8 </td>
3304 <td> 12
3305 </td></tr>
3306 <tr>
3307 <th> 5
3308 </th>
3309 <td> 5 </td>
3310 <td> 10 </td>
3311 <td> 15
3312 </td></tr></table>
3313
3314 !! end
3315
3316 !! test
3317 Accept "||" in table headings
3318 !! input
3319 {|
3320 !h1 || h2
3321 |}
3322 !! result
3323 <table>
3324 <tr>
3325 <th>h1 </th>
3326 <th> h2
3327 </th></tr></table>
3328
3329 !! end
3330
3331 !! test
3332 Accept "||" in indented table headings
3333 !! input
3334 :{|
3335 !h1 || h2
3336 |}
3337 !! result
3338 <dl><dd><table>
3339 <tr>
3340 <th>h1 </th>
3341 <th> h2
3342 </th></tr></table></dd></dl>
3343
3344 !! end
3345
3346 !! test
3347 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3348 !! input
3349 {|
3350 !| h1
3351 || a
3352 |}
3353 !! result
3354 <table>
3355 <tr>
3356 <th> h1
3357 </th>
3358 <td> a
3359 </td></tr></table>
3360
3361 !! end
3362
3363 !!test
3364 Accept "| !" at start of line in tables (ignore !-attribute)
3365 !!input
3366 {|
3367 |-
3368 | !style="color:red" | bar
3369 |}
3370 !!result
3371 <table>
3372
3373 <tr>
3374 <td> bar
3375 </td></tr></table>
3376
3377 !!end
3378
3379 !!test
3380 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 +/-
3381 !!input
3382 {|
3383 |-
3384 |style='color:red;'|+1
3385 |style='color:blue;'|-1
3386 |-
3387 | 1 || 2 || 3
3388 | 1 ||+2 ||-3
3389 |-
3390 | +1
3391 | -1
3392 |}
3393 !!result
3394 <table>
3395
3396 <tr>
3397 <td style="color:red;">+1
3398 </td>
3399 <td style="color:blue;">-1
3400 </td></tr>
3401 <tr>
3402 <td> 1 </td>
3403 <td> 2 </td>
3404 <td> 3
3405 </td>
3406 <td> 1 </td>
3407 <td>+2 </td>
3408 <td>-3
3409 </td></tr>
3410 <tr>
3411 <td> +1
3412 </td>
3413 <td> -1
3414 </td></tr></table>
3415
3416 !!end
3417
3418 !! test
3419 Table rowspan
3420 !! input
3421 {| border=1
3422 | Cell 1, row 1
3423 |rowspan=2| Cell 2, row 1 (and 2)
3424 | Cell 3, row 1
3425 |-
3426 | Cell 1, row 2
3427 | Cell 3, row 2
3428 |}
3429 !! result
3430 <table border="1">
3431 <tr>
3432 <td> Cell 1, row 1
3433 </td>
3434 <td rowspan="2"> Cell 2, row 1 (and 2)
3435 </td>
3436 <td> Cell 3, row 1
3437 </td></tr>
3438 <tr>
3439 <td> Cell 1, row 2
3440 </td>
3441 <td> Cell 3, row 2
3442 </td></tr></table>
3443
3444 !! end
3445
3446 !! test
3447 Nested table
3448 !! input
3449 {| border=1
3450 | &alpha;
3451 |
3452 {| bgcolor=#ABCDEF border=2
3453 |nested
3454 |-
3455 |table
3456 |}
3457 |the original table again
3458 |}
3459 !! result
3460 <table border="1">
3461 <tr>
3462 <td> &#945;
3463 </td>
3464 <td>
3465 <table bgcolor="#ABCDEF" border="2">
3466 <tr>
3467 <td>nested
3468 </td></tr>
3469 <tr>
3470 <td>table
3471 </td></tr></table>
3472 </td>
3473 <td>the original table again
3474 </td></tr></table>
3475
3476 !! end
3477
3478 !! test
3479 Invalid attributes in table cell (bug 1830)
3480 !! input
3481 {|
3482 |Cell:|broken
3483 |}
3484 !! result
3485 <table>
3486 <tr>
3487 <td>broken
3488 </td></tr></table>
3489
3490 !! end
3491
3492
3493 !! test
3494 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3495 !! input
3496 {|
3497 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3498 !! result
3499 <table>
3500 <tr>
3501 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3502 <td>]" onmouseover="alert(document.cookie)"&gt;test
3503 </td>
3504 </tr>
3505 </table>
3506
3507 !! end
3508
3509
3510 !! test
3511 Indented table markup mixed with indented pre content (proposed in bug 6200)
3512 !! input
3513 <table>
3514 <tr>
3515 <td>
3516 Text that should be rendered preformatted
3517 </td>
3518 </tr>
3519 </table>
3520 !! result
3521 <table>
3522 <tr>
3523 <td>
3524 <pre>Text that should be rendered preformatted
3525 </pre>
3526 </td>
3527 </tr>
3528 </table>
3529
3530 !! end
3531
3532 !! test
3533 Template-generated table cell attributes and cell content
3534 !! input
3535 {|
3536 |{{table_attribs}}
3537 |}
3538 !! result
3539 <table>
3540 <tr>
3541 <td style="color: red"> Foo
3542 </td></tr></table>
3543
3544 !! end
3545
3546 !! test
3547 Table with row followed by newlines and table heading
3548 !! input
3549 {|
3550 |-
3551
3552 ! foo
3553 |}
3554 !! result
3555 <table>
3556
3557
3558 <tr>
3559 <th> foo
3560 </th></tr></table>
3561
3562 !! end
3563
3564 !! test
3565 Table with empty line following the start tag
3566 !! input
3567 {|
3568
3569 |-
3570 | foo
3571 |}
3572 !! result
3573 <table>
3574
3575
3576 <tr>
3577 <td> foo
3578 </td></tr></table>
3579
3580 !! end
3581
3582 # FIXME: Preserve the attribute properly (with an empty string as value) in
3583 # the PHP parser. Parsoid implements the behavior below.
3584 !! test
3585 Table attributes with empty value
3586 !! options
3587 disabled
3588 !! input
3589 {|
3590 | style=| hello
3591 |}
3592 !! result
3593 <table>
3594 <tr>
3595 <td style=""> hello
3596 </td></tr></table>
3597
3598 !! end
3599
3600 !! test
3601 Wikitext table with a lot of comments
3602 !! input
3603 {|
3604 <!-- c0 -->
3605 | foo
3606 <!-- c1 -->
3607 |- <!-- c2 -->
3608 <!-- c3 -->
3609 |<!-- c4 -->
3610 <!-- c5 -->
3611 |}
3612 !! result
3613 <table>
3614 <tr>
3615 <td> foo
3616 </td></tr>
3617 <tr>
3618 <td>
3619 </td></tr></table>
3620
3621 !! end
3622
3623 !! test
3624 Wikitext table with double-line table cell
3625 !! input
3626 {|
3627 |a
3628 b
3629 |}
3630 !! result
3631 <table>
3632 <tr>
3633 <td>a
3634 <p>b
3635 </p>
3636 </td></tr></table>
3637
3638 !! end
3639
3640 !! test
3641 Table cell with a single comment
3642 !! input
3643 {|
3644 | <!-- c1 -->
3645 | a
3646 |}
3647 !! result
3648 <table>
3649 <tr>
3650 <td>
3651 </td>
3652 <td> a
3653 </td></tr></table>
3654
3655 !! end
3656
3657 # The expected HTML structure in this test is debatable. The PHP parser does
3658 # not parse this kind of table at all. The main focus for Parsoid is on
3659 # round-tripping, so this output is ok for now. TODO: revisit!
3660 !! test
3661 Wikitext table with html-syntax row (Parsoid)
3662 !! options
3663 parsoid
3664 !! input
3665 {|
3666 |-
3667 <td>foo</td>
3668 |}
3669 !! result
3670 <table>
3671 <tbody>
3672 <tr>
3673 <td></td>
3674 <td>foo</td></tr></tbody></table>
3675 !! end
3676
3677 ###
3678 ### Internal links
3679 ###
3680 !! test
3681 Plain link, capitalized
3682 !! input
3683 [[Main Page]]
3684 !! result
3685 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
3686 </p>
3687 !! end
3688
3689 !! test
3690 Plain link, uncapitalized
3691 !! input
3692 [[main Page]]
3693 !! result
3694 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
3695 </p>
3696 !! end
3697
3698 !! test
3699 Piped link
3700 !! input
3701 [[Main Page|The Main Page]]
3702 !! result
3703 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
3704 </p>
3705 !! end
3706
3707 !! test
3708 Broken link
3709 !! input
3710 [[Zigzagzogzagzig]]
3711 !! result
3712 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
3713 </p>
3714 !! end
3715
3716 !! test
3717 Broken link with fragment
3718 !! input
3719 [[Zigzagzogzagzig#zug]]
3720 !! result
3721 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
3722 </p>
3723 !! end
3724
3725 !! test
3726 Special page link with fragment
3727 !! input
3728 [[Special:Version#anchor]]
3729 !! result
3730 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
3731 </p>
3732 !! end
3733
3734 !! test
3735 Nonexistent special page link with fragment
3736 !! input
3737 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
3738 !! result
3739 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
3740 </p>
3741 !! end
3742
3743 !! test
3744 Link with prefix
3745 !! input
3746 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
3747 !! result
3748 <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>
3749 </p>
3750 !! end
3751
3752 !! test
3753 Link with suffix
3754 !! input
3755 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
3756 !! result
3757 <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>!!!
3758 </p>
3759 !! end
3760
3761 !! article
3762 prefixed article
3763 !! text
3764 Some text
3765 !! endarticle
3766
3767 !! test
3768 Bug 43661: Piped links with identical prefixes
3769 !! input
3770 [[prefixed article|prefixed articles with spaces]]
3771
3772 [[prefixed article|prefixed articlesaoeu]]
3773
3774 [[Main Page|Main Page test]]
3775 !! result
3776 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
3777 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
3778 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
3779 </p>
3780 !! end
3781
3782
3783 !! test
3784 Link with HTML entity in suffix / tail
3785 !! input
3786 [[Main Page]]&quot;, [[Main Page]]&#97;
3787 !! result
3788 <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;
3789 </p>
3790 !! end
3791
3792 !! test
3793 Link with 3 brackets
3794 !! input
3795 [[[main page]]]
3796 !! result
3797 <p>[[[main page]]]
3798 </p>
3799 !! end
3800
3801 !! test
3802 Piped link with 3 brackets
3803 !! input
3804 [[[main page|the main page]]]
3805 !! result
3806 <p>[[[main page|the main page]]]
3807 </p>
3808 !! end
3809
3810 !! test
3811 Link with multiple pipes
3812 !! input
3813 [[Main Page|The|Main|Page]]
3814 !! result
3815 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
3816 </p>
3817 !! end
3818
3819 !! test
3820 Link to namespaces
3821 !! input
3822 [[Talk:Parser testing]], [[Meta:Disclaimers]]
3823 !! result
3824 <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>
3825 </p>
3826 !! end
3827
3828 !! test
3829 Piped link to namespace
3830 !! input
3831 [[Meta:Disclaimers|The disclaimers]]
3832 !! result
3833 <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>
3834 </p>
3835 !! end
3836
3837 !! test
3838 Link containing }
3839 !! input
3840 [[Usually caused by a typo (oops}]]
3841 !! result
3842 <p>[[Usually caused by a typo (oops}]]
3843 </p>
3844 !! end
3845
3846 !! test
3847 Link containing % (not as a hex sequence)
3848 !! input
3849 [[7% Solution]]
3850 !! result
3851 <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>
3852 </p>
3853 !! end
3854
3855 !! test
3856 Link containing % as a single hex sequence interpreted to char
3857 !! input
3858 [[7%25 Solution]]
3859 !! result
3860 <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>
3861 </p>
3862 !!end
3863
3864 !! test
3865 Link containing % as a double hex sequence interpreted to hex sequence
3866 !! input
3867 [[7%2525 Solution]]
3868 !! result
3869 <p>[[7%2525 Solution]]
3870 </p>
3871 !!end
3872
3873 !! test
3874 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
3875 Example for such a section: == < ==
3876 !! input
3877 [[%23%3c]][[%23%3e]]
3878 !! result
3879 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
3880 </p>
3881 !! end
3882
3883 !! test
3884 Link containing "<#" and ">#" as a hex sequences
3885 !! input
3886 [[%3c%23]][[%3e%23]]
3887 !! result
3888 <p>[[%3c%23]][[%3e%23]]
3889 </p>
3890 !! end
3891
3892 !! test
3893 Link containing double-single-quotes '' (bug 4598)
3894 !! input
3895 [[Lista d''e paise d''o munno]]
3896 !! result
3897 <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>
3898 </p>
3899 !! end
3900
3901 !! test
3902 Link containing double-single-quotes '' in text (bug 4598 sanity check)
3903 !! input
3904 Some [[Link|pretty ''italics'' and stuff]]!
3905 !! result
3906 <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>!
3907 </p>
3908 !! end
3909
3910 !! test
3911 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
3912 !! input
3913 ''Some [[Link|pretty ''italics'' and stuff]]!
3914 !! result
3915 <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>
3916 </p>
3917 !! end
3918
3919 !! test
3920 Link with double quotes in title part (literal) and alternate part (interpreted)
3921 !! input
3922 [[File:Denys Savchenko ''Pentecoste''.jpg]]
3923
3924 [[''Pentecoste'']]
3925
3926 [[''Pentecoste''|Pentecoste]]
3927
3928 [[''Pentecoste''|''Pentecoste'']]
3929 !! result
3930 <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>
3931 </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>
3932 </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>
3933 </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>
3934 </p>
3935 !! end
3936
3937 !! test
3938 Broken image links with HTML captions (bug 39700)
3939 !! input
3940 [[File:Nonexistent|<script></script>]]
3941 [[File:Nonexistent|100px|<script></script>]]
3942 [[File:Nonexistent|&lt;]]
3943 [[File:Nonexistent|a<i>b</i>c]]
3944 !! result
3945 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
3946 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
3947 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
3948 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
3949 </p>
3950 !! end
3951
3952 !! test
3953 Plain link to URL
3954 !! input
3955 [[http://www.example.com]]
3956 !! result
3957 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
3958 </p>
3959 !! end
3960
3961 !! test
3962 Plain link to URL with link text
3963 !! input
3964 [[http://www.example.com Link text]]
3965 !! result
3966 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
3967 </p>
3968 !! end
3969
3970 !! test
3971 Plain link to protocol-relative URL
3972 !! input
3973 [[//www.example.com]]
3974 !! result
3975 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
3976 </p>
3977 !! end
3978
3979 !! test
3980 Plain link to protocol-relative URL with link text
3981 !! input
3982 [[//www.example.com Link text]]
3983 !! result
3984 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
3985 </p>
3986 !! end
3987
3988 !! test
3989 Plain link to page with question mark in title
3990 !! input
3991 [[A?b]]
3992
3993 [[A?b|Baz]]
3994 !! result
3995 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
3996 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
3997 </p>
3998 !! end
3999
4000
4001 # I'm fairly sure the expected result here is wrong.
4002 # We want these to be URL links, not pseudo-pages with URLs for titles....
4003 # However the current output is also pretty screwy.
4004 #
4005 # ----
4006 # I'm changing it to match the current output--it arguably makes more
4007 # sense in the light of the test above. Old expected result was:
4008 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4009 #</p>
4010 # But I think this test is bordering on "garbage in, garbage out" anyway.
4011 # -- wtm
4012 !! test
4013 Piped link to URL
4014 !! input
4015 Piped link to URL: [[http://www.example.com|an example URL]]
4016 !! result
4017 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4018 </p>
4019 !! end
4020
4021 !! test
4022 BUG 2: [[page|http://url/]] should link to page, not http://url/
4023 !! input
4024 [[Main Page|http://url/]]
4025 !! result
4026 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4027 </p>
4028 !! end
4029
4030 !! test
4031 BUG 337: Escaped self-links should be bold
4032 !! options
4033 title=[[Bug462]]
4034 !! input
4035 [[Bu&#103;462]] [[Bug462]]
4036 !! result
4037 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4038 </p>
4039 !! end
4040
4041 !! test
4042 Self-link to section should not be bold
4043 !! options
4044 title=[[Main Page]]
4045 !! input
4046 [[Main Page#section]]
4047 !! result
4048 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4049 </p>
4050 !! end
4051
4052 !! article
4053 00
4054 !! text
4055 This is 00.
4056 !! endarticle
4057
4058 !!test
4059 Self-link to numeric title
4060 !!options
4061 title=[[0]]
4062 !!input
4063 [[0]]
4064 !!result
4065 <p><strong class="selflink">0</strong>
4066 </p>
4067 !!end
4068
4069 !!test
4070 Link to numeric-equivalent title
4071 !!options
4072 title=[[0]]
4073 !!input
4074 [[00]]
4075 !!result
4076 <p><a href="/wiki/00" title="00">00</a>
4077 </p>
4078 !!end
4079
4080 !! test
4081 <nowiki> inside a link
4082 !! input
4083 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4084 !! result
4085 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4086 </p>
4087 !! end
4088
4089 !! test
4090 Non-breaking spaces in title
4091 !! input
4092 [[&nbsp; Main &nbsp; Page &nbsp;]]
4093 !! result
4094 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4095 </p>
4096 !!end
4097
4098 !! test
4099 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4100 !! options
4101 language=ca
4102 !! input
4103 '''[[Main Page]]'''
4104 !! result
4105 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4106 </p>
4107 !! end
4108
4109 !! test
4110 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4111 !! options
4112 language=ca
4113 !! input
4114 ''[[Main Page]]''
4115 !! result
4116 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4117 </p>
4118 !! end
4119
4120 !! test
4121 Internal link with en linktrail: no apostrophes (bug 27473)
4122 !! options
4123 language=en
4124 !! input
4125 [[Something]]'nice
4126 !! result
4127 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4128 </p>
4129 !! end
4130
4131 !! test
4132 Internal link with ca linktrail with apostrophes (bug 27473)
4133 !! options
4134 language=ca
4135 !! input
4136 [[Something]]'nice
4137 !! result
4138 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4139 </p>
4140 !! end
4141
4142 !! test
4143 Internal link with kaa linktrail with apostrophes (bug 27473)
4144 !! options
4145 language=kaa
4146 !! input
4147 [[Something]]'nice
4148 !! result
4149 <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>
4150 </p>
4151 !! end
4152
4153 !! test
4154 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4155 !! input
4156 [[Foo| bar]]
4157
4158 [[Foo| ''bar'']]
4159
4160 [http://wp.org foo]
4161
4162 [http://wp.org ''foo'']
4163 !! result
4164 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
4165 </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>
4166 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4167 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4168 </p>
4169 !! end
4170
4171 ###
4172 ### Interwiki links (see maintenance/interwiki.sql)
4173 ###
4174
4175 !! test
4176 Inline interwiki link
4177 !! input
4178 [[MeatBall:SoftSecurity]]
4179 !! result
4180 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4181 </p>
4182 !! end
4183
4184 !! test
4185 Inline interwiki link with empty title (bug 2372)
4186 !! input
4187 [[MeatBall:]]
4188 !! result
4189 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4190 </p>
4191 !! end
4192
4193 !! test
4194 Interwiki link encoding conversion (bug 1636)
4195 !! input
4196 *[[Wikipedia:ro:Olteni&#0355;a]]
4197 *[[Wikipedia:ro:Olteni&#355;a]]
4198 !! result
4199 <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>
4200 </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>
4201 </li></ul>
4202
4203 !! end
4204
4205 !! test
4206 Interwiki link with fragment (bug 2130)
4207 !! input
4208 [[MeatBall:SoftSecurity#foo]]
4209 !! result
4210 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4211 </p>
4212 !! end
4213
4214 !! test
4215 Interlanguage link
4216 !! input
4217 Blah blah blah
4218 [[zh:Chinese]]
4219 !!result
4220 <p>Blah blah blah
4221 </p>
4222 !! end
4223
4224 !! test
4225 Double interlanguage link
4226 !! input
4227 Blah blah blah
4228 [[es:Spanish]]
4229 [[zh:Chinese]]
4230 !!result
4231 <p>Blah blah blah
4232 </p>
4233 !! end
4234
4235 !! test
4236 Interlanguage link, with prefix links
4237 !! options
4238 language=ln
4239 !! input
4240 Blah blah blah
4241 [[zh:Chinese]]
4242 !!result
4243 <p>Blah blah blah
4244 </p>
4245 !! end
4246
4247 !! test
4248 Double interlanguage link, with prefix links (bug 8897)
4249 !! options
4250 language=ln
4251 !! input
4252 Blah blah blah
4253 [[es:Spanish]]
4254 [[zh:Chinese]]
4255 !!result
4256 <p>Blah blah blah
4257 </p>
4258 !! end
4259
4260 !! test
4261 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4262 !! options
4263 language=ln
4264 !! input
4265 [[WW&nbsp;II]]
4266 !!result
4267 <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>
4268 </p>
4269 !! end
4270
4271 ##
4272 ## XHTML tidiness
4273 ###
4274
4275 !! test
4276 <br> to <br />
4277 !! input
4278 1<br>2<br />3
4279 !! result
4280 <p>1<br />2<br />3
4281 </p>
4282 !! end
4283
4284 !! test
4285 Broken br tag sanitization
4286 !! input
4287 </br>
4288 !! result
4289 <p>&lt;/br&gt;
4290 </p>
4291 !! end
4292
4293 !! test
4294 Incorrecly removing closing slashes from correctly formed XHTML
4295 !! input
4296 <br style="clear:both;" />
4297 !! result
4298 <p><br style="clear:both;" />
4299 </p>
4300 !! end
4301
4302 !! test
4303 Failing to transform badly formed HTML into correct XHTML
4304 !! input
4305 <br style="clear: left;">
4306 <br style="clear: right;">
4307 <br style="clear: both;">
4308 !! result
4309 <p><br style="clear: left;" />
4310 <br style="clear: right;" />
4311 <br style="clear: both;" />
4312 </p>
4313 !!end
4314
4315 !! test
4316 Handling html with a div self-closing tag
4317 !! input
4318 <div title />
4319 <div title/>
4320 <div title/ >
4321 <div title=bar />
4322 <div title=bar/>
4323 <div title=bar/ >
4324 !! result
4325 <p>&lt;div title /&gt;
4326 &lt;div title/&gt;
4327 </p>
4328 <div>
4329 <p>&lt;div title=bar /&gt;
4330 &lt;div title=bar/&gt;
4331 </p>
4332 <div title="bar/"></div>
4333 </div>
4334
4335 !! end
4336
4337 !! test
4338 Handling html with a br self-closing tag
4339 !! input
4340 <br title />
4341 <br title/>
4342 <br title/ >
4343 <br title=bar />
4344 <br title=bar/>
4345 <br title=bar/ >
4346 !! result
4347 <p><br title="title" />
4348 <br title="title" />
4349 <br />
4350 <br title="bar" />
4351 <br title="bar" />
4352 <br title="bar/" />
4353 </p>
4354 !! end
4355
4356 !! test
4357 Horizontal ruler (should it add that extra space?)
4358 !! input
4359 <hr>
4360 <hr >
4361 foo <hr
4362 > bar
4363 !! result
4364 <hr />
4365 <hr />
4366 foo <hr /> bar
4367
4368 !! end
4369
4370 !! test
4371 Horizontal ruler -- 4+ dashes render hr
4372 !! input
4373 ----
4374 !! result
4375 <hr />
4376
4377 !! end
4378
4379 !! test
4380 Horizontal ruler -- eats additional dashes on the same line
4381 !! input
4382 ---------
4383 !! result
4384 <hr />
4385
4386 !! end
4387
4388 !! test
4389 Horizontal ruler -- does not collaps dashes on consecutive lines
4390 !! input
4391 ----
4392 ----
4393 !! result
4394 <hr />
4395 <hr />
4396
4397 !! end
4398
4399 !! test
4400 Horizontal ruler -- <4 dashes render as plain text
4401 !! input
4402 ---
4403 !! result
4404 <p>---
4405 </p>
4406 !! end
4407
4408 !! test
4409 Horizontal ruler -- Supports content following dashes on same line
4410 !! input
4411 ---- Foo
4412 !! result
4413 <hr /> Foo
4414
4415 !! end
4416
4417 ###
4418 ### Block-level elements
4419 ###
4420 !! test
4421 Common list
4422 !! input
4423 *Common list
4424 * item 2
4425 *item 3
4426 !! result
4427 <ul><li>Common list
4428 </li><li> item 2
4429 </li><li>item 3
4430 </li></ul>
4431
4432 !! end
4433
4434 !! test
4435 Numbered list
4436 !! input
4437 #Numbered list
4438 #item 2
4439 # item 3
4440 !! result
4441 <ol><li>Numbered list
4442 </li><li>item 2
4443 </li><li> item 3
4444 </li></ol>
4445
4446 !! end
4447
4448 !! test
4449 Mixed list
4450 !! input
4451 *Mixed list
4452 *# with numbers
4453 ** and bullets
4454 *# and numbers
4455 *bullets again
4456 **bullet level 2
4457 ***bullet level 3
4458 ***#Number on level 4
4459 **bullet level 2
4460 **#Number on level 3
4461 **#Number on level 3
4462 *#number level 2
4463 *Level 1
4464 *** Level 3
4465 #** Level 3, but ordered
4466 !! result
4467 <ul><li>Mixed list
4468 <ol><li> with numbers
4469 </li></ol>
4470 <ul><li> and bullets
4471 </li></ul>
4472 <ol><li> and numbers
4473 </li></ol>
4474 </li><li>bullets again
4475 <ul><li>bullet level 2
4476 <ul><li>bullet level 3
4477 <ol><li>Number on level 4
4478 </li></ol>
4479 </li></ul>
4480 </li><li>bullet level 2
4481 <ol><li>Number on level 3
4482 </li><li>Number on level 3
4483 </li></ol>
4484 </li></ul>
4485 <ol><li>number level 2
4486 </li></ol>
4487 </li><li>Level 1
4488 <ul><li><ul><li> Level 3
4489 </li></ul>
4490 </li></ul>
4491 </li></ul>
4492 <ol><li><ul><li><ul><li> Level 3, but ordered
4493 </li></ul>
4494 </li></ul>
4495 </li></ol>
4496
4497 !! end
4498
4499 !! test
4500 Nested lists 1
4501 !! input
4502 *foo
4503 **bar
4504 !! result
4505 <ul><li>foo
4506 <ul><li>bar
4507 </li></ul>
4508 </li></ul>
4509
4510 !! end
4511
4512 !! test
4513 Nested lists 2
4514 !! input
4515 **foo
4516 *bar
4517 !! result
4518 <ul><li><ul><li>foo
4519 </li></ul>
4520 </li><li>bar
4521 </li></ul>
4522
4523 !! end
4524
4525 !! test
4526 Nested lists 3 (first element empty)
4527 !! input
4528 *
4529 **bar
4530 !! result
4531 <ul><li>
4532 <ul><li>bar
4533 </li></ul>
4534 </li></ul>
4535
4536 !! end
4537
4538 !! test
4539 Nested lists 4 (first element empty)
4540 !! input
4541 **
4542 *bar
4543 !! result
4544 <ul><li><ul><li>
4545 </li></ul>
4546 </li><li>bar
4547 </li></ul>
4548
4549 !! end
4550
4551 !! test
4552 Nested lists 5 (both elements empty)
4553 !! input
4554 **
4555 *
4556 !! result
4557 <ul><li><ul><li>
4558 </li></ul>
4559 </li><li>
4560 </li></ul>
4561
4562 !! end
4563
4564 !! test
4565 Nested lists 6 (both elements empty)
4566 !! input
4567 *
4568 **
4569 !! result
4570 <ul><li>
4571 <ul><li>
4572 </li></ul>
4573 </li></ul>
4574
4575 !! end
4576
4577 !! test
4578 Nested lists 7 (skip initial nesting levels)
4579 !! input
4580 *** foo
4581 !! result
4582 <ul><li><ul><li><ul><li> foo
4583 </li></ul>
4584 </li></ul>
4585 </li></ul>
4586
4587 !! end
4588
4589 !! test
4590 Nested lists 8 (multiple nesting transitions)
4591 !! input
4592 * foo
4593 *** bar
4594 ** baz
4595 * boo
4596 !! result
4597 <ul><li> foo
4598 <ul><li><ul><li> bar
4599 </li></ul>
4600 </li><li> baz
4601 </li></ul>
4602 </li><li> boo
4603 </li></ul>
4604
4605 !! end
4606
4607 !! test
4608 1. Lists with start-of-line-transparent tokens before bullets: Comments
4609 !! input
4610 *foo
4611 *<!--cmt-->bar
4612 <!--cmt-->*baz
4613 !! result
4614 <ul><li>foo
4615 </li><li>bar
4616 </li><li>baz
4617 </li></ul>
4618
4619 !! end
4620
4621 !! test
4622 2. Lists with start-of-line-transparent tokens before bullets: Template close
4623 !! input
4624 *foo {{echo|bar
4625 }}*baz
4626 !! result
4627 <ul><li>foo bar
4628 </li><li>baz
4629 </li></ul>
4630
4631 !! end
4632
4633 !! test
4634 Unbalanced closing block tags break a list
4635 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4636 !! options
4637 disabled
4638 !! input
4639 <div>
4640 *a</div><div>
4641 *b</div>
4642 !! result
4643 <div>
4644 <ul><li>a
4645 </li></ul></div><div>
4646 <ul><li>b
4647 </li></ul></div>
4648 !! end
4649
4650 !! test
4651 Unbalanced closing non-block tags don't break a list
4652 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4653 !! options
4654 disabled
4655 !! input
4656 <span>
4657 *a</span><span>
4658 *b</span>
4659 !! result
4660 <p><span></span>
4661 </p>
4662 <ul><li>a<span></span>
4663 </li><li>b
4664 </li></ul>
4665 !! end
4666
4667 !! test
4668 Unclosed formatting tags that straddle lists are closed and reopened
4669 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4670 !! options
4671 disabled
4672 !! input
4673 # <s> a
4674 # b </s>
4675 !! result
4676 <ol><li> <s> a </s>
4677 </li><li> <s> b </s>
4678 </li></ol>
4679 !! end
4680
4681 !!test
4682 List embedded in a non-block tag
4683 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
4684 !! options
4685 parsoid
4686 !!input
4687 <small>
4688 * foo
4689 </small>
4690 !!result
4691 <p><small></small></p>
4692 <small>
4693 <ul>
4694 <li> foo</li>
4695 </ul>
4696 </small>
4697 <p><small></small></p>
4698 !!end
4699
4700 !! test
4701 List items are not parsed correctly following a <pre> block (bug 785)
4702 !! input
4703 * <pre>foo</pre>
4704 * <pre>bar</pre>
4705 * zar
4706 !! result
4707 <ul><li> <pre>foo</pre>
4708 </li><li> <pre>bar</pre>
4709 </li><li> zar
4710 </li></ul>
4711
4712 !! end
4713
4714 !! test
4715 List items from template
4716 !! input
4717
4718 {{inner list}}
4719 * item 2
4720
4721 * item 0
4722 {{inner list}}
4723 * item 2
4724
4725 * item 0
4726 * notSOL{{inner list}}
4727 * item 2
4728 !! result
4729 <ul><li> item 1
4730 </li><li> item 2
4731 </li></ul>
4732 <ul><li> item 0
4733 </li><li> item 1
4734 </li><li> item 2
4735 </li></ul>
4736 <ul><li> item 0
4737 </li><li> notSOL
4738 </li><li> item 1
4739 </li><li> item 2
4740 </li></ul>
4741
4742 !! end
4743
4744 !! test
4745 List interrupted by empty line or heading
4746 !! input
4747 * foo
4748
4749 ** bar
4750 == A heading ==
4751 * Another list item
4752 !! result
4753 <ul><li> foo
4754 </li></ul>
4755 <ul><li><ul><li> bar
4756 </li></ul>
4757 </li></ul>
4758 <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>
4759 <ul><li> Another list item
4760 </li></ul>
4761
4762 !!end
4763
4764 !!test
4765 Multiple list tags generated by templates
4766 !!input
4767 {{echo|<li>}}a
4768 {{echo|<li>}}b
4769 {{echo|<li>}}c
4770 !!result
4771 <li>a
4772 <li>b
4773 <li>c</li>
4774 </li>
4775 </li>
4776
4777 !!end
4778
4779 !!test
4780 Single-comment whitespace lines dont break lists, but multi-comment whitespace lines do
4781 !!input
4782 *a
4783 <!--This line will NOT split the list-->
4784 *b
4785 <!--This line will NOT split the list either-->
4786 *c
4787 <!--foo--> <!--This line with more than 1 comment will split the list-->
4788 *d
4789 !!result
4790 <ul><li>a
4791 </li><li>b
4792 </li><li>c
4793 </li></ul>
4794 <ul><li>d
4795 </li></ul>
4796
4797 !!end
4798
4799 ###
4800 ### Magic Words
4801 ###
4802
4803 !! test
4804 Magic Word: {{CURRENTDAY}}
4805 !! input
4806 {{CURRENTDAY}}
4807 !! result
4808 <p>1
4809 </p>
4810 !! end
4811
4812 !! test
4813 Magic Word: {{CURRENTDAY2}}
4814 !! input
4815 {{CURRENTDAY2}}
4816 !! result
4817 <p>01
4818 </p>
4819 !! end
4820
4821 !! test
4822 Magic Word: {{CURRENTDAYNAME}}
4823 !! input
4824 {{CURRENTDAYNAME}}
4825 !! result
4826 <p>Thursday
4827 </p>
4828 !! end
4829
4830 !! test
4831 Magic Word: {{CURRENTDOW}}
4832 !! input
4833 {{CURRENTDOW}}
4834 !! result
4835 <p>4
4836 </p>
4837 !! end
4838
4839 !! test
4840 Magic Word: {{CURRENTMONTH}}
4841 !! input
4842 {{CURRENTMONTH}}
4843 !! result
4844 <p>01
4845 </p>
4846 !! end
4847
4848 !! test
4849 Magic Word: {{CURRENTMONTHABBREV}}
4850 !! input
4851 {{CURRENTMONTHABBREV}}
4852 !! result
4853 <p>Jan
4854 </p>
4855 !! end
4856
4857 !! test
4858 Magic Word: {{CURRENTMONTHNAME}}
4859 !! input
4860 {{CURRENTMONTHNAME}}
4861 !! result
4862 <p>January
4863 </p>
4864 !! end
4865
4866 !! test
4867 Magic Word: {{CURRENTMONTHNAMEGEN}}
4868 !! input
4869 {{CURRENTMONTHNAMEGEN}}
4870 !! result
4871 <p>January
4872 </p>
4873 !! end
4874
4875 !! test
4876 Magic Word: {{CURRENTTIME}}
4877 !! input
4878 {{CURRENTTIME}}
4879 !! result
4880 <p>00:02
4881 </p>
4882 !! end
4883
4884 !! test
4885 Magic Word: {{CURRENTWEEK}} (@bug 4594)
4886 !! input
4887 {{CURRENTWEEK}}
4888 !! result
4889 <p>1
4890 </p>
4891 !! end
4892
4893 !! test
4894 Magic Word: {{CURRENTYEAR}}
4895 !! input
4896 {{CURRENTYEAR}}
4897 !! result
4898 <p>1970
4899 </p>
4900 !! end
4901
4902 !! test
4903 Magic Word: {{FULLPAGENAME}}
4904 !! options
4905 title=[[User:Ævar Arnfjörð Bjarmason]]
4906 !! input
4907 {{FULLPAGENAME}}
4908 !! result
4909 <p>User:Ævar Arnfjörð Bjarmason
4910 </p>
4911 !! end
4912
4913 !! test
4914 Magic Word: {{FULLPAGENAMEE}}
4915 !! options
4916 title=[[User:Ævar Arnfjörð Bjarmason]]
4917 !! input
4918 {{FULLPAGENAMEE}}
4919 !! result
4920 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
4921 </p>
4922 !! end
4923
4924 !! test
4925 Magic Word: {{NAMESPACE}}
4926 !! options
4927 title=[[User:Ævar Arnfjörð Bjarmason]]
4928 !! input
4929 {{NAMESPACE}}
4930 !! result
4931 <p>User
4932 </p>
4933 !! end
4934
4935 !! test
4936 Magic Word: {{NAMESPACEE}}
4937 !! options
4938 title=[[User:Ævar Arnfjörð Bjarmason]]
4939 !! input
4940 {{NAMESPACEE}}
4941 !! result
4942 <p>User
4943 </p>
4944 !! end
4945
4946 !! test
4947 Magic Word: {{NAMESPACENUMBER}}
4948 !! options
4949 title=[[User:Ævar Arnfjörð Bjarmason]]
4950 !! input
4951 {{NAMESPACENUMBER}}
4952 !! result
4953 <p>2
4954 </p>
4955 !! end
4956
4957 !! test
4958 Magic Word: {{NUMBEROFFILES}}
4959 !! input
4960 {{NUMBEROFFILES}}
4961 !! result
4962 <p>3
4963 </p>
4964 !! end
4965
4966 !! test
4967 Magic Word: {{PAGENAME}}
4968 !! options
4969 title=[[User:Ævar Arnfjörð Bjarmason]]
4970 !! input
4971 {{PAGENAME}}
4972 !! result
4973 <p>Ævar Arnfjörð Bjarmason
4974 </p>
4975 !! end
4976
4977 !! test
4978 Magic Word: {{PAGENAME}} with metacharacters
4979 !! options
4980 title=[['foo & bar = baz']]
4981 !! input
4982 ''{{PAGENAME}}''
4983 !! result
4984 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
4985 </p>
4986 !! end
4987
4988 !! test
4989 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
4990 !! options
4991 title=[[*RFC 1234 http://example.com/]]
4992 !! input
4993 {{PAGENAME}}
4994 !! result
4995 <p>&#42;RFC&#32;1234 http&#58;//example.com/
4996 </p>
4997 !! end
4998
4999 !! test
5000 Magic Word: {{PAGENAMEE}}
5001 !! options
5002 title=[[User:Ævar Arnfjörð Bjarmason]]
5003 !! input
5004 {{PAGENAMEE}}
5005 !! result
5006 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5007 </p>
5008 !! end
5009
5010 !! test
5011 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
5012 !! options
5013 title=[[*RFC 1234 http://example.com/]]
5014 !! input
5015 {{PAGENAMEE}}
5016 !! result
5017 <p>&#42;RFC_1234_http&#58;//example.com/
5018 </p>
5019 !! end
5020
5021 !! test
5022 Magic Word: {{REVISIONID}}
5023 !! input
5024 {{REVISIONID}}
5025 !! result
5026 <p>1337
5027 </p>
5028 !! end
5029
5030 !! test
5031 Magic Word: {{SCRIPTPATH}}
5032 !! input
5033 {{SCRIPTPATH}}
5034 !! result
5035 <p>/
5036 </p>
5037 !! end
5038
5039 !! test
5040 Magic Word: {{SERVER}}
5041 !! input
5042 {{SERVER}}
5043 !! result
5044 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5045 </p>
5046 !! end
5047
5048 !! test
5049 Magic Word: {{SERVERNAME}}
5050 !! input
5051 {{SERVERNAME}}
5052 !! result
5053 <p>example.org
5054 </p>
5055 !! end
5056
5057 !! test
5058 Magic Word: {{SITENAME}}
5059 !! input
5060 {{SITENAME}}
5061 !! result
5062 <p>MediaWiki
5063 </p>
5064 !! end
5065
5066 !! test
5067 Case-sensitive magic words, when cased differently, should just be template transclusions
5068 !! input
5069 {{CurrentMonth}}
5070 {{currentday}}
5071 {{cURreNTweEK}}
5072 {{currentHour}}
5073 !! result
5074 <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>
5075 <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>
5076 <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>
5077 <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>
5078 </p>
5079 !! end
5080
5081 !! test
5082 Case-insensitive magic words should still work with weird casing.
5083 !! input
5084 {{sErVeRNaMe}}
5085 {{LCFirst:AOEU}}
5086 {{ucFIRST:aoeu}}
5087 {{SERver}}
5088 !! result
5089 <p>example.org
5090 aOEU
5091 Aoeu
5092 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5093 </p>
5094 !! end
5095
5096 !! test
5097 Namespace 1 {{ns:1}}
5098 !! input
5099 {{ns:1}}
5100 !! result
5101 <p>Talk
5102 </p>
5103 !! end
5104
5105 !! test
5106 Namespace 1 {{ns:01}}
5107 !! input
5108 {{ns:01}}
5109 !! result
5110 <p>Talk
5111 </p>
5112 !! end
5113
5114 !! test
5115 Namespace 0 {{ns:0}} (bug 4783)
5116 !! input
5117 {{ns:0}}
5118 !! result
5119
5120 !! end
5121
5122 !! test
5123 Namespace 0 {{ns:00}} (bug 4783)
5124 !! input
5125 {{ns:00}}
5126 !! result
5127
5128 !! end
5129
5130 !! test
5131 Namespace -1 {{ns:-1}}
5132 !! input
5133 {{ns:-1}}
5134 !! result
5135 <p>Special
5136 </p>
5137 !! end
5138
5139 !! test
5140 Namespace User {{ns:User}}
5141 !! input
5142 {{ns:User}}
5143 !! result
5144 <p>User
5145 </p>
5146 !! end
5147
5148 !! test
5149 Namespace User talk {{ns:User_talk}}
5150 !! input
5151 {{ns:User_talk}}
5152 !! result
5153 <p>User talk
5154 </p>
5155 !! end
5156
5157 !! test
5158 Namespace User talk {{ns:uSeR tAlK}}
5159 !! input
5160 {{ns:uSeR tAlK}}
5161 !! result
5162 <p>User talk
5163 </p>
5164 !! end
5165
5166 !! test
5167 Namespace File {{ns:File}}
5168 !! input
5169 {{ns:File}}
5170 !! result
5171 <p>File
5172 </p>
5173 !! end
5174
5175 !! test
5176 Namespace File {{ns:Image}}
5177 !! input
5178 {{ns:Image}}
5179 !! result
5180 <p>File
5181 </p>
5182 !! end
5183
5184 !! test
5185 Namespace (lang=de) Benutzer {{ns:User}}
5186 !! options
5187 language=de
5188 !! input
5189 {{ns:User}}
5190 !! result
5191 <p>Benutzer
5192 </p>
5193 !! end
5194
5195 !! test
5196 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
5197 !! options
5198 language=de
5199 !! input
5200 {{ns:3}}
5201 !! result
5202 <p>Benutzer Diskussion
5203 </p>
5204 !! end
5205
5206
5207 !! test
5208 Urlencode
5209 !! input
5210 {{urlencode:hi world?!}}
5211 {{urlencode:hi world?!|WIKI}}
5212 {{urlencode:hi world?!|PATH}}
5213 {{urlencode:hi world?!|QUERY}}
5214 !! result
5215 <p>hi+world%3F%21
5216 hi_world%3F!
5217 hi%20world%3F%21
5218 hi+world%3F%21
5219 </p>
5220 !! end
5221
5222 ###
5223 ### Magic links
5224 ###
5225 !! test
5226 Magic links: internal link to RFC (bug 479)
5227 !! input
5228 [[RFC 123]]
5229 !! result
5230 <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>
5231 </p>
5232 !! end
5233
5234 !! test
5235 Magic links: RFC (bug 479)
5236 !! input
5237 RFC 822
5238 !! result
5239 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
5240 </p>
5241 !! end
5242
5243 !! test
5244 Magic links: ISBN (bug 1937)
5245 !! input
5246 ISBN 0-306-40615-2
5247 !! result
5248 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
5249 </p>
5250 !! end
5251
5252 !! test
5253 Magic links: PMID incorrectly converts space to underscore
5254 !! input
5255 PMID 1234
5256 !! result
5257 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
5258 </p>
5259 !! end
5260
5261 ###
5262 ### Templates
5263 ####
5264
5265 !! test
5266 Nonexistent template
5267 !! input
5268 {{thistemplatedoesnotexist}}
5269 !! result
5270 <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>
5271 </p>
5272 !! end
5273
5274 !! test
5275 Template with invalid target containing tags
5276 !! input
5277 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5278 !! result
5279 <p>{{a<b>b</b>|foo|a=b|a = b}}
5280 </p>
5281 !! end
5282
5283 !! test
5284 Template with invalid target containing unclosed tag
5285 !! input
5286 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5287 !! result
5288 <p>{{a<b>|foo|a=b|a = b}}</b>
5289 </p>
5290 !! end
5291
5292 !! article
5293 Template:test
5294 !! text
5295 This is a test template
5296 !! endarticle
5297
5298 !! test
5299 Simple template
5300 !! input
5301 {{test}}
5302 !! result
5303 <p>This is a test template
5304 </p>
5305 !! end
5306
5307 !! test
5308 Template with explicit namespace
5309 !! input
5310 {{Template:test}}
5311 !! result
5312 <p>This is a test template
5313 </p>
5314 !! end
5315
5316
5317 !! article
5318 Template:paramtest
5319 !! text
5320 This is a test template with parameter {{{param}}}
5321 !! endarticle
5322
5323 !! test
5324 Template parameter
5325 !! input
5326 {{paramtest|param=foo}}
5327 !! result
5328 <p>This is a test template with parameter foo
5329 </p>
5330 !! end
5331
5332 !! article
5333 Template:paramtestnum
5334 !! text
5335 [[{{{1}}}|{{{2}}}]]
5336 !! endarticle
5337
5338 !! test
5339 Template unnamed parameter
5340 !! input
5341 {{paramtestnum|Main Page|the main page}}
5342 !! result
5343 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
5344 </p>
5345 !! end
5346
5347 !! article
5348 Template:templatesimple
5349 !! text
5350 (test)
5351 !! endarticle
5352
5353 !! article
5354 Template:templateredirect
5355 !! text
5356 #redirect [[Template:templatesimple]]
5357 !! endarticle
5358
5359 !! article
5360 Template:templateasargtestnum
5361 !! text
5362 {{{{{1}}}}}
5363 !! endarticle
5364
5365 !! article
5366 Template:templateasargtest
5367 !! text
5368 {{template{{{templ}}}}}
5369 !! endarticle
5370
5371 !! article
5372 Template:templateasargtest2
5373 !! text
5374 {{{{{templ}}}}}
5375 !! endarticle
5376
5377 !! test
5378 Template with template name as unnamed argument
5379 !! input
5380 {{templateasargtestnum|templatesimple}}
5381 !! result
5382 <p>(test)
5383 </p>
5384 !! end
5385
5386 !! test
5387 Template with template name as argument
5388 !! input
5389 {{templateasargtest|templ=simple}}
5390 !! result
5391 <p>(test)
5392 </p>
5393 !! end
5394
5395 !! test
5396 Template with template name as argument (2)
5397 !! input
5398 {{templateasargtest2|templ=templatesimple}}
5399 !! result
5400 <p>(test)
5401 </p>
5402 !! end
5403
5404 !! article
5405 Template:templateasargtestdefault
5406 !! text
5407 {{{{{templ|templatesimple}}}}}
5408 !! endarticle
5409
5410 !! article
5411 Template:templa
5412 !! text
5413 '''templ'''
5414 !! endarticle
5415
5416 !! test
5417 Template with default value
5418 !! input
5419 {{templateasargtestdefault}}
5420 !! result
5421 <p>(test)
5422 </p>
5423 !! end
5424
5425 !! test
5426 Template with default value (value set)
5427 !! input
5428 {{templateasargtestdefault|templ=templa}}
5429 !! result
5430 <p><b>templ</b>
5431 </p>
5432 !! end
5433
5434 !! test
5435 Template redirect
5436 !! input
5437 {{templateredirect}}
5438 !! result
5439 <p>(test)
5440 </p>
5441 !! end
5442
5443 !! test
5444 Template with argument in separate line
5445 !! input
5446 {{ templateasargtest |
5447 templ = simple }}
5448 !! result
5449 <p>(test)
5450 </p>
5451 !! end
5452
5453 !! test
5454 Template with complex template as argument
5455 !! input
5456 {{paramtest|
5457 param ={{ templateasargtest |
5458 templ = simple }}}}
5459 !! result
5460 <p>This is a test template with parameter (test)
5461 </p>
5462 !! end
5463
5464 !! test
5465 Template with thumb image (with link in description)
5466 !! input
5467 {{paramtest|
5468 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
5469 !! result
5470 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>
5471
5472 !! end
5473
5474 !! article
5475 Template:complextemplate
5476 !! text
5477 {{{1}}} {{paramtest|
5478 param ={{{param}}}}}
5479 !! endarticle
5480
5481 !! test
5482 Template with complex arguments
5483 !! input
5484 {{complextemplate|
5485 param ={{ templateasargtest |
5486 templ = simple }}|[[Template:complextemplate|link]]}}
5487 !! result
5488 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
5489 </p>
5490 !! end
5491
5492 !! test
5493 BUG 553: link with two variables in a piped link
5494 !! input
5495 {|
5496 |[[{{{1}}}|{{{2}}}]]
5497 |}
5498 !! result
5499 <table>
5500 <tr>
5501 <td>[[{{{1}}}|{{{2}}}]]
5502 </td></tr></table>
5503
5504 !! end
5505
5506 !! test
5507 Magic variable as template parameter
5508 !! input
5509 {{paramtest|param={{SITENAME}}}}
5510 !! result
5511 <p>This is a test template with parameter MediaWiki
5512 </p>
5513 !! end
5514
5515 !! article
5516 Template:linktest
5517 !! text
5518 [[{{{param}}}|link]]
5519 !! endarticle
5520
5521 !! test
5522 Template parameter as link source
5523 !! input
5524 {{linktest|param=Main Page}}
5525 !! result
5526 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
5527 </p>
5528 !! end
5529
5530 !!test
5531 Template-generated attribute string (k='v')
5532 !!input
5533 <span {{attr_str|id|v1}}>bar</span>
5534 !!result
5535 <p><span id="v1">bar</span>
5536 </p>
5537 !!end
5538
5539 !!article
5540 Template:paramtest2
5541 !! text
5542 including another template, {{paramtest|param={{{arg}}}}}
5543 !! endarticle
5544
5545 !! test
5546 Template passing argument to another template
5547 !! input
5548 {{paramtest2|arg='hmm'}}
5549 !! result
5550 <p>including another template, This is a test template with parameter 'hmm'
5551 </p>
5552 !! end
5553
5554 !! article
5555 Template:Linktest2
5556 !! text
5557 Main Page
5558 !! endarticle
5559
5560 !! test
5561 Template as link source
5562 !! input
5563 [[{{linktest2}}]]
5564
5565 [[{{linktest2}}|Main Page]]
5566
5567 [[{{linktest2}}]]Page
5568 !! result
5569 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5570 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5571 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
5572 </p>
5573 !! end
5574
5575
5576 !! article
5577 Template:loop1
5578 !! text
5579 {{loop2}}
5580 !! endarticle
5581
5582 !! article
5583 Template:loop2
5584 !! text
5585 {{loop1}}
5586 !! endarticle
5587
5588 !! test
5589 Template infinite loop
5590 !! input
5591 {{loop1}}
5592 !! result
5593 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
5594 </p>
5595 !! end
5596
5597 !! test
5598 Template from main namespace
5599 !! input
5600 {{:Main Page}}
5601 !! result
5602 <p>blah blah
5603 </p>
5604 !! end
5605
5606 !! article
5607 Template:table
5608 !! text
5609 {|
5610 | 1 || 2
5611 |-
5612 | 3 || 4
5613 |}
5614 !! endarticle
5615
5616 !! test
5617 BUG 529: Template with table, not included at beginning of line
5618 !! input
5619 foo {{table}}
5620 !! result
5621 <p>foo
5622 </p>
5623 <table>
5624 <tr>
5625 <td> 1 </td>
5626 <td> 2
5627 </td></tr>
5628 <tr>
5629 <td> 3 </td>
5630 <td> 4
5631 </td></tr></table>
5632
5633 !! end
5634
5635 !! test
5636 BUG 523: Template shouldn't eat newline (or add an extra one before table)
5637 !! input
5638 foo
5639 {{table}}
5640 !! result
5641 <p>foo
5642 </p>
5643 <table>
5644 <tr>
5645 <td> 1 </td>
5646 <td> 2
5647 </td></tr>
5648 <tr>
5649 <td> 3 </td>
5650 <td> 4
5651 </td></tr></table>
5652
5653 !! end
5654
5655 !! test
5656 BUG 41: Template parameters shown as broken links
5657 !! input
5658 {{{parameter}}}
5659 !! result
5660 <p>{{{parameter}}}
5661 </p>
5662 !! end
5663
5664 !! test
5665 Template with targets containing wikilinks
5666 !! input
5667 {{[[foo]]}}
5668
5669 {{[[{{echo|foo}}]]}}
5670
5671 {{{{echo|[[foo}}]]}}
5672 !! result
5673 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5674 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5675 </p><p>{{[[foo}}]]
5676 </p>
5677 !! end
5678
5679 !! article
5680 Template:MSGNW test
5681 !! text
5682 ''None'' of '''this''' should be
5683 * interpreted
5684 but rather passed unmodified
5685 {{test}}
5686 !! endarticle
5687
5688 # hmm, fix this or just deprecate msgnw and document its behavior?
5689 !! test
5690 msgnw keyword
5691 !! options
5692 disabled
5693 !! input
5694 {{msgnw:MSGNW test}}
5695 !! result
5696 <p>''None'' of '''this''' should be
5697 * interpreted
5698 but rather passed unmodified
5699 {{test}}
5700 </p>
5701 !! end
5702
5703 !! test
5704 int keyword
5705 !! input
5706 {{int:youhavenewmessages|lots of money|not!}}
5707 !! result
5708 <p>You have lots of money (not!).
5709 </p>
5710 !! end
5711
5712 !! article
5713 Template:Includes
5714 !! text
5715 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5716 !! endarticle
5717
5718 !! test
5719 <includeonly> and <noinclude> being included
5720 !! input
5721 {{Includes}}
5722 !! result
5723 <p>Foobar
5724 </p>
5725 !! end
5726
5727 !! article
5728 Template:Includes2
5729 !! text
5730 <onlyinclude>Foo</onlyinclude>bar
5731 !! endarticle
5732
5733 !! test
5734 <onlyinclude> being included
5735 !! input
5736 {{Includes2}}
5737 !! result
5738 <p>Foo
5739 </p>
5740 !! end
5741
5742
5743 !! article
5744 Template:Includes3
5745 !! text
5746 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
5747 !! endarticle
5748
5749 !! test
5750 <onlyinclude> and <includeonly> being included
5751 !! input
5752 {{Includes3}}
5753 !! result
5754 <p>Foo
5755 </p>
5756 !! end
5757
5758 !! test
5759 <includeonly> and <noinclude> on a page
5760 !! input
5761 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5762 !! result
5763 <p>Foozar
5764 </p>
5765 !! end
5766
5767 !! test
5768 Un-closed <noinclude>
5769 !! input
5770 <noinclude>
5771 !! result
5772 !! end
5773
5774 !! test
5775 <onlyinclude> on a page
5776 !! input
5777 <onlyinclude>Foo</onlyinclude>bar
5778 !! result
5779 <p>Foobar
5780 </p>
5781 !! end
5782
5783 !! test
5784 Un-closed <onlyinclude>
5785 !! input
5786 <onlyinclude>
5787 !! result
5788 !! end
5789
5790 !!test
5791 Self-closed noinclude, includeonly, onlyinclude tags
5792 !!input
5793 <noinclude />
5794 <includeonly />
5795 <onlyinclude />
5796 !!result
5797 <p><br />
5798 </p>
5799 !!end
5800
5801 !!test
5802 Unbalanced includeonly and noinclude tags
5803 !!input
5804 {|
5805 |a</noinclude>
5806 |b</noinclude></noinclude>
5807 |c</noinclude></includeonly>
5808 |d</includeonly></includeonly>
5809 |}
5810 !!result
5811 <table>
5812 <tr>
5813 <td>a
5814 </td>
5815 <td>b
5816 </td>
5817 <td>c&lt;/includeonly&gt;
5818 </td>
5819 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
5820 </td></tr></table>
5821
5822 !!end
5823
5824 !! article
5825 Template:Includeonly section
5826 !! text
5827 <includeonly>
5828 ==Includeonly section==
5829 </includeonly>
5830 ==Section T-1==
5831 !!endarticle
5832
5833 !! test
5834 Bug 6563: Edit link generation for section shown by <includeonly>
5835 !! input
5836 {{includeonly section}}
5837 !! result
5838 <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>
5839 <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>
5840
5841 !! end
5842
5843 # Uses same input as the contents of [[Template:Includeonly section]]
5844 !! test
5845 Bug 6563: Section extraction for section shown by <includeonly>
5846 !! options
5847 section=T-2
5848 !! input
5849 <includeonly>
5850 ==Includeonly section==
5851 </includeonly>
5852 ==Section T-2==
5853 !! result
5854 ==Section T-2==
5855 !! end
5856
5857 !! test
5858 Bug 6563: Edit link generation for section suppressed by <includeonly>
5859 !! input
5860 <includeonly>
5861 ==Includeonly section==
5862 </includeonly>
5863 ==Section 1==
5864 !! result
5865 <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>
5866
5867 !! end
5868
5869 !! test
5870 Bug 6563: Section extraction for section suppressed by <includeonly>
5871 !! options
5872 section=1
5873 !! input
5874 <includeonly>
5875 ==Includeonly section==
5876 </includeonly>
5877 ==Section 1==
5878 !! result
5879 ==Section 1==
5880 !! end
5881
5882 !! test
5883 Un-closed <includeonly>
5884 !! input
5885 <includeonly>
5886 !! result
5887 !! end
5888
5889 ###
5890 ### <includeonly> and <noinclude> in attributes
5891 ###
5892 !!test
5893 0. includeonly around the entire attribute
5894 !!input
5895 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
5896 !!result
5897 <p><span id="v2">bar</span>
5898 </p>
5899 !!end
5900
5901 !!test
5902 1. includeonly in html attr key
5903 !!input
5904 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
5905 !!result
5906 <p><span id="foo">bar</span>
5907 </p>
5908 !!end
5909
5910 !!test
5911 2. includeonly in html attr value
5912 !!input
5913 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
5914 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
5915 !!result
5916 <p><span id="v1">bar</span>
5917 <span id="v1">bar</span>
5918 </p>
5919 !!end
5920
5921 !!test
5922 3. includeonly in part of an attr value
5923 !!input
5924 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
5925 !!result
5926 <p><span style="color:red;">bar</span>
5927 </p>
5928 !!end
5929
5930 ###
5931 ### Testing parsing of templates where a template arg
5932 ### has the same name as the template itself.
5933 ###
5934
5935 !! article
5936 Template:quote
5937 !! text
5938 {{{quote|{{{1}}}}}}
5939 !! endarticle
5940
5941 !!test
5942 Templates: Template Name/Arg clash: 1. Use of positional param
5943 !!input
5944 {{quote|foo}}
5945 !!result
5946 <p>foo
5947 </p>
5948 !!end
5949
5950 !!test
5951 Templates: Template Name/Arg clash: 2. Use of named param
5952 !!input
5953 {{quote|quote=foo}}
5954 !!result
5955 <p>foo
5956 </p>
5957 !!end
5958
5959 !!test
5960 Templates: Template Name/Arg clash: 3. Use of named param with empty input
5961 !!input
5962 {{quote|quote}}
5963 !!result
5964 <p>quote
5965 </p>
5966 !!end
5967
5968 ###
5969 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
5970 ###
5971
5972 !!test
5973 Templates: 1. Simple use
5974 !!input
5975 {{echo|Foo}}
5976 !!result
5977 <p>Foo
5978 </p>
5979 !!end
5980
5981 !!test
5982 Templates: 2. Inside a block tag
5983 !!input
5984 <div>{{echo|Foo}}</div>
5985 !!result
5986 <div>Foo</div>
5987
5988 !!end
5989
5990 !!test
5991 Templates: P-wrapping: 1a. Templates on consecutive lines
5992 !!input
5993 {{echo|Foo}}
5994 {{echo|bar}}
5995 !!result
5996 <p>Foo
5997 bar
5998 </p>
5999 !!end
6000
6001 !!test
6002 Templates: P-wrapping: 1b. Templates on consecutive lines
6003 !!input
6004 Foo
6005
6006 {{echo|bar}}
6007 {{echo|baz}}
6008 !!result
6009 <p>Foo
6010 </p><p>bar
6011 baz
6012 </p>
6013 !!end
6014
6015 !!test
6016 Templates: P-wrapping: 1c. Templates on consecutive lines
6017 !!input
6018 {{echo|Foo}}
6019 {{echo|bar}} <div>baz</div>
6020 !!result
6021 <p>Foo
6022 </p>
6023 bar <div>baz</div>
6024
6025 !!end
6026
6027 !!test
6028 Templates: Inline Text: 1. Multiple tmeplate uses
6029 !!input
6030 {{echo|Foo}}bar{{echo|baz}}
6031 !!result
6032 <p>Foobarbaz
6033 </p>
6034 !!end
6035
6036 !!test
6037 Templates: Inline Text: 2. Back-to-back template uses
6038 !!input
6039 {{echo|Foo}}{{echo|bar}}
6040 !!result
6041 <p>Foobar
6042 </p>
6043 !!end
6044
6045 !!test
6046 Templates: Block Tags: 1. Multiple template uses
6047 !!input
6048 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
6049 !!result
6050 <div>Foo</div><div>bar</div><div>baz</div>
6051
6052 !!end
6053
6054 !!test
6055 Templates: Block Tags: 2. Back-to-back template uses
6056 !!input
6057 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
6058 !!result
6059 <div>Foo</div><div>bar</div>
6060
6061 !!end
6062
6063 !!test
6064 Templates: Links: 1. Simple example
6065 !!input
6066 {{echo|[[Foo|bar]]}}
6067 !!result
6068 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6069 </p>
6070 !!end
6071
6072 !!test
6073 Templates: Links: 2. Generation of link href
6074 !!input
6075 [[{{echo|Foo}}|bar]]
6076 !!result
6077 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6078 </p>
6079 !!end
6080
6081 !!test
6082 Templates: Links: 3. Generation of part of a link href
6083 !!input
6084 [[Fo{{echo|o}}|bar]]
6085
6086 [[Foo{{echo|bar}}]]
6087
6088 [[Foo{{echo|bar}}baz]]
6089
6090 [[Foo{{echo|bar}}|bar]]
6091
6092 [[:Foo{{echo|bar}}]]
6093
6094 [[:Foo{{echo|bar}}|bar]]
6095 !!result
6096 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6097 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6098 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
6099 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6100 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6101 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6102 </p>
6103 !!end
6104
6105 !!test
6106 Templates: Links: 4. Multiple templates generating link href
6107 !!input
6108 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
6109 !!result
6110 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6111 </p>
6112 !!end
6113
6114 !!test
6115 Templates: Links: 5. Generation of link text
6116 !!input
6117 [[Foo|{{echo|bar}}]]
6118 !!result
6119 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6120 </p>
6121 !!end
6122
6123 !!test
6124 Templates: Links: 5. Nested templates (only outermost template should be marked)
6125 !!input
6126 {{echo|[[{{echo|Foo}}|bar]]}}
6127 !!result
6128 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6129 </p>
6130 !!end
6131
6132 !!test
6133 Templates: HTML Tag: 1. Generation of HTML attr. key
6134 !!input
6135 <div {{echo|style}}="color:red;">foo</div>
6136 !!result
6137 <div style="color:red;">foo</div>
6138
6139 !!end
6140
6141 !!test
6142 Templates: HTML Tag: 2. Generation of HTML attr. value
6143 !!input
6144 <div style={{echo|'color:red;'}}>foo</div>
6145 !!result
6146 <div style="color:red;">foo</div>
6147
6148 !!end
6149
6150 !!test
6151 Templates: HTML Tag: 3. Generation of HTML attr key and value
6152 !!input
6153 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
6154 !!result
6155 <div style="color:red;">foo</div>
6156
6157 !!end
6158
6159 !!test
6160 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
6161 !!input
6162 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
6163 !!result
6164 <div title="This is a long title with just one piece templated">foo</div>
6165
6166 !!end
6167
6168 !!test
6169 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
6170 !!input
6171 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
6172 !!result
6173 <div title="This is a long title with just one piece templated">foo</div>
6174
6175 !!end
6176
6177 !!test
6178 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
6179 !!input
6180 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
6181 !!result
6182 <div title="This is a long title with just one piece templated">foo</div>
6183
6184 !!end
6185
6186 !!test
6187 Templates: HTML Tag: 7. Generation of partial attribute key string
6188 !!input
6189 <div st{{echo|yle}}="color:red;">foo</div>
6190 !!result
6191 <div style="color:red;">foo</div>
6192
6193 !!end
6194
6195 !!test
6196 Templates: HTML Tables: 1. Generating start of a HTML table
6197 !!input
6198 {{echo|<table><tr><td>foo</td>}}</tr></table>
6199 !!result
6200 <table><tr><td>foo</td></tr></table>
6201
6202 !!end
6203
6204 !!test
6205 Templates: HTML Tables: 2a. Generating middle of a HTML table
6206 !!input
6207 <table><tr>{{echo|<td>foo</td>}}</tr></table>
6208 !!result
6209 <table><tr><td>foo</td></tr></table>
6210
6211 !!end
6212
6213 !!test
6214 Templates: HTML Tables: 2b. Generating middle of a HTML table
6215 !!input
6216 <table>{{echo|<tr><td>foo</td></tr>}}</table>
6217 !!result
6218 <table><tr><td>foo</td></tr></table>
6219
6220 !!end
6221
6222 !!test
6223 Templates: HTML Tables: 3. Generating end of a HTML table
6224 !!input
6225 <table><tr>{{echo|<td>foo</td></tr></table>}}
6226 !!result
6227 <table><tr><td>foo</td></tr></table>
6228
6229 !!end
6230
6231 !!test
6232 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
6233 !!input
6234 {{echo|<table>}}<tr><td>foo</td></tr></table>
6235 !!result
6236 <table><tr><td>foo</td></tr></table>
6237
6238 !!end
6239
6240 !!test
6241 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
6242 !!input
6243 <table>{{echo|<tr>}}<td>foo</td></tr></table>
6244 !!result
6245 <table><tr><td>foo</td></tr></table>
6246
6247 !!end
6248
6249 !!test
6250 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
6251 !!input
6252 <table><tr>{{echo|<td>}}foo</td></tr></table>
6253 !!result
6254 <table><tr><td>foo</td></tr></table>
6255
6256 !!end
6257
6258 !!test
6259 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
6260 !!input
6261 <table><tr><td>foo{{echo|</td>}}</tr></table>
6262 !!result
6263 <table><tr><td>foo</td></tr></table>
6264
6265 !!end
6266
6267 !!test
6268 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
6269 !!input
6270 <table><tr><td>foo</td>{{echo|</tr>}}</table>
6271 !!result
6272 <table><tr><td>foo</td></tr></table>
6273
6274 !!end
6275
6276 !!test
6277 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
6278 !!input
6279 <table><tr><td>foo</td></tr>{{echo|</table>}}
6280 !!result
6281 <table><tr><td>foo</td></tr></table>
6282
6283 !!end
6284
6285 !!test
6286 Templates: Wiki Tables: 1a. Fostering of entire template content
6287 !!input
6288 {|
6289 {{echo|a}}
6290 |}
6291 !!result
6292 <table>
6293 a
6294 <tr><td></td></tr></table>
6295
6296 !!end
6297
6298 !!test
6299 Templates: Wiki Tables: 1b. Fostering of entire template content
6300 !!input
6301 {|
6302 {{echo|<div>}}
6303 foo
6304 {{echo|</div>}}
6305 |}
6306 !!result
6307 <table>
6308 <div>
6309 <p>foo
6310 </p>
6311 </div>
6312 <tr><td></td></tr></table>
6313
6314 !!end
6315
6316 !!test
6317 Templates: Wiki Tables: 2. Fostering of partial template content
6318 !!input
6319 {|
6320 {{echo|a
6321 <div>b</div>}}
6322 |}
6323 !!result
6324 <table>
6325 a
6326 <div>b</div>
6327 <tr><td></td></tr></table>
6328
6329 !!end
6330
6331 !!test
6332 Templates: Wiki Tables: 3. td-content via multiple templates
6333 !!input
6334 {|
6335 {{echo|{{pipe}}a}}{{echo|b}}
6336 |}
6337 !!result
6338 <table>
6339 <tr>
6340 <td>ab
6341 </td></tr></table>
6342
6343 !!end
6344
6345 !!test
6346 Templates: Wiki Tables: 4. Templated tags, no content
6347 !!input
6348 {{tbl-start}}
6349 {{tbl-end}}
6350 !!result
6351 <table>
6352 <tr><td></td></tr></table>
6353
6354 !!end
6355
6356 !!test
6357 Templates: Wiki Tables: 5. Templated tags, regular td-tags
6358 !!input
6359 {{tbl-start}}
6360 |foo
6361 {{tbl-end}}
6362 !!result
6363 <table>
6364 <tr>
6365 <td>foo
6366 </td></tr></table>
6367
6368 !!end
6369
6370 !!test
6371 Templates: Wiki Tables: 6. Templated tags, templated td-tags
6372 !!input
6373 {{tbl-start}}
6374 {{!}}foo
6375 {{tbl-end}}
6376 !!result
6377 <table>
6378 <tr>
6379 <td>foo
6380 </td></tr></table>
6381
6382 !!end
6383
6384 !!test
6385 Templates: Lists: Multi-line list-items via templates
6386 !!input
6387 *{{echo|a {{nonexistent|
6388 unused}}}}
6389 *{{echo|b {{nonexistent|
6390 unused}}}}
6391 !!result
6392 <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>
6393 </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>
6394 </li></ul>
6395
6396 !!end
6397
6398 !!test
6399 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
6400 !!input
6401 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
6402 !!result
6403 <p><i>ab</i>c<i>d</i>e
6404 </p>
6405 !!end
6406
6407 !!test
6408 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
6409 (PHP parser generates misnested html)
6410 !! options
6411 disabled
6412 !!input
6413 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
6414 !!result
6415 <p><span><i>a</i></span><i><span>b</span></i><span>c</span><i>d</i><span>e</span></p>
6416 !!end
6417
6418 !!test
6419 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
6420 (PHP parser generates misnested html)
6421 !! options
6422 disabled
6423 !!input
6424 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
6425 !!result
6426 <div><i>a</i></div>
6427 <div><i>b</i>c<i>d</i></div>
6428 <div>e</div>
6429 !!end
6430
6431 !!test
6432 Templates: Ugly nesting: 4. Divs opened/closed across templates
6433 !!input
6434 a<div>b{{echo|c</div>d}}e
6435 !!result
6436 a<div>bc</div>de
6437
6438 !!end
6439
6440 !!test
6441 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
6442 (Parsoid-centric)
6443 !! options
6444 parsoid
6445 !!input
6446 {|
6447 |{{echo|foo</table>}}
6448 |bar
6449 |}
6450 !!result
6451 <table about="#mwt1" typeof="mw:Object/Template ">
6452 <tbody><tr><td>foo</td></tr></tbody></table><span about="#mwt1">
6453 bar</span><span about="#mwt1">
6454 </span>
6455 !!end
6456
6457 !!test
6458 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
6459 (Parsoid-centric)
6460 !! options
6461 parsoid
6462 !!input
6463 <table>
6464 <tr>
6465 <td>
6466 <table>
6467 <tr>
6468 <td>1. {{echo|foo </table>}}</td>
6469 <td> bar </td>
6470 <td>2. {{echo|baz </table>}}</td>
6471 </tr>
6472 <tr>
6473 <td>abc</td>
6474 </tr>
6475 </table>
6476 </td>
6477 </tr>
6478 <tr>
6479 <td>xyz</td>
6480 </tr>
6481 </table>
6482 !!result
6483 <table about="#mwt1" typeof="mw:Object/Template">
6484 <tbody><tr >
6485 <td >
6486 <table >
6487 <tbody><tr >
6488 <td >1. foo </td></tr></tbody></table></td>
6489 <td > bar </td>
6490 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
6491 </span><span about="#mwt1">
6492
6493 abc</span><span about="#mwt1">
6494 </span><span about="#mwt1">
6495 </span><span about="#mwt1">
6496 </span><span about="#mwt1">
6497 </span><span about="#mwt1">
6498
6499 xyz</span><span about="#mwt1">
6500 </span><span about="#mwt1">
6501 </span>
6502 !!end
6503
6504 !! test
6505 Templates: Ugly templates: 3. newline-only template parameter
6506 !! input
6507 foo {{echo|
6508 }}
6509 !! result
6510 <p>foo
6511 </p>
6512 !! end
6513
6514 # This looks like a bug: a single newline triggers p/br for some reason.
6515 !! test
6516 Templates: Ugly templates: 4. newline-only template parameter inconsistency
6517 !! input
6518 {{echo|
6519 }}
6520 !! result
6521 <p><br />
6522 </p>
6523 !! end
6524
6525
6526 !!test
6527 Parser Functions: 1. Simple example
6528 !!input
6529 {{uc:foo}}
6530 !!result
6531 <p>FOO
6532 </p>
6533 !!end
6534
6535 !!test
6536 Parser Functions: 2. Nested use (only outermost should be marked up)
6537 !!input
6538 {{uc:{{lc:FOO}}}}
6539 !!result
6540 <p>FOO
6541 </p>
6542 !!end
6543
6544 ###
6545 ### Pre-save transform tests
6546 ###
6547 !! test
6548 pre-save transform: subst:
6549 !! options
6550 PST
6551 !! input
6552 {{subst:test}}
6553 !! result
6554 This is a test template
6555 !! end
6556
6557 !! test
6558 pre-save transform: normal template
6559 !! options
6560 PST
6561 !! input
6562 {{test}}
6563 !! result
6564 {{test}}
6565 !! end
6566
6567 !! test
6568 pre-save transform: nonexistent template
6569 !! options
6570 PST
6571 !! input
6572 {{thistemplatedoesnotexist}}
6573 !! result
6574 {{thistemplatedoesnotexist}}
6575 !! end
6576
6577
6578 !! test
6579 pre-save transform: subst magic variables
6580 !! options
6581 PST
6582 !! input
6583 {{subst:SITENAME}}
6584 !! result
6585 MediaWiki
6586 !! end
6587
6588 # This is bug 89, which I fixed. -- wtm
6589 !! test
6590 pre-save transform: subst: templates with parameters
6591 !! options
6592 pst
6593 !! input
6594 {{subst:paramtest|param="something else"}}
6595 !! result
6596 This is a test template with parameter "something else"
6597 !! end
6598
6599 !! article
6600 Template:nowikitest
6601 !! text
6602 <nowiki>'''not wiki'''</nowiki>
6603 !! endarticle
6604
6605 !! test
6606 pre-save transform: nowiki in subst (bug 1188)
6607 !! options
6608 pst
6609 !! input
6610 {{subst:nowikitest}}
6611 !! result
6612 <nowiki>'''not wiki'''</nowiki>
6613 !! end
6614
6615
6616 !! article
6617 Template:commenttest
6618 !! text
6619 This template has <!-- a comment --> in it.
6620 !! endarticle
6621
6622 !! test
6623 pre-save transform: comment in subst (bug 1936)
6624 !! options
6625 pst
6626 !! input
6627 {{subst:commenttest}}
6628 !! result
6629 This template has <!-- a comment --> in it.
6630 !! end
6631
6632 !! test
6633 pre-save transform: unclosed tag
6634 !! options
6635 pst noxml
6636 !! input
6637 <nowiki>'''not wiki'''
6638 !! result
6639 <nowiki>'''not wiki'''
6640 !! end
6641
6642 !! test
6643 pre-save transform: mixed tag case
6644 !! options
6645 pst noxml
6646 !! input
6647 <NOwiki>'''not wiki'''</noWIKI>
6648 !! result
6649 <NOwiki>'''not wiki'''</noWIKI>
6650 !! end
6651
6652 !! test
6653 pre-save transform: unclosed comment in <nowiki>
6654 !! options
6655 pst noxml
6656 !! input
6657 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6658 !! result
6659 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6660 !!end
6661
6662 !! article
6663 Template:dangerous
6664 !!text
6665 <span onmouseover="alert('crap')">Oh no</span>
6666 !!endarticle
6667
6668 !!test
6669 (confirming safety of fix for subst bug 1936)
6670 !! input
6671 {{Template:dangerous}}
6672 !! result
6673 <p><span>Oh no</span>
6674 </p>
6675 !! end
6676
6677 !! test
6678 pre-save transform: comment containing gallery (bug 5024)
6679 !! options
6680 pst
6681 !! input
6682 <!-- <gallery>data</gallery> -->
6683 !!result
6684 <!-- <gallery>data</gallery> -->
6685 !!end
6686
6687 !! test
6688 pre-save transform: comment containing extension
6689 !! options
6690 pst
6691 !! input
6692 <!-- <tag>data</tag> -->
6693 !!result
6694 <!-- <tag>data</tag> -->
6695 !!end
6696
6697 !! test
6698 pre-save transform: comment containing nowiki
6699 !! options
6700 pst
6701 !! input
6702 <!-- <nowiki>data</nowiki> -->
6703 !!result
6704 <!-- <nowiki>data</nowiki> -->
6705 !!end
6706
6707 !! test
6708 pre-save transform: <noinclude> in subst (bug 3298)
6709 !! options
6710 pst
6711 !! input
6712 {{subst:Includes}}
6713 !! result
6714 Foobar
6715 !! end
6716
6717 !! test
6718 pre-save transform: <onlyinclude> in subst (bug 3298)
6719 !! options
6720 pst
6721 !! input
6722 {{subst:Includes2}}
6723 !! result
6724 Foo
6725 !! end
6726
6727 !! article
6728 Template:SubstTest
6729 !!text
6730 {{<includeonly>subst:</includeonly>Includes}}
6731 !! endarticle
6732
6733 !! article
6734 Template:SafeSubstTest
6735 !! text
6736 {{<includeonly>safesubst:</includeonly>Includes}}
6737 !! endarticle
6738
6739 !! test
6740 bug 22297: safesubst: works during PST
6741 !! options
6742 pst
6743 !! input
6744 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
6745 !! result
6746 FoobarFoobar
6747 !! end
6748
6749 !! test
6750 bug 22297: safesubst: works during normal parse
6751 !! input
6752 {{SafeSubstTest}}
6753 !! result
6754 <p>Foobar
6755 </p>
6756 !! end
6757
6758 !! test:
6759 subst: does not work during normal parse
6760 !! input
6761 {{SubstTest}}
6762 !! result
6763 <p>{{subst:Includes}}
6764 </p>
6765 !! end
6766
6767 !! test
6768 pre-save transform: context links ("pipe trick")
6769 !! options
6770 pst
6771 !! input
6772 [[Article (context)|]]
6773 [[Bar:Article|]]
6774 [[:Bar:Article|]]
6775 [[Bar:Article (context)|]]
6776 [[:Bar:Article (context)|]]
6777 [[|Article]]
6778 [[|Article (context)]]
6779 [[Bar:X (Y) Z|]]
6780 [[:Bar:X (Y) Z|]]
6781 !! result
6782 [[Article (context)|Article]]
6783 [[Bar:Article|Article]]
6784 [[:Bar:Article|Article]]
6785 [[Bar:Article (context)|Article]]
6786 [[:Bar:Article (context)|Article]]
6787 [[Article]]
6788 [[Article (context)]]
6789 [[Bar:X (Y) Z|X (Y) Z]]
6790 [[:Bar:X (Y) Z|X (Y) Z]]
6791 !! end
6792
6793 !! test
6794 pre-save transform: context links ("pipe trick") with interwiki prefix
6795 !! options
6796 pst
6797 !! input
6798 [[interwiki:Article|]]
6799 [[:interwiki:Article|]]
6800 [[interwiki:Bar:Article|]]
6801 [[:interwiki:Bar:Article|]]
6802 !! result
6803 [[interwiki:Article|Article]]
6804 [[:interwiki:Article|Article]]
6805 [[interwiki:Bar:Article|Bar:Article]]
6806 [[:interwiki:Bar:Article|Bar:Article]]
6807 !! end
6808
6809 !! test
6810 pre-save transform: context links ("pipe trick") with parens in title
6811 !! options
6812 pst title=[[Somearticle (context)]]
6813 !! input
6814 [[|Article]]
6815 !! result
6816 [[Article (context)|Article]]
6817 !! end
6818
6819 !! test
6820 pre-save transform: context links ("pipe trick") with comma in title
6821 !! options
6822 pst title=[[Someplace, Somewhere]]
6823 !! input
6824 [[|Otherplace]]
6825 [[Otherplace, Elsewhere|]]
6826 [[Otherplace, Elsewhere, Anywhere|]]
6827 !! result
6828 [[Otherplace, Somewhere|Otherplace]]
6829 [[Otherplace, Elsewhere|Otherplace]]
6830 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
6831 !! end
6832
6833 !! test
6834 pre-save transform: context links ("pipe trick") with parens and comma
6835 !! options
6836 pst title=[[Someplace (IGNORED), Somewhere]]
6837 !! input
6838 [[|Otherplace]]
6839 [[Otherplace (place), Elsewhere|]]
6840 !! result
6841 [[Otherplace, Somewhere|Otherplace]]
6842 [[Otherplace (place), Elsewhere|Otherplace]]
6843 !! end
6844
6845 !! test
6846 pre-save transform: context links ("pipe trick") with comma and parens
6847 !! options
6848 pst title=[[Who, me? (context)]]
6849 !! input
6850 [[|Yes, you.]]
6851 [[Me, Myself, and I (1937 song)|]]
6852 !! result
6853 [[Yes, you. (context)|Yes, you.]]
6854 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
6855 !! end
6856
6857 !! test
6858 pre-save transform: context links ("pipe trick") with namespace
6859 !! options
6860 pst title=[[Ns:Somearticle]]
6861 !! input
6862 [[|Article]]
6863 !! result
6864 [[Ns:Article|Article]]
6865 !! end
6866
6867 !! test
6868 pre-save transform: context links ("pipe trick") with namespace and parens
6869 !! options
6870 pst title=[[Ns:Somearticle (context)]]
6871 !! input
6872 [[|Article]]
6873 !! result
6874 [[Ns:Article (context)|Article]]
6875 !! end
6876
6877 !! test
6878 pre-save transform: context links ("pipe trick") with namespace and comma
6879 !! options
6880 pst title=[[Ns:Somearticle, Context, Whatever]]
6881 !! input
6882 [[|Article]]
6883 !! result
6884 [[Ns:Article, Context, Whatever|Article]]
6885 !! end
6886
6887 !! test
6888 pre-save transform: context links ("pipe trick") with namespace, comma and parens
6889 !! options
6890 pst title=[[Ns:Somearticle, Context (context)]]
6891 !! input
6892 [[|Article]]
6893 !! result
6894 [[Ns:Article (context)|Article]]
6895 !! end
6896
6897 !! test
6898 pre-save transform: context links ("pipe trick") with namespace, parens and comma
6899 !! options
6900 pst title=[[Ns:Somearticle (IGNORED), Context]]
6901 !! input
6902 [[|Article]]
6903 !! result
6904 [[Ns:Article, Context|Article]]
6905 !! end
6906
6907 !! test
6908 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
6909 !! options
6910 pst
6911 !! input
6912 [[Article(context)|]]
6913 [[Bar:Article(context)|]]
6914 [[:Bar:Article(context)|]]
6915 [[|Article(context)]]
6916 [[Bar:X(Y)Z|]]
6917 [[:Bar:X(Y)Z|]]
6918 !! result
6919 [[Article(context)|Article]]
6920 [[Bar:Article(context)|Article]]
6921 [[:Bar:Article(context)|Article]]
6922 [[Article(context)]]
6923 [[Bar:X(Y)Z|X(Y)Z]]
6924 [[:Bar:X(Y)Z|X(Y)Z]]
6925 !! end
6926
6927 !! test
6928 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
6929 !! options
6930 pst
6931 !! input
6932 [[Article (context)|]]
6933 [[Bar:Article (context)|]]
6934 [[:Bar:Article (context)|]]
6935 [[|Article (context)]]
6936 [[Bar:X (Y) Z|]]
6937 [[:Bar:X (Y) Z|]]
6938 !! result
6939 [[Article (context)|Article]]
6940 [[Bar:Article (context)|Article]]
6941 [[:Bar:Article (context)|Article]]
6942 [[Article (context)]]
6943 [[Bar:X (Y) Z|X (Y) Z]]
6944 [[:Bar:X (Y) Z|X (Y) Z]]
6945 !! end
6946
6947 !! test
6948 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
6949 !! options
6950 pst
6951 !! input
6952 [[Article(context)|]]
6953 [[Bar:Article(context)|]]
6954 [[:Bar:Article(context)|]]
6955 [[|Article(context)]]
6956 [[Bar:X(Y)Z|]]
6957 [[:Bar:X(Y)Z|]]
6958 !! result
6959 [[Article(context)|Article]]
6960 [[Bar:Article(context)|Article]]
6961 [[:Bar:Article(context)|Article]]
6962 [[Article(context)]]
6963 [[Bar:X(Y)Z|X(Y)Z]]
6964 [[:Bar:X(Y)Z|X(Y)Z]]
6965 !! end
6966
6967 !! test
6968 pre-save transform: context links ("pipe trick") with commas (bug 21660)
6969 !! options
6970 pst
6971 !! input
6972 [[Article (context), context|]]
6973 [[Article (context),context|]]
6974 [[Bar:Article (context), context|]]
6975 [[Bar:Article (context),context|]]
6976 [[:Bar:Article (context), context|]]
6977 [[:Bar:Article (context),context|]]
6978 !! result
6979 [[Article (context), context|Article]]
6980 [[Article (context),context|Article]]
6981 [[Bar:Article (context), context|Article]]
6982 [[Bar:Article (context),context|Article]]
6983 [[:Bar:Article (context), context|Article]]
6984 [[:Bar:Article (context),context|Article]]
6985 !! end
6986
6987 !! test
6988 pre-save transform: trim trailing empty lines
6989 !! options
6990 pst
6991 !! input
6992 Empty lines are trimmed
6993
6994
6995
6996
6997 !! result
6998 Empty lines are trimmed
6999 !! end
7000
7001 !! test
7002 pre-save transform: Signature expansion
7003 !! options
7004 pst
7005 !! input
7006 * ~~~
7007 * <noinclude>~~~</noinclude>
7008 * <includeonly>~~~</includeonly>
7009 * <onlyinclude>~~~</onlyinclude>
7010 !! result
7011 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
7012 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
7013 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
7014 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
7015 !! end
7016
7017
7018 !! test
7019 pre-save transform: Signature expansion in nowiki tags (bug 93)
7020 !! options
7021 pst disabled
7022 !! input
7023 Shall not expand:
7024
7025 <nowiki>~~~~</nowiki>
7026
7027 <includeonly><nowiki>~~~~</nowiki></includeonly>
7028
7029 <noinclude><nowiki>~~~~</nowiki></noinclude>
7030
7031 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7032
7033 {{subst:Foo}} shall be converted to FOO
7034
7035 As well as inside noinclude/onlyinclude
7036 <noinclude>{{subst:Foo}}</noinclude>
7037 <onlyinclude>{{subst:Foo}}</onlyinclude>
7038
7039 But not inside includeonly
7040 <includeonly>{{subst:Foo}}</includeonly>
7041 !! result
7042 Shall not expand:
7043
7044 <nowiki>~~~~</nowiki>
7045
7046 <includeonly><nowiki>~~~~</nowiki></includeonly>
7047
7048 <noinclude><nowiki>~~~~</nowiki></noinclude>
7049
7050 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7051
7052 FOO shall be converted to FOO
7053
7054 As well as inside noinclude/onlyinclude
7055 <noinclude>FOO</noinclude>
7056 <onlyinclude>FOO</onlyinclude>
7057
7058 But not inside includeonly
7059 <includeonly>{{subst:Foo}}</includeonly>
7060 !! end
7061
7062 ###
7063 ### Message transform tests
7064 ###
7065 !! test
7066 message transform: magic variables
7067 !! options
7068 msg
7069 !! input
7070 {{SITENAME}}
7071 !! result
7072 MediaWiki
7073 !! end
7074
7075 !! test
7076 message transform: should not transform wiki markup
7077 !! options
7078 msg
7079 !! input
7080 ''test''
7081 !! result
7082 ''test''
7083 !! end
7084
7085 !! test
7086 message transform: <noinclude> in transcluded template (bug 4926)
7087 !! options
7088 msg
7089 !! input
7090 {{Includes}}
7091 !! result
7092 Foobar
7093 !! end
7094
7095 !! test
7096 message transform: <onlyinclude> in transcluded template (bug 4926)
7097 !! options
7098 msg
7099 !! input
7100 {{Includes2}}
7101 !! result
7102 Foo
7103 !! end
7104
7105 !! test
7106 {{#special:}} page name, known
7107 !! options
7108 msg
7109 !! input
7110 {{#special:Recentchanges}}
7111 !! result
7112 Special:RecentChanges
7113 !! end
7114
7115 !! test
7116 {{#special:}} page name with subpage, known
7117 !! options
7118 msg
7119 !! input
7120 {{#special:Recentchanges/param}}
7121 !! result
7122 Special:RecentChanges/param
7123 !! end
7124
7125 !! test
7126 {{#special:}} page name, unknown
7127 !! options
7128 msg
7129 !! input
7130 {{#special:foobarnonexistent}}
7131 !! result
7132 No such special page
7133 !! end
7134
7135 !! test
7136 {{#speciale:}} page name, known
7137 !! options
7138 msg
7139 !! input
7140 {{#speciale:Recentchanges}}
7141 !! result
7142 Special:RecentChanges
7143 !! end
7144
7145 !! test
7146 {{#speciale:}} page name with subpage, known
7147 !! options
7148 msg
7149 !! input
7150 {{#speciale:Recentchanges/param}}
7151 !! result
7152 Special:RecentChanges/param
7153 !! end
7154
7155 !! test
7156 {{#speciale:}} page name, unknown
7157 !! options
7158 msg
7159 !! input
7160 {{#speciale:foobarnonexistent}}
7161 !! result
7162 No_such_special_page
7163 !! end
7164
7165 ###
7166 ### Images
7167 ###
7168 !! test
7169 Simple image
7170 !! input
7171 [[Image:foobar.jpg]]
7172 !! result
7173 <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>
7174 </p>
7175 !! end
7176
7177 !! test
7178 Right-aligned image
7179 !! input
7180 [[Image:foobar.jpg|right]]
7181 !! result
7182 <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>
7183
7184 !! end
7185
7186 !! test
7187 Simple image (using File: namespace, now canonical)
7188 !! input
7189 [[File:foobar.jpg]]
7190 !! result
7191 <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>
7192 </p>
7193 !! end
7194
7195 !! test
7196 Image with caption
7197 !! input
7198 [[Image:foobar.jpg|right|Caption text]]
7199 !! result
7200 <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>
7201
7202 !! end
7203
7204 !! test
7205 Image with empty attribute
7206 !! input
7207 [[Image:foobar.jpg|right||Caption text]]
7208 !! result
7209 <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>
7210
7211 !! end
7212
7213 !! test
7214 Image with link tails
7215 !! input
7216 123[[Image:foobar.jpg]]456
7217 123[[Image:foobar.jpg|right]]456
7218 123[[Image:foobar.jpg|thumb]]456
7219 !! result
7220 <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
7221 </p>
7222 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
7223 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
7224
7225 !! end
7226
7227 !! test
7228 Image with multiple captions -- only last one is accepted
7229 !! input
7230 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
7231 !! result
7232 <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>
7233
7234 !! end
7235
7236 !! test
7237 Image with width attribute at different positions
7238 !! input
7239 [[Image:foobar.jpg|200px|right|Caption]]
7240 [[Image:foobar.jpg|right|200px|Caption]]
7241 [[Image:foobar.jpg|right|Caption|200px]]
7242 !! result
7243 <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>
7244 <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>
7245 <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>
7246
7247 !! end
7248
7249 !! test
7250 Image with link parameter, wiki target
7251 !! input
7252 [[Image:foobar.jpg|link=Target page]]
7253 !! result
7254 <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>
7255 </p>
7256 !! end
7257
7258 !! test
7259 Image with link parameter, URL target
7260 !! input
7261 [[Image:foobar.jpg|link=http://example.com/]]
7262 !! result
7263 <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>
7264 </p>
7265 !! end
7266
7267 !! test
7268 Image with link parameter, wgExternalLinkTarget
7269 !! input
7270 [[Image:foobar.jpg|link=http://example.com/]]
7271 !! config
7272 wgExternalLinkTarget='foobar'
7273 !! result
7274 <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>
7275 </p>
7276 !! end
7277
7278 !! test
7279 Image with link parameter, wgNoFollowLinks set to false
7280 !! input
7281 [[Image:foobar.jpg|link=http://example.com/]]
7282 !! config
7283 wgNoFollowLinks=false
7284 !! result
7285 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7286 </p>
7287 !! end
7288
7289 !! test
7290 Image with link parameter, wgNoFollowDomainExceptions
7291 !! input
7292 [[Image:foobar.jpg|link=http://example.com/]]
7293 !! config
7294 wgNoFollowDomainExceptions='example.com'
7295 !! result
7296 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7297 </p>
7298 !! end
7299
7300 !! test
7301 Image with link parameter, wgExternalLinkTarget, unnamed parameter
7302 !! input
7303 [[Image:foobar.jpg|link=http://example.com/|Title]]
7304 !! config
7305 wgExternalLinkTarget='foobar'
7306 !! result
7307 <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>
7308 </p>
7309 !! end
7310
7311 !! test
7312 Image with empty link parameter
7313 !! input
7314 [[Image:foobar.jpg|link=]]
7315 !! result
7316 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
7317 </p>
7318 !! end
7319
7320 !! test
7321 Image with link parameter (wiki target) and unnamed parameter
7322 !! input
7323 [[Image:foobar.jpg|link=Target page|Title]]
7324 !! result
7325 <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>
7326 </p>
7327 !! end
7328
7329 !! test
7330 Image with link parameter (URL target) and unnamed parameter
7331 !! input
7332 [[Image:foobar.jpg|link=http://example.com/|Title]]
7333 !! result
7334 <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>
7335 </p>
7336 !! end
7337
7338 !! test
7339 Thumbnail image with link parameter
7340 !! options
7341 php
7342 !! input
7343 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
7344 !! result
7345 <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>
7346
7347 !! end
7348
7349 !! test
7350 Manually-specified thumbnail image
7351 !! options
7352 php
7353 !! input
7354 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
7355 !! result
7356 <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>
7357
7358 !! end
7359
7360 !! test
7361 Manually-specified thumbnail image with explicit link to wiki page
7362 !! options
7363 php
7364 !! input
7365 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
7366 !! result
7367 <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>
7368
7369 !! end
7370
7371 !! test
7372 Manually-specified thumbnail image with explicit link to url
7373 !! options
7374 php
7375 !! input
7376 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
7377 !! result
7378 <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>
7379
7380 !! end
7381
7382 !! test
7383 Manually-specified thumbnail image with explicit no link
7384 !! options
7385 php
7386 !! input
7387 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
7388 !! result
7389 <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>
7390
7391 !! end
7392
7393 !! test
7394 Manually-specified thumbnail image with explicit link and alt text
7395 !! options
7396 php
7397 !! input
7398 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
7399 !! result
7400 <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>
7401
7402 !! end
7403
7404 !! test
7405 Image with frame and link
7406 !! input
7407 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
7408 !! result
7409 <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>
7410
7411 !! end
7412
7413 !! test
7414 Image with frame and link and explicit alt
7415 !! input
7416 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
7417 !! result
7418 <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>
7419
7420 !! end
7421
7422 !! test
7423 Image with wiki markup in implicit alt
7424 !! input
7425 [[Image:Foobar.jpg|testing '''bold''' in alt]]
7426 !! result
7427 <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>
7428 </p>
7429 !! end
7430
7431 !! test
7432 Image with wiki markup in explicit alt
7433 !! input
7434 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
7435 !! result
7436 <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>
7437 </p>
7438 !! end
7439
7440 !! test
7441 Link to image page- image page normally doesn't exists, hence edit link
7442 Add test with existing image page
7443 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
7444 !! input
7445 [[:Image:test]]
7446 !! result
7447 <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>
7448 </p>
7449 !! end
7450
7451 !! test
7452 bug 18784 Link to non-existent image page with caption should use caption as link text
7453 !! input
7454 [[:Image:test|caption]]
7455 !! result
7456 <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>
7457 </p>
7458 !! end
7459
7460 !! test
7461 Frameless image caption with a free URL
7462 !! input
7463 [[Image:foobar.jpg|http://example.com]]
7464 !! result
7465 <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>
7466 </p>
7467 !! end
7468
7469 !! test
7470 Thumbnail image caption with a free URL
7471 !! input
7472 [[Image:foobar.jpg|thumb|http://example.com]]
7473 !! result
7474 <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>
7475
7476 !! end
7477
7478 !! test
7479 Thumbnail image caption with a free URL and explicit alt
7480 !! input
7481 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
7482 !! result
7483 <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>
7484
7485 !! end
7486
7487 !! test
7488 BUG 1887: A ISBN with a thumbnail
7489 !! input
7490 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
7491 !! result
7492 <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>
7493
7494 !! end
7495
7496 !! test
7497 BUG 1887: A RFC with a thumbnail
7498 !! input
7499 [[Image:foobar.jpg|thumb|This is RFC 12354]]
7500 !! result
7501 <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>
7502
7503 !! end
7504
7505 !! test
7506 BUG 1887: A mailto link with a thumbnail
7507 !! input
7508 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
7509 !! result
7510 <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>
7511
7512 !! end
7513
7514 # Pending resolution to bug 368
7515 !! test
7516 BUG 648: Frameless image caption with a link
7517 !! input
7518 [[Image:foobar.jpg|text with a [[link]] in it]]
7519 !! result
7520 <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>
7521 </p>
7522 !! end
7523
7524 !! test
7525 BUG 648: Frameless image caption with a link (suffix)
7526 !! input
7527 [[Image:foobar.jpg|text with a [[link]]foo in it]]
7528 !! result
7529 <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>
7530 </p>
7531 !! end
7532
7533 !! test
7534 BUG 648: Frameless image caption with an interwiki link
7535 !! input
7536 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
7537 !! result
7538 <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>
7539 </p>
7540 !! end
7541
7542 !! test
7543 BUG 648: Frameless image caption with a piped interwiki link
7544 !! input
7545 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
7546 !! result
7547 <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>
7548 </p>
7549 !! end
7550
7551 !! test
7552 Escape HTML special chars in image alt text
7553 !! input
7554 [[Image:foobar.jpg|& < > "]]
7555 !! result
7556 <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>
7557 </p>
7558 !! end
7559
7560 !! test
7561 BUG 499: Alt text should have &#1234;, not &amp;1234;
7562 !! input
7563 [[Image:foobar.jpg|&#9792;]]
7564 !! result
7565 <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>
7566 </p>
7567 !! end
7568
7569 !! test
7570 Broken image caption with link
7571 !! input
7572 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
7573 !! result
7574 <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.
7575 </p>
7576 !! end
7577
7578 !! test
7579 Image caption containing another image
7580 !! input
7581 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
7582 !! result
7583 <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>
7584
7585 !! end
7586
7587 !! test
7588 Image caption containing a newline
7589 !! input
7590 [[Image:Foobar.jpg|This
7591 *is some text]]
7592 !! result
7593 <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>
7594 </p>
7595 !!end
7596
7597 !!test
7598 Parsoid: Image caption containing leading space
7599 (The leading space should not trigger nowiki escaping in wt2wt mode)
7600 !! input
7601 [[Image:Foobar.jpg|thumb| bar]]
7602 !! result
7603 <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>
7604
7605 !!end
7606
7607 !! test
7608 Bug 3090: External links other than http: in image captions
7609 !! input
7610 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
7611 !! result
7612 <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>
7613
7614 !! end
7615
7616 !! test
7617 Custom class
7618 !! input
7619 [[Image:foobar.jpg|a|class=b]]
7620 !! result
7621 <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>
7622 </p>
7623 !! end
7624
7625 !! test
7626 Localized image handling (1).
7627 !! options
7628 language=es
7629 !! input
7630 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
7631 !! result
7632 <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>
7633
7634 !! end
7635
7636 !! test
7637 Localized image handling (2).
7638 !! options
7639 language=es
7640 !! input
7641 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
7642 !! result
7643 <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>
7644
7645 !! end
7646
7647 !! test
7648 "border", "frameless" and "class" attributes on an image.
7649 !! input
7650 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
7651 !! result
7652 <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>
7653 </p>
7654 !! end
7655
7656 !! article
7657 File:Barfoo.jpg
7658 !! text
7659 #REDIRECT [[File:Barfoo.jpg]]
7660 !! endarticle
7661
7662 !! test
7663 Redirected image
7664 !! input
7665 [[Image:Barfoo.jpg]]
7666 !! result
7667 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
7668 </p>
7669 !! end
7670
7671 !! test
7672 Missing image with uploads disabled
7673 !! options
7674 wgEnableUploads=0
7675 !! input
7676 [[Image:Foobaz.jpg]]
7677 !! result
7678 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
7679 </p>
7680 !! end
7681
7682
7683 ###
7684 ### Subpages
7685 ###
7686 !! article
7687 Subpage test/subpage
7688 !! text
7689 foo
7690 !! endarticle
7691
7692 !! test
7693 Subpage link
7694 !! options
7695 subpage title=[[Subpage test]]
7696 !! input
7697 [[/subpage]]
7698 !! result
7699 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
7700 </p>
7701 !! end
7702
7703 !! test
7704 Subpage noslash link
7705 !! options
7706 subpage title=[[Subpage test]]
7707 !!input
7708 [[/subpage/]]
7709 !! result
7710 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
7711 </p>
7712 !! end
7713
7714 !! test
7715 Disabled subpages
7716 !! input
7717 [[/subpage]]
7718 !! result
7719 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
7720 </p>
7721 !! end
7722
7723 !! test
7724 BUG 561: {{/Subpage}}
7725 !! options
7726 subpage title=[[Page]]
7727 !! input
7728 {{/Subpage}}
7729 !! result
7730 <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>
7731 </p>
7732 !! end
7733
7734 ###
7735 ### Categories
7736 ###
7737 !! article
7738 Category:MediaWiki User's Guide
7739 !! text
7740 blah
7741 !! endarticle
7742
7743 !! test
7744 Link to category
7745 !! input
7746 [[:Category:MediaWiki User's Guide]]
7747 !! result
7748 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
7749 </p>
7750 !! end
7751
7752 !! test
7753 Simple category
7754 !! options
7755 cat
7756 !! input
7757 [[Category:MediaWiki User's Guide]]
7758 !! result
7759 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7760 !! end
7761
7762 !! test
7763 PAGESINCATEGORY invalid title fatal (r33546 fix)
7764 !! input
7765 {{PAGESINCATEGORY:<bogus>}}
7766 !! result
7767 <p>0
7768 </p>
7769 !! end
7770
7771 !! test
7772 Category with different sort key
7773 !! options
7774 cat
7775 !! input
7776 [[Category:MediaWiki User's Guide|Foo]]
7777 !! result
7778 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7779 !! end
7780
7781 !! test
7782 Category with identical sort key
7783 !! options
7784 cat
7785 !! input
7786 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7787 !! result
7788 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7789 !! end
7790
7791 !! test
7792 Category with empty sort key
7793 !! options
7794 cat
7795 pst
7796 !! input
7797 [[Category:MediaWiki User's Guide|]]
7798 !! result
7799 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7800 !! end
7801
7802 !! test
7803 Category with empty sort key and parentheses
7804 !! options
7805 cat
7806 pst
7807 !! input
7808 [[Category:Foo (bar)|]]
7809 !! result
7810 [[Category:Foo (bar)|Foo]]
7811 !! end
7812
7813 !! test
7814 Category with link tail
7815 !! options
7816 cat
7817 pst
7818 !! input
7819 123[[Category:Foo]]456
7820 !! result
7821 123[[Category:Foo]]456
7822 !! end
7823
7824 !! test
7825 Category with template
7826 !! options
7827 cat
7828 pst
7829 !! input
7830 [[Category:{{echo|Foo}}]]
7831 !! result
7832 [[Category:{{echo|Foo}}]]
7833 !! end
7834
7835 !! test
7836 Category with template in sort key
7837 !! options
7838 cat
7839 pst
7840 !! input
7841 [[Category:Foo|{{echo|Bar}}]]
7842 !! result
7843 [[Category:Foo|{{echo|Bar}}]]
7844 !! end
7845
7846 !! test
7847 Category with template in sort key and title
7848 !! options
7849 cat
7850 pst
7851 !! input
7852 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
7853 !! result
7854 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
7855 !! end
7856
7857 !! test
7858 Category / paragraph interactions
7859 !! input
7860 Foo [[Category:Baz]] Bar
7861
7862 Foo [[Category:Baz]]
7863 Bar
7864
7865 Foo
7866 [[Category:Baz]]
7867 Bar
7868
7869 Foo
7870 [[Category:Baz]] Bar
7871
7872 Foo
7873 [[Category:Baz]]
7874 [[Category:Baz]]
7875 [[Category:Baz]]
7876 Bar
7877
7878 [[Category:Baz]]
7879 [[Category:Baz]]
7880 [[Category:Baz]]
7881
7882 [[Category:Baz]]
7883 {{echo|[[Category:Baz]]}}
7884 [[Category:Baz]]
7885 !! result
7886 <p>Foo Bar
7887 </p><p>Foo
7888 Bar
7889 </p><p>Foo
7890 Bar
7891 </p><p>Foo Bar
7892 </p><p>Foo
7893 Bar
7894 </p>
7895 !! end
7896
7897 ###
7898 ### Inter-language links
7899 ###
7900 !! test
7901 Inter-language links
7902 !! options
7903 ill
7904 !! input
7905 [[es:Alimento]]
7906 [[fr:Nourriture]]
7907 [[zh:&#39135;&#21697;]]
7908 !! result
7909 es:Alimento fr:Nourriture zh:食品
7910 !! end
7911
7912 !! test
7913 Duplicate interlanguage links (bug 24502)
7914 !! options
7915 ill
7916 !! input
7917 [[es:1]]
7918 [[es:2]]
7919 [[fr:1]]
7920 [[fr:2]]
7921 !! result
7922 es:1 fr:1
7923 !! end
7924
7925 ###
7926 ### Sections
7927 ###
7928 !! test
7929 Basic section headings
7930 !! input
7931 == Headline 1 ==
7932 Some text
7933
7934 ==Headline 2==
7935 More
7936 ===Smaller headline===
7937 Blah blah
7938 !! result
7939 <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>
7940 <p>Some text
7941 </p>
7942 <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>
7943 <p>More
7944 </p>
7945 <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>
7946 <p>Blah blah
7947 </p>
7948 !! end
7949
7950 !! test
7951 Section headings with TOC
7952 !! input
7953 == Headline 1 ==
7954 === Subheadline 1 ===
7955 ===== Skipping a level =====
7956 ====== Skipping a level ======
7957
7958 == Headline 2 ==
7959 Some text
7960 ===Another headline===
7961 !! result
7962 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7963 <ul>
7964 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
7965 <ul>
7966 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
7967 <ul>
7968 <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>
7969 <ul>
7970 <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>
7971 </ul>
7972 </li>
7973 </ul>
7974 </li>
7975 </ul>
7976 </li>
7977 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
7978 <ul>
7979 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
7980 </ul>
7981 </li>
7982 </ul>
7983 </td></tr></table>
7984 <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>
7985 <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>
7986 <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>
7987 <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>
7988 <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>
7989 <p>Some text
7990 </p>
7991 <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>
7992
7993 !! end
7994
7995 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
7996 !! test
7997 Handling of sections up to level 6 and beyond
7998 !! input
7999 = Level 1 Heading=
8000 == Level 2 Heading==
8001 === Level 3 Heading===
8002 ==== Level 4 Heading====
8003 ===== Level 5 Heading=====
8004 ====== Level 6 Heading======
8005 ======= Level 7 Heading=======
8006 ======== Level 8 Heading========
8007 ========= Level 9 Heading=========
8008 ========== Level 10 Heading==========
8009 !! result
8010 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8011 <ul>
8012 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
8013 <ul>
8014 <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>
8015 <ul>
8016 <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>
8017 <ul>
8018 <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>
8019 <ul>
8020 <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>
8021 <ul>
8022 <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>
8023 <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>
8024 <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>
8025 <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>
8026 <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>
8027 </ul>
8028 </li>
8029 </ul>
8030 </li>
8031 </ul>
8032 </li>
8033 </ul>
8034 </li>
8035 </ul>
8036 </li>
8037 </ul>
8038 </td></tr></table>
8039 <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>
8040 <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>
8041 <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>
8042 <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>
8043 <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>
8044 <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>
8045 <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>
8046 <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>
8047 <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>
8048 <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>
8049
8050 !! end
8051
8052 !! test
8053 TOC regression (bug 9764)
8054 !! input
8055 == title 1 ==
8056 === title 1.1 ===
8057 ==== title 1.1.1 ====
8058 === title 1.2 ===
8059 == title 2 ==
8060 === title 2.1 ===
8061 !! result
8062 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8063 <ul>
8064 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8065 <ul>
8066 <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>
8067 <ul>
8068 <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>
8069 </ul>
8070 </li>
8071 <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>
8072 </ul>
8073 </li>
8074 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8075 <ul>
8076 <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>
8077 </ul>
8078 </li>
8079 </ul>
8080 </td></tr></table>
8081 <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>
8082 <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>
8083 <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>
8084 <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>
8085 <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>
8086 <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>
8087
8088 !! end
8089
8090 !! test
8091 TOC with wgMaxTocLevel=3 (bug 6204)
8092 !! options
8093 wgMaxTocLevel=3
8094 !! input
8095 == title 1 ==
8096 === title 1.1 ===
8097 ==== title 1.1.1 ====
8098 === title 1.2 ===
8099 == title 2 ==
8100 === title 2.1 ===
8101 !! result
8102 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8103 <ul>
8104 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8105 <ul>
8106 <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>
8107 <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>
8108 </ul>
8109 </li>
8110 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8111 <ul>
8112 <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>
8113 </ul>
8114 </li>
8115 </ul>
8116 </td></tr></table>
8117 <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>
8118 <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>
8119 <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>
8120 <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>
8121 <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>
8122 <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>
8123
8124 !! end
8125
8126 !! test
8127 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
8128 !! options
8129 wgMaxTocLevel=3
8130 !! input
8131 ==Section 1==
8132 ===Section 1.1===
8133 ====Section 1.1.1====
8134 ====Section 1.1.1.1====
8135 ==Section 2==
8136 !! result
8137 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8138 <ul>
8139 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
8140 <ul>
8141 <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>
8142 </ul>
8143 </li>
8144 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
8145 </ul>
8146 </td></tr></table>
8147 <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>
8148 <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>
8149 <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>
8150 <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>
8151 <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>
8152
8153 !! end
8154
8155
8156 !! test
8157 Resolving duplicate section names
8158 !! input
8159 == Foo bar ==
8160 == Foo bar ==
8161 !! result
8162 <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>
8163 <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>
8164
8165 !! end
8166
8167 !! test
8168 Resolving duplicate section names with differing case (bug 10721)
8169 !! input
8170 == Foo bar ==
8171 == Foo Bar ==
8172 !! result
8173 <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>
8174 <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>
8175
8176 !! end
8177
8178 !! article
8179 Template:sections
8180 !! text
8181 ===Section 1===
8182 ==Section 2==
8183 !! endarticle
8184
8185 !! test
8186 Template with sections, __NOTOC__
8187 !! input
8188 __NOTOC__
8189 ==Section 0==
8190 {{sections}}
8191 ==Section 4==
8192 !! result
8193 <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>
8194 <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>
8195 <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>
8196 <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>
8197
8198 !! end
8199
8200 !! test
8201 __NOEDITSECTION__ keyword
8202 !! input
8203 __NOEDITSECTION__
8204 ==Section 1==
8205 ==Section 2==
8206 !! result
8207 <h2> <span class="mw-headline" id="Section_1">Section 1</span></h2>
8208 <h2> <span class="mw-headline" id="Section_2">Section 2</span></h2>
8209
8210 !! end
8211
8212 !! test
8213 Link inside a section heading
8214 !! input
8215 ==Section with a [[Main Page|link]] in it==
8216 !! result
8217 <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>
8218
8219 !! end
8220
8221 !! test
8222 TOC regression (bug 12077)
8223 !! input
8224 __TOC__
8225 == title 1 ==
8226 === title 1.1 ===
8227 == title 2 ==
8228 !! result
8229 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8230 <ul>
8231 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8232 <ul>
8233 <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>
8234 </ul>
8235 </li>
8236 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
8237 </ul>
8238 </td></tr></table>
8239 <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>
8240 <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>
8241 <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>
8242
8243 !! end
8244
8245 !! test
8246 BUG 1219 URL next to image (good)
8247 !! input
8248 http://example.com [[Image:foobar.jpg]]
8249 !! result
8250 <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>
8251 </p>
8252 !!end
8253
8254 !! test
8255 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
8256 !! input
8257 ===
8258 The line above must have a trailing space!
8259 === <!--
8260 --> <!-- -->
8261 But just in case it doesn't...
8262 !! result
8263 <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>
8264 <p>The line above must have a trailing space!
8265 </p>
8266 <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>
8267 <p>But just in case it doesn't...
8268 </p>
8269 !! end
8270
8271 !! test
8272 Header with special characters (bug 25462)
8273 !! input
8274 The tooltips shall not show entities to the user (ie. be double escaped)
8275
8276 == text > text ==
8277 section 1
8278
8279 == text < text ==
8280 section 2
8281
8282 == text & text ==
8283 section 3
8284
8285 == text ' text ==
8286 section 4
8287
8288 == text " text ==
8289 section 5
8290 !! result
8291 <p>The tooltips shall not show entities to the user (ie. be double escaped)
8292 </p>
8293 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8294 <ul>
8295 <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>
8296 <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>
8297 <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>
8298 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
8299 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
8300 </ul>
8301 </td></tr></table>
8302 <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>
8303 <p>section 1
8304 </p>
8305 <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>
8306 <p>section 2
8307 </p>
8308 <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>
8309 <p>section 3
8310 </p>
8311 <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>
8312 <p>section 4
8313 </p>
8314 <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>
8315 <p>section 5
8316 </p>
8317 !! end
8318
8319 !! test
8320 Headers with excess '=' characters
8321 (Are similar tests necessary beyond the 1st level?)
8322 !! input
8323 =foo==
8324 ==foo=
8325 =''italic'' heading==
8326 ==''italic'' heading=
8327 !! result
8328 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8329 <ul>
8330 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
8331 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
8332 <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>
8333 <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>
8334 </ul>
8335 </td></tr></table>
8336 <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>
8337 <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>
8338 <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>
8339 <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>
8340
8341 !! end
8342
8343 !! test
8344 HTML headers vs TOC (bug 23393)
8345 (__NOEDITSECTION__ for clearer output, doesn't matter here)
8346 !! input
8347 <h1>Header 1</h1>
8348 == Header 1.1 ==
8349 == Header 1.2 ==
8350
8351 <h1>Header 2
8352 </h1>
8353 == Header 2.1 ==
8354 == Header 2.2 ==
8355 __NOEDITSECTION__
8356 !! result
8357 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8358 <ul>
8359 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
8360 <ul>
8361 <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>
8362 <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>
8363 </ul>
8364 </li>
8365 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
8366 <ul>
8367 <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>
8368 <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>
8369 </ul>
8370 </li>
8371 </ul>
8372 </td></tr></table>
8373 <h1> <span class="mw-headline" id="Header_1">Header 1</span></h1>
8374 <h2> <span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
8375 <h2> <span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
8376 <h1> <span class="mw-headline" id="Header_2">Header 2</span></h1>
8377 <h2> <span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
8378 <h2> <span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
8379
8380 !! end
8381
8382 !! test
8383 BUG 1219 URL next to image (broken)
8384 !! input
8385 http://example.com[[Image:foobar.jpg]]
8386 !! result
8387 <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>
8388 </p>
8389 !!end
8390
8391 !! test
8392 Bug 1186 news: in the middle of text
8393 !! input
8394 http://en.wikinews.org/wiki/Wikinews:Workplace
8395 !! result
8396 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
8397 </p>
8398 !!end
8399
8400
8401 !! test
8402 Namespaced link must have a title
8403 !! input
8404 [[Project:]]
8405 !! result
8406 <p>[[Project:]]
8407 </p>
8408 !!end
8409
8410 !! test
8411 Namespaced link must have a title (bad fragment version)
8412 !! input
8413 [[Project:#fragment]]
8414 !! result
8415 <p>[[Project:#fragment]]
8416 </p>
8417 !!end
8418
8419
8420 ###
8421 ### HTML tags and HTML attributes
8422 ###
8423
8424 !! test
8425 div with no attributes
8426 !! input
8427 <div>HTML rocks</div>
8428 !! result
8429 <div>HTML rocks</div>
8430
8431 !! end
8432
8433 !! test
8434 div with double-quoted attribute
8435 !! input
8436 <div id="rock">HTML rocks</div>
8437 !! result
8438 <div id="rock">HTML rocks</div>
8439
8440 !! end
8441
8442 !! test
8443 div with single-quoted attribute
8444 !! input
8445 <div id='rock'>HTML rocks</div>
8446 !! result
8447 <div id="rock">HTML rocks</div>
8448
8449 !! end
8450
8451 !! test
8452 div with unquoted attribute
8453 !! input
8454 <div id=rock>HTML rocks</div>
8455 !! result
8456 <div id="rock">HTML rocks</div>
8457
8458 !! end
8459
8460 !! test
8461 div with illegal double attributes
8462 !! input
8463 <div id="a" id="b">HTML rocks</div>
8464 !! result
8465 <div id="b">HTML rocks</div>
8466
8467 !!end
8468
8469 # FIXME: produce empty string instead of "class" in the PHP parser, following
8470 # the HTML5 spec.
8471 !! test
8472 div with empty attribute value, space before equals
8473 !! options
8474 disabled
8475 !! input
8476 <div class =>HTML rocks</div>
8477 !! result
8478 <div class="">HTML rocks</div>
8479
8480 !! end
8481
8482 # The PHP parser escapes the opening brace to &#123; for some reason, so
8483 # disabled this test for it.
8484 !! test
8485 div with braces in attribute value
8486 !! options
8487 disabled
8488 !! input
8489 <div title="{}">Foo</div>
8490 !! result
8491 <div title="{}">Foo</div>
8492 !! end
8493
8494 # This it very inconsistent in the PHP parser: it returns
8495 # class="class" if there is a space between the name and the equal sign (see
8496 # 'div with empty attribute value, space before equals'), but strips the
8497 # attribute completely if the space is missing. We hope that not much content
8498 # depends on this, so are implementing the behavior below in Parsoid for
8499 # consistencies' sake. Disabled for the PHP parser.
8500 # FIXME: fix this behavior in the PHP parser?
8501 !! test
8502 div with empty attribute value, no space before equals
8503 !! options
8504 disabled
8505 !! input
8506 <div class=>HTML rocks</div>
8507 !! result
8508 <div class="">HTML rocks</div>
8509
8510 !! end
8511
8512 !! test
8513 HTML multiple attributes correction
8514 !! input
8515 <p class="error" class="awesome">Awesome!</p>
8516 !! result
8517 <p class="awesome">Awesome!</p>
8518
8519 !!end
8520
8521 !! test
8522 Table multiple attributes correction
8523 !! input
8524 {|
8525 !+ class="error" class="awesome"| status
8526 |}
8527 !! result
8528 <table>
8529 <tr>
8530 <th class="awesome"> status
8531 </th></tr></table>
8532
8533 !!end
8534
8535 !! test
8536 DIV IN UPPERCASE
8537 !! input
8538 <DIV ID="x">HTML ROCKS</DIV>
8539 !! result
8540 <div id="x">HTML ROCKS</div>
8541
8542 !!end
8543
8544 !! test
8545 Non-ASCII pseudo-tags are rendered as text
8546 !! input
8547 <khyô>
8548 !! result
8549 <p>&lt;khyô&gt;
8550 </p>
8551 !! end
8552
8553 !! test
8554 Pseudo-tag with URL 'name' renders as url link
8555 !! input
8556 <http://example.com/>
8557 !! result
8558 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
8559 </p>
8560 !! end
8561
8562 !! test
8563 text with amp in the middle of nowhere
8564 !! input
8565 Remember AT&T?
8566 !!result
8567 <p>Remember AT&amp;T?
8568 </p>
8569 !! end
8570
8571 !! test
8572 text with character entity: eacute
8573 !! input
8574 I always thought &eacute; was a cute letter.
8575 !! result
8576 <p>I always thought &#233; was a cute letter.
8577 </p>
8578 !! end
8579
8580 !! test
8581 text with entity-escaped character entity-like string: eacute
8582 !! input
8583 I always thought &amp;eacute; was a cute letter.
8584 !! result
8585 <p>I always thought &amp;eacute; was a cute letter.
8586 </p>
8587 !! end
8588
8589 !! test
8590 text with undefined character entity: xacute
8591 !! input
8592 I always thought &xacute; was a cute letter.
8593 !! result
8594 <p>I always thought &amp;xacute; was a cute letter.
8595 </p>
8596 !! end
8597
8598
8599 ###
8600 ### Media links
8601 ###
8602
8603 !! test
8604 Media link
8605 !! input
8606 [[Media:Foobar.jpg]]
8607 !! result
8608 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
8609 </p>
8610 !! end
8611
8612 !! test
8613 Media link with text
8614 !! input
8615 [[Media:Foobar.jpg|A neat file to look at]]
8616 !! result
8617 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
8618 </p>
8619 !! end
8620
8621 # FIXME: this is still bad HTML tag nesting
8622 !! test
8623 Media link with nasty text
8624 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
8625 !! input
8626 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
8627 !! result
8628 <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>
8629
8630 !! end
8631
8632 !! test
8633 Media link to nonexistent file (bug 1702)
8634 !! input
8635 [[Media:No such.jpg]]
8636 !! result
8637 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
8638 </p>
8639 !! end
8640
8641 !! test
8642 Image link to nonexistent file (bug 1850 - good)
8643 !! input
8644 [[Image:No such.jpg]]
8645 !! result
8646 <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>
8647 </p>
8648 !! end
8649
8650 !! test
8651 :Image link to nonexistent file (bug 1850 - bad)
8652 !! input
8653 [[:Image:No such.jpg]]
8654 !! result
8655 <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>
8656 </p>
8657 !! end
8658
8659
8660
8661 !! test
8662 Character reference normalization in link text (bug 1938)
8663 !! input
8664 [[Main Page|this&that]]
8665 !! result
8666 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
8667 </p>
8668 !!end
8669
8670 !! article
8671 אַ
8672 !! text
8673 Test for unicode normalization
8674
8675 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
8676 !! endarticle
8677
8678 !! test
8679 (bug 19451) Links should refer to the normalized form.
8680 !! input
8681 [[&#xFB2E;]]
8682 [[&#x5d0;&#x5b7;]]
8683 [[&#x5d0;ַ]]
8684 [[א&#x5b7;]]
8685 [[אַ]]
8686 !! result
8687 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
8688 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
8689 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
8690 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
8691 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
8692 </p>
8693 !! end
8694
8695 !! test
8696 Empty attribute crash test (bug 2067)
8697 !! input
8698 <font color="">foo</font>
8699 !! result
8700 <p><font color="">foo</font>
8701 </p>
8702 !! end
8703
8704 !! test
8705 Empty attribute crash test single-quotes (bug 2067)
8706 !! input
8707 <font color=''>foo</font>
8708 !! result
8709 <p><font color="">foo</font>
8710 </p>
8711 !! end
8712
8713 !! test
8714 Attribute test: equals, then nothing
8715 !! input
8716 <font color=>foo</font>
8717 !! result
8718 <p><font>foo</font>
8719 </p>
8720 !! end
8721
8722 !! test
8723 Attribute test: unquoted value
8724 !! input
8725 <font color=x>foo</font>
8726 !! result
8727 <p><font color="x">foo</font>
8728 </p>
8729 !! end
8730
8731 !! test
8732 Attribute test: unquoted but illegal value (hash)
8733 !! input
8734 <font color=#x>foo</font>
8735 !! result
8736 <p><font color="#x">foo</font>
8737 </p>
8738 !! end
8739
8740 !! test
8741 Attribute test: no value
8742 !! input
8743 <font color>foo</font>
8744 !! result
8745 <p><font color="color">foo</font>
8746 </p>
8747 !! end
8748
8749 !! test
8750 Bug 2095: link with three closing brackets
8751 !! input
8752 [[Main Page]]]
8753 !! result
8754 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
8755 </p>
8756 !! end
8757
8758 !! test
8759 Bug 2095: link with pipe and three closing brackets
8760 !! input
8761 [[Main Page|link]]]
8762 !! result
8763 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
8764 </p>
8765 !! end
8766
8767 !! test
8768 Bug 2095: link with pipe and three closing brackets, version 2
8769 !! input
8770 [[Main Page|[http://example.com/]]]
8771 !! result
8772 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
8773 </p>
8774 !! end
8775
8776
8777 ###
8778 ### Safety
8779 ###
8780
8781 !! article
8782 Template:Dangerous attribute
8783 !! text
8784 " onmouseover="alert(document.cookie)
8785 !! endarticle
8786
8787 !! article
8788 Template:Dangerous style attribute
8789 !! text
8790 border-size: expression(alert(document.cookie))
8791 !! endarticle
8792
8793 !! article
8794 Template:Div style
8795 !! text
8796 <div style="float: right; {{{1}}}">Magic div</div>
8797 !! endarticle
8798
8799 !! test
8800 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
8801 !! input
8802 <div title="{{test}}"></div>
8803 !! result
8804 <div title="This is a test template"></div>
8805
8806 !! end
8807
8808 !! test
8809 Bug 2304: HTML attribute safety (dangerous template; 2309)
8810 !! input
8811 <div title="{{dangerous attribute}}"></div>
8812 !! result
8813 <div title=""></div>
8814
8815 !! end
8816
8817 !! test
8818 Bug 2304: HTML attribute safety (dangerous style template; 2309)
8819 !! input
8820 <div style="{{dangerous style attribute}}"></div>
8821 !! result
8822 <div style="/* insecure input */"></div>
8823
8824 !! end
8825
8826 !! test
8827 Bug 2304: HTML attribute safety (safe parameter; 2309)
8828 !! input
8829 {{div style|width: 200px}}
8830 !! result
8831 <div style="float: right; width: 200px">Magic div</div>
8832
8833 !! end
8834
8835 !! test
8836 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
8837 !! input
8838 {{div style|width: expression(alert(document.cookie))}}
8839 !! result
8840 <div style="/* insecure input */">Magic div</div>
8841
8842 !! end
8843
8844 !! test
8845 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
8846 !! input
8847 {{div style|"><script>alert(document.cookie)</script>}}
8848 !! result
8849 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
8850
8851 !! end
8852
8853 !! test
8854 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
8855 !! input
8856 {{div style|" ><script>alert(document.cookie)</script>}}
8857 !! result
8858 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
8859
8860 !! end
8861
8862 !! test
8863 Bug 2304: HTML attribute safety (link)
8864 !! input
8865 <div title="[[Main Page]]"></div>
8866 !! result
8867 <div title="&#91;&#91;Main Page]]"></div>
8868
8869 !! end
8870
8871 !! test
8872 Bug 2304: HTML attribute safety (italics)
8873 !! input
8874 <div title="''foobar''"></div>
8875 !! result
8876 <div title="&#39;&#39;foobar&#39;&#39;"></div>
8877
8878 !! end
8879
8880 !! test
8881 Bug 2304: HTML attribute safety (bold)
8882 !! input
8883 <div title="'''foobar'''"></div>
8884 !! result
8885 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
8886
8887 !! end
8888
8889
8890 !! test
8891 Bug 2304: HTML attribute safety (ISBN)
8892 !! input
8893 <div title="ISBN 1234567890"></div>
8894 !! result
8895 <div title="&#73;SBN 1234567890"></div>
8896
8897 !! end
8898
8899 !! test
8900 Bug 2304: HTML attribute safety (RFC)
8901 !! input
8902 <div title="RFC 1234"></div>
8903 !! result
8904 <div title="&#82;FC 1234"></div>
8905
8906 !! end
8907
8908 !! test
8909 Bug 2304: HTML attribute safety (PMID)
8910 !! input
8911 <div title="PMID 1234567890"></div>
8912 !! result
8913 <div title="&#80;MID 1234567890"></div>
8914
8915 !! end
8916
8917 !! test
8918 Bug 2304: HTML attribute safety (web link)
8919 !! input
8920 <div title="http://example.com/"></div>
8921 !! result
8922 <div title="http&#58;//example.com/"></div>
8923
8924 !! end
8925
8926 !! test
8927 Bug 2304: HTML attribute safety (named web link)
8928 !! input
8929 <div title="[http://example.com/ link]"></div>
8930 !! result
8931 <div title="&#91;http&#58;//example.com/ link]"></div>
8932
8933 !! end
8934
8935 !! test
8936 Bug 3244: HTML attribute safety (extension; safe)
8937 !! input
8938 <div style="<nowiki>background:blue</nowiki>"></div>
8939 !! result
8940 <div style="background:blue"></div>
8941
8942 !! end
8943
8944 !! test
8945 Bug 3244: HTML attribute safety (extension; unsafe)
8946 !! input
8947 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
8948 !! result
8949 <div style="/* insecure input */"></div>
8950
8951 !! end
8952
8953 # More MSIE fun discovered by Tom Gilder
8954
8955 !! test
8956 MSIE CSS safety test: spurious slash
8957 !! input
8958 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
8959 !! result
8960 <div style="/* insecure input */">evil</div>
8961
8962 !! end
8963
8964 !! test
8965 MSIE CSS safety test: hex code
8966 !! input
8967 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
8968 !! result
8969 <div style="/* insecure input */">evil</div>
8970
8971 !! end
8972
8973 !! test
8974 MSIE CSS safety test: comment in url
8975 !! input
8976 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
8977 !! result
8978 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
8979
8980 !! end
8981
8982 !! test
8983 MSIE CSS safety test: comment in expression
8984 !! input
8985 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
8986 !! result
8987 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
8988
8989 !! end
8990
8991
8992 !! test
8993 Table attribute legitimate extension
8994 !! input
8995 {|
8996 !+ style="<nowiki>color:blue</nowiki>"| status
8997 |}
8998 !! result
8999 <table>
9000 <tr>
9001 <th style="color:blue"> status
9002 </th></tr></table>
9003
9004 !!end
9005
9006 !! test
9007 Table attribute safety
9008 !! input
9009 {|
9010 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
9011 |}
9012 !! result
9013 <table>
9014 <tr>
9015 <th style="/* insecure input */"> status
9016 </th></tr></table>
9017
9018 !! end
9019
9020 !! test
9021 CSS line continuation 1
9022 !! input
9023 <div style="background-image: u\&#10;rl(test.jpg);"></div>
9024 !! result
9025 <div style="/* insecure input */"></div>
9026
9027 !! end
9028
9029 !! test
9030 CSS line continuation 2
9031 !! input
9032 <div style="background-image: u\&#13;rl(test.jpg); "></div>
9033 !! result
9034 <div style="/* insecure input */"></div>
9035
9036 !! end
9037
9038 !! article
9039 Template:Identity
9040 !! text
9041 {{{1}}}
9042 !! endarticle
9043
9044 !! test
9045 Expansion of multi-line templates in attribute values (bug 6255)
9046 !! input
9047 <div style="background: {{identity|#00FF00}}">-</div>
9048 !! result
9049 <div style="background: #00FF00">-</div>
9050
9051 !! end
9052
9053
9054 !! test
9055 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
9056 !! input
9057 <div style="background:
9058 #00FF00">-</div>
9059 !! result
9060 <div style="background: #00FF00">-</div>
9061
9062 !! end
9063
9064 !! test
9065 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
9066 !! input
9067 <div style="background: &#10;#00FF00">-</div>
9068 !! result
9069 <div style="background: &#10;#00FF00">-</div>
9070
9071 !! end
9072
9073 ###
9074 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
9075 ###
9076 !! test
9077 Parser hook: empty input
9078 !! input
9079 <tag></tag>
9080 !! result
9081 <pre>
9082 ''
9083 array (
9084 )
9085 </pre>
9086
9087 !! end
9088
9089 !! test
9090 Parser hook: empty input using terminated empty elements
9091 !! input
9092 <tag/>
9093 !! result
9094 <pre>
9095 NULL
9096 array (
9097 )
9098 </pre>
9099
9100 !! end
9101
9102 !! test
9103 Parser hook: empty input using terminated empty elements (space before)
9104 !! input
9105 <tag />
9106 !! result
9107 <pre>
9108 NULL
9109 array (
9110 )
9111 </pre>
9112
9113 !! end
9114
9115 !! test
9116 Parser hook: basic input
9117 !! input
9118 <tag>input</tag>
9119 !! result
9120 <pre>
9121 'input'
9122 array (
9123 )
9124 </pre>
9125
9126 !! end
9127
9128
9129 !! test
9130 Parser hook: case insensitive
9131 !! input
9132 <TAG>input</TAG>
9133 !! result
9134 <pre>
9135 'input'
9136 array (
9137 )
9138 </pre>
9139
9140 !! end
9141
9142
9143 !! test
9144 Parser hook: case insensitive, redux
9145 !! input
9146 <TaG>input</TAg>
9147 !! result
9148 <pre>
9149 'input'
9150 array (
9151 )
9152 </pre>
9153
9154 !! end
9155
9156 !! test
9157 Parser hook: nested tags
9158 !! options
9159 noxml
9160 !! input
9161 <tag><tag></tag></tag>
9162 !! result
9163 <pre>
9164 '<tag>'
9165 array (
9166 )
9167 </pre>&lt;/tag&gt;
9168
9169 !! end
9170
9171 !! test
9172 Parser hook: basic arguments
9173 !! input
9174 <tag width=200 height = "100" depth = '50' square></tag>
9175 !! result
9176 <pre>
9177 ''
9178 array (
9179 'width' => '200',
9180 'height' => '100',
9181 'depth' => '50',
9182 'square' => 'square',
9183 )
9184 </pre>
9185
9186 !! end
9187
9188 !! test
9189 Parser hook: argument containing a forward slash (bug 5344)
9190 !! input
9191 <tag filename='/tmp/bla'></tag>
9192 !! result
9193 <pre>
9194 ''
9195 array (
9196 'filename' => '/tmp/bla',
9197 )
9198 </pre>
9199
9200 !! end
9201
9202 !! test
9203 Parser hook: empty input using terminated empty elements (bug 2374)
9204 !! input
9205 <tag foo=bar/>text
9206 !! result
9207 <pre>
9208 NULL
9209 array (
9210 'foo' => 'bar',
9211 )
9212 </pre>text
9213
9214 !! end
9215
9216 # </tag> should be output literally since there is no matching tag that begins it
9217 !! test
9218 Parser hook: basic arguments using terminated empty elements (bug 2374)
9219 !! input
9220 <tag width=200 height = "100" depth = '50' square/>
9221 other stuff
9222 </tag>
9223 !! result
9224 <pre>
9225 NULL
9226 array (
9227 'width' => '200',
9228 'height' => '100',
9229 'depth' => '50',
9230 'square' => 'square',
9231 )
9232 </pre>
9233 <p>other stuff
9234 &lt;/tag&gt;
9235 </p>
9236 !! end
9237
9238 ###
9239 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
9240 ###
9241
9242 !! test
9243 Parser hook: static parser hook not inside a comment
9244 !! input
9245 <statictag>hello, world</statictag>
9246 <statictag action=flush/>
9247 !! result
9248 <p>hello, world
9249 </p>
9250 !! end
9251
9252
9253 !! test
9254 Parser hook: static parser hook inside a comment
9255 !! input
9256 <!-- <statictag>hello, world</statictag> -->
9257 <statictag action=flush/>
9258 !! result
9259 <p><br />
9260 </p>
9261 !! end
9262
9263 # Nested template calls; this case was broken by Parser.php rev 1.506,
9264 # since reverted.
9265
9266 !! article
9267 Template:One-parameter
9268 !! text
9269 (My parameter is: {{{1}}})
9270 !! endarticle
9271
9272 !! article
9273 Template:Map-one-parameter
9274 !! text
9275 {{{{{1}}}|{{{2}}}}}
9276 !! endarticle
9277
9278 !! test
9279 Nested template calls
9280 !! input
9281 {{Map-one-parameter|One-parameter|param}}
9282 !! result
9283 <p>(My parameter is: param)
9284 </p>
9285 !! end
9286
9287
9288 ###
9289 ### Sanitizer
9290 ###
9291 !! test
9292 Sanitizer: Closing of open tags
9293 !! input
9294 <s></s><table></table>
9295 !! result
9296 <s></s><table></table>
9297
9298 !! end
9299
9300 !! test
9301 Sanitizer: Closing of open but not closed tags
9302 !! input
9303 <s>foo
9304 !! result
9305 <p><s>foo</s>
9306 </p>
9307 !! end
9308
9309 !! test
9310 Sanitizer: Closing of closed but not open tags
9311 !! input
9312 </s>
9313 !! result
9314 <p>&lt;/s&gt;
9315 </p>
9316 !! end
9317
9318 !! test
9319 Sanitizer: Closing of closed but not open table tags
9320 !! input
9321 Table not started</td></tr></table>
9322 !! result
9323 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
9324 </p>
9325 !! end
9326
9327 !! test
9328 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
9329 !! input
9330 <span id="æ: v">byte</span>[[#æ: v|backlink]]
9331 !! result
9332 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
9333 </p>
9334 !! end
9335
9336 !! test
9337 Sanitizer: Validating the contents of the id attribute (bug 4515)
9338 !! options
9339 disabled
9340 !! input
9341 <br id=9 />
9342 !! result
9343 Something, but definitely not <br id="9" />...
9344 !! end
9345
9346 !! test
9347 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
9348 !! options
9349 disabled
9350 !! input
9351 <br id="foo" /><br id="foo" />
9352 !! result
9353 Something need to be done. foo-2 ?
9354 !! end
9355
9356 !! test
9357 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
9358 !! input
9359 <div itemscope>
9360 <meta itemprop="hello" content="world">
9361 <meta http-equiv="refresh" content="5">
9362 <meta itemprop="hello" http-equiv="refresh" content="5">
9363 <link itemprop="hello" href="{{SERVER}}">
9364 <link rel="stylesheet" href="{{SERVER}}">
9365 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
9366 </div>
9367 !! result
9368 <div itemscope="itemscope">
9369 <p> <meta itemprop="hello" content="world" />
9370 &lt;meta http-equiv="refresh" content="5"&gt;
9371 <meta itemprop="hello" content="5" />
9372 </p>
9373 <link itemprop="hello" href="http&#58;//example.org" />
9374 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
9375 <link itemprop="hello" href="http&#58;//example.org" />
9376 </div>
9377
9378 !! end
9379
9380 !! test
9381 Language converter: output gets cut off unexpectedly (bug 5757)
9382 !! options
9383 language=zh
9384 !! input
9385 this bit is safe: }-
9386
9387 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
9388
9389 then we get cut off here: }-
9390
9391 all additional text is vanished
9392 !! result
9393 <p>this bit is safe: }-
9394 </p><p>but if we add a conversion instance: xxx
9395 </p><p>then we get cut off here: }-
9396 </p><p>all additional text is vanished
9397 </p>
9398 !! end
9399
9400 !! test
9401 Self closed html pairs (bug 5487)
9402 !! options
9403 !! input
9404 <center><font id="bug" />Centered text</center>
9405 <div><font id="bug2" />In div text</div>
9406 !! result
9407 <center>&lt;font id="bug" /&gt;Centered text</center>
9408 <div>&lt;font id="bug2" /&gt;In div text</div>
9409
9410 !! end
9411
9412 #
9413 #
9414 #
9415
9416 !! test
9417 Punctuation: nbsp before exclamation
9418 !! input
9419 C'est grave !
9420 !! result
9421 <p>C'est grave&#160;!
9422 </p>
9423 !! end
9424
9425 !! test
9426 Punctuation: CSS !important (bug 11874)
9427 !! input
9428 <div style="width:50% !important">important</div>
9429 !! result
9430 <div style="width:50% !important">important</div>
9431
9432 !!end
9433
9434 !! test
9435 Punctuation: CSS ! important (bug 11874; with space after)
9436 !! input
9437 <div style="width:50% ! important">important</div>
9438 !! result
9439 <div style="width:50% ! important">important</div>
9440
9441 !!end
9442
9443
9444 !! test
9445 HTML bullet list, closed tags (bug 5497)
9446 !! input
9447 <ul>
9448 <li>One</li>
9449 <li>Two</li>
9450 </ul>
9451 !! result
9452 <ul>
9453 <li>One</li>
9454 <li>Two</li>
9455 </ul>
9456
9457 !! end
9458
9459 !! test
9460 HTML bullet list, unclosed tags (bug 5497)
9461 !! options
9462 disabled
9463 !! input
9464 <ul>
9465 <li>One
9466 <li>Two
9467 </ul>
9468 !! result
9469 <ul>
9470 <li>One
9471 </li><li>Two
9472 </li></ul>
9473
9474 !! end
9475
9476 !! test
9477 HTML ordered list, closed tags (bug 5497)
9478 !! input
9479 <ol>
9480 <li>One</li>
9481 <li>Two</li>
9482 </ol>
9483 !! result
9484 <ol>
9485 <li>One</li>
9486 <li>Two</li>
9487 </ol>
9488
9489 !! end
9490
9491 !! test
9492 HTML ordered list, unclosed tags (bug 5497)
9493 !! options
9494 disabled
9495 !! input
9496 <ol>
9497 <li>One
9498 <li>Two
9499 </ol>
9500 !! result
9501 <ol>
9502 <li>One
9503 </li><li>Two
9504 </li></ol>
9505
9506 !! end
9507
9508 !! test
9509 HTML nested bullet list, closed tags (bug 5497)
9510 !! input
9511 <ul>
9512 <li>One</li>
9513 <li>Two:
9514 <ul>
9515 <li>Sub-one</li>
9516 <li>Sub-two</li>
9517 </ul>
9518 </li>
9519 </ul>
9520 !! result
9521 <ul>
9522 <li>One</li>
9523 <li>Two:
9524 <ul>
9525 <li>Sub-one</li>
9526 <li>Sub-two</li>
9527 </ul>
9528 </li>
9529 </ul>
9530
9531 !! end
9532
9533 !! test
9534 HTML nested bullet list, open tags (bug 5497)
9535 !! options
9536 disabled
9537 !! input
9538 <ul>
9539 <li>One
9540 <li>Two:
9541 <ul>
9542 <li>Sub-one
9543 <li>Sub-two
9544 </ul>
9545 </ul>
9546 !! result
9547 <ul>
9548 <li>One
9549 </li><li>Two:
9550 <ul>
9551 <li>Sub-one
9552 </li><li>Sub-two
9553 </li></ul>
9554 </li></ul>
9555
9556 !! end
9557
9558 !! test
9559 HTML nested ordered list, closed tags (bug 5497)
9560 !! input
9561 <ol>
9562 <li>One</li>
9563 <li>Two:
9564 <ol>
9565 <li>Sub-one</li>
9566 <li>Sub-two</li>
9567 </ol>
9568 </li>
9569 </ol>
9570 !! result
9571 <ol>
9572 <li>One</li>
9573 <li>Two:
9574 <ol>
9575 <li>Sub-one</li>
9576 <li>Sub-two</li>
9577 </ol>
9578 </li>
9579 </ol>
9580
9581 !! end
9582
9583 !! test
9584 HTML nested ordered list, open tags (bug 5497)
9585 !! options
9586 disabled
9587 !! input
9588 <ol>
9589 <li>One
9590 <li>Two:
9591 <ol>
9592 <li>Sub-one
9593 <li>Sub-two
9594 </ol>
9595 </ol>
9596 !! result
9597 <ol>
9598 <li>One
9599 </li><li>Two:
9600 <ol>
9601 <li>Sub-one
9602 </li><li>Sub-two
9603 </li></ol>
9604 </li></ol>
9605
9606 !! end
9607
9608 !! test
9609 HTML ordered list item with parameters oddity
9610 !! input
9611 <ol><li id="fragment">One</li></ol>
9612 !! result
9613 <ol><li id="fragment">One</li></ol>
9614
9615 !! end
9616
9617 !!test
9618 bug 5918: autonumbering
9619 !! input
9620 [http://first/] [http://second] [ftp://ftp]
9621
9622 ftp://inlineftp
9623
9624 [mailto:enclosed@mail.tld With target]
9625
9626 [mailto:enclosed@mail.tld]
9627
9628 mailto:inline@mail.tld
9629 !! result
9630 <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>
9631 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
9632 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
9633 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
9634 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
9635 </p>
9636 !! end
9637
9638
9639 #
9640 # Security and HTML correctness
9641 # From Nick Jenkins' fuzz testing
9642 #
9643
9644 !! test
9645 Fuzz testing: Parser13
9646 !! input
9647 {|
9648 | http://a|
9649 !! result
9650 <table>
9651 <tr>
9652 <td>
9653 </td>
9654 </tr>
9655 </table>
9656
9657 !! end
9658
9659 !! test
9660 Fuzz testing: Parser14
9661 !! input
9662 == onmouseover= ==
9663 http://__TOC__
9664 !! result
9665 <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>
9666 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9667 <ul>
9668 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
9669 </ul>
9670 </td></tr></table>
9671
9672 !! end
9673
9674 !! test
9675 Fuzz testing: Parser14-table
9676 !! input
9677 ==a==
9678 {| STYLE=__TOC__
9679 !! result
9680 <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>
9681 <table style="&#95;_TOC&#95;_">
9682 <tr><td></td></tr>
9683 </table>
9684
9685 !! end
9686
9687 # Known to produce bogus xml (extra </td>)
9688 !! test
9689 Fuzz testing: Parser16
9690 !! options
9691 noxml
9692 !! input
9693 {|
9694 !https://||||||
9695 !! result
9696 <table>
9697 <tr>
9698 <th>https://</th>
9699 <th></th>
9700 <th></th>
9701 <th>
9702 </td>
9703 </tr>
9704 </table>
9705
9706 !! end
9707
9708 !! test
9709 Fuzz testing: Parser21
9710 !! input
9711 {|
9712 ! irc://{{ftp://a" onmouseover="alert('hello world');"
9713 |
9714 !! result
9715 <table>
9716 <tr>
9717 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
9718 </th>
9719 <td>
9720 </td>
9721 </tr>
9722 </table>
9723
9724 !! end
9725
9726 !! test
9727 Fuzz testing: Parser22
9728 !! input
9729 http://===r:::https://b
9730
9731 {|
9732 !!result
9733 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
9734 </p>
9735 <table>
9736 <tr><td></td></tr>
9737 </table>
9738
9739 !! end
9740
9741 # Known to produce bad XML for now
9742 !! test
9743 Fuzz testing: Parser24
9744 !! options
9745 noxml
9746 !! input
9747 {|
9748 {{{|
9749 <u CLASS=
9750 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
9751 <br style="onmouseover='alert(document.cookie);' " />
9752
9753 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9754 |
9755 !! result
9756 <table>
9757 {{{|
9758 <u class="&#124;">}}}} &gt;
9759 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
9760
9761 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9762 <tr>
9763 <td></u>
9764 </td>
9765 </tr>
9766 </table>
9767
9768 !! end
9769
9770 # Note: the current result listed for this is not what the original one was,
9771 # but the original bug was JavaScript injection, which is fixed in any case.
9772 # It's not clear that the original result listed was any more correct than the
9773 # current one. Original result:
9774 # <p>{{{|
9775 # </p>
9776 # <li class="&#124;&#124;">
9777 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9778 !!test
9779 Fuzz testing: Parser25 (bug 6055)
9780 !! input
9781 {{{
9782 |
9783 <LI CLASS=||
9784 >
9785 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
9786 !! result
9787 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9788 </p>
9789 !! end
9790
9791 !!test
9792 Fuzz testing: URL adjacent extension (with space, clean)
9793 !! options
9794 !! input
9795 http://example.com <nowiki>junk</nowiki>
9796 !! result
9797 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
9798 </p>
9799 !!end
9800
9801 !!test
9802 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
9803 !! options
9804 !! input
9805 http://example.com<nowiki>junk</nowiki>
9806 !! result
9807 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
9808 </p>
9809 !!end
9810
9811 !!test
9812 Fuzz testing: URL adjacent extension (no space, dirty; pre)
9813 !! options
9814 !! input
9815 http://example.com<pre>junk</pre>
9816 !! result
9817 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
9818
9819 !!end
9820
9821 !!test
9822 Fuzz testing: image with bogus manual thumbnail
9823 !!input
9824 [[Image:foobar.jpg|thumbnail= ]]
9825 !!result
9826 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
9827
9828 !!end
9829
9830 !! test
9831 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
9832 !! input
9833 <pre dir="&#10;"></pre>
9834 !! result
9835 <pre dir="&#10;"></pre>
9836
9837 !! end
9838
9839 !! test
9840 Parsing optional HTML elements (Bug 6171)
9841 !! options
9842 !! input
9843 <table>
9844 <tr>
9845 <td> Some tabular data</td>
9846 <td> More tabular data ...
9847 <td> And yet som tabular data</td>
9848 </tr>
9849 </table>
9850 !! result
9851 <table>
9852 <tr>
9853 <td> Some tabular data</td>
9854 <td> More tabular data ...
9855 </td><td> And yet som tabular data</td>
9856 </tr>
9857 </table>
9858
9859 !! end
9860
9861 !! test
9862 Correct handling of <td>, <tr> (Bug 6171)
9863 !! options
9864 !! input
9865 <table>
9866 <tr>
9867 <td> Some tabular data</td>
9868 <td> More tabular data ...</td>
9869 <td> And yet som tabular data</td>
9870 </tr>
9871 </table>
9872 !! result
9873 <table>
9874 <tr>
9875 <td> Some tabular data</td>
9876 <td> More tabular data ...</td>
9877 <td> And yet som tabular data</td>
9878 </tr>
9879 </table>
9880
9881 !! end
9882
9883
9884 !! test
9885 Parsing crashing regression (fr:JavaScript)
9886 !! input
9887 </body></x>
9888 !! result
9889 <p>&lt;/body&gt;&lt;/x&gt;
9890 </p>
9891 !! end
9892
9893 !! test
9894 Inline wiki vs wiki block nesting
9895 !! input
9896 '''Bold paragraph
9897
9898 New wiki paragraph
9899 !! result
9900 <p><b>Bold paragraph</b>
9901 </p><p>New wiki paragraph
9902 </p>
9903 !! end
9904
9905 !! test
9906 Inline HTML vs wiki block nesting
9907 !! options
9908 disabled
9909 !! input
9910 <b>Bold paragraph
9911
9912 New wiki paragraph
9913 !! result
9914 <p><b>Bold paragraph</b>
9915 </p><p>New wiki paragraph
9916 </p>
9917 !! end
9918
9919 # Original result was this:
9920 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
9921 # </p>
9922 # While that might be marginally more intuitive, maybe, the six-apostrophe
9923 # construct is clearly pathological and the result stated here (which is what
9924 # the parser actually does) is about as reasonable as anything.
9925 !!test
9926 Mixing markup for italics and bold
9927 !! options
9928 !! input
9929 '''bold''''''bold''bolditalics'''''
9930 !! result
9931 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
9932 </p>
9933 !! end
9934
9935
9936 !! article
9937 Xyzzyx
9938 !! text
9939 Article for special page transclusion test
9940 !! endarticle
9941
9942 !! test
9943 Special page transclusion
9944 !! options
9945 !! input
9946 {{Special:Prefixindex/Xyzzyx}}
9947 !! result
9948 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9949
9950 !! end
9951
9952 !! test
9953 Special page transclusion twice (bug 5021)
9954 !! options
9955 !! input
9956 {{Special:Prefixindex/Xyzzyx}}
9957 {{Special:Prefixindex/Xyzzyx}}
9958 !! result
9959 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9960 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9961
9962 !! end
9963
9964 !! test
9965 Transclusion of default MediaWiki message
9966 !! input
9967 {{MediaWiki:Mainpage}}
9968 !!result
9969 <p>Main Page
9970 </p>
9971 !! end
9972
9973 !! test
9974 Transclusion of nonexistent MediaWiki message
9975 !! input
9976 {{MediaWiki:Mainpagexxx}}
9977 !!result
9978 <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>
9979 </p>
9980 !! end
9981
9982 !! test
9983 Transclusion of MediaWiki message with underscore
9984 !! input
9985 {{MediaWiki:history_short}}
9986 !! result
9987 <p>History
9988 </p>
9989 !! end
9990
9991 !! test
9992 Transclusion of MediaWiki message with space
9993 !! input
9994 {{MediaWiki:history short}}
9995 !! result
9996 <p>History
9997 </p>
9998 !! end
9999
10000 !! test
10001 Invalid header with following text
10002 !! input
10003 = x = y
10004 !! result
10005 <p>= x = y
10006 </p>
10007 !! end
10008
10009
10010 !! test
10011 Section extraction test (section 0)
10012 !! options
10013 section=0
10014 !! input
10015 start
10016 ==a==
10017 ===aa===
10018 ====aaa====
10019 ==b==
10020 ===ba===
10021 ===bb===
10022 ====bba====
10023 ===bc===
10024 ==c==
10025 ===ca===
10026 !! result
10027 start
10028 !! end
10029
10030 !! test
10031 Section extraction test (section 1)
10032 !! options
10033 section=1
10034 !! input
10035 start
10036 ==a==
10037 ===aa===
10038 ====aaa====
10039 ==b==
10040 ===ba===
10041 ===bb===
10042 ====bba====
10043 ===bc===
10044 ==c==
10045 ===ca===
10046 !! result
10047 ==a==
10048 ===aa===
10049 ====aaa====
10050 !! end
10051
10052 !! test
10053 Section extraction test (section 2)
10054 !! options
10055 section=2
10056 !! input
10057 start
10058 ==a==
10059 ===aa===
10060 ====aaa====
10061 ==b==
10062 ===ba===
10063 ===bb===
10064 ====bba====
10065 ===bc===
10066 ==c==
10067 ===ca===
10068 !! result
10069 ===aa===
10070 ====aaa====
10071 !! end
10072
10073 !! test
10074 Section extraction test (section 3)
10075 !! options
10076 section=3
10077 !! input
10078 start
10079 ==a==
10080 ===aa===
10081 ====aaa====
10082 ==b==
10083 ===ba===
10084 ===bb===
10085 ====bba====
10086 ===bc===
10087 ==c==
10088 ===ca===
10089 !! result
10090 ====aaa====
10091 !! end
10092
10093 !! test
10094 Section extraction test (section 4)
10095 !! options
10096 section=4
10097 !! input
10098 start
10099 ==a==
10100 ===aa===
10101 ====aaa====
10102 ==b==
10103 ===ba===
10104 ===bb===
10105 ====bba====
10106 ===bc===
10107 ==c==
10108 ===ca===
10109 !! result
10110 ==b==
10111 ===ba===
10112 ===bb===
10113 ====bba====
10114 ===bc===
10115 !! end
10116
10117 !! test
10118 Section extraction test (section 5)
10119 !! options
10120 section=5
10121 !! input
10122 start
10123 ==a==
10124 ===aa===
10125 ====aaa====
10126 ==b==
10127 ===ba===
10128 ===bb===
10129 ====bba====
10130 ===bc===
10131 ==c==
10132 ===ca===
10133 !! result
10134 ===ba===
10135 !! end
10136
10137 !! test
10138 Section extraction test (section 6)
10139 !! options
10140 section=6
10141 !! input
10142 start
10143 ==a==
10144 ===aa===
10145 ====aaa====
10146 ==b==
10147 ===ba===
10148 ===bb===
10149 ====bba====
10150 ===bc===
10151 ==c==
10152 ===ca===
10153 !! result
10154 ===bb===
10155 ====bba====
10156 !! end
10157
10158 !! test
10159 Section extraction test (section 7)
10160 !! options
10161 section=7
10162 !! input
10163 start
10164 ==a==
10165 ===aa===
10166 ====aaa====
10167 ==b==
10168 ===ba===
10169 ===bb===
10170 ====bba====
10171 ===bc===
10172 ==c==
10173 ===ca===
10174 !! result
10175 ====bba====
10176 !! end
10177
10178 !! test
10179 Section extraction test (section 8)
10180 !! options
10181 section=8
10182 !! input
10183 start
10184 ==a==
10185 ===aa===
10186 ====aaa====
10187 ==b==
10188 ===ba===
10189 ===bb===
10190 ====bba====
10191 ===bc===
10192 ==c==
10193 ===ca===
10194 !! result
10195 ===bc===
10196 !! end
10197
10198 !! test
10199 Section extraction test (section 9)
10200 !! options
10201 section=9
10202 !! input
10203 start
10204 ==a==
10205 ===aa===
10206 ====aaa====
10207 ==b==
10208 ===ba===
10209 ===bb===
10210 ====bba====
10211 ===bc===
10212 ==c==
10213 ===ca===
10214 !! result
10215 ==c==
10216 ===ca===
10217 !! end
10218
10219 !! test
10220 Section extraction test (section 10)
10221 !! options
10222 section=10
10223 !! input
10224 start
10225 ==a==
10226 ===aa===
10227 ====aaa====
10228 ==b==
10229 ===ba===
10230 ===bb===
10231 ====bba====
10232 ===bc===
10233 ==c==
10234 ===ca===
10235 !! result
10236 ===ca===
10237 !! end
10238
10239 !! test
10240 Section extraction test (nonexistent section 11)
10241 !! options
10242 section=11
10243 !! input
10244 start
10245 ==a==
10246 ===aa===
10247 ====aaa====
10248 ==b==
10249 ===ba===
10250 ===bb===
10251 ====bba====
10252 ===bc===
10253 ==c==
10254 ===ca===
10255 !! result
10256 !! end
10257
10258 !! test
10259 Section extraction test with bogus heading (section 1)
10260 !! options
10261 section=1
10262 !! input
10263 ==a==
10264 ==bogus== not a legal section
10265 ==b==
10266 !! result
10267 ==a==
10268 ==bogus== not a legal section
10269 !! end
10270
10271 !! test
10272 Section extraction test with bogus heading (section 2)
10273 !! options
10274 section=2
10275 !! input
10276 ==a==
10277 ==bogus== not a legal section
10278 ==b==
10279 !! result
10280 ==b==
10281 !! end
10282
10283 !! test
10284 Section extraction test with comment after heading (section 1)
10285 !! options
10286 section=1
10287 !! input
10288 ==a==
10289 ==b== <!-- -->
10290 ==c==
10291 !! result
10292 ==a==
10293 !! end
10294
10295 !! test
10296 Section extraction test with comment after heading (section 2)
10297 !! options
10298 section=2
10299 !! input
10300 ==a==
10301 ==b== <!-- -->
10302 ==c==
10303 !! result
10304 ==b== <!-- -->
10305 !! end
10306
10307 !! test
10308 Section extraction test with bogus <nowiki> heading (section 1)
10309 !! options
10310 section=1
10311 !! input
10312 ==a==
10313 ==bogus== <nowiki>not a legal section</nowiki>
10314 ==b==
10315 !! result
10316 ==a==
10317 ==bogus== <nowiki>not a legal section</nowiki>
10318 !! end
10319
10320 !! test
10321 Section extraction test with bogus <nowiki> heading (section 2)
10322 !! options
10323 section=2
10324 !! input
10325 ==a==
10326 ==bogus== <nowiki>not a legal section</nowiki>
10327 ==b==
10328 !! result
10329 ==b==
10330 !! end
10331
10332
10333 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
10334 # instead of respecting commented sections
10335 !! test
10336 Section extraction prefixed by comment (section 1)
10337 !! options
10338 section=1
10339 !! input
10340 <!-- -->==sec1==
10341 ==sec2==
10342 !!result
10343 ==sec2==
10344 !!end
10345
10346 !! test
10347 Section extraction prefixed by comment (section 2)
10348 !! options
10349 section=2
10350 !! input
10351 <!-- -->==sec1==
10352 ==sec2==
10353 !!result
10354
10355 !!end
10356
10357
10358 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
10359 # instead of respecting HTML-style headings
10360 !! test
10361 Section extraction, mixed wiki and html (section 1)
10362 !! options
10363 section=1
10364 !! input
10365 <h2>unmarked</h2>
10366 unmarked
10367 ==1==
10368 one
10369 ==2==
10370 two
10371 !! result
10372 ==1==
10373 one
10374 !! end
10375
10376 !! test
10377 Section extraction, mixed wiki and html (section 2)
10378 !! options
10379 section=2
10380 !! input
10381 <h2>unmarked</h2>
10382 unmarked
10383 ==1==
10384 one
10385 ==2==
10386 two
10387 !! result
10388 ==2==
10389 two
10390 !! end
10391
10392
10393 # Formerly testing for bug 3342
10394 !! test
10395 Section extraction, heading surrounded by <noinclude>
10396 !! options
10397 section=1
10398 !! input
10399 <noinclude>==unmarked==</noinclude>
10400 ==marked==
10401 !! result
10402 ==marked==
10403 !!end
10404
10405 # Test behavior of bug 19910
10406 !! test
10407 Sectiion with all-equals
10408 !! options
10409 section=2
10410 !! input
10411 ===
10412 The line above must have a trailing space
10413 === <!--
10414 --> <!-- -->
10415 But just in case it doesn't...
10416 !! result
10417 === <!--
10418 --> <!-- -->
10419 But just in case it doesn't...
10420 !! end
10421
10422 !! test
10423 Section replacement test (section 0)
10424 !! options
10425 replace=0,"xxx"
10426 !! input
10427 start
10428 ==a==
10429 ===aa===
10430 ====aaa====
10431 ==b==
10432 ===ba===
10433 ===bb===
10434 ====bba====
10435 ===bc===
10436 ==c==
10437 ===ca===
10438 !! result
10439 xxx
10440
10441 ==a==
10442 ===aa===
10443 ====aaa====
10444 ==b==
10445 ===ba===
10446 ===bb===
10447 ====bba====
10448 ===bc===
10449 ==c==
10450 ===ca===
10451 !! end
10452
10453 !! test
10454 Section replacement test (section 1)
10455 !! options
10456 replace=1,"xxx"
10457 !! input
10458 start
10459 ==a==
10460 ===aa===
10461 ====aaa====
10462 ==b==
10463 ===ba===
10464 ===bb===
10465 ====bba====
10466 ===bc===
10467 ==c==
10468 ===ca===
10469 !! result
10470 start
10471 xxx
10472
10473 ==b==
10474 ===ba===
10475 ===bb===
10476 ====bba====
10477 ===bc===
10478 ==c==
10479 ===ca===
10480 !! end
10481
10482 !! test
10483 Section replacement test (section 2)
10484 !! options
10485 replace=2,"xxx"
10486 !! input
10487 start
10488 ==a==
10489 ===aa===
10490 ====aaa====
10491 ==b==
10492 ===ba===
10493 ===bb===
10494 ====bba====
10495 ===bc===
10496 ==c==
10497 ===ca===
10498 !! result
10499 start
10500 ==a==
10501 xxx
10502
10503 ==b==
10504 ===ba===
10505 ===bb===
10506 ====bba====
10507 ===bc===
10508 ==c==
10509 ===ca===
10510 !! end
10511
10512 !! test
10513 Section replacement test (section 3)
10514 !! options
10515 replace=3,"xxx"
10516 !! input
10517 start
10518 ==a==
10519 ===aa===
10520 ====aaa====
10521 ==b==
10522 ===ba===
10523 ===bb===
10524 ====bba====
10525 ===bc===
10526 ==c==
10527 ===ca===
10528 !! result
10529 start
10530 ==a==
10531 ===aa===
10532 xxx
10533
10534 ==b==
10535 ===ba===
10536 ===bb===
10537 ====bba====
10538 ===bc===
10539 ==c==
10540 ===ca===
10541 !! end
10542
10543 !! test
10544 Section replacement test (section 4)
10545 !! options
10546 replace=4,"xxx"
10547 !! input
10548 start
10549 ==a==
10550 ===aa===
10551 ====aaa====
10552 ==b==
10553 ===ba===
10554 ===bb===
10555 ====bba====
10556 ===bc===
10557 ==c==
10558 ===ca===
10559 !! result
10560 start
10561 ==a==
10562 ===aa===
10563 ====aaa====
10564 xxx
10565
10566 ==c==
10567 ===ca===
10568 !! end
10569
10570 !! test
10571 Section replacement test (section 5)
10572 !! options
10573 replace=5,"xxx"
10574 !! input
10575 start
10576 ==a==
10577 ===aa===
10578 ====aaa====
10579 ==b==
10580 ===ba===
10581 ===bb===
10582 ====bba====
10583 ===bc===
10584 ==c==
10585 ===ca===
10586 !! result
10587 start
10588 ==a==
10589 ===aa===
10590 ====aaa====
10591 ==b==
10592 xxx
10593
10594 ===bb===
10595 ====bba====
10596 ===bc===
10597 ==c==
10598 ===ca===
10599 !! end
10600
10601 !! test
10602 Section replacement test (section 6)
10603 !! options
10604 replace=6,"xxx"
10605 !! input
10606 start
10607 ==a==
10608 ===aa===
10609 ====aaa====
10610 ==b==
10611 ===ba===
10612 ===bb===
10613 ====bba====
10614 ===bc===
10615 ==c==
10616 ===ca===
10617 !! result
10618 start
10619 ==a==
10620 ===aa===
10621 ====aaa====
10622 ==b==
10623 ===ba===
10624 xxx
10625
10626 ===bc===
10627 ==c==
10628 ===ca===
10629 !! end
10630
10631 !! test
10632 Section replacement test (section 7)
10633 !! options
10634 replace=7,"xxx"
10635 !! input
10636 start
10637 ==a==
10638 ===aa===
10639 ====aaa====
10640 ==b==
10641 ===ba===
10642 ===bb===
10643 ====bba====
10644 ===bc===
10645 ==c==
10646 ===ca===
10647 !! result
10648 start
10649 ==a==
10650 ===aa===
10651 ====aaa====
10652 ==b==
10653 ===ba===
10654 ===bb===
10655 xxx
10656
10657 ===bc===
10658 ==c==
10659 ===ca===
10660 !! end
10661
10662 !! test
10663 Section replacement test (section 8)
10664 !! options
10665 replace=8,"xxx"
10666 !! input
10667 start
10668 ==a==
10669 ===aa===
10670 ====aaa====
10671 ==b==
10672 ===ba===
10673 ===bb===
10674 ====bba====
10675 ===bc===
10676 ==c==
10677 ===ca===
10678 !! result
10679 start
10680 ==a==
10681 ===aa===
10682 ====aaa====
10683 ==b==
10684 ===ba===
10685 ===bb===
10686 ====bba====
10687 xxx
10688
10689 ==c==
10690 ===ca===
10691 !!end
10692
10693 !! test
10694 Section replacement test (section 9)
10695 !! options
10696 replace=9,"xxx"
10697 !! input
10698 start
10699 ==a==
10700 ===aa===
10701 ====aaa====
10702 ==b==
10703 ===ba===
10704 ===bb===
10705 ====bba====
10706 ===bc===
10707 ==c==
10708 ===ca===
10709 !! result
10710 start
10711 ==a==
10712 ===aa===
10713 ====aaa====
10714 ==b==
10715 ===ba===
10716 ===bb===
10717 ====bba====
10718 ===bc===
10719 xxx
10720 !! end
10721
10722 !! test
10723 Section replacement test (section 10)
10724 !! options
10725 replace=10,"xxx"
10726 !! input
10727 start
10728 ==a==
10729 ===aa===
10730 ====aaa====
10731 ==b==
10732 ===ba===
10733 ===bb===
10734 ====bba====
10735 ===bc===
10736 ==c==
10737 ===ca===
10738 !! result
10739 start
10740 ==a==
10741 ===aa===
10742 ====aaa====
10743 ==b==
10744 ===ba===
10745 ===bb===
10746 ====bba====
10747 ===bc===
10748 ==c==
10749 xxx
10750 !! end
10751
10752 !! test
10753 Section replacement test with initial whitespace (bug 13728)
10754 !! options
10755 replace=2,"xxx"
10756 !! input
10757 Preformatted initial line
10758 ==a==
10759 ===a===
10760 !! result
10761 Preformatted initial line
10762 ==a==
10763 xxx
10764 !! end
10765
10766
10767 !! test
10768 Section extraction, heading followed by pre with 20 spaces (bug 6398)
10769 !! options
10770 section=1
10771 !! input
10772 ==a==
10773 a
10774 !! result
10775 ==a==
10776 a
10777 !! end
10778
10779 !! test
10780 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
10781 !! options
10782 section=1
10783 !! input
10784 ==a==
10785 a
10786 !! result
10787 ==a==
10788 a
10789 !! end
10790
10791
10792 !! test
10793 Section extraction, <pre> around bogus header (bug 10309)
10794 !! options
10795 noxml section=2
10796 !! input
10797 == Section One ==
10798 <pre>
10799 =======
10800 </pre>
10801
10802 == Section Two ==
10803 stuff
10804 !! result
10805 == Section Two ==
10806 stuff
10807 !! end
10808
10809 !! test
10810 Section replacement, <pre> around bogus header (bug 10309)
10811 !! options
10812 noxml replace=2,"xxx"
10813 !! input
10814 == Section One ==
10815 <pre>
10816 =======
10817 </pre>
10818
10819 == Section Two ==
10820 stuff
10821 !! result
10822 == Section One ==
10823 <pre>
10824 =======
10825 </pre>
10826
10827 xxx
10828 !! end
10829
10830
10831
10832 !! test
10833 Handling of &#x0A; in URLs
10834 !! input
10835 **irc://&#x0A;a
10836 !! result
10837 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
10838 </li></ul>
10839 </li></ul>
10840
10841 !!end
10842
10843 !! test
10844 5 quotes, code coverage +1 line (php)
10845 !! options
10846 php
10847 !! input
10848 '''''
10849 !! result
10850 !! end
10851 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
10852 !! test
10853 5 quotes, code coverage +1 line (parsoid)
10854 !! options
10855 parsoid
10856 !! input
10857 '''''
10858 !! result
10859 <p><i><b></b></i></p>
10860 !! end
10861
10862 !! test
10863 Special:Search page linking.
10864 !! input
10865 {{Special:search}}
10866 !! result
10867 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
10868 </p>
10869 !! end
10870
10871 !! test
10872 Say the magic word
10873 !! input
10874 * {{PAGENAME}}
10875 * {{BASEPAGENAME}}
10876 * {{SUBPAGENAME}}
10877 * {{SUBPAGENAMEE}}
10878 * {{BASEPAGENAME}}
10879 * {{BASEPAGENAMEE}}
10880 * {{TALKPAGENAME}}
10881 * {{TALKPAGENAMEE}}
10882 * {{SUBJECTPAGENAME}}
10883 * {{SUBJECTPAGENAMEE}}
10884 * {{NAMESPACEE}}
10885 * {{NAMESPACE}}
10886 * {{TALKSPACE}}
10887 * {{TALKSPACEE}}
10888 * {{SUBJECTSPACE}}
10889 * {{SUBJECTSPACEE}}
10890 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
10891 !! result
10892 <ul><li> Parser test
10893 </li><li> Parser test
10894 </li><li> Parser test
10895 </li><li> Parser_test
10896 </li><li> Parser test
10897 </li><li> Parser_test
10898 </li><li> Talk:Parser test
10899 </li><li> Talk:Parser_test
10900 </li><li> Parser test
10901 </li><li> Parser_test
10902 </li><li>
10903 </li><li>
10904 </li><li> Talk
10905 </li><li> Talk
10906 </li><li>
10907 </li><li>
10908 </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>
10909 </li></ul>
10910
10911 !! end
10912 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
10913
10914 !! test
10915 Gallery
10916 !! input
10917 <gallery>
10918 image1.png |
10919 image2.gif|||||
10920
10921 image3|
10922 image4 |300px| centre
10923 image5.svg| http://///////
10924 [[x|xx]]]]
10925 * image6
10926 </gallery>
10927 !! result
10928 <ul class="gallery">
10929 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10930 <div style="height: 150px;">Image1.png</div>
10931 <div class="gallerytext">
10932 </div>
10933 </div></li>
10934 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10935 <div style="height: 150px;">Image2.gif</div>
10936 <div class="gallerytext">
10937 <p>||||
10938 </p>
10939 </div>
10940 </div></li>
10941 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10942 <div style="height: 150px;">Image3</div>
10943 <div class="gallerytext">
10944 </div>
10945 </div></li>
10946 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10947 <div style="height: 150px;">Image4</div>
10948 <div class="gallerytext">
10949 <p>300px| centre
10950 </p>
10951 </div>
10952 </div></li>
10953 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10954 <div style="height: 150px;">Image5.svg</div>
10955 <div class="gallerytext">
10956 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
10957 </p>
10958 </div>
10959 </div></li>
10960 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10961 <div style="height: 150px;">* image6</div>
10962 <div class="gallerytext">
10963 </div>
10964 </div></li>
10965 </ul>
10966
10967 !! end
10968
10969 !! test
10970 Gallery (with options)
10971 !! input
10972 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
10973 File:Nonexistant.jpg|caption
10974 File:Nonexistant.jpg
10975 image:foobar.jpg|some '''caption''' [[Main Page]]
10976 image:foobar.jpg
10977 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
10978 </gallery>
10979 !! result
10980 <ul class="gallery" style="max-width: 226px;_width: 226px;">
10981 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
10982 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10983 <div style="height: 70px;">Nonexistant.jpg</div>
10984 <div class="gallerytext">
10985 <p>caption
10986 </p>
10987 </div>
10988 </div></li>
10989 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10990 <div style="height: 70px;">Nonexistant.jpg</div>
10991 <div class="gallerytext">
10992 </div>
10993 </div></li>
10994 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10995 <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>
10996 <div class="gallerytext">
10997 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10998 </p>
10999 </div>
11000 </div></li>
11001 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11002 <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>
11003 <div class="gallerytext">
11004 </div>
11005 </div></li>
11006 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11007 <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>
11008 <div class="gallerytext">
11009 <p>Blabla|blabla.
11010 </p>
11011 </div>
11012 </div></li>
11013 </ul>
11014
11015 !! end
11016
11017 !! test
11018 Gallery with wikitext inside caption
11019 !! input
11020 <gallery>
11021 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
11022 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
11023 </gallery>
11024 !! result
11025 <ul class="gallery">
11026 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11027 <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>
11028 <div class="gallerytext">
11029 <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>
11030 </p>
11031 </div>
11032 </div></li>
11033 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11034 <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>
11035 <div class="gallerytext">
11036 <p>This is a test template
11037 </p>
11038 </div>
11039 </div></li>
11040 </ul>
11041
11042 !! end
11043
11044 !! test
11045 gallery (with showfilename option)
11046 !! input
11047 <gallery showfilename>
11048 File:Nonexistant.jpg|caption
11049 File:Nonexistant.jpg
11050 image:foobar.jpg|some '''caption''' [[Main Page]]
11051 File:Foobar.jpg
11052 </gallery>
11053 !! result
11054 <ul class="gallery">
11055 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11056 <div style="height: 150px;">Nonexistant.jpg</div>
11057 <div class="gallerytext">
11058 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11059 caption
11060 </p>
11061 </div>
11062 </div></li>
11063 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11064 <div style="height: 150px;">Nonexistant.jpg</div>
11065 <div class="gallerytext">
11066 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11067 </p>
11068 </div>
11069 </div></li>
11070 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11071 <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>
11072 <div class="gallerytext">
11073 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11074 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11075 </p>
11076 </div>
11077 </div></li>
11078 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11079 <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>
11080 <div class="gallerytext">
11081 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11082 </p>
11083 </div>
11084 </div></li>
11085 </ul>
11086
11087 !! end
11088
11089 !! test
11090 Gallery (with namespace-less filenames)
11091 !! input
11092 <gallery>
11093 File:Nonexistant.jpg
11094 Nonexistant.jpg
11095 image:foobar.jpg
11096 foobar.jpg
11097 </gallery>
11098 !! result
11099 <ul class="gallery">
11100 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11101 <div style="height: 150px;">Nonexistant.jpg</div>
11102 <div class="gallerytext">
11103 </div>
11104 </div></li>
11105 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11106 <div style="height: 150px;">Nonexistant.jpg</div>
11107 <div class="gallerytext">
11108 </div>
11109 </div></li>
11110 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11111 <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>
11112 <div class="gallerytext">
11113 </div>
11114 </div></li>
11115 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11116 <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>
11117 <div class="gallerytext">
11118 </div>
11119 </div></li>
11120 </ul>
11121
11122 !! end
11123
11124 !! test
11125 HTML Hex character encoding (spells the word "JavaScript")
11126 !! input
11127 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
11128 !! result
11129 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
11130 </p>
11131 !! end
11132
11133 !! test
11134 HTML Hex character encoding bogus encoding (bug 26437 regression check)
11135 !! input
11136 &#xsee;&#XSEE;
11137 !! result
11138 <p>&amp;#xsee;&amp;#XSEE;
11139 </p>
11140 !! end
11141
11142 !! test
11143 HTML Hex character encoding mixed case
11144 !! input
11145 &#xEE;&#Xee;
11146 !! result
11147 <p>&#xee;&#xee;
11148 </p>
11149 !! end
11150
11151 !! test
11152 __FORCETOC__ override
11153 !! input
11154 __NEWSECTIONLINK__
11155 __FORCETOC__
11156 !! result
11157 <p><br />
11158 </p>
11159 !! end
11160
11161 !! test
11162 ISBN code coverage
11163 !! input
11164 ISBN 978-0-1234-56&#x20;789
11165 !! result
11166 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
11167 </p>
11168 !! end
11169
11170 !! test
11171 ISBN followed by 5 spaces
11172 !! input
11173 ISBN
11174 !! result
11175 <p>ISBN
11176 </p>
11177 !! end
11178
11179 !! test
11180 Double ISBN
11181 !! input
11182 ISBN ISBN 1234567890
11183 !! result
11184 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
11185 </p>
11186 !! end
11187
11188 !! test
11189 Bug 22905: <abbr> followed by ISBN followed by </a>
11190 !! input
11191 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
11192 !! result
11193 <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>
11194 </p>
11195 !! end
11196
11197 !! test
11198 Double RFC
11199 !! input
11200 RFC RFC 1234
11201 !! result
11202 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
11203 </p>
11204 !! end
11205
11206 !! test
11207 Double RFC with a wiki link
11208 !! input
11209 RFC [[RFC 1234]]
11210 !! result
11211 <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>
11212 </p>
11213 !! end
11214
11215 !! test
11216 RFC code coverage
11217 !! input
11218 RFC 983&#x20;987
11219 !! result
11220 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
11221 </p>
11222 !! end
11223
11224 !! test
11225 Centre-aligned image
11226 !! input
11227 [[Image:foobar.jpg|centre]]
11228 !! result
11229 <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>
11230
11231 !!end
11232
11233 !! test
11234 None-aligned image
11235 !! input
11236 [[Image:foobar.jpg|none]]
11237 !! result
11238 <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>
11239
11240 !!end
11241
11242 !! test
11243 Width + Height sized image (using px) (height is ignored)
11244 !! input
11245 [[Image:foobar.jpg|640x480px]]
11246 !! result
11247 <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>
11248 </p>
11249 !!end
11250
11251 !! test
11252 Width-sized image (using px, no following whitespace)
11253 !! input
11254 [[Image:foobar.jpg|640px]]
11255 !! result
11256 <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>
11257 </p>
11258 !!end
11259
11260 !! test
11261 Width-sized image (using px, with following whitespace - test regression from r39467)
11262 !! input
11263 [[Image:foobar.jpg|640px ]]
11264 !! result
11265 <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>
11266 </p>
11267 !!end
11268
11269 !! test
11270 Width-sized image (using px, with preceding whitespace - test regression from r39467)
11271 !! input
11272 [[Image:foobar.jpg| 640px]]
11273 !! result
11274 <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>
11275 </p>
11276 !!end
11277
11278 !! test
11279 Another italics / bold test
11280 !! input
11281 ''' ''x'
11282 !! result
11283 <pre>'<i> </i>x'
11284 </pre>
11285 !!end
11286
11287 # Note the results may be incorrect, as parserTest output included this:
11288 # XML error: Mismatched tag at byte 6120:
11289 # ...<dd> </dt></dl> </dd...
11290 !! test
11291 dt/dd/dl test
11292 !! options
11293 disabled
11294 !! input
11295 :;;;::
11296 !! result
11297 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
11298 </dd></dl>
11299 </dd></dl>
11300 </dt></dl>
11301 </dt></dl>
11302 </dt></dl>
11303 </dd></dl>
11304
11305 !!end
11306
11307
11308 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
11309 !! test
11310 Images with the "|" character in the comment
11311 !! input
11312 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
11313 !! result
11314 <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>
11315
11316 !!end
11317
11318 !! test
11319 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
11320 !! input
11321 <html><script>alert(1);</script></html>
11322 !! result
11323 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
11324 </p>
11325 !! end
11326
11327 !! test
11328 HTML with raw HTML ($wgRawHtml==true)
11329 !! options
11330 rawhtml
11331 !! input
11332 <html><script>alert(1);</script></html>
11333 !! result
11334 <p><script>alert(1);</script>
11335 </p>
11336 !! end
11337
11338 !! test
11339 Parents of subpages, one level up
11340 !! options
11341 subpage title=[[Subpage test/L1/L2/L3]]
11342 !! input
11343 [[../|L2]]
11344 !! result
11345 <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>
11346 </p>
11347 !! end
11348
11349
11350 !! test
11351 Parents of subpages, one level up, not named
11352 !! options
11353 subpage title=[[Subpage test/L1/L2/L3]]
11354 !! input
11355 [[../]]
11356 !! result
11357 <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>
11358 </p>
11359 !! end
11360
11361
11362
11363 !! test
11364 Parents of subpages, two levels up
11365 !! options
11366 subpage title=[[Subpage test/L1/L2/L3]]
11367 !! input
11368 [[../../|L1]]2
11369
11370 [[../../|L1]]l
11371 !! result
11372 <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
11373 </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>
11374 </p>
11375 !! end
11376
11377 !! test
11378 Parents of subpages, two levels up, without trailing slash or name.
11379 !! options
11380 subpage title=[[Subpage test/L1/L2/L3]]
11381 !! input
11382 [[../..]]
11383 !! result
11384 <p>[[../..]]
11385 </p>
11386 !! end
11387
11388 !! test
11389 Parents of subpages, two levels up, with lots of extra trailing slashes.
11390 !! options
11391 subpage title=[[Subpage test/L1/L2/L3]]
11392 !! input
11393 [[../../////]]
11394 !! result
11395 <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>
11396 </p>
11397 !! end
11398
11399 !! test
11400 Definition list code coverage
11401 !! input
11402 ; title : def
11403 ; title : def
11404 ;title: def
11405 !! result
11406 <dl><dt> title &#160;</dt><dd> def
11407 </dd><dt> title&#160;</dt><dd> def
11408 </dd><dt>title</dt><dd> def
11409 </dd></dl>
11410
11411 !! end
11412
11413 !! test
11414 Don't fall for the self-closing div
11415 !! input
11416 <div>hello world</div/>
11417 !! result
11418 <div>hello world</div>
11419
11420 !! end
11421
11422 !! test
11423 MSGNW magic word
11424 !! input
11425 {{MSGNW:msg}}
11426 !! result
11427 <p>&#91;&#91;:Template:Msg&#93;&#93;
11428 </p>
11429 !! end
11430
11431 !! test
11432 RAW magic word
11433 !! input
11434 {{RAW:QUERTY}}
11435 !! result
11436 <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>
11437 </p>
11438 !! end
11439
11440 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
11441 !! test
11442 Always escape literal '>' in output, not just after '<'
11443 !! input
11444 ><>
11445 !! result
11446 <p>&gt;&lt;&gt;
11447 </p>
11448 !! end
11449
11450 !! test
11451 Template caching
11452 !! input
11453 {{Test}}
11454 {{Test}}
11455 !! result
11456 <p>This is a test template
11457 This is a test template
11458 </p>
11459 !! end
11460
11461
11462 !! article
11463 MediaWiki:Fake
11464 !! text
11465 ==header==
11466 !! endarticle
11467
11468 !! test
11469 Inclusion of !userCanEdit() content
11470 !! input
11471 {{MediaWiki:Fake}}
11472 !! result
11473 <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>
11474
11475 !! end
11476
11477
11478 !! test
11479 Out-of-order TOC heading levels
11480 !! input
11481 ==2==
11482 ======6======
11483 ===3===
11484 =1=
11485 =====5=====
11486 ==2==
11487 !! result
11488 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11489 <ul>
11490 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
11491 <ul>
11492 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
11493 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
11494 </ul>
11495 </li>
11496 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
11497 <ul>
11498 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
11499 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
11500 </ul>
11501 </li>
11502 </ul>
11503 </td></tr></table>
11504 <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>
11505 <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>
11506 <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>
11507 <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>
11508 <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>
11509 <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>
11510
11511 !! end
11512
11513
11514 !! test
11515 ISBN with a dummy number
11516 !! input
11517 ISBN ---
11518 !! result
11519 <p>ISBN ---
11520 </p>
11521 !! end
11522
11523
11524 !! test
11525 ISBN with space-delimited number
11526 !! input
11527 ISBN 92 9017 032 8
11528 !! result
11529 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
11530 </p>
11531 !! end
11532
11533
11534 !! test
11535 ISBN with multiple spaces, no number
11536 !! input
11537 ISBN foo
11538 !! result
11539 <p>ISBN foo
11540 </p>
11541 !! end
11542
11543
11544 !! test
11545 ISBN length
11546 !! input
11547 ISBN 123456789
11548
11549 ISBN 1234567890
11550
11551 ISBN 12345678901
11552 !! result
11553 <p>ISBN 123456789
11554 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
11555 </p><p>ISBN 12345678901
11556 </p>
11557 !! end
11558
11559
11560 !! test
11561 ISBN with trailing year (bug 8110)
11562 !! input
11563 ISBN 1-234-56789-0 - 2006
11564
11565 ISBN 1 234 56789 0 - 2006
11566 !! result
11567 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
11568 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
11569 </p>
11570 !! end
11571
11572
11573 !! test
11574 anchorencode
11575 !! input
11576 {{anchorencode:foo bar©#%n}}
11577 !! result
11578 <p>foo_bar.C2.A9.23.25n
11579 </p>
11580 !! end
11581
11582 !! test
11583 anchorencode trims spaces
11584 !! input
11585 {{anchorencode: __pretty__please__}}
11586 !! result
11587 <p>pretty_please
11588 </p>
11589 !! end
11590
11591 !! test
11592 anchorencode deals with links
11593 !! input
11594 {{anchorencode: [[hello|world]] [[hi]]}}
11595 !! result
11596 <p>world_hi
11597 </p>
11598 !! end
11599
11600 !! test
11601 anchorencode deals with templates
11602 !! input
11603 {{anchorencode: {{Foo}} }}
11604 !! result
11605 <p>FOO
11606 </p>
11607 !! end
11608
11609 !! test
11610 anchorencode encodes like the TOC generator: (bug 18431)
11611 !! input
11612 === _ +:.3A%3A&&amp;]] ===
11613 {{anchorencode: _ +:.3A%3A&&amp;]] }}
11614 __NOEDITSECTION__
11615 !! result
11616 <h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
11617 <p>.2B:.3A.253A.26.26.5D.5D
11618 </p>
11619 !! end
11620
11621 # Expected output in the following test is not necessarily expected (there
11622 # should probably be <p> tags inside the <blockquote> in the output) -- it's
11623 # only testing for well-formedness.
11624 !! test
11625 Bug 6200: blockquotes and paragraph formatting
11626 !! input
11627 <blockquote>
11628 foo
11629 </blockquote>
11630
11631 bar
11632
11633 baz
11634 !! result
11635 <blockquote>
11636 foo
11637 </blockquote>
11638 <p>bar
11639 </p>
11640 <pre>baz
11641 </pre>
11642 !! end
11643
11644 !! test
11645 Bug 8293: Use of center tag ruins paragraph formatting
11646 !! input
11647 <center>
11648 foo
11649 </center>
11650
11651 bar
11652
11653 baz
11654 !! result
11655 <center>
11656 <p>foo
11657 </p>
11658 </center>
11659 <p>bar
11660 </p>
11661 <pre>baz
11662 </pre>
11663 !! end
11664
11665
11666 ###
11667 ### Language variants related tests
11668 ###
11669 !! test
11670 Self-link in language variants
11671 !! options
11672 title=[[Dunav]] language=sr
11673 !! input
11674 Both [[Dunav]] and [[Дунав]] are names for this river.
11675 !! result
11676 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
11677 </p>
11678 !!end
11679
11680 !! article
11681 Дуна
11682 !! text
11683 content
11684 !! endarticle
11685
11686 !! test
11687 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
11688 !! options
11689 title=[[Duna]] language=sr
11690 !! input
11691 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
11692 !! result
11693 <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.
11694 </p>
11695 !! end
11696
11697 !! test
11698 Link to pages in language variants
11699 !! options
11700 language=sr
11701 !! input
11702 Main Page can be written as [[Маин Паге]]
11703 !! result
11704 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
11705 </p>
11706 !!end
11707
11708
11709 !! test
11710 Multiple links to pages in language variants
11711 !! options
11712 language=sr
11713 !! input
11714 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
11715 !! result
11716 <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>.
11717 </p>
11718 !!end
11719
11720
11721 !! test
11722 Simple template in language variants
11723 !! options
11724 language=sr
11725 !! input
11726 {{тест}}
11727 !! result
11728 <p>This is a test template
11729 </p>
11730 !! end
11731
11732
11733 !! test
11734 Template with explicit namespace in language variants
11735 !! options
11736 language=sr
11737 !! input
11738 {{Template:тест}}
11739 !! result
11740 <p>This is a test template
11741 </p>
11742 !! end
11743
11744
11745 !! test
11746 Basic test for template parameter in language variants
11747 !! options
11748 language=sr
11749 !! input
11750 {{парамтест|param=foo}}
11751 !! result
11752 <p>This is a test template with parameter foo
11753 </p>
11754 !! end
11755
11756
11757 !! test
11758 Simple category in language variants
11759 !! options
11760 language=sr cat
11761 !! input
11762 [[Category:МедиаWики Усер'с Гуиде]]
11763 !! result
11764 <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>
11765 !! end
11766
11767
11768 !! article
11769 Category:分类
11770 !! text
11771 blah
11772 !! endarticle
11773
11774 !! article
11775 Category:分類
11776 !! text
11777 blah
11778 !! endarticle
11779
11780 !! test
11781 Don't convert blue categorylinks to another variant (bug 33210)
11782 !! options
11783 language=zh cat
11784 !! input
11785 [[A]][[Category:分类]]
11786 !! result
11787 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
11788 !! end
11789
11790
11791 !! test
11792 Stripping -{}- tags (language variants)
11793 !! options
11794 language=sr
11795 !! input
11796 Latin proverb: -{Ne nuntium necare}-
11797 !! result
11798 <p>Latin proverb: Ne nuntium necare
11799 </p>
11800 !! end
11801
11802
11803 !! test
11804 Prevent conversion with -{}- tags (language variants)
11805 !! options
11806 language=sr variant=sr-ec
11807 !! input
11808 Latinski: -{Ne nuntium necare}-
11809 !! result
11810 <p>Латински: Ne nuntium necare
11811 </p>
11812 !! end
11813
11814
11815 !! test
11816 Prevent conversion of text with -{}- tags (language variants)
11817 !! options
11818 language=sr variant=sr-ec
11819 !! input
11820 Latinski: -{Ne nuntium necare}-
11821 !! result
11822 <p>Латински: Ne nuntium necare
11823 </p>
11824 !! end
11825
11826
11827 !! test
11828 Prevent conversion of links with -{}- tags (language variants)
11829 !! options
11830 language=sr variant=sr-ec
11831 !! input
11832 -{[[Main Page]]}-
11833 !! result
11834 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11835 </p>
11836 !! end
11837
11838
11839 !! test
11840 -{}- tags within headlines (within html for parserConvert())
11841 !! options
11842 language=sr variant=sr-ec
11843 !! input
11844 == -{Naslov}- ==
11845 !! result
11846 <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>
11847
11848 !! end
11849
11850
11851 !! test
11852 Explicit definition of language variant alternatives
11853 !! options
11854 language=zh variant=zh-tw
11855 !! input
11856 -{zh:China;zh-tw:Taiwan}-, not China
11857 !! result
11858 <p>Taiwan, not China
11859 </p>
11860 !! end
11861
11862
11863 !! test
11864 Conversion around HTML tags
11865 !! options
11866 language=sr variant=sr-ec
11867 !! input
11868 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
11869 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
11870 !! result
11871 <p>
11872 <span title="ЛаCтин">ски</span>
11873 </p>
11874 !! end
11875
11876
11877 !! test
11878 Explicit session-wise language variant mapping (A flag and - flag)
11879 !! options
11880 language=zh variant=zh-tw
11881 !! input
11882 Taiwan is not China.
11883 But -{A|zh:China;zh-tw:Taiwan}- is China,
11884 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
11885 and -{China}- is China.
11886 !! result
11887 <p>Taiwan is not China.
11888 But Taiwan is Taiwan,
11889 (This should be stripped!)
11890 and China is China.
11891 </p>
11892 !! end
11893
11894 !! test
11895 Explicit session-wise language variant mapping (H flag for hide)
11896 !! options
11897 language=zh variant=zh-tw
11898 !! input
11899 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
11900 Taiwan is China.
11901 !! result
11902 <p>(This should be stripped!)
11903 Taiwan is Taiwan.
11904 </p>
11905 !! end
11906
11907 !! test
11908 Adding explicit conversion rule for title (T flag)
11909 !! options
11910 language=zh variant=zh-tw showtitle
11911 !! input
11912 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
11913 !! result
11914 Taiwan
11915 <p>Should be stripped!
11916 </p>
11917 !! end
11918
11919 !! test
11920 Testing that changing the language variant here in the tests actually works
11921 !! options
11922 language=zh variant=zh showtitle
11923 !! input
11924 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
11925 !! result
11926 China
11927 <p>Should be stripped!
11928 </p>
11929 !! end
11930
11931 !! test
11932 Recursive conversion of alt and title attrs shouldn't clear converter state
11933 !! options
11934 language=zh variant=zh-cn showtitle
11935 !! input
11936 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
11937 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
11938 !! result
11939 China
11940 <p>
11941 Should be stripped<span title="Exclamation">!</span>
11942 </p>
11943 !! end
11944
11945 !! test
11946 Bug 24072: more test on conversion rule for title
11947 !! options
11948 language=zh variant=zh-tw showtitle
11949 !! input
11950 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
11951 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
11952 !! result
11953 Taiwan
11954 <p>This should be stripped!
11955 This won't take interferes with the title rule.
11956 </p>
11957 !! end
11958
11959 !! test
11960 Raw output of variant escape tags (R flag)
11961 !! options
11962 language=zh variant=zh-tw
11963 !! input
11964 Raw: -{R|zh:China;zh-tw:Taiwan}-
11965 !! result
11966 <p>Raw: zh:China;zh-tw:Taiwan
11967 </p>
11968 !! end
11969
11970 !! test
11971 Nested using of manual convert syntax
11972 !! options
11973 language=zh variant=zh-hk
11974 !! input
11975 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
11976 !! result
11977 <p>Nested: Hello Hong Kong!
11978 </p>
11979 !! end
11980
11981 !! test
11982 Proper conversion of text in external links
11983 !! options
11984 language=sr variant=sr-ec
11985 !! input
11986 http://www.google.com
11987 gopher://www.google.com
11988 [http://www.google.com http://www.google.com]
11989 [gopher://www.google.com gopher://www.google.com]
11990 [https://www.google.com irc://www.google.com]
11991 [ftp://www.google.com www.google.com/ftp://dir]
11992 [//www.google.com www.google.com]
11993 !! result
11994 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
11995 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
11996 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
11997 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
11998 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
11999 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
12000 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
12001 </p>
12002 !! end
12003
12004 !! test
12005 Do not convert roman numbers to language variants
12006 !! options
12007 language=sr variant=sr-ec
12008 !! input
12009 Fridrih IV je car.
12010 !! result
12011 <p>Фридрих IV је цар.
12012 </p>
12013 !! end
12014
12015 !! test
12016 Unclosed language converter markup "-{"
12017 !! options
12018 language=sr
12019 !! input
12020 -{T|hello
12021 !! result
12022 <p>-{T|hello
12023 </p>
12024 !! end
12025
12026 !! test
12027 Don't convert raw rule "-{R|=&gt;}-" to "=>"
12028 !! options
12029 language=sr
12030 !! input
12031 -{R|=&gt;}-
12032 !! result
12033 <p>=&gt;
12034 </p>
12035 !!end
12036
12037 !!article
12038 Template:Bullet
12039 !!text
12040 * Bar
12041 !!endarticle
12042
12043 !! test
12044 Bug 529: Uncovered bullet
12045 !! input
12046 * Foo {{bullet}}
12047 !! result
12048 <ul><li> Foo
12049 </li><li> Bar
12050 </li></ul>
12051
12052 !! end
12053
12054 # Plain MediaWiki does not remove empty lists, but tidy actually does.
12055 # Templates in Wikipedia rely on this behavior, as tidy has always been
12056 # enabled there. These tests are normally run *without* tidy, so specify the
12057 # full output here.
12058 # To test realistic parsing behavior, apply a tidy-like transformation to both
12059 # the expected output and your parser's output.
12060 !! test
12061 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
12062 !! input
12063 ******* Foo {{bullet}}
12064 !! result
12065 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
12066 </li></ul>
12067 </li></ul>
12068 </li></ul>
12069 </li></ul>
12070 </li></ul>
12071 </li></ul>
12072 </li><li> Bar
12073 </li></ul>
12074
12075 !! end
12076
12077 !! test
12078 Bug 529: Uncovered table already at line-start
12079 !! input
12080 x
12081
12082 {{table}}
12083 y
12084 !! result
12085 <p>x
12086 </p>
12087 <table>
12088 <tr>
12089 <td> 1 </td>
12090 <td> 2
12091 </td></tr>
12092 <tr>
12093 <td> 3 </td>
12094 <td> 4
12095 </td></tr></table>
12096 <p>y
12097 </p>
12098 !! end
12099
12100 !! test
12101 Bug 529: Uncovered bullet in parser function result
12102 !! input
12103 * Foo {{lc:{{bullet}} }}
12104 !! result
12105 <ul><li> Foo
12106 </li><li> bar
12107 </li></ul>
12108
12109 !! end
12110
12111 !! test
12112 Bug 5678: Double-parsed template argument
12113 !! input
12114 {{lc:{{{1}}}|hello}}
12115 !! result
12116 <p>{{{1}}}
12117 </p>
12118 !! end
12119
12120 !! test
12121 Bug 5678: Double-parsed template invocation
12122 !! input
12123 {{lc:{{paramtest {{!}} param = hello }} }}
12124 !! result
12125 <p>{{paramtest | param = hello }}
12126 </p>
12127 !! end
12128
12129 !! test
12130 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
12131 !! options
12132 language=cs
12133 title=[[Main Page]]
12134 !! input
12135 {{PRVNÍVELKÉ:ěščř}}
12136 {{prvnívelké:ěščř}}
12137 {{PRVNÍMALÉ:ěščř}}
12138 {{prvnímalé:ěščř}}
12139 {{MALÁ:ěščř}}
12140 {{malá:ěščř}}
12141 {{VELKÁ:ěščř}}
12142 {{velká:ěščř}}
12143 !! result
12144 <p>Ěščř
12145 Ěščř
12146 ěščř
12147 ěščř
12148 ěščř
12149 ěščř
12150 ĚŠČŘ
12151 ĚŠČŘ
12152 </p>
12153 !! end
12154
12155 !! test
12156 Morwen/13: Unclosed link followed by heading
12157 !! input
12158 [[link
12159 ==heading==
12160 !! result
12161 <p>[[link
12162 </p>
12163 <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>
12164
12165 !! end
12166
12167 !! test
12168 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
12169 !! input
12170 {{foo|
12171 =heading=
12172 !! result
12173 <p>{{foo|
12174 </p>
12175 <h1> <span class="mw-headline" id="heading">heading</span></h1>
12176
12177 !! end
12178
12179 !! test
12180 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
12181 !! input
12182 {{foo|
12183 ==heading==
12184 !! result
12185 <p>{{foo|
12186 </p>
12187 <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>
12188
12189 !! end
12190
12191 !! test
12192 Tildes in comments
12193 !! options
12194 pst
12195 !! input
12196 <!-- ~~~~ -->
12197 !! result
12198 <!-- ~~~~ -->
12199 !! end
12200
12201 !! test
12202 Paragraphs inside divs (no extra line breaks)
12203 !! input
12204 <div>Line one
12205
12206 Line two</div>
12207 !! result
12208 <div>Line one
12209 Line two</div>
12210
12211 !! end
12212
12213 !! test
12214 Paragraphs inside divs (extra line break on open)
12215 !! input
12216 <div>
12217 Line one
12218
12219 Line two</div>
12220 !! result
12221 <div>
12222 <p>Line one
12223 </p>
12224 Line two</div>
12225
12226 !! end
12227
12228 !! test
12229 Paragraphs inside divs (extra line break on close)
12230 !! input
12231 <div>Line one
12232
12233 Line two
12234 </div>
12235 !! result
12236 <div>Line one
12237 <p>Line two
12238 </p>
12239 </div>
12240
12241 !! end
12242
12243 !! test
12244 Paragraphs inside divs (extra line break on open and close)
12245 !! input
12246 <div>
12247 Line one
12248
12249 Line two
12250 </div>
12251 !! result
12252 <div>
12253 <p>Line one
12254 </p><p>Line two
12255 </p>
12256 </div>
12257
12258 !! end
12259
12260 !! test
12261 Nesting tags, paragraphs on lines which begin with <div>
12262 !! options
12263 disabled
12264 !! input
12265 <div></div><strong>A
12266 B</strong>
12267 !! result
12268 <div></div>
12269 <p><strong>A
12270 B</strong>
12271 </p>
12272 !! end
12273
12274 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
12275 !! test
12276 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
12277 !! options
12278 disabled
12279 !! input
12280 <blockquote>Line one
12281
12282 Line two</blockquote>
12283 !! result
12284 <blockquote>Line one
12285 Line two</blockquote>
12286
12287 !! end
12288
12289 !! test
12290 Bug 6200: paragraphs inside blockquotes (extra line break on open)
12291 !! options
12292 disabled
12293 !! input
12294 <blockquote>
12295 Line one
12296
12297 Line two</blockquote>
12298 !! result
12299 <blockquote>
12300 <p>Line one
12301 </p>
12302 Line two</blockquote>
12303
12304 !! end
12305
12306 !! test
12307 Bug 6200: paragraphs inside blockquotes (extra line break on close)
12308 !! options
12309 disabled
12310 !! input
12311 <blockquote>Line one
12312
12313 Line two
12314 </blockquote>
12315 !! result
12316 <blockquote>Line one
12317 <p>Line two
12318 </p>
12319 </blockquote>
12320
12321 !! end
12322
12323 !! test
12324 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
12325 !! options
12326 disabled
12327 !! input
12328 <blockquote>
12329 Line one
12330
12331 Line two
12332 </blockquote>
12333 !! result
12334 <blockquote>
12335 <p>Line one
12336 </p><p>Line two
12337 </p>
12338 </blockquote>
12339
12340 !! end
12341
12342 !! test
12343 Paragraphs inside blockquotes/divs (no extra line breaks)
12344 !! input
12345 <blockquote><div>Line one
12346
12347 Line two</div></blockquote>
12348 !! result
12349 <blockquote><div>Line one
12350 Line two</div></blockquote>
12351
12352 !! end
12353
12354 !! test
12355 Paragraphs inside blockquotes/divs (extra line break on open)
12356 !! input
12357 <blockquote><div>
12358 Line one
12359
12360 Line two</div></blockquote>
12361 !! result
12362 <blockquote><div>
12363 <p>Line one
12364 </p>
12365 Line two</div></blockquote>
12366
12367 !! end
12368
12369 !! test
12370 Paragraphs inside blockquotes/divs (extra line break on close)
12371 !! input
12372 <blockquote><div>Line one
12373
12374 Line two
12375 </div></blockquote>
12376 !! result
12377 <blockquote><div>Line one
12378 <p>Line two
12379 </p>
12380 </div></blockquote>
12381
12382 !! end
12383
12384 !! test
12385 Paragraphs inside blockquotes/divs (extra line break on open and close)
12386 !! input
12387 <blockquote><div>
12388 Line one
12389
12390 Line two
12391 </div></blockquote>
12392 !! result
12393 <blockquote><div>
12394 <p>Line one
12395 </p><p>Line two
12396 </p>
12397 </div></blockquote>
12398
12399 !! end
12400
12401 !! test
12402 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
12403 !! options
12404 wgLinkHolderBatchSize=0
12405 !! input
12406 [[meatball:1]]
12407 [[meatball:2]]
12408 [[meatball:3]]
12409 !! result
12410 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
12411 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
12412 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
12413 </p>
12414 !! end
12415
12416 !! test
12417 Free external link invading image caption
12418 !! input
12419 [[Image:Foobar.jpg|thumb|http://x|hello]]
12420 !! result
12421 <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>
12422
12423 !! end
12424
12425 !! test
12426 Bug 15196: localised external link numbers
12427 !! options
12428 language=fa
12429 !! input
12430 [http://en.wikipedia.org/]
12431 !! result
12432 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
12433 </p>
12434 !! end
12435
12436 !! test
12437 Multibyte character in padleft
12438 !! input
12439 {{padleft:-Hello|7|Æ}}
12440 !! result
12441 <p>Æ-Hello
12442 </p>
12443 !! end
12444
12445 !! test
12446 Multibyte character in padright
12447 !! input
12448 {{padright:Hello-|7|Æ}}
12449 !! result
12450 <p>Hello-Æ
12451 </p>
12452 !! end
12453
12454 !!test
12455 formatdate parser function
12456 !!input
12457 {{#formatdate:2009-03-24}}
12458 !! result
12459 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
12460 </p>
12461 !! end
12462
12463 !!test
12464 formatdate parser function, with default format
12465 !!input
12466 {{#formatdate:2009-03-24|mdy}}
12467 !! result
12468 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
12469 </p>
12470 !! end
12471
12472 !! test
12473 Spacing of numbers in formatted dates
12474 !! input
12475 {{#formatdate:January 15}}
12476 !! result
12477 <p><span class="mw-formatted-date" title="01-15">January 15</span>
12478 </p>
12479 !! end
12480
12481 !! test
12482 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
12483 !! options
12484 language=nl title=[[MediaWiki:Common.css]]
12485 !! input
12486 {{#formatdate:2009-03-24|dmy}}
12487 !! result
12488 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
12489 </p>
12490 !! end
12491
12492 #
12493 #
12494 #
12495
12496 #
12497 # Edit comments
12498 #
12499
12500 !! test
12501 Edit comment with link
12502 !! options
12503 comment
12504 !! input
12505 I like the [[Main Page]] a lot
12506 !! result
12507 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
12508 !!end
12509
12510 !! test
12511 Edit comment with link and link text
12512 !! options
12513 comment
12514 !! input
12515 I like the [[Main Page|best pages]] a lot
12516 !! result
12517 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
12518 !!end
12519
12520 !! test
12521 Edit comment with link and link text with suffix
12522 !! options
12523 comment
12524 !! input
12525 I like the [[Main Page|best page]]s a lot
12526 !! result
12527 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
12528 !!end
12529
12530 !! test
12531 Edit comment with section link (non-local, eg in history list)
12532 !! options
12533 comment title=[[Main Page]]
12534 !! input
12535 /* External links */ removed bogus entries
12536 !! result
12537 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12538 !!end
12539
12540 !! test
12541 Edit comment with section link and text before it (non-local, eg in history list)
12542 !! options
12543 comment title=[[Main Page]]
12544 !! input
12545 pre-comment text /* External links */ removed bogus entries
12546 !! result
12547 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>
12548 !!end
12549
12550 !! test
12551 Edit comment with section link (local, eg in diff view)
12552 !! options
12553 comment local title=[[Main Page]]
12554 !! input
12555 /* External links */ removed bogus entries
12556 !! result
12557 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12558 !!end
12559
12560 !! test
12561 Edit comment with subpage link (bug 14080)
12562 !! options
12563 comment
12564 subpage
12565 title=[[Subpage test]]
12566 !! input
12567 Poked at a [[/subpage]] here...
12568 !! result
12569 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
12570 !!end
12571
12572 !! test
12573 Edit comment with subpage link and link text (bug 14080)
12574 !! options
12575 comment
12576 subpage
12577 title=[[Subpage test]]
12578 !! input
12579 Poked at a [[/subpage|neat little page]] here...
12580 !! result
12581 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
12582 !!end
12583
12584 !! test
12585 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
12586 !! options
12587 comment
12588 title=[[Subpage test]]
12589 !! input
12590 Poked at a [[/subpage]] here...
12591 !! result
12592 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...
12593 !!end
12594
12595 !! test
12596 Edit comment with bare anchor link (local, as on diff)
12597 !! options
12598 comment
12599 local
12600 title=[[Main Page]]
12601 !!input
12602 [[#section]]
12603 !! result
12604 <a href="#section">#section</a>
12605 !! end
12606
12607 !! test
12608 Edit comment with bare anchor link (non-local, as on history)
12609 !! options
12610 comment
12611 title=[[Main Page]]
12612 !!input
12613 [[#section]]
12614 !! result
12615 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
12616 !! end
12617
12618 !! test
12619 Anchor starting with underscore
12620 !!input
12621 [[#_ref|One]]
12622 !! result
12623 <p><a href="#_ref">One</a>
12624 </p>
12625 !! end
12626
12627 !! test
12628 Id starting with underscore
12629 !!input
12630 <div id="_ref"></div>
12631 !! result
12632 <div id="_ref"></div>
12633
12634 !! end
12635
12636 !! test
12637 Space normalisation on autocomment (bug 22784)
12638 !! options
12639 comment
12640 title=[[Main Page]]
12641 !!input
12642 /* __hello__world__ */
12643 !! result
12644 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
12645 !! end
12646
12647 !! test
12648 percent-encoding and + signs in comments (Bug 26410)
12649 !! options
12650 comment
12651 !!input
12652 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
12653 !! result
12654 <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>
12655 !! end
12656
12657 !! test
12658 Bad images - basic functionality
12659 !! options
12660 disabled
12661 !! input
12662 [[File:Bad.jpg]]
12663 !! result
12664 !! end
12665
12666 !! test
12667 Bad images - bug 16039: text after bad image disappears
12668 !! options
12669 disabled
12670 !! input
12671 Foo bar
12672 [[File:Bad.jpg]]
12673 Bar foo
12674 !! result
12675 <p>Foo bar
12676 </p><p>Bar foo
12677 </p>
12678 !! end
12679
12680 !! test
12681 Verify that displaytitle works (bug #22501) no displaytitle
12682 !! options
12683 showtitle
12684 !! config
12685 wgAllowDisplayTitle=true
12686 wgRestrictDisplayTitle=false
12687 !! input
12688 this is not the the title
12689 !! result
12690 Parser test
12691 <p>this is not the the title
12692 </p>
12693 !! end
12694
12695 !! test
12696 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
12697 !! options
12698 showtitle
12699 title=[[Screen]]
12700 !! config
12701 wgAllowDisplayTitle=true
12702 wgRestrictDisplayTitle=false
12703 !! input
12704 this is not the the title
12705 {{DISPLAYTITLE:whatever}}
12706 !! result
12707 whatever
12708 <p>this is not the the title
12709 </p>
12710 !! end
12711
12712 !! test
12713 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
12714 !! options
12715 showtitle
12716 title=[[Screen]]
12717 !! config
12718 wgAllowDisplayTitle=true
12719 wgRestrictDisplayTitle=true
12720 !! input
12721 this is not the the title
12722 {{DISPLAYTITLE:whatever}}
12723 !! result
12724 Screen
12725 <p>this is not the the title
12726 </p>
12727 !! end
12728
12729 !! test
12730 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
12731 !! options
12732 showtitle
12733 title=[[Screen]]
12734 !! config
12735 wgAllowDisplayTitle=true
12736 wgRestrictDisplayTitle=true
12737 !! input
12738 this is not the the title
12739 {{DISPLAYTITLE:screen}}
12740 !! result
12741 screen
12742 <p>this is not the the title
12743 </p>
12744 !! end
12745
12746 !! test
12747 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
12748 !! options
12749 showtitle
12750 title=[[Screen]]
12751 !! config
12752 wgAllowDisplayTitle=false
12753 !! input
12754 this is not the the title
12755 {{DISPLAYTITLE:screen}}
12756 !! result
12757 Screen
12758 <p>this is not the the title
12759 <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>
12760 </p>
12761 !! end
12762
12763 !! test
12764 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
12765 !! options
12766 showtitle
12767 title=[[Screen]]
12768 !! config
12769 wgAllowDisplayTitle=false
12770 !! input
12771 this is not the the title
12772 !! result
12773 Screen
12774 <p>this is not the the title
12775 </p>
12776 !! end
12777
12778 !! test
12779 preload: check <noinclude> and <includeonly>
12780 !! options
12781 preload
12782 !! input
12783 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
12784 !! result
12785 Hello kind world.
12786 !! end
12787
12788 !! test
12789 preload: check <onlyinclude>
12790 !! options
12791 preload
12792 !! input
12793 Goodbye <onlyinclude>Hello world</onlyinclude>
12794 !! result
12795 Hello world
12796 !! end
12797
12798 !! test
12799 preload: can pass tags through if we want to
12800 !! options
12801 preload
12802 !! input
12803 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
12804 !! result
12805 <includeonly>Hello world</includeonly>
12806 !! end
12807
12808 !! test
12809 preload: check that it doesn't try to do tricks
12810 !! options
12811 preload
12812 !! input
12813 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12814 !! result
12815 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12816 !! end
12817
12818 !! test
12819 Play a bit with r67090 and bug 3158
12820 !! options
12821 disabled
12822 !! input
12823 <div style="width:50% !important">&nbsp;</div>
12824 <div style="width:50%&nbsp;!important">&nbsp;</div>
12825 <div style="width:50%&#160;!important">&nbsp;</div>
12826 <div style="border : solid;">&nbsp;</div>
12827 !! result
12828 <div style="width:50% !important">&nbsp;</div>
12829 <div style="width:50% !important">&nbsp;</div>
12830 <div style="width:50% !important">&nbsp;</div>
12831 <div style="border&#160;: solid;">&nbsp;</div>
12832
12833 !! end
12834
12835 !! test
12836 HTML5 data attributes
12837 !! input
12838 <span data-foo="bar">Baz</span>
12839 <p data-abc-def_hij="">Quuz</p>
12840 !! result
12841 <p><span data-foo="bar">Baz</span>
12842 </p>
12843 <p data-abc-def_hij="">Quuz</p>
12844
12845 !! end
12846
12847 !! test
12848 percent-encoding and + signs in internal links (Bug 26410)
12849 !! input
12850 [[User:+%]] [[Page+title%]]
12851 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
12852 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
12853 [[%33%45]] [[%33%45+]]
12854 !! result
12855 <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>
12856 <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>
12857 <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>
12858 <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>
12859 </p>
12860 !! end
12861
12862 !! test
12863 Special characters in embedded file links (bug 27679)
12864 !! input
12865 [[File:Contains & ampersand.jpg]]
12866 [[File:Does not exist.jpg|Title with & ampersand]]
12867 !! result
12868 <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>
12869 <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>
12870 </p>
12871 !! end
12872
12873
12874 !! test
12875 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
12876 !! input
12877 Text&apos;s been normalized?
12878 !! result
12879 <p>Text&#39;s been normalized?
12880 </p>
12881 !! end
12882
12883 !! test
12884 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
12885 !! input
12886 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
12887 !! result
12888 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
12889 </p>
12890 !! end
12891
12892 !! test
12893 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
12894 !! input
12895 [http://www.example.org/ ideograms]
12896 !! result
12897 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
12898 </p>
12899 !! end
12900
12901 !! test
12902 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
12903 !! input
12904 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
12905 !! result
12906 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
12907 </p>
12908 !! end
12909
12910 !! article
12911 Mediawiki:loop1
12912 !! text
12913 {{Identical|A}}
12914 !! endarticle
12915
12916 !! article
12917 Mediawiki:loop2
12918 !! text
12919 {{Identical|B}}
12920 !! endarticle
12921
12922 !! article
12923 Template:Identical
12924 !! text
12925 {{int:loop1}}
12926 {{int:loop2}}
12927 !! endarticle
12928
12929 !! test
12930 Bug 31098 Template which includes system messages which includes the template
12931 !! input
12932 {{Identical}}
12933 !! result
12934 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
12935 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
12936 </p>
12937 !! end
12938
12939 !! test
12940 Bug31490 Turkish: ucfirst 'blah'
12941 !! options
12942 language=tr
12943 !! input
12944 {{ucfirst:blah}}
12945 !! result
12946 <p>Blah
12947 </p>
12948 !! end
12949
12950 !! test
12951 Bug31490 Turkish: ucfirst 'ix'
12952 !! options
12953 language=tr
12954 !! input
12955 {{ucfirst:ix}}
12956 !! result
12957 <p>İx
12958 </p>
12959 !! end
12960
12961 !! test
12962 Bug31490 Turkish: lcfirst 'BLAH'
12963 !! options
12964 language=tr
12965 !! input
12966 {{lcfirst:BLAH}}
12967 !! result
12968 <p>bLAH
12969 </p>
12970 !! end
12971
12972 !! test
12973 Bug31490 Turkish: ucfırst (with a dotless i)
12974 !! options
12975 language=tr
12976 !! input
12977 {{ucfırst:blah}}
12978 !! result
12979 <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>
12980 </p>
12981 !! end
12982
12983 !! test
12984 Bug31490 ucfırst (with a dotless i) with English language
12985 !! options
12986 language=en
12987 !! input
12988 {{ucfırst:blah}}
12989 !! result
12990 <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>
12991 </p>
12992 !! end
12993
12994 !! test
12995 Bug 26375: TOC with italics
12996 !! options
12997 title=[[Main Page]]
12998 !! input
12999 __TOC__
13000 == ''Lost'' episodes ==
13001 !! result
13002 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13003 <ul>
13004 <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>
13005 </ul>
13006 </td></tr></table>
13007 <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>
13008
13009 !! end
13010
13011 !! test
13012 Bug 26375: TOC with bold
13013 !! options
13014 title=[[Main Page]]
13015 !! input
13016 __TOC__
13017 == '''should be bold''' then normal text ==
13018 !! result
13019 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13020 <ul>
13021 <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>
13022 </ul>
13023 </td></tr></table>
13024 <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>
13025
13026 !! end
13027
13028 !! test
13029 Bug 33845: Headings become cursive in TOC when they contain an image
13030 !! options
13031 title=[[Main Page]]
13032 !! input
13033 __TOC__
13034 == Image [[Image:foobar.jpg]] ==
13035 !! result
13036 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13037 <ul>
13038 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
13039 </ul>
13040 </td></tr></table>
13041 <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>
13042
13043 !! end
13044
13045 !! test
13046 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
13047 !! options
13048 title=[[Main Page]]
13049 !! input
13050 __TOC__
13051 == <blockquote>Quote</blockquote> ==
13052 !! result
13053 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13054 <ul>
13055 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
13056 </ul>
13057 </td></tr></table>
13058 <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>
13059
13060 !! end
13061
13062 !! test
13063 Unclosed tags in TOC
13064 !! options
13065 title=[[Main Page]]
13066 !! input
13067 __TOC__
13068 == Proof: 2 < 3 ==
13069 <small>Hanc marginis exiguitas non caperet.</small>
13070 QED
13071 !! result
13072 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13073 <ul>
13074 <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>
13075 </ul>
13076 </td></tr></table>
13077 <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>
13078 <p><small>Hanc marginis exiguitas non caperet.</small>
13079 QED
13080 </p>
13081 !! end
13082
13083 !! test
13084 Multiple tags in TOC
13085 !! input
13086 __TOC__
13087 == <i>Foo</i> <b>Bar</b> ==
13088
13089 == <i>Foo</i> <blockquote>Bar</blockquote> ==
13090 !! result
13091 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13092 <ul>
13093 <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>
13094 <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>
13095 </ul>
13096 </td></tr></table>
13097 <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>
13098 <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>
13099
13100 !! end
13101
13102 !! test
13103 Tags with parameters in TOC
13104 !! input
13105 __TOC__
13106 == <sup class="in-h2">Hello</sup> ==
13107
13108 == <sup class="a > b">Evilbye</sup> ==
13109 !! result
13110 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13111 <ul>
13112 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
13113 <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>
13114 </ul>
13115 </td></tr></table>
13116 <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>
13117 <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>
13118
13119 !! end
13120
13121 !! test
13122 span tags with directionality in TOC
13123 !! input
13124 __TOC__
13125 == <span dir="ltr">C++</span> ==
13126
13127 == <span dir="rtl">זבנג!</span> ==
13128
13129 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
13130
13131 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
13132
13133 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
13134 !! result
13135 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13136 <ul>
13137 <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>
13138 <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>
13139 <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>
13140 <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>
13141 <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>
13142 </ul>
13143 </td></tr></table>
13144 <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>
13145 <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>
13146 <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>
13147 <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>
13148 <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>
13149
13150 !! end
13151
13152 !! article
13153 MediaWiki:Bug32057
13154 !! text
13155 == {{int:headline_sample}} ==
13156 !! endarticle
13157
13158 !! test
13159 Bug 32057: Title needed when expanding <h> nodes.
13160 !! options
13161 title=[[Main Page]]
13162 !! input
13163 {{int:Bug32057}}
13164 !! result
13165 <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>
13166
13167 !! end
13168
13169 !! test
13170 Strip marker in urlencode
13171 !! input
13172 {{urlencode:x<nowiki/>y}}
13173 {{urlencode:x<nowiki/>y|wiki}}
13174 {{urlencode:x<nowiki/>y|path}}
13175 !! result
13176 <p>xy
13177 xy
13178 xy
13179 </p>
13180 !! end
13181
13182 !! test
13183 Strip marker in lc
13184 !! input
13185 {{lc:x<nowiki/>y}}
13186 !! result
13187 <p>xy
13188 </p>
13189 !! end
13190
13191 !! test
13192 Strip marker in uc
13193 !! input
13194 {{uc:x<nowiki/>y}}
13195 !! result
13196 <p>XY
13197 </p>
13198 !! end
13199
13200 !! test
13201 Strip marker in formatNum
13202 !! input
13203 {{formatnum:1<nowiki/>2}}
13204 {{formatnum:1<nowiki/>2|R}}
13205 !! result
13206 <p>12
13207 12
13208 </p>
13209 !! end
13210
13211 !! test
13212 Check noCommafy in formatNum
13213 !! options
13214 language=be-tarask
13215 !! input
13216 {{formatnum:123456.78}}
13217 {{formatnum:123456.78|NOSEP}}
13218 !! result
13219 <p>123 456,78
13220 123456.78
13221 </p>
13222 !! end
13223
13224 !! test
13225 Strip marker in grammar
13226 !! options
13227 language=fi
13228 !! input
13229 {{grammar:elative|foo<nowiki/>bar}}
13230 !! result
13231 <p>foobarista
13232 </p>
13233 !! end
13234
13235 !! test
13236 Strip marker in padleft
13237 !! input
13238 {{padleft:|2|x<nowiki/>y}}
13239 !! result
13240 <p>xy
13241 </p>
13242 !! end
13243
13244 !! test
13245 Strip marker in padright
13246 !! input
13247 {{padright:|2|x<nowiki/>y}}
13248 !! result
13249 <p>xy
13250 </p>
13251 !! end
13252
13253 !! test
13254 Strip marker in anchorencode
13255 !! input
13256 {{anchorencode:x<nowiki/>y}}
13257 !! result
13258 <p>xy
13259 </p>
13260 !! end
13261
13262 !! test
13263 nowiki inside link inside heading (bug 18295)
13264 !! input
13265 ==[[foo|x<nowiki>y</nowiki>z]]==
13266 !! result
13267 <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>
13268
13269 !! end
13270
13271 !! test
13272 new support for bdi element (bug 31817)
13273 !! input
13274 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
13275 !! result
13276 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
13277
13278 !!end
13279
13280 !! test
13281 Ignore pipe between table row attributes
13282 !! input
13283 {|
13284 | quux
13285 |- id=foo | style='color: red'
13286 | bar
13287 |}
13288 !! result
13289 <table>
13290 <tr>
13291 <td> quux
13292 </td></tr>
13293 <tr id="foo" style="color: red">
13294 <td> bar
13295 </td></tr></table>
13296
13297 !! end
13298
13299 !!test
13300 Gallery override link with WikiLink (bug 34852)
13301 !! input
13302 <gallery>
13303 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
13304 </gallery>
13305 !! result
13306 <ul class="gallery">
13307 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13308 <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>
13309 <div class="gallerytext">
13310 <p>caption
13311 </p>
13312 </div>
13313 </div></li>
13314 </ul>
13315
13316 !! end
13317
13318 !!test
13319 Gallery override link with absolute external link (bug 34852)
13320 !! input
13321 <gallery>
13322 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
13323 </gallery>
13324 !! result
13325 <ul class="gallery">
13326 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13327 <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>
13328 <div class="gallerytext">
13329 <p>caption
13330 </p>
13331 </div>
13332 </div></li>
13333 </ul>
13334
13335 !! end
13336
13337 !!test
13338 Gallery override link with malicious javascript (bug 34852)
13339 !! input
13340 <gallery>
13341 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
13342 </gallery>
13343 !! result
13344 <ul class="gallery">
13345 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13346 <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>
13347 <div class="gallerytext">
13348 <p>caption
13349 </p>
13350 </div>
13351 </div></li>
13352 </ul>
13353
13354 !! end
13355
13356 !!test
13357 Gallery with invalid title as link (bug 43964)
13358 !! input
13359 <gallery>
13360 File:foobar.jpg|link=<
13361 </gallery>
13362 !! result
13363 <ul class="gallery">
13364 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13365 <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>
13366 <div class="gallerytext">
13367 </div>
13368 </div></li>
13369 </ul>
13370
13371 !! end
13372
13373 !!test
13374 Language parser function
13375 !! input
13376 {{#language:ar}}
13377 !! result
13378 <p>العربية
13379 </p>
13380 !! end
13381
13382 !!test
13383 Padleft and padright as substr
13384 !! input
13385 {{padleft:|3|abcde}}
13386 {{padright:|3|abcde}}
13387 !! result
13388 <p>abc
13389 abc
13390 </p>
13391 !! end
13392
13393 !!test
13394 Bug 34939 - Case insensitive link parsing ([HttP://])
13395 !! input
13396 [HttP://MediaWiki.Org/]
13397 !! result
13398 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
13399 </p>
13400 !! end
13401
13402 !!test
13403 Bug 34939 - Case insensitive link parsing ([HttP:// title])
13404 !! input
13405 [HttP://MediaWiki.Org/ MediaWiki]
13406 !! result
13407 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
13408 </p>
13409 !! end
13410
13411 !!test
13412 Bug 34939 - Case insensitive link parsing (HttP://)
13413 !! input
13414 HttP://MediaWiki.Org/
13415 !! result
13416 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
13417 </p>
13418 !! end
13419
13420 ###
13421 ### Parsoids-specific tests
13422 ### Parsoid-PHP parser incompatibilities
13423 ###
13424 !!test
13425 1. SOL-sensitive wikitext tokens as template-args
13426 !!options
13427 disabled
13428 !!input
13429 {{echo|*a}}
13430 {{echo|#a}}
13431 {{echo|:a}}
13432 !!result
13433 <p>*a
13434 #a
13435 :a
13436 </p>
13437 !!end
13438
13439 #### The following section of tests are primarily to test
13440 #### wikitext escaping capabilities of Parsoid.
13441 #### A lot of the tests are disabled for the PHP parser either
13442 #### because of minor newline diffs or other reasons.
13443 #### As Parsoid serializer can handle newlines and other HTML
13444 #### more robustly, some of these tests might get reenabled
13445 #### for the PHP parser.
13446
13447 #### --------------- Headings ---------------
13448 #### 0. Unnested
13449 #### 1. Nested inside html <h1>=foo=</h1>
13450 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
13451 #### 3. Nested inside html with wikitext split by html tags
13452 #### 4. No escape needed
13453 #### 5. Empty headings <h1></h1>
13454 #### 6. Heading chars in SOL context
13455 #### ----------------------------------------
13456 !! test
13457 Headings: 0. Unnested
13458 !! input
13459 <nowiki>=foo=</nowiki>
13460
13461 <nowiki>=foo</nowiki>''a''=
13462 !! result
13463 <p>=foo=
13464 </p><p>=foo<i>a</i>=
13465 </p>
13466 !!end
13467
13468 !! test
13469 Headings: 1. Nested inside html
13470 !! options
13471 disabled
13472 !! input
13473 =<nowiki>=foo=</nowiki>=
13474 ==<nowiki>=foo=</nowiki>==
13475 ===<nowiki>=foo=</nowiki>===
13476 ====<nowiki>=foo=</nowiki>====
13477 =====<nowiki>=foo=</nowiki>=====
13478 ======<nowiki>=foo=</nowiki>======
13479 !! result
13480 <h1>=foo=</h1>
13481 <h2>=foo=</h2>
13482 <h3>=foo=</h3>
13483 <h4>=foo=</h4>
13484 <h5>=foo=</h5>
13485 <h6>=foo=</h6>
13486 !!end
13487
13488 !! test
13489 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
13490 !! options
13491 disabled
13492 !! input
13493 =foo=
13494 <nowiki>*bar</nowiki>
13495 =foo=
13496 =bar
13497 =foo=
13498 <nowiki>=bar=</nowiki>
13499 !! result
13500 <h1>foo</h1>*bar
13501 <h1>foo</h1>=bar
13502 <h1>foo</h1>=bar=
13503 !!end
13504
13505 !! test
13506 Headings: 3. Nested inside html with wikitext split by html tags
13507 !! options
13508 disabled
13509 !! input
13510 =<nowiki>=</nowiki>'''bold'''foo==
13511 !! result
13512 <h1>=<b>bold</b>foo=</h1>
13513 !!end
13514
13515 !! test
13516 Headings: 4. No escaping needed (testing just h1 and h2)
13517 !! options
13518 disabled
13519 !! input
13520 ==foo=
13521 =foo==
13522 ===foo==
13523 ==foo===
13524 =''=''foo==
13525 ===
13526 !! result
13527 <h1>=foo</h1>
13528 <h1>foo=</h1>
13529 <h2>=foo</h2>
13530 <h2>foo=</h2>
13531 <h1><i>=</i>foo=</h1>
13532 <h1>=</h1>
13533 !!end
13534
13535 !! test
13536 Headings: 5. Empty headings
13537 !! options
13538 disabled
13539 !! input
13540 =<nowiki></nowiki>=
13541 ==<nowiki></nowiki>==
13542 ===<nowiki></nowiki>===
13543 ====<nowiki></nowiki>====
13544 =====<nowiki></nowiki>=====
13545 ======<nowiki></nowiki>======
13546 !! result
13547 <h1></h1>
13548 <h2></h2>
13549 <h3></h3>
13550 <h4></h4>
13551 <h5></h5>
13552 <h6></h6>
13553 !!end
13554
13555 !! test
13556 Headings: 6. Heading chars in SOL context
13557 !! options
13558 disabled
13559 !! input
13560 <!--cmt--><nowiki>=h1=</nowiki>
13561 !! result
13562 <p><!--cmt-->=h1=
13563 </p>
13564 !!end
13565
13566 #### --------------- Lists ---------------
13567 #### 0. Outside nests (*foo, etc.)
13568 #### 1. Nested inside html <ul><li>*foo</li></ul>
13569 #### 2. Inside definition lists
13570 #### 3. Only bullets at start should be escaped
13571 #### 4. No escapes needed
13572 #### 5. No unnecessary escapes
13573 #### 6. Escape bullets in SOL position
13574 #### 7. Escape bullets in a multi-line context
13575 #### ----------------------------------------
13576
13577 !! test
13578 Lists: 0. Outside nests
13579 !! input
13580 <nowiki>*foo</nowiki>
13581
13582 <nowiki>#foo</nowiki>
13583 !! result
13584 <p>*foo
13585 </p><p>#foo
13586 </p>
13587 !!end
13588
13589 !! test
13590 Lists: 1. Nested inside html
13591 !! input
13592 *<nowiki>*foo</nowiki>
13593
13594 *<nowiki>#foo</nowiki>
13595
13596 *<nowiki>:foo</nowiki>
13597
13598 *<nowiki>;foo</nowiki>
13599
13600 #<nowiki>*foo</nowiki>
13601
13602 #<nowiki>#foo</nowiki>
13603
13604 #<nowiki>:foo</nowiki>
13605
13606 #<nowiki>;foo</nowiki>
13607 !! result
13608 <ul><li>*foo
13609 </li></ul>
13610 <ul><li>#foo
13611 </li></ul>
13612 <ul><li>:foo
13613 </li></ul>
13614 <ul><li>;foo
13615 </li></ul>
13616 <ol><li>*foo
13617 </li></ol>
13618 <ol><li>#foo
13619 </li></ol>
13620 <ol><li>:foo
13621 </li></ol>
13622 <ol><li>;foo
13623 </li></ol>
13624
13625 !!end
13626
13627 !! test
13628 Lists: 2. Inside definition lists
13629 !! input
13630 ;<nowiki>;foo</nowiki>
13631
13632 ;<nowiki>:foo</nowiki>
13633
13634 ;<nowiki>:foo</nowiki>
13635 :bar
13636
13637 :<nowiki>:foo</nowiki>
13638 !! result
13639 <dl><dt>;foo
13640 </dt></dl>
13641 <dl><dt>:foo
13642 </dt></dl>
13643 <dl><dt>:foo
13644 </dt><dd>bar
13645 </dd></dl>
13646 <dl><dd>:foo
13647 </dd></dl>
13648
13649 !!end
13650
13651 !! test
13652 Lists: 3. Only bullets at start of text should be escaped
13653 !! input
13654 *<nowiki>*foo*bar</nowiki>
13655
13656 *<nowiki>*foo</nowiki>''it''*bar
13657 !! result
13658 <ul><li>*foo*bar
13659 </li></ul>
13660 <ul><li>*foo<i>it</i>*bar
13661 </li></ul>
13662
13663 !!end
13664
13665 !! test
13666 Lists: 4. No escapes needed
13667 !! options
13668 disabled
13669 !! input
13670 *foo*bar
13671
13672 *''foo''*bar
13673
13674 *[[Foo]]: bar
13675 !! result
13676 <ul><li>foo*bar
13677 </li></ul>
13678 <ul><li><i>foo</i>*bar
13679 </li></ul>
13680 <ul><li><a href="Foo" rel="mw:WikiLink">Foo</a>: bar
13681 </li></ul>
13682 !!end
13683
13684 !! test
13685 Lists: 5. No unnecessary escapes
13686 !! input
13687 * bar <span><nowiki>[[foo]]</nowiki></span>
13688
13689 *=bar <span><nowiki>[[foo]]</nowiki></span>
13690
13691 *[[bar <span><nowiki>[[foo]]</nowiki></span>
13692
13693 *<nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
13694
13695 *=bar <span>foo]]</span>=
13696 !! result
13697 <ul><li> bar <span>[[foo]]</span>
13698 </li></ul>
13699 <ul><li>=bar <span>[[foo]]</span>
13700 </li></ul>
13701 <ul><li>[[bar <span>[[foo]]</span>
13702 </li></ul>
13703 <ul><li>]]bar <span>[[foo]]</span>
13704 </li></ul>
13705 <ul><li>=bar <span>foo]]</span>=
13706 </li></ul>
13707
13708 !!end
13709
13710 !! test
13711 Lists: 6. Escape bullets in SOL position
13712 !! options
13713 disabled
13714 !! input
13715 <!--cmt--><nowiki>*foo</nowiki>
13716 !! result
13717 <p><!--cmt-->*foo
13718 </p>
13719 !!end
13720
13721 !! test
13722 Lists: 7. Escape bullets in a multi-line context
13723 !! input
13724 <nowiki>a
13725 *b</nowiki>
13726 !! result
13727 <p>a
13728 *b
13729 </p>
13730 !!end
13731
13732 #### --------------- HRs ---------------
13733 #### 1. Single line
13734 #### -----------------------------------
13735
13736 !! test
13737 HRs: 1. Single line
13738 !! options
13739 disabled
13740 !! input
13741 ----
13742 <nowiki>----</nowiki>
13743 ----
13744 <nowiki>=foo=</nowiki>
13745 ----
13746 <nowiki>*foo</nowiki>
13747 !! result
13748 <hr/>----
13749 <hr/>=foo=
13750 <hr/>*foo
13751 !! end
13752
13753 #### --------------- Tables ---------------
13754 #### 1a. Simple example
13755 #### 1b. No escaping needed (!foo)
13756 #### 1c. No escaping needed (|foo)
13757 #### 1d. No escaping needed (|}foo)
13758 ####
13759 #### 2a. Nested in td (<td>foo|bar</td>)
13760 #### 2b. Nested in td (<td>foo||bar</td>)
13761 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
13762 ####
13763 #### 3a. Nested in th (<th>foo!bar</th>)
13764 #### 3b. Nested in th (<th>foo!!bar</th>)
13765 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
13766 ####
13767 #### 4a. Escape -
13768 #### 4b. Escape +
13769 #### 4c. No escaping needed
13770 #### --------------------------------------
13771
13772 !! test
13773 Tables: 1a. Simple example
13774 !! input
13775 <nowiki>{|
13776 |}</nowiki>
13777 !! result
13778 <p>{|
13779 |}
13780 </p>
13781 !! end
13782
13783 !! test
13784 Tables: 1b. No escaping needed
13785 !! input
13786 !foo
13787 !! result
13788 <p>!foo
13789 </p>
13790 !! end
13791
13792 !! test
13793 Tables: 1c. No escaping needed
13794 !! input
13795 |foo
13796 !! result
13797 <p>|foo
13798 </p>
13799 !! end
13800
13801 !! test
13802 Tables: 1d. No escaping needed
13803 !! input
13804 |}foo
13805 !! result
13806 <p>|}foo
13807 </p>
13808 !! end
13809
13810 !! test
13811 Tables: 2a. Nested in td
13812 !! options
13813 disabled
13814 !! input
13815 {|
13816 |<nowiki>foo|bar</nowiki>
13817 |}
13818 !! result
13819 <table>
13820 <tr><td>foo|bar
13821 </td></tr></table>
13822
13823 !! end
13824
13825 !! test
13826 Tables: 2b. Nested in td
13827 !! options
13828 disabled
13829 !! input
13830 {|
13831 |<nowiki>foo||bar</nowiki>
13832 |''it''<nowiki>foo||bar</nowiki>
13833 |}
13834 !! result
13835 <table>
13836 <tr><td>foo||bar
13837 </td><td><i>it</i>foo||bar
13838 </td></tr></table>
13839
13840 !! end
13841
13842 !! test
13843 Tables: 2c. Nested in td -- no escaping needed
13844 !! options
13845 disabled
13846 !! input
13847 {|
13848 |foo!!bar
13849 |}
13850 !! result
13851 <table>
13852 <tr><td>foo!!bar
13853 </td></tr></table>
13854
13855 !! end
13856
13857 !! test
13858 Tables: 3a. Nested in th
13859 !! options
13860 disabled
13861 !! input
13862 {|
13863 !foo!bar
13864 |}
13865 !! result
13866 <table>
13867 <tr><th>foo!bar
13868 </th></tr></table>
13869
13870 !! end
13871
13872 !! test
13873 Tables: 3b. Nested in th
13874 !! options
13875 disabled
13876 !! input
13877 {|
13878 !<nowiki>foo!!bar</nowiki>
13879 |}
13880 !! result
13881 <table>
13882 <tr><th>foo!!bar
13883 </th></tr></table>
13884
13885 !! end
13886
13887 !! test
13888 Tables: 3c. Nested in th -- no escaping needed
13889 !! options
13890 disabled
13891 !! input
13892 {|
13893 !foo||bar
13894 |}
13895 !! result
13896 <table>
13897 <tr><th>foo||bar
13898 </th></tr></table>
13899
13900 !! end
13901
13902 !! test
13903 Tables: 4a. Escape -
13904 !! options
13905 disabled
13906 !! input
13907 {|
13908 |-
13909 !-bar
13910 |-
13911 |<nowiki>-bar</nowiki>
13912 |}
13913 !! result
13914 <table><tbody>
13915 <tr><th>-bar</th></tr>
13916 <tr><td>-bar</td></tr>
13917 </tbody></table>
13918 !! end
13919
13920 !! test
13921 Tables: 4b. Escape +
13922 !! options
13923 disabled
13924 !! input
13925 {|
13926 |-
13927 !+bar
13928 |-
13929 |<nowiki>+bar</nowiki>
13930 |}
13931 !! result
13932 <table><tbody>
13933 <tr><th>+bar</th></tr>
13934 <tr><td>+bar</td></tr>
13935 </tbody></table>
13936 !! end
13937
13938 !! test
13939 Tables: 4c. No escaping needed
13940 !! options
13941 disabled
13942 !! input
13943 {|
13944 |-
13945 |foo-bar
13946 |foo+bar
13947 |-
13948 |''foo''-bar
13949 |''foo''+bar
13950 |}
13951 !! result
13952 <table><tbody>
13953 <tr><td>foo-bar</td><td>foo+bar</td></tr>
13954 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
13955 </tbody></table>
13956 !! end
13957
13958 !! test
13959 Tables: 4d. No escaping needed
13960 !! input
13961 {|
13962 ||+1
13963 ||-2
13964 |}
13965 !! result
13966 <table>
13967 <tr>
13968 <td>+1
13969 </td>
13970 <td>-2
13971 </td></tr></table>
13972
13973 !! end
13974
13975 #### --------------- Links ---------------
13976 #### 1. Quote marks in link text
13977 #### 2. Wikilinks: Escapes needed
13978 #### 3. Wikilinks: No escapes needed
13979 #### 4. Extlinks: Escapes needed
13980 #### 5. Extlinks: No escapes needed
13981 #### --------------------------------------
13982 !! test
13983 Links 1. Quote marks in link text
13984 !! options
13985 disabled
13986 !! input
13987 [[Foo|<nowiki>Foo''boo''</nowiki>]]
13988 !! result
13989 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
13990 !! end
13991
13992 !! test
13993 Links 2. WikiLinks: Escapes needed
13994 !! options
13995 disabled
13996 !! input
13997 [[Foo|<nowiki>[Foobar]</nowiki>]]
13998 [[Foo|<nowiki>Foobar]</nowiki>]]
13999 [[Foo|<nowiki>x [Foobar] x</nowiki>]]
14000 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
14001 [[Foo|<nowiki>[[Bar]]</nowiki>]]
14002 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
14003 [[Foo|<nowiki>|Bar</nowiki>]]
14004 !! result
14005 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
14006 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
14007 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
14008 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
14009 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
14010 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
14011 <a href="Foo" rel="mw:WikiLink">|Bar</a>
14012 !! end
14013
14014 !! test
14015 Links 3. WikiLinks: No escapes needed
14016 !! options
14017 disabled
14018 !! input
14019 [[Foo|[Foobar]]
14020 [[Foo|foo|bar]]
14021 !! result
14022 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
14023 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
14024 !! end
14025
14026 !! test
14027 Links 4. ExtLinks: Escapes needed
14028 !! options
14029 disabled
14030 !! input
14031 [http://google.com <nowiki>[google]</nowiki>]
14032 [http://google.com <nowiki>google]</nowiki>]
14033 !! result
14034 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
14035 <a href="http://google.com" rel="mw:ExtLink">google]</a>
14036 !! end
14037
14038 !! test
14039 Links 5. ExtLinks: No escapes needed
14040 !! options
14041 disabled
14042 !! input
14043 [http://google.com [google]
14044 !! result
14045 <a href="http://google.com" rel="mw:ExtLink">[google</a>
14046 !! end
14047
14048 #### --------------- Quotes ---------------
14049 #### 1. Quotes inside <b> and <i>
14050 #### 2. Link fragments separated by <i> and <b> tags
14051 #### 3. Link fragments inside <i> and <b>
14052 #### --------------------------------------
14053 !! test
14054 1. Quotes inside <b> and <i>
14055 !! input
14056 ''<nowiki>'foo'</nowiki>''
14057 ''<nowiki>''foo''</nowiki>''
14058 ''<nowiki>'''foo'''</nowiki>''
14059 '''<nowiki>'foo'</nowiki>'''
14060 '''<nowiki>''foo''</nowiki>'''
14061 '''<nowiki>'''foo'''</nowiki>'''
14062 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
14063 !! result
14064 <p><i>'foo'</i>
14065 <i>''foo''</i>
14066 <i>'''foo'''</i>
14067 <b>'foo'</b>
14068 <b>''foo''</b>
14069 <b>'''foo'''</b>
14070 <b>foo'<i>bar'</i>baz</b>
14071 </p>
14072 !! end
14073
14074 !! test
14075 2. Link fragments separated by <i> and <b> tags
14076 !! input
14077 [[''foo''<nowiki>hello]]</nowiki>
14078
14079 [['''foo'''<nowiki>hello]]</nowiki>
14080 !! result
14081 <p>[[<i>foo</i>hello]]
14082 </p><p>[[<b>foo</b>hello]]
14083 </p>
14084 !! end
14085
14086 !! test
14087 2. Link fragments inside <i> and <b>
14088 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
14089 this is one of the shortcomings of this format)
14090 !! input
14091 ''[[foo''<nowiki>]]</nowiki>
14092
14093 '''[[foo'''<nowiki>]]</nowiki>
14094 !! result
14095 <p><i>[[foo</i>]]
14096 </p><p><b>[[foo</b>]]
14097 </p>
14098 !! end
14099
14100 #### --------------- Paragraphs ---------------
14101 #### 1. No unnecessary escapes
14102 #### --------------------------------------
14103
14104 !! test
14105 1. No unnecessary escapes
14106 !! input
14107 bar <span><nowiki>[[foo]]</nowiki></span>
14108
14109 =bar <span><nowiki>[[foo]]</nowiki></span>
14110
14111 [[bar <span><nowiki>[[foo]]</nowiki></span>
14112
14113 <nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
14114
14115 <nowiki>=bar </nowiki><span>foo]]</span>=
14116 !! result
14117 <p>bar <span>[[foo]]</span>
14118 </p><p>=bar <span>[[foo]]</span>
14119 </p><p>[[bar <span>[[foo]]</span>
14120 </p><p>]]bar <span>[[foo]]</span>
14121 </p><p>=bar <span>foo]]</span>=
14122 </p>
14123 !!end
14124
14125 #### --------------- PRE ------------------
14126 #### 1. Leading space in SOL context should be escaped
14127 #### --------------------------------------
14128 !! test
14129 1. Leading space in SOL context should be escaped
14130 !! options
14131 disabled
14132 !! input
14133 <nowiki> foo</nowiki>
14134 <!--cmt--><nowiki> foo</nowiki>
14135 !! result
14136 <p> foo
14137 <!--cmt--> foo
14138 </p>
14139 !! end
14140
14141 #### --------------- HTML tags ---------------
14142 #### 1. a tags
14143 #### 2. other tags
14144 #### 3. multi-line html tag
14145 #### --------------------------------------
14146 !! test
14147 1. a tags
14148 !! options
14149 disabled
14150 !! input
14151 <a href="http://google.com">google</a>
14152 !! result
14153 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
14154 !! end
14155
14156 !! test
14157 2. other tags
14158 !! input
14159 <nowiki><div>foo</div>
14160 <div style="color:red">foo</div></nowiki>
14161 !! result
14162 <p>&lt;div&gt;foo&lt;/div&gt;
14163 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
14164 </p>
14165 !! end
14166
14167 !! test
14168 3. multi-line html tag
14169 !! input
14170 <nowiki><div
14171 >foo</div
14172 ></nowiki>
14173 !! result
14174 <p>&lt;div
14175 &gt;foo&lt;/div
14176 &gt;
14177 </p>
14178 !! end
14179
14180 #### --------------- Others ---------------
14181 !! test
14182 Escaping nowikis
14183 !! input
14184 &lt;nowiki&gt;foo&lt;/nowiki&gt;
14185 !! result
14186 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
14187 </p>
14188 !! end
14189
14190 !! test
14191 Tag-like HTML structures are passed through as text
14192 !! input
14193 <x y>
14194
14195 <x.y>
14196
14197 <x-y>
14198
14199 1>2
14200
14201 x<y
14202
14203 a>b
14204
14205 1<d e>f
14206 !! result
14207 <p>&lt;x y&gt;
14208 </p><p>&lt;x.y&gt;
14209 </p><p>&lt;x-y&gt;
14210 </p><p>1&gt;2
14211 </p><p>x&lt;y
14212 </p><p>a&gt;b
14213 </p><p>1&lt;d e&gt;f
14214 </p>
14215 !! end
14216
14217
14218 # This fails in the PHP parser (see bug 40670,
14219 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
14220 !! test
14221 Tag names followed by punctuation should not be recognized as tags
14222 !! options
14223 disabled
14224 !! input
14225 <s.ome> text
14226 !! result
14227 <p>&lt;s.ome&gt text
14228 </p>
14229 !! end
14230
14231 !! test
14232 HTML tag with necessary entities in attributes
14233 !! input
14234 <span title="&amp;amp;">foo</span>
14235 !! result
14236 <p><span title="&amp;amp;">foo</span>
14237 </p>
14238 !! end
14239
14240 !! test
14241 HTML tag with 'unnecessary' entity encoding in attributes
14242 !! input
14243 <span title="&amp;">foo</span>
14244 !! result
14245 <p><span title="&amp;">foo</span>
14246 </p>
14247 !! end
14248
14249 !! test
14250 HTML tag with broken attribute value quoting
14251 !! input
14252 <span title="Hello world>Foo</span>
14253 !! result
14254 <p><span>Foo</span>
14255 </p>
14256 !! end
14257
14258 !! test
14259 Parsoid-only: HTML tag with broken attribute value quoting
14260 !! options
14261 parsoid
14262 !! input
14263 <span title="Hello world>Foo</span>
14264 !! result
14265 <p><span title="Hello world">Foo</span>
14266 </p>
14267 !! end
14268
14269 !! test
14270 Table with broken attribute value quoting
14271 !! input
14272 {|
14273 | title="Hello world|Foo
14274 |}
14275 !! result
14276 <table>
14277 <tr>
14278 <td>Foo
14279 </td></tr></table>
14280
14281 !! end
14282
14283 !! test
14284 Table with broken attribute value quoting on consecutive lines
14285 !! input
14286 {|
14287 | title="Hello world|Foo
14288 | style="color:red|Bar
14289 |}
14290 !! result
14291 <table>
14292 <tr>
14293 <td>Foo
14294 </td>
14295 <td>Bar
14296 </td></tr></table>
14297
14298 !! end
14299
14300 !! test
14301 Parsoid-only: Table with broken attribute value quoting on consecutive lines
14302 !! options
14303 parsoid
14304 !! input
14305 {|
14306 | title="Hello world|Foo
14307 | style="color:red|Bar
14308 |}
14309 !! result
14310 <table>
14311 <tr>
14312 <td title="Hello world">Foo
14313 </td><td style="color: red">Bar
14314 </td></tr></table>
14315
14316 !! end
14317
14318 !! test
14319 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
14320 !! options
14321 parsoid
14322 !! input
14323 {{}}
14324 !! result
14325 {{}}
14326 !! end
14327
14328 !! test
14329 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
14330 !! options
14331 parsoid
14332 !! input
14333 }}{{
14334 !! result
14335 }}{{
14336 !! end
14337
14338 !!test
14339 Accept empty td cell attribute
14340 !!input
14341 {|
14342 | align="center" | foo || |
14343 |}
14344 !!result
14345 <table>
14346 <tr>
14347 <td align="center"> foo </td>
14348 <td>
14349 </td></tr></table>
14350
14351 !!end
14352
14353 !!test
14354 Non-empty attributes in th-cells
14355 !!input
14356 {|
14357 ! Foo !! style="color: red" | Bar
14358 |}
14359 !!result
14360 <table>
14361 <tr>
14362 <th> Foo </th>
14363 <th style="color: red"> Bar
14364 </th></tr></table>
14365
14366 !!end
14367
14368 !!test
14369 Accept empty attributes in th-cells
14370 !!input
14371 {|
14372 !| foo !!| bar
14373 |}
14374 !!result
14375 <table>
14376 <tr>
14377 <th> foo </th>
14378 <th> bar
14379 </th></tr></table>
14380
14381 !!end
14382
14383 !!test
14384 Empty table rows go away
14385 !!input
14386 {|
14387 | Hello
14388 | there
14389 |- class="foo"
14390 |-
14391 |}
14392 !! result
14393 <table>
14394 <tr>
14395 <td> Hello
14396 </td>
14397 <td> there
14398 </td></tr>
14399
14400 </table>
14401
14402 !! end
14403
14404 ###
14405 ### Parsoid-centric tests for testing RTing of inter-element separators
14406 ### Edge cases not tested by existing parser tests and specific to
14407 ### Parsoid-specific serialization strategies.
14408 ###
14409
14410 !!test
14411 RT-ed inter-element separators should be valid separators
14412 !!input
14413 {|
14414 |- [[foo]]
14415 |}
14416 !!result
14417 <table>
14418
14419 </table>
14420
14421 !!end
14422
14423 !!test
14424 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
14425 (Parsoid-only since PHP parser relies on Tidy for correct output)
14426 !!options
14427 disabled parsoid
14428 !!input
14429 {|
14430 |<small>foo
14431 bar
14432 |}
14433
14434 {|
14435 |<small>foo<small>
14436 |}
14437 !!result
14438 !!end
14439
14440 !!test
14441 Empty TD followed by TD with tpl-generated attribute
14442 !!input
14443 {|
14444 |-
14445 |
14446 |{{echo|style='color:red'}}|foo
14447 |}
14448 !!result
14449 <table>
14450
14451 <tr>
14452 <td>
14453 </td>
14454 <td>foo
14455 </td></tr></table>
14456
14457 !!end
14458
14459 !!test
14460 Empty TR followed by a template-generated TR
14461 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
14462 !!options
14463 disabled parsoid
14464 !!input
14465 {|
14466 |-
14467 {{echo|<tr><td>foo</td></tr>}}
14468 |}
14469 !!result
14470 <table>
14471 <tbody>
14472 <tr>
14473 <td></td></tr>
14474 <tr>
14475 <td>foo</td></tr></tbody></table>
14476 !!end
14477
14478 !!test
14479 Multi-line image caption generated by templates with/without trailing newlines
14480 !!options
14481 parsoid
14482 !!input
14483 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
14484 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
14485 !!result
14486 <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>
14487 <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>
14488
14489 !!end
14490
14491 TODO:
14492 more images
14493 more tables
14494 character entities
14495 and much more
14496 Try for 100% code coverage