Merge "add htmlform-no and htmlform-yes messages for generic yes-no questions"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-only test (not run by PHP parser)
25 # php php-only test (not run by the parsoid parser)
26 # showtitle make the first line the title
27 # comment run through Linker::formatComment() instead of main parser
28 # local format section links in edit comment text as local links
29 #
30 # For testing purposes, temporary articles can created:
31 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
32 # where '/' denotes a newline.
33
34 # This is the standard article assumed to exist.
35 !! article
36 Main Page
37 !! text
38 blah blah
39 !! endarticle
40
41 !!article
42 Template:Foo
43 !!text
44 FOO
45 !!endarticle
46
47 !! article
48 Template:Blank
49 !! text
50 !! endarticle
51
52 !! article
53 Template:pipe
54 !! text
55 |
56 !! endarticle
57
58 !!article
59 MediaWiki:bad image list
60 !!text
61 * [[File:Bad.jpg]] except [[Nasty page]]
62 !!endarticle
63
64 !! article
65 Template:inner list
66 !! text
67 * item 1
68 !! endarticle
69
70 !! article
71 Template:tbl-start
72 !! text
73 {|
74 !! endarticle
75
76 !! article
77 Template:tbl-end
78 !! text
79 |}
80 !! endarticle
81
82 !! article
83 Template:!
84 !! text
85 |
86 !! endarticle
87
88 !! article
89 Template:echo
90 !! text
91 {{{1}}}
92 !! endarticle
93
94 !! article
95 Template:echo_with_span
96 !! text
97 <span>{{{1}}}</span>
98 !! endarticle
99
100 !! article
101 Template:echo_with_div
102 !! text
103 <div>{{{1}}}</div>
104 !! endarticle
105
106 !! article
107 Template:attr_str
108 !! text
109 {{{1}}}="{{{2}}}"
110 !! endarticle
111
112 !! article
113 Template:table_attribs
114 !! text
115 <noinclude>
116 |</noinclude>style="color: red"| Foo
117 !! endarticle
118
119 !! article
120 A?b
121 !! text
122 Weirdo titles!
123 !! endarticle
124
125 ###
126 ### Basic tests
127 ###
128 !! test
129 Blank input
130 !! input
131 !! result
132 !! end
133
134
135 !! test
136 Simple paragraph
137 !! input
138 This is a simple paragraph.
139 !! result
140 <p>This is a simple paragraph.
141 </p>
142 !! end
143
144 !! test
145 Paragraphs with extra newline spacing
146 !! input
147 foo
148
149 bar
150
151
152 baz
153
154
155
156 booz
157 !! result
158 <p>foo
159 </p><p>bar
160 </p><p><br />
161 baz
162 </p><p><br />
163 </p><p>booz
164 </p>
165 !! end
166
167 !! test
168 Paragraphs with newline spacing with comment lines in between
169 !! input
170 ----
171 a
172 <!--foo-->
173 b
174 ----
175 a
176 <!--foo--><!--More than 1 comment disables stripping of this line!-->
177 b
178 ----
179 a
180 <!--foo-->
181
182 b
183 ----
184 a
185
186 <!--foo-->
187 b
188 ----
189 a
190 <!--foo-->
191
192
193 b
194 ----
195 a
196
197
198 <!--foo-->
199 b
200 ----
201 !! result
202 <hr />
203 <p>a
204 b
205 </p>
206 <hr />
207 <p>a
208 </p><p>b
209 </p>
210 <hr />
211 <p>a
212 </p><p>b
213 </p>
214 <hr />
215 <p>a
216 </p><p>b
217 </p>
218 <hr />
219 <p>a
220 </p><p><br />
221 b
222 </p>
223 <hr />
224 <p>a
225 </p><p><br />
226 b
227 </p>
228 <hr />
229
230 !! end
231
232 !! test
233 Paragraphs with newline spacing with non-empty white-space lines in between
234 !! input
235 ----
236 a
237
238 b
239 ----
240 a
241
242
243 b
244 ----
245 !! result
246 <hr />
247 <p>a
248 </p><p>b
249 </p>
250 <hr />
251 <p>a
252 </p><p><br />
253 b
254 </p>
255 <hr />
256
257 !! end
258
259 !! test
260 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
261 !! input
262 ----
263 a
264 <!--foo-->
265 b
266 ----
267 a
268 <!--foo--><!--More than 1 comment disables stripping of this line!-->
269 b
270 ----
271 a
272
273 <!--foo-->
274 <!--bar-->
275 b
276 ----
277 a
278
279 <!--foo-->
280 <!--bar-->
281
282 b
283 ----
284 !! result
285 <hr />
286 <p>a
287 b
288 </p>
289 <hr />
290 <p>a
291 </p><p>b
292 </p>
293 <hr />
294 <p>a
295 </p><p>b
296 </p>
297 <hr />
298 <p>a
299 </p><p><br />
300 b
301 </p>
302 <hr />
303
304 !! end
305
306 !! test
307 Parsing an URL
308 !! input
309 http://fr.wikipedia.org/wiki/🍺
310 <!-- EasterEgg we love beer, better be able be able to link to it -->
311 !! result
312 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
313 </p>
314 !! end
315
316 !! test
317 Simple list
318 !! input
319 * Item 1
320 * Item 2
321 !! result
322 <ul><li> Item 1
323 </li><li> Item 2
324 </li></ul>
325
326 !! end
327
328 !! test
329 Italics and bold
330 !! input
331 * plain
332 * plain''italic''plain
333 * plain''italic''plain''italic''plain
334 * plain'''bold'''plain
335 * plain'''bold'''plain'''bold'''plain
336 * plain''italic''plain'''bold'''plain
337 * plain'''bold'''plain''italic''plain
338 * plain''italic'''bold-italic'''italic''plain
339 * plain'''bold''bold-italic''bold'''plain
340 * plain'''''bold-italic'''italic''plain
341 * plain'''''bold-italic''bold'''plain
342 * plain''italic'''bold-italic'''''plain
343 * plain'''bold''bold-italic'''''plain
344 * plain l'''italic''plain
345 * plain l''''bold''' plain
346 !! result
347 <ul><li> plain
348 </li><li> plain<i>italic</i>plain
349 </li><li> plain<i>italic</i>plain<i>italic</i>plain
350 </li><li> plain<b>bold</b>plain
351 </li><li> plain<b>bold</b>plain<b>bold</b>plain
352 </li><li> plain<i>italic</i>plain<b>bold</b>plain
353 </li><li> plain<b>bold</b>plain<i>italic</i>plain
354 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
355 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
356 </li><li> plain<i><b>bold-italic</b>italic</i>plain
357 </li><li> plain<b><i>bold-italic</i>bold</b>plain
358 </li><li> plain<i>italic<b>bold-italic</b></i>plain
359 </li><li> plain<b>bold<i>bold-italic</i></b>plain
360 </li><li> plain l'<i>italic</i>plain
361 </li><li> plain l'<b>bold</b> plain
362 </li></ul>
363
364 !! end
365
366 # this example taken from the simple/Moon article
367 !! test
368 Italics and possessives
369 !! input
370 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
371 !! result
372 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
373 </p>
374 !! end
375
376 ###
377 ### 2-quote opening sequence tests
378 ###
379 !! test
380 Italics and bold: 2-quote opening sequence: (2,2)
381 !! input
382 ''foo''
383 !! result
384 <p><i>foo</i>
385 </p>
386 !!end
387
388
389 !! test
390 Italics and bold: 2-quote opening sequence: (2,3)
391 !! input
392 ''foo'''
393 !! result
394 <p><i>foo'</i>
395 </p>
396 !!end
397
398
399 !! test
400 Italics and bold: 2-quote opening sequence: (2,4)
401 !! input
402 ''foo''''
403 !! result
404 <p><i>foo''</i>
405 </p>
406 !!end
407
408
409 !! test
410 Italics and bold: 2-quote opening sequence: (2,5) (php)
411 !! options
412 php
413 !! input
414 ''foo'''''
415 !! result
416 <p><i>foo</i>
417 </p>
418 !!end
419 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
420 !! test
421 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
422 !! options
423 parsoid
424 !! input
425 ''foo'''''
426 !! result
427 <p><i>foo</i><b></b>
428 </p>
429 !!end
430
431
432 ###
433 ### 3-quote opening sequence tests
434 ###
435
436 !! test
437 Italics and bold: 3-quote opening sequence: (3,2)
438 !! input
439 '''foo''
440 !! result
441 <p>'<i>foo</i>
442 </p>
443 !!end
444
445
446 !! test
447 Italics and bold: 3-quote opening sequence: (3,3)
448 !! input
449 '''foo'''
450 !! result
451 <p><b>foo</b>
452 </p>
453 !!end
454
455
456 !! test
457 Italics and bold: 3-quote opening sequence: (3,4)
458 !! input
459 '''foo''''
460 !! result
461 <p><b>foo'</b>
462 </p>
463 !!end
464
465
466 !! test
467 Italics and bold: 3-quote opening sequence: (3,5) (php)
468 !! options
469 php
470 !! input
471 '''foo'''''
472 !! result
473 <p><b>foo</b>
474 </p>
475 !!end
476 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
477 !! test
478 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
479 !! options
480 parsoid
481 !! input
482 '''foo'''''
483 !! result
484 <p><b>foo<i></i></b>
485 </p>
486 !!end
487
488
489 ###
490 ### 4-quote opening sequence tests
491 ###
492
493 !! test
494 Italics and bold: 4-quote opening sequence: (4,2)
495 !! input
496 ''''foo''
497 !! result
498 <p>''<i>foo</i>
499 </p>
500 !!end
501
502
503 !! test
504 Italics and bold: 4-quote opening sequence: (4,3)
505 !! input
506 ''''foo'''
507 !! result
508 <p>'<b>foo</b>
509 </p>
510 !!end
511
512
513 !! test
514 Italics and bold: 4-quote opening sequence: (4,4)
515 !! input
516 ''''foo''''
517 !! result
518 <p>'<b>foo'</b>
519 </p>
520 !!end
521
522
523 !! test
524 Italics and bold: 4-quote opening sequence: (4,5) (php)
525 !! options
526 php
527 !! input
528 ''''foo'''''
529 !! result
530 <p>'<b>foo</b>
531 </p>
532 !!end
533 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
534 !! test
535 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
536 !! options
537 parsoid
538 !! input
539 ''''foo'''''
540 !! result
541 <p>'<b>foo<i></i></b>
542 </p>
543 !!end
544
545
546 ###
547 ### 5-quote opening sequence tests
548 ###
549
550 !! test
551 Italics and bold: 5-quote opening sequence: (5,2) (php)
552 !! options
553 php
554 !! input
555 '''''foo''
556 !! result
557 <p><b><i>foo</i></b>
558 </p>
559 !!end
560 # Parsoid reverses the nesting order, compared to the PHP parser
561 !! test
562 Italics and bold: 5-quote opening sequence: (5,2) (parsoid)
563 !! options
564 parsoid
565 !! input
566 '''''foo''
567 !! result
568 <p><i><b>foo</b></i>
569 </p>
570 !!end
571
572
573 !! test
574 Italics and bold: 5-quote opening sequence: (5,3)
575 !! input
576 '''''foo'''
577 !! result
578 <p><i><b>foo</b></i>
579 </p>
580 !!end
581
582
583 !! test
584 Italics and bold: 5-quote opening sequence: (5,4)
585 !! input
586 '''''foo''''
587 !! result
588 <p><i><b>foo'</b></i>
589 </p>
590 !!end
591
592
593 !! test
594 Italics and bold: 5-quote opening sequence: (5,5)
595 !! input
596 '''''foo'''''
597 !! result
598 <p><i><b>foo</b></i>
599 </p>
600 !!end
601
602 ###
603 ### multiple quote sequences in a line
604 ###
605 !! test
606 Italics and bold: multiple quote sequences: (2,4,2)
607 !! input
608 ''foo''''bar''
609 !! result
610 <p><i>foo'<b>bar</b></i>
611 </p>
612 !!end
613
614
615 !! test
616 Italics and bold: multiple quote sequences: (2,4,3)
617 !! input
618 ''foo''''bar'''
619 !! result
620 <p><i>foo'<b>bar</b></i>
621 </p>
622 !!end
623
624
625 !! test
626 Italics and bold: multiple quote sequences: (2,4,4)
627 !! input
628 ''foo''''bar''''
629 !! result
630 <p><i>foo'<b>bar'</b></i>
631 </p>
632 !!end
633
634
635 !! test
636 Italics and bold: multiple quote sequences: (3,4,2) (php)
637 !! options
638 php
639 !! input
640 '''foo''''bar''
641 !! result
642 <p><b>foo'</b>bar
643 </p>
644 !!end
645 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
646 !! test
647 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
648 !! options
649 parsoid
650 !! input
651 '''foo''''bar''
652 !! result
653 <p><b>foo'</b>bar<i></i>
654 </p>
655 !!end
656
657
658 !! test
659 Italics and bold: multiple quote sequences: (3,4,3) (php)
660 !! options
661 php
662 !! input
663 '''foo''''bar'''
664 !! result
665 <p><b>foo'</b>bar
666 </p>
667 !!end
668 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
669 !! test
670 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
671 !! options
672 parsoid
673 !! input
674 '''foo''''bar'''
675 !! result
676 <p><b>foo'</b>bar<b></b>
677 </p>
678 !!end
679
680 ###
681 ### other quote tests
682 ###
683 !! test
684 Italics and bold: other quote tests: (2,3,5)
685 !! input
686 ''this is about '''foo's family'''''
687 !! result
688 <p><i>this is about <b>foo's family</b></i>
689 </p>
690 !!end
691
692
693 !! test
694 Italics and bold: other quote tests: (2,(3,3),2)
695 !! input
696 ''this is about '''foo's''' family''
697 !! result
698 <p><i>this is about <b>foo's</b> family</i>
699 </p>
700 !!end
701
702
703 !! test
704 Italics and bold: other quote tests: (3,2,3,2)
705 !! input
706 '''this is about ''foo'''s family''
707 !! result
708 <p><b>this is about <i>foo</i></b><i>s family</i>
709 </p>
710 !!end
711
712
713 # The Parsoid team believes the PHP parser's output on this test is wrong.
714 # It only checks for convert-to-bold-on-single-character-word when the word
715 # matches with a bold tag ("'''") that is *odd* in the list of quote tokens.
716 # This means that the bold token in position 2 (0-indexed) gets converted by
717 # parsoid, but doesn't get changed by the PHP parser.
718 !! test
719 Italics and bold: other quote tests: (3,2,3,3) (php)
720 !! options
721 php
722 !! input
723 '''this is about ''foo'''s family'''
724 !! result
725 <p>'<i>this is about </i>foo<b>s family</b>
726 </p>
727 !!end
728 # This is the output the Parsoid team believes to be correct.
729 !! test
730 Italics and bold: other quote tests: (3,2,3,3) (parsoid)
731 !! options
732 parsoid
733 !! input
734 '''this is about ''foo'''s family'''
735 !! result
736 <p><b>this is about <i>foo'</i>s family</b>
737 </p>
738 !!end
739
740
741 !! test
742 Italics and bold: other quote tests: (3,(2,2),3)
743 !! input
744 '''this is about ''foo's'' family'''
745 !! result
746 <p><b>this is about <i>foo's</i> family</b>
747 </p>
748 !!end
749
750
751 !! test
752 Italicized possessive
753 !! input
754 The ''[[Main Page]]'''s talk page.
755 !! result
756 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
757 </p>
758 !! end
759
760 ###
761 ### Non-html5 tags
762 ###
763
764 !! test
765 Non-html5 tags should be accepted
766 !! input
767 <center>''foo''</center>
768 <big>''foo''</big>
769 <font>''foo''</font>
770 <strike>''foo''</strike>
771 <tt>''foo''</tt>
772 !! result
773 <center><i>foo</i></center>
774 <p><big><i>foo</i></big>
775 <font><i>foo</i></font>
776 <strike><i>foo</i></strike>
777 <tt><i>foo</i></tt>
778 </p>
779 !! end
780
781 ###
782 ### <nowiki> test cases
783 ###
784
785 !! test
786 <nowiki> unordered list
787 !! input
788 <nowiki>* This is not an unordered list item.</nowiki>
789 !! result
790 <p>* This is not an unordered list item.
791 </p>
792 !! end
793
794 !! test
795 <nowiki> spacing
796 !! input
797 <nowiki>Lorem ipsum dolor
798
799 sed abit.
800 sed nullum.
801
802 :and a colon
803 </nowiki>
804 !! result
805 <p>Lorem ipsum dolor
806
807 sed abit.
808 sed nullum.
809
810 :and a colon
811
812 </p>
813 !! end
814
815 !! test
816 nowiki 3
817 !! input
818 :There is not nowiki.
819 :There is <nowiki>nowiki</nowiki>.
820
821 #There is not nowiki.
822 #There is <nowiki>nowiki</nowiki>.
823
824 *There is not nowiki.
825 *There is <nowiki>nowiki</nowiki>.
826 !! result
827 <dl><dd>There is not nowiki.
828 </dd><dd>There is nowiki.
829 </dd></dl>
830 <ol><li>There is not nowiki.
831 </li><li>There is nowiki.
832 </li></ol>
833 <ul><li>There is not nowiki.
834 </li><li>There is nowiki.
835 </li></ul>
836
837 !! end
838
839 !! test
840 Entities inside <nowiki>
841 !! input
842 <nowiki>&lt;</nowiki>
843 !! result
844 <p>&lt;
845 </p>
846 !! end
847
848
849 ###
850 ### Comments
851 ###
852 !! test
853 Comments and Indent-Pre
854 !! input
855 <!-- comment 1 --> asdf
856
857 <!-- comment 1 --> asdf
858 <!-- comment 2 -->
859
860 <!-- comment 1 --> asdf
861 <!-- comment 2 -->xyz
862
863 <!-- comment 1 --> asdf
864 <!-- comment 2 --> xyz
865 !! result
866 <pre>asdf
867 </pre>
868 <pre>asdf
869 </pre>
870 <pre>asdf
871 </pre>
872 <p>xyz
873 </p>
874 <pre>asdf
875 xyz
876 </pre>
877 !! end
878
879 !! test
880 Comment test 2a
881 !! input
882 asdf
883 <!-- comment 1 -->
884 jkl
885 !! result
886 <p>asdf
887 jkl
888 </p>
889 !! end
890
891 !! test
892 Comment test 2b
893 !! input
894 asdf
895 <!-- comment 1 -->
896
897 jkl
898 !! result
899 <p>asdf
900 </p><p>jkl
901 </p>
902 !! end
903
904 !! test
905 Comment test 3
906 !! input
907 asdf
908 <!-- comment 1 -->
909 <!-- comment 2 -->
910 jkl
911 !! result
912 <p>asdf
913 jkl
914 </p>
915 !! end
916
917 !! test
918 Comment test 4
919 !! input
920 asdf<!-- comment 1 -->jkl
921 !! result
922 <p>asdfjkl
923 </p>
924 !! end
925
926 !! test
927 Comment spacing
928 !! input
929 a
930 <!-- foo --> b <!-- bar -->
931 c
932 !! result
933 <p>a
934 </p>
935 <pre> b
936 </pre>
937 <p>c
938 </p>
939 !! end
940
941 !! test
942 Comment whitespace
943 !! input
944 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
945 !! result
946
947 !! end
948
949 !! test
950 Comment semantics and delimiters
951 !! input
952 <!-- --><!----><!-----><!------>
953 !! result
954
955 !! end
956
957 !! test
958 Comment semantics and delimiters, redux
959 !! input
960 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
961 -- foo -- funky huh? ... -->
962 !! result
963
964 !! end
965
966 !! test
967 Comment semantics and delimiters: directors cut
968 !! input
969 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
970 everything starting with < followed by !-- until the first -- and > we see,
971 that wouldn't be valid XML however, since in XML -- has to terminate a comment
972 -->-->
973 !! result
974 <p>--&gt;
975 </p>
976 !! end
977
978 !! test
979 Comment semantics: nesting
980 !! input
981 <!--<!-- no, we're not going to do anything fancy here -->-->
982 !! result
983 <p>--&gt;
984 </p>
985 !! end
986
987 !! test
988 Comment semantics: unclosed comment at end
989 !! input
990 <!--This comment will run out to the end of the document
991 !! result
992
993 !! end
994
995 !! test
996 Comment in template title
997 !! input
998 {{f<!---->oo}}
999 !! result
1000 <p>FOO
1001 </p>
1002 !! end
1003
1004 !! test
1005 Comment on its own line post-expand
1006 !! input
1007 a
1008 {{blank}}<!---->
1009 b
1010 !! result
1011 <p>a
1012 </p><p>b
1013 </p>
1014 !! end
1015
1016 !! test
1017 Comment on its own line post-expand with non-significant whitespace
1018 !! input
1019 a
1020 {{blank}} <!---->
1021 b
1022 !! result
1023 <p>a
1024 </p><p>b
1025 </p>
1026 !! end
1027
1028 ###
1029 ### paragraph wraping tests
1030 ###
1031 !! test
1032 No block tags
1033 !! input
1034 a
1035
1036 b
1037 !! result
1038 <p>a
1039 </p><p>b
1040 </p>
1041 !! end
1042 !! test
1043 Block tag on one line
1044 !! input
1045 a <div>foo</div>
1046
1047 b
1048 !! result
1049 a <div>foo</div>
1050 <p>b
1051 </p>
1052 !! end
1053
1054 !! test
1055 Block tag on both lines
1056 !! input
1057 a <div>foo</div>
1058
1059 b <div>foo</div>
1060 !! result
1061 a <div>foo</div>
1062 b <div>foo</div>
1063
1064 !! end
1065
1066 !! test
1067 Multiple lines without block tags
1068 !! input
1069 <div>foo</div> a
1070 b
1071 c
1072 d<!--foo--> e
1073 x <div>foo</div> z
1074 !! result
1075 <div>foo</div> a
1076 <p>b
1077 c
1078 d e
1079 </p>
1080 x <div>foo</div> z
1081
1082 !! end
1083
1084 !! test
1085 Empty lines between lines with block tags
1086 !! input
1087 <div></div>
1088
1089
1090 <div></div>a
1091
1092 b
1093 <div>a</div>b
1094
1095 <div>b</div>d
1096
1097
1098 <div>e</div>
1099 !! result
1100 <div></div>
1101 <p><br />
1102 </p>
1103 <div></div>a
1104 <p>b
1105 </p>
1106 <div>a</div>b
1107 <div>b</div>d
1108 <p><br />
1109 </p>
1110 <div>e</div>
1111
1112 !! end
1113
1114 ###
1115 ### Preformatted text
1116 ###
1117 !! test
1118 Preformatted text
1119 !! input
1120 This is some
1121 Preformatted text
1122 With ''italic''
1123 And '''bold'''
1124 And a [[Main Page|link]]
1125 !! result
1126 <pre>This is some
1127 Preformatted text
1128 With <i>italic</i>
1129 And <b>bold</b>
1130 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1131 </pre>
1132 !! end
1133
1134 !! test
1135 Ident preformatting with inline content
1136 !! input
1137 a
1138 ''b''
1139 !! result
1140 <pre>a
1141 <i>b</i>
1142 </pre>
1143 !! end
1144
1145 !! test
1146 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1147 !! input
1148 <pre><nowiki>
1149 <b>
1150 <cite>
1151 <em>
1152 </nowiki></pre>
1153 !! result
1154 <pre>
1155 &lt;b&gt;
1156 &lt;cite&gt;
1157 &lt;em&gt;
1158 </pre>
1159
1160 !! end
1161
1162 !! test
1163 Regression with preformatted in <center>
1164 !! input
1165 <center>
1166 Blah
1167 </center>
1168 !! result
1169 <center>
1170 <pre>Blah
1171 </pre>
1172 </center>
1173
1174 !! end
1175
1176 # Expected output in the following test is not really expected (there should be
1177 # <pre> in the output) -- it's only testing for well-formedness.
1178 !! test
1179 Bug 6200: Preformatted in <blockquote>
1180 !! input
1181 <blockquote>
1182 Blah
1183 </blockquote>
1184 !! result
1185 <blockquote>
1186 Blah
1187 </blockquote>
1188
1189 !! end
1190
1191 !! test
1192 <pre> with attributes (bug 3202)
1193 !! input
1194 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1195 !! result
1196 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1197
1198 !! end
1199
1200 !! test
1201 <pre> with width attribute (bug 3202)
1202 !! input
1203 <pre width="8">Narrow screen goodies</pre>
1204 !! result
1205 <pre width="8">Narrow screen goodies</pre>
1206
1207 !! end
1208
1209 !! test
1210 <pre> with forbidden attribute (bug 3202)
1211 !! input
1212 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1213 !! result
1214 <pre width="8">Narrow screen goodies</pre>
1215
1216 !! end
1217
1218 !! test
1219 Entities inside <pre>
1220 !! input
1221 <pre>&lt;</pre>
1222 !! result
1223 <pre>&lt;</pre>
1224
1225 !! end
1226
1227 !! test
1228 <pre> with forbidden attribute values (bug 3202)
1229 !! input
1230 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1231 !! result
1232 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1233
1234 !! end
1235
1236 !! test
1237 <nowiki> inside <pre> (bug 13238)
1238 !! input
1239 <pre>
1240 <nowiki>
1241 </pre>
1242 <pre>
1243 <nowiki></nowiki>
1244 </pre>
1245 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1246 !! result
1247 <pre>
1248 &lt;nowiki&gt;
1249 </pre>
1250 <pre>
1251
1252 </pre>
1253 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1254
1255 !! end
1256
1257 !! test
1258 <nowiki> and <pre> preference (first one wins)
1259 !! input
1260 <pre>
1261 <nowiki>
1262 </pre>
1263 </nowiki>
1264 </pre>
1265
1266 <nowiki>
1267 <pre>
1268 <nowiki>
1269 </pre>
1270 </nowiki>
1271 </pre>
1272
1273 !! result
1274 <pre>
1275 &lt;nowiki&gt;
1276 </pre>
1277 <p>&lt;/nowiki&gt;
1278 &lt;/pre&gt;
1279 </p><p>
1280 &lt;pre&gt;
1281 &lt;nowiki&gt;
1282 &lt;/pre&gt;
1283
1284 &lt;/pre&gt;
1285 </p>
1286 !! end
1287
1288 !! test
1289 </pre> inside nowiki
1290 !! input
1291 <nowiki></pre></nowiki>
1292 !! result
1293 <p>&lt;/pre&gt;
1294 </p>
1295 !! end
1296
1297 !!test
1298 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1299 !!input
1300 {{echo|}}
1301 !!result
1302
1303 !!end
1304
1305 !!test
1306 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1307 !!input
1308 {{echo|
1309 foo}}
1310 !!result
1311 <p>foo
1312 </p>
1313 !!end
1314
1315 !! test
1316 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1317 !! input
1318 {{echo|a
1319 b}}
1320 !!result
1321 <pre>a
1322 </pre>
1323 <p>b
1324 </p>
1325 !!end
1326
1327 !! test
1328 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1329 !! input
1330 {{echo|a
1331 b
1332 c
1333 d
1334 e
1335 }}
1336 !!result
1337 <pre>a
1338 </pre>
1339 <p>b
1340 c
1341 </p>
1342 <pre>d
1343 </pre>
1344 <p>e
1345 </p>
1346 !!end
1347
1348 !!test
1349 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1350 !!input
1351 {{echo| foo}}
1352
1353 {{echo| foo}}{{echo| bar}}
1354
1355 {{echo| foo}}
1356 {{echo| bar}}
1357
1358 {{echo|<!--cmt--> foo}}
1359
1360 <!--cmt-->{{echo| foo}}
1361
1362 {{echo|{{echo| }}bar}}
1363 !!result
1364 <pre>foo
1365 </pre>
1366 <pre>foo bar
1367 </pre>
1368 <pre>foo
1369 bar
1370 </pre>
1371 <pre>foo
1372 </pre>
1373 <pre>foo
1374 </pre>
1375 <pre>bar
1376 </pre>
1377 !!end
1378
1379 !! test
1380 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1381 !! input
1382 {{echo| }}a
1383
1384 {{echo|
1385 }}a
1386
1387 {{echo|
1388 b}}
1389
1390 {{echo|a
1391 }}b
1392
1393 {{echo|a
1394 }} b
1395 !!result
1396 <pre>a
1397 </pre>
1398 <p><br />
1399 </p>
1400 <pre>a
1401 </pre>
1402 <p><br />
1403 </p>
1404 <pre>b
1405 </pre>
1406 <p>a
1407 </p>
1408 <pre>b
1409 </pre>
1410 <p>a
1411 </p>
1412 <pre>b
1413 </pre>
1414 !!end
1415
1416 !! test
1417 Templates: Single-line variant of parameter whitespace stripping test
1418 !! input
1419 {{echo| a}}
1420
1421 {{echo|1= a}}
1422
1423 {{echo|{{echo| a}}}}
1424
1425 {{echo|1={{echo| a}}}}
1426 !! result
1427 <pre>a
1428 </pre>
1429 <p>a
1430 </p>
1431 <pre>a
1432 </pre>
1433 <p>a
1434 </p>
1435 !! end
1436
1437 !! test
1438 Templates: Strip whitespace from named parameters, but not positional ones
1439 !! input
1440 {{echo|
1441 foo}}
1442
1443 {{echo|
1444 * foo}}
1445
1446 {{echo| 1 =
1447 foo}}
1448
1449 {{echo| 1 =
1450 * foo}}
1451 !! result
1452 <pre>foo
1453 </pre>
1454 <p><br />
1455 </p>
1456 <ul><li> foo
1457 </li></ul>
1458 <p>foo
1459 </p>
1460 <ul><li> foo
1461 </li></ul>
1462
1463 !! end
1464
1465 ###
1466 ### Parsoid-centric tests for testing RT edge cases for pre
1467 ###
1468
1469 !!test
1470 1a. Indent-Pre and Comments
1471 !!input
1472 a
1473 <!--a-->
1474 c
1475 !!result
1476 <pre>a
1477 </pre>
1478 <p>c
1479 </p>
1480 !!end
1481
1482 !!test
1483 1b. Indent-Pre and Comments
1484 !!input
1485 a
1486 <!--a-->
1487 c
1488 !!result
1489 <pre>a
1490 </pre>
1491 <p>c
1492 </p>
1493 !!end
1494
1495 !!test
1496 1c. Indent-Pre and Comments
1497 !!input
1498 <!--a--> a
1499
1500 <!--a--> a
1501 !!result
1502 <pre> a
1503 </pre>
1504 <pre> a
1505 </pre>
1506 !!end
1507
1508 !!test
1509 2a. Indent-Pre and tables
1510 !!input
1511 {|
1512 |-
1513 !h1!!h2
1514 |foo||bar
1515 |}
1516 !!result
1517 <table>
1518
1519 <tr>
1520 <th>h1</th>
1521 <th>h2
1522 </th>
1523 <td>foo</td>
1524 <td>bar
1525 </td></tr></table>
1526
1527 !!end
1528
1529 !!test
1530 2b. Indent-Pre and tables
1531 !!input
1532 {|
1533 |-
1534 |foo
1535 |}
1536 !!result
1537 <table>
1538
1539 <tr>
1540 <td>foo
1541 </td></tr></table>
1542
1543 !!end
1544
1545 !!test
1546 2c. Indent-Pre and tables (bug 42252)
1547 !!input
1548 {|
1549 |+ foo
1550 ! | bar
1551 |}
1552 !!result
1553 <table>
1554 <caption> foo
1555 </caption>
1556 <tr>
1557 <th> bar
1558 </th></tr></table>
1559
1560 !!end
1561
1562 !!test
1563 3a. Indent-Pre and block tags (single-line html)
1564 !!input
1565 <p> foo </p>
1566 <div> foo </div>
1567 <span> foo </span>
1568 !!result
1569 <p> foo </p>
1570 <div> foo </div>
1571 <pre><span> foo </span>
1572 </pre>
1573 !!end
1574
1575 !!test
1576 3b. Indent-Pre and block tags (pre-content on separate line)
1577 !!input
1578 <p>
1579 foo
1580 </p>
1581
1582 <div>
1583 foo
1584 </div>
1585
1586 <center>
1587 foo
1588 </center>
1589
1590 <blockquote>
1591 foo
1592 </blockquote>
1593
1594 <table><tr><td>
1595 foo
1596 </td></tr></table>
1597
1598 <ul><li>
1599 foo
1600 </li></ul>
1601
1602 !!result
1603 <p>
1604 foo
1605 </p>
1606 <div>
1607 <pre>foo
1608 </pre>
1609 </div>
1610 <center>
1611 <pre>foo
1612 </pre>
1613 </center>
1614 <blockquote>
1615 foo
1616 </blockquote>
1617 <table><tr><td>
1618 <pre>foo
1619 </pre>
1620 </td></tr></table>
1621 <ul><li>
1622 foo
1623 </li></ul>
1624
1625 !!end
1626
1627 !!test
1628 4. Multiple spaces at start-of-line
1629 !!input
1630 <p> foo </p>
1631 foo
1632 {|
1633 |foo
1634 |}
1635 !!result
1636 <p> foo </p>
1637 <pre> foo
1638 </pre>
1639 <table>
1640 <tr>
1641 <td>foo
1642 </td></tr></table>
1643
1644 !!end
1645
1646 !! test
1647 5. White-space in indent-pre
1648 NOTE: the white-space char on 2nd line is significant
1649 !! input
1650 a<br/>
1651
1652 b
1653 !! result
1654 <pre>a<br />
1655
1656 b
1657 </pre>
1658 !! end
1659
1660 ###
1661 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1662 ###
1663
1664 !!test
1665 HTML-pre: 1. embedded newlines
1666 !!input
1667 <pre>foo</pre>
1668
1669 <pre>
1670 foo
1671 </pre>
1672
1673 <pre>
1674
1675 foo
1676 </pre>
1677
1678 <pre>
1679
1680
1681 foo
1682 </pre>
1683 !!result
1684 <pre>foo</pre>
1685 <pre>
1686 foo
1687 </pre>
1688 <pre>
1689
1690 foo
1691 </pre>
1692 <pre>
1693
1694
1695 foo
1696 </pre>
1697
1698 !!end
1699
1700 !!test
1701 HTML-pre: 2: indented text
1702 !!input
1703 <pre>
1704 foo
1705 </pre>
1706 !!result
1707 <pre>
1708 foo
1709 </pre>
1710
1711 !!end
1712
1713 !!test
1714 HTML-pre: 3: other wikitext
1715 !!input
1716 <pre>
1717 * foo
1718 # bar
1719 = no-h =
1720 '' no-italic ''
1721 [[ NoLink ]]
1722 </pre>
1723 !!result
1724 <pre>
1725 * foo
1726 # bar
1727 = no-h =
1728 '' no-italic ''
1729 [[ NoLink ]]
1730 </pre>
1731
1732 !!end
1733
1734 ###
1735 ### Definition lists
1736 ###
1737 !! test
1738 Simple definition
1739 !! input
1740 ; name : Definition
1741 !! result
1742 <dl><dt> name&#160;</dt><dd> Definition
1743 </dd></dl>
1744
1745 !! end
1746
1747 !! test
1748 Definition list for indentation only
1749 !! input
1750 : Indented text
1751 !! result
1752 <dl><dd> Indented text
1753 </dd></dl>
1754
1755 !! end
1756
1757 !! test
1758 Definition list with no space
1759 !! input
1760 ;name:Definition
1761 !! result
1762 <dl><dt>name</dt><dd>Definition
1763 </dd></dl>
1764
1765 !!end
1766
1767 !! test
1768 Definition list with URL link
1769 !! input
1770 ; http://example.com/ : definition
1771 !! result
1772 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
1773 </dd></dl>
1774
1775 !! end
1776
1777 !! test
1778 Definition list with bracketed URL link
1779 !! input
1780 ;[http://www.example.com/ Example]:Something about it
1781 !! result
1782 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
1783 </dd></dl>
1784
1785 !! end
1786
1787 !! test
1788 Definition list with wikilink containing colon
1789 !! input
1790 ; [[Help:FAQ]]: The least-read page on Wikipedia
1791 !! result
1792 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt><dd> The least-read page on Wikipedia
1793 </dd></dl>
1794
1795 !! end
1796
1797 # At Brion's and JeLuF's insistence... :)
1798 !! test
1799 Definition list with news link containing colon
1800 !! input
1801 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
1802 !! result
1803 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt><dd> This isn't even a real newsgroup!
1804 </dd></dl>
1805
1806 !! end
1807
1808 !! test
1809 Malformed definition list with colon
1810 !! input
1811 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
1812 !! result
1813 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop
1814 </dt></dl>
1815
1816 !! end
1817
1818 !! test
1819 Definition lists: colon in external link text
1820 !! input
1821 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
1822 !! result
1823 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt><dd> OK, I made that up
1824 </dd></dl>
1825
1826 !! end
1827
1828 !! test
1829 Definition lists: colon in HTML attribute
1830 !! input
1831 ;<b style="display: inline">bold</b>
1832 !! result
1833 <dl><dt><b style="display: inline">bold</b>
1834 </dt></dl>
1835
1836 !! end
1837
1838 !! test
1839 Definition lists: self-closed tag
1840 !! input
1841 ;one<br/>two : two-line fun
1842 !! result
1843 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
1844 </dd></dl>
1845
1846 !! end
1847
1848 !! test
1849 Bug 11748: Literal closing tags
1850 !! input
1851 <dl>
1852 <dt>test 1</dt>
1853 <dd>test test test test test</dd>
1854 <dt>test 2</dt>
1855 <dd>test test test test test</dd>
1856 </dl>
1857 !! result
1858 <dl>
1859 <dt>test 1</dt>
1860 <dd>test test test test test</dd>
1861 <dt>test 2</dt>
1862 <dd>test test test test test</dd>
1863 </dl>
1864
1865 !! end
1866
1867 !! test
1868 Definition and unordered list using wiki syntax nested in unordered list using html tags.
1869 !! input
1870 <ul><li>
1871 ; term : description
1872 * unordered
1873 </li>
1874 </ul>
1875 !! result
1876 <ul><li>
1877 <dl><dt> term&#160;</dt><dd> description
1878 </dd></dl>
1879 <ul><li> unordered
1880 </li></ul>
1881 </li>
1882 </ul>
1883
1884 !! end
1885
1886 !! test
1887
1888 Definition list with empty definition and following paragraph
1889 !! input
1890 ; term:
1891 Paragraph text
1892 !! result
1893 <dl><dt> term</dt><dd>
1894 </dd></dl>
1895 <p>Paragraph text
1896 </p>
1897 !! end
1898
1899 !! test
1900 Nested definition lists using html syntax
1901 !! input
1902 <dl><dd>
1903 <dl>
1904 <dd>Foo</dd>
1905 </dl>
1906 </dd></dl>
1907 !! result
1908 <dl><dd>
1909 <dl>
1910 <dd>Foo</dd>
1911 </dl>
1912 </dd></dl>
1913
1914 !! end
1915
1916 !! test
1917 Definition Lists: No nesting: Multiple dd's
1918 !! input
1919 ;x
1920 :a
1921 :b
1922 !! result
1923 <dl><dt>x
1924 </dt><dd>a
1925 </dd><dd>b
1926 </dd></dl>
1927
1928 !! end
1929
1930 !! test
1931 Definition Lists: Indentation: Regular
1932 !! input
1933 :i1
1934 ::i2
1935 :::i3
1936 !! result
1937 <dl><dd>i1
1938 <dl><dd>i2
1939 <dl><dd>i3
1940 </dd></dl>
1941 </dd></dl>
1942 </dd></dl>
1943
1944 !! end
1945
1946 !! test
1947 Definition Lists: Indentation: Missing 1st level
1948 !! input
1949 ::i2
1950 :::i3
1951 !! result
1952 <dl><dd><dl><dd>i2
1953 <dl><dd>i3
1954 </dd></dl>
1955 </dd></dl>
1956 </dd></dl>
1957
1958 !! end
1959
1960 !! test
1961 Definition Lists: Indentation: Multi-level indent
1962 !! input
1963 :::i3
1964 !! result
1965 <dl><dd><dl><dd><dl><dd>i3
1966 </dd></dl>
1967 </dd></dl>
1968 </dd></dl>
1969
1970 !! end
1971
1972 !! test
1973 Definition Lists: Hacky use to indent tables
1974 !! input
1975 ::{|
1976 |foo
1977 |bar
1978 |}
1979 this text
1980 should be left alone
1981 !! result
1982 <dl><dd><dl><dd><table>
1983 <tr>
1984 <td>foo
1985 </td>
1986 <td>bar
1987 </td></tr></table></dd></dl></dd></dl>
1988 <p>this text
1989 should be left alone
1990 </p>
1991 !! end
1992 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
1993 ## as an empty dt item. It also ignores all but the last ";" when followed
1994 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
1995 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
1996 ## ";"s.
1997 ##
1998 ## Ex: ";;t2 ::d2" is transformed into:
1999 ##
2000 ## <dl>
2001 ## <dt>t2 </dt>
2002 ## <dd>
2003 ## <dl>
2004 ## <dt></dt>
2005 ## <dd>d2</dd>
2006 ## </dl>
2007 ## </dd>
2008 ## </dl>
2009 ##
2010 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2011 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2012 ##
2013 ## <dl>
2014 ## <dt>
2015 ## <dl>
2016 ## <dt>t2 </dt>
2017 ## <dd>:d2</dd>
2018 ## </dl>
2019 ## </dt>
2020 ## </dl>
2021 ##
2022 ## All Parsoid only definition list tests have this difference.
2023 ##
2024 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2025 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2026
2027 !! test
2028 Table / list interaction: indented table with lists in table contents
2029 !! input
2030 :{|
2031 |-
2032 | a
2033 * b
2034 |-
2035 | c
2036 * d
2037 |}
2038 !! result
2039 <dl><dd><table>
2040
2041 <tr>
2042 <td> a
2043 <ul><li> b
2044 </li></ul>
2045 </td></tr>
2046 <tr>
2047 <td> c
2048 <ul><li> d
2049 </li></ul>
2050 </td></tr></table></dd></dl>
2051
2052 !! end
2053
2054 !!test
2055 Table / list interaction: lists nested in tables nested in indented lists
2056 !!input
2057 :{|
2058 |
2059 :a
2060 :b
2061 |
2062 *c
2063 *d
2064 |}
2065
2066 *e
2067 *f
2068 !!result
2069 <dl><dd><table>
2070 <tr>
2071 <td>
2072 <dl><dd>a
2073 </dd><dd>b
2074 </dd></dl>
2075 </td>
2076 <td>
2077 <ul><li>c
2078 </li><li>d
2079 </li></ul>
2080 </td></tr></table></dd></dl>
2081 <ul><li>e
2082 </li><li>f
2083 </li></ul>
2084
2085 !!end
2086
2087 !! test
2088 Definition Lists: Nesting: Multi-level (Parsoid only)
2089 !! options
2090 parsoid
2091 !! input
2092 ;t1 :d1
2093 ;;t2 ::d2
2094 ;;;t3 :::d3
2095 !! result
2096 <dl>
2097 <dt>t1 </dt>
2098 <dd>d1</dd>
2099 <dt>
2100 <dl>
2101 <dt>t2 </dt>
2102 <dd>:d2</dd>
2103 <dt>
2104 <dl>
2105 <dt>t3 </dt>
2106 <dd>::d3</dd>
2107 </dl>
2108 </dt>
2109 </dl>
2110 </dt>
2111 </dl>
2112
2113
2114 !! end
2115
2116
2117 !! test
2118 Definition Lists: Nesting: Test 2 (Parsoid only)
2119 !! options
2120 parsoid
2121 !! input
2122 ;t1
2123 ::d2
2124 !! result
2125 <dl>
2126 <dt>t1</dt>
2127 <dd>
2128 <dl>
2129 <dd>d2</dd>
2130 </dl>
2131 </dd>
2132 </dl>
2133
2134 !! end
2135
2136
2137 !! test
2138 Definition Lists: Nesting: Test 3 (Parsoid only)
2139 !! options
2140 parsoid
2141 !! input
2142 :;t1
2143 ::::d2
2144 !! result
2145 <dl>
2146 <dd>
2147 <dl>
2148 <dt>t1</dt>
2149 <dd>
2150 <dl>
2151 <dd>
2152 <dl>
2153 <dd>d2</dd>
2154 </dl>
2155 </dd>
2156 </dl>
2157 </dd>
2158 </dl>
2159 </dd>
2160 </dl>
2161
2162 !! end
2163
2164
2165 !! test
2166 Definition Lists: Nesting: Test 4
2167 !! input
2168 ::;t3
2169 :::d3
2170 !! result
2171 <dl><dd><dl><dd><dl><dt>t3
2172 </dt><dd>d3
2173 </dd></dl>
2174 </dd></dl>
2175 </dd></dl>
2176
2177 !! end
2178
2179
2180 ## The Parsoid team believes the following three test exposes a
2181 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2182 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2183 !! test
2184 Definition Lists: Mixed Lists: Test 1 (php)
2185 !! options
2186 php
2187 !! input
2188 :;* foo
2189 ::* bar
2190 :; baz
2191 !! result
2192 <dl><dd><dl><dt><ul><li> foo
2193 </li><li> bar
2194 </li></ul>
2195 </dt></dl>
2196 <dl><dt> baz
2197 </dt></dl>
2198 </dd></dl>
2199
2200 !! end
2201 !! test
2202 Definition Lists: Mixed Lists: Test 1 (parsoid)
2203 !! options
2204 parsoid
2205 !! input
2206 :;* foo
2207 ::* bar
2208 :; baz
2209 !! result
2210 <dl><dd><dl><dt><ul><li> foo
2211 </li></ul></dt><dd><ul><li> bar
2212 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2213 !! end
2214
2215 !! test
2216 Definition Lists: Mixed Lists: Test 2
2217 !! input
2218 *: d1
2219 *: d2
2220 !! result
2221 <ul><li><dl><dd> d1
2222 </dd><dd> d2
2223 </dd></dl>
2224 </li></ul>
2225
2226 !! end
2227
2228
2229 !! test
2230 Definition Lists: Mixed Lists: Test 3
2231 !! input
2232 *::: d1
2233 *::: d2
2234 !! result
2235 <ul><li><dl><dd><dl><dd><dl><dd> d1
2236 </dd><dd> d2
2237 </dd></dl>
2238 </dd></dl>
2239 </dd></dl>
2240 </li></ul>
2241
2242 !! end
2243
2244
2245 !! test
2246 Definition Lists: Mixed Lists: Test 4
2247 !! input
2248 *;d1 :d2
2249 *;d3 :d4
2250 !! result
2251 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2252 </dd><dt>d3&#160;</dt><dd>d4
2253 </dd></dl>
2254 </li></ul>
2255
2256 !! end
2257
2258
2259 !! test
2260 Definition Lists: Mixed Lists: Test 5
2261 !! input
2262 *:d1
2263 *:: d2
2264 !! result
2265 <ul><li><dl><dd>d1
2266 <dl><dd> d2
2267 </dd></dl>
2268 </dd></dl>
2269 </li></ul>
2270
2271 !! end
2272
2273
2274 !! test
2275 Definition Lists: Mixed Lists: Test 6
2276 !! input
2277 #*:d1
2278 #*::: d3
2279 !! result
2280 <ol><li><ul><li><dl><dd>d1
2281 <dl><dd><dl><dd> d3
2282 </dd></dl>
2283 </dd></dl>
2284 </dd></dl>
2285 </li></ul>
2286 </li></ol>
2287
2288 !! end
2289
2290
2291 !! test
2292 Definition Lists: Mixed Lists: Test 7
2293 !! input
2294 :* d1
2295 :* d2
2296 !! result
2297 <dl><dd><ul><li> d1
2298 </li><li> d2
2299 </li></ul>
2300 </dd></dl>
2301
2302 !! end
2303
2304
2305 !! test
2306 Definition Lists: Mixed Lists: Test 8
2307 !! input
2308 :* d1
2309 ::* d2
2310 !! result
2311 <dl><dd><ul><li> d1
2312 </li></ul>
2313 <dl><dd><ul><li> d2
2314 </li></ul>
2315 </dd></dl>
2316 </dd></dl>
2317
2318 !! end
2319
2320
2321 !! test
2322 Definition Lists: Mixed Lists: Test 9
2323 !! input
2324 *;foo :bar
2325 !! result
2326 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2327 </dd></dl>
2328 </li></ul>
2329
2330 !! end
2331
2332
2333 !! test
2334 Definition Lists: Mixed Lists: Test 10
2335 !! input
2336 *#;foo :bar
2337 !! result
2338 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2339 </dd></dl>
2340 </li></ol>
2341 </li></ul>
2342
2343 !! end
2344
2345 # The Parsoid team disagrees with the PHP parser's seemingly-random
2346 # rules regarding dd/dt on the next two tests. Parsoid is more
2347 # consistent, and recognizes the shared nesting and keeps the
2348 # still-open tags around until the nesting is complete.
2349
2350 !! test
2351 Definition Lists: Mixed Lists: Test 11 (php)
2352 !! options
2353 php
2354 !! input
2355 *#*#;*;;foo :bar
2356 *#*#;boo :baz
2357 !! result
2358 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2359 </dt></dl>
2360 </dd></dl>
2361 </li></ul>
2362 </dd></dl>
2363 <dl><dt>boo&#160;</dt><dd>baz
2364 </dd></dl>
2365 </li></ol>
2366 </li></ul>
2367 </li></ol>
2368 </li></ul>
2369
2370 !! end
2371 !! test
2372 Definition Lists: Mixed Lists: Test 11 (parsoid)
2373 !! options
2374 parsoid
2375 !! input
2376 *#*#;*;;foo :bar
2377 *#*#;boo :baz
2378 !! result
2379 <ul><li><ol><li><ul><li><ol><li><dl><dt><ul><li><dl><dt><dl><dt>foo&nbsp;</dt><dd>bar
2380 </dd></dl></dt></dl></li></ul></dt><dt>boo&nbsp;</dt><dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2381 !! end
2382
2383
2384 !! test
2385 Definition Lists: Weird Ones: Test 1 (php)
2386 !! options
2387 php
2388 !! input
2389 *#;*::;; foo : bar (who uses this?)
2390 !! result
2391 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2392 </dt></dl>
2393 </dd></dl>
2394 </dd></dl>
2395 </dd></dl>
2396 </li></ul>
2397 </dd></dl>
2398 </li></ol>
2399 </li></ul>
2400
2401 !! end
2402 !! test
2403 Definition Lists: Weird Ones: Test 1 (parsoid)
2404 !! options
2405 parsoid
2406 !! input
2407 *#;*::;; foo : bar (who uses this?)
2408 !! result
2409 <ul><li><ol><li><dl><dt><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> foo&nbsp;</dt><dd> bar (who uses this?)</dd></dl></dt></dl></dd></dl></dd></dl></li></ul></dt></dl></li></ol></li></ul>
2410 !! end
2411
2412 ###
2413 ### External links
2414 ###
2415 !! test
2416 External links: non-bracketed
2417 !! input
2418 Non-bracketed: http://example.com
2419 !! result
2420 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2421 </p>
2422 !! end
2423
2424 !! test
2425 External links: numbered
2426 !! input
2427 Numbered: [http://example.com]
2428 Numbered: [http://example.net]
2429 Numbered: [http://example.com]
2430 !! result
2431 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2432 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2433 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2434 </p>
2435 !!end
2436
2437 !! test
2438 External links: specified text
2439 !! input
2440 Specified text: [http://example.com link]
2441 !! result
2442 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2443 </p>
2444 !!end
2445
2446 !! test
2447 External links: trail
2448 !! input
2449 Linktrails should not work for external links: [http://example.com link]s
2450 !! result
2451 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2452 </p>
2453 !! end
2454
2455 !! test
2456 External links: dollar sign in URL
2457 !! input
2458 http://example.com/1$2345
2459 !! result
2460 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2461 </p>
2462 !! end
2463
2464 !! test
2465 External links: dollar sign in URL (named)
2466 !! input
2467 [http://example.com/1$2345]
2468 !! result
2469 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2470 </p>
2471 !!end
2472
2473 !! test
2474 External links: open square bracket forbidden in URL (bug 4377)
2475 !! input
2476 http://example.com/1[2345
2477 !! result
2478 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2479 </p>
2480 !! end
2481
2482 !! test
2483 External links: open square bracket forbidden in URL (named) (bug 4377)
2484 !! input
2485 [http://example.com/1[2345]
2486 !! result
2487 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2488 </p>
2489 !!end
2490
2491 !! test
2492 External links: nowiki in URL link text (bug 6230)
2493 !!input
2494 [http://example.com/ <nowiki>''example site''</nowiki>]
2495 !! result
2496 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2497 </p>
2498 !! end
2499
2500 !! test
2501 External links: newline forbidden in text (bug 6230 regression check)
2502 !! input
2503 [http://example.com/ first
2504 second]
2505 !! result
2506 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2507 second]
2508 </p>
2509 !!end
2510
2511 !! test
2512 External links: Pipe char between url and text
2513 !! input
2514 [http://example.com | link]
2515 !! result
2516 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2517 </p>
2518 !!end
2519
2520 !! test
2521 External links: protocol-relative URL in brackets
2522 !! input
2523 [//example.com/ Test]
2524 !! result
2525 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2526 </p>
2527 !! end
2528
2529 !! test
2530 External links: protocol-relative URL in brackets without text
2531 !! input
2532 [//example.com]
2533 !! result
2534 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2535 </p>
2536 !! end
2537
2538 !! test
2539 External links: protocol-relative URL in free text is left alone
2540 !! input
2541 //example.com/Foo
2542 !! result
2543 <p>//example.com/Foo
2544 </p>
2545 !!end
2546
2547 !! test
2548 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2549 !! input
2550 foo//example.com/Foo
2551 !! result
2552 <p>foo//example.com/Foo
2553 </p>
2554 !! end
2555
2556 !! test
2557 External image
2558 !! input
2559 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2560 !! result
2561 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2562 </p>
2563 !! end
2564
2565 !! test
2566 External image from https
2567 !! input
2568 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2569 !! result
2570 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2571 </p>
2572 !! end
2573
2574 !! test
2575 Link to non-http image, no img tag
2576 !! input
2577 Link to non-http image, no img tag: ftp://example.com/test.jpg
2578 !! result
2579 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
2580 </p>
2581 !! end
2582
2583 !! test
2584 External links: terminating separator
2585 !! input
2586 Terminating separator: http://example.com/thing,
2587 !! result
2588 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2589 </p>
2590 !! end
2591
2592 !! test
2593 External links: intervening separator
2594 !! input
2595 Intervening separator: http://example.com/1,2,3
2596 !! result
2597 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2598 </p>
2599 !! end
2600
2601 !! test
2602 External links: old bug with URL in query
2603 !! input
2604 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2605 !! result
2606 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2607 </p>
2608 !! end
2609
2610 !! test
2611 External links: old URL-in-URL bug, mixed protocols
2612 !! input
2613 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2614 !! result
2615 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2616 </p>
2617 !!end
2618
2619 !! test
2620 External links: URL in text
2621 !! input
2622 URL in text: [http://example.com http://example.com]
2623 !! result
2624 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2625 </p>
2626 !! end
2627
2628 !! test
2629 External links: Clickable images
2630 !! input
2631 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2632 !! result
2633 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
2634 </p>
2635 !!end
2636
2637 !! test
2638 External links: raw ampersand
2639 !! input
2640 Old &amp; use: http://x&y
2641 !! result
2642 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2643 </p>
2644 !! end
2645
2646 !! test
2647 External links: encoded ampersand
2648 !! input
2649 Old &amp; use: http://x&amp;y
2650 !! result
2651 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2652 </p>
2653 !! end
2654
2655 !! test
2656 External links: encoded equals (bug 6102)
2657 !! input
2658 http://example.com/?foo&#61;bar
2659 !! result
2660 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2661 </p>
2662 !! end
2663
2664 !! test
2665 External links: [raw ampersand]
2666 !! input
2667 Old &amp; use: [http://x&y]
2668 !! result
2669 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2670 </p>
2671 !! end
2672
2673 !! test
2674 External links: [encoded ampersand]
2675 !! input
2676 Old &amp; use: [http://x&amp;y]
2677 !! result
2678 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2679 </p>
2680 !! end
2681
2682 !! test
2683 External links: [encoded equals] (bug 6102)
2684 !! input
2685 [http://example.com/?foo&#61;bar]
2686 !! result
2687 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2688 </p>
2689 !! end
2690
2691 !! test
2692 External links: [IDN ignored character reference in hostname; strip it right off]
2693 !! input
2694 [http://e&zwnj;xample.com/]
2695 !! result
2696 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2697 </p>
2698 !! end
2699
2700 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2701 # Where an external link could easily circumvent the sanitization of the text of
2702 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2703 # test demands a higher standard. That's a bit strange.
2704 #
2705 # Example:
2706 #
2707 # http://e‌xample.com -> [http://example.com|http://example.com]
2708 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2709 #
2710 # The first example is sanitized, but the second is not. Any security benefits
2711 # from this production are trivial to circumvent. Either remove this test and
2712 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2713 # the test accordingly.
2714 #
2715 # All our love,
2716 # The Parsoid team.
2717 !! test
2718 External links: IDN ignored character reference in hostname; strip it right off
2719 !! input
2720 http://e&zwnj;xample.com/
2721 !! result
2722 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
2723 </p>
2724 !! end
2725
2726 !! test
2727 External links: www.jpeg.org (bug 554)
2728 !! input
2729 http://www.jpeg.org
2730 !!result
2731 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
2732 </p>
2733 !! end
2734
2735 !! test
2736 External links: URL within URL (original bug 2)
2737 !! input
2738 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
2739 !! result
2740 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
2741 </p>
2742 !! end
2743
2744 !! test
2745 BUG 361: URL inside bracketed URL
2746 !! input
2747 [http://www.example.com/foo http://www.example.com/bar]
2748 !! result
2749 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
2750 </p>
2751 !! end
2752
2753 !! test
2754 BUG 361: URL within URL, not bracketed
2755 !! input
2756 http://www.example.com/foo?=http://www.example.com/bar
2757 !! result
2758 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
2759 </p>
2760 !! end
2761
2762 !! test
2763 BUG 289: ">"-token in URL-tail
2764 !! input
2765 http://www.example.com/<hello>
2766 !! result
2767 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
2768 </p>
2769 !!end
2770
2771 !! test
2772 BUG 289: literal ">"-token in URL-tail
2773 !! input
2774 http://www.example.com/<b>html</b>
2775 !! result
2776 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
2777 </p>
2778 !!end
2779
2780 !! test
2781 BUG 289: ">"-token in bracketed URL
2782 !! input
2783 [http://www.example.com/<hello> stuff]
2784 !! result
2785 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
2786 </p>
2787 !!end
2788
2789 !! test
2790 BUG 289: literal ">"-token in bracketed URL
2791 !! input
2792 [http://www.example.com/<b>html</b> stuff]
2793 !! result
2794 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
2795 </p>
2796 !!end
2797
2798 !! test
2799 BUG 289: literal double quote at end of URL
2800 !! input
2801 http://www.example.com/"hello"
2802 !! result
2803 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
2804 </p>
2805 !!end
2806
2807 !! test
2808 BUG 289: literal double quote in bracketed URL
2809 !! input
2810 [http://www.example.com/"hello" stuff]
2811 !! result
2812 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
2813 </p>
2814 !!end
2815
2816 !! test
2817 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
2818 !! input
2819 [http://www.example.com test]
2820 !! result
2821 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
2822 </p>
2823 !! end
2824
2825 !! test
2826 External links: link text with spaces
2827 !! input
2828 [http://www.example.com a b c]
2829 [http://www.example.com ''a'' ''b'']
2830 !! result
2831 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
2832 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
2833 </p>
2834 !! end
2835
2836 !! test
2837 External links: wiki links within external link (Bug 3695)
2838 !! input
2839 [http://example.com [[wikilink]] embedded in ext link]
2840 !! result
2841 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
2842 </p>
2843 !! end
2844
2845 !! test
2846 BUG 787: Links with one slash after the url protocol are invalid
2847 !! input
2848 http:/example.com
2849
2850 [http:/example.com title]
2851 !! result
2852 <p>http:/example.com
2853 </p><p>[http:/example.com title]
2854 </p>
2855 !! end
2856
2857 !! test
2858 Bracketed external links with template-generated invalid target
2859 !! input
2860 [{{echo|http:/example.com}} title]
2861 !! result
2862 <p>[http:/example.com title]
2863 </p>
2864 !! end
2865
2866 !! test
2867 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
2868 !! input
2869 ''[http://example.com text'']
2870 [http://example.com '''text]'''
2871 ''Something [http://example.com in italic'']
2872 ''Something [http://example.com mixed''''', even bold]'''
2873 '''''Now [http://example.com both''''']
2874 !! result
2875 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
2876 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
2877 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
2878 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
2879 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
2880 </p>
2881 !! end
2882
2883
2884 !! test
2885 Bug 4781: %26 in URL
2886 !! input
2887 http://www.example.com/?title=AT%26T
2888 !! result
2889 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
2890 </p>
2891 !! end
2892
2893 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
2894 # % is actually legal in HTML5. Any change in output would need testing though.
2895 !! test
2896 Bug 4781, 5267: %25 in URL
2897 !! input
2898 http://www.example.com/?title=100%25_Bran
2899 !! result
2900 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
2901 </p>
2902 !! end
2903
2904 !! test
2905 Bug 4781, 5267: %28, %29 in URL
2906 !! input
2907 http://www.example.com/?title=Ben-Hur_%281959_film%29
2908 !! result
2909 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
2910 </p>
2911 !! end
2912
2913
2914 !! test
2915 Bug 4781: %26 in autonumber URL
2916 !! input
2917 [http://www.example.com/?title=AT%26T]
2918 !! result
2919 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
2920 </p>
2921 !! end
2922
2923 !! test
2924 Bug 4781, 5267: %26 in autonumber URL
2925 !! input
2926 [http://www.example.com/?title=100%25_Bran]
2927 !! result
2928 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
2929 </p>
2930 !! end
2931
2932 !! test
2933 Bug 4781, 5267: %28, %29 in autonumber URL
2934 !! input
2935 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
2936 !! result
2937 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
2938 </p>
2939 !! end
2940
2941
2942 !! test
2943 Bug 4781: %26 in bracketed URL
2944 !! input
2945 [http://www.example.com/?title=AT%26T link]
2946 !! result
2947 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
2948 </p>
2949 !! end
2950
2951 !! test
2952 Bug 4781, 5267: %26 in bracketed URL
2953 !! input
2954 [http://www.example.com/?title=100%25_Bran link]
2955 !! result
2956 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
2957 </p>
2958 !! end
2959
2960 !! test
2961 Bug 4781, 5267: %28, %29 in bracketed URL
2962 !! input
2963 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
2964 !! result
2965 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
2966 </p>
2967 !! end
2968
2969 !! test
2970 External link containing double-single-quotes in text '' (bug 4598 sanity check)
2971 !! input
2972 Some [http://example.com/ pretty ''italics'' and stuff]!
2973 !! result
2974 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
2975 </p>
2976 !! end
2977
2978 !! test
2979 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
2980 !! input
2981 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
2982 !! result
2983 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
2984 </p>
2985 !! end
2986
2987 !! test
2988 External link containing double-single-quotes with no space separating the url from text in italics
2989 !! input
2990 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
2991 !! result
2992 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
2993 </p>
2994 !! end
2995
2996 !! test
2997 URL-encoding in URL functions (single parameter)
2998 !! input
2999 {{localurl:Some page|amp=&}}
3000 !! result
3001 <p>/index.php?title=Some_page&amp;amp=&amp;
3002 </p>
3003 !! end
3004
3005 !! test
3006 URL-encoding in URL functions (multiple parameters)
3007 !! input
3008 {{localurl:Some page|q=?&amp=&}}
3009 !! result
3010 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3011 </p>
3012 !! end
3013
3014 !! test
3015 Brackets in urls
3016 !! input
3017 http://example.com/index.php?foozoid%5B%5D=bar
3018
3019 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3020 !! result
3021 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
3022 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
3023 </p>
3024 !! end
3025
3026 !! test
3027 IPv6 urls (bug 21261)
3028 !! options
3029 disabled
3030 !! input
3031 http://[2404:130:0:1000::187:2]/index.php
3032 !! result
3033 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
3034 </p>
3035 !! end
3036
3037 !! test
3038 Non-extlinks in brackets
3039 !! input
3040 [foo]
3041 [foo bar]
3042 [foo ''bar'']
3043 [fool's] errand
3044 [fool's errand]
3045 [{{echo|foo}}]
3046 [{{echo|foo}} bar]
3047 [{{echo|foo}} ''bar'']
3048 [{{echo|foo}}l's] errand
3049 [{{echo|foo}}l's errand]
3050 [url={{echo|foo}}]
3051 [url=http://example.com]
3052 !! result
3053 <p>[foo]
3054 [foo bar]
3055 [foo <i>bar</i>]
3056 [fool's] errand
3057 [fool's errand]
3058 [foo]
3059 [foo bar]
3060 [foo <i>bar</i>]
3061 [fool's] errand
3062 [fool's errand]
3063 [url=foo]
3064 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3065 </p>
3066 !! end
3067
3068 ###
3069 ### Quotes
3070 ###
3071
3072 !! test
3073 Quotes
3074 !! input
3075 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3076
3077 Normal text. '''''Bold italic text.''''' Normal text.
3078 !!result
3079 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3080 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3081 </p>
3082 !! end
3083
3084
3085 !! test
3086 Unclosed and unmatched quotes (php)
3087 !! options
3088 php
3089 !! input
3090 '''''Bold italic text '''with bold deactivated''' in between.'''''
3091
3092 '''''Bold italic text ''with italic deactivated'' in between.'''''
3093
3094 '''Bold text..
3095
3096 ..spanning two paragraphs (should not work).'''
3097
3098 '''Bold tag left open
3099
3100 ''Italic tag left open
3101
3102 Normal text.
3103
3104 <!-- Unmatching number of opening, closing tags: -->
3105 '''This year''''s election ''should'' beat '''last year''''s.
3106
3107 ''Tom'''s car is bigger than ''Susan'''s.
3108
3109 Plain ''italic'''s plain
3110 !! result
3111 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3112 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3113 </p><p><b>Bold text..</b>
3114 </p><p>..spanning two paragraphs (should not work).
3115 </p><p><b>Bold tag left open</b>
3116 </p><p><i>Italic tag left open</i>
3117 </p><p>Normal text.
3118 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3119 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3120 </p><p>Plain <i>italic'</i>s plain
3121 </p>
3122 !! end
3123 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3124 # parser strips. The wikitext contains just the first half of the bold
3125 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3126 # differently than the PHP parser.)
3127 !! test
3128 Unclosed and unmatched quotes (parsoid)
3129 !! options
3130 parsoid
3131 !! input
3132 '''''Bold italic text '''with bold deactivated''' in between.'''''
3133
3134 '''''Bold italic text ''with italic deactivated'' in between.'''''
3135
3136 '''Bold text..
3137
3138 ..spanning two paragraphs (should not work).'''
3139
3140 '''Bold tag left open
3141
3142 ''Italic tag left open
3143
3144 Normal text.
3145
3146 <!-- Unmatching number of opening, closing tags: -->
3147 '''This year''''s election ''should'' beat '''last year''''s.
3148
3149 ''Tom'''s car is bigger than ''Susan'''s.
3150
3151 Plain ''italic'''s plain
3152 !! result
3153 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3154 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3155 </p><p><b>Bold text..</b>
3156 </p><p>..spanning two paragraphs (should not work).<b></b>
3157 </p><p><b>Bold tag left open</b>
3158 </p><p><i>Italic tag left open</i>
3159 </p><p>Normal text.
3160 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3161 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3162 </p><p>Plain <i>italic'</i>s plain
3163 </p>
3164 !! end
3165
3166 ###
3167 ### Tables
3168 ###
3169 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3170 ###
3171
3172 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3173 # is the bare minimun required by the spec, see:
3174 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3175 !! test
3176 A table with no data. (php)
3177 !! options
3178 php
3179 !! input
3180 {||}
3181 !! result
3182 !! end
3183 # Parsoid team replies: empty table tags are legal in HTML5
3184 !! test
3185 A table with no data. (parsoid)
3186 !! options
3187 parsoid
3188 !! input
3189 {||}
3190 !! result
3191 <table></table>
3192 !! end
3193
3194 # A table with nothing but a caption is invalid XHTML, we might want to render
3195 # this as <p>caption</p>
3196 !! test
3197 A table with nothing but a caption (php)
3198 !! options
3199 php
3200 !! input
3201 {|
3202 |+ caption
3203 |}
3204 !! result
3205 <table>
3206 <caption> caption
3207 </caption><tr><td></td></tr></table>
3208
3209 !! end
3210 # Parsoid team replies: table with only a caption is legal in HTML5
3211 !! test
3212 A table with nothing but a caption (parsoid)
3213 !! options
3214 parsoid
3215 !! input
3216 {|
3217 |+ caption
3218 |}
3219 !! result
3220 <table><caption> caption</caption></table>
3221 !! end
3222
3223 !! test
3224 A table with caption with default-spaced attributes and a table row
3225 !! input
3226 {|
3227 |+ style="color: red;" | caption1
3228 |-
3229 | foo
3230 |}
3231 !! result
3232 <table>
3233 <caption style="color: red;"> caption1
3234 </caption>
3235 <tr>
3236 <td> foo
3237 </td></tr></table>
3238
3239 !! end
3240
3241 !! test
3242 A table with captions with non-default spaced attributes and a table row
3243 !! input
3244 {|
3245 |+style="color: red;"|caption2
3246 |+ style="color: red;"| caption3
3247 |-
3248 | foo
3249 |}
3250 !! result
3251 <table>
3252 <caption style="color: red;">caption2
3253 </caption>
3254 <caption style="color: red;"> caption3
3255 </caption>
3256 <tr>
3257 <td> foo
3258 </td></tr></table>
3259
3260 !! end
3261
3262 !! test
3263 Table td-cell syntax variations
3264 !! input
3265 {|
3266 | foo bar foo | baz
3267 | foo bar foo || baz
3268 | style='color:red;' | baz
3269 | style='color:red;' || baz
3270 |}
3271 !! result
3272 <table>
3273 <tr>
3274 <td> baz
3275 </td>
3276 <td> foo bar foo </td>
3277 <td> baz
3278 </td>
3279 <td style="color:red;"> baz
3280 </td>
3281 <td> style='color:red;' </td>
3282 <td> baz
3283 </td></tr></table>
3284
3285 !! end
3286
3287 !! test
3288 Simple table
3289 !! input
3290 {|
3291 | 1 || 2
3292 |-
3293 | 3 || 4
3294 |}
3295 !! result
3296 <table>
3297 <tr>
3298 <td> 1 </td>
3299 <td> 2
3300 </td></tr>
3301 <tr>
3302 <td> 3 </td>
3303 <td> 4
3304 </td></tr></table>
3305
3306 !! end
3307
3308 !! test
3309 Simple table but with multiple dashes for row wikitext
3310 !! input
3311 {|
3312 | foo
3313 |-----
3314 | bar
3315 |}
3316 !! result
3317 <table>
3318 <tr>
3319 <td> foo
3320 </td></tr>
3321 <tr>
3322 <td> bar
3323 </td></tr></table>
3324
3325 !! end
3326 !! test
3327 Multiplication table
3328 !! input
3329 {| border="1" cellpadding="2"
3330 |+Multiplication table
3331 |-
3332 ! &times; !! 1 !! 2 !! 3
3333 |-
3334 ! 1
3335 | 1 || 2 || 3
3336 |-
3337 ! 2
3338 | 2 || 4 || 6
3339 |-
3340 ! 3
3341 | 3 || 6 || 9
3342 |-
3343 ! 4
3344 | 4 || 8 || 12
3345 |-
3346 ! 5
3347 | 5 || 10 || 15
3348 |}
3349 !! result
3350 <table border="1" cellpadding="2">
3351 <caption>Multiplication table
3352 </caption>
3353 <tr>
3354 <th> &#215; </th>
3355 <th> 1 </th>
3356 <th> 2 </th>
3357 <th> 3
3358 </th></tr>
3359 <tr>
3360 <th> 1
3361 </th>
3362 <td> 1 </td>
3363 <td> 2 </td>
3364 <td> 3
3365 </td></tr>
3366 <tr>
3367 <th> 2
3368 </th>
3369 <td> 2 </td>
3370 <td> 4 </td>
3371 <td> 6
3372 </td></tr>
3373 <tr>
3374 <th> 3
3375 </th>
3376 <td> 3 </td>
3377 <td> 6 </td>
3378 <td> 9
3379 </td></tr>
3380 <tr>
3381 <th> 4
3382 </th>
3383 <td> 4 </td>
3384 <td> 8 </td>
3385 <td> 12
3386 </td></tr>
3387 <tr>
3388 <th> 5
3389 </th>
3390 <td> 5 </td>
3391 <td> 10 </td>
3392 <td> 15
3393 </td></tr></table>
3394
3395 !! end
3396
3397 !! test
3398 Accept "||" in table headings
3399 !! input
3400 {|
3401 !h1 || h2
3402 |}
3403 !! result
3404 <table>
3405 <tr>
3406 <th>h1 </th>
3407 <th> h2
3408 </th></tr></table>
3409
3410 !! end
3411
3412 !! test
3413 Accept "||" in indented table headings
3414 !! input
3415 :{|
3416 !h1 || h2
3417 |}
3418 !! result
3419 <dl><dd><table>
3420 <tr>
3421 <th>h1 </th>
3422 <th> h2
3423 </th></tr></table></dd></dl>
3424
3425 !! end
3426
3427 !! test
3428 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3429 !! input
3430 {|
3431 !| h1
3432 || a
3433 |}
3434 !! result
3435 <table>
3436 <tr>
3437 <th> h1
3438 </th>
3439 <td> a
3440 </td></tr></table>
3441
3442 !! end
3443
3444 !!test
3445 Accept "| !" at start of line in tables (ignore !-attribute)
3446 !!input
3447 {|
3448 |-
3449 | !style="color:red" | bar
3450 |}
3451 !!result
3452 <table>
3453
3454 <tr>
3455 <td> bar
3456 </td></tr></table>
3457
3458 !!end
3459
3460 !!test
3461 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
3462 !!input
3463 {|
3464 |-
3465 |style='color:red;'|+1
3466 |style='color:blue;'|-1
3467 |-
3468 | 1 || 2 || 3
3469 | 1 ||+2 ||-3
3470 |-
3471 | +1
3472 | -1
3473 |}
3474 !!result
3475 <table>
3476
3477 <tr>
3478 <td style="color:red;">+1
3479 </td>
3480 <td style="color:blue;">-1
3481 </td></tr>
3482 <tr>
3483 <td> 1 </td>
3484 <td> 2 </td>
3485 <td> 3
3486 </td>
3487 <td> 1 </td>
3488 <td>+2 </td>
3489 <td>-3
3490 </td></tr>
3491 <tr>
3492 <td> +1
3493 </td>
3494 <td> -1
3495 </td></tr></table>
3496
3497 !!end
3498
3499 !! test
3500 Table rowspan
3501 !! input
3502 {| border=1
3503 | Cell 1, row 1
3504 |rowspan=2| Cell 2, row 1 (and 2)
3505 | Cell 3, row 1
3506 |-
3507 | Cell 1, row 2
3508 | Cell 3, row 2
3509 |}
3510 !! result
3511 <table border="1">
3512 <tr>
3513 <td> Cell 1, row 1
3514 </td>
3515 <td rowspan="2"> Cell 2, row 1 (and 2)
3516 </td>
3517 <td> Cell 3, row 1
3518 </td></tr>
3519 <tr>
3520 <td> Cell 1, row 2
3521 </td>
3522 <td> Cell 3, row 2
3523 </td></tr></table>
3524
3525 !! end
3526
3527 !! test
3528 Nested table
3529 !! input
3530 {| border=1
3531 | &alpha;
3532 |
3533 {| bgcolor=#ABCDEF border=2
3534 |nested
3535 |-
3536 |table
3537 |}
3538 |the original table again
3539 |}
3540 !! result
3541 <table border="1">
3542 <tr>
3543 <td> &#945;
3544 </td>
3545 <td>
3546 <table bgcolor="#ABCDEF" border="2">
3547 <tr>
3548 <td>nested
3549 </td></tr>
3550 <tr>
3551 <td>table
3552 </td></tr></table>
3553 </td>
3554 <td>the original table again
3555 </td></tr></table>
3556
3557 !! end
3558
3559 !! test
3560 Invalid attributes in table cell (bug 1830)
3561 !! input
3562 {|
3563 |Cell:|broken
3564 |}
3565 !! result
3566 <table>
3567 <tr>
3568 <td>broken
3569 </td></tr></table>
3570
3571 !! end
3572
3573
3574 !! test
3575 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3576 !! input
3577 {|
3578 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3579 !! result
3580 <table>
3581 <tr>
3582 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3583 <td>]" onmouseover="alert(document.cookie)"&gt;test
3584 </td>
3585 </tr>
3586 </table>
3587
3588 !! end
3589
3590
3591 !! test
3592 Indented table markup mixed with indented pre content (proposed in bug 6200)
3593 !! input
3594 <table>
3595 <tr>
3596 <td>
3597 Text that should be rendered preformatted
3598 </td>
3599 </tr>
3600 </table>
3601 !! result
3602 <table>
3603 <tr>
3604 <td>
3605 <pre>Text that should be rendered preformatted
3606 </pre>
3607 </td>
3608 </tr>
3609 </table>
3610
3611 !! end
3612
3613 !! test
3614 Template-generated table cell attributes and cell content
3615 !! input
3616 {|
3617 |{{table_attribs}}
3618 |}
3619 !! result
3620 <table>
3621 <tr>
3622 <td style="color: red"> Foo
3623 </td></tr></table>
3624
3625 !! end
3626
3627 !! test
3628 Table with row followed by newlines and table heading
3629 !! input
3630 {|
3631 |-
3632
3633 ! foo
3634 |}
3635 !! result
3636 <table>
3637
3638
3639 <tr>
3640 <th> foo
3641 </th></tr></table>
3642
3643 !! end
3644
3645 !! test
3646 Table with empty line following the start tag
3647 !! input
3648 {|
3649
3650 |-
3651 | foo
3652 |}
3653 !! result
3654 <table>
3655
3656
3657 <tr>
3658 <td> foo
3659 </td></tr></table>
3660
3661 !! end
3662
3663 # FIXME: Preserve the attribute properly (with an empty string as value) in
3664 # the PHP parser. Parsoid implements the behavior below.
3665 !! test
3666 Table attributes with empty value
3667 !! options
3668 disabled
3669 !! input
3670 {|
3671 | style=| hello
3672 |}
3673 !! result
3674 <table>
3675 <tr>
3676 <td style=""> hello
3677 </td></tr></table>
3678
3679 !! end
3680
3681 !! test
3682 Wikitext table with a lot of comments
3683 !! input
3684 {|
3685 <!-- c0 -->
3686 | foo
3687 <!-- c1 -->
3688 |- <!-- c2 -->
3689 <!-- c3 -->
3690 |<!-- c4 -->
3691 <!-- c5 -->
3692 |}
3693 !! result
3694 <table>
3695 <tr>
3696 <td> foo
3697 </td></tr>
3698 <tr>
3699 <td>
3700 </td></tr></table>
3701
3702 !! end
3703
3704 !! test
3705 Wikitext table with double-line table cell
3706 !! input
3707 {|
3708 |a
3709 b
3710 |}
3711 !! result
3712 <table>
3713 <tr>
3714 <td>a
3715 <p>b
3716 </p>
3717 </td></tr></table>
3718
3719 !! end
3720
3721 !! test
3722 Table cell with a single comment
3723 !! input
3724 {|
3725 | <!-- c1 -->
3726 | a
3727 |}
3728 !! result
3729 <table>
3730 <tr>
3731 <td>
3732 </td>
3733 <td> a
3734 </td></tr></table>
3735
3736 !! end
3737
3738 # The expected HTML structure in this test is debatable. The PHP parser does
3739 # not parse this kind of table at all. The main focus for Parsoid is on
3740 # round-tripping, so this output is ok for now. TODO: revisit!
3741 !! test
3742 Wikitext table with html-syntax row (Parsoid)
3743 !! options
3744 parsoid
3745 !! input
3746 {|
3747 |-
3748 <td>foo</td>
3749 |}
3750 !! result
3751 <table>
3752 <tbody>
3753 <tr>
3754 <td></td>
3755 <td>foo</td></tr></tbody></table>
3756 !! end
3757
3758 ###
3759 ### Internal links
3760 ###
3761 !! test
3762 Plain link, capitalized
3763 !! input
3764 [[Main Page]]
3765 !! result
3766 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
3767 </p>
3768 !! end
3769
3770 !! test
3771 Plain link, uncapitalized
3772 !! input
3773 [[main Page]]
3774 !! result
3775 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
3776 </p>
3777 !! end
3778
3779 !! test
3780 Piped link
3781 !! input
3782 [[Main Page|The Main Page]]
3783 !! result
3784 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
3785 </p>
3786 !! end
3787
3788 !! test
3789 Broken link
3790 !! input
3791 [[Zigzagzogzagzig]]
3792 !! result
3793 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
3794 </p>
3795 !! end
3796
3797 !! test
3798 Broken link with fragment
3799 !! input
3800 [[Zigzagzogzagzig#zug]]
3801 !! result
3802 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
3803 </p>
3804 !! end
3805
3806 !! test
3807 Special page link with fragment
3808 !! input
3809 [[Special:Version#anchor]]
3810 !! result
3811 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
3812 </p>
3813 !! end
3814
3815 !! test
3816 Nonexistent special page link with fragment
3817 !! input
3818 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
3819 !! result
3820 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
3821 </p>
3822 !! end
3823
3824 !! test
3825 Link with prefix
3826 !! input
3827 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
3828 !! result
3829 <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>
3830 </p>
3831 !! end
3832
3833 !! test
3834 Link with suffix
3835 !! input
3836 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
3837 !! result
3838 <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>!!!
3839 </p>
3840 !! end
3841
3842 !! article
3843 prefixed article
3844 !! text
3845 Some text
3846 !! endarticle
3847
3848 !! test
3849 Bug 43661: Piped links with identical prefixes
3850 !! input
3851 [[prefixed article|prefixed articles with spaces]]
3852
3853 [[prefixed article|prefixed articlesaoeu]]
3854
3855 [[Main Page|Main Page test]]
3856 !! result
3857 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
3858 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
3859 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
3860 </p>
3861 !! end
3862
3863
3864 !! test
3865 Link with HTML entity in suffix / tail
3866 !! input
3867 [[Main Page]]&quot;, [[Main Page]]&#97;
3868 !! result
3869 <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;
3870 </p>
3871 !! end
3872
3873 !! test
3874 Link with 3 brackets
3875 !! input
3876 [[[main page]]]
3877 !! result
3878 <p>[[[main page]]]
3879 </p>
3880 !! end
3881
3882 !! test
3883 Piped link with 3 brackets
3884 !! input
3885 [[[main page|the main page]]]
3886 !! result
3887 <p>[[[main page|the main page]]]
3888 </p>
3889 !! end
3890
3891 !! test
3892 Link with multiple pipes
3893 !! input
3894 [[Main Page|The|Main|Page]]
3895 !! result
3896 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
3897 </p>
3898 !! end
3899
3900 !! test
3901 Link to namespaces
3902 !! input
3903 [[Talk:Parser testing]], [[Meta:Disclaimers]]
3904 !! result
3905 <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>
3906 </p>
3907 !! end
3908
3909 !! test
3910 Piped link to namespace
3911 !! input
3912 [[Meta:Disclaimers|The disclaimers]]
3913 !! result
3914 <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>
3915 </p>
3916 !! end
3917
3918 !! test
3919 Link containing }
3920 !! input
3921 [[Usually caused by a typo (oops}]]
3922 !! result
3923 <p>[[Usually caused by a typo (oops}]]
3924 </p>
3925 !! end
3926
3927 !! test
3928 Link containing % (not as a hex sequence)
3929 !! input
3930 [[7% Solution]]
3931 !! result
3932 <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>
3933 </p>
3934 !! end
3935
3936 !! test
3937 Link containing % as a single hex sequence interpreted to char
3938 !! input
3939 [[7%25 Solution]]
3940 !! result
3941 <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>
3942 </p>
3943 !!end
3944
3945 !! test
3946 Link containing % as a double hex sequence interpreted to hex sequence
3947 !! input
3948 [[7%2525 Solution]]
3949 !! result
3950 <p>[[7%2525 Solution]]
3951 </p>
3952 !!end
3953
3954 !! test
3955 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
3956 Example for such a section: == < ==
3957 !! input
3958 [[%23%3c]][[%23%3e]]
3959 !! result
3960 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
3961 </p>
3962 !! end
3963
3964 !! test
3965 Link containing "<#" and ">#" as a hex sequences
3966 !! input
3967 [[%3c%23]][[%3e%23]]
3968 !! result
3969 <p>[[%3c%23]][[%3e%23]]
3970 </p>
3971 !! end
3972
3973 !! test
3974 Link containing double-single-quotes '' (bug 4598)
3975 !! input
3976 [[Lista d''e paise d''o munno]]
3977 !! result
3978 <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>
3979 </p>
3980 !! end
3981
3982 !! test
3983 Link containing double-single-quotes '' in text (bug 4598 sanity check)
3984 !! input
3985 Some [[Link|pretty ''italics'' and stuff]]!
3986 !! result
3987 <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>!
3988 </p>
3989 !! end
3990
3991 !! test
3992 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
3993 !! input
3994 ''Some [[Link|pretty ''italics'' and stuff]]!
3995 !! result
3996 <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>
3997 </p>
3998 !! end
3999
4000 !! test
4001 Link with double quotes in title part (literal) and alternate part (interpreted)
4002 !! input
4003 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4004
4005 [[''Pentecoste'']]
4006
4007 [[''Pentecoste''|Pentecoste]]
4008
4009 [[''Pentecoste''|''Pentecoste'']]
4010 !! result
4011 <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>
4012 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
4013 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
4014 </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>
4015 </p>
4016 !! end
4017
4018 !! test
4019 Broken image links with HTML captions (bug 39700)
4020 !! input
4021 [[File:Nonexistent|<script></script>]]
4022 [[File:Nonexistent|100px|<script></script>]]
4023 [[File:Nonexistent|&lt;]]
4024 [[File:Nonexistent|a<i>b</i>c]]
4025 !! result
4026 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4027 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4028 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4029 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4030 </p>
4031 !! end
4032
4033 !! test
4034 Plain link to URL
4035 !! input
4036 [[http://www.example.com]]
4037 !! result
4038 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4039 </p>
4040 !! end
4041
4042 !! test
4043 Plain link to URL with link text
4044 !! input
4045 [[http://www.example.com Link text]]
4046 !! result
4047 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4048 </p>
4049 !! end
4050
4051 !! test
4052 Plain link to protocol-relative URL
4053 !! input
4054 [[//www.example.com]]
4055 !! result
4056 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4057 </p>
4058 !! end
4059
4060 !! test
4061 Plain link to protocol-relative URL with link text
4062 !! input
4063 [[//www.example.com Link text]]
4064 !! result
4065 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4066 </p>
4067 !! end
4068
4069 !! test
4070 Plain link to page with question mark in title
4071 !! input
4072 [[A?b]]
4073
4074 [[A?b|Baz]]
4075 !! result
4076 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4077 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4078 </p>
4079 !! end
4080
4081
4082 # I'm fairly sure the expected result here is wrong.
4083 # We want these to be URL links, not pseudo-pages with URLs for titles....
4084 # However the current output is also pretty screwy.
4085 #
4086 # ----
4087 # I'm changing it to match the current output--it arguably makes more
4088 # sense in the light of the test above. Old expected result was:
4089 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4090 #</p>
4091 # But I think this test is bordering on "garbage in, garbage out" anyway.
4092 # -- wtm
4093 !! test
4094 Piped link to URL
4095 !! input
4096 Piped link to URL: [[http://www.example.com|an example URL]]
4097 !! result
4098 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4099 </p>
4100 !! end
4101
4102 !! test
4103 BUG 2: [[page|http://url/]] should link to page, not http://url/
4104 !! input
4105 [[Main Page|http://url/]]
4106 !! result
4107 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4108 </p>
4109 !! end
4110
4111 !! test
4112 BUG 337: Escaped self-links should be bold
4113 !! options
4114 title=[[Bug462]]
4115 !! input
4116 [[Bu&#103;462]] [[Bug462]]
4117 !! result
4118 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4119 </p>
4120 !! end
4121
4122 !! test
4123 Self-link to section should not be bold
4124 !! options
4125 title=[[Main Page]]
4126 !! input
4127 [[Main Page#section]]
4128 !! result
4129 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4130 </p>
4131 !! end
4132
4133 !! article
4134 00
4135 !! text
4136 This is 00.
4137 !! endarticle
4138
4139 !!test
4140 Self-link to numeric title
4141 !!options
4142 title=[[0]]
4143 !!input
4144 [[0]]
4145 !!result
4146 <p><strong class="selflink">0</strong>
4147 </p>
4148 !!end
4149
4150 !!test
4151 Link to numeric-equivalent title
4152 !!options
4153 title=[[0]]
4154 !!input
4155 [[00]]
4156 !!result
4157 <p><a href="/wiki/00" title="00">00</a>
4158 </p>
4159 !!end
4160
4161 !! test
4162 <nowiki> inside a link
4163 !! input
4164 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4165 !! result
4166 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4167 </p>
4168 !! end
4169
4170 !! test
4171 Non-breaking spaces in title
4172 !! input
4173 [[&nbsp; Main &nbsp; Page &nbsp;]]
4174 !! result
4175 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4176 </p>
4177 !!end
4178
4179 !! test
4180 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4181 !! options
4182 language=ca
4183 !! input
4184 '''[[Main Page]]'''
4185 !! result
4186 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4187 </p>
4188 !! end
4189
4190 !! test
4191 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4192 !! options
4193 language=ca
4194 !! input
4195 ''[[Main Page]]''
4196 !! result
4197 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4198 </p>
4199 !! end
4200
4201 !! test
4202 Internal link with en linktrail: no apostrophes (bug 27473)
4203 !! options
4204 language=en
4205 !! input
4206 [[Something]]'nice
4207 !! result
4208 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4209 </p>
4210 !! end
4211
4212 !! test
4213 Internal link with ca linktrail with apostrophes (bug 27473)
4214 !! options
4215 language=ca
4216 !! input
4217 [[Something]]'nice
4218 !! result
4219 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4220 </p>
4221 !! end
4222
4223 !! test
4224 Internal link with kaa linktrail with apostrophes (bug 27473)
4225 !! options
4226 language=kaa
4227 !! input
4228 [[Something]]'nice
4229 !! result
4230 <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>
4231 </p>
4232 !! end
4233
4234 !! test
4235 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4236 !! input
4237 [[Foo| bar]]
4238
4239 [[Foo| ''bar'']]
4240
4241 [http://wp.org foo]
4242
4243 [http://wp.org ''foo'']
4244 !! result
4245 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
4246 </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>
4247 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4248 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4249 </p>
4250 !! end
4251
4252 ###
4253 ### Interwiki links (see maintenance/interwiki.sql)
4254 ###
4255
4256 !! test
4257 Inline interwiki link
4258 !! input
4259 [[MeatBall:SoftSecurity]]
4260 !! result
4261 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4262 </p>
4263 !! end
4264
4265 !! test
4266 Inline interwiki link with empty title (bug 2372)
4267 !! input
4268 [[MeatBall:]]
4269 !! result
4270 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4271 </p>
4272 !! end
4273
4274 !! test
4275 Interwiki link encoding conversion (bug 1636)
4276 !! input
4277 *[[Wikipedia:ro:Olteni&#0355;a]]
4278 *[[Wikipedia:ro:Olteni&#355;a]]
4279 !! result
4280 <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>
4281 </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>
4282 </li></ul>
4283
4284 !! end
4285
4286 !! test
4287 Interwiki link with fragment (bug 2130)
4288 !! input
4289 [[MeatBall:SoftSecurity#foo]]
4290 !! result
4291 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4292 </p>
4293 !! end
4294
4295 !! test
4296 Interlanguage link
4297 !! input
4298 Blah blah blah
4299 [[zh:Chinese]]
4300 !!result
4301 <p>Blah blah blah
4302 </p>
4303 !! end
4304
4305 !! test
4306 Double interlanguage link
4307 !! input
4308 Blah blah blah
4309 [[es:Spanish]]
4310 [[zh:Chinese]]
4311 !!result
4312 <p>Blah blah blah
4313 </p>
4314 !! end
4315
4316 !! test
4317 Interlanguage link, with prefix links
4318 !! options
4319 language=ln
4320 !! input
4321 Blah blah blah
4322 [[zh:Chinese]]
4323 !!result
4324 <p>Blah blah blah
4325 </p>
4326 !! end
4327
4328 !! test
4329 Double interlanguage link, with prefix links (bug 8897)
4330 !! options
4331 language=ln
4332 !! input
4333 Blah blah blah
4334 [[es:Spanish]]
4335 [[zh:Chinese]]
4336 !!result
4337 <p>Blah blah blah
4338 </p>
4339 !! end
4340
4341 !! test
4342 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4343 !! options
4344 language=ln
4345 !! input
4346 [[WW&nbsp;II]]
4347 !!result
4348 <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>
4349 </p>
4350 !! end
4351
4352 ##
4353 ## XHTML tidiness
4354 ###
4355
4356 !! test
4357 <br> to <br />
4358 !! input
4359 1<br>2<br />3
4360 !! result
4361 <p>1<br />2<br />3
4362 </p>
4363 !! end
4364
4365 !! test
4366 Broken br tag sanitization
4367 !! input
4368 </br>
4369 !! result
4370 <p>&lt;/br&gt;
4371 </p>
4372 !! end
4373
4374 !! test
4375 Incorrecly removing closing slashes from correctly formed XHTML
4376 !! input
4377 <br style="clear:both;" />
4378 !! result
4379 <p><br style="clear:both;" />
4380 </p>
4381 !! end
4382
4383 !! test
4384 Failing to transform badly formed HTML into correct XHTML
4385 !! input
4386 <br style="clear: left;">
4387 <br style="clear: right;">
4388 <br style="clear: both;">
4389 !! result
4390 <p><br style="clear: left;" />
4391 <br style="clear: right;" />
4392 <br style="clear: both;" />
4393 </p>
4394 !!end
4395
4396 !! test
4397 Handling html with a div self-closing tag
4398 !! input
4399 <div title />
4400 <div title/>
4401 <div title/ >
4402 <div title=bar />
4403 <div title=bar/>
4404 <div title=bar/ >
4405 !! result
4406 <p>&lt;div title /&gt;
4407 &lt;div title/&gt;
4408 </p>
4409 <div>
4410 <p>&lt;div title=bar /&gt;
4411 &lt;div title=bar/&gt;
4412 </p>
4413 <div title="bar/"></div>
4414 </div>
4415
4416 !! end
4417
4418 !! test
4419 Handling html with a br self-closing tag
4420 !! input
4421 <br title />
4422 <br title/>
4423 <br title/ >
4424 <br title=bar />
4425 <br title=bar/>
4426 <br title=bar/ >
4427 !! result
4428 <p><br title="title" />
4429 <br title="title" />
4430 <br />
4431 <br title="bar" />
4432 <br title="bar" />
4433 <br title="bar/" />
4434 </p>
4435 !! end
4436
4437 !! test
4438 Horizontal ruler (should it add that extra space?)
4439 !! input
4440 <hr>
4441 <hr >
4442 foo <hr
4443 > bar
4444 !! result
4445 <hr />
4446 <hr />
4447 foo <hr /> bar
4448
4449 !! end
4450
4451 !! test
4452 Horizontal ruler -- 4+ dashes render hr
4453 !! input
4454 ----
4455 !! result
4456 <hr />
4457
4458 !! end
4459
4460 !! test
4461 Horizontal ruler -- eats additional dashes on the same line
4462 !! input
4463 ---------
4464 !! result
4465 <hr />
4466
4467 !! end
4468
4469 !! test
4470 Horizontal ruler -- does not collaps dashes on consecutive lines
4471 !! input
4472 ----
4473 ----
4474 !! result
4475 <hr />
4476 <hr />
4477
4478 !! end
4479
4480 !! test
4481 Horizontal ruler -- <4 dashes render as plain text
4482 !! input
4483 ---
4484 !! result
4485 <p>---
4486 </p>
4487 !! end
4488
4489 !! test
4490 Horizontal ruler -- Supports content following dashes on same line
4491 !! input
4492 ---- Foo
4493 !! result
4494 <hr /> Foo
4495
4496 !! end
4497
4498 ###
4499 ### Block-level elements
4500 ###
4501 !! test
4502 Common list
4503 !! input
4504 *Common list
4505 * item 2
4506 *item 3
4507 !! result
4508 <ul><li>Common list
4509 </li><li> item 2
4510 </li><li>item 3
4511 </li></ul>
4512
4513 !! end
4514
4515 !! test
4516 Numbered list
4517 !! input
4518 #Numbered list
4519 #item 2
4520 # item 3
4521 !! result
4522 <ol><li>Numbered list
4523 </li><li>item 2
4524 </li><li> item 3
4525 </li></ol>
4526
4527 !! end
4528
4529 !! test
4530 Mixed list
4531 !! input
4532 *Mixed list
4533 *# with numbers
4534 ** and bullets
4535 *# and numbers
4536 *bullets again
4537 **bullet level 2
4538 ***bullet level 3
4539 ***#Number on level 4
4540 **bullet level 2
4541 **#Number on level 3
4542 **#Number on level 3
4543 *#number level 2
4544 *Level 1
4545 *** Level 3
4546 #** Level 3, but ordered
4547 !! result
4548 <ul><li>Mixed list
4549 <ol><li> with numbers
4550 </li></ol>
4551 <ul><li> and bullets
4552 </li></ul>
4553 <ol><li> and numbers
4554 </li></ol>
4555 </li><li>bullets again
4556 <ul><li>bullet level 2
4557 <ul><li>bullet level 3
4558 <ol><li>Number on level 4
4559 </li></ol>
4560 </li></ul>
4561 </li><li>bullet level 2
4562 <ol><li>Number on level 3
4563 </li><li>Number on level 3
4564 </li></ol>
4565 </li></ul>
4566 <ol><li>number level 2
4567 </li></ol>
4568 </li><li>Level 1
4569 <ul><li><ul><li> Level 3
4570 </li></ul>
4571 </li></ul>
4572 </li></ul>
4573 <ol><li><ul><li><ul><li> Level 3, but ordered
4574 </li></ul>
4575 </li></ul>
4576 </li></ol>
4577
4578 !! end
4579
4580 !! test
4581 Nested lists 1
4582 !! input
4583 *foo
4584 **bar
4585 !! result
4586 <ul><li>foo
4587 <ul><li>bar
4588 </li></ul>
4589 </li></ul>
4590
4591 !! end
4592
4593 !! test
4594 Nested lists 2
4595 !! input
4596 **foo
4597 *bar
4598 !! result
4599 <ul><li><ul><li>foo
4600 </li></ul>
4601 </li><li>bar
4602 </li></ul>
4603
4604 !! end
4605
4606 !! test
4607 Nested lists 3 (first element empty)
4608 !! input
4609 *
4610 **bar
4611 !! result
4612 <ul><li>
4613 <ul><li>bar
4614 </li></ul>
4615 </li></ul>
4616
4617 !! end
4618
4619 !! test
4620 Nested lists 4 (first element empty)
4621 !! input
4622 **
4623 *bar
4624 !! result
4625 <ul><li><ul><li>
4626 </li></ul>
4627 </li><li>bar
4628 </li></ul>
4629
4630 !! end
4631
4632 !! test
4633 Nested lists 5 (both elements empty)
4634 !! input
4635 **
4636 *
4637 !! result
4638 <ul><li><ul><li>
4639 </li></ul>
4640 </li><li>
4641 </li></ul>
4642
4643 !! end
4644
4645 !! test
4646 Nested lists 6 (both elements empty)
4647 !! input
4648 *
4649 **
4650 !! result
4651 <ul><li>
4652 <ul><li>
4653 </li></ul>
4654 </li></ul>
4655
4656 !! end
4657
4658 !! test
4659 Nested lists 7 (skip initial nesting levels)
4660 !! input
4661 *** foo
4662 !! result
4663 <ul><li><ul><li><ul><li> foo
4664 </li></ul>
4665 </li></ul>
4666 </li></ul>
4667
4668 !! end
4669
4670 !! test
4671 Nested lists 8 (multiple nesting transitions)
4672 !! input
4673 * foo
4674 *** bar
4675 ** baz
4676 * boo
4677 !! result
4678 <ul><li> foo
4679 <ul><li><ul><li> bar
4680 </li></ul>
4681 </li><li> baz
4682 </li></ul>
4683 </li><li> boo
4684 </li></ul>
4685
4686 !! end
4687
4688 !! test
4689 1. Lists with start-of-line-transparent tokens before bullets: Comments
4690 !! input
4691 *foo
4692 *<!--cmt-->bar
4693 <!--cmt-->*baz
4694 !! result
4695 <ul><li>foo
4696 </li><li>bar
4697 </li><li>baz
4698 </li></ul>
4699
4700 !! end
4701
4702 !! test
4703 2. Lists with start-of-line-transparent tokens before bullets: Template close
4704 !! input
4705 *foo {{echo|bar
4706 }}*baz
4707 !! result
4708 <ul><li>foo bar
4709 </li><li>baz
4710 </li></ul>
4711
4712 !! end
4713
4714 !! test
4715 Unbalanced closing block tags break a list
4716 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4717 !! options
4718 disabled
4719 !! input
4720 <div>
4721 *a</div><div>
4722 *b</div>
4723 !! result
4724 <div>
4725 <ul><li>a
4726 </li></ul></div><div>
4727 <ul><li>b
4728 </li></ul></div>
4729 !! end
4730
4731 !! test
4732 Unbalanced closing non-block tags don't break a list
4733 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4734 !! options
4735 disabled
4736 !! input
4737 <span>
4738 *a</span><span>
4739 *b</span>
4740 !! result
4741 <p><span></span>
4742 </p>
4743 <ul><li>a<span></span>
4744 </li><li>b
4745 </li></ul>
4746 !! end
4747
4748 !! test
4749 Unclosed formatting tags that straddle lists are closed and reopened
4750 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4751 !! options
4752 disabled
4753 !! input
4754 # <s> a
4755 # b </s>
4756 !! result
4757 <ol><li> <s> a </s>
4758 </li><li> <s> b </s>
4759 </li></ol>
4760 !! end
4761
4762 !!test
4763 List embedded in a non-block tag
4764 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
4765 !! options
4766 parsoid
4767 !!input
4768 <small>
4769 * foo
4770 </small>
4771 !!result
4772 <p><small></small></p>
4773 <small>
4774 <ul>
4775 <li> foo</li>
4776 </ul>
4777 </small>
4778 <p><small></small></p>
4779 !!end
4780
4781 !! test
4782 List items are not parsed correctly following a <pre> block (bug 785)
4783 !! input
4784 * <pre>foo</pre>
4785 * <pre>bar</pre>
4786 * zar
4787 !! result
4788 <ul><li> <pre>foo</pre>
4789 </li><li> <pre>bar</pre>
4790 </li><li> zar
4791 </li></ul>
4792
4793 !! end
4794
4795 !! test
4796 List items from template
4797 !! input
4798
4799 {{inner list}}
4800 * item 2
4801
4802 * item 0
4803 {{inner list}}
4804 * item 2
4805
4806 * item 0
4807 * notSOL{{inner list}}
4808 * item 2
4809 !! result
4810 <ul><li> item 1
4811 </li><li> item 2
4812 </li></ul>
4813 <ul><li> item 0
4814 </li><li> item 1
4815 </li><li> item 2
4816 </li></ul>
4817 <ul><li> item 0
4818 </li><li> notSOL
4819 </li><li> item 1
4820 </li><li> item 2
4821 </li></ul>
4822
4823 !! end
4824
4825 !! test
4826 List interrupted by empty line or heading
4827 !! input
4828 * foo
4829
4830 ** bar
4831 == A heading ==
4832 * Another list item
4833 !! result
4834 <ul><li> foo
4835 </li></ul>
4836 <ul><li><ul><li> bar
4837 </li></ul>
4838 </li></ul>
4839 <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>
4840 <ul><li> Another list item
4841 </li></ul>
4842
4843 !!end
4844
4845 !!test
4846 Multiple list tags generated by templates
4847 !!input
4848 {{echo|<li>}}a
4849 {{echo|<li>}}b
4850 {{echo|<li>}}c
4851 !!result
4852 <li>a
4853 <li>b
4854 <li>c</li>
4855 </li>
4856 </li>
4857
4858 !!end
4859
4860 !!test
4861 Single-comment whitespace lines dont break lists, but multi-comment whitespace lines do
4862 !!input
4863 *a
4864 <!--This line will NOT split the list-->
4865 *b
4866 <!--This line will NOT split the list either-->
4867 *c
4868 <!--foo--> <!--This line with more than 1 comment will split the list-->
4869 *d
4870 !!result
4871 <ul><li>a
4872 </li><li>b
4873 </li><li>c
4874 </li></ul>
4875 <ul><li>d
4876 </li></ul>
4877
4878 !!end
4879
4880 ###
4881 ### Magic Words
4882 ###
4883
4884 !! test
4885 Magic Word: {{CURRENTDAY}}
4886 !! input
4887 {{CURRENTDAY}}
4888 !! result
4889 <p>1
4890 </p>
4891 !! end
4892
4893 !! test
4894 Magic Word: {{CURRENTDAY2}}
4895 !! input
4896 {{CURRENTDAY2}}
4897 !! result
4898 <p>01
4899 </p>
4900 !! end
4901
4902 !! test
4903 Magic Word: {{CURRENTDAYNAME}}
4904 !! input
4905 {{CURRENTDAYNAME}}
4906 !! result
4907 <p>Thursday
4908 </p>
4909 !! end
4910
4911 !! test
4912 Magic Word: {{CURRENTDOW}}
4913 !! input
4914 {{CURRENTDOW}}
4915 !! result
4916 <p>4
4917 </p>
4918 !! end
4919
4920 !! test
4921 Magic Word: {{CURRENTMONTH}}
4922 !! input
4923 {{CURRENTMONTH}}
4924 !! result
4925 <p>01
4926 </p>
4927 !! end
4928
4929 !! test
4930 Magic Word: {{CURRENTMONTHABBREV}}
4931 !! input
4932 {{CURRENTMONTHABBREV}}
4933 !! result
4934 <p>Jan
4935 </p>
4936 !! end
4937
4938 !! test
4939 Magic Word: {{CURRENTMONTHNAME}}
4940 !! input
4941 {{CURRENTMONTHNAME}}
4942 !! result
4943 <p>January
4944 </p>
4945 !! end
4946
4947 !! test
4948 Magic Word: {{CURRENTMONTHNAMEGEN}}
4949 !! input
4950 {{CURRENTMONTHNAMEGEN}}
4951 !! result
4952 <p>January
4953 </p>
4954 !! end
4955
4956 !! test
4957 Magic Word: {{CURRENTTIME}}
4958 !! input
4959 {{CURRENTTIME}}
4960 !! result
4961 <p>00:02
4962 </p>
4963 !! end
4964
4965 !! test
4966 Magic Word: {{CURRENTWEEK}} (@bug 4594)
4967 !! input
4968 {{CURRENTWEEK}}
4969 !! result
4970 <p>1
4971 </p>
4972 !! end
4973
4974 !! test
4975 Magic Word: {{CURRENTYEAR}}
4976 !! input
4977 {{CURRENTYEAR}}
4978 !! result
4979 <p>1970
4980 </p>
4981 !! end
4982
4983 !! test
4984 Magic Word: {{FULLPAGENAME}}
4985 !! options
4986 title=[[User:Ævar Arnfjörð Bjarmason]]
4987 !! input
4988 {{FULLPAGENAME}}
4989 !! result
4990 <p>User:Ævar Arnfjörð Bjarmason
4991 </p>
4992 !! end
4993
4994 !! test
4995 Magic Word: {{FULLPAGENAMEE}}
4996 !! options
4997 title=[[User:Ævar Arnfjörð Bjarmason]]
4998 !! input
4999 {{FULLPAGENAMEE}}
5000 !! result
5001 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5002 </p>
5003 !! end
5004
5005 !! test
5006 Magic Word: {{NAMESPACE}}
5007 !! options
5008 title=[[User:Ævar Arnfjörð Bjarmason]]
5009 !! input
5010 {{NAMESPACE}}
5011 !! result
5012 <p>User
5013 </p>
5014 !! end
5015
5016 !! test
5017 Magic Word: {{NAMESPACEE}}
5018 !! options
5019 title=[[User:Ævar Arnfjörð Bjarmason]]
5020 !! input
5021 {{NAMESPACEE}}
5022 !! result
5023 <p>User
5024 </p>
5025 !! end
5026
5027 !! test
5028 Magic Word: {{NAMESPACENUMBER}}
5029 !! options
5030 title=[[User:Ævar Arnfjörð Bjarmason]]
5031 !! input
5032 {{NAMESPACENUMBER}}
5033 !! result
5034 <p>2
5035 </p>
5036 !! end
5037
5038 !! test
5039 Magic Word: {{NUMBEROFFILES}}
5040 !! input
5041 {{NUMBEROFFILES}}
5042 !! result
5043 <p>3
5044 </p>
5045 !! end
5046
5047 !! test
5048 Magic Word: {{PAGENAME}}
5049 !! options
5050 title=[[User:Ævar Arnfjörð Bjarmason]]
5051 !! input
5052 {{PAGENAME}}
5053 !! result
5054 <p>Ævar Arnfjörð Bjarmason
5055 </p>
5056 !! end
5057
5058 !! test
5059 Magic Word: {{PAGENAME}} with metacharacters
5060 !! options
5061 title=[['foo & bar = baz']]
5062 !! input
5063 ''{{PAGENAME}}''
5064 !! result
5065 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
5066 </p>
5067 !! end
5068
5069 !! test
5070 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
5071 !! options
5072 title=[[*RFC 1234 http://example.com/]]
5073 !! input
5074 {{PAGENAME}}
5075 !! result
5076 <p>&#42;RFC&#32;1234 http&#58;//example.com/
5077 </p>
5078 !! end
5079
5080 !! test
5081 Magic Word: {{PAGENAMEE}}
5082 !! options
5083 title=[[User:Ævar Arnfjörð Bjarmason]]
5084 !! input
5085 {{PAGENAMEE}}
5086 !! result
5087 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5088 </p>
5089 !! end
5090
5091 !! test
5092 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
5093 !! options
5094 title=[[*RFC 1234 http://example.com/]]
5095 !! input
5096 {{PAGENAMEE}}
5097 !! result
5098 <p>&#42;RFC_1234_http&#58;//example.com/
5099 </p>
5100 !! end
5101
5102 !! test
5103 Magic Word: {{REVISIONID}}
5104 !! input
5105 {{REVISIONID}}
5106 !! result
5107 <p>1337
5108 </p>
5109 !! end
5110
5111 !! test
5112 Magic Word: {{SCRIPTPATH}}
5113 !! input
5114 {{SCRIPTPATH}}
5115 !! result
5116 <p>/
5117 </p>
5118 !! end
5119
5120 !! test
5121 Magic Word: {{SERVER}}
5122 !! input
5123 {{SERVER}}
5124 !! result
5125 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5126 </p>
5127 !! end
5128
5129 !! test
5130 Magic Word: {{SERVERNAME}}
5131 !! input
5132 {{SERVERNAME}}
5133 !! result
5134 <p>example.org
5135 </p>
5136 !! end
5137
5138 !! test
5139 Magic Word: {{SITENAME}}
5140 !! input
5141 {{SITENAME}}
5142 !! result
5143 <p>MediaWiki
5144 </p>
5145 !! end
5146
5147 !! test
5148 Case-sensitive magic words, when cased differently, should just be template transclusions
5149 !! input
5150 {{CurrentMonth}}
5151 {{currentday}}
5152 {{cURreNTweEK}}
5153 {{currentHour}}
5154 !! result
5155 <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>
5156 <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>
5157 <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>
5158 <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>
5159 </p>
5160 !! end
5161
5162 !! test
5163 Case-insensitive magic words should still work with weird casing.
5164 !! input
5165 {{sErVeRNaMe}}
5166 {{LCFirst:AOEU}}
5167 {{ucFIRST:aoeu}}
5168 {{SERver}}
5169 !! result
5170 <p>example.org
5171 aOEU
5172 Aoeu
5173 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5174 </p>
5175 !! end
5176
5177 !! test
5178 Namespace 1 {{ns:1}}
5179 !! input
5180 {{ns:1}}
5181 !! result
5182 <p>Talk
5183 </p>
5184 !! end
5185
5186 !! test
5187 Namespace 1 {{ns:01}}
5188 !! input
5189 {{ns:01}}
5190 !! result
5191 <p>Talk
5192 </p>
5193 !! end
5194
5195 !! test
5196 Namespace 0 {{ns:0}} (bug 4783)
5197 !! input
5198 {{ns:0}}
5199 !! result
5200
5201 !! end
5202
5203 !! test
5204 Namespace 0 {{ns:00}} (bug 4783)
5205 !! input
5206 {{ns:00}}
5207 !! result
5208
5209 !! end
5210
5211 !! test
5212 Namespace -1 {{ns:-1}}
5213 !! input
5214 {{ns:-1}}
5215 !! result
5216 <p>Special
5217 </p>
5218 !! end
5219
5220 !! test
5221 Namespace User {{ns:User}}
5222 !! input
5223 {{ns:User}}
5224 !! result
5225 <p>User
5226 </p>
5227 !! end
5228
5229 !! test
5230 Namespace User talk {{ns:User_talk}}
5231 !! input
5232 {{ns:User_talk}}
5233 !! result
5234 <p>User talk
5235 </p>
5236 !! end
5237
5238 !! test
5239 Namespace User talk {{ns:uSeR tAlK}}
5240 !! input
5241 {{ns:uSeR tAlK}}
5242 !! result
5243 <p>User talk
5244 </p>
5245 !! end
5246
5247 !! test
5248 Namespace File {{ns:File}}
5249 !! input
5250 {{ns:File}}
5251 !! result
5252 <p>File
5253 </p>
5254 !! end
5255
5256 !! test
5257 Namespace File {{ns:Image}}
5258 !! input
5259 {{ns:Image}}
5260 !! result
5261 <p>File
5262 </p>
5263 !! end
5264
5265 !! test
5266 Namespace (lang=de) Benutzer {{ns:User}}
5267 !! options
5268 language=de
5269 !! input
5270 {{ns:User}}
5271 !! result
5272 <p>Benutzer
5273 </p>
5274 !! end
5275
5276 !! test
5277 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
5278 !! options
5279 language=de
5280 !! input
5281 {{ns:3}}
5282 !! result
5283 <p>Benutzer Diskussion
5284 </p>
5285 !! end
5286
5287
5288 !! test
5289 Urlencode
5290 !! input
5291 {{urlencode:hi world?!}}
5292 {{urlencode:hi world?!|WIKI}}
5293 {{urlencode:hi world?!|PATH}}
5294 {{urlencode:hi world?!|QUERY}}
5295 !! result
5296 <p>hi+world%3F%21
5297 hi_world%3F!
5298 hi%20world%3F%21
5299 hi+world%3F%21
5300 </p>
5301 !! end
5302
5303 ###
5304 ### Magic links
5305 ###
5306 !! test
5307 Magic links: internal link to RFC (bug 479)
5308 !! input
5309 [[RFC 123]]
5310 !! result
5311 <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>
5312 </p>
5313 !! end
5314
5315 !! test
5316 Magic links: RFC (bug 479)
5317 !! input
5318 RFC 822
5319 !! result
5320 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
5321 </p>
5322 !! end
5323
5324 !! test
5325 Magic links: ISBN (bug 1937)
5326 !! input
5327 ISBN 0-306-40615-2
5328 !! result
5329 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
5330 </p>
5331 !! end
5332
5333 !! test
5334 Magic links: PMID incorrectly converts space to underscore
5335 !! input
5336 PMID 1234
5337 !! result
5338 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
5339 </p>
5340 !! end
5341
5342 ###
5343 ### Templates
5344 ####
5345
5346 !! test
5347 Nonexistent template
5348 !! input
5349 {{thistemplatedoesnotexist}}
5350 !! result
5351 <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>
5352 </p>
5353 !! end
5354
5355 !! test
5356 Template with invalid target containing tags
5357 !! input
5358 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5359 !! result
5360 <p>{{a<b>b</b>|foo|a=b|a = b}}
5361 </p>
5362 !! end
5363
5364 !! test
5365 Template with invalid target containing unclosed tag
5366 !! input
5367 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5368 !! result
5369 <p>{{a<b>|foo|a=b|a = b}}</b>
5370 </p>
5371 !! end
5372
5373 !! article
5374 Template:test
5375 !! text
5376 This is a test template
5377 !! endarticle
5378
5379 !! test
5380 Simple template
5381 !! input
5382 {{test}}
5383 !! result
5384 <p>This is a test template
5385 </p>
5386 !! end
5387
5388 !! test
5389 Template with explicit namespace
5390 !! input
5391 {{Template:test}}
5392 !! result
5393 <p>This is a test template
5394 </p>
5395 !! end
5396
5397
5398 !! article
5399 Template:paramtest
5400 !! text
5401 This is a test template with parameter {{{param}}}
5402 !! endarticle
5403
5404 !! test
5405 Template parameter
5406 !! input
5407 {{paramtest|param=foo}}
5408 !! result
5409 <p>This is a test template with parameter foo
5410 </p>
5411 !! end
5412
5413 !! article
5414 Template:paramtestnum
5415 !! text
5416 [[{{{1}}}|{{{2}}}]]
5417 !! endarticle
5418
5419 !! test
5420 Template unnamed parameter
5421 !! input
5422 {{paramtestnum|Main Page|the main page}}
5423 !! result
5424 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
5425 </p>
5426 !! end
5427
5428 !! article
5429 Template:templatesimple
5430 !! text
5431 (test)
5432 !! endarticle
5433
5434 !! article
5435 Template:templateredirect
5436 !! text
5437 #redirect [[Template:templatesimple]]
5438 !! endarticle
5439
5440 !! article
5441 Template:templateasargtestnum
5442 !! text
5443 {{{{{1}}}}}
5444 !! endarticle
5445
5446 !! article
5447 Template:templateasargtest
5448 !! text
5449 {{template{{{templ}}}}}
5450 !! endarticle
5451
5452 !! article
5453 Template:templateasargtest2
5454 !! text
5455 {{{{{templ}}}}}
5456 !! endarticle
5457
5458 !! test
5459 Template with template name as unnamed argument
5460 !! input
5461 {{templateasargtestnum|templatesimple}}
5462 !! result
5463 <p>(test)
5464 </p>
5465 !! end
5466
5467 !! test
5468 Template with template name as argument
5469 !! input
5470 {{templateasargtest|templ=simple}}
5471 !! result
5472 <p>(test)
5473 </p>
5474 !! end
5475
5476 !! test
5477 Template with template name as argument (2)
5478 !! input
5479 {{templateasargtest2|templ=templatesimple}}
5480 !! result
5481 <p>(test)
5482 </p>
5483 !! end
5484
5485 !! article
5486 Template:templateasargtestdefault
5487 !! text
5488 {{{{{templ|templatesimple}}}}}
5489 !! endarticle
5490
5491 !! article
5492 Template:templa
5493 !! text
5494 '''templ'''
5495 !! endarticle
5496
5497 !! test
5498 Template with default value
5499 !! input
5500 {{templateasargtestdefault}}
5501 !! result
5502 <p>(test)
5503 </p>
5504 !! end
5505
5506 !! test
5507 Template with default value (value set)
5508 !! input
5509 {{templateasargtestdefault|templ=templa}}
5510 !! result
5511 <p><b>templ</b>
5512 </p>
5513 !! end
5514
5515 !! test
5516 Template redirect
5517 !! input
5518 {{templateredirect}}
5519 !! result
5520 <p>(test)
5521 </p>
5522 !! end
5523
5524 !! test
5525 Template with argument in separate line
5526 !! input
5527 {{ templateasargtest |
5528 templ = simple }}
5529 !! result
5530 <p>(test)
5531 </p>
5532 !! end
5533
5534 !! test
5535 Template with complex template as argument
5536 !! input
5537 {{paramtest|
5538 param ={{ templateasargtest |
5539 templ = simple }}}}
5540 !! result
5541 <p>This is a test template with parameter (test)
5542 </p>
5543 !! end
5544
5545 !! test
5546 Template with thumb image (with link in description)
5547 !! input
5548 {{paramtest|
5549 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
5550 !! result
5551 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>
5552
5553 !! end
5554
5555 !! article
5556 Template:complextemplate
5557 !! text
5558 {{{1}}} {{paramtest|
5559 param ={{{param}}}}}
5560 !! endarticle
5561
5562 !! test
5563 Template with complex arguments
5564 !! input
5565 {{complextemplate|
5566 param ={{ templateasargtest |
5567 templ = simple }}|[[Template:complextemplate|link]]}}
5568 !! result
5569 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
5570 </p>
5571 !! end
5572
5573 !! test
5574 BUG 553: link with two variables in a piped link
5575 !! input
5576 {|
5577 |[[{{{1}}}|{{{2}}}]]
5578 |}
5579 !! result
5580 <table>
5581 <tr>
5582 <td>[[{{{1}}}|{{{2}}}]]
5583 </td></tr></table>
5584
5585 !! end
5586
5587 !! test
5588 Magic variable as template parameter
5589 !! input
5590 {{paramtest|param={{SITENAME}}}}
5591 !! result
5592 <p>This is a test template with parameter MediaWiki
5593 </p>
5594 !! end
5595
5596 !! article
5597 Template:linktest
5598 !! text
5599 [[{{{param}}}|link]]
5600 !! endarticle
5601
5602 !! test
5603 Template parameter as link source
5604 !! input
5605 {{linktest|param=Main Page}}
5606 !! result
5607 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
5608 </p>
5609 !! end
5610
5611 !!test
5612 Template-generated attribute string (k='v')
5613 !!input
5614 <span {{attr_str|id|v1}}>bar</span>
5615 !!result
5616 <p><span id="v1">bar</span>
5617 </p>
5618 !!end
5619
5620 !!article
5621 Template:paramtest2
5622 !! text
5623 including another template, {{paramtest|param={{{arg}}}}}
5624 !! endarticle
5625
5626 !! test
5627 Template passing argument to another template
5628 !! input
5629 {{paramtest2|arg='hmm'}}
5630 !! result
5631 <p>including another template, This is a test template with parameter 'hmm'
5632 </p>
5633 !! end
5634
5635 !! article
5636 Template:Linktest2
5637 !! text
5638 Main Page
5639 !! endarticle
5640
5641 !! test
5642 Template as link source
5643 !! input
5644 [[{{linktest2}}]]
5645
5646 [[{{linktest2}}|Main Page]]
5647
5648 [[{{linktest2}}]]Page
5649 !! result
5650 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5651 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5652 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
5653 </p>
5654 !! end
5655
5656
5657 !! article
5658 Template:loop1
5659 !! text
5660 {{loop2}}
5661 !! endarticle
5662
5663 !! article
5664 Template:loop2
5665 !! text
5666 {{loop1}}
5667 !! endarticle
5668
5669 !! test
5670 Template infinite loop
5671 !! input
5672 {{loop1}}
5673 !! result
5674 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
5675 </p>
5676 !! end
5677
5678 !! test
5679 Template from main namespace
5680 !! input
5681 {{:Main Page}}
5682 !! result
5683 <p>blah blah
5684 </p>
5685 !! end
5686
5687 !! article
5688 Template:table
5689 !! text
5690 {|
5691 | 1 || 2
5692 |-
5693 | 3 || 4
5694 |}
5695 !! endarticle
5696
5697 !! test
5698 BUG 529: Template with table, not included at beginning of line
5699 !! input
5700 foo {{table}}
5701 !! result
5702 <p>foo
5703 </p>
5704 <table>
5705 <tr>
5706 <td> 1 </td>
5707 <td> 2
5708 </td></tr>
5709 <tr>
5710 <td> 3 </td>
5711 <td> 4
5712 </td></tr></table>
5713
5714 !! end
5715
5716 !! test
5717 BUG 523: Template shouldn't eat newline (or add an extra one before table)
5718 !! input
5719 foo
5720 {{table}}
5721 !! result
5722 <p>foo
5723 </p>
5724 <table>
5725 <tr>
5726 <td> 1 </td>
5727 <td> 2
5728 </td></tr>
5729 <tr>
5730 <td> 3 </td>
5731 <td> 4
5732 </td></tr></table>
5733
5734 !! end
5735
5736 !! test
5737 BUG 41: Template parameters shown as broken links
5738 !! input
5739 {{{parameter}}}
5740 !! result
5741 <p>{{{parameter}}}
5742 </p>
5743 !! end
5744
5745 !! test
5746 Template with targets containing wikilinks
5747 !! input
5748 {{[[foo]]}}
5749
5750 {{[[{{echo|foo}}]]}}
5751
5752 {{{{echo|[[foo}}]]}}
5753 !! result
5754 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5755 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5756 </p><p>{{[[foo}}]]
5757 </p>
5758 !! end
5759
5760 !! article
5761 Template:MSGNW test
5762 !! text
5763 ''None'' of '''this''' should be
5764 * interpreted
5765 but rather passed unmodified
5766 {{test}}
5767 !! endarticle
5768
5769 # hmm, fix this or just deprecate msgnw and document its behavior?
5770 !! test
5771 msgnw keyword
5772 !! options
5773 disabled
5774 !! input
5775 {{msgnw:MSGNW test}}
5776 !! result
5777 <p>''None'' of '''this''' should be
5778 * interpreted
5779 but rather passed unmodified
5780 {{test}}
5781 </p>
5782 !! end
5783
5784 !! test
5785 int keyword
5786 !! input
5787 {{int:youhavenewmessages|lots of money|not!}}
5788 !! result
5789 <p>You have lots of money (not!).
5790 </p>
5791 !! end
5792
5793 !! article
5794 Template:Includes
5795 !! text
5796 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5797 !! endarticle
5798
5799 !! test
5800 <includeonly> and <noinclude> being included
5801 !! input
5802 {{Includes}}
5803 !! result
5804 <p>Foobar
5805 </p>
5806 !! end
5807
5808 !! article
5809 Template:Includes2
5810 !! text
5811 <onlyinclude>Foo</onlyinclude>bar
5812 !! endarticle
5813
5814 !! test
5815 <onlyinclude> being included
5816 !! input
5817 {{Includes2}}
5818 !! result
5819 <p>Foo
5820 </p>
5821 !! end
5822
5823
5824 !! article
5825 Template:Includes3
5826 !! text
5827 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
5828 !! endarticle
5829
5830 !! test
5831 <onlyinclude> and <includeonly> being included
5832 !! input
5833 {{Includes3}}
5834 !! result
5835 <p>Foo
5836 </p>
5837 !! end
5838
5839 !! test
5840 <includeonly> and <noinclude> on a page
5841 !! input
5842 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5843 !! result
5844 <p>Foozar
5845 </p>
5846 !! end
5847
5848 !! test
5849 Un-closed <noinclude>
5850 !! input
5851 <noinclude>
5852 !! result
5853 !! end
5854
5855 !! test
5856 <onlyinclude> on a page
5857 !! input
5858 <onlyinclude>Foo</onlyinclude>bar
5859 !! result
5860 <p>Foobar
5861 </p>
5862 !! end
5863
5864 !! test
5865 Un-closed <onlyinclude>
5866 !! input
5867 <onlyinclude>
5868 !! result
5869 !! end
5870
5871 !!test
5872 Self-closed noinclude, includeonly, onlyinclude tags
5873 !!input
5874 <noinclude />
5875 <includeonly />
5876 <onlyinclude />
5877 !!result
5878 <p><br />
5879 </p>
5880 !!end
5881
5882 !!test
5883 Unbalanced includeonly and noinclude tags
5884 !!input
5885 {|
5886 |a</noinclude>
5887 |b</noinclude></noinclude>
5888 |c</noinclude></includeonly>
5889 |d</includeonly></includeonly>
5890 |}
5891 !!result
5892 <table>
5893 <tr>
5894 <td>a
5895 </td>
5896 <td>b
5897 </td>
5898 <td>c&lt;/includeonly&gt;
5899 </td>
5900 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
5901 </td></tr></table>
5902
5903 !!end
5904
5905 !! article
5906 Template:Includeonly section
5907 !! text
5908 <includeonly>
5909 ==Includeonly section==
5910 </includeonly>
5911 ==Section T-1==
5912 !!endarticle
5913
5914 !! test
5915 Bug 6563: Edit link generation for section shown by <includeonly>
5916 !! input
5917 {{includeonly section}}
5918 !! result
5919 <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>
5920 <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>
5921
5922 !! end
5923
5924 # Uses same input as the contents of [[Template:Includeonly section]]
5925 !! test
5926 Bug 6563: Section extraction for section shown by <includeonly>
5927 !! options
5928 section=T-2
5929 !! input
5930 <includeonly>
5931 ==Includeonly section==
5932 </includeonly>
5933 ==Section T-2==
5934 !! result
5935 ==Section T-2==
5936 !! end
5937
5938 !! test
5939 Bug 6563: Edit link generation for section suppressed by <includeonly>
5940 !! input
5941 <includeonly>
5942 ==Includeonly section==
5943 </includeonly>
5944 ==Section 1==
5945 !! result
5946 <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>
5947
5948 !! end
5949
5950 !! test
5951 Bug 6563: Section extraction for section suppressed by <includeonly>
5952 !! options
5953 section=1
5954 !! input
5955 <includeonly>
5956 ==Includeonly section==
5957 </includeonly>
5958 ==Section 1==
5959 !! result
5960 ==Section 1==
5961 !! end
5962
5963 !! test
5964 Un-closed <includeonly>
5965 !! input
5966 <includeonly>
5967 !! result
5968 !! end
5969
5970 ###
5971 ### <includeonly> and <noinclude> in attributes
5972 ###
5973 !!test
5974 0. includeonly around the entire attribute
5975 !!input
5976 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
5977 !!result
5978 <p><span id="v2">bar</span>
5979 </p>
5980 !!end
5981
5982 !!test
5983 1. includeonly in html attr key
5984 !!input
5985 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
5986 !!result
5987 <p><span id="foo">bar</span>
5988 </p>
5989 !!end
5990
5991 !!test
5992 2. includeonly in html attr value
5993 !!input
5994 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
5995 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
5996 !!result
5997 <p><span id="v1">bar</span>
5998 <span id="v1">bar</span>
5999 </p>
6000 !!end
6001
6002 !!test
6003 3. includeonly in part of an attr value
6004 !!input
6005 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
6006 !!result
6007 <p><span style="color:red;">bar</span>
6008 </p>
6009 !!end
6010
6011 ###
6012 ### Testing parsing of templates where a template arg
6013 ### has the same name as the template itself.
6014 ###
6015
6016 !! article
6017 Template:quote
6018 !! text
6019 {{{quote|{{{1}}}}}}
6020 !! endarticle
6021
6022 !!test
6023 Templates: Template Name/Arg clash: 1. Use of positional param
6024 !!input
6025 {{quote|foo}}
6026 !!result
6027 <p>foo
6028 </p>
6029 !!end
6030
6031 !!test
6032 Templates: Template Name/Arg clash: 2. Use of named param
6033 !!input
6034 {{quote|quote=foo}}
6035 !!result
6036 <p>foo
6037 </p>
6038 !!end
6039
6040 !!test
6041 Templates: Template Name/Arg clash: 3. Use of named param with empty input
6042 !!input
6043 {{quote|quote}}
6044 !!result
6045 <p>quote
6046 </p>
6047 !!end
6048
6049 ###
6050 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
6051 ###
6052
6053 !!test
6054 Templates: 1. Simple use
6055 !!input
6056 {{echo|Foo}}
6057 !!result
6058 <p>Foo
6059 </p>
6060 !!end
6061
6062 !!test
6063 Templates: 2. Inside a block tag
6064 !!input
6065 <div>{{echo|Foo}}</div>
6066 !!result
6067 <div>Foo</div>
6068
6069 !!end
6070
6071 !!test
6072 Templates: P-wrapping: 1a. Templates on consecutive lines
6073 !!input
6074 {{echo|Foo}}
6075 {{echo|bar}}
6076 !!result
6077 <p>Foo
6078 bar
6079 </p>
6080 !!end
6081
6082 !!test
6083 Templates: P-wrapping: 1b. Templates on consecutive lines
6084 !!input
6085 Foo
6086
6087 {{echo|bar}}
6088 {{echo|baz}}
6089 !!result
6090 <p>Foo
6091 </p><p>bar
6092 baz
6093 </p>
6094 !!end
6095
6096 !!test
6097 Templates: P-wrapping: 1c. Templates on consecutive lines
6098 !!input
6099 {{echo|Foo}}
6100 {{echo|bar}} <div>baz</div>
6101 !!result
6102 <p>Foo
6103 </p>
6104 bar <div>baz</div>
6105
6106 !!end
6107
6108 !!test
6109 Templates: Inline Text: 1. Multiple tmeplate uses
6110 !!input
6111 {{echo|Foo}}bar{{echo|baz}}
6112 !!result
6113 <p>Foobarbaz
6114 </p>
6115 !!end
6116
6117 !!test
6118 Templates: Inline Text: 2. Back-to-back template uses
6119 !!input
6120 {{echo|Foo}}{{echo|bar}}
6121 !!result
6122 <p>Foobar
6123 </p>
6124 !!end
6125
6126 !!test
6127 Templates: Block Tags: 1. Multiple template uses
6128 !!input
6129 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
6130 !!result
6131 <div>Foo</div><div>bar</div><div>baz</div>
6132
6133 !!end
6134
6135 !!test
6136 Templates: Block Tags: 2. Back-to-back template uses
6137 !!input
6138 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
6139 !!result
6140 <div>Foo</div><div>bar</div>
6141
6142 !!end
6143
6144 !!test
6145 Templates: Links: 1. Simple example
6146 !!input
6147 {{echo|[[Foo|bar]]}}
6148 !!result
6149 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6150 </p>
6151 !!end
6152
6153 !!test
6154 Templates: Links: 2. Generation of link href
6155 !!input
6156 [[{{echo|Foo}}|bar]]
6157 !!result
6158 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6159 </p>
6160 !!end
6161
6162 !!test
6163 Templates: Links: 3. Generation of part of a link href
6164 !!input
6165 [[Fo{{echo|o}}|bar]]
6166
6167 [[Foo{{echo|bar}}]]
6168
6169 [[Foo{{echo|bar}}baz]]
6170
6171 [[Foo{{echo|bar}}|bar]]
6172
6173 [[:Foo{{echo|bar}}]]
6174
6175 [[:Foo{{echo|bar}}|bar]]
6176 !!result
6177 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6178 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6179 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
6180 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6181 </p><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><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6183 </p>
6184 !!end
6185
6186 !!test
6187 Templates: Links: 4. Multiple templates generating link href
6188 !!input
6189 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
6190 !!result
6191 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6192 </p>
6193 !!end
6194
6195 !!test
6196 Templates: Links: 5. Generation of link text
6197 !!input
6198 [[Foo|{{echo|bar}}]]
6199 !!result
6200 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6201 </p>
6202 !!end
6203
6204 !!test
6205 Templates: Links: 5. Nested templates (only outermost template should be marked)
6206 !!input
6207 {{echo|[[{{echo|Foo}}|bar]]}}
6208 !!result
6209 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6210 </p>
6211 !!end
6212
6213 !!test
6214 Templates: HTML Tag: 1. Generation of HTML attr. key
6215 !!input
6216 <div {{echo|style}}="color:red;">foo</div>
6217 !!result
6218 <div style="color:red;">foo</div>
6219
6220 !!end
6221
6222 !!test
6223 Templates: HTML Tag: 2. Generation of HTML attr. value
6224 !!input
6225 <div style={{echo|'color:red;'}}>foo</div>
6226 !!result
6227 <div style="color:red;">foo</div>
6228
6229 !!end
6230
6231 !!test
6232 Templates: HTML Tag: 3. Generation of HTML attr key and value
6233 !!input
6234 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
6235 !!result
6236 <div style="color:red;">foo</div>
6237
6238 !!end
6239
6240 !!test
6241 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
6242 !!input
6243 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
6244 !!result
6245 <div title="This is a long title with just one piece templated">foo</div>
6246
6247 !!end
6248
6249 !!test
6250 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
6251 !!input
6252 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
6253 !!result
6254 <div title="This is a long title with just one piece templated">foo</div>
6255
6256 !!end
6257
6258 !!test
6259 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
6260 !!input
6261 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
6262 !!result
6263 <div title="This is a long title with just one piece templated">foo</div>
6264
6265 !!end
6266
6267 !!test
6268 Templates: HTML Tag: 7. Generation of partial attribute key string
6269 !!input
6270 <div st{{echo|yle}}="color:red;">foo</div>
6271 !!result
6272 <div style="color:red;">foo</div>
6273
6274 !!end
6275
6276 !!test
6277 Templates: HTML Tables: 1. Generating start of a HTML table
6278 !!input
6279 {{echo|<table><tr><td>foo</td>}}</tr></table>
6280 !!result
6281 <table><tr><td>foo</td></tr></table>
6282
6283 !!end
6284
6285 !!test
6286 Templates: HTML Tables: 2a. Generating middle of a HTML table
6287 !!input
6288 <table><tr>{{echo|<td>foo</td>}}</tr></table>
6289 !!result
6290 <table><tr><td>foo</td></tr></table>
6291
6292 !!end
6293
6294 !!test
6295 Templates: HTML Tables: 2b. Generating middle of a HTML table
6296 !!input
6297 <table>{{echo|<tr><td>foo</td></tr>}}</table>
6298 !!result
6299 <table><tr><td>foo</td></tr></table>
6300
6301 !!end
6302
6303 !!test
6304 Templates: HTML Tables: 3. Generating end of a HTML table
6305 !!input
6306 <table><tr>{{echo|<td>foo</td></tr></table>}}
6307 !!result
6308 <table><tr><td>foo</td></tr></table>
6309
6310 !!end
6311
6312 !!test
6313 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
6314 !!input
6315 {{echo|<table>}}<tr><td>foo</td></tr></table>
6316 !!result
6317 <table><tr><td>foo</td></tr></table>
6318
6319 !!end
6320
6321 !!test
6322 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
6323 !!input
6324 <table>{{echo|<tr>}}<td>foo</td></tr></table>
6325 !!result
6326 <table><tr><td>foo</td></tr></table>
6327
6328 !!end
6329
6330 !!test
6331 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
6332 !!input
6333 <table><tr>{{echo|<td>}}foo</td></tr></table>
6334 !!result
6335 <table><tr><td>foo</td></tr></table>
6336
6337 !!end
6338
6339 !!test
6340 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
6341 !!input
6342 <table><tr><td>foo{{echo|</td>}}</tr></table>
6343 !!result
6344 <table><tr><td>foo</td></tr></table>
6345
6346 !!end
6347
6348 !!test
6349 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
6350 !!input
6351 <table><tr><td>foo</td>{{echo|</tr>}}</table>
6352 !!result
6353 <table><tr><td>foo</td></tr></table>
6354
6355 !!end
6356
6357 !!test
6358 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
6359 !!input
6360 <table><tr><td>foo</td></tr>{{echo|</table>}}
6361 !!result
6362 <table><tr><td>foo</td></tr></table>
6363
6364 !!end
6365
6366 !!test
6367 Templates: Wiki Tables: 1a. Fostering of entire template content
6368 !!input
6369 {|
6370 {{echo|a}}
6371 |}
6372 !!result
6373 <table>
6374 a
6375 <tr><td></td></tr></table>
6376
6377 !!end
6378
6379 !!test
6380 Templates: Wiki Tables: 1b. Fostering of entire template content
6381 !!input
6382 {|
6383 {{echo|<div>}}
6384 foo
6385 {{echo|</div>}}
6386 |}
6387 !!result
6388 <table>
6389 <div>
6390 <p>foo
6391 </p>
6392 </div>
6393 <tr><td></td></tr></table>
6394
6395 !!end
6396
6397 !!test
6398 Templates: Wiki Tables: 2. Fostering of partial template content
6399 !!input
6400 {|
6401 {{echo|a
6402 <div>b</div>}}
6403 |}
6404 !!result
6405 <table>
6406 a
6407 <div>b</div>
6408 <tr><td></td></tr></table>
6409
6410 !!end
6411
6412 !!test
6413 Templates: Wiki Tables: 3. td-content via multiple templates
6414 !!input
6415 {|
6416 {{echo|{{pipe}}a}}{{echo|b}}
6417 |}
6418 !!result
6419 <table>
6420 <tr>
6421 <td>ab
6422 </td></tr></table>
6423
6424 !!end
6425
6426 !!test
6427 Templates: Wiki Tables: 4. Templated tags, no content
6428 !!input
6429 {{tbl-start}}
6430 {{tbl-end}}
6431 !!result
6432 <table>
6433 <tr><td></td></tr></table>
6434
6435 !!end
6436
6437 !!test
6438 Templates: Wiki Tables: 5. Templated tags, regular td-tags
6439 !!input
6440 {{tbl-start}}
6441 |foo
6442 {{tbl-end}}
6443 !!result
6444 <table>
6445 <tr>
6446 <td>foo
6447 </td></tr></table>
6448
6449 !!end
6450
6451 !!test
6452 Templates: Wiki Tables: 6. Templated tags, templated td-tags
6453 !!input
6454 {{tbl-start}}
6455 {{!}}foo
6456 {{tbl-end}}
6457 !!result
6458 <table>
6459 <tr>
6460 <td>foo
6461 </td></tr></table>
6462
6463 !!end
6464
6465 !!test
6466 Templates: Lists: Multi-line list-items via templates
6467 !!input
6468 *{{echo|a {{nonexistent|
6469 unused}}}}
6470 *{{echo|b {{nonexistent|
6471 unused}}}}
6472 !!result
6473 <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>
6474 </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>
6475 </li></ul>
6476
6477 !!end
6478
6479 !!test
6480 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
6481 !!input
6482 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
6483 !!result
6484 <p><i>ab</i>c<i>d</i>e
6485 </p>
6486 !!end
6487
6488 !!test
6489 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
6490 (PHP parser generates misnested html)
6491 !! options
6492 disabled
6493 !!input
6494 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
6495 !!result
6496 <p><span><i>a</i></span><i><span>b</span></i><span>c</span><i>d</i><span>e</span></p>
6497 !!end
6498
6499 !!test
6500 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
6501 (PHP parser generates misnested html)
6502 !! options
6503 disabled
6504 !!input
6505 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
6506 !!result
6507 <div><i>a</i></div>
6508 <div><i>b</i>c<i>d</i></div>
6509 <div>e</div>
6510 !!end
6511
6512 !!test
6513 Templates: Ugly nesting: 4. Divs opened/closed across templates
6514 !!input
6515 a<div>b{{echo|c</div>d}}e
6516 !!result
6517 a<div>bc</div>de
6518
6519 !!end
6520
6521 !!test
6522 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
6523 (Parsoid-centric)
6524 !! options
6525 parsoid
6526 !!input
6527 {|
6528 |{{echo|foo</table>}}
6529 |bar
6530 |}
6531 !!result
6532 <table about="#mwt1" typeof="mw:Object/Template ">
6533 <tbody><tr><td>foo</td></tr></tbody></table><span about="#mwt1">
6534 bar</span><span about="#mwt1">
6535 </span>
6536 !!end
6537
6538 !!test
6539 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
6540 (Parsoid-centric)
6541 !! options
6542 parsoid
6543 !!input
6544 <table>
6545 <tr>
6546 <td>
6547 <table>
6548 <tr>
6549 <td>1. {{echo|foo </table>}}</td>
6550 <td> bar </td>
6551 <td>2. {{echo|baz </table>}}</td>
6552 </tr>
6553 <tr>
6554 <td>abc</td>
6555 </tr>
6556 </table>
6557 </td>
6558 </tr>
6559 <tr>
6560 <td>xyz</td>
6561 </tr>
6562 </table>
6563 !!result
6564 <table about="#mwt1" typeof="mw:Object/Template">
6565 <tbody><tr >
6566 <td >
6567 <table >
6568 <tbody><tr >
6569 <td >1. foo </td></tr></tbody></table></td>
6570 <td > bar </td>
6571 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
6572 </span><span about="#mwt1">
6573
6574 abc</span><span about="#mwt1">
6575 </span><span about="#mwt1">
6576 </span><span about="#mwt1">
6577 </span><span about="#mwt1">
6578 </span><span about="#mwt1">
6579
6580 xyz</span><span about="#mwt1">
6581 </span><span about="#mwt1">
6582 </span>
6583 !!end
6584
6585 !! test
6586 Templates: Ugly templates: 3. newline-only template parameter
6587 !! input
6588 foo {{echo|
6589 }}
6590 !! result
6591 <p>foo
6592 </p>
6593 !! end
6594
6595 # This looks like a bug: a single newline triggers p/br for some reason.
6596 !! test
6597 Templates: Ugly templates: 4. newline-only template parameter inconsistency
6598 !! input
6599 {{echo|
6600 }}
6601 !! result
6602 <p><br />
6603 </p>
6604 !! end
6605
6606
6607 !!test
6608 Parser Functions: 1. Simple example
6609 !!input
6610 {{uc:foo}}
6611 !!result
6612 <p>FOO
6613 </p>
6614 !!end
6615
6616 !!test
6617 Parser Functions: 2. Nested use (only outermost should be marked up)
6618 !!input
6619 {{uc:{{lc:FOO}}}}
6620 !!result
6621 <p>FOO
6622 </p>
6623 !!end
6624
6625 ###
6626 ### Pre-save transform tests
6627 ###
6628 !! test
6629 pre-save transform: subst:
6630 !! options
6631 PST
6632 !! input
6633 {{subst:test}}
6634 !! result
6635 This is a test template
6636 !! end
6637
6638 !! test
6639 pre-save transform: normal template
6640 !! options
6641 PST
6642 !! input
6643 {{test}}
6644 !! result
6645 {{test}}
6646 !! end
6647
6648 !! test
6649 pre-save transform: nonexistent template
6650 !! options
6651 PST
6652 !! input
6653 {{thistemplatedoesnotexist}}
6654 !! result
6655 {{thistemplatedoesnotexist}}
6656 !! end
6657
6658
6659 !! test
6660 pre-save transform: subst magic variables
6661 !! options
6662 PST
6663 !! input
6664 {{subst:SITENAME}}
6665 !! result
6666 MediaWiki
6667 !! end
6668
6669 # This is bug 89, which I fixed. -- wtm
6670 !! test
6671 pre-save transform: subst: templates with parameters
6672 !! options
6673 pst
6674 !! input
6675 {{subst:paramtest|param="something else"}}
6676 !! result
6677 This is a test template with parameter "something else"
6678 !! end
6679
6680 !! article
6681 Template:nowikitest
6682 !! text
6683 <nowiki>'''not wiki'''</nowiki>
6684 !! endarticle
6685
6686 !! test
6687 pre-save transform: nowiki in subst (bug 1188)
6688 !! options
6689 pst
6690 !! input
6691 {{subst:nowikitest}}
6692 !! result
6693 <nowiki>'''not wiki'''</nowiki>
6694 !! end
6695
6696
6697 !! article
6698 Template:commenttest
6699 !! text
6700 This template has <!-- a comment --> in it.
6701 !! endarticle
6702
6703 !! test
6704 pre-save transform: comment in subst (bug 1936)
6705 !! options
6706 pst
6707 !! input
6708 {{subst:commenttest}}
6709 !! result
6710 This template has <!-- a comment --> in it.
6711 !! end
6712
6713 !! test
6714 pre-save transform: unclosed tag
6715 !! options
6716 pst noxml
6717 !! input
6718 <nowiki>'''not wiki'''
6719 !! result
6720 <nowiki>'''not wiki'''
6721 !! end
6722
6723 !! test
6724 pre-save transform: mixed tag case
6725 !! options
6726 pst noxml
6727 !! input
6728 <NOwiki>'''not wiki'''</noWIKI>
6729 !! result
6730 <NOwiki>'''not wiki'''</noWIKI>
6731 !! end
6732
6733 !! test
6734 pre-save transform: unclosed comment in <nowiki>
6735 !! options
6736 pst noxml
6737 !! input
6738 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6739 !! result
6740 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6741 !!end
6742
6743 !! article
6744 Template:dangerous
6745 !!text
6746 <span onmouseover="alert('crap')">Oh no</span>
6747 !!endarticle
6748
6749 !!test
6750 (confirming safety of fix for subst bug 1936)
6751 !! input
6752 {{Template:dangerous}}
6753 !! result
6754 <p><span>Oh no</span>
6755 </p>
6756 !! end
6757
6758 !! test
6759 pre-save transform: comment containing gallery (bug 5024)
6760 !! options
6761 pst
6762 !! input
6763 <!-- <gallery>data</gallery> -->
6764 !!result
6765 <!-- <gallery>data</gallery> -->
6766 !!end
6767
6768 !! test
6769 pre-save transform: comment containing extension
6770 !! options
6771 pst
6772 !! input
6773 <!-- <tag>data</tag> -->
6774 !!result
6775 <!-- <tag>data</tag> -->
6776 !!end
6777
6778 !! test
6779 pre-save transform: comment containing nowiki
6780 !! options
6781 pst
6782 !! input
6783 <!-- <nowiki>data</nowiki> -->
6784 !!result
6785 <!-- <nowiki>data</nowiki> -->
6786 !!end
6787
6788 !! test
6789 pre-save transform: <noinclude> in subst (bug 3298)
6790 !! options
6791 pst
6792 !! input
6793 {{subst:Includes}}
6794 !! result
6795 Foobar
6796 !! end
6797
6798 !! test
6799 pre-save transform: <onlyinclude> in subst (bug 3298)
6800 !! options
6801 pst
6802 !! input
6803 {{subst:Includes2}}
6804 !! result
6805 Foo
6806 !! end
6807
6808 !! article
6809 Template:SubstTest
6810 !!text
6811 {{<includeonly>subst:</includeonly>Includes}}
6812 !! endarticle
6813
6814 !! article
6815 Template:SafeSubstTest
6816 !! text
6817 {{<includeonly>safesubst:</includeonly>Includes}}
6818 !! endarticle
6819
6820 !! test
6821 bug 22297: safesubst: works during PST
6822 !! options
6823 pst
6824 !! input
6825 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
6826 !! result
6827 FoobarFoobar
6828 !! end
6829
6830 !! test
6831 bug 22297: safesubst: works during normal parse
6832 !! input
6833 {{SafeSubstTest}}
6834 !! result
6835 <p>Foobar
6836 </p>
6837 !! end
6838
6839 !! test:
6840 subst: does not work during normal parse
6841 !! input
6842 {{SubstTest}}
6843 !! result
6844 <p>{{subst:Includes}}
6845 </p>
6846 !! end
6847
6848 !! test
6849 pre-save transform: context links ("pipe trick")
6850 !! options
6851 pst
6852 !! input
6853 [[Article (context)|]]
6854 [[Bar:Article|]]
6855 [[:Bar:Article|]]
6856 [[Bar:Article (context)|]]
6857 [[:Bar:Article (context)|]]
6858 [[|Article]]
6859 [[|Article (context)]]
6860 [[Bar:X (Y) Z|]]
6861 [[:Bar:X (Y) Z|]]
6862 !! result
6863 [[Article (context)|Article]]
6864 [[Bar:Article|Article]]
6865 [[:Bar:Article|Article]]
6866 [[Bar:Article (context)|Article]]
6867 [[:Bar:Article (context)|Article]]
6868 [[Article]]
6869 [[Article (context)]]
6870 [[Bar:X (Y) Z|X (Y) Z]]
6871 [[:Bar:X (Y) Z|X (Y) Z]]
6872 !! end
6873
6874 !! test
6875 pre-save transform: context links ("pipe trick") with interwiki prefix
6876 !! options
6877 pst
6878 !! input
6879 [[interwiki:Article|]]
6880 [[:interwiki:Article|]]
6881 [[interwiki:Bar:Article|]]
6882 [[:interwiki:Bar:Article|]]
6883 !! result
6884 [[interwiki:Article|Article]]
6885 [[:interwiki:Article|Article]]
6886 [[interwiki:Bar:Article|Bar:Article]]
6887 [[:interwiki:Bar:Article|Bar:Article]]
6888 !! end
6889
6890 !! test
6891 pre-save transform: context links ("pipe trick") with parens in title
6892 !! options
6893 pst title=[[Somearticle (context)]]
6894 !! input
6895 [[|Article]]
6896 !! result
6897 [[Article (context)|Article]]
6898 !! end
6899
6900 !! test
6901 pre-save transform: context links ("pipe trick") with comma in title
6902 !! options
6903 pst title=[[Someplace, Somewhere]]
6904 !! input
6905 [[|Otherplace]]
6906 [[Otherplace, Elsewhere|]]
6907 [[Otherplace, Elsewhere, Anywhere|]]
6908 !! result
6909 [[Otherplace, Somewhere|Otherplace]]
6910 [[Otherplace, Elsewhere|Otherplace]]
6911 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
6912 !! end
6913
6914 !! test
6915 pre-save transform: context links ("pipe trick") with parens and comma
6916 !! options
6917 pst title=[[Someplace (IGNORED), Somewhere]]
6918 !! input
6919 [[|Otherplace]]
6920 [[Otherplace (place), Elsewhere|]]
6921 !! result
6922 [[Otherplace, Somewhere|Otherplace]]
6923 [[Otherplace (place), Elsewhere|Otherplace]]
6924 !! end
6925
6926 !! test
6927 pre-save transform: context links ("pipe trick") with comma and parens
6928 !! options
6929 pst title=[[Who, me? (context)]]
6930 !! input
6931 [[|Yes, you.]]
6932 [[Me, Myself, and I (1937 song)|]]
6933 !! result
6934 [[Yes, you. (context)|Yes, you.]]
6935 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
6936 !! end
6937
6938 !! test
6939 pre-save transform: context links ("pipe trick") with namespace
6940 !! options
6941 pst title=[[Ns:Somearticle]]
6942 !! input
6943 [[|Article]]
6944 !! result
6945 [[Ns:Article|Article]]
6946 !! end
6947
6948 !! test
6949 pre-save transform: context links ("pipe trick") with namespace and parens
6950 !! options
6951 pst title=[[Ns:Somearticle (context)]]
6952 !! input
6953 [[|Article]]
6954 !! result
6955 [[Ns:Article (context)|Article]]
6956 !! end
6957
6958 !! test
6959 pre-save transform: context links ("pipe trick") with namespace and comma
6960 !! options
6961 pst title=[[Ns:Somearticle, Context, Whatever]]
6962 !! input
6963 [[|Article]]
6964 !! result
6965 [[Ns:Article, Context, Whatever|Article]]
6966 !! end
6967
6968 !! test
6969 pre-save transform: context links ("pipe trick") with namespace, comma and parens
6970 !! options
6971 pst title=[[Ns:Somearticle, Context (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 namespace, parens and comma
6980 !! options
6981 pst title=[[Ns:Somearticle (IGNORED), Context]]
6982 !! input
6983 [[|Article]]
6984 !! result
6985 [[Ns:Article, Context|Article]]
6986 !! end
6987
6988 !! test
6989 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
6990 !! options
6991 pst
6992 !! input
6993 [[Article(context)|]]
6994 [[Bar:Article(context)|]]
6995 [[:Bar:Article(context)|]]
6996 [[|Article(context)]]
6997 [[Bar:X(Y)Z|]]
6998 [[:Bar:X(Y)Z|]]
6999 !! result
7000 [[Article(context)|Article]]
7001 [[Bar:Article(context)|Article]]
7002 [[:Bar:Article(context)|Article]]
7003 [[Article(context)]]
7004 [[Bar:X(Y)Z|X(Y)Z]]
7005 [[:Bar:X(Y)Z|X(Y)Z]]
7006 !! end
7007
7008 !! test
7009 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
7010 !! options
7011 pst
7012 !! input
7013 [[Article (context)|]]
7014 [[Bar:Article (context)|]]
7015 [[:Bar:Article (context)|]]
7016 [[|Article (context)]]
7017 [[Bar:X (Y) Z|]]
7018 [[:Bar:X (Y) Z|]]
7019 !! result
7020 [[Article (context)|Article]]
7021 [[Bar:Article (context)|Article]]
7022 [[:Bar:Article (context)|Article]]
7023 [[Article (context)]]
7024 [[Bar:X (Y) Z|X (Y) Z]]
7025 [[:Bar:X (Y) Z|X (Y) Z]]
7026 !! end
7027
7028 !! test
7029 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
7030 !! options
7031 pst
7032 !! input
7033 [[Article(context)|]]
7034 [[Bar:Article(context)|]]
7035 [[:Bar:Article(context)|]]
7036 [[|Article(context)]]
7037 [[Bar:X(Y)Z|]]
7038 [[:Bar:X(Y)Z|]]
7039 !! result
7040 [[Article(context)|Article]]
7041 [[Bar:Article(context)|Article]]
7042 [[:Bar:Article(context)|Article]]
7043 [[Article(context)]]
7044 [[Bar:X(Y)Z|X(Y)Z]]
7045 [[:Bar:X(Y)Z|X(Y)Z]]
7046 !! end
7047
7048 !! test
7049 pre-save transform: context links ("pipe trick") with commas (bug 21660)
7050 !! options
7051 pst
7052 !! input
7053 [[Article (context), context|]]
7054 [[Article (context),context|]]
7055 [[Bar:Article (context), context|]]
7056 [[Bar:Article (context),context|]]
7057 [[:Bar:Article (context), context|]]
7058 [[:Bar:Article (context),context|]]
7059 !! result
7060 [[Article (context), context|Article]]
7061 [[Article (context),context|Article]]
7062 [[Bar:Article (context), context|Article]]
7063 [[Bar:Article (context),context|Article]]
7064 [[:Bar:Article (context), context|Article]]
7065 [[:Bar:Article (context),context|Article]]
7066 !! end
7067
7068 !! test
7069 pre-save transform: trim trailing empty lines
7070 !! options
7071 pst
7072 !! input
7073 Empty lines are trimmed
7074
7075
7076
7077
7078 !! result
7079 Empty lines are trimmed
7080 !! end
7081
7082 !! test
7083 pre-save transform: Signature expansion
7084 !! options
7085 pst
7086 !! input
7087 * ~~~
7088 * <noinclude>~~~</noinclude>
7089 * <includeonly>~~~</includeonly>
7090 * <onlyinclude>~~~</onlyinclude>
7091 !! result
7092 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
7093 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
7094 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
7095 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
7096 !! end
7097
7098
7099 !! test
7100 pre-save transform: Signature expansion in nowiki tags (bug 93)
7101 !! options
7102 pst disabled
7103 !! input
7104 Shall not expand:
7105
7106 <nowiki>~~~~</nowiki>
7107
7108 <includeonly><nowiki>~~~~</nowiki></includeonly>
7109
7110 <noinclude><nowiki>~~~~</nowiki></noinclude>
7111
7112 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7113
7114 {{subst:Foo}} shall be converted to FOO
7115
7116 As well as inside noinclude/onlyinclude
7117 <noinclude>{{subst:Foo}}</noinclude>
7118 <onlyinclude>{{subst:Foo}}</onlyinclude>
7119
7120 But not inside includeonly
7121 <includeonly>{{subst:Foo}}</includeonly>
7122 !! result
7123 Shall not expand:
7124
7125 <nowiki>~~~~</nowiki>
7126
7127 <includeonly><nowiki>~~~~</nowiki></includeonly>
7128
7129 <noinclude><nowiki>~~~~</nowiki></noinclude>
7130
7131 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7132
7133 FOO shall be converted to FOO
7134
7135 As well as inside noinclude/onlyinclude
7136 <noinclude>FOO</noinclude>
7137 <onlyinclude>FOO</onlyinclude>
7138
7139 But not inside includeonly
7140 <includeonly>{{subst:Foo}}</includeonly>
7141 !! end
7142
7143 ###
7144 ### Message transform tests
7145 ###
7146 !! test
7147 message transform: magic variables
7148 !! options
7149 msg
7150 !! input
7151 {{SITENAME}}
7152 !! result
7153 MediaWiki
7154 !! end
7155
7156 !! test
7157 message transform: should not transform wiki markup
7158 !! options
7159 msg
7160 !! input
7161 ''test''
7162 !! result
7163 ''test''
7164 !! end
7165
7166 !! test
7167 message transform: <noinclude> in transcluded template (bug 4926)
7168 !! options
7169 msg
7170 !! input
7171 {{Includes}}
7172 !! result
7173 Foobar
7174 !! end
7175
7176 !! test
7177 message transform: <onlyinclude> in transcluded template (bug 4926)
7178 !! options
7179 msg
7180 !! input
7181 {{Includes2}}
7182 !! result
7183 Foo
7184 !! end
7185
7186 !! test
7187 {{#special:}} page name, known
7188 !! options
7189 msg
7190 !! input
7191 {{#special:Recentchanges}}
7192 !! result
7193 Special:RecentChanges
7194 !! end
7195
7196 !! test
7197 {{#special:}} page name with subpage, known
7198 !! options
7199 msg
7200 !! input
7201 {{#special:Recentchanges/param}}
7202 !! result
7203 Special:RecentChanges/param
7204 !! end
7205
7206 !! test
7207 {{#special:}} page name, unknown
7208 !! options
7209 msg
7210 !! input
7211 {{#special:foobarnonexistent}}
7212 !! result
7213 No such special page
7214 !! end
7215
7216 !! test
7217 {{#speciale:}} page name, known
7218 !! options
7219 msg
7220 !! input
7221 {{#speciale:Recentchanges}}
7222 !! result
7223 Special:RecentChanges
7224 !! end
7225
7226 !! test
7227 {{#speciale:}} page name with subpage, known
7228 !! options
7229 msg
7230 !! input
7231 {{#speciale:Recentchanges/param}}
7232 !! result
7233 Special:RecentChanges/param
7234 !! end
7235
7236 !! test
7237 {{#speciale:}} page name, unknown
7238 !! options
7239 msg
7240 !! input
7241 {{#speciale:foobarnonexistent}}
7242 !! result
7243 No_such_special_page
7244 !! end
7245
7246 ###
7247 ### Images
7248 ###
7249 !! test
7250 Simple image
7251 !! input
7252 [[Image:foobar.jpg]]
7253 !! result
7254 <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>
7255 </p>
7256 !! end
7257
7258 !! test
7259 Right-aligned image
7260 !! input
7261 [[Image:foobar.jpg|right]]
7262 !! result
7263 <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>
7264
7265 !! end
7266
7267 !! test
7268 Simple image (using File: namespace, now canonical)
7269 !! input
7270 [[File:foobar.jpg]]
7271 !! result
7272 <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>
7273 </p>
7274 !! end
7275
7276 !! test
7277 Image with caption
7278 !! input
7279 [[Image:foobar.jpg|right|Caption text]]
7280 !! result
7281 <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>
7282
7283 !! end
7284
7285 !! test
7286 Image with empty attribute
7287 !! input
7288 [[Image:foobar.jpg|right||Caption text]]
7289 !! result
7290 <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>
7291
7292 !! end
7293
7294 !! test
7295 Image with link tails
7296 !! input
7297 123[[Image:foobar.jpg]]456
7298 123[[Image:foobar.jpg|right]]456
7299 123[[Image:foobar.jpg|thumb]]456
7300 !! result
7301 <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
7302 </p>
7303 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
7304 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
7305
7306 !! end
7307
7308 !! test
7309 Image with multiple captions -- only last one is accepted
7310 !! input
7311 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
7312 !! result
7313 <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>
7314
7315 !! end
7316
7317 !! test
7318 Image with width attribute at different positions
7319 !! input
7320 [[Image:foobar.jpg|200px|right|Caption]]
7321 [[Image:foobar.jpg|right|200px|Caption]]
7322 [[Image:foobar.jpg|right|Caption|200px]]
7323 !! result
7324 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
7325 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
7326 <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>
7327
7328 !! end
7329
7330 !! test
7331 Image with link parameter, wiki target
7332 !! input
7333 [[Image:foobar.jpg|link=Target page]]
7334 !! result
7335 <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>
7336 </p>
7337 !! end
7338
7339 !! test
7340 Image with link parameter, URL target
7341 !! input
7342 [[Image:foobar.jpg|link=http://example.com/]]
7343 !! result
7344 <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>
7345 </p>
7346 !! end
7347
7348 !! test
7349 Image with link parameter, wgExternalLinkTarget
7350 !! input
7351 [[Image:foobar.jpg|link=http://example.com/]]
7352 !! config
7353 wgExternalLinkTarget='foobar'
7354 !! result
7355 <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>
7356 </p>
7357 !! end
7358
7359 !! test
7360 Image with link parameter, wgNoFollowLinks set to false
7361 !! input
7362 [[Image:foobar.jpg|link=http://example.com/]]
7363 !! config
7364 wgNoFollowLinks=false
7365 !! result
7366 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7367 </p>
7368 !! end
7369
7370 !! test
7371 Image with link parameter, wgNoFollowDomainExceptions
7372 !! input
7373 [[Image:foobar.jpg|link=http://example.com/]]
7374 !! config
7375 wgNoFollowDomainExceptions='example.com'
7376 !! result
7377 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7378 </p>
7379 !! end
7380
7381 !! test
7382 Image with link parameter, wgExternalLinkTarget, unnamed parameter
7383 !! input
7384 [[Image:foobar.jpg|link=http://example.com/|Title]]
7385 !! config
7386 wgExternalLinkTarget='foobar'
7387 !! result
7388 <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>
7389 </p>
7390 !! end
7391
7392 !! test
7393 Image with empty link parameter
7394 !! input
7395 [[Image:foobar.jpg|link=]]
7396 !! result
7397 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
7398 </p>
7399 !! end
7400
7401 !! test
7402 Image with link parameter (wiki target) and unnamed parameter
7403 !! input
7404 [[Image:foobar.jpg|link=Target page|Title]]
7405 !! result
7406 <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>
7407 </p>
7408 !! end
7409
7410 !! test
7411 Image with link parameter (URL target) and unnamed parameter
7412 !! input
7413 [[Image:foobar.jpg|link=http://example.com/|Title]]
7414 !! result
7415 <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>
7416 </p>
7417 !! end
7418
7419 !! test
7420 Thumbnail image with link parameter
7421 !! options
7422 php
7423 !! input
7424 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
7425 !! result
7426 <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>
7427
7428 !! end
7429
7430 !! test
7431 Manually-specified thumbnail image
7432 !! options
7433 php
7434 !! input
7435 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
7436 !! result
7437 <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>
7438
7439 !! end
7440
7441 !! test
7442 Manually-specified thumbnail image with explicit link to wiki page
7443 !! options
7444 php
7445 !! input
7446 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
7447 !! result
7448 <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>
7449
7450 !! end
7451
7452 !! test
7453 Manually-specified thumbnail image with explicit link to url
7454 !! options
7455 php
7456 !! input
7457 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
7458 !! result
7459 <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>
7460
7461 !! end
7462
7463 !! test
7464 Manually-specified thumbnail image with explicit no link
7465 !! options
7466 php
7467 !! input
7468 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
7469 !! result
7470 <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>
7471
7472 !! end
7473
7474 !! test
7475 Manually-specified thumbnail image with explicit link and alt text
7476 !! options
7477 php
7478 !! input
7479 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
7480 !! result
7481 <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>
7482
7483 !! end
7484
7485 !! test
7486 Image with frame and link
7487 !! input
7488 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
7489 !! result
7490 <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>
7491
7492 !! end
7493
7494 !! test
7495 Image with frame and link and explicit alt
7496 !! input
7497 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
7498 !! result
7499 <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>
7500
7501 !! end
7502
7503 !! test
7504 Image with wiki markup in implicit alt
7505 !! input
7506 [[Image:Foobar.jpg|testing '''bold''' in alt]]
7507 !! result
7508 <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>
7509 </p>
7510 !! end
7511
7512 !! test
7513 Image with wiki markup in explicit alt
7514 !! input
7515 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
7516 !! result
7517 <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>
7518 </p>
7519 !! end
7520
7521 !! test
7522 Link to image page- image page normally doesn't exists, hence edit link
7523 Add test with existing image page
7524 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
7525 !! input
7526 [[:Image:test]]
7527 !! result
7528 <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>
7529 </p>
7530 !! end
7531
7532 !! test
7533 bug 18784 Link to non-existent image page with caption should use caption as link text
7534 !! input
7535 [[:Image:test|caption]]
7536 !! result
7537 <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>
7538 </p>
7539 !! end
7540
7541 !! test
7542 Frameless image caption with a free URL
7543 !! input
7544 [[Image:foobar.jpg|http://example.com]]
7545 !! result
7546 <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>
7547 </p>
7548 !! end
7549
7550 !! test
7551 Thumbnail image caption with a free URL
7552 !! input
7553 [[Image:foobar.jpg|thumb|http://example.com]]
7554 !! result
7555 <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>
7556
7557 !! end
7558
7559 !! test
7560 Thumbnail image caption with a free URL and explicit alt
7561 !! input
7562 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
7563 !! result
7564 <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>
7565
7566 !! end
7567
7568 !! test
7569 BUG 1887: A ISBN with a thumbnail
7570 !! input
7571 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
7572 !! result
7573 <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>
7574
7575 !! end
7576
7577 !! test
7578 BUG 1887: A RFC with a thumbnail
7579 !! input
7580 [[Image:foobar.jpg|thumb|This is RFC 12354]]
7581 !! result
7582 <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>
7583
7584 !! end
7585
7586 !! test
7587 BUG 1887: A mailto link with a thumbnail
7588 !! input
7589 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
7590 !! result
7591 <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>
7592
7593 !! end
7594
7595 # Pending resolution to bug 368
7596 !! test
7597 BUG 648: Frameless image caption with a link
7598 !! input
7599 [[Image:foobar.jpg|text with a [[link]] in it]]
7600 !! result
7601 <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>
7602 </p>
7603 !! end
7604
7605 !! test
7606 BUG 648: Frameless image caption with a link (suffix)
7607 !! input
7608 [[Image:foobar.jpg|text with a [[link]]foo in it]]
7609 !! result
7610 <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>
7611 </p>
7612 !! end
7613
7614 !! test
7615 BUG 648: Frameless image caption with an interwiki link
7616 !! input
7617 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
7618 !! result
7619 <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>
7620 </p>
7621 !! end
7622
7623 !! test
7624 BUG 648: Frameless image caption with a piped interwiki link
7625 !! input
7626 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
7627 !! result
7628 <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>
7629 </p>
7630 !! end
7631
7632 !! test
7633 Escape HTML special chars in image alt text
7634 !! input
7635 [[Image:foobar.jpg|& < > "]]
7636 !! result
7637 <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>
7638 </p>
7639 !! end
7640
7641 !! test
7642 BUG 499: Alt text should have &#1234;, not &amp;1234;
7643 !! input
7644 [[Image:foobar.jpg|&#9792;]]
7645 !! result
7646 <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>
7647 </p>
7648 !! end
7649
7650 !! test
7651 Broken image caption with link
7652 !! input
7653 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
7654 !! result
7655 <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.
7656 </p>
7657 !! end
7658
7659 !! test
7660 Image caption containing another image
7661 !! input
7662 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
7663 !! result
7664 <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>
7665
7666 !! end
7667
7668 !! test
7669 Image caption containing a newline
7670 !! input
7671 [[Image:Foobar.jpg|This
7672 *is some text]]
7673 !! result
7674 <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>
7675 </p>
7676 !!end
7677
7678 !!test
7679 Parsoid: Image caption containing leading space
7680 (The leading space should not trigger nowiki escaping in wt2wt mode)
7681 !! input
7682 [[Image:Foobar.jpg|thumb| bar]]
7683 !! result
7684 <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>
7685
7686 !!end
7687
7688 !! test
7689 Bug 3090: External links other than http: in image captions
7690 !! input
7691 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
7692 !! result
7693 <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>
7694
7695 !! end
7696
7697 !! test
7698 Custom class
7699 !! input
7700 [[Image:foobar.jpg|a|class=b]]
7701 !! result
7702 <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>
7703 </p>
7704 !! end
7705
7706 !! test
7707 Localized image handling (1).
7708 !! options
7709 language=es
7710 !! input
7711 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
7712 !! result
7713 <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>
7714
7715 !! end
7716
7717 !! test
7718 Localized image handling (2).
7719 !! options
7720 language=es
7721 !! input
7722 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
7723 !! result
7724 <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>
7725
7726 !! end
7727
7728 !! test
7729 "border", "frameless" and "class" attributes on an image.
7730 !! input
7731 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
7732 !! result
7733 <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>
7734 </p>
7735 !! end
7736
7737 !! article
7738 File:Barfoo.jpg
7739 !! text
7740 #REDIRECT [[File:Barfoo.jpg]]
7741 !! endarticle
7742
7743 !! test
7744 Redirected image
7745 !! input
7746 [[Image:Barfoo.jpg]]
7747 !! result
7748 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
7749 </p>
7750 !! end
7751
7752 !! test
7753 Missing image with uploads disabled
7754 !! options
7755 wgEnableUploads=0
7756 !! input
7757 [[Image:Foobaz.jpg]]
7758 !! result
7759 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
7760 </p>
7761 !! end
7762
7763
7764 ###
7765 ### Subpages
7766 ###
7767 !! article
7768 Subpage test/subpage
7769 !! text
7770 foo
7771 !! endarticle
7772
7773 !! test
7774 Subpage link
7775 !! options
7776 subpage title=[[Subpage test]]
7777 !! input
7778 [[/subpage]]
7779 !! result
7780 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
7781 </p>
7782 !! end
7783
7784 !! test
7785 Subpage noslash link
7786 !! options
7787 subpage title=[[Subpage test]]
7788 !!input
7789 [[/subpage/]]
7790 !! result
7791 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
7792 </p>
7793 !! end
7794
7795 !! test
7796 Disabled subpages
7797 !! input
7798 [[/subpage]]
7799 !! result
7800 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
7801 </p>
7802 !! end
7803
7804 !! test
7805 BUG 561: {{/Subpage}}
7806 !! options
7807 subpage title=[[Page]]
7808 !! input
7809 {{/Subpage}}
7810 !! result
7811 <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>
7812 </p>
7813 !! end
7814
7815 ###
7816 ### Categories
7817 ###
7818 !! article
7819 Category:MediaWiki User's Guide
7820 !! text
7821 blah
7822 !! endarticle
7823
7824 !! test
7825 Link to category
7826 !! input
7827 [[:Category:MediaWiki User's Guide]]
7828 !! result
7829 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
7830 </p>
7831 !! end
7832
7833 !! test
7834 Simple category
7835 !! options
7836 cat
7837 !! input
7838 [[Category:MediaWiki User's Guide]]
7839 !! result
7840 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7841 !! end
7842
7843 !! test
7844 PAGESINCATEGORY invalid title fatal (r33546 fix)
7845 !! input
7846 {{PAGESINCATEGORY:<bogus>}}
7847 !! result
7848 <p>0
7849 </p>
7850 !! end
7851
7852 !! test
7853 Category with different sort key
7854 !! options
7855 cat
7856 !! input
7857 [[Category:MediaWiki User's Guide|Foo]]
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 identical sort key
7864 !! options
7865 cat
7866 !! input
7867 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7868 !! result
7869 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7870 !! end
7871
7872 !! test
7873 Category with empty sort key
7874 !! options
7875 cat
7876 pst
7877 !! input
7878 [[Category:MediaWiki User's Guide|]]
7879 !! result
7880 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7881 !! end
7882
7883 !! test
7884 Category with empty sort key and parentheses
7885 !! options
7886 cat
7887 pst
7888 !! input
7889 [[Category:Foo (bar)|]]
7890 !! result
7891 [[Category:Foo (bar)|Foo]]
7892 !! end
7893
7894 !! test
7895 Category with link tail
7896 !! options
7897 cat
7898 pst
7899 !! input
7900 123[[Category:Foo]]456
7901 !! result
7902 123[[Category:Foo]]456
7903 !! end
7904
7905 !! test
7906 Category with template
7907 !! options
7908 cat
7909 pst
7910 !! input
7911 [[Category:{{echo|Foo}}]]
7912 !! result
7913 [[Category:{{echo|Foo}}]]
7914 !! end
7915
7916 !! test
7917 Category with template in sort key
7918 !! options
7919 cat
7920 pst
7921 !! input
7922 [[Category:Foo|{{echo|Bar}}]]
7923 !! result
7924 [[Category:Foo|{{echo|Bar}}]]
7925 !! end
7926
7927 !! test
7928 Category with template in sort key and title
7929 !! options
7930 cat
7931 pst
7932 !! input
7933 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
7934 !! result
7935 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
7936 !! end
7937
7938 !! test
7939 Category / paragraph interactions
7940 !! input
7941 Foo [[Category:Baz]] Bar
7942
7943 Foo [[Category:Baz]]
7944 Bar
7945
7946 Foo
7947 [[Category:Baz]]
7948 Bar
7949
7950 Foo
7951 [[Category:Baz]] Bar
7952
7953 Foo
7954 [[Category:Baz]]
7955 [[Category:Baz]]
7956 [[Category:Baz]]
7957 Bar
7958
7959 [[Category:Baz]]
7960 [[Category:Baz]]
7961 [[Category:Baz]]
7962
7963 [[Category:Baz]]
7964 {{echo|[[Category:Baz]]}}
7965 [[Category:Baz]]
7966 !! result
7967 <p>Foo Bar
7968 </p><p>Foo
7969 Bar
7970 </p><p>Foo
7971 Bar
7972 </p><p>Foo Bar
7973 </p><p>Foo
7974 Bar
7975 </p>
7976 !! end
7977
7978 ###
7979 ### Inter-language links
7980 ###
7981 !! test
7982 Inter-language links
7983 !! options
7984 ill
7985 !! input
7986 [[es:Alimento]]
7987 [[fr:Nourriture]]
7988 [[zh:&#39135;&#21697;]]
7989 !! result
7990 es:Alimento fr:Nourriture zh:食品
7991 !! end
7992
7993 !! test
7994 Duplicate interlanguage links (bug 24502)
7995 !! options
7996 ill
7997 !! input
7998 [[es:1]]
7999 [[es:2]]
8000 [[fr:1]]
8001 [[fr:2]]
8002 !! result
8003 es:1 fr:1
8004 !! end
8005
8006 ###
8007 ### Sections
8008 ###
8009 !! test
8010 Basic section headings
8011 !! input
8012 == Headline 1 ==
8013 Some text
8014
8015 ==Headline 2==
8016 More
8017 ===Smaller headline===
8018 Blah blah
8019 !! result
8020 <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>
8021 <p>Some text
8022 </p>
8023 <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>
8024 <p>More
8025 </p>
8026 <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>
8027 <p>Blah blah
8028 </p>
8029 !! end
8030
8031 !! test
8032 Section headings with TOC
8033 !! input
8034 == Headline 1 ==
8035 === Subheadline 1 ===
8036 ===== Skipping a level =====
8037 ====== Skipping a level ======
8038
8039 == Headline 2 ==
8040 Some text
8041 ===Another headline===
8042 !! result
8043 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8044 <ul>
8045 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
8046 <ul>
8047 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
8048 <ul>
8049 <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>
8050 <ul>
8051 <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>
8052 </ul>
8053 </li>
8054 </ul>
8055 </li>
8056 </ul>
8057 </li>
8058 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
8059 <ul>
8060 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
8061 </ul>
8062 </li>
8063 </ul>
8064 </td></tr></table>
8065 <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>
8066 <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>
8067 <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>
8068 <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>
8069 <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>
8070 <p>Some text
8071 </p>
8072 <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>
8073
8074 !! end
8075
8076 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
8077 !! test
8078 Handling of sections up to level 6 and beyond
8079 !! input
8080 = Level 1 Heading=
8081 == Level 2 Heading==
8082 === Level 3 Heading===
8083 ==== Level 4 Heading====
8084 ===== Level 5 Heading=====
8085 ====== Level 6 Heading======
8086 ======= Level 7 Heading=======
8087 ======== Level 8 Heading========
8088 ========= Level 9 Heading=========
8089 ========== Level 10 Heading==========
8090 !! result
8091 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8092 <ul>
8093 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
8094 <ul>
8095 <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>
8096 <ul>
8097 <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>
8098 <ul>
8099 <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>
8100 <ul>
8101 <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>
8102 <ul>
8103 <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>
8104 <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>
8105 <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>
8106 <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>
8107 <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>
8108 </ul>
8109 </li>
8110 </ul>
8111 </li>
8112 </ul>
8113 </li>
8114 </ul>
8115 </li>
8116 </ul>
8117 </li>
8118 </ul>
8119 </td></tr></table>
8120 <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>
8121 <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>
8122 <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>
8123 <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>
8124 <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>
8125 <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>
8126 <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>
8127 <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>
8128 <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>
8129 <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>
8130
8131 !! end
8132
8133 !! test
8134 TOC regression (bug 9764)
8135 !! input
8136 == title 1 ==
8137 === title 1.1 ===
8138 ==== title 1.1.1 ====
8139 === title 1.2 ===
8140 == title 2 ==
8141 === title 2.1 ===
8142 !! result
8143 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8144 <ul>
8145 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8146 <ul>
8147 <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>
8148 <ul>
8149 <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>
8150 </ul>
8151 </li>
8152 <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>
8153 </ul>
8154 </li>
8155 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8156 <ul>
8157 <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>
8158 </ul>
8159 </li>
8160 </ul>
8161 </td></tr></table>
8162 <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>
8163 <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>
8164 <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>
8165 <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>
8166 <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>
8167 <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>
8168
8169 !! end
8170
8171 !! test
8172 TOC with wgMaxTocLevel=3 (bug 6204)
8173 !! options
8174 wgMaxTocLevel=3
8175 !! input
8176 == title 1 ==
8177 === title 1.1 ===
8178 ==== title 1.1.1 ====
8179 === title 1.2 ===
8180 == title 2 ==
8181 === title 2.1 ===
8182 !! result
8183 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8184 <ul>
8185 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8186 <ul>
8187 <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>
8188 <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>
8189 </ul>
8190 </li>
8191 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8192 <ul>
8193 <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>
8194 </ul>
8195 </li>
8196 </ul>
8197 </td></tr></table>
8198 <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>
8199 <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>
8200 <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>
8201 <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>
8202 <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>
8203 <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>
8204
8205 !! end
8206
8207 !! test
8208 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
8209 !! options
8210 wgMaxTocLevel=3
8211 !! input
8212 ==Section 1==
8213 ===Section 1.1===
8214 ====Section 1.1.1====
8215 ====Section 1.1.1.1====
8216 ==Section 2==
8217 !! result
8218 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8219 <ul>
8220 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
8221 <ul>
8222 <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>
8223 </ul>
8224 </li>
8225 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
8226 </ul>
8227 </td></tr></table>
8228 <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>
8229 <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>
8230 <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>
8231 <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>
8232 <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>
8233
8234 !! end
8235
8236
8237 !! test
8238 Resolving duplicate section names
8239 !! input
8240 == Foo bar ==
8241 == Foo bar ==
8242 !! result
8243 <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>
8244 <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>
8245
8246 !! end
8247
8248 !! test
8249 Resolving duplicate section names with differing case (bug 10721)
8250 !! input
8251 == Foo bar ==
8252 == Foo Bar ==
8253 !! result
8254 <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>
8255 <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>
8256
8257 !! end
8258
8259 !! article
8260 Template:sections
8261 !! text
8262 ===Section 1===
8263 ==Section 2==
8264 !! endarticle
8265
8266 !! test
8267 Template with sections, __NOTOC__
8268 !! input
8269 __NOTOC__
8270 ==Section 0==
8271 {{sections}}
8272 ==Section 4==
8273 !! result
8274 <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>
8275 <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>
8276 <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>
8277 <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>
8278
8279 !! end
8280
8281 !! test
8282 __NOEDITSECTION__ keyword
8283 !! input
8284 __NOEDITSECTION__
8285 ==Section 1==
8286 ==Section 2==
8287 !! result
8288 <h2> <span class="mw-headline" id="Section_1">Section 1</span></h2>
8289 <h2> <span class="mw-headline" id="Section_2">Section 2</span></h2>
8290
8291 !! end
8292
8293 !! test
8294 Link inside a section heading
8295 !! input
8296 ==Section with a [[Main Page|link]] in it==
8297 !! result
8298 <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>
8299
8300 !! end
8301
8302 !! test
8303 TOC regression (bug 12077)
8304 !! input
8305 __TOC__
8306 == title 1 ==
8307 === title 1.1 ===
8308 == title 2 ==
8309 !! result
8310 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8311 <ul>
8312 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8313 <ul>
8314 <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>
8315 </ul>
8316 </li>
8317 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
8318 </ul>
8319 </td></tr></table>
8320 <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>
8321 <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>
8322 <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>
8323
8324 !! end
8325
8326 !! test
8327 BUG 1219 URL next to image (good)
8328 !! input
8329 http://example.com [[Image:foobar.jpg]]
8330 !! result
8331 <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>
8332 </p>
8333 !!end
8334
8335 !! test
8336 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
8337 !! input
8338 ===
8339 The line above must have a trailing space!
8340 === <!--
8341 --> <!-- -->
8342 But just in case it doesn't...
8343 !! result
8344 <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>
8345 <p>The line above must have a trailing space!
8346 </p>
8347 <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>
8348 <p>But just in case it doesn't...
8349 </p>
8350 !! end
8351
8352 !! test
8353 Header with special characters (bug 25462)
8354 !! input
8355 The tooltips shall not show entities to the user (ie. be double escaped)
8356
8357 == text > text ==
8358 section 1
8359
8360 == text < text ==
8361 section 2
8362
8363 == text & text ==
8364 section 3
8365
8366 == text ' text ==
8367 section 4
8368
8369 == text " text ==
8370 section 5
8371 !! result
8372 <p>The tooltips shall not show entities to the user (ie. be double escaped)
8373 </p>
8374 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8375 <ul>
8376 <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>
8377 <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>
8378 <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>
8379 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
8380 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
8381 </ul>
8382 </td></tr></table>
8383 <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>
8384 <p>section 1
8385 </p>
8386 <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>
8387 <p>section 2
8388 </p>
8389 <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>
8390 <p>section 3
8391 </p>
8392 <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>
8393 <p>section 4
8394 </p>
8395 <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>
8396 <p>section 5
8397 </p>
8398 !! end
8399
8400 !! test
8401 Headers with excess '=' characters
8402 (Are similar tests necessary beyond the 1st level?)
8403 !! input
8404 =foo==
8405 ==foo=
8406 =''italic'' heading==
8407 ==''italic'' heading=
8408 !! result
8409 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8410 <ul>
8411 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
8412 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
8413 <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>
8414 <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>
8415 </ul>
8416 </td></tr></table>
8417 <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>
8418 <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>
8419 <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>
8420 <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>
8421
8422 !! end
8423
8424 !! test
8425 HTML headers vs TOC (bug 23393)
8426 (__NOEDITSECTION__ for clearer output, doesn't matter here)
8427 !! input
8428 <h1>Header 1</h1>
8429 == Header 1.1 ==
8430 == Header 1.2 ==
8431
8432 <h1>Header 2
8433 </h1>
8434 == Header 2.1 ==
8435 == Header 2.2 ==
8436 __NOEDITSECTION__
8437 !! result
8438 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8439 <ul>
8440 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
8441 <ul>
8442 <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>
8443 <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>
8444 </ul>
8445 </li>
8446 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
8447 <ul>
8448 <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>
8449 <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>
8450 </ul>
8451 </li>
8452 </ul>
8453 </td></tr></table>
8454 <h1> <span class="mw-headline" id="Header_1">Header 1</span></h1>
8455 <h2> <span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
8456 <h2> <span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
8457 <h1> <span class="mw-headline" id="Header_2">Header 2</span></h1>
8458 <h2> <span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
8459 <h2> <span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
8460
8461 !! end
8462
8463 !! test
8464 BUG 1219 URL next to image (broken)
8465 !! input
8466 http://example.com[[Image:foobar.jpg]]
8467 !! result
8468 <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>
8469 </p>
8470 !!end
8471
8472 !! test
8473 Bug 1186 news: in the middle of text
8474 !! input
8475 http://en.wikinews.org/wiki/Wikinews:Workplace
8476 !! result
8477 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
8478 </p>
8479 !!end
8480
8481
8482 !! test
8483 Namespaced link must have a title
8484 !! input
8485 [[Project:]]
8486 !! result
8487 <p>[[Project:]]
8488 </p>
8489 !!end
8490
8491 !! test
8492 Namespaced link must have a title (bad fragment version)
8493 !! input
8494 [[Project:#fragment]]
8495 !! result
8496 <p>[[Project:#fragment]]
8497 </p>
8498 !!end
8499
8500
8501 ###
8502 ### HTML tags and HTML attributes
8503 ###
8504
8505 !! test
8506 div with no attributes
8507 !! input
8508 <div>HTML rocks</div>
8509 !! result
8510 <div>HTML rocks</div>
8511
8512 !! end
8513
8514 !! test
8515 div with double-quoted attribute
8516 !! input
8517 <div id="rock">HTML rocks</div>
8518 !! result
8519 <div id="rock">HTML rocks</div>
8520
8521 !! end
8522
8523 !! test
8524 div with single-quoted attribute
8525 !! input
8526 <div id='rock'>HTML rocks</div>
8527 !! result
8528 <div id="rock">HTML rocks</div>
8529
8530 !! end
8531
8532 !! test
8533 div with unquoted attribute
8534 !! input
8535 <div id=rock>HTML rocks</div>
8536 !! result
8537 <div id="rock">HTML rocks</div>
8538
8539 !! end
8540
8541 !! test
8542 div with illegal double attributes
8543 !! input
8544 <div id="a" id="b">HTML rocks</div>
8545 !! result
8546 <div id="b">HTML rocks</div>
8547
8548 !!end
8549
8550 # FIXME: produce empty string instead of "class" in the PHP parser, following
8551 # the HTML5 spec.
8552 !! test
8553 div with empty attribute value, space before equals
8554 !! options
8555 disabled
8556 !! input
8557 <div class =>HTML rocks</div>
8558 !! result
8559 <div class="">HTML rocks</div>
8560
8561 !! end
8562
8563 # The PHP parser escapes the opening brace to &#123; for some reason, so
8564 # disabled this test for it.
8565 !! test
8566 div with braces in attribute value
8567 !! options
8568 disabled
8569 !! input
8570 <div title="{}">Foo</div>
8571 !! result
8572 <div title="{}">Foo</div>
8573 !! end
8574
8575 # This it very inconsistent in the PHP parser: it returns
8576 # class="class" if there is a space between the name and the equal sign (see
8577 # 'div with empty attribute value, space before equals'), but strips the
8578 # attribute completely if the space is missing. We hope that not much content
8579 # depends on this, so are implementing the behavior below in Parsoid for
8580 # consistencies' sake. Disabled for the PHP parser.
8581 # FIXME: fix this behavior in the PHP parser?
8582 !! test
8583 div with empty attribute value, no space before equals
8584 !! options
8585 disabled
8586 !! input
8587 <div class=>HTML rocks</div>
8588 !! result
8589 <div class="">HTML rocks</div>
8590
8591 !! end
8592
8593 !! test
8594 HTML multiple attributes correction
8595 !! input
8596 <p class="error" class="awesome">Awesome!</p>
8597 !! result
8598 <p class="awesome">Awesome!</p>
8599
8600 !!end
8601
8602 !! test
8603 Table multiple attributes correction
8604 !! input
8605 {|
8606 !+ class="error" class="awesome"| status
8607 |}
8608 !! result
8609 <table>
8610 <tr>
8611 <th class="awesome"> status
8612 </th></tr></table>
8613
8614 !!end
8615
8616 !! test
8617 DIV IN UPPERCASE
8618 !! input
8619 <DIV ID="x">HTML ROCKS</DIV>
8620 !! result
8621 <div id="x">HTML ROCKS</div>
8622
8623 !!end
8624
8625 !! test
8626 Non-ASCII pseudo-tags are rendered as text
8627 !! input
8628 <khyô>
8629 !! result
8630 <p>&lt;khyô&gt;
8631 </p>
8632 !! end
8633
8634 !! test
8635 Pseudo-tag with URL 'name' renders as url link
8636 !! input
8637 <http://example.com/>
8638 !! result
8639 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
8640 </p>
8641 !! end
8642
8643 !! test
8644 text with amp in the middle of nowhere
8645 !! input
8646 Remember AT&T?
8647 !!result
8648 <p>Remember AT&amp;T?
8649 </p>
8650 !! end
8651
8652 !! test
8653 text with character entity: eacute
8654 !! input
8655 I always thought &eacute; was a cute letter.
8656 !! result
8657 <p>I always thought &#233; was a cute letter.
8658 </p>
8659 !! end
8660
8661 !! test
8662 text with entity-escaped character entity-like string: eacute
8663 !! input
8664 I always thought &amp;eacute; was a cute letter.
8665 !! result
8666 <p>I always thought &amp;eacute; was a cute letter.
8667 </p>
8668 !! end
8669
8670 !! test
8671 text with undefined character entity: xacute
8672 !! input
8673 I always thought &xacute; was a cute letter.
8674 !! result
8675 <p>I always thought &amp;xacute; was a cute letter.
8676 </p>
8677 !! end
8678
8679
8680 ###
8681 ### Media links
8682 ###
8683
8684 !! test
8685 Media link
8686 !! input
8687 [[Media:Foobar.jpg]]
8688 !! result
8689 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
8690 </p>
8691 !! end
8692
8693 !! test
8694 Media link with text
8695 !! input
8696 [[Media:Foobar.jpg|A neat file to look at]]
8697 !! result
8698 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
8699 </p>
8700 !! end
8701
8702 # FIXME: this is still bad HTML tag nesting
8703 !! test
8704 Media link with nasty text
8705 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
8706 !! input
8707 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
8708 !! result
8709 <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>
8710
8711 !! end
8712
8713 !! test
8714 Media link to nonexistent file (bug 1702)
8715 !! input
8716 [[Media:No such.jpg]]
8717 !! result
8718 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
8719 </p>
8720 !! end
8721
8722 !! test
8723 Image link to nonexistent file (bug 1850 - good)
8724 !! input
8725 [[Image:No such.jpg]]
8726 !! result
8727 <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>
8728 </p>
8729 !! end
8730
8731 !! test
8732 :Image link to nonexistent file (bug 1850 - bad)
8733 !! input
8734 [[:Image:No such.jpg]]
8735 !! result
8736 <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>
8737 </p>
8738 !! end
8739
8740
8741
8742 !! test
8743 Character reference normalization in link text (bug 1938)
8744 !! input
8745 [[Main Page|this&that]]
8746 !! result
8747 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
8748 </p>
8749 !!end
8750
8751 !! article
8752 אַ
8753 !! text
8754 Test for unicode normalization
8755
8756 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
8757 !! endarticle
8758
8759 !! test
8760 (bug 19451) Links should refer to the normalized form.
8761 !! input
8762 [[&#xFB2E;]]
8763 [[&#x5d0;&#x5b7;]]
8764 [[&#x5d0;ַ]]
8765 [[א&#x5b7;]]
8766 [[אַ]]
8767 !! result
8768 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
8769 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
8770 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
8771 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
8772 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
8773 </p>
8774 !! end
8775
8776 !! test
8777 Empty attribute crash test (bug 2067)
8778 !! input
8779 <font color="">foo</font>
8780 !! result
8781 <p><font color="">foo</font>
8782 </p>
8783 !! end
8784
8785 !! test
8786 Empty attribute crash test single-quotes (bug 2067)
8787 !! input
8788 <font color=''>foo</font>
8789 !! result
8790 <p><font color="">foo</font>
8791 </p>
8792 !! end
8793
8794 !! test
8795 Attribute test: equals, then nothing
8796 !! input
8797 <font color=>foo</font>
8798 !! result
8799 <p><font>foo</font>
8800 </p>
8801 !! end
8802
8803 !! test
8804 Attribute test: unquoted value
8805 !! input
8806 <font color=x>foo</font>
8807 !! result
8808 <p><font color="x">foo</font>
8809 </p>
8810 !! end
8811
8812 !! test
8813 Attribute test: unquoted but illegal value (hash)
8814 !! input
8815 <font color=#x>foo</font>
8816 !! result
8817 <p><font color="#x">foo</font>
8818 </p>
8819 !! end
8820
8821 !! test
8822 Attribute test: no value
8823 !! input
8824 <font color>foo</font>
8825 !! result
8826 <p><font color="color">foo</font>
8827 </p>
8828 !! end
8829
8830 !! test
8831 Bug 2095: link with three closing brackets
8832 !! input
8833 [[Main Page]]]
8834 !! result
8835 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
8836 </p>
8837 !! end
8838
8839 !! test
8840 Bug 2095: link with pipe and three closing brackets
8841 !! input
8842 [[Main Page|link]]]
8843 !! result
8844 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
8845 </p>
8846 !! end
8847
8848 !! test
8849 Bug 2095: link with pipe and three closing brackets, version 2
8850 !! input
8851 [[Main Page|[http://example.com/]]]
8852 !! result
8853 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
8854 </p>
8855 !! end
8856
8857
8858 ###
8859 ### Safety
8860 ###
8861
8862 !! article
8863 Template:Dangerous attribute
8864 !! text
8865 " onmouseover="alert(document.cookie)
8866 !! endarticle
8867
8868 !! article
8869 Template:Dangerous style attribute
8870 !! text
8871 border-size: expression(alert(document.cookie))
8872 !! endarticle
8873
8874 !! article
8875 Template:Div style
8876 !! text
8877 <div style="float: right; {{{1}}}">Magic div</div>
8878 !! endarticle
8879
8880 !! test
8881 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
8882 !! input
8883 <div title="{{test}}"></div>
8884 !! result
8885 <div title="This is a test template"></div>
8886
8887 !! end
8888
8889 !! test
8890 Bug 2304: HTML attribute safety (dangerous template; 2309)
8891 !! input
8892 <div title="{{dangerous attribute}}"></div>
8893 !! result
8894 <div title=""></div>
8895
8896 !! end
8897
8898 !! test
8899 Bug 2304: HTML attribute safety (dangerous style template; 2309)
8900 !! input
8901 <div style="{{dangerous style attribute}}"></div>
8902 !! result
8903 <div style="/* insecure input */"></div>
8904
8905 !! end
8906
8907 !! test
8908 Bug 2304: HTML attribute safety (safe parameter; 2309)
8909 !! input
8910 {{div style|width: 200px}}
8911 !! result
8912 <div style="float: right; width: 200px">Magic div</div>
8913
8914 !! end
8915
8916 !! test
8917 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
8918 !! input
8919 {{div style|width: expression(alert(document.cookie))}}
8920 !! result
8921 <div style="/* insecure input */">Magic div</div>
8922
8923 !! end
8924
8925 !! test
8926 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
8927 !! input
8928 {{div style|"><script>alert(document.cookie)</script>}}
8929 !! result
8930 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
8931
8932 !! end
8933
8934 !! test
8935 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
8936 !! input
8937 {{div style|" ><script>alert(document.cookie)</script>}}
8938 !! result
8939 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
8940
8941 !! end
8942
8943 !! test
8944 Bug 2304: HTML attribute safety (link)
8945 !! input
8946 <div title="[[Main Page]]"></div>
8947 !! result
8948 <div title="&#91;&#91;Main Page]]"></div>
8949
8950 !! end
8951
8952 !! test
8953 Bug 2304: HTML attribute safety (italics)
8954 !! input
8955 <div title="''foobar''"></div>
8956 !! result
8957 <div title="&#39;&#39;foobar&#39;&#39;"></div>
8958
8959 !! end
8960
8961 !! test
8962 Bug 2304: HTML attribute safety (bold)
8963 !! input
8964 <div title="'''foobar'''"></div>
8965 !! result
8966 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
8967
8968 !! end
8969
8970
8971 !! test
8972 Bug 2304: HTML attribute safety (ISBN)
8973 !! input
8974 <div title="ISBN 1234567890"></div>
8975 !! result
8976 <div title="&#73;SBN 1234567890"></div>
8977
8978 !! end
8979
8980 !! test
8981 Bug 2304: HTML attribute safety (RFC)
8982 !! input
8983 <div title="RFC 1234"></div>
8984 !! result
8985 <div title="&#82;FC 1234"></div>
8986
8987 !! end
8988
8989 !! test
8990 Bug 2304: HTML attribute safety (PMID)
8991 !! input
8992 <div title="PMID 1234567890"></div>
8993 !! result
8994 <div title="&#80;MID 1234567890"></div>
8995
8996 !! end
8997
8998 !! test
8999 Bug 2304: HTML attribute safety (web link)
9000 !! input
9001 <div title="http://example.com/"></div>
9002 !! result
9003 <div title="http&#58;//example.com/"></div>
9004
9005 !! end
9006
9007 !! test
9008 Bug 2304: HTML attribute safety (named web link)
9009 !! input
9010 <div title="[http://example.com/ link]"></div>
9011 !! result
9012 <div title="&#91;http&#58;//example.com/ link]"></div>
9013
9014 !! end
9015
9016 !! test
9017 Bug 3244: HTML attribute safety (extension; safe)
9018 !! input
9019 <div style="<nowiki>background:blue</nowiki>"></div>
9020 !! result
9021 <div style="background:blue"></div>
9022
9023 !! end
9024
9025 !! test
9026 Bug 3244: HTML attribute safety (extension; unsafe)
9027 !! input
9028 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
9029 !! result
9030 <div style="/* insecure input */"></div>
9031
9032 !! end
9033
9034 # More MSIE fun discovered by Tom Gilder
9035
9036 !! test
9037 MSIE CSS safety test: spurious slash
9038 !! input
9039 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
9040 !! result
9041 <div style="/* insecure input */">evil</div>
9042
9043 !! end
9044
9045 !! test
9046 MSIE CSS safety test: hex code
9047 !! input
9048 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
9049 !! result
9050 <div style="/* insecure input */">evil</div>
9051
9052 !! end
9053
9054 !! test
9055 MSIE CSS safety test: comment in url
9056 !! input
9057 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
9058 !! result
9059 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
9060
9061 !! end
9062
9063 !! test
9064 MSIE CSS safety test: comment in expression
9065 !! input
9066 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
9067 !! result
9068 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
9069
9070 !! end
9071
9072
9073 !! test
9074 Table attribute legitimate extension
9075 !! input
9076 {|
9077 !+ style="<nowiki>color:blue</nowiki>"| status
9078 |}
9079 !! result
9080 <table>
9081 <tr>
9082 <th style="color:blue"> status
9083 </th></tr></table>
9084
9085 !!end
9086
9087 !! test
9088 Table attribute safety
9089 !! input
9090 {|
9091 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
9092 |}
9093 !! result
9094 <table>
9095 <tr>
9096 <th style="/* insecure input */"> status
9097 </th></tr></table>
9098
9099 !! end
9100
9101 !! test
9102 CSS line continuation 1
9103 !! input
9104 <div style="background-image: u\&#10;rl(test.jpg);"></div>
9105 !! result
9106 <div style="/* insecure input */"></div>
9107
9108 !! end
9109
9110 !! test
9111 CSS line continuation 2
9112 !! input
9113 <div style="background-image: u\&#13;rl(test.jpg); "></div>
9114 !! result
9115 <div style="/* insecure input */"></div>
9116
9117 !! end
9118
9119 !! article
9120 Template:Identity
9121 !! text
9122 {{{1}}}
9123 !! endarticle
9124
9125 !! test
9126 Expansion of multi-line templates in attribute values (bug 6255)
9127 !! input
9128 <div style="background: {{identity|#00FF00}}">-</div>
9129 !! result
9130 <div style="background: #00FF00">-</div>
9131
9132 !! end
9133
9134
9135 !! test
9136 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
9137 !! input
9138 <div style="background:
9139 #00FF00">-</div>
9140 !! result
9141 <div style="background: #00FF00">-</div>
9142
9143 !! end
9144
9145 !! test
9146 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
9147 !! input
9148 <div style="background: &#10;#00FF00">-</div>
9149 !! result
9150 <div style="background: &#10;#00FF00">-</div>
9151
9152 !! end
9153
9154 ###
9155 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
9156 ###
9157 !! test
9158 Parser hook: empty input
9159 !! input
9160 <tag></tag>
9161 !! result
9162 <pre>
9163 ''
9164 array (
9165 )
9166 </pre>
9167
9168 !! end
9169
9170 !! test
9171 Parser hook: empty input using terminated empty elements
9172 !! input
9173 <tag/>
9174 !! result
9175 <pre>
9176 NULL
9177 array (
9178 )
9179 </pre>
9180
9181 !! end
9182
9183 !! test
9184 Parser hook: empty input using terminated empty elements (space before)
9185 !! input
9186 <tag />
9187 !! result
9188 <pre>
9189 NULL
9190 array (
9191 )
9192 </pre>
9193
9194 !! end
9195
9196 !! test
9197 Parser hook: basic input
9198 !! input
9199 <tag>input</tag>
9200 !! result
9201 <pre>
9202 'input'
9203 array (
9204 )
9205 </pre>
9206
9207 !! end
9208
9209
9210 !! test
9211 Parser hook: case insensitive
9212 !! input
9213 <TAG>input</TAG>
9214 !! result
9215 <pre>
9216 'input'
9217 array (
9218 )
9219 </pre>
9220
9221 !! end
9222
9223
9224 !! test
9225 Parser hook: case insensitive, redux
9226 !! input
9227 <TaG>input</TAg>
9228 !! result
9229 <pre>
9230 'input'
9231 array (
9232 )
9233 </pre>
9234
9235 !! end
9236
9237 !! test
9238 Parser hook: nested tags
9239 !! options
9240 noxml
9241 !! input
9242 <tag><tag></tag></tag>
9243 !! result
9244 <pre>
9245 '<tag>'
9246 array (
9247 )
9248 </pre>&lt;/tag&gt;
9249
9250 !! end
9251
9252 !! test
9253 Parser hook: basic arguments
9254 !! input
9255 <tag width=200 height = "100" depth = '50' square></tag>
9256 !! result
9257 <pre>
9258 ''
9259 array (
9260 'width' => '200',
9261 'height' => '100',
9262 'depth' => '50',
9263 'square' => 'square',
9264 )
9265 </pre>
9266
9267 !! end
9268
9269 !! test
9270 Parser hook: argument containing a forward slash (bug 5344)
9271 !! input
9272 <tag filename='/tmp/bla'></tag>
9273 !! result
9274 <pre>
9275 ''
9276 array (
9277 'filename' => '/tmp/bla',
9278 )
9279 </pre>
9280
9281 !! end
9282
9283 !! test
9284 Parser hook: empty input using terminated empty elements (bug 2374)
9285 !! input
9286 <tag foo=bar/>text
9287 !! result
9288 <pre>
9289 NULL
9290 array (
9291 'foo' => 'bar',
9292 )
9293 </pre>text
9294
9295 !! end
9296
9297 # </tag> should be output literally since there is no matching tag that begins it
9298 !! test
9299 Parser hook: basic arguments using terminated empty elements (bug 2374)
9300 !! input
9301 <tag width=200 height = "100" depth = '50' square/>
9302 other stuff
9303 </tag>
9304 !! result
9305 <pre>
9306 NULL
9307 array (
9308 'width' => '200',
9309 'height' => '100',
9310 'depth' => '50',
9311 'square' => 'square',
9312 )
9313 </pre>
9314 <p>other stuff
9315 &lt;/tag&gt;
9316 </p>
9317 !! end
9318
9319 ###
9320 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
9321 ###
9322
9323 !! test
9324 Parser hook: static parser hook not inside a comment
9325 !! input
9326 <statictag>hello, world</statictag>
9327 <statictag action=flush/>
9328 !! result
9329 <p>hello, world
9330 </p>
9331 !! end
9332
9333
9334 !! test
9335 Parser hook: static parser hook inside a comment
9336 !! input
9337 <!-- <statictag>hello, world</statictag> -->
9338 <statictag action=flush/>
9339 !! result
9340 <p><br />
9341 </p>
9342 !! end
9343
9344 # Nested template calls; this case was broken by Parser.php rev 1.506,
9345 # since reverted.
9346
9347 !! article
9348 Template:One-parameter
9349 !! text
9350 (My parameter is: {{{1}}})
9351 !! endarticle
9352
9353 !! article
9354 Template:Map-one-parameter
9355 !! text
9356 {{{{{1}}}|{{{2}}}}}
9357 !! endarticle
9358
9359 !! test
9360 Nested template calls
9361 !! input
9362 {{Map-one-parameter|One-parameter|param}}
9363 !! result
9364 <p>(My parameter is: param)
9365 </p>
9366 !! end
9367
9368
9369 ###
9370 ### Sanitizer
9371 ###
9372 !! test
9373 Sanitizer: Closing of open tags
9374 !! input
9375 <s></s><table></table>
9376 !! result
9377 <s></s><table></table>
9378
9379 !! end
9380
9381 !! test
9382 Sanitizer: Closing of open but not closed tags
9383 !! input
9384 <s>foo
9385 !! result
9386 <p><s>foo</s>
9387 </p>
9388 !! end
9389
9390 !! test
9391 Sanitizer: Closing of closed but not open tags
9392 !! input
9393 </s>
9394 !! result
9395 <p>&lt;/s&gt;
9396 </p>
9397 !! end
9398
9399 !! test
9400 Sanitizer: Closing of closed but not open table tags
9401 !! input
9402 Table not started</td></tr></table>
9403 !! result
9404 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
9405 </p>
9406 !! end
9407
9408 !! test
9409 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
9410 !! input
9411 <span id="æ: v">byte</span>[[#æ: v|backlink]]
9412 !! result
9413 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
9414 </p>
9415 !! end
9416
9417 !! test
9418 Sanitizer: Validating the contents of the id attribute (bug 4515)
9419 !! options
9420 disabled
9421 !! input
9422 <br id=9 />
9423 !! result
9424 Something, but definitely not <br id="9" />...
9425 !! end
9426
9427 !! test
9428 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
9429 !! options
9430 disabled
9431 !! input
9432 <br id="foo" /><br id="foo" />
9433 !! result
9434 Something need to be done. foo-2 ?
9435 !! end
9436
9437 !! test
9438 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
9439 !! input
9440 <div itemscope>
9441 <meta itemprop="hello" content="world">
9442 <meta http-equiv="refresh" content="5">
9443 <meta itemprop="hello" http-equiv="refresh" content="5">
9444 <link itemprop="hello" href="{{SERVER}}">
9445 <link rel="stylesheet" href="{{SERVER}}">
9446 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
9447 </div>
9448 !! result
9449 <div itemscope="itemscope">
9450 <p> <meta itemprop="hello" content="world" />
9451 &lt;meta http-equiv="refresh" content="5"&gt;
9452 <meta itemprop="hello" content="5" />
9453 </p>
9454 <link itemprop="hello" href="http&#58;//example.org" />
9455 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
9456 <link itemprop="hello" href="http&#58;//example.org" />
9457 </div>
9458
9459 !! end
9460
9461 !! test
9462 Language converter: output gets cut off unexpectedly (bug 5757)
9463 !! options
9464 language=zh
9465 !! input
9466 this bit is safe: }-
9467
9468 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
9469
9470 then we get cut off here: }-
9471
9472 all additional text is vanished
9473 !! result
9474 <p>this bit is safe: }-
9475 </p><p>but if we add a conversion instance: xxx
9476 </p><p>then we get cut off here: }-
9477 </p><p>all additional text is vanished
9478 </p>
9479 !! end
9480
9481 !! test
9482 Self closed html pairs (bug 5487)
9483 !! options
9484 !! input
9485 <center><font id="bug" />Centered text</center>
9486 <div><font id="bug2" />In div text</div>
9487 !! result
9488 <center>&lt;font id="bug" /&gt;Centered text</center>
9489 <div>&lt;font id="bug2" /&gt;In div text</div>
9490
9491 !! end
9492
9493 #
9494 #
9495 #
9496
9497 !! test
9498 Punctuation: nbsp before exclamation
9499 !! input
9500 C'est grave !
9501 !! result
9502 <p>C'est grave&#160;!
9503 </p>
9504 !! end
9505
9506 !! test
9507 Punctuation: CSS !important (bug 11874)
9508 !! input
9509 <div style="width:50% !important">important</div>
9510 !! result
9511 <div style="width:50% !important">important</div>
9512
9513 !!end
9514
9515 !! test
9516 Punctuation: CSS ! important (bug 11874; with space after)
9517 !! input
9518 <div style="width:50% ! important">important</div>
9519 !! result
9520 <div style="width:50% ! important">important</div>
9521
9522 !!end
9523
9524
9525 !! test
9526 HTML bullet list, closed tags (bug 5497)
9527 !! input
9528 <ul>
9529 <li>One</li>
9530 <li>Two</li>
9531 </ul>
9532 !! result
9533 <ul>
9534 <li>One</li>
9535 <li>Two</li>
9536 </ul>
9537
9538 !! end
9539
9540 !! test
9541 HTML bullet list, unclosed tags (bug 5497)
9542 !! options
9543 disabled
9544 !! input
9545 <ul>
9546 <li>One
9547 <li>Two
9548 </ul>
9549 !! result
9550 <ul>
9551 <li>One
9552 </li><li>Two
9553 </li></ul>
9554
9555 !! end
9556
9557 !! test
9558 HTML ordered list, closed tags (bug 5497)
9559 !! input
9560 <ol>
9561 <li>One</li>
9562 <li>Two</li>
9563 </ol>
9564 !! result
9565 <ol>
9566 <li>One</li>
9567 <li>Two</li>
9568 </ol>
9569
9570 !! end
9571
9572 !! test
9573 HTML ordered list, unclosed tags (bug 5497)
9574 !! options
9575 disabled
9576 !! input
9577 <ol>
9578 <li>One
9579 <li>Two
9580 </ol>
9581 !! result
9582 <ol>
9583 <li>One
9584 </li><li>Two
9585 </li></ol>
9586
9587 !! end
9588
9589 !! test
9590 HTML nested bullet list, closed tags (bug 5497)
9591 !! input
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 !! result
9602 <ul>
9603 <li>One</li>
9604 <li>Two:
9605 <ul>
9606 <li>Sub-one</li>
9607 <li>Sub-two</li>
9608 </ul>
9609 </li>
9610 </ul>
9611
9612 !! end
9613
9614 !! test
9615 HTML nested bullet list, open tags (bug 5497)
9616 !! options
9617 disabled
9618 !! input
9619 <ul>
9620 <li>One
9621 <li>Two:
9622 <ul>
9623 <li>Sub-one
9624 <li>Sub-two
9625 </ul>
9626 </ul>
9627 !! result
9628 <ul>
9629 <li>One
9630 </li><li>Two:
9631 <ul>
9632 <li>Sub-one
9633 </li><li>Sub-two
9634 </li></ul>
9635 </li></ul>
9636
9637 !! end
9638
9639 !! test
9640 HTML nested ordered list, closed tags (bug 5497)
9641 !! input
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 !! result
9652 <ol>
9653 <li>One</li>
9654 <li>Two:
9655 <ol>
9656 <li>Sub-one</li>
9657 <li>Sub-two</li>
9658 </ol>
9659 </li>
9660 </ol>
9661
9662 !! end
9663
9664 !! test
9665 HTML nested ordered list, open tags (bug 5497)
9666 !! options
9667 disabled
9668 !! input
9669 <ol>
9670 <li>One
9671 <li>Two:
9672 <ol>
9673 <li>Sub-one
9674 <li>Sub-two
9675 </ol>
9676 </ol>
9677 !! result
9678 <ol>
9679 <li>One
9680 </li><li>Two:
9681 <ol>
9682 <li>Sub-one
9683 </li><li>Sub-two
9684 </li></ol>
9685 </li></ol>
9686
9687 !! end
9688
9689 !! test
9690 HTML ordered list item with parameters oddity
9691 !! input
9692 <ol><li id="fragment">One</li></ol>
9693 !! result
9694 <ol><li id="fragment">One</li></ol>
9695
9696 !! end
9697
9698 !!test
9699 bug 5918: autonumbering
9700 !! input
9701 [http://first/] [http://second] [ftp://ftp]
9702
9703 ftp://inlineftp
9704
9705 [mailto:enclosed@mail.tld With target]
9706
9707 [mailto:enclosed@mail.tld]
9708
9709 mailto:inline@mail.tld
9710 !! result
9711 <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>
9712 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
9713 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
9714 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
9715 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
9716 </p>
9717 !! end
9718
9719
9720 #
9721 # Security and HTML correctness
9722 # From Nick Jenkins' fuzz testing
9723 #
9724
9725 !! test
9726 Fuzz testing: Parser13
9727 !! input
9728 {|
9729 | http://a|
9730 !! result
9731 <table>
9732 <tr>
9733 <td>
9734 </td>
9735 </tr>
9736 </table>
9737
9738 !! end
9739
9740 !! test
9741 Fuzz testing: Parser14
9742 !! input
9743 == onmouseover= ==
9744 http://__TOC__
9745 !! result
9746 <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>
9747 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9748 <ul>
9749 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
9750 </ul>
9751 </td></tr></table>
9752
9753 !! end
9754
9755 !! test
9756 Fuzz testing: Parser14-table
9757 !! input
9758 ==a==
9759 {| STYLE=__TOC__
9760 !! result
9761 <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>
9762 <table style="&#95;_TOC&#95;_">
9763 <tr><td></td></tr>
9764 </table>
9765
9766 !! end
9767
9768 # Known to produce bogus xml (extra </td>)
9769 !! test
9770 Fuzz testing: Parser16
9771 !! options
9772 noxml
9773 !! input
9774 {|
9775 !https://||||||
9776 !! result
9777 <table>
9778 <tr>
9779 <th>https://</th>
9780 <th></th>
9781 <th></th>
9782 <th>
9783 </td>
9784 </tr>
9785 </table>
9786
9787 !! end
9788
9789 !! test
9790 Fuzz testing: Parser21
9791 !! input
9792 {|
9793 ! irc://{{ftp://a" onmouseover="alert('hello world');"
9794 |
9795 !! result
9796 <table>
9797 <tr>
9798 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
9799 </th>
9800 <td>
9801 </td>
9802 </tr>
9803 </table>
9804
9805 !! end
9806
9807 !! test
9808 Fuzz testing: Parser22
9809 !! input
9810 http://===r:::https://b
9811
9812 {|
9813 !!result
9814 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
9815 </p>
9816 <table>
9817 <tr><td></td></tr>
9818 </table>
9819
9820 !! end
9821
9822 # Known to produce bad XML for now
9823 !! test
9824 Fuzz testing: Parser24
9825 !! options
9826 noxml
9827 !! input
9828 {|
9829 {{{|
9830 <u CLASS=
9831 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
9832 <br style="onmouseover='alert(document.cookie);' " />
9833
9834 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9835 |
9836 !! result
9837 <table>
9838 {{{|
9839 <u class="&#124;">}}}} &gt;
9840 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
9841
9842 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9843 <tr>
9844 <td></u>
9845 </td>
9846 </tr>
9847 </table>
9848
9849 !! end
9850
9851 # Note: the current result listed for this is not what the original one was,
9852 # but the original bug was JavaScript injection, which is fixed in any case.
9853 # It's not clear that the original result listed was any more correct than the
9854 # current one. Original result:
9855 # <p>{{{|
9856 # </p>
9857 # <li class="&#124;&#124;">
9858 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9859 !!test
9860 Fuzz testing: Parser25 (bug 6055)
9861 !! input
9862 {{{
9863 |
9864 <LI CLASS=||
9865 >
9866 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
9867 !! result
9868 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9869 </p>
9870 !! end
9871
9872 !!test
9873 Fuzz testing: URL adjacent extension (with space, clean)
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; nowiki)
9884 !! options
9885 !! input
9886 http://example.com<nowiki>junk</nowiki>
9887 !! result
9888 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
9889 </p>
9890 !!end
9891
9892 !!test
9893 Fuzz testing: URL adjacent extension (no space, dirty; pre)
9894 !! options
9895 !! input
9896 http://example.com<pre>junk</pre>
9897 !! result
9898 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
9899
9900 !!end
9901
9902 !!test
9903 Fuzz testing: image with bogus manual thumbnail
9904 !!input
9905 [[Image:foobar.jpg|thumbnail= ]]
9906 !!result
9907 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
9908
9909 !!end
9910
9911 !! test
9912 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
9913 !! input
9914 <pre dir="&#10;"></pre>
9915 !! result
9916 <pre dir="&#10;"></pre>
9917
9918 !! end
9919
9920 !! test
9921 Parsing optional HTML elements (Bug 6171)
9922 !! options
9923 !! input
9924 <table>
9925 <tr>
9926 <td> Some tabular data</td>
9927 <td> More tabular data ...
9928 <td> And yet som tabular data</td>
9929 </tr>
9930 </table>
9931 !! result
9932 <table>
9933 <tr>
9934 <td> Some tabular data</td>
9935 <td> More tabular data ...
9936 </td><td> And yet som tabular data</td>
9937 </tr>
9938 </table>
9939
9940 !! end
9941
9942 !! test
9943 Correct handling of <td>, <tr> (Bug 6171)
9944 !! options
9945 !! input
9946 <table>
9947 <tr>
9948 <td> Some tabular data</td>
9949 <td> More tabular data ...</td>
9950 <td> And yet som tabular data</td>
9951 </tr>
9952 </table>
9953 !! result
9954 <table>
9955 <tr>
9956 <td> Some tabular data</td>
9957 <td> More tabular data ...</td>
9958 <td> And yet som tabular data</td>
9959 </tr>
9960 </table>
9961
9962 !! end
9963
9964
9965 !! test
9966 Parsing crashing regression (fr:JavaScript)
9967 !! input
9968 </body></x>
9969 !! result
9970 <p>&lt;/body&gt;&lt;/x&gt;
9971 </p>
9972 !! end
9973
9974 !! test
9975 Inline wiki vs wiki block nesting
9976 !! input
9977 '''Bold paragraph
9978
9979 New wiki paragraph
9980 !! result
9981 <p><b>Bold paragraph</b>
9982 </p><p>New wiki paragraph
9983 </p>
9984 !! end
9985
9986 !! test
9987 Inline HTML vs wiki block nesting
9988 !! options
9989 disabled
9990 !! input
9991 <b>Bold paragraph
9992
9993 New wiki paragraph
9994 !! result
9995 <p><b>Bold paragraph</b>
9996 </p><p>New wiki paragraph
9997 </p>
9998 !! end
9999
10000 # Original result was this:
10001 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
10002 # </p>
10003 # While that might be marginally more intuitive, maybe, the six-apostrophe
10004 # construct is clearly pathological and the result stated here (which is what
10005 # the parser actually does) is about as reasonable as anything.
10006 !!test
10007 Mixing markup for italics and bold
10008 !! options
10009 !! input
10010 '''bold''''''bold''bolditalics'''''
10011 !! result
10012 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
10013 </p>
10014 !! end
10015
10016
10017 !! article
10018 Xyzzyx
10019 !! text
10020 Article for special page transclusion test
10021 !! endarticle
10022
10023 !! test
10024 Special page transclusion
10025 !! options
10026 !! input
10027 {{Special:Prefixindex/Xyzzyx}}
10028 !! result
10029 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10030
10031 !! end
10032
10033 !! test
10034 Special page transclusion twice (bug 5021)
10035 !! options
10036 !! input
10037 {{Special:Prefixindex/Xyzzyx}}
10038 {{Special:Prefixindex/Xyzzyx}}
10039 !! result
10040 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10041 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10042
10043 !! end
10044
10045 !! test
10046 Transclusion of default MediaWiki message
10047 !! input
10048 {{MediaWiki:Mainpage}}
10049 !!result
10050 <p>Main Page
10051 </p>
10052 !! end
10053
10054 !! test
10055 Transclusion of nonexistent MediaWiki message
10056 !! input
10057 {{MediaWiki:Mainpagexxx}}
10058 !!result
10059 <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>
10060 </p>
10061 !! end
10062
10063 !! test
10064 Transclusion of MediaWiki message with underscore
10065 !! input
10066 {{MediaWiki:history_short}}
10067 !! result
10068 <p>History
10069 </p>
10070 !! end
10071
10072 !! test
10073 Transclusion of MediaWiki message with space
10074 !! input
10075 {{MediaWiki:history short}}
10076 !! result
10077 <p>History
10078 </p>
10079 !! end
10080
10081 !! test
10082 Invalid header with following text
10083 !! input
10084 = x = y
10085 !! result
10086 <p>= x = y
10087 </p>
10088 !! end
10089
10090
10091 !! test
10092 Section extraction test (section 0)
10093 !! options
10094 section=0
10095 !! input
10096 start
10097 ==a==
10098 ===aa===
10099 ====aaa====
10100 ==b==
10101 ===ba===
10102 ===bb===
10103 ====bba====
10104 ===bc===
10105 ==c==
10106 ===ca===
10107 !! result
10108 start
10109 !! end
10110
10111 !! test
10112 Section extraction test (section 1)
10113 !! options
10114 section=1
10115 !! input
10116 start
10117 ==a==
10118 ===aa===
10119 ====aaa====
10120 ==b==
10121 ===ba===
10122 ===bb===
10123 ====bba====
10124 ===bc===
10125 ==c==
10126 ===ca===
10127 !! result
10128 ==a==
10129 ===aa===
10130 ====aaa====
10131 !! end
10132
10133 !! test
10134 Section extraction test (section 2)
10135 !! options
10136 section=2
10137 !! input
10138 start
10139 ==a==
10140 ===aa===
10141 ====aaa====
10142 ==b==
10143 ===ba===
10144 ===bb===
10145 ====bba====
10146 ===bc===
10147 ==c==
10148 ===ca===
10149 !! result
10150 ===aa===
10151 ====aaa====
10152 !! end
10153
10154 !! test
10155 Section extraction test (section 3)
10156 !! options
10157 section=3
10158 !! input
10159 start
10160 ==a==
10161 ===aa===
10162 ====aaa====
10163 ==b==
10164 ===ba===
10165 ===bb===
10166 ====bba====
10167 ===bc===
10168 ==c==
10169 ===ca===
10170 !! result
10171 ====aaa====
10172 !! end
10173
10174 !! test
10175 Section extraction test (section 4)
10176 !! options
10177 section=4
10178 !! input
10179 start
10180 ==a==
10181 ===aa===
10182 ====aaa====
10183 ==b==
10184 ===ba===
10185 ===bb===
10186 ====bba====
10187 ===bc===
10188 ==c==
10189 ===ca===
10190 !! result
10191 ==b==
10192 ===ba===
10193 ===bb===
10194 ====bba====
10195 ===bc===
10196 !! end
10197
10198 !! test
10199 Section extraction test (section 5)
10200 !! options
10201 section=5
10202 !! input
10203 start
10204 ==a==
10205 ===aa===
10206 ====aaa====
10207 ==b==
10208 ===ba===
10209 ===bb===
10210 ====bba====
10211 ===bc===
10212 ==c==
10213 ===ca===
10214 !! result
10215 ===ba===
10216 !! end
10217
10218 !! test
10219 Section extraction test (section 6)
10220 !! options
10221 section=6
10222 !! input
10223 start
10224 ==a==
10225 ===aa===
10226 ====aaa====
10227 ==b==
10228 ===ba===
10229 ===bb===
10230 ====bba====
10231 ===bc===
10232 ==c==
10233 ===ca===
10234 !! result
10235 ===bb===
10236 ====bba====
10237 !! end
10238
10239 !! test
10240 Section extraction test (section 7)
10241 !! options
10242 section=7
10243 !! input
10244 start
10245 ==a==
10246 ===aa===
10247 ====aaa====
10248 ==b==
10249 ===ba===
10250 ===bb===
10251 ====bba====
10252 ===bc===
10253 ==c==
10254 ===ca===
10255 !! result
10256 ====bba====
10257 !! end
10258
10259 !! test
10260 Section extraction test (section 8)
10261 !! options
10262 section=8
10263 !! input
10264 start
10265 ==a==
10266 ===aa===
10267 ====aaa====
10268 ==b==
10269 ===ba===
10270 ===bb===
10271 ====bba====
10272 ===bc===
10273 ==c==
10274 ===ca===
10275 !! result
10276 ===bc===
10277 !! end
10278
10279 !! test
10280 Section extraction test (section 9)
10281 !! options
10282 section=9
10283 !! input
10284 start
10285 ==a==
10286 ===aa===
10287 ====aaa====
10288 ==b==
10289 ===ba===
10290 ===bb===
10291 ====bba====
10292 ===bc===
10293 ==c==
10294 ===ca===
10295 !! result
10296 ==c==
10297 ===ca===
10298 !! end
10299
10300 !! test
10301 Section extraction test (section 10)
10302 !! options
10303 section=10
10304 !! input
10305 start
10306 ==a==
10307 ===aa===
10308 ====aaa====
10309 ==b==
10310 ===ba===
10311 ===bb===
10312 ====bba====
10313 ===bc===
10314 ==c==
10315 ===ca===
10316 !! result
10317 ===ca===
10318 !! end
10319
10320 !! test
10321 Section extraction test (nonexistent section 11)
10322 !! options
10323 section=11
10324 !! input
10325 start
10326 ==a==
10327 ===aa===
10328 ====aaa====
10329 ==b==
10330 ===ba===
10331 ===bb===
10332 ====bba====
10333 ===bc===
10334 ==c==
10335 ===ca===
10336 !! result
10337 !! end
10338
10339 !! test
10340 Section extraction test with bogus heading (section 1)
10341 !! options
10342 section=1
10343 !! input
10344 ==a==
10345 ==bogus== not a legal section
10346 ==b==
10347 !! result
10348 ==a==
10349 ==bogus== not a legal section
10350 !! end
10351
10352 !! test
10353 Section extraction test with bogus heading (section 2)
10354 !! options
10355 section=2
10356 !! input
10357 ==a==
10358 ==bogus== not a legal section
10359 ==b==
10360 !! result
10361 ==b==
10362 !! end
10363
10364 !! test
10365 Section extraction test with comment after heading (section 1)
10366 !! options
10367 section=1
10368 !! input
10369 ==a==
10370 ==b== <!-- -->
10371 ==c==
10372 !! result
10373 ==a==
10374 !! end
10375
10376 !! test
10377 Section extraction test with comment after heading (section 2)
10378 !! options
10379 section=2
10380 !! input
10381 ==a==
10382 ==b== <!-- -->
10383 ==c==
10384 !! result
10385 ==b== <!-- -->
10386 !! end
10387
10388 !! test
10389 Section extraction test with bogus <nowiki> heading (section 1)
10390 !! options
10391 section=1
10392 !! input
10393 ==a==
10394 ==bogus== <nowiki>not a legal section</nowiki>
10395 ==b==
10396 !! result
10397 ==a==
10398 ==bogus== <nowiki>not a legal section</nowiki>
10399 !! end
10400
10401 !! test
10402 Section extraction test with bogus <nowiki> heading (section 2)
10403 !! options
10404 section=2
10405 !! input
10406 ==a==
10407 ==bogus== <nowiki>not a legal section</nowiki>
10408 ==b==
10409 !! result
10410 ==b==
10411 !! end
10412
10413
10414 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
10415 # instead of respecting commented sections
10416 !! test
10417 Section extraction prefixed by comment (section 1)
10418 !! options
10419 section=1
10420 !! input
10421 <!-- -->==sec1==
10422 ==sec2==
10423 !!result
10424 ==sec2==
10425 !!end
10426
10427 !! test
10428 Section extraction prefixed by comment (section 2)
10429 !! options
10430 section=2
10431 !! input
10432 <!-- -->==sec1==
10433 ==sec2==
10434 !!result
10435
10436 !!end
10437
10438
10439 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
10440 # instead of respecting HTML-style headings
10441 !! test
10442 Section extraction, mixed wiki and html (section 1)
10443 !! options
10444 section=1
10445 !! input
10446 <h2>unmarked</h2>
10447 unmarked
10448 ==1==
10449 one
10450 ==2==
10451 two
10452 !! result
10453 ==1==
10454 one
10455 !! end
10456
10457 !! test
10458 Section extraction, mixed wiki and html (section 2)
10459 !! options
10460 section=2
10461 !! input
10462 <h2>unmarked</h2>
10463 unmarked
10464 ==1==
10465 one
10466 ==2==
10467 two
10468 !! result
10469 ==2==
10470 two
10471 !! end
10472
10473
10474 # Formerly testing for bug 3342
10475 !! test
10476 Section extraction, heading surrounded by <noinclude>
10477 !! options
10478 section=1
10479 !! input
10480 <noinclude>==unmarked==</noinclude>
10481 ==marked==
10482 !! result
10483 ==marked==
10484 !!end
10485
10486 # Test behavior of bug 19910
10487 !! test
10488 Sectiion with all-equals
10489 !! options
10490 section=2
10491 !! input
10492 ===
10493 The line above must have a trailing space
10494 === <!--
10495 --> <!-- -->
10496 But just in case it doesn't...
10497 !! result
10498 === <!--
10499 --> <!-- -->
10500 But just in case it doesn't...
10501 !! end
10502
10503 !! test
10504 Section replacement test (section 0)
10505 !! options
10506 replace=0,"xxx"
10507 !! input
10508 start
10509 ==a==
10510 ===aa===
10511 ====aaa====
10512 ==b==
10513 ===ba===
10514 ===bb===
10515 ====bba====
10516 ===bc===
10517 ==c==
10518 ===ca===
10519 !! result
10520 xxx
10521
10522 ==a==
10523 ===aa===
10524 ====aaa====
10525 ==b==
10526 ===ba===
10527 ===bb===
10528 ====bba====
10529 ===bc===
10530 ==c==
10531 ===ca===
10532 !! end
10533
10534 !! test
10535 Section replacement test (section 1)
10536 !! options
10537 replace=1,"xxx"
10538 !! input
10539 start
10540 ==a==
10541 ===aa===
10542 ====aaa====
10543 ==b==
10544 ===ba===
10545 ===bb===
10546 ====bba====
10547 ===bc===
10548 ==c==
10549 ===ca===
10550 !! result
10551 start
10552 xxx
10553
10554 ==b==
10555 ===ba===
10556 ===bb===
10557 ====bba====
10558 ===bc===
10559 ==c==
10560 ===ca===
10561 !! end
10562
10563 !! test
10564 Section replacement test (section 2)
10565 !! options
10566 replace=2,"xxx"
10567 !! input
10568 start
10569 ==a==
10570 ===aa===
10571 ====aaa====
10572 ==b==
10573 ===ba===
10574 ===bb===
10575 ====bba====
10576 ===bc===
10577 ==c==
10578 ===ca===
10579 !! result
10580 start
10581 ==a==
10582 xxx
10583
10584 ==b==
10585 ===ba===
10586 ===bb===
10587 ====bba====
10588 ===bc===
10589 ==c==
10590 ===ca===
10591 !! end
10592
10593 !! test
10594 Section replacement test (section 3)
10595 !! options
10596 replace=3,"xxx"
10597 !! input
10598 start
10599 ==a==
10600 ===aa===
10601 ====aaa====
10602 ==b==
10603 ===ba===
10604 ===bb===
10605 ====bba====
10606 ===bc===
10607 ==c==
10608 ===ca===
10609 !! result
10610 start
10611 ==a==
10612 ===aa===
10613 xxx
10614
10615 ==b==
10616 ===ba===
10617 ===bb===
10618 ====bba====
10619 ===bc===
10620 ==c==
10621 ===ca===
10622 !! end
10623
10624 !! test
10625 Section replacement test (section 4)
10626 !! options
10627 replace=4,"xxx"
10628 !! input
10629 start
10630 ==a==
10631 ===aa===
10632 ====aaa====
10633 ==b==
10634 ===ba===
10635 ===bb===
10636 ====bba====
10637 ===bc===
10638 ==c==
10639 ===ca===
10640 !! result
10641 start
10642 ==a==
10643 ===aa===
10644 ====aaa====
10645 xxx
10646
10647 ==c==
10648 ===ca===
10649 !! end
10650
10651 !! test
10652 Section replacement test (section 5)
10653 !! options
10654 replace=5,"xxx"
10655 !! input
10656 start
10657 ==a==
10658 ===aa===
10659 ====aaa====
10660 ==b==
10661 ===ba===
10662 ===bb===
10663 ====bba====
10664 ===bc===
10665 ==c==
10666 ===ca===
10667 !! result
10668 start
10669 ==a==
10670 ===aa===
10671 ====aaa====
10672 ==b==
10673 xxx
10674
10675 ===bb===
10676 ====bba====
10677 ===bc===
10678 ==c==
10679 ===ca===
10680 !! end
10681
10682 !! test
10683 Section replacement test (section 6)
10684 !! options
10685 replace=6,"xxx"
10686 !! input
10687 start
10688 ==a==
10689 ===aa===
10690 ====aaa====
10691 ==b==
10692 ===ba===
10693 ===bb===
10694 ====bba====
10695 ===bc===
10696 ==c==
10697 ===ca===
10698 !! result
10699 start
10700 ==a==
10701 ===aa===
10702 ====aaa====
10703 ==b==
10704 ===ba===
10705 xxx
10706
10707 ===bc===
10708 ==c==
10709 ===ca===
10710 !! end
10711
10712 !! test
10713 Section replacement test (section 7)
10714 !! options
10715 replace=7,"xxx"
10716 !! input
10717 start
10718 ==a==
10719 ===aa===
10720 ====aaa====
10721 ==b==
10722 ===ba===
10723 ===bb===
10724 ====bba====
10725 ===bc===
10726 ==c==
10727 ===ca===
10728 !! result
10729 start
10730 ==a==
10731 ===aa===
10732 ====aaa====
10733 ==b==
10734 ===ba===
10735 ===bb===
10736 xxx
10737
10738 ===bc===
10739 ==c==
10740 ===ca===
10741 !! end
10742
10743 !! test
10744 Section replacement test (section 8)
10745 !! options
10746 replace=8,"xxx"
10747 !! input
10748 start
10749 ==a==
10750 ===aa===
10751 ====aaa====
10752 ==b==
10753 ===ba===
10754 ===bb===
10755 ====bba====
10756 ===bc===
10757 ==c==
10758 ===ca===
10759 !! result
10760 start
10761 ==a==
10762 ===aa===
10763 ====aaa====
10764 ==b==
10765 ===ba===
10766 ===bb===
10767 ====bba====
10768 xxx
10769
10770 ==c==
10771 ===ca===
10772 !!end
10773
10774 !! test
10775 Section replacement test (section 9)
10776 !! options
10777 replace=9,"xxx"
10778 !! input
10779 start
10780 ==a==
10781 ===aa===
10782 ====aaa====
10783 ==b==
10784 ===ba===
10785 ===bb===
10786 ====bba====
10787 ===bc===
10788 ==c==
10789 ===ca===
10790 !! result
10791 start
10792 ==a==
10793 ===aa===
10794 ====aaa====
10795 ==b==
10796 ===ba===
10797 ===bb===
10798 ====bba====
10799 ===bc===
10800 xxx
10801 !! end
10802
10803 !! test
10804 Section replacement test (section 10)
10805 !! options
10806 replace=10,"xxx"
10807 !! input
10808 start
10809 ==a==
10810 ===aa===
10811 ====aaa====
10812 ==b==
10813 ===ba===
10814 ===bb===
10815 ====bba====
10816 ===bc===
10817 ==c==
10818 ===ca===
10819 !! result
10820 start
10821 ==a==
10822 ===aa===
10823 ====aaa====
10824 ==b==
10825 ===ba===
10826 ===bb===
10827 ====bba====
10828 ===bc===
10829 ==c==
10830 xxx
10831 !! end
10832
10833 !! test
10834 Section replacement test with initial whitespace (bug 13728)
10835 !! options
10836 replace=2,"xxx"
10837 !! input
10838 Preformatted initial line
10839 ==a==
10840 ===a===
10841 !! result
10842 Preformatted initial line
10843 ==a==
10844 xxx
10845 !! end
10846
10847
10848 !! test
10849 Section extraction, heading followed by pre with 20 spaces (bug 6398)
10850 !! options
10851 section=1
10852 !! input
10853 ==a==
10854 a
10855 !! result
10856 ==a==
10857 a
10858 !! end
10859
10860 !! test
10861 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
10862 !! options
10863 section=1
10864 !! input
10865 ==a==
10866 a
10867 !! result
10868 ==a==
10869 a
10870 !! end
10871
10872
10873 !! test
10874 Section extraction, <pre> around bogus header (bug 10309)
10875 !! options
10876 noxml section=2
10877 !! input
10878 == Section One ==
10879 <pre>
10880 =======
10881 </pre>
10882
10883 == Section Two ==
10884 stuff
10885 !! result
10886 == Section Two ==
10887 stuff
10888 !! end
10889
10890 !! test
10891 Section replacement, <pre> around bogus header (bug 10309)
10892 !! options
10893 noxml replace=2,"xxx"
10894 !! input
10895 == Section One ==
10896 <pre>
10897 =======
10898 </pre>
10899
10900 == Section Two ==
10901 stuff
10902 !! result
10903 == Section One ==
10904 <pre>
10905 =======
10906 </pre>
10907
10908 xxx
10909 !! end
10910
10911
10912
10913 !! test
10914 Handling of &#x0A; in URLs
10915 !! input
10916 **irc://&#x0A;a
10917 !! result
10918 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
10919 </li></ul>
10920 </li></ul>
10921
10922 !!end
10923
10924 !! test
10925 5 quotes, code coverage +1 line (php)
10926 !! options
10927 php
10928 !! input
10929 '''''
10930 !! result
10931 !! end
10932 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
10933 !! test
10934 5 quotes, code coverage +1 line (parsoid)
10935 !! options
10936 parsoid
10937 !! input
10938 '''''
10939 !! result
10940 <p><i><b></b></i></p>
10941 !! end
10942
10943 !! test
10944 Special:Search page linking.
10945 !! input
10946 {{Special:search}}
10947 !! result
10948 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
10949 </p>
10950 !! end
10951
10952 !! test
10953 Say the magic word
10954 !! input
10955 * {{PAGENAME}}
10956 * {{BASEPAGENAME}}
10957 * {{SUBPAGENAME}}
10958 * {{SUBPAGENAMEE}}
10959 * {{BASEPAGENAME}}
10960 * {{BASEPAGENAMEE}}
10961 * {{TALKPAGENAME}}
10962 * {{TALKPAGENAMEE}}
10963 * {{SUBJECTPAGENAME}}
10964 * {{SUBJECTPAGENAMEE}}
10965 * {{NAMESPACEE}}
10966 * {{NAMESPACE}}
10967 * {{TALKSPACE}}
10968 * {{TALKSPACEE}}
10969 * {{SUBJECTSPACE}}
10970 * {{SUBJECTSPACEE}}
10971 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
10972 !! result
10973 <ul><li> Parser test
10974 </li><li> Parser test
10975 </li><li> Parser test
10976 </li><li> Parser_test
10977 </li><li> Parser test
10978 </li><li> Parser_test
10979 </li><li> Talk:Parser test
10980 </li><li> Talk:Parser_test
10981 </li><li> Parser test
10982 </li><li> Parser_test
10983 </li><li>
10984 </li><li>
10985 </li><li> Talk
10986 </li><li> Talk
10987 </li><li>
10988 </li><li>
10989 </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>
10990 </li></ul>
10991
10992 !! end
10993 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
10994
10995 !! test
10996 Gallery
10997 !! input
10998 <gallery>
10999 image1.png |
11000 image2.gif|||||
11001
11002 image3|
11003 image4 |300px| centre
11004 image5.svg| http://///////
11005 [[x|xx]]]]
11006 * image6
11007 </gallery>
11008 !! result
11009 <ul class="gallery">
11010 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11011 <div style="height: 150px;">Image1.png</div>
11012 <div class="gallerytext">
11013 </div>
11014 </div></li>
11015 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11016 <div style="height: 150px;">Image2.gif</div>
11017 <div class="gallerytext">
11018 <p>||||
11019 </p>
11020 </div>
11021 </div></li>
11022 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11023 <div style="height: 150px;">Image3</div>
11024 <div class="gallerytext">
11025 </div>
11026 </div></li>
11027 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11028 <div style="height: 150px;">Image4</div>
11029 <div class="gallerytext">
11030 <p>300px| centre
11031 </p>
11032 </div>
11033 </div></li>
11034 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11035 <div style="height: 150px;">Image5.svg</div>
11036 <div class="gallerytext">
11037 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
11038 </p>
11039 </div>
11040 </div></li>
11041 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11042 <div style="height: 150px;">* image6</div>
11043 <div class="gallerytext">
11044 </div>
11045 </div></li>
11046 </ul>
11047
11048 !! end
11049
11050 !! test
11051 Gallery (with options)
11052 !! input
11053 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
11054 File:Nonexistant.jpg|caption
11055 File:Nonexistant.jpg
11056 image:foobar.jpg|some '''caption''' [[Main Page]]
11057 image:foobar.jpg
11058 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
11059 </gallery>
11060 !! result
11061 <ul class="gallery" style="max-width: 226px;_width: 226px;">
11062 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
11063 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11064 <div style="height: 70px;">Nonexistant.jpg</div>
11065 <div class="gallerytext">
11066 <p>caption
11067 </p>
11068 </div>
11069 </div></li>
11070 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11071 <div style="height: 70px;">Nonexistant.jpg</div>
11072 <div class="gallerytext">
11073 </div>
11074 </div></li>
11075 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11076 <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>
11077 <div class="gallerytext">
11078 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11079 </p>
11080 </div>
11081 </div></li>
11082 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11083 <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>
11084 <div class="gallerytext">
11085 </div>
11086 </div></li>
11087 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11088 <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>
11089 <div class="gallerytext">
11090 <p>Blabla|blabla.
11091 </p>
11092 </div>
11093 </div></li>
11094 </ul>
11095
11096 !! end
11097
11098 !! test
11099 Gallery with wikitext inside caption
11100 !! input
11101 <gallery>
11102 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
11103 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
11104 </gallery>
11105 !! result
11106 <ul class="gallery">
11107 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11108 <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>
11109 <div class="gallerytext">
11110 <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>
11111 </p>
11112 </div>
11113 </div></li>
11114 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11115 <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>
11116 <div class="gallerytext">
11117 <p>This is a test template
11118 </p>
11119 </div>
11120 </div></li>
11121 </ul>
11122
11123 !! end
11124
11125 !! test
11126 gallery (with showfilename option)
11127 !! input
11128 <gallery showfilename>
11129 File:Nonexistant.jpg|caption
11130 File:Nonexistant.jpg
11131 image:foobar.jpg|some '''caption''' [[Main Page]]
11132 File:Foobar.jpg
11133 </gallery>
11134 !! result
11135 <ul class="gallery">
11136 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11137 <div style="height: 150px;">Nonexistant.jpg</div>
11138 <div class="gallerytext">
11139 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11140 caption
11141 </p>
11142 </div>
11143 </div></li>
11144 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11145 <div style="height: 150px;">Nonexistant.jpg</div>
11146 <div class="gallerytext">
11147 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11148 </p>
11149 </div>
11150 </div></li>
11151 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11152 <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>
11153 <div class="gallerytext">
11154 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11155 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11156 </p>
11157 </div>
11158 </div></li>
11159 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11160 <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>
11161 <div class="gallerytext">
11162 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11163 </p>
11164 </div>
11165 </div></li>
11166 </ul>
11167
11168 !! end
11169
11170 !! test
11171 Gallery (with namespace-less filenames)
11172 !! input
11173 <gallery>
11174 File:Nonexistant.jpg
11175 Nonexistant.jpg
11176 image:foobar.jpg
11177 foobar.jpg
11178 </gallery>
11179 !! result
11180 <ul class="gallery">
11181 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11182 <div style="height: 150px;">Nonexistant.jpg</div>
11183 <div class="gallerytext">
11184 </div>
11185 </div></li>
11186 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11187 <div style="height: 150px;">Nonexistant.jpg</div>
11188 <div class="gallerytext">
11189 </div>
11190 </div></li>
11191 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11192 <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>
11193 <div class="gallerytext">
11194 </div>
11195 </div></li>
11196 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11197 <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>
11198 <div class="gallerytext">
11199 </div>
11200 </div></li>
11201 </ul>
11202
11203 !! end
11204
11205 !! test
11206 HTML Hex character encoding (spells the word "JavaScript")
11207 !! input
11208 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
11209 !! result
11210 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
11211 </p>
11212 !! end
11213
11214 !! test
11215 HTML Hex character encoding bogus encoding (bug 26437 regression check)
11216 !! input
11217 &#xsee;&#XSEE;
11218 !! result
11219 <p>&amp;#xsee;&amp;#XSEE;
11220 </p>
11221 !! end
11222
11223 !! test
11224 HTML Hex character encoding mixed case
11225 !! input
11226 &#xEE;&#Xee;
11227 !! result
11228 <p>&#xee;&#xee;
11229 </p>
11230 !! end
11231
11232 !! test
11233 __FORCETOC__ override
11234 !! input
11235 __NEWSECTIONLINK__
11236 __FORCETOC__
11237 !! result
11238 <p><br />
11239 </p>
11240 !! end
11241
11242 !! test
11243 ISBN code coverage
11244 !! input
11245 ISBN 978-0-1234-56&#x20;789
11246 !! result
11247 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
11248 </p>
11249 !! end
11250
11251 !! test
11252 ISBN followed by 5 spaces
11253 !! input
11254 ISBN
11255 !! result
11256 <p>ISBN
11257 </p>
11258 !! end
11259
11260 !! test
11261 Double ISBN
11262 !! input
11263 ISBN ISBN 1234567890
11264 !! result
11265 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
11266 </p>
11267 !! end
11268
11269 !! test
11270 Bug 22905: <abbr> followed by ISBN followed by </a>
11271 !! input
11272 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
11273 !! result
11274 <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>
11275 </p>
11276 !! end
11277
11278 !! test
11279 Double RFC
11280 !! input
11281 RFC RFC 1234
11282 !! result
11283 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
11284 </p>
11285 !! end
11286
11287 !! test
11288 Double RFC with a wiki link
11289 !! input
11290 RFC [[RFC 1234]]
11291 !! result
11292 <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>
11293 </p>
11294 !! end
11295
11296 !! test
11297 RFC code coverage
11298 !! input
11299 RFC 983&#x20;987
11300 !! result
11301 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
11302 </p>
11303 !! end
11304
11305 !! test
11306 Centre-aligned image
11307 !! input
11308 [[Image:foobar.jpg|centre]]
11309 !! result
11310 <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>
11311
11312 !!end
11313
11314 !! test
11315 None-aligned image
11316 !! input
11317 [[Image:foobar.jpg|none]]
11318 !! result
11319 <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>
11320
11321 !!end
11322
11323 !! test
11324 Width + Height sized image (using px) (height is ignored)
11325 !! input
11326 [[Image:foobar.jpg|640x480px]]
11327 !! result
11328 <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>
11329 </p>
11330 !!end
11331
11332 !! test
11333 Width-sized image (using px, no following whitespace)
11334 !! input
11335 [[Image:foobar.jpg|640px]]
11336 !! result
11337 <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>
11338 </p>
11339 !!end
11340
11341 !! test
11342 Width-sized image (using px, with following whitespace - test regression from r39467)
11343 !! input
11344 [[Image:foobar.jpg|640px ]]
11345 !! result
11346 <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>
11347 </p>
11348 !!end
11349
11350 !! test
11351 Width-sized image (using px, with preceding whitespace - test regression from r39467)
11352 !! input
11353 [[Image:foobar.jpg| 640px]]
11354 !! result
11355 <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>
11356 </p>
11357 !!end
11358
11359 !! test
11360 Another italics / bold test
11361 !! input
11362 ''' ''x'
11363 !! result
11364 <pre>'<i> </i>x'
11365 </pre>
11366 !!end
11367
11368 # Note the results may be incorrect, as parserTest output included this:
11369 # XML error: Mismatched tag at byte 6120:
11370 # ...<dd> </dt></dl> </dd...
11371 !! test
11372 dt/dd/dl test
11373 !! options
11374 disabled
11375 !! input
11376 :;;;::
11377 !! result
11378 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
11379 </dd></dl>
11380 </dd></dl>
11381 </dt></dl>
11382 </dt></dl>
11383 </dt></dl>
11384 </dd></dl>
11385
11386 !!end
11387
11388
11389 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
11390 !! test
11391 Images with the "|" character in the comment
11392 !! input
11393 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
11394 !! result
11395 <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>
11396
11397 !!end
11398
11399 !! test
11400 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
11401 !! input
11402 <html><script>alert(1);</script></html>
11403 !! result
11404 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
11405 </p>
11406 !! end
11407
11408 !! test
11409 HTML with raw HTML ($wgRawHtml==true)
11410 !! options
11411 rawhtml
11412 !! input
11413 <html><script>alert(1);</script></html>
11414 !! result
11415 <p><script>alert(1);</script>
11416 </p>
11417 !! end
11418
11419 !! test
11420 Parents of subpages, one level up
11421 !! options
11422 subpage title=[[Subpage test/L1/L2/L3]]
11423 !! input
11424 [[../|L2]]
11425 !! result
11426 <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>
11427 </p>
11428 !! end
11429
11430
11431 !! test
11432 Parents of subpages, one level up, not named
11433 !! options
11434 subpage title=[[Subpage test/L1/L2/L3]]
11435 !! input
11436 [[../]]
11437 !! result
11438 <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>
11439 </p>
11440 !! end
11441
11442
11443
11444 !! test
11445 Parents of subpages, two levels up
11446 !! options
11447 subpage title=[[Subpage test/L1/L2/L3]]
11448 !! input
11449 [[../../|L1]]2
11450
11451 [[../../|L1]]l
11452 !! result
11453 <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
11454 </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>
11455 </p>
11456 !! end
11457
11458 !! test
11459 Parents of subpages, two levels up, without trailing slash or name.
11460 !! options
11461 subpage title=[[Subpage test/L1/L2/L3]]
11462 !! input
11463 [[../..]]
11464 !! result
11465 <p>[[../..]]
11466 </p>
11467 !! end
11468
11469 !! test
11470 Parents of subpages, two levels up, with lots of extra trailing slashes.
11471 !! options
11472 subpage title=[[Subpage test/L1/L2/L3]]
11473 !! input
11474 [[../../////]]
11475 !! result
11476 <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>
11477 </p>
11478 !! end
11479
11480 !! test
11481 Definition list code coverage
11482 !! input
11483 ; title : def
11484 ; title : def
11485 ;title: def
11486 !! result
11487 <dl><dt> title &#160;</dt><dd> def
11488 </dd><dt> title&#160;</dt><dd> def
11489 </dd><dt>title</dt><dd> def
11490 </dd></dl>
11491
11492 !! end
11493
11494 !! test
11495 Don't fall for the self-closing div
11496 !! input
11497 <div>hello world</div/>
11498 !! result
11499 <div>hello world</div>
11500
11501 !! end
11502
11503 !! test
11504 MSGNW magic word
11505 !! input
11506 {{MSGNW:msg}}
11507 !! result
11508 <p>&#91;&#91;:Template:Msg&#93;&#93;
11509 </p>
11510 !! end
11511
11512 !! test
11513 RAW magic word
11514 !! input
11515 {{RAW:QUERTY}}
11516 !! result
11517 <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>
11518 </p>
11519 !! end
11520
11521 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
11522 !! test
11523 Always escape literal '>' in output, not just after '<'
11524 !! input
11525 ><>
11526 !! result
11527 <p>&gt;&lt;&gt;
11528 </p>
11529 !! end
11530
11531 !! test
11532 Template caching
11533 !! input
11534 {{Test}}
11535 {{Test}}
11536 !! result
11537 <p>This is a test template
11538 This is a test template
11539 </p>
11540 !! end
11541
11542
11543 !! article
11544 MediaWiki:Fake
11545 !! text
11546 ==header==
11547 !! endarticle
11548
11549 !! test
11550 Inclusion of !userCanEdit() content
11551 !! input
11552 {{MediaWiki:Fake}}
11553 !! result
11554 <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>
11555
11556 !! end
11557
11558
11559 !! test
11560 Out-of-order TOC heading levels
11561 !! input
11562 ==2==
11563 ======6======
11564 ===3===
11565 =1=
11566 =====5=====
11567 ==2==
11568 !! result
11569 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11570 <ul>
11571 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
11572 <ul>
11573 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
11574 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
11575 </ul>
11576 </li>
11577 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
11578 <ul>
11579 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
11580 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
11581 </ul>
11582 </li>
11583 </ul>
11584 </td></tr></table>
11585 <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>
11586 <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>
11587 <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>
11588 <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>
11589 <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>
11590 <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>
11591
11592 !! end
11593
11594
11595 !! test
11596 ISBN with a dummy number
11597 !! input
11598 ISBN ---
11599 !! result
11600 <p>ISBN ---
11601 </p>
11602 !! end
11603
11604
11605 !! test
11606 ISBN with space-delimited number
11607 !! input
11608 ISBN 92 9017 032 8
11609 !! result
11610 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
11611 </p>
11612 !! end
11613
11614
11615 !! test
11616 ISBN with multiple spaces, no number
11617 !! input
11618 ISBN foo
11619 !! result
11620 <p>ISBN foo
11621 </p>
11622 !! end
11623
11624
11625 !! test
11626 ISBN length
11627 !! input
11628 ISBN 123456789
11629
11630 ISBN 1234567890
11631
11632 ISBN 12345678901
11633 !! result
11634 <p>ISBN 123456789
11635 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
11636 </p><p>ISBN 12345678901
11637 </p>
11638 !! end
11639
11640
11641 !! test
11642 ISBN with trailing year (bug 8110)
11643 !! input
11644 ISBN 1-234-56789-0 - 2006
11645
11646 ISBN 1 234 56789 0 - 2006
11647 !! result
11648 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
11649 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
11650 </p>
11651 !! end
11652
11653
11654 !! test
11655 anchorencode
11656 !! input
11657 {{anchorencode:foo bar©#%n}}
11658 !! result
11659 <p>foo_bar.C2.A9.23.25n
11660 </p>
11661 !! end
11662
11663 !! test
11664 anchorencode trims spaces
11665 !! input
11666 {{anchorencode: __pretty__please__}}
11667 !! result
11668 <p>pretty_please
11669 </p>
11670 !! end
11671
11672 !! test
11673 anchorencode deals with links
11674 !! input
11675 {{anchorencode: [[hello|world]] [[hi]]}}
11676 !! result
11677 <p>world_hi
11678 </p>
11679 !! end
11680
11681 !! test
11682 anchorencode deals with templates
11683 !! input
11684 {{anchorencode: {{Foo}} }}
11685 !! result
11686 <p>FOO
11687 </p>
11688 !! end
11689
11690 !! test
11691 anchorencode encodes like the TOC generator: (bug 18431)
11692 !! input
11693 === _ +:.3A%3A&&amp;]] ===
11694 {{anchorencode: _ +:.3A%3A&&amp;]] }}
11695 __NOEDITSECTION__
11696 !! result
11697 <h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
11698 <p>.2B:.3A.253A.26.26.5D.5D
11699 </p>
11700 !! end
11701
11702 # Expected output in the following test is not necessarily expected (there
11703 # should probably be <p> tags inside the <blockquote> in the output) -- it's
11704 # only testing for well-formedness.
11705 !! test
11706 Bug 6200: blockquotes and paragraph formatting
11707 !! input
11708 <blockquote>
11709 foo
11710 </blockquote>
11711
11712 bar
11713
11714 baz
11715 !! result
11716 <blockquote>
11717 foo
11718 </blockquote>
11719 <p>bar
11720 </p>
11721 <pre>baz
11722 </pre>
11723 !! end
11724
11725 !! test
11726 Bug 8293: Use of center tag ruins paragraph formatting
11727 !! input
11728 <center>
11729 foo
11730 </center>
11731
11732 bar
11733
11734 baz
11735 !! result
11736 <center>
11737 <p>foo
11738 </p>
11739 </center>
11740 <p>bar
11741 </p>
11742 <pre>baz
11743 </pre>
11744 !! end
11745
11746
11747 ###
11748 ### Language variants related tests
11749 ###
11750 !! test
11751 Self-link in language variants
11752 !! options
11753 title=[[Dunav]] language=sr
11754 !! input
11755 Both [[Dunav]] and [[Дунав]] are names for this river.
11756 !! result
11757 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
11758 </p>
11759 !!end
11760
11761 !! article
11762 Дуна
11763 !! text
11764 content
11765 !! endarticle
11766
11767 !! test
11768 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
11769 !! options
11770 title=[[Duna]] language=sr
11771 !! input
11772 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
11773 !! result
11774 <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.
11775 </p>
11776 !! end
11777
11778 !! test
11779 Link to pages in language variants
11780 !! options
11781 language=sr
11782 !! input
11783 Main Page can be written as [[Маин Паге]]
11784 !! result
11785 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
11786 </p>
11787 !!end
11788
11789
11790 !! test
11791 Multiple links to pages in language variants
11792 !! options
11793 language=sr
11794 !! input
11795 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
11796 !! result
11797 <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>.
11798 </p>
11799 !!end
11800
11801
11802 !! test
11803 Simple template in language variants
11804 !! options
11805 language=sr
11806 !! input
11807 {{тест}}
11808 !! result
11809 <p>This is a test template
11810 </p>
11811 !! end
11812
11813
11814 !! test
11815 Template with explicit namespace in language variants
11816 !! options
11817 language=sr
11818 !! input
11819 {{Template:тест}}
11820 !! result
11821 <p>This is a test template
11822 </p>
11823 !! end
11824
11825
11826 !! test
11827 Basic test for template parameter in language variants
11828 !! options
11829 language=sr
11830 !! input
11831 {{парамтест|param=foo}}
11832 !! result
11833 <p>This is a test template with parameter foo
11834 </p>
11835 !! end
11836
11837
11838 !! test
11839 Simple category in language variants
11840 !! options
11841 language=sr cat
11842 !! input
11843 [[Category:МедиаWики Усер'с Гуиде]]
11844 !! result
11845 <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>
11846 !! end
11847
11848
11849 !! article
11850 Category:分类
11851 !! text
11852 blah
11853 !! endarticle
11854
11855 !! article
11856 Category:分類
11857 !! text
11858 blah
11859 !! endarticle
11860
11861 !! test
11862 Don't convert blue categorylinks to another variant (bug 33210)
11863 !! options
11864 language=zh cat
11865 !! input
11866 [[A]][[Category:分类]]
11867 !! result
11868 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
11869 !! end
11870
11871
11872 !! test
11873 Stripping -{}- tags (language variants)
11874 !! options
11875 language=sr
11876 !! input
11877 Latin proverb: -{Ne nuntium necare}-
11878 !! result
11879 <p>Latin proverb: Ne nuntium necare
11880 </p>
11881 !! end
11882
11883
11884 !! test
11885 Prevent conversion with -{}- tags (language variants)
11886 !! options
11887 language=sr variant=sr-ec
11888 !! input
11889 Latinski: -{Ne nuntium necare}-
11890 !! result
11891 <p>Латински: Ne nuntium necare
11892 </p>
11893 !! end
11894
11895
11896 !! test
11897 Prevent conversion of text with -{}- tags (language variants)
11898 !! options
11899 language=sr variant=sr-ec
11900 !! input
11901 Latinski: -{Ne nuntium necare}-
11902 !! result
11903 <p>Латински: Ne nuntium necare
11904 </p>
11905 !! end
11906
11907
11908 !! test
11909 Prevent conversion of links with -{}- tags (language variants)
11910 !! options
11911 language=sr variant=sr-ec
11912 !! input
11913 -{[[Main Page]]}-
11914 !! result
11915 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11916 </p>
11917 !! end
11918
11919
11920 !! test
11921 -{}- tags within headlines (within html for parserConvert())
11922 !! options
11923 language=sr variant=sr-ec
11924 !! input
11925 == -{Naslov}- ==
11926 !! result
11927 <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>
11928
11929 !! end
11930
11931
11932 !! test
11933 Explicit definition of language variant alternatives
11934 !! options
11935 language=zh variant=zh-tw
11936 !! input
11937 -{zh:China;zh-tw:Taiwan}-, not China
11938 !! result
11939 <p>Taiwan, not China
11940 </p>
11941 !! end
11942
11943
11944 !! test
11945 Conversion around HTML tags
11946 !! options
11947 language=sr variant=sr-ec
11948 !! input
11949 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
11950 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
11951 !! result
11952 <p>
11953 <span title="ЛаCтин">ски</span>
11954 </p>
11955 !! end
11956
11957
11958 !! test
11959 Explicit session-wise language variant mapping (A flag and - flag)
11960 !! options
11961 language=zh variant=zh-tw
11962 !! input
11963 Taiwan is not China.
11964 But -{A|zh:China;zh-tw:Taiwan}- is China,
11965 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
11966 and -{China}- is China.
11967 !! result
11968 <p>Taiwan is not China.
11969 But Taiwan is Taiwan,
11970 (This should be stripped!)
11971 and China is China.
11972 </p>
11973 !! end
11974
11975 !! test
11976 Explicit session-wise language variant mapping (H flag for hide)
11977 !! options
11978 language=zh variant=zh-tw
11979 !! input
11980 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
11981 Taiwan is China.
11982 !! result
11983 <p>(This should be stripped!)
11984 Taiwan is Taiwan.
11985 </p>
11986 !! end
11987
11988 !! test
11989 Adding explicit conversion rule for title (T flag)
11990 !! options
11991 language=zh variant=zh-tw showtitle
11992 !! input
11993 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
11994 !! result
11995 Taiwan
11996 <p>Should be stripped!
11997 </p>
11998 !! end
11999
12000 !! test
12001 Testing that changing the language variant here in the tests actually works
12002 !! options
12003 language=zh variant=zh showtitle
12004 !! input
12005 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12006 !! result
12007 China
12008 <p>Should be stripped!
12009 </p>
12010 !! end
12011
12012 !! test
12013 Recursive conversion of alt and title attrs shouldn't clear converter state
12014 !! options
12015 language=zh variant=zh-cn showtitle
12016 !! input
12017 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
12018 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
12019 !! result
12020 China
12021 <p>
12022 Should be stripped<span title="Exclamation">!</span>
12023 </p>
12024 !! end
12025
12026 !! test
12027 Bug 24072: more test on conversion rule for title
12028 !! options
12029 language=zh variant=zh-tw showtitle
12030 !! input
12031 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12032 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
12033 !! result
12034 Taiwan
12035 <p>This should be stripped!
12036 This won't take interferes with the title rule.
12037 </p>
12038 !! end
12039
12040 !! test
12041 Raw output of variant escape tags (R flag)
12042 !! options
12043 language=zh variant=zh-tw
12044 !! input
12045 Raw: -{R|zh:China;zh-tw:Taiwan}-
12046 !! result
12047 <p>Raw: zh:China;zh-tw:Taiwan
12048 </p>
12049 !! end
12050
12051 !! test
12052 Nested using of manual convert syntax
12053 !! options
12054 language=zh variant=zh-hk
12055 !! input
12056 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
12057 !! result
12058 <p>Nested: Hello Hong Kong!
12059 </p>
12060 !! end
12061
12062 !! test
12063 Proper conversion of text in external links
12064 !! options
12065 language=sr variant=sr-ec
12066 !! input
12067 http://www.google.com
12068 gopher://www.google.com
12069 [http://www.google.com http://www.google.com]
12070 [gopher://www.google.com gopher://www.google.com]
12071 [https://www.google.com irc://www.google.com]
12072 [ftp://www.google.com www.google.com/ftp://dir]
12073 [//www.google.com www.google.com]
12074 !! result
12075 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12076 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12077 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12078 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12079 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
12080 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
12081 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
12082 </p>
12083 !! end
12084
12085 !! test
12086 Do not convert roman numbers to language variants
12087 !! options
12088 language=sr variant=sr-ec
12089 !! input
12090 Fridrih IV je car.
12091 !! result
12092 <p>Фридрих IV је цар.
12093 </p>
12094 !! end
12095
12096 !! test
12097 Unclosed language converter markup "-{"
12098 !! options
12099 language=sr
12100 !! input
12101 -{T|hello
12102 !! result
12103 <p>-{T|hello
12104 </p>
12105 !! end
12106
12107 !! test
12108 Don't convert raw rule "-{R|=&gt;}-" to "=>"
12109 !! options
12110 language=sr
12111 !! input
12112 -{R|=&gt;}-
12113 !! result
12114 <p>=&gt;
12115 </p>
12116 !!end
12117
12118 !!article
12119 Template:Bullet
12120 !!text
12121 * Bar
12122 !!endarticle
12123
12124 !! test
12125 Bug 529: Uncovered bullet
12126 !! input
12127 * Foo {{bullet}}
12128 !! result
12129 <ul><li> Foo
12130 </li><li> Bar
12131 </li></ul>
12132
12133 !! end
12134
12135 # Plain MediaWiki does not remove empty lists, but tidy actually does.
12136 # Templates in Wikipedia rely on this behavior, as tidy has always been
12137 # enabled there. These tests are normally run *without* tidy, so specify the
12138 # full output here.
12139 # To test realistic parsing behavior, apply a tidy-like transformation to both
12140 # the expected output and your parser's output.
12141 !! test
12142 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
12143 !! input
12144 ******* Foo {{bullet}}
12145 !! result
12146 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
12147 </li></ul>
12148 </li></ul>
12149 </li></ul>
12150 </li></ul>
12151 </li></ul>
12152 </li></ul>
12153 </li><li> Bar
12154 </li></ul>
12155
12156 !! end
12157
12158 !! test
12159 Bug 529: Uncovered table already at line-start
12160 !! input
12161 x
12162
12163 {{table}}
12164 y
12165 !! result
12166 <p>x
12167 </p>
12168 <table>
12169 <tr>
12170 <td> 1 </td>
12171 <td> 2
12172 </td></tr>
12173 <tr>
12174 <td> 3 </td>
12175 <td> 4
12176 </td></tr></table>
12177 <p>y
12178 </p>
12179 !! end
12180
12181 !! test
12182 Bug 529: Uncovered bullet in parser function result
12183 !! input
12184 * Foo {{lc:{{bullet}} }}
12185 !! result
12186 <ul><li> Foo
12187 </li><li> bar
12188 </li></ul>
12189
12190 !! end
12191
12192 !! test
12193 Bug 5678: Double-parsed template argument
12194 !! input
12195 {{lc:{{{1}}}|hello}}
12196 !! result
12197 <p>{{{1}}}
12198 </p>
12199 !! end
12200
12201 !! test
12202 Bug 5678: Double-parsed template invocation
12203 !! input
12204 {{lc:{{paramtest {{!}} param = hello }} }}
12205 !! result
12206 <p>{{paramtest | param = hello }}
12207 </p>
12208 !! end
12209
12210 !! test
12211 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
12212 !! options
12213 language=cs
12214 title=[[Main Page]]
12215 !! input
12216 {{PRVNÍVELKÉ:ěščř}}
12217 {{prvnívelké:ěščř}}
12218 {{PRVNÍMALÉ:ěščř}}
12219 {{prvnímalé:ěščř}}
12220 {{MALÁ:ěščř}}
12221 {{malá:ěščř}}
12222 {{VELKÁ:ěščř}}
12223 {{velká:ěščř}}
12224 !! result
12225 <p>Ěščř
12226 Ěščř
12227 ěščř
12228 ěščř
12229 ěščř
12230 ěščř
12231 ĚŠČŘ
12232 ĚŠČŘ
12233 </p>
12234 !! end
12235
12236 !! test
12237 Morwen/13: Unclosed link followed by heading
12238 !! input
12239 [[link
12240 ==heading==
12241 !! result
12242 <p>[[link
12243 </p>
12244 <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>
12245
12246 !! end
12247
12248 !! test
12249 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
12250 !! input
12251 {{foo|
12252 =heading=
12253 !! result
12254 <p>{{foo|
12255 </p>
12256 <h1> <span class="mw-headline" id="heading">heading</span></h1>
12257
12258 !! end
12259
12260 !! test
12261 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
12262 !! input
12263 {{foo|
12264 ==heading==
12265 !! result
12266 <p>{{foo|
12267 </p>
12268 <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>
12269
12270 !! end
12271
12272 !! test
12273 Tildes in comments
12274 !! options
12275 pst
12276 !! input
12277 <!-- ~~~~ -->
12278 !! result
12279 <!-- ~~~~ -->
12280 !! end
12281
12282 !! test
12283 Paragraphs inside divs (no extra line breaks)
12284 !! input
12285 <div>Line one
12286
12287 Line two</div>
12288 !! result
12289 <div>Line one
12290 Line two</div>
12291
12292 !! end
12293
12294 !! test
12295 Paragraphs inside divs (extra line break on open)
12296 !! input
12297 <div>
12298 Line one
12299
12300 Line two</div>
12301 !! result
12302 <div>
12303 <p>Line one
12304 </p>
12305 Line two</div>
12306
12307 !! end
12308
12309 !! test
12310 Paragraphs inside divs (extra line break on close)
12311 !! input
12312 <div>Line one
12313
12314 Line two
12315 </div>
12316 !! result
12317 <div>Line one
12318 <p>Line two
12319 </p>
12320 </div>
12321
12322 !! end
12323
12324 !! test
12325 Paragraphs inside divs (extra line break on open and close)
12326 !! input
12327 <div>
12328 Line one
12329
12330 Line two
12331 </div>
12332 !! result
12333 <div>
12334 <p>Line one
12335 </p><p>Line two
12336 </p>
12337 </div>
12338
12339 !! end
12340
12341 !! test
12342 Nesting tags, paragraphs on lines which begin with <div>
12343 !! options
12344 disabled
12345 !! input
12346 <div></div><strong>A
12347 B</strong>
12348 !! result
12349 <div></div>
12350 <p><strong>A
12351 B</strong>
12352 </p>
12353 !! end
12354
12355 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
12356 !! test
12357 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
12358 !! options
12359 disabled
12360 !! input
12361 <blockquote>Line one
12362
12363 Line two</blockquote>
12364 !! result
12365 <blockquote>Line one
12366 Line two</blockquote>
12367
12368 !! end
12369
12370 !! test
12371 Bug 6200: paragraphs inside blockquotes (extra line break on open)
12372 !! options
12373 disabled
12374 !! input
12375 <blockquote>
12376 Line one
12377
12378 Line two</blockquote>
12379 !! result
12380 <blockquote>
12381 <p>Line one
12382 </p>
12383 Line two</blockquote>
12384
12385 !! end
12386
12387 !! test
12388 Bug 6200: paragraphs inside blockquotes (extra line break on close)
12389 !! options
12390 disabled
12391 !! input
12392 <blockquote>Line one
12393
12394 Line two
12395 </blockquote>
12396 !! result
12397 <blockquote>Line one
12398 <p>Line two
12399 </p>
12400 </blockquote>
12401
12402 !! end
12403
12404 !! test
12405 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
12406 !! options
12407 disabled
12408 !! input
12409 <blockquote>
12410 Line one
12411
12412 Line two
12413 </blockquote>
12414 !! result
12415 <blockquote>
12416 <p>Line one
12417 </p><p>Line two
12418 </p>
12419 </blockquote>
12420
12421 !! end
12422
12423 !! test
12424 Paragraphs inside blockquotes/divs (no extra line breaks)
12425 !! input
12426 <blockquote><div>Line one
12427
12428 Line two</div></blockquote>
12429 !! result
12430 <blockquote><div>Line one
12431 Line two</div></blockquote>
12432
12433 !! end
12434
12435 !! test
12436 Paragraphs inside blockquotes/divs (extra line break on open)
12437 !! input
12438 <blockquote><div>
12439 Line one
12440
12441 Line two</div></blockquote>
12442 !! result
12443 <blockquote><div>
12444 <p>Line one
12445 </p>
12446 Line two</div></blockquote>
12447
12448 !! end
12449
12450 !! test
12451 Paragraphs inside blockquotes/divs (extra line break on close)
12452 !! input
12453 <blockquote><div>Line one
12454
12455 Line two
12456 </div></blockquote>
12457 !! result
12458 <blockquote><div>Line one
12459 <p>Line two
12460 </p>
12461 </div></blockquote>
12462
12463 !! end
12464
12465 !! test
12466 Paragraphs inside blockquotes/divs (extra line break on open and close)
12467 !! input
12468 <blockquote><div>
12469 Line one
12470
12471 Line two
12472 </div></blockquote>
12473 !! result
12474 <blockquote><div>
12475 <p>Line one
12476 </p><p>Line two
12477 </p>
12478 </div></blockquote>
12479
12480 !! end
12481
12482 !! test
12483 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
12484 !! options
12485 wgLinkHolderBatchSize=0
12486 !! input
12487 [[meatball:1]]
12488 [[meatball:2]]
12489 [[meatball:3]]
12490 !! result
12491 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
12492 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
12493 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
12494 </p>
12495 !! end
12496
12497 !! test
12498 Free external link invading image caption
12499 !! input
12500 [[Image:Foobar.jpg|thumb|http://x|hello]]
12501 !! result
12502 <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>
12503
12504 !! end
12505
12506 !! test
12507 Bug 15196: localised external link numbers
12508 !! options
12509 language=fa
12510 !! input
12511 [http://en.wikipedia.org/]
12512 !! result
12513 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
12514 </p>
12515 !! end
12516
12517 !! test
12518 Multibyte character in padleft
12519 !! input
12520 {{padleft:-Hello|7|Æ}}
12521 !! result
12522 <p>Æ-Hello
12523 </p>
12524 !! end
12525
12526 !! test
12527 Multibyte character in padright
12528 !! input
12529 {{padright:Hello-|7|Æ}}
12530 !! result
12531 <p>Hello-Æ
12532 </p>
12533 !! end
12534
12535 !!test
12536 formatdate parser function
12537 !!input
12538 {{#formatdate:2009-03-24}}
12539 !! result
12540 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
12541 </p>
12542 !! end
12543
12544 !!test
12545 formatdate parser function, with default format
12546 !!input
12547 {{#formatdate:2009-03-24|mdy}}
12548 !! result
12549 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
12550 </p>
12551 !! end
12552
12553 !! test
12554 Spacing of numbers in formatted dates
12555 !! input
12556 {{#formatdate:January 15}}
12557 !! result
12558 <p><span class="mw-formatted-date" title="01-15">January 15</span>
12559 </p>
12560 !! end
12561
12562 !! test
12563 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
12564 !! options
12565 language=nl title=[[MediaWiki:Common.css]]
12566 !! input
12567 {{#formatdate:2009-03-24|dmy}}
12568 !! result
12569 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
12570 </p>
12571 !! end
12572
12573 #
12574 #
12575 #
12576
12577 #
12578 # Edit comments
12579 #
12580
12581 !! test
12582 Edit comment with link
12583 !! options
12584 comment
12585 !! input
12586 I like the [[Main Page]] a lot
12587 !! result
12588 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
12589 !!end
12590
12591 !! test
12592 Edit comment with link and link text
12593 !! options
12594 comment
12595 !! input
12596 I like the [[Main Page|best pages]] 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 link and link text with suffix
12603 !! options
12604 comment
12605 !! input
12606 I like the [[Main Page|best page]]s a lot
12607 !! result
12608 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
12609 !!end
12610
12611 !! test
12612 Edit comment with section link (non-local, eg in history list)
12613 !! options
12614 comment title=[[Main Page]]
12615 !! input
12616 /* External links */ removed bogus entries
12617 !! result
12618 <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 and text before it (non-local, eg in history list)
12623 !! options
12624 comment title=[[Main Page]]
12625 !! input
12626 pre-comment text /* External links */ removed bogus entries
12627 !! result
12628 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>
12629 !!end
12630
12631 !! test
12632 Edit comment with section link (local, eg in diff view)
12633 !! options
12634 comment local title=[[Main Page]]
12635 !! input
12636 /* External links */ removed bogus entries
12637 !! result
12638 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12639 !!end
12640
12641 !! test
12642 Edit comment with subpage link (bug 14080)
12643 !! options
12644 comment
12645 subpage
12646 title=[[Subpage test]]
12647 !! input
12648 Poked at a [[/subpage]] here...
12649 !! result
12650 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
12651 !!end
12652
12653 !! test
12654 Edit comment with subpage link and link text (bug 14080)
12655 !! options
12656 comment
12657 subpage
12658 title=[[Subpage test]]
12659 !! input
12660 Poked at a [[/subpage|neat little page]] here...
12661 !! result
12662 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
12663 !!end
12664
12665 !! test
12666 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
12667 !! options
12668 comment
12669 title=[[Subpage test]]
12670 !! input
12671 Poked at a [[/subpage]] here...
12672 !! result
12673 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...
12674 !!end
12675
12676 !! test
12677 Edit comment with bare anchor link (local, as on diff)
12678 !! options
12679 comment
12680 local
12681 title=[[Main Page]]
12682 !!input
12683 [[#section]]
12684 !! result
12685 <a href="#section">#section</a>
12686 !! end
12687
12688 !! test
12689 Edit comment with bare anchor link (non-local, as on history)
12690 !! options
12691 comment
12692 title=[[Main Page]]
12693 !!input
12694 [[#section]]
12695 !! result
12696 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
12697 !! end
12698
12699 !! test
12700 Anchor starting with underscore
12701 !!input
12702 [[#_ref|One]]
12703 !! result
12704 <p><a href="#_ref">One</a>
12705 </p>
12706 !! end
12707
12708 !! test
12709 Id starting with underscore
12710 !!input
12711 <div id="_ref"></div>
12712 !! result
12713 <div id="_ref"></div>
12714
12715 !! end
12716
12717 !! test
12718 Space normalisation on autocomment (bug 22784)
12719 !! options
12720 comment
12721 title=[[Main Page]]
12722 !!input
12723 /* __hello__world__ */
12724 !! result
12725 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
12726 !! end
12727
12728 !! test
12729 percent-encoding and + signs in comments (Bug 26410)
12730 !! options
12731 comment
12732 !!input
12733 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
12734 !! result
12735 <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>
12736 !! end
12737
12738 !! test
12739 Bad images - basic functionality
12740 !! options
12741 disabled
12742 !! input
12743 [[File:Bad.jpg]]
12744 !! result
12745 !! end
12746
12747 !! test
12748 Bad images - bug 16039: text after bad image disappears
12749 !! options
12750 disabled
12751 !! input
12752 Foo bar
12753 [[File:Bad.jpg]]
12754 Bar foo
12755 !! result
12756 <p>Foo bar
12757 </p><p>Bar foo
12758 </p>
12759 !! end
12760
12761 !! test
12762 Verify that displaytitle works (bug #22501) no displaytitle
12763 !! options
12764 showtitle
12765 !! config
12766 wgAllowDisplayTitle=true
12767 wgRestrictDisplayTitle=false
12768 !! input
12769 this is not the the title
12770 !! result
12771 Parser test
12772 <p>this is not the the title
12773 </p>
12774 !! end
12775
12776 !! test
12777 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
12778 !! options
12779 showtitle
12780 title=[[Screen]]
12781 !! config
12782 wgAllowDisplayTitle=true
12783 wgRestrictDisplayTitle=false
12784 !! input
12785 this is not the the title
12786 {{DISPLAYTITLE:whatever}}
12787 !! result
12788 whatever
12789 <p>this is not the the title
12790 </p>
12791 !! end
12792
12793 !! test
12794 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
12795 !! options
12796 showtitle
12797 title=[[Screen]]
12798 !! config
12799 wgAllowDisplayTitle=true
12800 wgRestrictDisplayTitle=true
12801 !! input
12802 this is not the the title
12803 {{DISPLAYTITLE:whatever}}
12804 !! result
12805 Screen
12806 <p>this is not the the title
12807 </p>
12808 !! end
12809
12810 !! test
12811 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
12812 !! options
12813 showtitle
12814 title=[[Screen]]
12815 !! config
12816 wgAllowDisplayTitle=true
12817 wgRestrictDisplayTitle=true
12818 !! input
12819 this is not the the title
12820 {{DISPLAYTITLE:screen}}
12821 !! result
12822 screen
12823 <p>this is not the the title
12824 </p>
12825 !! end
12826
12827 !! test
12828 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
12829 !! options
12830 showtitle
12831 title=[[Screen]]
12832 !! config
12833 wgAllowDisplayTitle=false
12834 !! input
12835 this is not the the title
12836 {{DISPLAYTITLE:screen}}
12837 !! result
12838 Screen
12839 <p>this is not the the title
12840 <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>
12841 </p>
12842 !! end
12843
12844 !! test
12845 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
12846 !! options
12847 showtitle
12848 title=[[Screen]]
12849 !! config
12850 wgAllowDisplayTitle=false
12851 !! input
12852 this is not the the title
12853 !! result
12854 Screen
12855 <p>this is not the the title
12856 </p>
12857 !! end
12858
12859 !! test
12860 preload: check <noinclude> and <includeonly>
12861 !! options
12862 preload
12863 !! input
12864 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
12865 !! result
12866 Hello kind world.
12867 !! end
12868
12869 !! test
12870 preload: check <onlyinclude>
12871 !! options
12872 preload
12873 !! input
12874 Goodbye <onlyinclude>Hello world</onlyinclude>
12875 !! result
12876 Hello world
12877 !! end
12878
12879 !! test
12880 preload: can pass tags through if we want to
12881 !! options
12882 preload
12883 !! input
12884 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
12885 !! result
12886 <includeonly>Hello world</includeonly>
12887 !! end
12888
12889 !! test
12890 preload: check that it doesn't try to do tricks
12891 !! options
12892 preload
12893 !! input
12894 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12895 !! result
12896 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12897 !! end
12898
12899 !! test
12900 Play a bit with r67090 and bug 3158
12901 !! options
12902 disabled
12903 !! input
12904 <div style="width:50% !important">&nbsp;</div>
12905 <div style="width:50%&nbsp;!important">&nbsp;</div>
12906 <div style="width:50%&#160;!important">&nbsp;</div>
12907 <div style="border : solid;">&nbsp;</div>
12908 !! result
12909 <div style="width:50% !important">&nbsp;</div>
12910 <div style="width:50% !important">&nbsp;</div>
12911 <div style="width:50% !important">&nbsp;</div>
12912 <div style="border&#160;: solid;">&nbsp;</div>
12913
12914 !! end
12915
12916 !! test
12917 HTML5 data attributes
12918 !! input
12919 <span data-foo="bar">Baz</span>
12920 <p data-abc-def_hij="">Quuz</p>
12921 !! result
12922 <p><span data-foo="bar">Baz</span>
12923 </p>
12924 <p data-abc-def_hij="">Quuz</p>
12925
12926 !! end
12927
12928 !! test
12929 percent-encoding and + signs in internal links (Bug 26410)
12930 !! input
12931 [[User:+%]] [[Page+title%]]
12932 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
12933 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
12934 [[%33%45]] [[%33%45+]]
12935 !! result
12936 <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>
12937 <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>
12938 <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>
12939 <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>
12940 </p>
12941 !! end
12942
12943 !! test
12944 Special characters in embedded file links (bug 27679)
12945 !! input
12946 [[File:Contains & ampersand.jpg]]
12947 [[File:Does not exist.jpg|Title with & ampersand]]
12948 !! result
12949 <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>
12950 <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>
12951 </p>
12952 !! end
12953
12954
12955 !! test
12956 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
12957 !! input
12958 Text&apos;s been normalized?
12959 !! result
12960 <p>Text&#39;s been normalized?
12961 </p>
12962 !! end
12963
12964 !! test
12965 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
12966 !! input
12967 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
12968 !! result
12969 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
12970 </p>
12971 !! end
12972
12973 !! test
12974 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
12975 !! input
12976 [http://www.example.org/ ideograms]
12977 !! result
12978 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
12979 </p>
12980 !! end
12981
12982 !! test
12983 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
12984 !! input
12985 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
12986 !! result
12987 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
12988 </p>
12989 !! end
12990
12991 !! article
12992 Mediawiki:loop1
12993 !! text
12994 {{Identical|A}}
12995 !! endarticle
12996
12997 !! article
12998 Mediawiki:loop2
12999 !! text
13000 {{Identical|B}}
13001 !! endarticle
13002
13003 !! article
13004 Template:Identical
13005 !! text
13006 {{int:loop1}}
13007 {{int:loop2}}
13008 !! endarticle
13009
13010 !! test
13011 Bug 31098 Template which includes system messages which includes the template
13012 !! input
13013 {{Identical}}
13014 !! result
13015 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13016 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13017 </p>
13018 !! end
13019
13020 !! test
13021 Bug31490 Turkish: ucfirst 'blah'
13022 !! options
13023 language=tr
13024 !! input
13025 {{ucfirst:blah}}
13026 !! result
13027 <p>Blah
13028 </p>
13029 !! end
13030
13031 !! test
13032 Bug31490 Turkish: ucfirst 'ix'
13033 !! options
13034 language=tr
13035 !! input
13036 {{ucfirst:ix}}
13037 !! result
13038 <p>İx
13039 </p>
13040 !! end
13041
13042 !! test
13043 Bug31490 Turkish: lcfirst 'BLAH'
13044 !! options
13045 language=tr
13046 !! input
13047 {{lcfirst:BLAH}}
13048 !! result
13049 <p>bLAH
13050 </p>
13051 !! end
13052
13053 !! test
13054 Bug31490 Turkish: ucfırst (with a dotless i)
13055 !! options
13056 language=tr
13057 !! input
13058 {{ucfırst:blah}}
13059 !! result
13060 <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>
13061 </p>
13062 !! end
13063
13064 !! test
13065 Bug31490 ucfırst (with a dotless i) with English language
13066 !! options
13067 language=en
13068 !! input
13069 {{ucfırst:blah}}
13070 !! result
13071 <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>
13072 </p>
13073 !! end
13074
13075 !! test
13076 Bug 26375: TOC with italics
13077 !! options
13078 title=[[Main Page]]
13079 !! input
13080 __TOC__
13081 == ''Lost'' episodes ==
13082 !! result
13083 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13084 <ul>
13085 <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>
13086 </ul>
13087 </td></tr></table>
13088 <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>
13089
13090 !! end
13091
13092 !! test
13093 Bug 26375: TOC with bold
13094 !! options
13095 title=[[Main Page]]
13096 !! input
13097 __TOC__
13098 == '''should be bold''' then normal text ==
13099 !! result
13100 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13101 <ul>
13102 <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>
13103 </ul>
13104 </td></tr></table>
13105 <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>
13106
13107 !! end
13108
13109 !! test
13110 Bug 33845: Headings become cursive in TOC when they contain an image
13111 !! options
13112 title=[[Main Page]]
13113 !! input
13114 __TOC__
13115 == Image [[Image:foobar.jpg]] ==
13116 !! result
13117 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13118 <ul>
13119 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
13120 </ul>
13121 </td></tr></table>
13122 <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>
13123
13124 !! end
13125
13126 !! test
13127 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
13128 !! options
13129 title=[[Main Page]]
13130 !! input
13131 __TOC__
13132 == <blockquote>Quote</blockquote> ==
13133 !! result
13134 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13135 <ul>
13136 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
13137 </ul>
13138 </td></tr></table>
13139 <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>
13140
13141 !! end
13142
13143 !! test
13144 Unclosed tags in TOC
13145 !! options
13146 title=[[Main Page]]
13147 !! input
13148 __TOC__
13149 == Proof: 2 < 3 ==
13150 <small>Hanc marginis exiguitas non caperet.</small>
13151 QED
13152 !! result
13153 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13154 <ul>
13155 <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>
13156 </ul>
13157 </td></tr></table>
13158 <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>
13159 <p><small>Hanc marginis exiguitas non caperet.</small>
13160 QED
13161 </p>
13162 !! end
13163
13164 !! test
13165 Multiple tags in TOC
13166 !! input
13167 __TOC__
13168 == <i>Foo</i> <b>Bar</b> ==
13169
13170 == <i>Foo</i> <blockquote>Bar</blockquote> ==
13171 !! result
13172 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13173 <ul>
13174 <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>
13175 <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>
13176 </ul>
13177 </td></tr></table>
13178 <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>
13179 <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>
13180
13181 !! end
13182
13183 !! test
13184 Tags with parameters in TOC
13185 !! input
13186 __TOC__
13187 == <sup class="in-h2">Hello</sup> ==
13188
13189 == <sup class="a > b">Evilbye</sup> ==
13190 !! result
13191 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13192 <ul>
13193 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
13194 <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>
13195 </ul>
13196 </td></tr></table>
13197 <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>
13198 <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>
13199
13200 !! end
13201
13202 !! test
13203 span tags with directionality in TOC
13204 !! input
13205 __TOC__
13206 == <span dir="ltr">C++</span> ==
13207
13208 == <span dir="rtl">זבנג!</span> ==
13209
13210 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
13211
13212 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
13213
13214 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
13215 !! result
13216 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13217 <ul>
13218 <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>
13219 <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>
13220 <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>
13221 <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>
13222 <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>
13223 </ul>
13224 </td></tr></table>
13225 <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>
13226 <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>
13227 <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>
13228 <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>
13229 <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>
13230
13231 !! end
13232
13233 !! article
13234 MediaWiki:Bug32057
13235 !! text
13236 == {{int:headline_sample}} ==
13237 !! endarticle
13238
13239 !! test
13240 Bug 32057: Title needed when expanding <h> nodes.
13241 !! options
13242 title=[[Main Page]]
13243 !! input
13244 {{int:Bug32057}}
13245 !! result
13246 <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>
13247
13248 !! end
13249
13250 !! test
13251 Strip marker in urlencode
13252 !! input
13253 {{urlencode:x<nowiki/>y}}
13254 {{urlencode:x<nowiki/>y|wiki}}
13255 {{urlencode:x<nowiki/>y|path}}
13256 !! result
13257 <p>xy
13258 xy
13259 xy
13260 </p>
13261 !! end
13262
13263 !! test
13264 Strip marker in lc
13265 !! input
13266 {{lc:x<nowiki/>y}}
13267 !! result
13268 <p>xy
13269 </p>
13270 !! end
13271
13272 !! test
13273 Strip marker in uc
13274 !! input
13275 {{uc:x<nowiki/>y}}
13276 !! result
13277 <p>XY
13278 </p>
13279 !! end
13280
13281 !! test
13282 Strip marker in formatNum
13283 !! input
13284 {{formatnum:1<nowiki/>2}}
13285 {{formatnum:1<nowiki/>2|R}}
13286 !! result
13287 <p>12
13288 12
13289 </p>
13290 !! end
13291
13292 !! test
13293 Check noCommafy in formatNum
13294 !! options
13295 language=be-tarask
13296 !! input
13297 {{formatnum:123456.78}}
13298 {{formatnum:123456.78|NOSEP}}
13299 !! result
13300 <p>123 456,78
13301 123456.78
13302 </p>
13303 !! end
13304
13305 !! test
13306 Strip marker in grammar
13307 !! options
13308 language=fi
13309 !! input
13310 {{grammar:elative|foo<nowiki/>bar}}
13311 !! result
13312 <p>foobarista
13313 </p>
13314 !! end
13315
13316 !! test
13317 Strip marker in padleft
13318 !! input
13319 {{padleft:|2|x<nowiki/>y}}
13320 !! result
13321 <p>xy
13322 </p>
13323 !! end
13324
13325 !! test
13326 Strip marker in padright
13327 !! input
13328 {{padright:|2|x<nowiki/>y}}
13329 !! result
13330 <p>xy
13331 </p>
13332 !! end
13333
13334 !! test
13335 Strip marker in anchorencode
13336 !! input
13337 {{anchorencode:x<nowiki/>y}}
13338 !! result
13339 <p>xy
13340 </p>
13341 !! end
13342
13343 !! test
13344 nowiki inside link inside heading (bug 18295)
13345 !! input
13346 ==[[foo|x<nowiki>y</nowiki>z]]==
13347 !! result
13348 <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>
13349
13350 !! end
13351
13352 !! test
13353 new support for bdi element (bug 31817)
13354 !! input
13355 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
13356 !! result
13357 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
13358
13359 !!end
13360
13361 !! test
13362 Ignore pipe between table row attributes
13363 !! input
13364 {|
13365 | quux
13366 |- id=foo | style='color: red'
13367 | bar
13368 |}
13369 !! result
13370 <table>
13371 <tr>
13372 <td> quux
13373 </td></tr>
13374 <tr id="foo" style="color: red">
13375 <td> bar
13376 </td></tr></table>
13377
13378 !! end
13379
13380 !!test
13381 Gallery override link with WikiLink (bug 34852)
13382 !! input
13383 <gallery>
13384 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
13385 </gallery>
13386 !! result
13387 <ul class="gallery">
13388 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13389 <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>
13390 <div class="gallerytext">
13391 <p>caption
13392 </p>
13393 </div>
13394 </div></li>
13395 </ul>
13396
13397 !! end
13398
13399 !!test
13400 Gallery override link with absolute external link (bug 34852)
13401 !! input
13402 <gallery>
13403 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
13404 </gallery>
13405 !! result
13406 <ul class="gallery">
13407 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13408 <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>
13409 <div class="gallerytext">
13410 <p>caption
13411 </p>
13412 </div>
13413 </div></li>
13414 </ul>
13415
13416 !! end
13417
13418 !!test
13419 Gallery override link with malicious javascript (bug 34852)
13420 !! input
13421 <gallery>
13422 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
13423 </gallery>
13424 !! result
13425 <ul class="gallery">
13426 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13427 <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>
13428 <div class="gallerytext">
13429 <p>caption
13430 </p>
13431 </div>
13432 </div></li>
13433 </ul>
13434
13435 !! end
13436
13437 !!test
13438 Gallery with invalid title as link (bug 43964)
13439 !! input
13440 <gallery>
13441 File:foobar.jpg|link=<
13442 </gallery>
13443 !! result
13444 <ul class="gallery">
13445 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13446 <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>
13447 <div class="gallerytext">
13448 </div>
13449 </div></li>
13450 </ul>
13451
13452 !! end
13453
13454 !!test
13455 Language parser function
13456 !! input
13457 {{#language:ar}}
13458 !! result
13459 <p>العربية
13460 </p>
13461 !! end
13462
13463 !!test
13464 Padleft and padright as substr
13465 !! input
13466 {{padleft:|3|abcde}}
13467 {{padright:|3|abcde}}
13468 !! result
13469 <p>abc
13470 abc
13471 </p>
13472 !! end
13473
13474 !!test
13475 Bug 34939 - Case insensitive link parsing ([HttP://])
13476 !! input
13477 [HttP://MediaWiki.Org/]
13478 !! result
13479 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
13480 </p>
13481 !! end
13482
13483 !!test
13484 Bug 34939 - Case insensitive link parsing ([HttP:// title])
13485 !! input
13486 [HttP://MediaWiki.Org/ MediaWiki]
13487 !! result
13488 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
13489 </p>
13490 !! end
13491
13492 !!test
13493 Bug 34939 - Case insensitive link parsing (HttP://)
13494 !! input
13495 HttP://MediaWiki.Org/
13496 !! result
13497 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
13498 </p>
13499 !! end
13500
13501 ###
13502 ### Parsoids-specific tests
13503 ### Parsoid-PHP parser incompatibilities
13504 ###
13505 !!test
13506 1. SOL-sensitive wikitext tokens as template-args
13507 !!options
13508 disabled
13509 !!input
13510 {{echo|*a}}
13511 {{echo|#a}}
13512 {{echo|:a}}
13513 !!result
13514 <p>*a
13515 #a
13516 :a
13517 </p>
13518 !!end
13519
13520 #### The following section of tests are primarily to test
13521 #### wikitext escaping capabilities of Parsoid.
13522 #### A lot of the tests are disabled for the PHP parser either
13523 #### because of minor newline diffs or other reasons.
13524 #### As Parsoid serializer can handle newlines and other HTML
13525 #### more robustly, some of these tests might get reenabled
13526 #### for the PHP parser.
13527
13528 #### --------------- Headings ---------------
13529 #### 0. Unnested
13530 #### 1. Nested inside html <h1>=foo=</h1>
13531 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
13532 #### 3. Nested inside html with wikitext split by html tags
13533 #### 4. No escape needed
13534 #### 5. Empty headings <h1></h1>
13535 #### 6. Heading chars in SOL context
13536 #### ----------------------------------------
13537 !! test
13538 Headings: 0. Unnested
13539 !! input
13540 <nowiki>=foo=</nowiki>
13541
13542 <nowiki>=foo</nowiki>''a''=
13543 !! result
13544 <p>=foo=
13545 </p><p>=foo<i>a</i>=
13546 </p>
13547 !!end
13548
13549 !! test
13550 Headings: 1. Nested inside html
13551 !! options
13552 disabled
13553 !! input
13554 =<nowiki>=foo=</nowiki>=
13555 ==<nowiki>=foo=</nowiki>==
13556 ===<nowiki>=foo=</nowiki>===
13557 ====<nowiki>=foo=</nowiki>====
13558 =====<nowiki>=foo=</nowiki>=====
13559 ======<nowiki>=foo=</nowiki>======
13560 !! result
13561 <h1>=foo=</h1>
13562 <h2>=foo=</h2>
13563 <h3>=foo=</h3>
13564 <h4>=foo=</h4>
13565 <h5>=foo=</h5>
13566 <h6>=foo=</h6>
13567 !!end
13568
13569 !! test
13570 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
13571 !! options
13572 disabled
13573 !! input
13574 =foo=
13575 <nowiki>*bar</nowiki>
13576 =foo=
13577 =bar
13578 =foo=
13579 <nowiki>=bar=</nowiki>
13580 !! result
13581 <h1>foo</h1>*bar
13582 <h1>foo</h1>=bar
13583 <h1>foo</h1>=bar=
13584 !!end
13585
13586 !! test
13587 Headings: 3. Nested inside html with wikitext split by html tags
13588 !! options
13589 disabled
13590 !! input
13591 =<nowiki>=</nowiki>'''bold'''foo==
13592 !! result
13593 <h1>=<b>bold</b>foo=</h1>
13594 !!end
13595
13596 !! test
13597 Headings: 4. No escaping needed (testing just h1 and h2)
13598 !! options
13599 disabled
13600 !! input
13601 ==foo=
13602 =foo==
13603 ===foo==
13604 ==foo===
13605 =''=''foo==
13606 ===
13607 !! result
13608 <h1>=foo</h1>
13609 <h1>foo=</h1>
13610 <h2>=foo</h2>
13611 <h2>foo=</h2>
13612 <h1><i>=</i>foo=</h1>
13613 <h1>=</h1>
13614 !!end
13615
13616 !! test
13617 Headings: 5. Empty headings
13618 !! options
13619 disabled
13620 !! input
13621 =<nowiki></nowiki>=
13622 ==<nowiki></nowiki>==
13623 ===<nowiki></nowiki>===
13624 ====<nowiki></nowiki>====
13625 =====<nowiki></nowiki>=====
13626 ======<nowiki></nowiki>======
13627 !! result
13628 <h1></h1>
13629 <h2></h2>
13630 <h3></h3>
13631 <h4></h4>
13632 <h5></h5>
13633 <h6></h6>
13634 !!end
13635
13636 !! test
13637 Headings: 6. Heading chars in SOL context
13638 !! options
13639 disabled
13640 !! input
13641 <!--cmt--><nowiki>=h1=</nowiki>
13642 !! result
13643 <p><!--cmt-->=h1=
13644 </p>
13645 !!end
13646
13647 #### --------------- Lists ---------------
13648 #### 0. Outside nests (*foo, etc.)
13649 #### 1. Nested inside html <ul><li>*foo</li></ul>
13650 #### 2. Inside definition lists
13651 #### 3. Only bullets at start should be escaped
13652 #### 4. No escapes needed
13653 #### 5. No unnecessary escapes
13654 #### 6. Escape bullets in SOL position
13655 #### 7. Escape bullets in a multi-line context
13656 #### ----------------------------------------
13657
13658 !! test
13659 Lists: 0. Outside nests
13660 !! input
13661 <nowiki>*foo</nowiki>
13662
13663 <nowiki>#foo</nowiki>
13664 !! result
13665 <p>*foo
13666 </p><p>#foo
13667 </p>
13668 !!end
13669
13670 !! test
13671 Lists: 1. Nested inside html
13672 !! input
13673 *<nowiki>*foo</nowiki>
13674
13675 *<nowiki>#foo</nowiki>
13676
13677 *<nowiki>:foo</nowiki>
13678
13679 *<nowiki>;foo</nowiki>
13680
13681 #<nowiki>*foo</nowiki>
13682
13683 #<nowiki>#foo</nowiki>
13684
13685 #<nowiki>:foo</nowiki>
13686
13687 #<nowiki>;foo</nowiki>
13688 !! result
13689 <ul><li>*foo
13690 </li></ul>
13691 <ul><li>#foo
13692 </li></ul>
13693 <ul><li>:foo
13694 </li></ul>
13695 <ul><li>;foo
13696 </li></ul>
13697 <ol><li>*foo
13698 </li></ol>
13699 <ol><li>#foo
13700 </li></ol>
13701 <ol><li>:foo
13702 </li></ol>
13703 <ol><li>;foo
13704 </li></ol>
13705
13706 !!end
13707
13708 !! test
13709 Lists: 2. Inside definition lists
13710 !! input
13711 ;<nowiki>;foo</nowiki>
13712
13713 ;<nowiki>:foo</nowiki>
13714
13715 ;<nowiki>:foo</nowiki>
13716 :bar
13717
13718 :<nowiki>:foo</nowiki>
13719 !! result
13720 <dl><dt>;foo
13721 </dt></dl>
13722 <dl><dt>:foo
13723 </dt></dl>
13724 <dl><dt>:foo
13725 </dt><dd>bar
13726 </dd></dl>
13727 <dl><dd>:foo
13728 </dd></dl>
13729
13730 !!end
13731
13732 !! test
13733 Lists: 3. Only bullets at start of text should be escaped
13734 !! input
13735 *<nowiki>*foo*bar</nowiki>
13736
13737 *<nowiki>*foo</nowiki>''it''*bar
13738 !! result
13739 <ul><li>*foo*bar
13740 </li></ul>
13741 <ul><li>*foo<i>it</i>*bar
13742 </li></ul>
13743
13744 !!end
13745
13746 !! test
13747 Lists: 4. No escapes needed
13748 !! options
13749 disabled
13750 !! input
13751 *foo*bar
13752
13753 *''foo''*bar
13754
13755 *[[Foo]]: bar
13756 !! result
13757 <ul><li>foo*bar
13758 </li></ul>
13759 <ul><li><i>foo</i>*bar
13760 </li></ul>
13761 <ul><li><a href="Foo" rel="mw:WikiLink">Foo</a>: bar
13762 </li></ul>
13763 !!end
13764
13765 !! test
13766 Lists: 5. No unnecessary escapes
13767 !! input
13768 * bar <span><nowiki>[[foo]]</nowiki></span>
13769
13770 *=bar <span><nowiki>[[foo]]</nowiki></span>
13771
13772 *[[bar <span><nowiki>[[foo]]</nowiki></span>
13773
13774 *<nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
13775
13776 *=bar <span>foo]]</span>=
13777 !! result
13778 <ul><li> bar <span>[[foo]]</span>
13779 </li></ul>
13780 <ul><li>=bar <span>[[foo]]</span>
13781 </li></ul>
13782 <ul><li>[[bar <span>[[foo]]</span>
13783 </li></ul>
13784 <ul><li>]]bar <span>[[foo]]</span>
13785 </li></ul>
13786 <ul><li>=bar <span>foo]]</span>=
13787 </li></ul>
13788
13789 !!end
13790
13791 !! test
13792 Lists: 6. Escape bullets in SOL position
13793 !! options
13794 disabled
13795 !! input
13796 <!--cmt--><nowiki>*foo</nowiki>
13797 !! result
13798 <p><!--cmt-->*foo
13799 </p>
13800 !!end
13801
13802 !! test
13803 Lists: 7. Escape bullets in a multi-line context
13804 !! input
13805 <nowiki>a
13806 *b</nowiki>
13807 !! result
13808 <p>a
13809 *b
13810 </p>
13811 !!end
13812
13813 #### --------------- HRs ---------------
13814 #### 1. Single line
13815 #### -----------------------------------
13816
13817 !! test
13818 HRs: 1. Single line
13819 !! options
13820 disabled
13821 !! input
13822 ----
13823 <nowiki>----</nowiki>
13824 ----
13825 <nowiki>=foo=</nowiki>
13826 ----
13827 <nowiki>*foo</nowiki>
13828 !! result
13829 <hr/>----
13830 <hr/>=foo=
13831 <hr/>*foo
13832 !! end
13833
13834 #### --------------- Tables ---------------
13835 #### 1a. Simple example
13836 #### 1b. No escaping needed (!foo)
13837 #### 1c. No escaping needed (|foo)
13838 #### 1d. No escaping needed (|}foo)
13839 ####
13840 #### 2a. Nested in td (<td>foo|bar</td>)
13841 #### 2b. Nested in td (<td>foo||bar</td>)
13842 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
13843 ####
13844 #### 3a. Nested in th (<th>foo!bar</th>)
13845 #### 3b. Nested in th (<th>foo!!bar</th>)
13846 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
13847 ####
13848 #### 4a. Escape -
13849 #### 4b. Escape +
13850 #### 4c. No escaping needed
13851 #### --------------------------------------
13852
13853 !! test
13854 Tables: 1a. Simple example
13855 !! input
13856 <nowiki>{|
13857 |}</nowiki>
13858 !! result
13859 <p>{|
13860 |}
13861 </p>
13862 !! end
13863
13864 !! test
13865 Tables: 1b. No escaping needed
13866 !! input
13867 !foo
13868 !! result
13869 <p>!foo
13870 </p>
13871 !! end
13872
13873 !! test
13874 Tables: 1c. No escaping needed
13875 !! input
13876 |foo
13877 !! result
13878 <p>|foo
13879 </p>
13880 !! end
13881
13882 !! test
13883 Tables: 1d. No escaping needed
13884 !! input
13885 |}foo
13886 !! result
13887 <p>|}foo
13888 </p>
13889 !! end
13890
13891 !! test
13892 Tables: 2a. Nested in td
13893 !! options
13894 disabled
13895 !! input
13896 {|
13897 |<nowiki>foo|bar</nowiki>
13898 |}
13899 !! result
13900 <table>
13901 <tr><td>foo|bar
13902 </td></tr></table>
13903
13904 !! end
13905
13906 !! test
13907 Tables: 2b. Nested in td
13908 !! options
13909 disabled
13910 !! input
13911 {|
13912 |<nowiki>foo||bar</nowiki>
13913 |''it''<nowiki>foo||bar</nowiki>
13914 |}
13915 !! result
13916 <table>
13917 <tr><td>foo||bar
13918 </td><td><i>it</i>foo||bar
13919 </td></tr></table>
13920
13921 !! end
13922
13923 !! test
13924 Tables: 2c. Nested in td -- no escaping needed
13925 !! options
13926 disabled
13927 !! input
13928 {|
13929 |foo!!bar
13930 |}
13931 !! result
13932 <table>
13933 <tr><td>foo!!bar
13934 </td></tr></table>
13935
13936 !! end
13937
13938 !! test
13939 Tables: 3a. Nested in th
13940 !! options
13941 disabled
13942 !! input
13943 {|
13944 !foo!bar
13945 |}
13946 !! result
13947 <table>
13948 <tr><th>foo!bar
13949 </th></tr></table>
13950
13951 !! end
13952
13953 !! test
13954 Tables: 3b. Nested in th
13955 !! options
13956 disabled
13957 !! input
13958 {|
13959 !<nowiki>foo!!bar</nowiki>
13960 |}
13961 !! result
13962 <table>
13963 <tr><th>foo!!bar
13964 </th></tr></table>
13965
13966 !! end
13967
13968 !! test
13969 Tables: 3c. Nested in th -- no escaping needed
13970 !! options
13971 disabled
13972 !! input
13973 {|
13974 !foo||bar
13975 |}
13976 !! result
13977 <table>
13978 <tr><th>foo||bar
13979 </th></tr></table>
13980
13981 !! end
13982
13983 !! test
13984 Tables: 4a. Escape -
13985 !! options
13986 disabled
13987 !! input
13988 {|
13989 |-
13990 !-bar
13991 |-
13992 |<nowiki>-bar</nowiki>
13993 |}
13994 !! result
13995 <table><tbody>
13996 <tr><th>-bar</th></tr>
13997 <tr><td>-bar</td></tr>
13998 </tbody></table>
13999 !! end
14000
14001 !! test
14002 Tables: 4b. Escape +
14003 !! options
14004 disabled
14005 !! input
14006 {|
14007 |-
14008 !+bar
14009 |-
14010 |<nowiki>+bar</nowiki>
14011 |}
14012 !! result
14013 <table><tbody>
14014 <tr><th>+bar</th></tr>
14015 <tr><td>+bar</td></tr>
14016 </tbody></table>
14017 !! end
14018
14019 !! test
14020 Tables: 4c. No escaping needed
14021 !! options
14022 disabled
14023 !! input
14024 {|
14025 |-
14026 |foo-bar
14027 |foo+bar
14028 |-
14029 |''foo''-bar
14030 |''foo''+bar
14031 |}
14032 !! result
14033 <table><tbody>
14034 <tr><td>foo-bar</td><td>foo+bar</td></tr>
14035 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
14036 </tbody></table>
14037 !! end
14038
14039 !! test
14040 Tables: 4d. No escaping needed
14041 !! input
14042 {|
14043 ||+1
14044 ||-2
14045 |}
14046 !! result
14047 <table>
14048 <tr>
14049 <td>+1
14050 </td>
14051 <td>-2
14052 </td></tr></table>
14053
14054 !! end
14055
14056 #### --------------- Links ---------------
14057 #### 1. Quote marks in link text
14058 #### 2. Wikilinks: Escapes needed
14059 #### 3. Wikilinks: No escapes needed
14060 #### 4. Extlinks: Escapes needed
14061 #### 5. Extlinks: No escapes needed
14062 #### --------------------------------------
14063 !! test
14064 Links 1. Quote marks in link text
14065 !! options
14066 disabled
14067 !! input
14068 [[Foo|<nowiki>Foo''boo''</nowiki>]]
14069 !! result
14070 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
14071 !! end
14072
14073 !! test
14074 Links 2. WikiLinks: Escapes needed
14075 !! options
14076 disabled
14077 !! input
14078 [[Foo|<nowiki>[Foobar]</nowiki>]]
14079 [[Foo|<nowiki>Foobar]</nowiki>]]
14080 [[Foo|<nowiki>x [Foobar] x</nowiki>]]
14081 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
14082 [[Foo|<nowiki>[[Bar]]</nowiki>]]
14083 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
14084 [[Foo|<nowiki>|Bar</nowiki>]]
14085 !! result
14086 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
14087 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
14088 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
14089 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
14090 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
14091 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
14092 <a href="Foo" rel="mw:WikiLink">|Bar</a>
14093 !! end
14094
14095 !! test
14096 Links 3. WikiLinks: No escapes needed
14097 !! options
14098 disabled
14099 !! input
14100 [[Foo|[Foobar]]
14101 [[Foo|foo|bar]]
14102 !! result
14103 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
14104 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
14105 !! end
14106
14107 !! test
14108 Links 4. ExtLinks: Escapes needed
14109 !! options
14110 disabled
14111 !! input
14112 [http://google.com <nowiki>[google]</nowiki>]
14113 [http://google.com <nowiki>google]</nowiki>]
14114 !! result
14115 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
14116 <a href="http://google.com" rel="mw:ExtLink">google]</a>
14117 !! end
14118
14119 !! test
14120 Links 5. ExtLinks: No escapes needed
14121 !! options
14122 disabled
14123 !! input
14124 [http://google.com [google]
14125 !! result
14126 <a href="http://google.com" rel="mw:ExtLink">[google</a>
14127 !! end
14128
14129 #### --------------- Quotes ---------------
14130 #### 1. Quotes inside <b> and <i>
14131 #### 2. Link fragments separated by <i> and <b> tags
14132 #### 3. Link fragments inside <i> and <b>
14133 #### --------------------------------------
14134 !! test
14135 1. Quotes inside <b> and <i>
14136 !! input
14137 ''<nowiki>'foo'</nowiki>''
14138 ''<nowiki>''foo''</nowiki>''
14139 ''<nowiki>'''foo'''</nowiki>''
14140 '''<nowiki>'foo'</nowiki>'''
14141 '''<nowiki>''foo''</nowiki>'''
14142 '''<nowiki>'''foo'''</nowiki>'''
14143 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
14144 !! result
14145 <p><i>'foo'</i>
14146 <i>''foo''</i>
14147 <i>'''foo'''</i>
14148 <b>'foo'</b>
14149 <b>''foo''</b>
14150 <b>'''foo'''</b>
14151 <b>foo'<i>bar'</i>baz</b>
14152 </p>
14153 !! end
14154
14155 !! test
14156 2. Link fragments separated by <i> and <b> tags
14157 !! input
14158 [[''foo''<nowiki>hello]]</nowiki>
14159
14160 [['''foo'''<nowiki>hello]]</nowiki>
14161 !! result
14162 <p>[[<i>foo</i>hello]]
14163 </p><p>[[<b>foo</b>hello]]
14164 </p>
14165 !! end
14166
14167 !! test
14168 2. Link fragments inside <i> and <b>
14169 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
14170 this is one of the shortcomings of this format)
14171 !! input
14172 ''[[foo''<nowiki>]]</nowiki>
14173
14174 '''[[foo'''<nowiki>]]</nowiki>
14175 !! result
14176 <p><i>[[foo</i>]]
14177 </p><p><b>[[foo</b>]]
14178 </p>
14179 !! end
14180
14181 #### --------------- Paragraphs ---------------
14182 #### 1. No unnecessary escapes
14183 #### --------------------------------------
14184
14185 !! test
14186 1. No unnecessary escapes
14187 !! input
14188 bar <span><nowiki>[[foo]]</nowiki></span>
14189
14190 =bar <span><nowiki>[[foo]]</nowiki></span>
14191
14192 [[bar <span><nowiki>[[foo]]</nowiki></span>
14193
14194 <nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
14195
14196 <nowiki>=bar </nowiki><span>foo]]</span>=
14197 !! result
14198 <p>bar <span>[[foo]]</span>
14199 </p><p>=bar <span>[[foo]]</span>
14200 </p><p>[[bar <span>[[foo]]</span>
14201 </p><p>]]bar <span>[[foo]]</span>
14202 </p><p>=bar <span>foo]]</span>=
14203 </p>
14204 !!end
14205
14206 #### --------------- PRE ------------------
14207 #### 1. Leading space in SOL context should be escaped
14208 #### --------------------------------------
14209 !! test
14210 1. Leading space in SOL context should be escaped
14211 !! options
14212 disabled
14213 !! input
14214 <nowiki> foo</nowiki>
14215 <!--cmt--><nowiki> foo</nowiki>
14216 !! result
14217 <p> foo
14218 <!--cmt--> foo
14219 </p>
14220 !! end
14221
14222 #### --------------- HTML tags ---------------
14223 #### 1. a tags
14224 #### 2. other tags
14225 #### 3. multi-line html tag
14226 #### --------------------------------------
14227 !! test
14228 1. a tags
14229 !! options
14230 disabled
14231 !! input
14232 <a href="http://google.com">google</a>
14233 !! result
14234 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
14235 !! end
14236
14237 !! test
14238 2. other tags
14239 !! input
14240 <nowiki><div>foo</div>
14241 <div style="color:red">foo</div></nowiki>
14242 !! result
14243 <p>&lt;div&gt;foo&lt;/div&gt;
14244 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
14245 </p>
14246 !! end
14247
14248 !! test
14249 3. multi-line html tag
14250 !! input
14251 <nowiki><div
14252 >foo</div
14253 ></nowiki>
14254 !! result
14255 <p>&lt;div
14256 &gt;foo&lt;/div
14257 &gt;
14258 </p>
14259 !! end
14260
14261 #### --------------- Others ---------------
14262 !! test
14263 Escaping nowikis
14264 !! input
14265 &lt;nowiki&gt;foo&lt;/nowiki&gt;
14266 !! result
14267 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
14268 </p>
14269 !! end
14270
14271 !! test
14272 Tag-like HTML structures are passed through as text
14273 !! input
14274 <x y>
14275
14276 <x.y>
14277
14278 <x-y>
14279
14280 1>2
14281
14282 x<y
14283
14284 a>b
14285
14286 1<d e>f
14287 !! result
14288 <p>&lt;x y&gt;
14289 </p><p>&lt;x.y&gt;
14290 </p><p>&lt;x-y&gt;
14291 </p><p>1&gt;2
14292 </p><p>x&lt;y
14293 </p><p>a&gt;b
14294 </p><p>1&lt;d e&gt;f
14295 </p>
14296 !! end
14297
14298
14299 # This fails in the PHP parser (see bug 40670,
14300 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
14301 !! test
14302 Tag names followed by punctuation should not be recognized as tags
14303 !! options
14304 disabled
14305 !! input
14306 <s.ome> text
14307 !! result
14308 <p>&lt;s.ome&gt text
14309 </p>
14310 !! end
14311
14312 !! test
14313 HTML tag with necessary entities in attributes
14314 !! input
14315 <span title="&amp;amp;">foo</span>
14316 !! result
14317 <p><span title="&amp;amp;">foo</span>
14318 </p>
14319 !! end
14320
14321 !! test
14322 HTML tag with 'unnecessary' entity encoding in attributes
14323 !! input
14324 <span title="&amp;">foo</span>
14325 !! result
14326 <p><span title="&amp;">foo</span>
14327 </p>
14328 !! end
14329
14330 !! test
14331 HTML tag with broken attribute value quoting
14332 !! input
14333 <span title="Hello world>Foo</span>
14334 !! result
14335 <p><span>Foo</span>
14336 </p>
14337 !! end
14338
14339 !! test
14340 Parsoid-only: HTML tag with broken attribute value quoting
14341 !! options
14342 parsoid
14343 !! input
14344 <span title="Hello world>Foo</span>
14345 !! result
14346 <p><span title="Hello world">Foo</span>
14347 </p>
14348 !! end
14349
14350 !! test
14351 Table with broken attribute value quoting
14352 !! input
14353 {|
14354 | title="Hello world|Foo
14355 |}
14356 !! result
14357 <table>
14358 <tr>
14359 <td>Foo
14360 </td></tr></table>
14361
14362 !! end
14363
14364 !! test
14365 Table with broken attribute value quoting on consecutive lines
14366 !! input
14367 {|
14368 | title="Hello world|Foo
14369 | style="color:red|Bar
14370 |}
14371 !! result
14372 <table>
14373 <tr>
14374 <td>Foo
14375 </td>
14376 <td>Bar
14377 </td></tr></table>
14378
14379 !! end
14380
14381 !! test
14382 Parsoid-only: Table with broken attribute value quoting on consecutive lines
14383 !! options
14384 parsoid
14385 !! input
14386 {|
14387 | title="Hello world|Foo
14388 | style="color:red|Bar
14389 |}
14390 !! result
14391 <table>
14392 <tr>
14393 <td title="Hello world">Foo
14394 </td><td style="color: red">Bar
14395 </td></tr></table>
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 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
14411 !! options
14412 parsoid
14413 !! input
14414 }}{{
14415 !! result
14416 }}{{
14417 !! end
14418
14419 !!test
14420 Accept empty td cell attribute
14421 !!input
14422 {|
14423 | align="center" | foo || |
14424 |}
14425 !!result
14426 <table>
14427 <tr>
14428 <td align="center"> foo </td>
14429 <td>
14430 </td></tr></table>
14431
14432 !!end
14433
14434 !!test
14435 Non-empty attributes in th-cells
14436 !!input
14437 {|
14438 ! Foo !! style="color: red" | Bar
14439 |}
14440 !!result
14441 <table>
14442 <tr>
14443 <th> Foo </th>
14444 <th style="color: red"> Bar
14445 </th></tr></table>
14446
14447 !!end
14448
14449 !!test
14450 Accept empty attributes in th-cells
14451 !!input
14452 {|
14453 !| foo !!| bar
14454 |}
14455 !!result
14456 <table>
14457 <tr>
14458 <th> foo </th>
14459 <th> bar
14460 </th></tr></table>
14461
14462 !!end
14463
14464 !!test
14465 Empty table rows go away
14466 !!input
14467 {|
14468 | Hello
14469 | there
14470 |- class="foo"
14471 |-
14472 |}
14473 !! result
14474 <table>
14475 <tr>
14476 <td> Hello
14477 </td>
14478 <td> there
14479 </td></tr>
14480
14481 </table>
14482
14483 !! end
14484
14485 ###
14486 ### Parsoid-centric tests for testing RTing of inter-element separators
14487 ### Edge cases not tested by existing parser tests and specific to
14488 ### Parsoid-specific serialization strategies.
14489 ###
14490
14491 !!test
14492 RT-ed inter-element separators should be valid separators
14493 !!input
14494 {|
14495 |- [[foo]]
14496 |}
14497 !!result
14498 <table>
14499
14500 </table>
14501
14502 !!end
14503
14504 !!test
14505 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
14506 (Parsoid-only since PHP parser relies on Tidy for correct output)
14507 !!options
14508 disabled parsoid
14509 !!input
14510 {|
14511 |<small>foo
14512 bar
14513 |}
14514
14515 {|
14516 |<small>foo<small>
14517 |}
14518 !!result
14519 !!end
14520
14521 !!test
14522 Empty TD followed by TD with tpl-generated attribute
14523 !!input
14524 {|
14525 |-
14526 |
14527 |{{echo|style='color:red'}}|foo
14528 |}
14529 !!result
14530 <table>
14531
14532 <tr>
14533 <td>
14534 </td>
14535 <td>foo
14536 </td></tr></table>
14537
14538 !!end
14539
14540 !!test
14541 Empty TR followed by a template-generated TR
14542 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
14543 !!options
14544 disabled parsoid
14545 !!input
14546 {|
14547 |-
14548 {{echo|<tr><td>foo</td></tr>}}
14549 |}
14550 !!result
14551 <table>
14552 <tbody>
14553 <tr>
14554 <td></td></tr>
14555 <tr>
14556 <td>foo</td></tr></tbody></table>
14557 !!end
14558
14559 !!test
14560 Multi-line image caption generated by templates with/without trailing newlines
14561 !!options
14562 parsoid
14563 !!input
14564 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
14565 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
14566 !!result
14567 <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>
14568 <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>
14569
14570 !!end
14571
14572 TODO:
14573 more images
14574 more tables
14575 character entities
14576 and much more
14577 Try for 100% code coverage