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