parserTests: fix broken parsoid-only tests.
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-only test (not run by PHP parser)
25 # php php-only test (not run by the parsoid parser)
26 # showtitle make the first line the title
27 # comment run through Linker::formatComment() instead of main parser
28 # local format section links in edit comment text as local links
29 #
30 # For testing purposes, temporary articles can created:
31 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
32 # where '/' denotes a newline.
33
34 # This is the standard article assumed to exist.
35 !! article
36 Main Page
37 !! text
38 blah blah
39 !! endarticle
40
41 !!article
42 Template:Foo
43 !!text
44 FOO
45 !!endarticle
46
47 !! article
48 Template:Blank
49 !! text
50 !! endarticle
51
52 !! article
53 Template:pipe
54 !! text
55 |
56 !! endarticle
57
58 !!article
59 MediaWiki:bad image list
60 !!text
61 * [[File:Bad.jpg]] except [[Nasty page]]
62 !!endarticle
63
64 !! article
65 Template:inner list
66 !! text
67 * item 1
68 !! endarticle
69
70 !! article
71 Template:tbl-start
72 !! text
73 {|
74 !! endarticle
75
76 !! article
77 Template:tbl-end
78 !! text
79 |}
80 !! endarticle
81
82 !! article
83 Template:!
84 !! text
85 |
86 !! endarticle
87
88 !! article
89 Template:echo
90 !! text
91 {{{1}}}
92 !! endarticle
93
94 !! article
95 Template:echo_with_span
96 !! text
97 <span>{{{1}}}</span>
98 !! endarticle
99
100 !! article
101 Template:echo_with_div
102 !! text
103 <div>{{{1}}}</div>
104 !! endarticle
105
106 !! article
107 Template:attr_str
108 !! text
109 {{{1}}}="{{{2}}}"
110 !! endarticle
111
112 !! article
113 Template:table_attribs
114 !! text
115 <noinclude>
116 |</noinclude>style="color: red"| Foo
117 !! endarticle
118
119 !! article
120 A?b
121 !! text
122 Weirdo titles!
123 !! endarticle
124
125 ###
126 ### Basic tests
127 ###
128 !! test
129 Blank input
130 !! input
131 !! result
132 !! end
133
134
135 !! test
136 Simple paragraph
137 !! input
138 This is a simple paragraph.
139 !! result
140 <p>This is a simple paragraph.
141 </p>
142 !! end
143
144 !! test
145 Paragraphs with extra newline spacing
146 !! input
147 foo
148
149 bar
150
151
152 baz
153
154
155
156 booz
157 !! result
158 <p>foo
159 </p><p>bar
160 </p><p><br />
161 baz
162 </p><p><br />
163 </p><p>booz
164 </p>
165 !! end
166
167 !! test
168 Paragraphs with newline spacing with comment lines in between
169 !! input
170 ----
171 a
172 <!--foo-->
173 b
174 ----
175 a
176 <!--foo--><!--More than 1 comment disables stripping of this line!-->
177 b
178 ----
179 a
180 <!--foo-->
181
182 b
183 ----
184 a
185
186 <!--foo-->
187 b
188 ----
189 a
190 <!--foo-->
191
192
193 b
194 ----
195 a
196
197
198 <!--foo-->
199 b
200 ----
201 !! result
202 <hr />
203 <p>a
204 b
205 </p>
206 <hr />
207 <p>a
208 </p><p>b
209 </p>
210 <hr />
211 <p>a
212 </p><p>b
213 </p>
214 <hr />
215 <p>a
216 </p><p>b
217 </p>
218 <hr />
219 <p>a
220 </p><p><br />
221 b
222 </p>
223 <hr />
224 <p>a
225 </p><p><br />
226 b
227 </p>
228 <hr />
229
230 !! end
231
232 !! test
233 Paragraphs with newline spacing with non-empty white-space lines in between
234 !! input
235 ----
236 a
237
238 b
239 ----
240 a
241
242
243 b
244 ----
245 !! result
246 <hr />
247 <p>a
248 </p><p>b
249 </p>
250 <hr />
251 <p>a
252 </p><p><br />
253 b
254 </p>
255 <hr />
256
257 !! end
258
259 !! test
260 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
261 !! input
262 ----
263 a
264 <!--foo-->
265 b
266 ----
267 a
268 <!--foo--><!--More than 1 comment disables stripping of this line!-->
269 b
270 ----
271 a
272
273 <!--foo-->
274 <!--bar-->
275 b
276 ----
277 a
278
279 <!--foo-->
280 <!--bar-->
281
282 b
283 ----
284 !! result
285 <hr />
286 <p>a
287 b
288 </p>
289 <hr />
290 <p>a
291 </p><p>b
292 </p>
293 <hr />
294 <p>a
295 </p><p>b
296 </p>
297 <hr />
298 <p>a
299 </p><p><br />
300 b
301 </p>
302 <hr />
303
304 !! end
305
306 !! test
307 Parsing an URL
308 !! input
309 http://fr.wikipedia.org/wiki/🍺
310 <!-- EasterEgg we love beer, better be able be able to link to it -->
311 !! result
312 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
313 </p>
314 !! end
315
316 !! test
317 Simple list
318 !! input
319 * Item 1
320 * Item 2
321 !! result
322 <ul><li> Item 1
323 </li><li> Item 2
324 </li></ul>
325
326 !! end
327
328 !! test
329 Italics and bold
330 !! input
331 * plain
332 * plain''italic''plain
333 * plain''italic''plain''italic''plain
334 * plain'''bold'''plain
335 * plain'''bold'''plain'''bold'''plain
336 * plain''italic''plain'''bold'''plain
337 * plain'''bold'''plain''italic''plain
338 * plain''italic'''bold-italic'''italic''plain
339 * plain'''bold''bold-italic''bold'''plain
340 * plain'''''bold-italic'''italic''plain
341 * plain'''''bold-italic''bold'''plain
342 * plain''italic'''bold-italic'''''plain
343 * plain'''bold''bold-italic'''''plain
344 * plain l'''italic''plain
345 * plain l''''bold''' plain
346 !! result
347 <ul><li> plain
348 </li><li> plain<i>italic</i>plain
349 </li><li> plain<i>italic</i>plain<i>italic</i>plain
350 </li><li> plain<b>bold</b>plain
351 </li><li> plain<b>bold</b>plain<b>bold</b>plain
352 </li><li> plain<i>italic</i>plain<b>bold</b>plain
353 </li><li> plain<b>bold</b>plain<i>italic</i>plain
354 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
355 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
356 </li><li> plain<i><b>bold-italic</b>italic</i>plain
357 </li><li> plain<b><i>bold-italic</i>bold</b>plain
358 </li><li> plain<i>italic<b>bold-italic</b></i>plain
359 </li><li> plain<b>bold<i>bold-italic</i></b>plain
360 </li><li> plain l'<i>italic</i>plain
361 </li><li> plain l'<b>bold</b> plain
362 </li></ul>
363
364 !! end
365
366 # this example taken from the simple/Moon article
367 !! test
368 Italics and possessives
369 !! input
370 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
371 !! result
372 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
373 </p>
374 !! end
375
376 ###
377 ### 2-quote opening sequence tests
378 ###
379 !! test
380 Italics and bold: 2-quote opening sequence: (2,2)
381 !! input
382 ''foo''
383 !! result
384 <p><i>foo</i>
385 </p>
386 !!end
387
388
389 !! test
390 Italics and bold: 2-quote opening sequence: (2,3)
391 !! input
392 ''foo'''
393 !! result
394 <p><i>foo'</i>
395 </p>
396 !!end
397
398
399 !! test
400 Italics and bold: 2-quote opening sequence: (2,4)
401 !! input
402 ''foo''''
403 !! result
404 <p><i>foo''</i>
405 </p>
406 !!end
407
408
409 !! test
410 Italics and bold: 2-quote opening sequence: (2,5) (php)
411 !! options
412 php
413 !! input
414 ''foo'''''
415 !! result
416 <p><i>foo</i>
417 </p>
418 !!end
419 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
420 !! test
421 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
422 !! options
423 parsoid
424 !! input
425 ''foo'''''
426 !! result
427 <p><i>foo</i><b></b>
428 </p>
429 !!end
430
431
432 ###
433 ### 3-quote opening sequence tests
434 ###
435
436 !! test
437 Italics and bold: 3-quote opening sequence: (3,2)
438 !! input
439 '''foo''
440 !! result
441 <p>'<i>foo</i>
442 </p>
443 !!end
444
445
446 !! test
447 Italics and bold: 3-quote opening sequence: (3,3)
448 !! input
449 '''foo'''
450 !! result
451 <p><b>foo</b>
452 </p>
453 !!end
454
455
456 !! test
457 Italics and bold: 3-quote opening sequence: (3,4)
458 !! input
459 '''foo''''
460 !! result
461 <p><b>foo'</b>
462 </p>
463 !!end
464
465
466 !! test
467 Italics and bold: 3-quote opening sequence: (3,5) (php)
468 !! options
469 php
470 !! input
471 '''foo'''''
472 !! result
473 <p><b>foo</b>
474 </p>
475 !!end
476 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
477 !! test
478 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
479 !! options
480 parsoid
481 !! input
482 '''foo'''''
483 !! result
484 <p><b>foo<i></i></b>
485 </p>
486 !!end
487
488
489 ###
490 ### 4-quote opening sequence tests
491 ###
492
493 !! test
494 Italics and bold: 4-quote opening sequence: (4,2)
495 !! input
496 ''''foo''
497 !! result
498 <p>''<i>foo</i>
499 </p>
500 !!end
501
502
503 !! test
504 Italics and bold: 4-quote opening sequence: (4,3)
505 !! input
506 ''''foo'''
507 !! result
508 <p>'<b>foo</b>
509 </p>
510 !!end
511
512
513 !! test
514 Italics and bold: 4-quote opening sequence: (4,4)
515 !! input
516 ''''foo''''
517 !! result
518 <p>'<b>foo'</b>
519 </p>
520 !!end
521
522
523 !! test
524 Italics and bold: 4-quote opening sequence: (4,5) (php)
525 !! options
526 php
527 !! input
528 ''''foo'''''
529 !! result
530 <p>'<b>foo</b>
531 </p>
532 !!end
533 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
534 !! test
535 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
536 !! options
537 parsoid
538 !! input
539 ''''foo'''''
540 !! result
541 <p>'<b>foo<i></i></b>
542 </p>
543 !!end
544
545
546 ###
547 ### 5-quote opening sequence tests
548 ###
549
550 !! test
551 Italics and bold: 5-quote opening sequence: (5,2) (php)
552 !! options
553 php
554 !! input
555 '''''foo''
556 !! result
557 <p><b><i>foo</i></b>
558 </p>
559 !!end
560 # Parsoid reverses the nesting order, compared to the PHP parser
561 !! test
562 Italics and bold: 5-quote opening sequence: (5,2) (parsoid)
563 !! options
564 parsoid
565 !! input
566 '''''foo''
567 !! result
568 <p><i><b>foo</b></i>
569 </p>
570 !!end
571
572
573 !! test
574 Italics and bold: 5-quote opening sequence: (5,3)
575 !! input
576 '''''foo'''
577 !! result
578 <p><i><b>foo</b></i>
579 </p>
580 !!end
581
582
583 !! test
584 Italics and bold: 5-quote opening sequence: (5,4)
585 !! input
586 '''''foo''''
587 !! result
588 <p><i><b>foo'</b></i>
589 </p>
590 !!end
591
592
593 !! test
594 Italics and bold: 5-quote opening sequence: (5,5)
595 !! input
596 '''''foo'''''
597 !! result
598 <p><i><b>foo</b></i>
599 </p>
600 !!end
601
602 ###
603 ### multiple quote sequences in a line
604 ###
605 !! test
606 Italics and bold: multiple quote sequences: (2,4,2)
607 !! input
608 ''foo''''bar''
609 !! result
610 <p><i>foo'<b>bar</b></i>
611 </p>
612 !!end
613
614
615 !! test
616 Italics and bold: multiple quote sequences: (2,4,3)
617 !! input
618 ''foo''''bar'''
619 !! result
620 <p><i>foo'<b>bar</b></i>
621 </p>
622 !!end
623
624
625 !! test
626 Italics and bold: multiple quote sequences: (2,4,4)
627 !! input
628 ''foo''''bar''''
629 !! result
630 <p><i>foo'<b>bar'</b></i>
631 </p>
632 !!end
633
634
635 !! test
636 Italics and bold: multiple quote sequences: (3,4,2) (php)
637 !! options
638 php
639 !! input
640 '''foo''''bar''
641 !! result
642 <p><b>foo'</b>bar
643 </p>
644 !!end
645 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
646 !! test
647 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
648 !! options
649 parsoid
650 !! input
651 '''foo''''bar''
652 !! result
653 <p><b>foo'</b>bar<i></i>
654 </p>
655 !!end
656
657
658 !! test
659 Italics and bold: multiple quote sequences: (3,4,3) (php)
660 !! options
661 php
662 !! input
663 '''foo''''bar'''
664 !! result
665 <p><b>foo'</b>bar
666 </p>
667 !!end
668 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
669 !! test
670 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
671 !! options
672 parsoid
673 !! input
674 '''foo''''bar'''
675 !! result
676 <p><b>foo'</b>bar<b></b>
677 </p>
678 !!end
679
680 ###
681 ### other quote tests
682 ###
683 !! test
684 Italics and bold: other quote tests: (2,3,5)
685 !! input
686 ''this is about '''foo's family'''''
687 !! result
688 <p><i>this is about <b>foo's family</b></i>
689 </p>
690 !!end
691
692
693 !! test
694 Italics and bold: other quote tests: (2,(3,3),2)
695 !! input
696 ''this is about '''foo's''' family''
697 !! result
698 <p><i>this is about <b>foo's</b> family</i>
699 </p>
700 !!end
701
702
703 !! test
704 Italics and bold: other quote tests: (3,2,3,2)
705 !! input
706 '''this is about ''foo'''s family''
707 !! result
708 <p><b>this is about <i>foo</i></b><i>s family</i>
709 </p>
710 !!end
711
712
713 # The Parsoid team believes the PHP parser's output on this test is wrong.
714 # It only checks for convert-to-bold-on-single-character-word when the word
715 # matches with a bold tag ("'''") that is *odd* in the list of quote tokens.
716 # This means that the bold token in position 2 (0-indexed) gets converted by
717 # parsoid, but doesn't get changed by the PHP parser.
718 !! test
719 Italics and bold: other quote tests: (3,2,3,3) (php)
720 !! options
721 php
722 !! input
723 '''this is about ''foo'''s family'''
724 !! result
725 <p>'<i>this is about </i>foo<b>s family</b>
726 </p>
727 !!end
728 # This is the output the Parsoid team believes to be correct.
729 !! test
730 Italics and bold: other quote tests: (3,2,3,3) (parsoid)
731 !! options
732 parsoid
733 !! input
734 '''this is about ''foo'''s family'''
735 !! result
736 <p><b>this is about <i>foo'</i>s family</b>
737 </p>
738 !!end
739
740
741 !! test
742 Italics and bold: other quote tests: (3,(2,2),3)
743 !! input
744 '''this is about ''foo's'' family'''
745 !! result
746 <p><b>this is about <i>foo's</i> family</b>
747 </p>
748 !!end
749
750
751 !! test
752 Italicized possessive
753 !! input
754 The ''[[Main Page]]'''s talk page.
755 !! result
756 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
757 </p>
758 !! end
759
760 ###
761 ### Non-html5 tags
762 ###
763
764 !! test
765 Non-html5 tags should be accepted
766 !! input
767 <center>''foo''</center>
768 <big>''foo''</big>
769 <font>''foo''</font>
770 <strike>''foo''</strike>
771 <tt>''foo''</tt>
772 !! result
773 <center><i>foo</i></center>
774 <p><big><i>foo</i></big>
775 <font><i>foo</i></font>
776 <strike><i>foo</i></strike>
777 <tt><i>foo</i></tt>
778 </p>
779 !! end
780
781 ###
782 ### <nowiki> test cases
783 ###
784
785 !! test
786 <nowiki> unordered list
787 !! input
788 <nowiki>* This is not an unordered list item.</nowiki>
789 !! result
790 <p>* This is not an unordered list item.
791 </p>
792 !! end
793
794 !! test
795 <nowiki> spacing
796 !! input
797 <nowiki>Lorem ipsum dolor
798
799 sed abit.
800 sed nullum.
801
802 :and a colon
803 </nowiki>
804 !! result
805 <p>Lorem ipsum dolor
806
807 sed abit.
808 sed nullum.
809
810 :and a colon
811
812 </p>
813 !! end
814
815 !! test
816 nowiki 3
817 !! input
818 :There is not nowiki.
819 :There is <nowiki>nowiki</nowiki>.
820
821 #There is not nowiki.
822 #There is <nowiki>nowiki</nowiki>.
823
824 *There is not nowiki.
825 *There is <nowiki>nowiki</nowiki>.
826 !! result
827 <dl><dd>There is not nowiki.
828 </dd><dd>There is nowiki.
829 </dd></dl>
830 <ol><li>There is not nowiki.
831 </li><li>There is nowiki.
832 </li></ol>
833 <ul><li>There is not nowiki.
834 </li><li>There is nowiki.
835 </li></ul>
836
837 !! end
838
839 !! test
840 Entities inside <nowiki>
841 !! input
842 <nowiki>&lt;</nowiki>
843 !! result
844 <p>&lt;
845 </p>
846 !! end
847
848
849 ###
850 ### Comments
851 ###
852 !! test
853 Comments and Indent-Pre
854 !! input
855 <!-- comment 1 --> asdf
856
857 <!-- comment 1 --> asdf
858 <!-- comment 2 -->
859
860 <!-- comment 1 --> asdf
861 <!-- comment 2 -->xyz
862
863 <!-- comment 1 --> asdf
864 <!-- comment 2 --> xyz
865 !! result
866 <pre>asdf
867 </pre>
868 <pre>asdf
869 </pre>
870 <pre>asdf
871 </pre>
872 <p>xyz
873 </p>
874 <pre>asdf
875 xyz
876 </pre>
877 !! end
878
879 !! test
880 Comment test 2a
881 !! input
882 asdf
883 <!-- comment 1 -->
884 jkl
885 !! result
886 <p>asdf
887 jkl
888 </p>
889 !! end
890
891 !! test
892 Comment test 2b
893 !! input
894 asdf
895 <!-- comment 1 -->
896
897 jkl
898 !! result
899 <p>asdf
900 </p><p>jkl
901 </p>
902 !! end
903
904 !! test
905 Comment test 3
906 !! input
907 asdf
908 <!-- comment 1 -->
909 <!-- comment 2 -->
910 jkl
911 !! result
912 <p>asdf
913 jkl
914 </p>
915 !! end
916
917 !! test
918 Comment test 4
919 !! input
920 asdf<!-- comment 1 -->jkl
921 !! result
922 <p>asdfjkl
923 </p>
924 !! end
925
926 !! test
927 Comment spacing
928 !! input
929 a
930 <!-- foo --> b <!-- bar -->
931 c
932 !! result
933 <p>a
934 </p>
935 <pre> b
936 </pre>
937 <p>c
938 </p>
939 !! end
940
941 !! test
942 Comment whitespace
943 !! input
944 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
945 !! result
946
947 !! end
948
949 !! test
950 Comment semantics and delimiters
951 !! input
952 <!-- --><!----><!-----><!------>
953 !! result
954
955 !! end
956
957 !! test
958 Comment semantics and delimiters, redux
959 !! input
960 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
961 -- foo -- funky huh? ... -->
962 !! result
963
964 !! end
965
966 !! test
967 Comment semantics and delimiters: directors cut
968 !! input
969 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
970 everything starting with < followed by !-- until the first -- and > we see,
971 that wouldn't be valid XML however, since in XML -- has to terminate a comment
972 -->-->
973 !! result
974 <p>--&gt;
975 </p>
976 !! end
977
978 !! test
979 Comment semantics: nesting
980 !! input
981 <!--<!-- no, we're not going to do anything fancy here -->-->
982 !! result
983 <p>--&gt;
984 </p>
985 !! end
986
987 !! test
988 Comment semantics: unclosed comment at end
989 !! input
990 <!--This comment will run out to the end of the document
991 !! result
992
993 !! end
994
995 !! test
996 Comment in template title
997 !! input
998 {{f<!---->oo}}
999 !! result
1000 <p>FOO
1001 </p>
1002 !! end
1003
1004 !! test
1005 Comment on its own line post-expand
1006 !! input
1007 a
1008 {{blank}}<!---->
1009 b
1010 !! result
1011 <p>a
1012 </p><p>b
1013 </p>
1014 !! end
1015
1016 !! test
1017 Comment on its own line post-expand with non-significant whitespace
1018 !! input
1019 a
1020 {{blank}} <!---->
1021 b
1022 !! result
1023 <p>a
1024 </p><p>b
1025 </p>
1026 !! end
1027
1028 ###
1029 ### paragraph wraping tests
1030 ###
1031 !! test
1032 No block tags
1033 !! input
1034 a
1035
1036 b
1037 !! result
1038 <p>a
1039 </p><p>b
1040 </p>
1041 !! end
1042 !! test
1043 Block tag on one line
1044 !! input
1045 a <div>foo</div>
1046
1047 b
1048 !! result
1049 a <div>foo</div>
1050 <p>b
1051 </p>
1052 !! end
1053
1054 !! test
1055 Block tag on both lines
1056 !! input
1057 a <div>foo</div>
1058
1059 b <div>foo</div>
1060 !! result
1061 a <div>foo</div>
1062 b <div>foo</div>
1063
1064 !! end
1065
1066 !! test
1067 Multiple lines without block tags
1068 !! input
1069 <div>foo</div> a
1070 b
1071 c
1072 d<!--foo--> e
1073 x <div>foo</div> z
1074 !! result
1075 <div>foo</div> a
1076 <p>b
1077 c
1078 d e
1079 </p>
1080 x <div>foo</div> z
1081
1082 !! end
1083
1084 !! test
1085 Empty lines between lines with block tags
1086 !! input
1087 <div></div>
1088
1089
1090 <div></div>a
1091
1092 b
1093 <div>a</div>b
1094
1095 <div>b</div>d
1096
1097
1098 <div>e</div>
1099 !! result
1100 <div></div>
1101 <p><br />
1102 </p>
1103 <div></div>a
1104 <p>b
1105 </p>
1106 <div>a</div>b
1107 <div>b</div>d
1108 <p><br />
1109 </p>
1110 <div>e</div>
1111
1112 !! end
1113
1114 ###
1115 ### Preformatted text
1116 ###
1117 !! test
1118 Preformatted text
1119 !! input
1120 This is some
1121 Preformatted text
1122 With ''italic''
1123 And '''bold'''
1124 And a [[Main Page|link]]
1125 !! result
1126 <pre>This is some
1127 Preformatted text
1128 With <i>italic</i>
1129 And <b>bold</b>
1130 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1131 </pre>
1132 !! end
1133
1134 !! test
1135 Ident preformatting with inline content
1136 !! input
1137 a
1138 ''b''
1139 !! result
1140 <pre>a
1141 <i>b</i>
1142 </pre>
1143 !! end
1144
1145 !! test
1146 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1147 !! input
1148 <pre><nowiki>
1149 <b>
1150 <cite>
1151 <em>
1152 </nowiki></pre>
1153 !! result
1154 <pre>
1155 &lt;b&gt;
1156 &lt;cite&gt;
1157 &lt;em&gt;
1158 </pre>
1159
1160 !! end
1161
1162 !! test
1163 Regression with preformatted in <center>
1164 !! input
1165 <center>
1166 Blah
1167 </center>
1168 !! result
1169 <center>
1170 <pre>Blah
1171 </pre>
1172 </center>
1173
1174 !! end
1175
1176 # Expected output in the following test is not really expected (there should be
1177 # <pre> in the output) -- it's only testing for well-formedness.
1178 !! test
1179 Bug 6200: Preformatted in <blockquote>
1180 !! input
1181 <blockquote>
1182 Blah
1183 </blockquote>
1184 !! result
1185 <blockquote>
1186 Blah
1187 </blockquote>
1188
1189 !! end
1190
1191 !! test
1192 <pre> with attributes (bug 3202)
1193 !! input
1194 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1195 !! result
1196 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1197
1198 !! end
1199
1200 !! test
1201 <pre> with width attribute (bug 3202)
1202 !! input
1203 <pre width="8">Narrow screen goodies</pre>
1204 !! result
1205 <pre width="8">Narrow screen goodies</pre>
1206
1207 !! end
1208
1209 !! test
1210 <pre> with forbidden attribute (bug 3202)
1211 !! input
1212 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1213 !! result
1214 <pre width="8">Narrow screen goodies</pre>
1215
1216 !! end
1217
1218 !! test
1219 Entities inside <pre>
1220 !! input
1221 <pre>&lt;</pre>
1222 !! result
1223 <pre>&lt;</pre>
1224
1225 !! end
1226
1227 !! test
1228 <pre> with forbidden attribute values (bug 3202)
1229 !! input
1230 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1231 !! result
1232 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1233
1234 !! end
1235
1236 !! test
1237 <nowiki> inside <pre> (bug 13238)
1238 !! input
1239 <pre>
1240 <nowiki>
1241 </pre>
1242 <pre>
1243 <nowiki></nowiki>
1244 </pre>
1245 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1246 !! result
1247 <pre>
1248 &lt;nowiki&gt;
1249 </pre>
1250 <pre>
1251
1252 </pre>
1253 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1254
1255 !! end
1256
1257 !! test
1258 <nowiki> and <pre> preference (first one wins)
1259 !! input
1260 <pre>
1261 <nowiki>
1262 </pre>
1263 </nowiki>
1264 </pre>
1265
1266 <nowiki>
1267 <pre>
1268 <nowiki>
1269 </pre>
1270 </nowiki>
1271 </pre>
1272
1273 !! result
1274 <pre>
1275 &lt;nowiki&gt;
1276 </pre>
1277 <p>&lt;/nowiki&gt;
1278 &lt;/pre&gt;
1279 </p><p>
1280 &lt;pre&gt;
1281 &lt;nowiki&gt;
1282 &lt;/pre&gt;
1283
1284 &lt;/pre&gt;
1285 </p>
1286 !! end
1287
1288 !! test
1289 </pre> inside nowiki
1290 !! input
1291 <nowiki></pre></nowiki>
1292 !! result
1293 <p>&lt;/pre&gt;
1294 </p>
1295 !! end
1296
1297 !!test
1298 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1299 !!input
1300 {{echo|}}
1301 !!result
1302
1303 !!end
1304
1305 !!test
1306 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1307 !!input
1308 {{echo|
1309 foo}}
1310 !!result
1311 <p>foo
1312 </p>
1313 !!end
1314
1315 !! test
1316 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1317 !! input
1318 {{echo|a
1319 b}}
1320 !!result
1321 <pre>a
1322 </pre>
1323 <p>b
1324 </p>
1325 !!end
1326
1327 !! test
1328 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1329 !! input
1330 {{echo|a
1331 b
1332 c
1333 d
1334 e
1335 }}
1336 !!result
1337 <pre>a
1338 </pre>
1339 <p>b
1340 c
1341 </p>
1342 <pre>d
1343 </pre>
1344 <p>e
1345 </p>
1346 !!end
1347
1348 !!test
1349 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1350 !!input
1351 {{echo| foo}}
1352
1353 {{echo| foo}}{{echo| bar}}
1354
1355 {{echo| foo}}
1356 {{echo| bar}}
1357
1358 {{echo|<!--cmt--> foo}}
1359
1360 <!--cmt-->{{echo| foo}}
1361
1362 {{echo|{{echo| }}bar}}
1363 !!result
1364 <pre>foo
1365 </pre>
1366 <pre>foo bar
1367 </pre>
1368 <pre>foo
1369 bar
1370 </pre>
1371 <pre>foo
1372 </pre>
1373 <pre>foo
1374 </pre>
1375 <pre>bar
1376 </pre>
1377 !!end
1378
1379 !! test
1380 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1381 !! input
1382 {{echo| }}a
1383
1384 {{echo|
1385 }}a
1386
1387 {{echo|
1388 b}}
1389
1390 {{echo|a
1391 }}b
1392
1393 {{echo|a
1394 }} b
1395 !!result
1396 <pre>a
1397 </pre>
1398 <p><br />
1399 </p>
1400 <pre>a
1401 </pre>
1402 <p><br />
1403 </p>
1404 <pre>b
1405 </pre>
1406 <p>a
1407 </p>
1408 <pre>b
1409 </pre>
1410 <p>a
1411 </p>
1412 <pre>b
1413 </pre>
1414 !!end
1415
1416 !! test
1417 Templates: Single-line variant of parameter whitespace stripping test
1418 !! input
1419 {{echo| a}}
1420
1421 {{echo|1= a}}
1422
1423 {{echo|{{echo| a}}}}
1424
1425 {{echo|1={{echo| a}}}}
1426 !! result
1427 <pre>a
1428 </pre>
1429 <p>a
1430 </p>
1431 <pre>a
1432 </pre>
1433 <p>a
1434 </p>
1435 !! end
1436
1437 !! test
1438 Templates: Strip whitespace from named parameters, but not positional ones
1439 !! input
1440 {{echo|
1441 foo}}
1442
1443 {{echo|
1444 * foo}}
1445
1446 {{echo| 1 =
1447 foo}}
1448
1449 {{echo| 1 =
1450 * foo}}
1451 !! result
1452 <pre>foo
1453 </pre>
1454 <p><br />
1455 </p>
1456 <ul><li> foo
1457 </li></ul>
1458 <p>foo
1459 </p>
1460 <ul><li> foo
1461 </li></ul>
1462
1463 !! end
1464
1465 ###
1466 ### Parsoid-centric tests for testing RT edge cases for pre
1467 ###
1468
1469 !!test
1470 1a. Indent-Pre and Comments
1471 !!input
1472 a
1473 <!--a-->
1474 c
1475 !!result
1476 <pre>a
1477 </pre>
1478 <p>c
1479 </p>
1480 !!end
1481
1482 !!test
1483 1b. Indent-Pre and Comments
1484 !!input
1485 a
1486 <!--a-->
1487 c
1488 !!result
1489 <pre>a
1490 </pre>
1491 <p>c
1492 </p>
1493 !!end
1494
1495 !!test
1496 1c. Indent-Pre and Comments
1497 !!input
1498 <!--a--> a
1499
1500 <!--a--> a
1501 !!result
1502 <pre> a
1503 </pre>
1504 <pre> a
1505 </pre>
1506 !!end
1507
1508 !!test
1509 2a. Indent-Pre and tables
1510 !!input
1511 {|
1512 |-
1513 !h1!!h2
1514 |foo||bar
1515 |}
1516 !!result
1517 <table>
1518
1519 <tr>
1520 <th>h1</th>
1521 <th>h2
1522 </th>
1523 <td>foo</td>
1524 <td>bar
1525 </td></tr></table>
1526
1527 !!end
1528
1529 !!test
1530 2b. Indent-Pre and tables
1531 !!input
1532 {|
1533 |-
1534 |foo
1535 |}
1536 !!result
1537 <table>
1538
1539 <tr>
1540 <td>foo
1541 </td></tr></table>
1542
1543 !!end
1544
1545 !!test
1546 2c. Indent-Pre and tables (bug 42252)
1547 !!input
1548 {|
1549 |+ foo
1550 ! | bar
1551 |}
1552 !!result
1553 <table>
1554 <caption> foo
1555 </caption>
1556 <tr>
1557 <th> bar
1558 </th></tr></table>
1559
1560 !!end
1561
1562 !!test
1563 3a. Indent-Pre and block tags (single-line html)
1564 !!input
1565 <p> foo </p>
1566 <div> foo </div>
1567 <span> foo </span>
1568 !!result
1569 <p> foo </p>
1570 <div> foo </div>
1571 <pre><span> foo </span>
1572 </pre>
1573 !!end
1574
1575 !!test
1576 3b. Indent-Pre and block tags (pre-content on separate line)
1577 !!input
1578 <p>
1579 foo
1580 </p>
1581
1582 <div>
1583 foo
1584 </div>
1585
1586 <center>
1587 foo
1588 </center>
1589
1590 <blockquote>
1591 foo
1592 </blockquote>
1593
1594 <table><tr><td>
1595 foo
1596 </td></tr></table>
1597
1598 <ul><li>
1599 foo
1600 </li></ul>
1601
1602 !!result
1603 <p>
1604 foo
1605 </p>
1606 <div>
1607 <pre>foo
1608 </pre>
1609 </div>
1610 <center>
1611 <pre>foo
1612 </pre>
1613 </center>
1614 <blockquote>
1615 foo
1616 </blockquote>
1617 <table><tr><td>
1618 <pre>foo
1619 </pre>
1620 </td></tr></table>
1621 <ul><li>
1622 foo
1623 </li></ul>
1624
1625 !!end
1626
1627 !!test
1628 4. Multiple spaces at start-of-line
1629 !!input
1630 <p> foo </p>
1631 foo
1632 {|
1633 |foo
1634 |}
1635 !!result
1636 <p> foo </p>
1637 <pre> foo
1638 </pre>
1639 <table>
1640 <tr>
1641 <td>foo
1642 </td></tr></table>
1643
1644 !!end
1645
1646 !! test
1647 5. White-space in indent-pre
1648 NOTE: the white-space char on 2nd line is significant
1649 !! input
1650 a<br/>
1651
1652 b
1653 !! result
1654 <pre>a<br />
1655
1656 b
1657 </pre>
1658 !! end
1659
1660 ###
1661 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1662 ###
1663
1664 !!test
1665 HTML-pre: 1. embedded newlines
1666 !!input
1667 <pre>foo</pre>
1668
1669 <pre>
1670 foo
1671 </pre>
1672
1673 <pre>
1674
1675 foo
1676 </pre>
1677
1678 <pre>
1679
1680
1681 foo
1682 </pre>
1683 !!result
1684 <pre>foo</pre>
1685 <pre>
1686 foo
1687 </pre>
1688 <pre>
1689
1690 foo
1691 </pre>
1692 <pre>
1693
1694
1695 foo
1696 </pre>
1697
1698 !!end
1699
1700 !!test
1701 HTML-pre: 2: indented text
1702 !!input
1703 <pre>
1704 foo
1705 </pre>
1706 !!result
1707 <pre>
1708 foo
1709 </pre>
1710
1711 !!end
1712
1713 !!test
1714 HTML-pre: 3: other wikitext
1715 !!input
1716 <pre>
1717 * foo
1718 # bar
1719 = no-h =
1720 '' no-italic ''
1721 [[ NoLink ]]
1722 </pre>
1723 !!result
1724 <pre>
1725 * foo
1726 # bar
1727 = no-h =
1728 '' no-italic ''
1729 [[ NoLink ]]
1730 </pre>
1731
1732 !!end
1733
1734 ###
1735 ### Definition lists
1736 ###
1737 !! test
1738 Simple definition
1739 !! input
1740 ; name : Definition
1741 !! result
1742 <dl><dt> name&#160;</dt><dd> Definition
1743 </dd></dl>
1744
1745 !! end
1746
1747 !! test
1748 Definition list for indentation only
1749 !! input
1750 : Indented text
1751 !! result
1752 <dl><dd> Indented text
1753 </dd></dl>
1754
1755 !! end
1756
1757 !! test
1758 Definition list with no space
1759 !! input
1760 ;name:Definition
1761 !! result
1762 <dl><dt>name</dt><dd>Definition
1763 </dd></dl>
1764
1765 !!end
1766
1767 !! test
1768 Definition list with URL link
1769 !! input
1770 ; http://example.com/ : definition
1771 !! result
1772 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
1773 </dd></dl>
1774
1775 !! end
1776
1777 !! test
1778 Definition list with bracketed URL link
1779 !! input
1780 ;[http://www.example.com/ Example]:Something about it
1781 !! result
1782 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
1783 </dd></dl>
1784
1785 !! end
1786
1787 !! test
1788 Definition list with wikilink containing colon
1789 !! input
1790 ; [[Help:FAQ]]: The least-read page on Wikipedia
1791 !! result
1792 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt><dd> The least-read page on Wikipedia
1793 </dd></dl>
1794
1795 !! end
1796
1797 # At Brion's and JeLuF's insistence... :)
1798 !! test
1799 Definition list with news link containing colon
1800 !! input
1801 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
1802 !! result
1803 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt><dd> This isn't even a real newsgroup!
1804 </dd></dl>
1805
1806 !! end
1807
1808 !! test
1809 Malformed definition list with colon
1810 !! input
1811 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
1812 !! result
1813 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop
1814 </dt></dl>
1815
1816 !! end
1817
1818 !! test
1819 Definition lists: colon in external link text
1820 !! input
1821 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
1822 !! result
1823 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt><dd> OK, I made that up
1824 </dd></dl>
1825
1826 !! end
1827
1828 !! test
1829 Definition lists: colon in HTML attribute
1830 !! input
1831 ;<b style="display: inline">bold</b>
1832 !! result
1833 <dl><dt><b style="display: inline">bold</b>
1834 </dt></dl>
1835
1836 !! end
1837
1838 !! test
1839 Definition lists: self-closed tag
1840 !! input
1841 ;one<br/>two : two-line fun
1842 !! result
1843 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
1844 </dd></dl>
1845
1846 !! end
1847
1848 !! test
1849 Bug 11748: Literal closing tags
1850 !! input
1851 <dl>
1852 <dt>test 1</dt>
1853 <dd>test test test test test</dd>
1854 <dt>test 2</dt>
1855 <dd>test test test test test</dd>
1856 </dl>
1857 !! result
1858 <dl>
1859 <dt>test 1</dt>
1860 <dd>test test test test test</dd>
1861 <dt>test 2</dt>
1862 <dd>test test test test test</dd>
1863 </dl>
1864
1865 !! end
1866
1867 !! test
1868 Definition and unordered list using wiki syntax nested in unordered list using html tags.
1869 !! input
1870 <ul><li>
1871 ; term : description
1872 * unordered
1873 </li>
1874 </ul>
1875 !! result
1876 <ul><li>
1877 <dl><dt> term&#160;</dt><dd> description
1878 </dd></dl>
1879 <ul><li> unordered
1880 </li></ul>
1881 </li>
1882 </ul>
1883
1884 !! end
1885
1886 !! test
1887
1888 Definition list with empty definition and following paragraph
1889 !! input
1890 ; term:
1891 Paragraph text
1892 !! result
1893 <dl><dt> term</dt><dd>
1894 </dd></dl>
1895 <p>Paragraph text
1896 </p>
1897 !! end
1898
1899 !! test
1900 Nested definition lists using html syntax
1901 !! input
1902 <dl><dd>
1903 <dl>
1904 <dd>Foo</dd>
1905 </dl>
1906 </dd></dl>
1907 !! result
1908 <dl><dd>
1909 <dl>
1910 <dd>Foo</dd>
1911 </dl>
1912 </dd></dl>
1913
1914 !! end
1915
1916 !! test
1917 Definition Lists: No nesting: Multiple dd's
1918 !! input
1919 ;x
1920 :a
1921 :b
1922 !! result
1923 <dl><dt>x
1924 </dt><dd>a
1925 </dd><dd>b
1926 </dd></dl>
1927
1928 !! end
1929
1930 !! test
1931 Definition Lists: Indentation: Regular
1932 !! input
1933 :i1
1934 ::i2
1935 :::i3
1936 !! result
1937 <dl><dd>i1
1938 <dl><dd>i2
1939 <dl><dd>i3
1940 </dd></dl>
1941 </dd></dl>
1942 </dd></dl>
1943
1944 !! end
1945
1946 !! test
1947 Definition Lists: Indentation: Missing 1st level
1948 !! input
1949 ::i2
1950 :::i3
1951 !! result
1952 <dl><dd><dl><dd>i2
1953 <dl><dd>i3
1954 </dd></dl>
1955 </dd></dl>
1956 </dd></dl>
1957
1958 !! end
1959
1960 !! test
1961 Definition Lists: Indentation: Multi-level indent
1962 !! input
1963 :::i3
1964 !! result
1965 <dl><dd><dl><dd><dl><dd>i3
1966 </dd></dl>
1967 </dd></dl>
1968 </dd></dl>
1969
1970 !! end
1971
1972 !! test
1973 Definition Lists: Hacky use to indent tables
1974 !! input
1975 ::{|
1976 |foo
1977 |bar
1978 |}
1979 this text
1980 should be left alone
1981 !! result
1982 <dl><dd><dl><dd><table>
1983 <tr>
1984 <td>foo
1985 </td>
1986 <td>bar
1987 </td></tr></table></dd></dl></dd></dl>
1988 <p>this text
1989 should be left alone
1990 </p>
1991 !! end
1992 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
1993 ## as an empty dt item. It also ignores all but the last ";" when followed
1994 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
1995 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
1996 ## ";"s.
1997 ##
1998 ## Ex: ";;t2 ::d2" is transformed into:
1999 ##
2000 ## <dl>
2001 ## <dt>t2 </dt>
2002 ## <dd>
2003 ## <dl>
2004 ## <dt></dt>
2005 ## <dd>d2</dd>
2006 ## </dl>
2007 ## </dd>
2008 ## </dl>
2009 ##
2010 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2011 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2012 ##
2013 ## <dl>
2014 ## <dt>
2015 ## <dl>
2016 ## <dt>t2 </dt>
2017 ## <dd>:d2</dd>
2018 ## </dl>
2019 ## </dt>
2020 ## </dl>
2021 ##
2022 ## All Parsoid only definition list tests have this difference.
2023 ##
2024 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2025 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2026
2027 !! test
2028 Table / list interaction: indented table with lists in table contents
2029 !! input
2030 :{|
2031 |-
2032 | a
2033 * b
2034 |-
2035 | c
2036 * d
2037 |}
2038 !! result
2039 <dl><dd><table>
2040
2041 <tr>
2042 <td> a
2043 <ul><li> b
2044 </li></ul>
2045 </td></tr>
2046 <tr>
2047 <td> c
2048 <ul><li> d
2049 </li></ul>
2050 </td></tr></table></dd></dl>
2051
2052 !! end
2053
2054 !!test
2055 Table / list interaction: lists nested in tables nested in indented lists
2056 !!input
2057 :{|
2058 |
2059 :a
2060 :b
2061 |
2062 *c
2063 *d
2064 |}
2065
2066 *e
2067 *f
2068 !!result
2069 <dl><dd><table>
2070 <tr>
2071 <td>
2072 <dl><dd>a
2073 </dd><dd>b
2074 </dd></dl>
2075 </td>
2076 <td>
2077 <ul><li>c
2078 </li><li>d
2079 </li></ul>
2080 </td></tr></table></dd></dl>
2081 <ul><li>e
2082 </li><li>f
2083 </li></ul>
2084
2085 !!end
2086
2087 !! test
2088 Definition Lists: Nesting: Multi-level (Parsoid only)
2089 !! options
2090 parsoid
2091 !! input
2092 ;t1 :d1
2093 ;;t2 ::d2
2094 ;;;t3 :::d3
2095 !! result
2096 <dl>
2097 <dt>t1 </dt>
2098 <dd>d1</dd>
2099 <dt>
2100 <dl>
2101 <dt>t2 </dt>
2102 <dd>:d2</dd>
2103 <dt>
2104 <dl>
2105 <dt>t3 </dt>
2106 <dd>::d3</dd>
2107 </dl>
2108 </dt>
2109 </dl>
2110 </dt>
2111 </dl>
2112
2113
2114 !! end
2115
2116
2117 !! test
2118 Definition Lists: Nesting: Test 2 (Parsoid only)
2119 !! options
2120 parsoid
2121 !! input
2122 ;t1
2123 ::d2
2124 !! result
2125 <dl>
2126 <dt>t1</dt>
2127 <dd>
2128 <dl>
2129 <dd>d2</dd>
2130 </dl>
2131 </dd>
2132 </dl>
2133
2134 !! end
2135
2136
2137 !! test
2138 Definition Lists: Nesting: Test 3 (Parsoid only)
2139 !! options
2140 parsoid
2141 !! input
2142 :;t1
2143 ::::d2
2144 !! result
2145 <dl>
2146 <dd>
2147 <dl>
2148 <dt>t1</dt>
2149 <dd>
2150 <dl>
2151 <dd>
2152 <dl>
2153 <dd>d2</dd>
2154 </dl>
2155 </dd>
2156 </dl>
2157 </dd>
2158 </dl>
2159 </dd>
2160 </dl>
2161
2162 !! end
2163
2164
2165 !! test
2166 Definition Lists: Nesting: Test 4
2167 !! input
2168 ::;t3
2169 :::d3
2170 !! result
2171 <dl><dd><dl><dd><dl><dt>t3
2172 </dt><dd>d3
2173 </dd></dl>
2174 </dd></dl>
2175 </dd></dl>
2176
2177 !! end
2178
2179
2180 ## The Parsoid team believes the following three test exposes a
2181 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2182 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2183 !! test
2184 Definition Lists: Mixed Lists: Test 1 (php)
2185 !! options
2186 php
2187 !! input
2188 :;* foo
2189 ::* bar
2190 :; baz
2191 !! result
2192 <dl><dd><dl><dt><ul><li> foo
2193 </li><li> bar
2194 </li></ul>
2195 </dt></dl>
2196 <dl><dt> baz
2197 </dt></dl>
2198 </dd></dl>
2199
2200 !! end
2201 !! test
2202 Definition Lists: Mixed Lists: Test 1 (parsoid)
2203 !! options
2204 parsoid
2205 !! input
2206 :;* foo
2207 ::* bar
2208 :; baz
2209 !! result
2210 <dl><dd><dl><dt><ul><li> foo
2211 </li></ul></dt><dd><ul><li> bar
2212 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2213 !! end
2214
2215 !! test
2216 Definition Lists: Mixed Lists: Test 2
2217 !! input
2218 *: d1
2219 *: d2
2220 !! result
2221 <ul><li><dl><dd> d1
2222 </dd><dd> d2
2223 </dd></dl>
2224 </li></ul>
2225
2226 !! end
2227
2228
2229 !! test
2230 Definition Lists: Mixed Lists: Test 3
2231 !! input
2232 *::: d1
2233 *::: d2
2234 !! result
2235 <ul><li><dl><dd><dl><dd><dl><dd> d1
2236 </dd><dd> d2
2237 </dd></dl>
2238 </dd></dl>
2239 </dd></dl>
2240 </li></ul>
2241
2242 !! end
2243
2244
2245 !! test
2246 Definition Lists: Mixed Lists: Test 4
2247 !! input
2248 *;d1 :d2
2249 *;d3 :d4
2250 !! result
2251 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2252 </dd><dt>d3&#160;</dt><dd>d4
2253 </dd></dl>
2254 </li></ul>
2255
2256 !! end
2257
2258
2259 !! test
2260 Definition Lists: Mixed Lists: Test 5
2261 !! input
2262 *:d1
2263 *:: d2
2264 !! result
2265 <ul><li><dl><dd>d1
2266 <dl><dd> d2
2267 </dd></dl>
2268 </dd></dl>
2269 </li></ul>
2270
2271 !! end
2272
2273
2274 !! test
2275 Definition Lists: Mixed Lists: Test 6
2276 !! input
2277 #*:d1
2278 #*::: d3
2279 !! result
2280 <ol><li><ul><li><dl><dd>d1
2281 <dl><dd><dl><dd> d3
2282 </dd></dl>
2283 </dd></dl>
2284 </dd></dl>
2285 </li></ul>
2286 </li></ol>
2287
2288 !! end
2289
2290
2291 !! test
2292 Definition Lists: Mixed Lists: Test 7
2293 !! input
2294 :* d1
2295 :* d2
2296 !! result
2297 <dl><dd><ul><li> d1
2298 </li><li> d2
2299 </li></ul>
2300 </dd></dl>
2301
2302 !! end
2303
2304
2305 !! test
2306 Definition Lists: Mixed Lists: Test 8
2307 !! input
2308 :* d1
2309 ::* d2
2310 !! result
2311 <dl><dd><ul><li> d1
2312 </li></ul>
2313 <dl><dd><ul><li> d2
2314 </li></ul>
2315 </dd></dl>
2316 </dd></dl>
2317
2318 !! end
2319
2320
2321 !! test
2322 Definition Lists: Mixed Lists: Test 9
2323 !! input
2324 *;foo :bar
2325 !! result
2326 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2327 </dd></dl>
2328 </li></ul>
2329
2330 !! end
2331
2332
2333 !! test
2334 Definition Lists: Mixed Lists: Test 10
2335 !! input
2336 *#;foo :bar
2337 !! result
2338 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2339 </dd></dl>
2340 </li></ol>
2341 </li></ul>
2342
2343 !! end
2344
2345 # The Parsoid team disagrees with the PHP parser's seemingly-random
2346 # rules regarding dd/dt on the next two tests. Parsoid is more
2347 # consistent, and recognizes the shared nesting and keeps the
2348 # still-open tags around until the nesting is complete.
2349
2350 !! test
2351 Definition Lists: Mixed Lists: Test 11 (php)
2352 !! options
2353 php
2354 !! input
2355 *#*#;*;;foo :bar
2356 *#*#;boo :baz
2357 !! result
2358 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2359 </dt></dl>
2360 </dd></dl>
2361 </li></ul>
2362 </dd></dl>
2363 <dl><dt>boo&#160;</dt><dd>baz
2364 </dd></dl>
2365 </li></ol>
2366 </li></ul>
2367 </li></ol>
2368 </li></ul>
2369
2370 !! end
2371 !! test
2372 Definition Lists: Mixed Lists: Test 11 (parsoid)
2373 !! options
2374 parsoid
2375 !! input
2376 *#*#;*;;foo :bar
2377 *#*#;boo :baz
2378 !! result
2379 <ul><li><ol><li><ul><li><ol><li><dl><dt><ul><li><dl><dt><dl><dt>foo&nbsp;</dt><dd>bar
2380 </dd></dl></dt></dl></li></ul></dt><dt>boo&nbsp;</dt><dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2381 !! end
2382
2383
2384 !! test
2385 Definition Lists: Weird Ones: Test 1 (php)
2386 !! options
2387 php
2388 !! input
2389 *#;*::;; foo : bar (who uses this?)
2390 !! result
2391 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2392 </dt></dl>
2393 </dd></dl>
2394 </dd></dl>
2395 </dd></dl>
2396 </li></ul>
2397 </dd></dl>
2398 </li></ol>
2399 </li></ul>
2400
2401 !! end
2402 !! test
2403 Definition Lists: Weird Ones: Test 1 (parsoid)
2404 !! options
2405 parsoid
2406 !! input
2407 *#;*::;; foo : bar (who uses this?)
2408 !! result
2409 <ul><li><ol><li><dl><dt><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> foo&nbsp;</dt><dd> bar (who uses this?)</dd></dl></dt></dl></dd></dl></dd></dl></li></ul></dt></dl></li></ol></li></ul>
2410 !! end
2411
2412 ###
2413 ### External links
2414 ###
2415 !! test
2416 External links: non-bracketed
2417 !! input
2418 Non-bracketed: http://example.com
2419 !! result
2420 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2421 </p>
2422 !! end
2423
2424 !! test
2425 External links: numbered
2426 !! input
2427 Numbered: [http://example.com]
2428 Numbered: [http://example.net]
2429 Numbered: [http://example.com]
2430 !! result
2431 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2432 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2433 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2434 </p>
2435 !!end
2436
2437 !! test
2438 External links: specified text
2439 !! input
2440 Specified text: [http://example.com link]
2441 !! result
2442 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2443 </p>
2444 !!end
2445
2446 !! test
2447 External links: trail
2448 !! input
2449 Linktrails should not work for external links: [http://example.com link]s
2450 !! result
2451 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2452 </p>
2453 !! end
2454
2455 !! test
2456 External links: dollar sign in URL
2457 !! input
2458 http://example.com/1$2345
2459 !! result
2460 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2461 </p>
2462 !! end
2463
2464 !! test
2465 External links: dollar sign in URL (named)
2466 !! input
2467 [http://example.com/1$2345]
2468 !! result
2469 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2470 </p>
2471 !!end
2472
2473 !! test
2474 External links: open square bracket forbidden in URL (bug 4377)
2475 !! input
2476 http://example.com/1[2345
2477 !! result
2478 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2479 </p>
2480 !! end
2481
2482 !! test
2483 External links: open square bracket forbidden in URL (named) (bug 4377)
2484 !! input
2485 [http://example.com/1[2345]
2486 !! result
2487 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2488 </p>
2489 !!end
2490
2491 !! test
2492 External links: nowiki in URL link text (bug 6230)
2493 !!input
2494 [http://example.com/ <nowiki>''example site''</nowiki>]
2495 !! result
2496 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2497 </p>
2498 !! end
2499
2500 !! test
2501 External links: newline forbidden in text (bug 6230 regression check)
2502 !! input
2503 [http://example.com/ first
2504 second]
2505 !! result
2506 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2507 second]
2508 </p>
2509 !!end
2510
2511 !! test
2512 External links: Pipe char between url and text
2513 !! input
2514 [http://example.com | link]
2515 !! result
2516 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2517 </p>
2518 !!end
2519
2520 !! test
2521 External links: protocol-relative URL in brackets
2522 !! input
2523 [//example.com/ Test]
2524 !! result
2525 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2526 </p>
2527 !! end
2528
2529 !! test
2530 External links: protocol-relative URL in brackets without text
2531 !! input
2532 [//example.com]
2533 !! result
2534 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2535 </p>
2536 !! end
2537
2538 !! test
2539 External links: protocol-relative URL in free text is left alone
2540 !! input
2541 //example.com/Foo
2542 !! result
2543 <p>//example.com/Foo
2544 </p>
2545 !!end
2546
2547 !! test
2548 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2549 !! input
2550 foo//example.com/Foo
2551 !! result
2552 <p>foo//example.com/Foo
2553 </p>
2554 !! end
2555
2556 !! test
2557 External image
2558 !! input
2559 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2560 !! result
2561 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2562 </p>
2563 !! end
2564
2565 !! test
2566 External image from https
2567 !! input
2568 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2569 !! result
2570 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2571 </p>
2572 !! end
2573
2574 !! test
2575 Link to non-http image, no img tag
2576 !! input
2577 Link to non-http image, no img tag: ftp://example.com/test.jpg
2578 !! result
2579 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
2580 </p>
2581 !! end
2582
2583 !! test
2584 External links: terminating separator
2585 !! input
2586 Terminating separator: http://example.com/thing,
2587 !! result
2588 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2589 </p>
2590 !! end
2591
2592 !! test
2593 External links: intervening separator
2594 !! input
2595 Intervening separator: http://example.com/1,2,3
2596 !! result
2597 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2598 </p>
2599 !! end
2600
2601 !! test
2602 External links: old bug with URL in query
2603 !! input
2604 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2605 !! result
2606 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2607 </p>
2608 !! end
2609
2610 !! test
2611 External links: old URL-in-URL bug, mixed protocols
2612 !! input
2613 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2614 !! result
2615 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2616 </p>
2617 !!end
2618
2619 !! test
2620 External links: URL in text
2621 !! input
2622 URL in text: [http://example.com http://example.com]
2623 !! result
2624 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2625 </p>
2626 !! end
2627
2628 !! test
2629 External links: Clickable images
2630 !! input
2631 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2632 !! result
2633 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
2634 </p>
2635 !!end
2636
2637 !! test
2638 External links: raw ampersand
2639 !! input
2640 Old &amp; use: http://x&y
2641 !! result
2642 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2643 </p>
2644 !! end
2645
2646 !! test
2647 External links: encoded ampersand
2648 !! input
2649 Old &amp; use: http://x&amp;y
2650 !! result
2651 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2652 </p>
2653 !! end
2654
2655 !! test
2656 External links: encoded equals (bug 6102)
2657 !! input
2658 http://example.com/?foo&#61;bar
2659 !! result
2660 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2661 </p>
2662 !! end
2663
2664 !! test
2665 External links: [raw ampersand]
2666 !! input
2667 Old &amp; use: [http://x&y]
2668 !! result
2669 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2670 </p>
2671 !! end
2672
2673 !! test
2674 External links: [encoded ampersand]
2675 !! input
2676 Old &amp; use: [http://x&amp;y]
2677 !! result
2678 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2679 </p>
2680 !! end
2681
2682 !! test
2683 External links: [encoded equals] (bug 6102)
2684 !! input
2685 [http://example.com/?foo&#61;bar]
2686 !! result
2687 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2688 </p>
2689 !! end
2690
2691 !! test
2692 External links: [IDN ignored character reference in hostname; strip it right off]
2693 !! input
2694 [http://e&zwnj;xample.com/]
2695 !! result
2696 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2697 </p>
2698 !! end
2699
2700 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2701 # Where an external link could easily circumvent the sanitization of the text of
2702 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2703 # test demands a higher standard. That's a bit strange.
2704 #
2705 # Example:
2706 #
2707 # http://e‌xample.com -> [http://example.com|http://example.com]
2708 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2709 #
2710 # The first example is sanitized, but the second is not. Any security benefits
2711 # from this production are trivial to circumvent. Either remove this test and
2712 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2713 # the test accordingly.
2714 #
2715 # All our love,
2716 # The Parsoid team.
2717 !! test
2718 External links: IDN ignored character reference in hostname; strip it right off
2719 !! input
2720 http://e&zwnj;xample.com/
2721 !! result
2722 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
2723 </p>
2724 !! end
2725
2726 !! test
2727 External links: www.jpeg.org (bug 554)
2728 !! input
2729 http://www.jpeg.org
2730 !!result
2731 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
2732 </p>
2733 !! end
2734
2735 !! test
2736 External links: URL within URL (original bug 2)
2737 !! input
2738 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
2739 !! result
2740 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
2741 </p>
2742 !! end
2743
2744 !! test
2745 BUG 361: URL inside bracketed URL
2746 !! input
2747 [http://www.example.com/foo http://www.example.com/bar]
2748 !! result
2749 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
2750 </p>
2751 !! end
2752
2753 !! test
2754 BUG 361: URL within URL, not bracketed
2755 !! input
2756 http://www.example.com/foo?=http://www.example.com/bar
2757 !! result
2758 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
2759 </p>
2760 !! end
2761
2762 !! test
2763 BUG 289: ">"-token in URL-tail
2764 !! input
2765 http://www.example.com/<hello>
2766 !! result
2767 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
2768 </p>
2769 !!end
2770
2771 !! test
2772 BUG 289: literal ">"-token in URL-tail
2773 !! input
2774 http://www.example.com/<b>html</b>
2775 !! result
2776 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
2777 </p>
2778 !!end
2779
2780 !! test
2781 BUG 289: ">"-token in bracketed URL
2782 !! input
2783 [http://www.example.com/<hello> stuff]
2784 !! result
2785 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
2786 </p>
2787 !!end
2788
2789 !! test
2790 BUG 289: literal ">"-token in bracketed URL
2791 !! input
2792 [http://www.example.com/<b>html</b> stuff]
2793 !! result
2794 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
2795 </p>
2796 !!end
2797
2798 !! test
2799 BUG 289: literal double quote at end of URL
2800 !! input
2801 http://www.example.com/"hello"
2802 !! result
2803 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
2804 </p>
2805 !!end
2806
2807 !! test
2808 BUG 289: literal double quote in bracketed URL
2809 !! input
2810 [http://www.example.com/"hello" stuff]
2811 !! result
2812 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
2813 </p>
2814 !!end
2815
2816 !! test
2817 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
2818 !! input
2819 [http://www.example.com test]
2820 !! result
2821 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
2822 </p>
2823 !! end
2824
2825 !! test
2826 External links: link text with spaces
2827 !! input
2828 [http://www.example.com a b c]
2829 [http://www.example.com ''a'' ''b'']
2830 !! result
2831 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
2832 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
2833 </p>
2834 !! end
2835
2836 !! test
2837 External links: wiki links within external link (Bug 3695)
2838 !! input
2839 [http://example.com [[wikilink]] embedded in ext link]
2840 !! result
2841 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
2842 </p>
2843 !! end
2844
2845 !! test
2846 BUG 787: Links with one slash after the url protocol are invalid
2847 !! input
2848 http:/example.com
2849
2850 [http:/example.com title]
2851 !! result
2852 <p>http:/example.com
2853 </p><p>[http:/example.com title]
2854 </p>
2855 !! end
2856
2857 !! test
2858 Bracketed external links with template-generated invalid target
2859 !! input
2860 [{{echo|http:/example.com}} title]
2861 !! result
2862 <p>[http:/example.com title]
2863 </p>
2864 !! end
2865
2866 !! test
2867 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
2868 !! input
2869 ''[http://example.com text'']
2870 [http://example.com '''text]'''
2871 ''Something [http://example.com in italic'']
2872 ''Something [http://example.com mixed''''', even bold]'''
2873 '''''Now [http://example.com both''''']
2874 !! result
2875 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
2876 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
2877 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
2878 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
2879 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
2880 </p>
2881 !! end
2882
2883
2884 !! test
2885 Bug 4781: %26 in URL
2886 !! input
2887 http://www.example.com/?title=AT%26T
2888 !! result
2889 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
2890 </p>
2891 !! end
2892
2893 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
2894 # % is actually legal in HTML5. Any change in output would need testing though.
2895 !! test
2896 Bug 4781, 5267: %25 in URL
2897 !! input
2898 http://www.example.com/?title=100%25_Bran
2899 !! result
2900 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
2901 </p>
2902 !! end
2903
2904 !! test
2905 Bug 4781, 5267: %28, %29 in URL
2906 !! input
2907 http://www.example.com/?title=Ben-Hur_%281959_film%29
2908 !! result
2909 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
2910 </p>
2911 !! end
2912
2913
2914 !! test
2915 Bug 4781: %26 in autonumber URL
2916 !! input
2917 [http://www.example.com/?title=AT%26T]
2918 !! result
2919 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
2920 </p>
2921 !! end
2922
2923 !! test
2924 Bug 4781, 5267: %26 in autonumber URL
2925 !! input
2926 [http://www.example.com/?title=100%25_Bran]
2927 !! result
2928 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
2929 </p>
2930 !! end
2931
2932 !! test
2933 Bug 4781, 5267: %28, %29 in autonumber URL
2934 !! input
2935 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
2936 !! result
2937 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
2938 </p>
2939 !! end
2940
2941
2942 !! test
2943 Bug 4781: %26 in bracketed URL
2944 !! input
2945 [http://www.example.com/?title=AT%26T link]
2946 !! result
2947 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
2948 </p>
2949 !! end
2950
2951 !! test
2952 Bug 4781, 5267: %26 in bracketed URL
2953 !! input
2954 [http://www.example.com/?title=100%25_Bran link]
2955 !! result
2956 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
2957 </p>
2958 !! end
2959
2960 !! test
2961 Bug 4781, 5267: %28, %29 in bracketed URL
2962 !! input
2963 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
2964 !! result
2965 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
2966 </p>
2967 !! end
2968
2969 !! test
2970 External link containing double-single-quotes in text '' (bug 4598 sanity check)
2971 !! input
2972 Some [http://example.com/ pretty ''italics'' and stuff]!
2973 !! result
2974 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
2975 </p>
2976 !! end
2977
2978 !! test
2979 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
2980 !! input
2981 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
2982 !! result
2983 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
2984 </p>
2985 !! end
2986
2987 !! test
2988 External link containing double-single-quotes with no space separating the url from text in italics
2989 !! input
2990 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
2991 !! result
2992 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
2993 </p>
2994 !! end
2995
2996 !! test
2997 URL-encoding in URL functions (single parameter)
2998 !! input
2999 {{localurl:Some page|amp=&}}
3000 !! result
3001 <p>/index.php?title=Some_page&amp;amp=&amp;
3002 </p>
3003 !! end
3004
3005 !! test
3006 URL-encoding in URL functions (multiple parameters)
3007 !! input
3008 {{localurl:Some page|q=?&amp=&}}
3009 !! result
3010 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3011 </p>
3012 !! end
3013
3014 !! test
3015 Brackets in urls
3016 !! input
3017 http://example.com/index.php?foozoid%5B%5D=bar
3018
3019 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3020 !! result
3021 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
3022 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
3023 </p>
3024 !! end
3025
3026 !! test
3027 IPv6 urls (bug 21261)
3028 !! options
3029 disabled
3030 !! input
3031 http://[2404:130:0:1000::187:2]/index.php
3032 !! result
3033 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
3034 </p>
3035 !! end
3036
3037 !! test
3038 Non-extlinks in brackets
3039 !! input
3040 [foo]
3041 [foo bar]
3042 [foo ''bar'']
3043 [fool's] errand
3044 [fool's errand]
3045 [{{echo|foo}}]
3046 [{{echo|foo}} bar]
3047 [{{echo|foo}} ''bar'']
3048 [{{echo|foo}}l's] errand
3049 [{{echo|foo}}l's errand]
3050 [url={{echo|foo}}]
3051 [url=http://example.com]
3052 !! result
3053 <p>[foo]
3054 [foo bar]
3055 [foo <i>bar</i>]
3056 [fool's] errand
3057 [fool's errand]
3058 [foo]
3059 [foo bar]
3060 [foo <i>bar</i>]
3061 [fool's] errand
3062 [fool's errand]
3063 [url=foo]
3064 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3065 </p>
3066 !! end
3067
3068 ###
3069 ### Quotes
3070 ###
3071
3072 !! test
3073 Quotes
3074 !! input
3075 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3076
3077 Normal text. '''''Bold italic text.''''' Normal text.
3078 !!result
3079 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3080 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3081 </p>
3082 !! end
3083
3084
3085 !! test
3086 Unclosed and unmatched quotes (php)
3087 !! options
3088 php
3089 !! input
3090 '''''Bold italic text '''with bold deactivated''' in between.'''''
3091
3092 '''''Bold italic text ''with italic deactivated'' in between.'''''
3093
3094 '''Bold text..
3095
3096 ..spanning two paragraphs (should not work).'''
3097
3098 '''Bold tag left open
3099
3100 ''Italic tag left open
3101
3102 Normal text.
3103
3104 <!-- Unmatching number of opening, closing tags: -->
3105 '''This year''''s election ''should'' beat '''last year''''s.
3106
3107 ''Tom'''s car is bigger than ''Susan'''s.
3108
3109 Plain ''italic'''s plain
3110 !! result
3111 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3112 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3113 </p><p><b>Bold text..</b>
3114 </p><p>..spanning two paragraphs (should not work).
3115 </p><p><b>Bold tag left open</b>
3116 </p><p><i>Italic tag left open</i>
3117 </p><p>Normal text.
3118 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3119 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3120 </p><p>Plain <i>italic'</i>s plain
3121 </p>
3122 !! end
3123 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3124 # parser strips. The wikitext contains just the first half of the bold
3125 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3126 # differently than the PHP parser.)
3127 !! test
3128 Unclosed and unmatched quotes (parsoid)
3129 !! options
3130 parsoid
3131 !! input
3132 '''''Bold italic text '''with bold deactivated''' in between.'''''
3133
3134 '''''Bold italic text ''with italic deactivated'' in between.'''''
3135
3136 '''Bold text..
3137
3138 ..spanning two paragraphs (should not work).'''
3139
3140 '''Bold tag left open
3141
3142 ''Italic tag left open
3143
3144 Normal text.
3145
3146 <!-- Unmatching number of opening, closing tags: -->
3147 '''This year''''s election ''should'' beat '''last year''''s.
3148
3149 ''Tom'''s car is bigger than ''Susan'''s.
3150
3151 Plain ''italic'''s plain
3152 !! result
3153 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3154 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3155 </p><p><b>Bold text..</b>
3156 </p><p>..spanning two paragraphs (should not work).<b></b>
3157 </p><p><b>Bold tag left open</b>
3158 </p><p><i>Italic tag left open</i>
3159 </p><p>Normal text.
3160 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3161 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3162 </p><p>Plain <i>italic'</i>s plain
3163 </p>
3164 !! end
3165
3166 ###
3167 ### Tables
3168 ###
3169 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3170 ###
3171
3172 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3173 # is the bare minimun required by the spec, see:
3174 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3175 !! test
3176 A table with no data. (php)
3177 !! options
3178 php
3179 !! input
3180 {||}
3181 !! result
3182 !! end
3183 # Parsoid team replies: empty table tags are legal in HTML5
3184 !! test
3185 A table with no data. (parsoid)
3186 !! options
3187 parsoid
3188 !! input
3189 {||}
3190 !! result
3191 <table></table>
3192 !! end
3193
3194 # A table with nothing but a caption is invalid XHTML, we might want to render
3195 # this as <p>caption</p>
3196 !! test
3197 A table with nothing but a caption (php)
3198 !! options
3199 php
3200 !! input
3201 {|
3202 |+ caption
3203 |}
3204 !! result
3205 <table>
3206 <caption> caption
3207 </caption><tr><td></td></tr></table>
3208
3209 !! end
3210 # Parsoid team replies: table with only a caption is legal in HTML5
3211 !! test
3212 A table with nothing but a caption (parsoid)
3213 !! options
3214 parsoid
3215 !! input
3216 {|
3217 |+ caption
3218 |}
3219 !! result
3220 <table><caption> caption</caption></table>
3221 !! end
3222
3223 !! test
3224 A table with caption with default-spaced attributes and a table row
3225 !! input
3226 {|
3227 |+ style="color: red;" | caption1
3228 |-
3229 | foo
3230 |}
3231 !! result
3232 <table>
3233 <caption style="color: red;"> caption1
3234 </caption>
3235 <tr>
3236 <td> foo
3237 </td></tr></table>
3238
3239 !! end
3240
3241 !! test
3242 A table with captions with non-default spaced attributes and a table row
3243 !! input
3244 {|
3245 |+style="color: red;"|caption2
3246 |+ style="color: red;"| caption3
3247 |-
3248 | foo
3249 |}
3250 !! result
3251 <table>
3252 <caption style="color: red;">caption2
3253 </caption>
3254 <caption style="color: red;"> caption3
3255 </caption>
3256 <tr>
3257 <td> foo
3258 </td></tr></table>
3259
3260 !! end
3261
3262 !! test
3263 Table td-cell syntax variations
3264 !! input
3265 {|
3266 | foo bar foo | baz
3267 | foo bar foo || baz
3268 | style='color:red;' | baz
3269 | style='color:red;' || baz
3270 |}
3271 !! result
3272 <table>
3273 <tr>
3274 <td> baz
3275 </td>
3276 <td> foo bar foo </td>
3277 <td> baz
3278 </td>
3279 <td style="color:red;"> baz
3280 </td>
3281 <td> style='color:red;' </td>
3282 <td> baz
3283 </td></tr></table>
3284
3285 !! end
3286
3287 !! test
3288 Simple table
3289 !! input
3290 {|
3291 | 1 || 2
3292 |-
3293 | 3 || 4
3294 |}
3295 !! result
3296 <table>
3297 <tr>
3298 <td> 1 </td>
3299 <td> 2
3300 </td></tr>
3301 <tr>
3302 <td> 3 </td>
3303 <td> 4
3304 </td></tr></table>
3305
3306 !! end
3307
3308 !! test
3309 Simple table but with multiple dashes for row wikitext
3310 !! input
3311 {|
3312 | foo
3313 |-----
3314 | bar
3315 |}
3316 !! result
3317 <table>
3318 <tr>
3319 <td> foo
3320 </td></tr>
3321 <tr>
3322 <td> bar
3323 </td></tr></table>
3324
3325 !! end
3326 !! test
3327 Multiplication table
3328 !! input
3329 {| border="1" cellpadding="2"
3330 |+Multiplication table
3331 |-
3332 ! &times; !! 1 !! 2 !! 3
3333 |-
3334 ! 1
3335 | 1 || 2 || 3
3336 |-
3337 ! 2
3338 | 2 || 4 || 6
3339 |-
3340 ! 3
3341 | 3 || 6 || 9
3342 |-
3343 ! 4
3344 | 4 || 8 || 12
3345 |-
3346 ! 5
3347 | 5 || 10 || 15
3348 |}
3349 !! result
3350 <table border="1" cellpadding="2">
3351 <caption>Multiplication table
3352 </caption>
3353 <tr>
3354 <th> &#215; </th>
3355 <th> 1 </th>
3356 <th> 2 </th>
3357 <th> 3
3358 </th></tr>
3359 <tr>
3360 <th> 1
3361 </th>
3362 <td> 1 </td>
3363 <td> 2 </td>
3364 <td> 3
3365 </td></tr>
3366 <tr>
3367 <th> 2
3368 </th>
3369 <td> 2 </td>
3370 <td> 4 </td>
3371 <td> 6
3372 </td></tr>
3373 <tr>
3374 <th> 3
3375 </th>
3376 <td> 3 </td>
3377 <td> 6 </td>
3378 <td> 9
3379 </td></tr>
3380 <tr>
3381 <th> 4
3382 </th>
3383 <td> 4 </td>
3384 <td> 8 </td>
3385 <td> 12
3386 </td></tr>
3387 <tr>
3388 <th> 5
3389 </th>
3390 <td> 5 </td>
3391 <td> 10 </td>
3392 <td> 15
3393 </td></tr></table>
3394
3395 !! end
3396
3397 !! test
3398 Accept "||" in table headings
3399 !! input
3400 {|
3401 !h1 || h2
3402 |}
3403 !! result
3404 <table>
3405 <tr>
3406 <th>h1 </th>
3407 <th> h2
3408 </th></tr></table>
3409
3410 !! end
3411
3412 !! test
3413 Accept "||" in indented table headings
3414 !! input
3415 :{|
3416 !h1 || h2
3417 |}
3418 !! result
3419 <dl><dd><table>
3420 <tr>
3421 <th>h1 </th>
3422 <th> h2
3423 </th></tr></table></dd></dl>
3424
3425 !! end
3426
3427 !! test
3428 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3429 !! input
3430 {|
3431 !| h1
3432 || a
3433 |}
3434 !! result
3435 <table>
3436 <tr>
3437 <th> h1
3438 </th>
3439 <td> a
3440 </td></tr></table>
3441
3442 !! end
3443
3444 !!test
3445 Accept "| !" at start of line in tables (ignore !-attribute)
3446 !!input
3447 {|
3448 |-
3449 | !style="color:red" | bar
3450 |}
3451 !!result
3452 <table>
3453
3454 <tr>
3455 <td> bar
3456 </td></tr></table>
3457
3458 !!end
3459
3460 !!test
3461 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
3462 !!input
3463 {|
3464 |-
3465 |style='color:red;'|+1
3466 |style='color:blue;'|-1
3467 |-
3468 | 1 || 2 || 3
3469 | 1 ||+2 ||-3
3470 |-
3471 | +1
3472 | -1
3473 |}
3474 !!result
3475 <table>
3476
3477 <tr>
3478 <td style="color:red;">+1
3479 </td>
3480 <td style="color:blue;">-1
3481 </td></tr>
3482 <tr>
3483 <td> 1 </td>
3484 <td> 2 </td>
3485 <td> 3
3486 </td>
3487 <td> 1 </td>
3488 <td>+2 </td>
3489 <td>-3
3490 </td></tr>
3491 <tr>
3492 <td> +1
3493 </td>
3494 <td> -1
3495 </td></tr></table>
3496
3497 !!end
3498
3499 !! test
3500 Table rowspan
3501 !! input
3502 {| border=1
3503 | Cell 1, row 1
3504 |rowspan=2| Cell 2, row 1 (and 2)
3505 | Cell 3, row 1
3506 |-
3507 | Cell 1, row 2
3508 | Cell 3, row 2
3509 |}
3510 !! result
3511 <table border="1">
3512 <tr>
3513 <td> Cell 1, row 1
3514 </td>
3515 <td rowspan="2"> Cell 2, row 1 (and 2)
3516 </td>
3517 <td> Cell 3, row 1
3518 </td></tr>
3519 <tr>
3520 <td> Cell 1, row 2
3521 </td>
3522 <td> Cell 3, row 2
3523 </td></tr></table>
3524
3525 !! end
3526
3527 !! test
3528 Nested table
3529 !! input
3530 {| border=1
3531 | &alpha;
3532 |
3533 {| bgcolor=#ABCDEF border=2
3534 |nested
3535 |-
3536 |table
3537 |}
3538 |the original table again
3539 |}
3540 !! result
3541 <table border="1">
3542 <tr>
3543 <td> &#945;
3544 </td>
3545 <td>
3546 <table bgcolor="#ABCDEF" border="2">
3547 <tr>
3548 <td>nested
3549 </td></tr>
3550 <tr>
3551 <td>table
3552 </td></tr></table>
3553 </td>
3554 <td>the original table again
3555 </td></tr></table>
3556
3557 !! end
3558
3559 !! test
3560 Invalid attributes in table cell (bug 1830)
3561 !! input
3562 {|
3563 |Cell:|broken
3564 |}
3565 !! result
3566 <table>
3567 <tr>
3568 <td>broken
3569 </td></tr></table>
3570
3571 !! end
3572
3573
3574 !! test
3575 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3576 !! input
3577 {|
3578 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3579 !! result
3580 <table>
3581 <tr>
3582 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3583 <td>]" onmouseover="alert(document.cookie)"&gt;test
3584 </td>
3585 </tr>
3586 </table>
3587
3588 !! end
3589
3590
3591 !! test
3592 Indented table markup mixed with indented pre content (proposed in bug 6200)
3593 !! input
3594 <table>
3595 <tr>
3596 <td>
3597 Text that should be rendered preformatted
3598 </td>
3599 </tr>
3600 </table>
3601 !! result
3602 <table>
3603 <tr>
3604 <td>
3605 <pre>Text that should be rendered preformatted
3606 </pre>
3607 </td>
3608 </tr>
3609 </table>
3610
3611 !! end
3612
3613 !! test
3614 Template-generated table cell attributes and cell content
3615 !! input
3616 {|
3617 |{{table_attribs}}
3618 |}
3619 !! result
3620 <table>
3621 <tr>
3622 <td style="color: red"> Foo
3623 </td></tr></table>
3624
3625 !! end
3626
3627 !! test
3628 Table with row followed by newlines and table heading
3629 !! input
3630 {|
3631 |-
3632
3633 ! foo
3634 |}
3635 !! result
3636 <table>
3637
3638
3639 <tr>
3640 <th> foo
3641 </th></tr></table>
3642
3643 !! end
3644
3645 !! test
3646 Table with empty line following the start tag
3647 !! input
3648 {|
3649
3650 |-
3651 | foo
3652 |}
3653 !! result
3654 <table>
3655
3656
3657 <tr>
3658 <td> foo
3659 </td></tr></table>
3660
3661 !! end
3662
3663 # FIXME: Preserve the attribute properly (with an empty string as value) in
3664 # the PHP parser. Parsoid implements the behavior below.
3665 !! test
3666 Table attributes with empty value
3667 !! options
3668 parsoid
3669 !! input
3670 {|
3671 | style=| hello
3672 |}
3673 !! result
3674 <table>
3675 <tbody>
3676 <tr>
3677 <td style=""> hello
3678 </td></tr></tbody></table>
3679
3680 !! end
3681
3682 !! test
3683 Wikitext table with a lot of comments
3684 !! input
3685 {|
3686 <!-- c0 -->
3687 | foo
3688 <!-- c1 -->
3689 |- <!-- c2 -->
3690 <!-- c3 -->
3691 |<!-- c4 -->
3692 <!-- c5 -->
3693 |}
3694 !! result
3695 <table>
3696 <tr>
3697 <td> foo
3698 </td></tr>
3699 <tr>
3700 <td>
3701 </td></tr></table>
3702
3703 !! end
3704
3705 !! test
3706 Wikitext table with double-line table cell
3707 !! input
3708 {|
3709 |a
3710 b
3711 |}
3712 !! result
3713 <table>
3714 <tr>
3715 <td>a
3716 <p>b
3717 </p>
3718 </td></tr></table>
3719
3720 !! end
3721
3722 !! test
3723 Table cell with a single comment
3724 !! input
3725 {|
3726 | <!-- c1 -->
3727 | a
3728 |}
3729 !! result
3730 <table>
3731 <tr>
3732 <td>
3733 </td>
3734 <td> a
3735 </td></tr></table>
3736
3737 !! end
3738
3739 # The expected HTML structure in this test is debatable. The PHP parser does
3740 # not parse this kind of table at all. The main focus for Parsoid is on
3741 # round-tripping, so this output is ok for now. TODO: revisit!
3742 !! test
3743 Wikitext table with html-syntax row (Parsoid)
3744 !! options
3745 parsoid
3746 !! input
3747 {|
3748 |-
3749 <td>foo</td>
3750 |}
3751 !! result
3752 <table>
3753 <tbody>
3754 <tr>
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 an equals sign
3975 !! input
3976 [[Special:BookSources/isbn=4-00-026157-6]]
3977 !! result
3978 <p><a href="/wiki/Special:BookSources/isbn%3D4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a>
3979 </p>
3980 !! end
3981
3982 !! article
3983 Foo~bar
3984 !! text
3985 Just a test of an article title containing a tilde.
3986 !! endarticle
3987
3988 # note that links containing signatures, like [[Foo~~~~]], are
3989 # massaged by the pre-save transform (PST) and so the tildes are never
3990 # seen by the parser.
3991 !! test
3992 Link containing a tilde
3993 !! input
3994 [[Foo~bar]]
3995 !! result
3996 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
3997 </p>
3998 !! end
3999
4000 !! test
4001 Link containing double-single-quotes '' (bug 4598)
4002 !! input
4003 [[Lista d''e paise d''o munno]]
4004 !! result
4005 <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>
4006 </p>
4007 !! end
4008
4009 !! test
4010 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4011 !! input
4012 Some [[Link|pretty ''italics'' and stuff]]!
4013 !! result
4014 <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>!
4015 </p>
4016 !! end
4017
4018 !! test
4019 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4020 !! input
4021 ''Some [[Link|pretty ''italics'' and stuff]]!
4022 !! result
4023 <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>
4024 </p>
4025 !! end
4026
4027 !! test
4028 Link with double quotes in title part (literal) and alternate part (interpreted)
4029 !! input
4030 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4031
4032 [[''Pentecoste'']]
4033
4034 [[''Pentecoste''|Pentecoste]]
4035
4036 [[''Pentecoste''|''Pentecoste'']]
4037 !! result
4038 <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>
4039 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
4040 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
4041 </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>
4042 </p>
4043 !! end
4044
4045 !! test
4046 Broken image links with HTML captions (bug 39700)
4047 !! input
4048 [[File:Nonexistent|<script></script>]]
4049 [[File:Nonexistent|100px|<script></script>]]
4050 [[File:Nonexistent|&lt;]]
4051 [[File:Nonexistent|a<i>b</i>c]]
4052 !! result
4053 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4054 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4055 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4056 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4057 </p>
4058 !! end
4059
4060 !! test
4061 Plain link to URL
4062 !! input
4063 [[http://www.example.com]]
4064 !! result
4065 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4066 </p>
4067 !! end
4068
4069 !! test
4070 Plain link to URL with link text
4071 !! input
4072 [[http://www.example.com Link text]]
4073 !! result
4074 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4075 </p>
4076 !! end
4077
4078 !! test
4079 Plain link to protocol-relative URL
4080 !! input
4081 [[//www.example.com]]
4082 !! result
4083 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4084 </p>
4085 !! end
4086
4087 !! test
4088 Plain link to protocol-relative URL with link text
4089 !! input
4090 [[//www.example.com Link text]]
4091 !! result
4092 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4093 </p>
4094 !! end
4095
4096 !! test
4097 Plain link to page with question mark in title
4098 !! input
4099 [[A?b]]
4100
4101 [[A?b|Baz]]
4102 !! result
4103 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4104 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4105 </p>
4106 !! end
4107
4108
4109 # I'm fairly sure the expected result here is wrong.
4110 # We want these to be URL links, not pseudo-pages with URLs for titles....
4111 # However the current output is also pretty screwy.
4112 #
4113 # ----
4114 # I'm changing it to match the current output--it arguably makes more
4115 # sense in the light of the test above. Old expected result was:
4116 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4117 #</p>
4118 # But I think this test is bordering on "garbage in, garbage out" anyway.
4119 # -- wtm
4120 !! test
4121 Piped link to URL
4122 !! input
4123 Piped link to URL: [[http://www.example.com|an example URL]]
4124 !! result
4125 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4126 </p>
4127 !! end
4128
4129 !! test
4130 BUG 2: [[page|http://url/]] should link to page, not http://url/
4131 !! input
4132 [[Main Page|http://url/]]
4133 !! result
4134 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4135 </p>
4136 !! end
4137
4138 !! test
4139 BUG 337: Escaped self-links should be bold
4140 !! options
4141 title=[[Bug462]]
4142 !! input
4143 [[Bu&#103;462]] [[Bug462]]
4144 !! result
4145 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4146 </p>
4147 !! end
4148
4149 !! test
4150 Self-link to section should not be bold
4151 !! options
4152 title=[[Main Page]]
4153 !! input
4154 [[Main Page#section]]
4155 !! result
4156 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4157 </p>
4158 !! end
4159
4160 !! article
4161 00
4162 !! text
4163 This is 00.
4164 !! endarticle
4165
4166 !!test
4167 Self-link to numeric title
4168 !!options
4169 title=[[0]]
4170 !!input
4171 [[0]]
4172 !!result
4173 <p><strong class="selflink">0</strong>
4174 </p>
4175 !!end
4176
4177 !!test
4178 Link to numeric-equivalent title
4179 !!options
4180 title=[[0]]
4181 !!input
4182 [[00]]
4183 !!result
4184 <p><a href="/wiki/00" title="00">00</a>
4185 </p>
4186 !!end
4187
4188 !! test
4189 <nowiki> inside a link
4190 !! input
4191 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4192 !! result
4193 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4194 </p>
4195 !! end
4196
4197 !! test
4198 Non-breaking spaces in title
4199 !! input
4200 [[&nbsp; Main &nbsp; Page &nbsp;]]
4201 !! result
4202 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4203 </p>
4204 !!end
4205
4206 !! test
4207 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4208 !! options
4209 language=ca
4210 !! input
4211 '''[[Main Page]]'''
4212 !! result
4213 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4214 </p>
4215 !! end
4216
4217 !! test
4218 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4219 !! options
4220 language=ca
4221 !! input
4222 ''[[Main Page]]''
4223 !! result
4224 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4225 </p>
4226 !! end
4227
4228 !! test
4229 Internal link with en linktrail: no apostrophes (bug 27473)
4230 !! options
4231 language=en
4232 !! input
4233 [[Something]]'nice
4234 !! result
4235 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4236 </p>
4237 !! end
4238
4239 !! test
4240 Internal link with ca linktrail with apostrophes (bug 27473)
4241 !! options
4242 language=ca
4243 !! input
4244 [[Something]]'nice
4245 !! result
4246 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4247 </p>
4248 !! end
4249
4250 !! test
4251 Internal link with kaa linktrail with apostrophes (bug 27473)
4252 !! options
4253 language=kaa
4254 !! input
4255 [[Something]]'nice
4256 !! result
4257 <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>
4258 </p>
4259 !! end
4260
4261 !! article
4262 Söfnuður
4263 !! text
4264 Test.
4265 !! endarticle
4266
4267 !! test
4268 Internal link with is link prefix
4269 !! options
4270 language=is
4271 !! input
4272 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
4273 !! result
4274 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
4275 </p>
4276 !! end
4277
4278 !! article
4279 Mótmælendatrú
4280 !! text
4281 Test.
4282 !! endarticle
4283
4284 !! test
4285 Internal link with is link trail and link prefix
4286 !! options
4287 language=is
4288 !! input
4289 [[mótmælendatrú|xxx]]ar
4290 [[mótmælendatrú]]ar
4291 mótmælenda[[söfnuður]]
4292 mótmælenda[[söfnuður|söfnuðir]]
4293 mótmælenda[[söfnuður|söfnuðir]]xxx
4294 !! result
4295 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
4296 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
4297 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
4298 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
4299 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
4300 </p>
4301 !! end
4302
4303 !! test
4304 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4305 !! input
4306 [[Foo| bar]]
4307
4308 [[Foo| ''bar'']]
4309
4310 [http://wp.org foo]
4311
4312 [http://wp.org ''foo'']
4313 !! result
4314 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
4315 </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>
4316 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4317 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4318 </p>
4319 !! end
4320
4321 ###
4322 ### Interwiki links (see maintenance/interwiki.sql)
4323 ###
4324
4325 !! test
4326 Inline interwiki link
4327 !! input
4328 [[MeatBall:SoftSecurity]]
4329 !! result
4330 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4331 </p>
4332 !! end
4333
4334 !! test
4335 Inline interwiki link with empty title (bug 2372)
4336 !! input
4337 [[MeatBall:]]
4338 !! result
4339 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4340 </p>
4341 !! end
4342
4343 !! test
4344 Interwiki link encoding conversion (bug 1636)
4345 !! input
4346 *[[Wikipedia:ro:Olteni&#0355;a]]
4347 *[[Wikipedia:ro:Olteni&#355;a]]
4348 !! result
4349 <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>
4350 </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>
4351 </li></ul>
4352
4353 !! end
4354
4355 !! test
4356 Interwiki link with fragment (bug 2130)
4357 !! input
4358 [[MeatBall:SoftSecurity#foo]]
4359 !! result
4360 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4361 </p>
4362 !! end
4363
4364 !! test
4365 Interlanguage link
4366 !! input
4367 Blah blah blah
4368 [[zh:Chinese]]
4369 !!result
4370 <p>Blah blah blah
4371 </p>
4372 !! end
4373
4374 !! test
4375 Double interlanguage link
4376 !! input
4377 Blah blah blah
4378 [[es:Spanish]]
4379 [[zh:Chinese]]
4380 !!result
4381 <p>Blah blah blah
4382 </p>
4383 !! end
4384
4385 !! test
4386 Interlanguage link, with prefix links
4387 !! options
4388 language=ln
4389 !! input
4390 Blah blah blah
4391 [[zh:Chinese]]
4392 !!result
4393 <p>Blah blah blah
4394 </p>
4395 !! end
4396
4397 !! test
4398 Double interlanguage link, with prefix links (bug 8897)
4399 !! options
4400 language=ln
4401 !! input
4402 Blah blah blah
4403 [[es:Spanish]]
4404 [[zh:Chinese]]
4405 !!result
4406 <p>Blah blah blah
4407 </p>
4408 !! end
4409
4410 !! test
4411 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4412 !! options
4413 language=ln
4414 !! input
4415 [[WW&nbsp;II]]
4416 !!result
4417 <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>
4418 </p>
4419 !! end
4420
4421 ##
4422 ## XHTML tidiness
4423 ###
4424
4425 !! test
4426 <br> to <br />
4427 !! input
4428 1<br>2<br />3
4429 !! result
4430 <p>1<br />2<br />3
4431 </p>
4432 !! end
4433
4434 !! test
4435 Broken br tag sanitization
4436 !! input
4437 </br>
4438 !! result
4439 <p>&lt;/br&gt;
4440 </p>
4441 !! end
4442
4443 !! test
4444 Incorrecly removing closing slashes from correctly formed XHTML
4445 !! input
4446 <br style="clear:both;" />
4447 !! result
4448 <p><br style="clear:both;" />
4449 </p>
4450 !! end
4451
4452 !! test
4453 Failing to transform badly formed HTML into correct XHTML
4454 !! input
4455 <br style="clear: left;">
4456 <br style="clear: right;">
4457 <br style="clear: both;">
4458 !! result
4459 <p><br style="clear: left;" />
4460 <br style="clear: right;" />
4461 <br style="clear: both;" />
4462 </p>
4463 !!end
4464
4465 !! test
4466 Handling html with a div self-closing tag
4467 !! input
4468 <div title />
4469 <div title/>
4470 <div title/ >
4471 <div title=bar />
4472 <div title=bar/>
4473 <div title=bar/ >
4474 !! result
4475 <p>&lt;div title /&gt;
4476 &lt;div title/&gt;
4477 </p>
4478 <div>
4479 <p>&lt;div title=bar /&gt;
4480 &lt;div title=bar/&gt;
4481 </p>
4482 <div title="bar/"></div>
4483 </div>
4484
4485 !! end
4486
4487 !! test
4488 Handling html with a br self-closing tag
4489 !! input
4490 <br title />
4491 <br title/>
4492 <br title/ >
4493 <br title=bar />
4494 <br title=bar/>
4495 <br title=bar/ >
4496 !! result
4497 <p><br title="title" />
4498 <br title="title" />
4499 <br />
4500 <br title="bar" />
4501 <br title="bar" />
4502 <br title="bar/" />
4503 </p>
4504 !! end
4505
4506 !! test
4507 Horizontal ruler (should it add that extra space?)
4508 !! input
4509 <hr>
4510 <hr >
4511 foo <hr
4512 > bar
4513 !! result
4514 <hr />
4515 <hr />
4516 foo <hr /> bar
4517
4518 !! end
4519
4520 !! test
4521 Horizontal ruler -- 4+ dashes render hr
4522 !! input
4523 ----
4524 !! result
4525 <hr />
4526
4527 !! end
4528
4529 !! test
4530 Horizontal ruler -- eats additional dashes on the same line
4531 !! input
4532 ---------
4533 !! result
4534 <hr />
4535
4536 !! end
4537
4538 !! test
4539 Horizontal ruler -- does not collapse dashes on consecutive lines
4540 !! input
4541 ----
4542 ----
4543 !! result
4544 <hr />
4545 <hr />
4546
4547 !! end
4548
4549 !! test
4550 Horizontal ruler -- <4 dashes render as plain text
4551 !! input
4552 ---
4553 !! result
4554 <p>---
4555 </p>
4556 !! end
4557
4558 !! test
4559 Horizontal ruler -- Supports content following dashes on same line
4560 !! input
4561 ---- Foo
4562 !! result
4563 <hr /> Foo
4564
4565 !! end
4566
4567 ###
4568 ### Block-level elements
4569 ###
4570 !! test
4571 Common list
4572 !! input
4573 *Common list
4574 * item 2
4575 *item 3
4576 !! result
4577 <ul><li>Common list
4578 </li><li> item 2
4579 </li><li>item 3
4580 </li></ul>
4581
4582 !! end
4583
4584 !! test
4585 Numbered list
4586 !! input
4587 #Numbered list
4588 #item 2
4589 # item 3
4590 !! result
4591 <ol><li>Numbered list
4592 </li><li>item 2
4593 </li><li> item 3
4594 </li></ol>
4595
4596 !! end
4597
4598 !! test
4599 Mixed list
4600 !! input
4601 *Mixed list
4602 *# with numbers
4603 ** and bullets
4604 *# and numbers
4605 *bullets again
4606 **bullet level 2
4607 ***bullet level 3
4608 ***#Number on level 4
4609 **bullet level 2
4610 **#Number on level 3
4611 **#Number on level 3
4612 *#number level 2
4613 *Level 1
4614 *** Level 3
4615 #** Level 3, but ordered
4616 !! result
4617 <ul><li>Mixed list
4618 <ol><li> with numbers
4619 </li></ol>
4620 <ul><li> and bullets
4621 </li></ul>
4622 <ol><li> and numbers
4623 </li></ol>
4624 </li><li>bullets again
4625 <ul><li>bullet level 2
4626 <ul><li>bullet level 3
4627 <ol><li>Number on level 4
4628 </li></ol>
4629 </li></ul>
4630 </li><li>bullet level 2
4631 <ol><li>Number on level 3
4632 </li><li>Number on level 3
4633 </li></ol>
4634 </li></ul>
4635 <ol><li>number level 2
4636 </li></ol>
4637 </li><li>Level 1
4638 <ul><li><ul><li> Level 3
4639 </li></ul>
4640 </li></ul>
4641 </li></ul>
4642 <ol><li><ul><li><ul><li> Level 3, but ordered
4643 </li></ul>
4644 </li></ul>
4645 </li></ol>
4646
4647 !! end
4648
4649 !! test
4650 Nested lists 1
4651 !! input
4652 *foo
4653 **bar
4654 !! result
4655 <ul><li>foo
4656 <ul><li>bar
4657 </li></ul>
4658 </li></ul>
4659
4660 !! end
4661
4662 !! test
4663 Nested lists 2
4664 !! input
4665 **foo
4666 *bar
4667 !! result
4668 <ul><li><ul><li>foo
4669 </li></ul>
4670 </li><li>bar
4671 </li></ul>
4672
4673 !! end
4674
4675 !! test
4676 Nested lists 3 (first element empty)
4677 !! input
4678 *
4679 **bar
4680 !! result
4681 <ul><li>
4682 <ul><li>bar
4683 </li></ul>
4684 </li></ul>
4685
4686 !! end
4687
4688 !! test
4689 Nested lists 4 (first element empty)
4690 !! input
4691 **
4692 *bar
4693 !! result
4694 <ul><li><ul><li>
4695 </li></ul>
4696 </li><li>bar
4697 </li></ul>
4698
4699 !! end
4700
4701 !! test
4702 Nested lists 5 (both elements empty)
4703 !! input
4704 **
4705 *
4706 !! result
4707 <ul><li><ul><li>
4708 </li></ul>
4709 </li><li>
4710 </li></ul>
4711
4712 !! end
4713
4714 !! test
4715 Nested lists 6 (both elements empty)
4716 !! input
4717 *
4718 **
4719 !! result
4720 <ul><li>
4721 <ul><li>
4722 </li></ul>
4723 </li></ul>
4724
4725 !! end
4726
4727 !! test
4728 Nested lists 7 (skip initial nesting levels)
4729 !! input
4730 *** foo
4731 !! result
4732 <ul><li><ul><li><ul><li> foo
4733 </li></ul>
4734 </li></ul>
4735 </li></ul>
4736
4737 !! end
4738
4739 !! test
4740 Nested lists 8 (multiple nesting transitions)
4741 !! input
4742 * foo
4743 *** bar
4744 ** baz
4745 * boo
4746 !! result
4747 <ul><li> foo
4748 <ul><li><ul><li> bar
4749 </li></ul>
4750 </li><li> baz
4751 </li></ul>
4752 </li><li> boo
4753 </li></ul>
4754
4755 !! end
4756
4757 !! test
4758 1. Lists with start-of-line-transparent tokens before bullets: Comments
4759 !! input
4760 *foo
4761 *<!--cmt-->bar
4762 <!--cmt-->*baz
4763 !! result
4764 <ul><li>foo
4765 </li><li>bar
4766 </li><li>baz
4767 </li></ul>
4768
4769 !! end
4770
4771 !! test
4772 2. Lists with start-of-line-transparent tokens before bullets: Template close
4773 !! input
4774 *foo {{echo|bar
4775 }}*baz
4776 !! result
4777 <ul><li>foo bar
4778 </li><li>baz
4779 </li></ul>
4780
4781 !! end
4782
4783 !! test
4784 Unbalanced closing block tags break a list
4785 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
4786 !! options
4787 parsoid
4788 !! input
4789 <div>
4790 *a</div><div>
4791 *b</div>
4792 !! result
4793 <div>
4794 <ul><li>a
4795 </li></ul></div><div>
4796 <ul><li>b
4797 </li></ul></div>
4798 !! end
4799
4800 !! test
4801 Unbalanced closing non-block tags don't break a list
4802 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
4803 !! options
4804 parsoid
4805 !! input
4806 <span>
4807 *a</span><span>
4808 *b</span>
4809 !! result
4810 <p><span></span>
4811 </p>
4812 <ul><li>a<span></span>
4813 </li><li>b
4814 </li></ul>
4815 !! end
4816
4817 !! test
4818 Unclosed formatting tags that straddle lists are closed and reopened
4819 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
4820 !! options
4821 parsoid
4822 !! input
4823 # <s> a
4824 # b </s>
4825 !! result
4826 <ol><li> <s> a </s>
4827 </li><li> <s> b </s>
4828 </li></ol>
4829 !! end
4830
4831 !!test
4832 List embedded in a non-block tag
4833 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
4834 !! options
4835 parsoid
4836 !!input
4837 <small>
4838 * foo
4839 </small>
4840 !!result
4841 <p><small></small></p>
4842 <small>
4843 <ul>
4844 <li> foo</li>
4845 </ul>
4846 </small>
4847 <p><small></small></p>
4848 !!end
4849
4850 !! test
4851 List items are not parsed correctly following a <pre> block (bug 785)
4852 !! input
4853 * <pre>foo</pre>
4854 * <pre>bar</pre>
4855 * zar
4856 !! result
4857 <ul><li> <pre>foo</pre>
4858 </li><li> <pre>bar</pre>
4859 </li><li> zar
4860 </li></ul>
4861
4862 !! end
4863
4864 !! test
4865 List items from template
4866 !! input
4867
4868 {{inner list}}
4869 * item 2
4870
4871 * item 0
4872 {{inner list}}
4873 * item 2
4874
4875 * item 0
4876 * notSOL{{inner list}}
4877 * item 2
4878 !! result
4879 <ul><li> item 1
4880 </li><li> item 2
4881 </li></ul>
4882 <ul><li> item 0
4883 </li><li> item 1
4884 </li><li> item 2
4885 </li></ul>
4886 <ul><li> item 0
4887 </li><li> notSOL
4888 </li><li> item 1
4889 </li><li> item 2
4890 </li></ul>
4891
4892 !! end
4893
4894 !! test
4895 List interrupted by empty line or heading
4896 !! input
4897 * foo
4898
4899 ** bar
4900 == A heading ==
4901 * Another list item
4902 !! result
4903 <ul><li> foo
4904 </li></ul>
4905 <ul><li><ul><li> bar
4906 </li></ul>
4907 </li></ul>
4908 <h2><span class="mw-headline" id="A_heading">A heading</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a>]</span></h2>
4909 <ul><li> Another list item
4910 </li></ul>
4911
4912 !!end
4913
4914 !!test
4915 Multiple list tags generated by templates
4916 !!input
4917 {{echo|<li>}}a
4918 {{echo|<li>}}b
4919 {{echo|<li>}}c
4920 !!result
4921 <li>a
4922 <li>b
4923 <li>c</li>
4924 </li>
4925 </li>
4926
4927 !!end
4928
4929 !!test
4930 Single-comment whitespace lines dont break lists, but multi-comment whitespace lines do
4931 !!input
4932 *a
4933 <!--This line will NOT split the list-->
4934 *b
4935 <!--This line will NOT split the list either-->
4936 *c
4937 <!--foo--> <!--This line with more than 1 comment will split the list-->
4938 *d
4939 !!result
4940 <ul><li>a
4941 </li><li>b
4942 </li><li>c
4943 </li></ul>
4944 <ul><li>d
4945 </li></ul>
4946
4947 !!end
4948
4949 ###
4950 ### Magic Words
4951 ###
4952
4953 !! test
4954 Magic Word: {{CURRENTDAY}}
4955 !! input
4956 {{CURRENTDAY}}
4957 !! result
4958 <p>1
4959 </p>
4960 !! end
4961
4962 !! test
4963 Magic Word: {{CURRENTDAY2}}
4964 !! input
4965 {{CURRENTDAY2}}
4966 !! result
4967 <p>01
4968 </p>
4969 !! end
4970
4971 !! test
4972 Magic Word: {{CURRENTDAYNAME}}
4973 !! input
4974 {{CURRENTDAYNAME}}
4975 !! result
4976 <p>Thursday
4977 </p>
4978 !! end
4979
4980 !! test
4981 Magic Word: {{CURRENTDOW}}
4982 !! input
4983 {{CURRENTDOW}}
4984 !! result
4985 <p>4
4986 </p>
4987 !! end
4988
4989 !! test
4990 Magic Word: {{CURRENTMONTH}}
4991 !! input
4992 {{CURRENTMONTH}}
4993 !! result
4994 <p>01
4995 </p>
4996 !! end
4997
4998 !! test
4999 Magic Word: {{CURRENTMONTHABBREV}}
5000 !! input
5001 {{CURRENTMONTHABBREV}}
5002 !! result
5003 <p>Jan
5004 </p>
5005 !! end
5006
5007 !! test
5008 Magic Word: {{CURRENTMONTHNAME}}
5009 !! input
5010 {{CURRENTMONTHNAME}}
5011 !! result
5012 <p>January
5013 </p>
5014 !! end
5015
5016 !! test
5017 Magic Word: {{CURRENTMONTHNAMEGEN}}
5018 !! input
5019 {{CURRENTMONTHNAMEGEN}}
5020 !! result
5021 <p>January
5022 </p>
5023 !! end
5024
5025 !! test
5026 Magic Word: {{CURRENTTIME}}
5027 !! input
5028 {{CURRENTTIME}}
5029 !! result
5030 <p>00:02
5031 </p>
5032 !! end
5033
5034 !! test
5035 Magic Word: {{CURRENTWEEK}} (@bug 4594)
5036 !! input
5037 {{CURRENTWEEK}}
5038 !! result
5039 <p>1
5040 </p>
5041 !! end
5042
5043 !! test
5044 Magic Word: {{CURRENTYEAR}}
5045 !! input
5046 {{CURRENTYEAR}}
5047 !! result
5048 <p>1970
5049 </p>
5050 !! end
5051
5052 !! test
5053 Magic Word: {{FULLPAGENAME}}
5054 !! options
5055 title=[[User:Ævar Arnfjörð Bjarmason]]
5056 !! input
5057 {{FULLPAGENAME}}
5058 !! result
5059 <p>User:Ævar Arnfjörð Bjarmason
5060 </p>
5061 !! end
5062
5063 !! test
5064 Magic Word: {{FULLPAGENAMEE}}
5065 !! options
5066 title=[[User:Ævar Arnfjörð Bjarmason]]
5067 !! input
5068 {{FULLPAGENAMEE}}
5069 !! result
5070 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5071 </p>
5072 !! end
5073
5074 !! test
5075 Magic Word: {{NAMESPACE}}
5076 !! options
5077 title=[[User:Ævar Arnfjörð Bjarmason]]
5078 !! input
5079 {{NAMESPACE}}
5080 !! result
5081 <p>User
5082 </p>
5083 !! end
5084
5085 !! test
5086 Magic Word: {{NAMESPACEE}}
5087 !! options
5088 title=[[User:Ævar Arnfjörð Bjarmason]]
5089 !! input
5090 {{NAMESPACEE}}
5091 !! result
5092 <p>User
5093 </p>
5094 !! end
5095
5096 !! test
5097 Magic Word: {{NAMESPACENUMBER}}
5098 !! options
5099 title=[[User:Ævar Arnfjörð Bjarmason]]
5100 !! input
5101 {{NAMESPACENUMBER}}
5102 !! result
5103 <p>2
5104 </p>
5105 !! end
5106
5107 !! test
5108 Magic Word: {{NUMBEROFFILES}}
5109 !! input
5110 {{NUMBEROFFILES}}
5111 !! result
5112 <p>3
5113 </p>
5114 !! end
5115
5116 !! test
5117 Magic Word: {{PAGENAME}}
5118 !! options
5119 title=[[User:Ævar Arnfjörð Bjarmason]]
5120 !! input
5121 {{PAGENAME}}
5122 !! result
5123 <p>Ævar Arnfjörð Bjarmason
5124 </p>
5125 !! end
5126
5127 !! test
5128 Magic Word: {{PAGENAME}} with metacharacters
5129 !! options
5130 title=[['foo & bar = baz']]
5131 !! input
5132 ''{{PAGENAME}}''
5133 !! result
5134 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
5135 </p>
5136 !! end
5137
5138 !! test
5139 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
5140 !! options
5141 title=[[*RFC 1234 http://example.com/]]
5142 !! input
5143 {{PAGENAME}}
5144 !! result
5145 <p>&#42;RFC&#32;1234 http&#58;//example.com/
5146 </p>
5147 !! end
5148
5149 !! test
5150 Magic Word: {{PAGENAMEE}}
5151 !! options
5152 title=[[User:Ævar Arnfjörð Bjarmason]]
5153 !! input
5154 {{PAGENAMEE}}
5155 !! result
5156 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5157 </p>
5158 !! end
5159
5160 !! test
5161 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
5162 !! options
5163 title=[[*RFC 1234 http://example.com/]]
5164 !! input
5165 {{PAGENAMEE}}
5166 !! result
5167 <p>&#42;RFC_1234_http&#58;//example.com/
5168 </p>
5169 !! end
5170
5171 !! test
5172 Magic Word: {{REVISIONID}}
5173 !! input
5174 {{REVISIONID}}
5175 !! result
5176 <p>1337
5177 </p>
5178 !! end
5179
5180 !! test
5181 Magic Word: {{SCRIPTPATH}}
5182 !! input
5183 {{SCRIPTPATH}}
5184 !! result
5185 <p>/
5186 </p>
5187 !! end
5188
5189 !! test
5190 Magic Word: {{SERVER}}
5191 !! input
5192 {{SERVER}}
5193 !! result
5194 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5195 </p>
5196 !! end
5197
5198 !! test
5199 Magic Word: {{SERVERNAME}}
5200 !! input
5201 {{SERVERNAME}}
5202 !! result
5203 <p>example.org
5204 </p>
5205 !! end
5206
5207 !! test
5208 Magic Word: {{SITENAME}}
5209 !! input
5210 {{SITENAME}}
5211 !! result
5212 <p>MediaWiki
5213 </p>
5214 !! end
5215
5216 !! test
5217 Case-sensitive magic words, when cased differently, should just be template transclusions
5218 !! input
5219 {{CurrentMonth}}
5220 {{currentday}}
5221 {{cURreNTweEK}}
5222 {{currentHour}}
5223 !! result
5224 <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>
5225 <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>
5226 <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>
5227 <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>
5228 </p>
5229 !! end
5230
5231 !! test
5232 Case-insensitive magic words should still work with weird casing.
5233 !! input
5234 {{sErVeRNaMe}}
5235 {{LCFirst:AOEU}}
5236 {{ucFIRST:aoeu}}
5237 {{SERver}}
5238 !! result
5239 <p>example.org
5240 aOEU
5241 Aoeu
5242 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5243 </p>
5244 !! end
5245
5246 !! test
5247 Namespace 1 {{ns:1}}
5248 !! input
5249 {{ns:1}}
5250 !! result
5251 <p>Talk
5252 </p>
5253 !! end
5254
5255 !! test
5256 Namespace 1 {{ns:01}}
5257 !! input
5258 {{ns:01}}
5259 !! result
5260 <p>Talk
5261 </p>
5262 !! end
5263
5264 !! test
5265 Namespace 0 {{ns:0}} (bug 4783)
5266 !! input
5267 {{ns:0}}
5268 !! result
5269
5270 !! end
5271
5272 !! test
5273 Namespace 0 {{ns:00}} (bug 4783)
5274 !! input
5275 {{ns:00}}
5276 !! result
5277
5278 !! end
5279
5280 !! test
5281 Namespace -1 {{ns:-1}}
5282 !! input
5283 {{ns:-1}}
5284 !! result
5285 <p>Special
5286 </p>
5287 !! end
5288
5289 !! test
5290 Namespace User {{ns:User}}
5291 !! input
5292 {{ns:User}}
5293 !! result
5294 <p>User
5295 </p>
5296 !! end
5297
5298 !! test
5299 Namespace User talk {{ns:User_talk}}
5300 !! input
5301 {{ns:User_talk}}
5302 !! result
5303 <p>User talk
5304 </p>
5305 !! end
5306
5307 !! test
5308 Namespace User talk {{ns:uSeR tAlK}}
5309 !! input
5310 {{ns:uSeR tAlK}}
5311 !! result
5312 <p>User talk
5313 </p>
5314 !! end
5315
5316 !! test
5317 Namespace File {{ns:File}}
5318 !! input
5319 {{ns:File}}
5320 !! result
5321 <p>File
5322 </p>
5323 !! end
5324
5325 !! test
5326 Namespace File {{ns:Image}}
5327 !! input
5328 {{ns:Image}}
5329 !! result
5330 <p>File
5331 </p>
5332 !! end
5333
5334 !! test
5335 Namespace (lang=de) Benutzer {{ns:User}}
5336 !! options
5337 language=de
5338 !! input
5339 {{ns:User}}
5340 !! result
5341 <p>Benutzer
5342 </p>
5343 !! end
5344
5345 !! test
5346 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
5347 !! options
5348 language=de
5349 !! input
5350 {{ns:3}}
5351 !! result
5352 <p>Benutzer Diskussion
5353 </p>
5354 !! end
5355
5356
5357 !! test
5358 Urlencode
5359 !! input
5360 {{urlencode:hi world?!}}
5361 {{urlencode:hi world?!|WIKI}}
5362 {{urlencode:hi world?!|PATH}}
5363 {{urlencode:hi world?!|QUERY}}
5364 !! result
5365 <p>hi+world%3F%21
5366 hi_world%3F!
5367 hi%20world%3F%21
5368 hi+world%3F%21
5369 </p>
5370 !! end
5371
5372 ###
5373 ### Magic links
5374 ###
5375 !! test
5376 Magic links: internal link to RFC (bug 479)
5377 !! input
5378 [[RFC 123]]
5379 !! result
5380 <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>
5381 </p>
5382 !! end
5383
5384 !! test
5385 Magic links: RFC (bug 479)
5386 !! input
5387 RFC 822
5388 !! result
5389 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
5390 </p>
5391 !! end
5392
5393 !! test
5394 Magic links: ISBN (bug 1937)
5395 !! input
5396 ISBN 0-306-40615-2
5397 !! result
5398 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
5399 </p>
5400 !! end
5401
5402 !! test
5403 Magic links: PMID incorrectly converts space to underscore
5404 !! input
5405 PMID 1234
5406 !! result
5407 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
5408 </p>
5409 !! end
5410
5411 ###
5412 ### Templates
5413 ####
5414
5415 !! test
5416 Nonexistent template
5417 !! input
5418 {{thistemplatedoesnotexist}}
5419 !! result
5420 <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>
5421 </p>
5422 !! end
5423
5424 !! test
5425 Template with invalid target containing tags
5426 !! input
5427 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5428 !! result
5429 <p>{{a<b>b</b>|foo|a=b|a = b}}
5430 </p>
5431 !! end
5432
5433 !! test
5434 Template with invalid target containing unclosed tag
5435 !! input
5436 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5437 !! result
5438 <p>{{a<b>|foo|a=b|a = b}}</b>
5439 </p>
5440 !! end
5441
5442 !! article
5443 Template:test
5444 !! text
5445 This is a test template
5446 !! endarticle
5447
5448 !! test
5449 Simple template
5450 !! input
5451 {{test}}
5452 !! result
5453 <p>This is a test template
5454 </p>
5455 !! end
5456
5457 !! test
5458 Template with explicit namespace
5459 !! input
5460 {{Template:test}}
5461 !! result
5462 <p>This is a test template
5463 </p>
5464 !! end
5465
5466
5467 !! article
5468 Template:paramtest
5469 !! text
5470 This is a test template with parameter {{{param}}}
5471 !! endarticle
5472
5473 !! test
5474 Template parameter
5475 !! input
5476 {{paramtest|param=foo}}
5477 !! result
5478 <p>This is a test template with parameter foo
5479 </p>
5480 !! end
5481
5482 !! article
5483 Template:paramtestnum
5484 !! text
5485 [[{{{1}}}|{{{2}}}]]
5486 !! endarticle
5487
5488 !! test
5489 Template unnamed parameter
5490 !! input
5491 {{paramtestnum|Main Page|the main page}}
5492 !! result
5493 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
5494 </p>
5495 !! end
5496
5497 !! article
5498 Template:templatesimple
5499 !! text
5500 (test)
5501 !! endarticle
5502
5503 !! article
5504 Template:templateredirect
5505 !! text
5506 #redirect [[Template:templatesimple]]
5507 !! endarticle
5508
5509 !! article
5510 Template:templateasargtestnum
5511 !! text
5512 {{{{{1}}}}}
5513 !! endarticle
5514
5515 !! article
5516 Template:templateasargtest
5517 !! text
5518 {{template{{{templ}}}}}
5519 !! endarticle
5520
5521 !! article
5522 Template:templateasargtest2
5523 !! text
5524 {{{{{templ}}}}}
5525 !! endarticle
5526
5527 !! test
5528 Template with template name as unnamed argument
5529 !! input
5530 {{templateasargtestnum|templatesimple}}
5531 !! result
5532 <p>(test)
5533 </p>
5534 !! end
5535
5536 !! test
5537 Template with template name as argument
5538 !! input
5539 {{templateasargtest|templ=simple}}
5540 !! result
5541 <p>(test)
5542 </p>
5543 !! end
5544
5545 !! test
5546 Template with template name as argument (2)
5547 !! input
5548 {{templateasargtest2|templ=templatesimple}}
5549 !! result
5550 <p>(test)
5551 </p>
5552 !! end
5553
5554 !! article
5555 Template:templateasargtestdefault
5556 !! text
5557 {{{{{templ|templatesimple}}}}}
5558 !! endarticle
5559
5560 !! article
5561 Template:templa
5562 !! text
5563 '''templ'''
5564 !! endarticle
5565
5566 !! test
5567 Template with default value
5568 !! input
5569 {{templateasargtestdefault}}
5570 !! result
5571 <p>(test)
5572 </p>
5573 !! end
5574
5575 !! test
5576 Template with default value (value set)
5577 !! input
5578 {{templateasargtestdefault|templ=templa}}
5579 !! result
5580 <p><b>templ</b>
5581 </p>
5582 !! end
5583
5584 !! test
5585 Template redirect
5586 !! input
5587 {{templateredirect}}
5588 !! result
5589 <p>(test)
5590 </p>
5591 !! end
5592
5593 !! test
5594 Template with argument in separate line
5595 !! input
5596 {{ templateasargtest |
5597 templ = simple }}
5598 !! result
5599 <p>(test)
5600 </p>
5601 !! end
5602
5603 !! test
5604 Template with complex template as argument
5605 !! input
5606 {{paramtest|
5607 param ={{ templateasargtest |
5608 templ = simple }}}}
5609 !! result
5610 <p>This is a test template with parameter (test)
5611 </p>
5612 !! end
5613
5614 !! test
5615 Template with thumb image (with link in description)
5616 !! input
5617 {{paramtest|
5618 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
5619 !! result
5620 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>
5621
5622 !! end
5623
5624 !! article
5625 Template:complextemplate
5626 !! text
5627 {{{1}}} {{paramtest|
5628 param ={{{param}}}}}
5629 !! endarticle
5630
5631 !! test
5632 Template with complex arguments
5633 !! input
5634 {{complextemplate|
5635 param ={{ templateasargtest |
5636 templ = simple }}|[[Template:complextemplate|link]]}}
5637 !! result
5638 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
5639 </p>
5640 !! end
5641
5642 !! test
5643 BUG 553: link with two variables in a piped link
5644 !! input
5645 {|
5646 |[[{{{1}}}|{{{2}}}]]
5647 |}
5648 !! result
5649 <table>
5650 <tr>
5651 <td>[[{{{1}}}|{{{2}}}]]
5652 </td></tr></table>
5653
5654 !! end
5655
5656 !! test
5657 Magic variable as template parameter
5658 !! input
5659 {{paramtest|param={{SITENAME}}}}
5660 !! result
5661 <p>This is a test template with parameter MediaWiki
5662 </p>
5663 !! end
5664
5665 !! article
5666 Template:linktest
5667 !! text
5668 [[{{{param}}}|link]]
5669 !! endarticle
5670
5671 !! test
5672 Template parameter as link source
5673 !! input
5674 {{linktest|param=Main Page}}
5675 !! result
5676 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
5677 </p>
5678 !! end
5679
5680 !!test
5681 Template-generated attribute string (k='v')
5682 !!input
5683 <span {{attr_str|id|v1}}>bar</span>
5684 !!result
5685 <p><span id="v1">bar</span>
5686 </p>
5687 !!end
5688
5689 !!article
5690 Template:paramtest2
5691 !! text
5692 including another template, {{paramtest|param={{{arg}}}}}
5693 !! endarticle
5694
5695 !! test
5696 Template passing argument to another template
5697 !! input
5698 {{paramtest2|arg='hmm'}}
5699 !! result
5700 <p>including another template, This is a test template with parameter 'hmm'
5701 </p>
5702 !! end
5703
5704 !! article
5705 Template:Linktest2
5706 !! text
5707 Main Page
5708 !! endarticle
5709
5710 !! test
5711 Template as link source
5712 !! input
5713 [[{{linktest2}}]]
5714
5715 [[{{linktest2}}|Main Page]]
5716
5717 [[{{linktest2}}]]Page
5718 !! result
5719 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5720 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5721 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
5722 </p>
5723 !! end
5724
5725
5726 !! article
5727 Template:loop1
5728 !! text
5729 {{loop2}}
5730 !! endarticle
5731
5732 !! article
5733 Template:loop2
5734 !! text
5735 {{loop1}}
5736 !! endarticle
5737
5738 !! test
5739 Template infinite loop
5740 !! input
5741 {{loop1}}
5742 !! result
5743 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
5744 </p>
5745 !! end
5746
5747 !! test
5748 Template from main namespace
5749 !! input
5750 {{:Main Page}}
5751 !! result
5752 <p>blah blah
5753 </p>
5754 !! end
5755
5756 !! article
5757 Template:table
5758 !! text
5759 {|
5760 | 1 || 2
5761 |-
5762 | 3 || 4
5763 |}
5764 !! endarticle
5765
5766 !! test
5767 BUG 529: Template with table, not included at beginning of line
5768 !! input
5769 foo {{table}}
5770 !! result
5771 <p>foo
5772 </p>
5773 <table>
5774 <tr>
5775 <td> 1 </td>
5776 <td> 2
5777 </td></tr>
5778 <tr>
5779 <td> 3 </td>
5780 <td> 4
5781 </td></tr></table>
5782
5783 !! end
5784
5785 !! test
5786 BUG 523: Template shouldn't eat newline (or add an extra one before table)
5787 !! input
5788 foo
5789 {{table}}
5790 !! result
5791 <p>foo
5792 </p>
5793 <table>
5794 <tr>
5795 <td> 1 </td>
5796 <td> 2
5797 </td></tr>
5798 <tr>
5799 <td> 3 </td>
5800 <td> 4
5801 </td></tr></table>
5802
5803 !! end
5804
5805 !! test
5806 BUG 41: Template parameters shown as broken links
5807 !! input
5808 {{{parameter}}}
5809 !! result
5810 <p>{{{parameter}}}
5811 </p>
5812 !! end
5813
5814 !! test
5815 Template with targets containing wikilinks
5816 !! input
5817 {{[[foo]]}}
5818
5819 {{[[{{echo|foo}}]]}}
5820
5821 {{{{echo|[[foo}}]]}}
5822 !! result
5823 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5824 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5825 </p><p>{{[[foo}}]]
5826 </p>
5827 !! end
5828
5829 !! article
5830 Template:MSGNW test
5831 !! text
5832 ''None'' of '''this''' should be
5833 * interpreted
5834 but rather passed unmodified
5835 {{test}}
5836 !! endarticle
5837
5838 # hmm, fix this or just deprecate msgnw and document its behavior?
5839 !! test
5840 msgnw keyword
5841 !! options
5842 disabled
5843 !! input
5844 {{msgnw:MSGNW test}}
5845 !! result
5846 <p>''None'' of '''this''' should be
5847 * interpreted
5848 but rather passed unmodified
5849 {{test}}
5850 </p>
5851 !! end
5852
5853 !! test
5854 int keyword
5855 !! input
5856 {{int:youhavenewmessages|lots of money|not!}}
5857 !! result
5858 <p>You have lots of money (not!).
5859 </p>
5860 !! end
5861
5862 !! article
5863 Template:Includes
5864 !! text
5865 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5866 !! endarticle
5867
5868 !! test
5869 <includeonly> and <noinclude> being included
5870 !! input
5871 {{Includes}}
5872 !! result
5873 <p>Foobar
5874 </p>
5875 !! end
5876
5877 !! article
5878 Template:Includes2
5879 !! text
5880 <onlyinclude>Foo</onlyinclude>bar
5881 !! endarticle
5882
5883 !! test
5884 <onlyinclude> being included
5885 !! input
5886 {{Includes2}}
5887 !! result
5888 <p>Foo
5889 </p>
5890 !! end
5891
5892
5893 !! article
5894 Template:Includes3
5895 !! text
5896 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
5897 !! endarticle
5898
5899 !! test
5900 <onlyinclude> and <includeonly> being included
5901 !! input
5902 {{Includes3}}
5903 !! result
5904 <p>Foo
5905 </p>
5906 !! end
5907
5908 !! test
5909 <includeonly> and <noinclude> on a page
5910 !! input
5911 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5912 !! result
5913 <p>Foozar
5914 </p>
5915 !! end
5916
5917 !! test
5918 Un-closed <noinclude>
5919 !! input
5920 <noinclude>
5921 !! result
5922 !! end
5923
5924 !! test
5925 <onlyinclude> on a page
5926 !! input
5927 <onlyinclude>Foo</onlyinclude>bar
5928 !! result
5929 <p>Foobar
5930 </p>
5931 !! end
5932
5933 !! test
5934 Un-closed <onlyinclude>
5935 !! input
5936 <onlyinclude>
5937 !! result
5938 !! end
5939
5940 !!test
5941 Self-closed noinclude, includeonly, onlyinclude tags
5942 !!input
5943 <noinclude />
5944 <includeonly />
5945 <onlyinclude />
5946 !!result
5947 <p><br />
5948 </p>
5949 !!end
5950
5951 !!test
5952 Unbalanced includeonly and noinclude tags
5953 !!input
5954 {|
5955 |a</noinclude>
5956 |b</noinclude></noinclude>
5957 |c</noinclude></includeonly>
5958 |d</includeonly></includeonly>
5959 |}
5960 !!result
5961 <table>
5962 <tr>
5963 <td>a
5964 </td>
5965 <td>b
5966 </td>
5967 <td>c&lt;/includeonly&gt;
5968 </td>
5969 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
5970 </td></tr></table>
5971
5972 !!end
5973
5974 !! article
5975 Template:Includeonly section
5976 !! text
5977 <includeonly>
5978 ==Includeonly section==
5979 </includeonly>
5980 ==Section T-1==
5981 !!endarticle
5982
5983 !! test
5984 Bug 6563: Edit link generation for section shown by <includeonly>
5985 !! input
5986 {{includeonly section}}
5987 !! result
5988 <h2><span class="mw-headline" id="Includeonly_section">Includeonly section</span> <span class="mw-editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a>]</span></h2>
5989 <h2><span class="mw-headline" id="Section_T-1">Section T-1</span> <span class="mw-editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a>]</span></h2>
5990
5991 !! end
5992
5993 # Uses same input as the contents of [[Template:Includeonly section]]
5994 !! test
5995 Bug 6563: Section extraction for section shown by <includeonly>
5996 !! options
5997 section=T-2
5998 !! input
5999 <includeonly>
6000 ==Includeonly section==
6001 </includeonly>
6002 ==Section T-2==
6003 !! result
6004 ==Section T-2==
6005 !! end
6006
6007 !! test
6008 Bug 6563: Edit link generation for section suppressed by <includeonly>
6009 !! input
6010 <includeonly>
6011 ==Includeonly section==
6012 </includeonly>
6013 ==Section 1==
6014 !! result
6015 <h2><span class="mw-headline" id="Section_1">Section 1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a>]</span></h2>
6016
6017 !! end
6018
6019 !! test
6020 Bug 6563: Section extraction for section suppressed by <includeonly>
6021 !! options
6022 section=1
6023 !! input
6024 <includeonly>
6025 ==Includeonly section==
6026 </includeonly>
6027 ==Section 1==
6028 !! result
6029 ==Section 1==
6030 !! end
6031
6032 !! test
6033 Un-closed <includeonly>
6034 !! input
6035 <includeonly>
6036 !! result
6037 !! end
6038
6039 ###
6040 ### <includeonly> and <noinclude> in attributes
6041 ###
6042 !!test
6043 0. includeonly around the entire attribute
6044 !!input
6045 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
6046 !!result
6047 <p><span id="v2">bar</span>
6048 </p>
6049 !!end
6050
6051 !!test
6052 1. includeonly in html attr key
6053 !!input
6054 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
6055 !!result
6056 <p><span id="foo">bar</span>
6057 </p>
6058 !!end
6059
6060 !!test
6061 2. includeonly in html attr value
6062 !!input
6063 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
6064 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
6065 !!result
6066 <p><span id="v1">bar</span>
6067 <span id="v1">bar</span>
6068 </p>
6069 !!end
6070
6071 !!test
6072 3. includeonly in part of an attr value
6073 !!input
6074 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
6075 !!result
6076 <p><span style="color:red;">bar</span>
6077 </p>
6078 !!end
6079
6080 ###
6081 ### Testing parsing of templates where a template arg
6082 ### has the same name as the template itself.
6083 ###
6084
6085 !! article
6086 Template:quote
6087 !! text
6088 {{{quote|{{{1}}}}}}
6089 !! endarticle
6090
6091 !!test
6092 Templates: Template Name/Arg clash: 1. Use of positional param
6093 !!input
6094 {{quote|foo}}
6095 !!result
6096 <p>foo
6097 </p>
6098 !!end
6099
6100 !!test
6101 Templates: Template Name/Arg clash: 2. Use of named param
6102 !!input
6103 {{quote|quote=foo}}
6104 !!result
6105 <p>foo
6106 </p>
6107 !!end
6108
6109 !!test
6110 Templates: Template Name/Arg clash: 3. Use of named param with empty input
6111 !!input
6112 {{quote|quote}}
6113 !!result
6114 <p>quote
6115 </p>
6116 !!end
6117
6118 ###
6119 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
6120 ###
6121
6122 !!test
6123 Templates: 1. Simple use
6124 !!input
6125 {{echo|Foo}}
6126 !!result
6127 <p>Foo
6128 </p>
6129 !!end
6130
6131 !!test
6132 Templates: 2. Inside a block tag
6133 !!input
6134 <div>{{echo|Foo}}</div>
6135 !!result
6136 <div>Foo</div>
6137
6138 !!end
6139
6140 !!test
6141 Templates: P-wrapping: 1a. Templates on consecutive lines
6142 !!input
6143 {{echo|Foo}}
6144 {{echo|bar}}
6145 !!result
6146 <p>Foo
6147 bar
6148 </p>
6149 !!end
6150
6151 !!test
6152 Templates: P-wrapping: 1b. Templates on consecutive lines
6153 !!input
6154 Foo
6155
6156 {{echo|bar}}
6157 {{echo|baz}}
6158 !!result
6159 <p>Foo
6160 </p><p>bar
6161 baz
6162 </p>
6163 !!end
6164
6165 !!test
6166 Templates: P-wrapping: 1c. Templates on consecutive lines
6167 !!input
6168 {{echo|Foo}}
6169 {{echo|bar}} <div>baz</div>
6170 !!result
6171 <p>Foo
6172 </p>
6173 bar <div>baz</div>
6174
6175 !!end
6176
6177 !!test
6178 Templates: P-wrapping: 1d. Template preceded by comment-only line
6179 !!options
6180 parsoid
6181 !!input
6182 <!-- foo -->
6183 {{echo|Bar}}
6184 !!result
6185 <!-- foo -->
6186 <p>Bar
6187 </p>
6188 !!end
6189
6190 !!test
6191 Templates: Inline Text: 1. Multiple tmeplate uses
6192 !!input
6193 {{echo|Foo}}bar{{echo|baz}}
6194 !!result
6195 <p>Foobarbaz
6196 </p>
6197 !!end
6198
6199 !!test
6200 Templates: Inline Text: 2. Back-to-back template uses
6201 !!input
6202 {{echo|Foo}}{{echo|bar}}
6203 !!result
6204 <p>Foobar
6205 </p>
6206 !!end
6207
6208 !!test
6209 Templates: Block Tags: 1. Multiple template uses
6210 !!input
6211 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
6212 !!result
6213 <div>Foo</div><div>bar</div><div>baz</div>
6214
6215 !!end
6216
6217 !!test
6218 Templates: Block Tags: 2. Back-to-back template uses
6219 !!input
6220 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
6221 !!result
6222 <div>Foo</div><div>bar</div>
6223
6224 !!end
6225
6226 !!test
6227 Templates: Links: 1. Simple example
6228 !!input
6229 {{echo|[[Foo|bar]]}}
6230 !!result
6231 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6232 </p>
6233 !!end
6234
6235 !!test
6236 Templates: Links: 2. Generation of link href
6237 !!input
6238 [[{{echo|Foo}}|bar]]
6239 !!result
6240 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6241 </p>
6242 !!end
6243
6244 !!test
6245 Templates: Links: 3. Generation of part of a link href
6246 !!input
6247 [[Fo{{echo|o}}|bar]]
6248
6249 [[Foo{{echo|bar}}]]
6250
6251 [[Foo{{echo|bar}}baz]]
6252
6253 [[Foo{{echo|bar}}|bar]]
6254
6255 [[:Foo{{echo|bar}}]]
6256
6257 [[:Foo{{echo|bar}}|bar]]
6258 !!result
6259 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6260 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6261 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
6262 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6263 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6264 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6265 </p>
6266 !!end
6267
6268 !!test
6269 Templates: Links: 4. Multiple templates generating link href
6270 !!input
6271 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
6272 !!result
6273 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6274 </p>
6275 !!end
6276
6277 !!test
6278 Templates: Links: 5. Generation of link text
6279 !!input
6280 [[Foo|{{echo|bar}}]]
6281 !!result
6282 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6283 </p>
6284 !!end
6285
6286 !!test
6287 Templates: Links: 5. Nested templates (only outermost template should be marked)
6288 !!input
6289 {{echo|[[{{echo|Foo}}|bar]]}}
6290 !!result
6291 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6292 </p>
6293 !!end
6294
6295 !!test
6296 Templates: HTML Tag: 1. Generation of HTML attr. key
6297 !!input
6298 <div {{echo|style}}="color:red;">foo</div>
6299 !!result
6300 <div style="color:red;">foo</div>
6301
6302 !!end
6303
6304 !!test
6305 Templates: HTML Tag: 2. Generation of HTML attr. value
6306 !!input
6307 <div style={{echo|'color:red;'}}>foo</div>
6308 !!result
6309 <div style="color:red;">foo</div>
6310
6311 !!end
6312
6313 !!test
6314 Templates: HTML Tag: 3. Generation of HTML attr key and value
6315 !!input
6316 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
6317 !!result
6318 <div style="color:red;">foo</div>
6319
6320 !!end
6321
6322 !!test
6323 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
6324 !!input
6325 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
6326 !!result
6327 <div title="This is a long title with just one piece templated">foo</div>
6328
6329 !!end
6330
6331 !!test
6332 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
6333 !!input
6334 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
6335 !!result
6336 <div title="This is a long title with just one piece templated">foo</div>
6337
6338 !!end
6339
6340 !!test
6341 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
6342 !!input
6343 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
6344 !!result
6345 <div title="This is a long title with just one piece templated">foo</div>
6346
6347 !!end
6348
6349 !!test
6350 Templates: HTML Tag: 7. Generation of partial attribute key string
6351 !!input
6352 <div st{{echo|yle}}="color:red;">foo</div>
6353 !!result
6354 <div style="color:red;">foo</div>
6355
6356 !!end
6357
6358 !!test
6359 Templates: HTML Tables: 1. Generating start of a HTML table
6360 !!input
6361 {{echo|<table><tr><td>foo</td>}}</tr></table>
6362 !!result
6363 <table><tr><td>foo</td></tr></table>
6364
6365 !!end
6366
6367 !!test
6368 Templates: HTML Tables: 2a. Generating middle of a HTML table
6369 !!input
6370 <table><tr>{{echo|<td>foo</td>}}</tr></table>
6371 !!result
6372 <table><tr><td>foo</td></tr></table>
6373
6374 !!end
6375
6376 !!test
6377 Templates: HTML Tables: 2b. Generating middle of a HTML table
6378 !!input
6379 <table>{{echo|<tr><td>foo</td></tr>}}</table>
6380 !!result
6381 <table><tr><td>foo</td></tr></table>
6382
6383 !!end
6384
6385 !!test
6386 Templates: HTML Tables: 3. Generating end of a HTML table
6387 !!input
6388 <table><tr>{{echo|<td>foo</td></tr></table>}}
6389 !!result
6390 <table><tr><td>foo</td></tr></table>
6391
6392 !!end
6393
6394 !!test
6395 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
6396 !!input
6397 {{echo|<table>}}<tr><td>foo</td></tr></table>
6398 !!result
6399 <table><tr><td>foo</td></tr></table>
6400
6401 !!end
6402
6403 !!test
6404 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
6405 !!input
6406 <table>{{echo|<tr>}}<td>foo</td></tr></table>
6407 !!result
6408 <table><tr><td>foo</td></tr></table>
6409
6410 !!end
6411
6412 !!test
6413 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
6414 !!input
6415 <table><tr>{{echo|<td>}}foo</td></tr></table>
6416 !!result
6417 <table><tr><td>foo</td></tr></table>
6418
6419 !!end
6420
6421 !!test
6422 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
6423 !!input
6424 <table><tr><td>foo{{echo|</td>}}</tr></table>
6425 !!result
6426 <table><tr><td>foo</td></tr></table>
6427
6428 !!end
6429
6430 !!test
6431 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
6432 !!input
6433 <table><tr><td>foo</td>{{echo|</tr>}}</table>
6434 !!result
6435 <table><tr><td>foo</td></tr></table>
6436
6437 !!end
6438
6439 !!test
6440 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
6441 !!input
6442 <table><tr><td>foo</td></tr>{{echo|</table>}}
6443 !!result
6444 <table><tr><td>foo</td></tr></table>
6445
6446 !!end
6447
6448 !!test
6449 Templates: Wiki Tables: 1a. Fostering of entire template content
6450 !!input
6451 {|
6452 {{echo|a}}
6453 |}
6454 !!result
6455 <table>
6456 a
6457 <tr><td></td></tr></table>
6458
6459 !!end
6460
6461 !!test
6462 Templates: Wiki Tables: 1b. Fostering of entire template content
6463 !!input
6464 {|
6465 {{echo|<div>}}
6466 foo
6467 {{echo|</div>}}
6468 |}
6469 !!result
6470 <table>
6471 <div>
6472 <p>foo
6473 </p>
6474 </div>
6475 <tr><td></td></tr></table>
6476
6477 !!end
6478
6479 !!test
6480 Templates: Wiki Tables: 2. Fostering of partial template content
6481 !!input
6482 {|
6483 {{echo|a
6484 <div>b</div>}}
6485 |}
6486 !!result
6487 <table>
6488 a
6489 <div>b</div>
6490 <tr><td></td></tr></table>
6491
6492 !!end
6493
6494 !!test
6495 Templates: Wiki Tables: 3. td-content via multiple templates
6496 !!input
6497 {|
6498 {{echo|{{pipe}}a}}{{echo|b}}
6499 |}
6500 !!result
6501 <table>
6502 <tr>
6503 <td>ab
6504 </td></tr></table>
6505
6506 !!end
6507
6508 !!test
6509 Templates: Wiki Tables: 4. Templated tags, no content
6510 !!input
6511 {{tbl-start}}
6512 {{tbl-end}}
6513 !!result
6514 <table>
6515 <tr><td></td></tr></table>
6516
6517 !!end
6518
6519 !!test
6520 Templates: Wiki Tables: 5. Templated tags, regular td-tags
6521 !!input
6522 {{tbl-start}}
6523 |foo
6524 {{tbl-end}}
6525 !!result
6526 <table>
6527 <tr>
6528 <td>foo
6529 </td></tr></table>
6530
6531 !!end
6532
6533 !!test
6534 Templates: Wiki Tables: 6. Templated tags, templated td-tags
6535 !!input
6536 {{tbl-start}}
6537 {{!}}foo
6538 {{tbl-end}}
6539 !!result
6540 <table>
6541 <tr>
6542 <td>foo
6543 </td></tr></table>
6544
6545 !!end
6546
6547 !!test
6548 Templates: Lists: Multi-line list-items via templates
6549 !!input
6550 *{{echo|a {{nonexistent|
6551 unused}}}}
6552 *{{echo|b {{nonexistent|
6553 unused}}}}
6554 !!result
6555 <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>
6556 </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>
6557 </li></ul>
6558
6559 !!end
6560
6561 !!test
6562 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
6563 !!input
6564 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
6565 !!result
6566 <p><i>ab</i>c<i>d</i>e
6567 </p>
6568 !!end
6569
6570 !!test
6571 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
6572 (PHP parser generates misnested html)
6573 !! options
6574 parsoid
6575 !!input
6576 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
6577 !!result
6578 <p><span><i>a</i></span><i><span>b</span></i><span>c</span><i>d</i><span>e</span></p>
6579 !!end
6580
6581 !!test
6582 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
6583 (PHP parser generates misnested html)
6584 !! options
6585 parsoid
6586 !!input
6587 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
6588 !!result
6589 <div><i>a</i></div>
6590 <div><i>b</i>c<i>d</i></div>
6591 <div>e</div>
6592 !!end
6593
6594 !!test
6595 Templates: Ugly nesting: 4. Divs opened/closed across templates
6596 !!input
6597 a<div>b{{echo|c</div>d}}e
6598 !!result
6599 a<div>bc</div>de
6600
6601 !!end
6602
6603 !!test
6604 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
6605 (Parsoid-centric)
6606 !! options
6607 parsoid
6608 !!input
6609 {|
6610 |{{echo|foo</table>}}
6611 |bar
6612 |}
6613 !!result
6614 <table about="#mwt1" typeof="mw:Object/Template ">
6615 <tbody><tr><td>foo</td></tr></tbody></table><span about="#mwt1">
6616 bar</span><span about="#mwt1">
6617 </span>
6618 !!end
6619
6620 !!test
6621 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
6622 (Parsoid-centric)
6623 !! options
6624 parsoid
6625 !!input
6626 <table>
6627 <tr>
6628 <td>
6629 <table>
6630 <tr>
6631 <td>1. {{echo|foo </table>}}</td>
6632 <td> bar </td>
6633 <td>2. {{echo|baz </table>}}</td>
6634 </tr>
6635 <tr>
6636 <td>abc</td>
6637 </tr>
6638 </table>
6639 </td>
6640 </tr>
6641 <tr>
6642 <td>xyz</td>
6643 </tr>
6644 </table>
6645 !!result
6646 <table about="#mwt1" typeof="mw:Object/Template">
6647 <tbody><tr >
6648 <td >
6649 <table >
6650 <tbody><tr >
6651 <td >1. foo </td></tr></tbody></table></td>
6652 <td > bar </td>
6653 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
6654 </span><span about="#mwt1">
6655
6656 abc</span><span about="#mwt1">
6657 </span><span about="#mwt1">
6658 </span><span about="#mwt1">
6659 </span><span about="#mwt1">
6660 </span><span about="#mwt1">
6661
6662 xyz</span><span about="#mwt1">
6663 </span><span about="#mwt1">
6664 </span>
6665 !!end
6666
6667 !! test
6668 Templates: Ugly templates: 3. newline-only template parameter
6669 !! input
6670 foo {{echo|
6671 }}
6672 !! result
6673 <p>foo
6674 </p>
6675 !! end
6676
6677 # This looks like a bug: a single newline triggers p/br for some reason.
6678 !! test
6679 Templates: Ugly templates: 4. newline-only template parameter inconsistency
6680 !! input
6681 {{echo|
6682 }}
6683 !! result
6684 <p><br />
6685 </p>
6686 !! end
6687
6688
6689 !!test
6690 Parser Functions: 1. Simple example
6691 !!input
6692 {{uc:foo}}
6693 !!result
6694 <p>FOO
6695 </p>
6696 !!end
6697
6698 !!test
6699 Parser Functions: 2. Nested use (only outermost should be marked up)
6700 !!input
6701 {{uc:{{lc:FOO}}}}
6702 !!result
6703 <p>FOO
6704 </p>
6705 !!end
6706
6707 ###
6708 ### Pre-save transform tests
6709 ###
6710 !! test
6711 pre-save transform: subst:
6712 !! options
6713 PST
6714 !! input
6715 {{subst:test}}
6716 !! result
6717 This is a test template
6718 !! end
6719
6720 !! test
6721 pre-save transform: normal template
6722 !! options
6723 PST
6724 !! input
6725 {{test}}
6726 !! result
6727 {{test}}
6728 !! end
6729
6730 !! test
6731 pre-save transform: nonexistent template
6732 !! options
6733 PST
6734 !! input
6735 {{thistemplatedoesnotexist}}
6736 !! result
6737 {{thistemplatedoesnotexist}}
6738 !! end
6739
6740
6741 !! test
6742 pre-save transform: subst magic variables
6743 !! options
6744 PST
6745 !! input
6746 {{subst:SITENAME}}
6747 !! result
6748 MediaWiki
6749 !! end
6750
6751 # This is bug 89, which I fixed. -- wtm
6752 !! test
6753 pre-save transform: subst: templates with parameters
6754 !! options
6755 pst
6756 !! input
6757 {{subst:paramtest|param="something else"}}
6758 !! result
6759 This is a test template with parameter "something else"
6760 !! end
6761
6762 !! article
6763 Template:nowikitest
6764 !! text
6765 <nowiki>'''not wiki'''</nowiki>
6766 !! endarticle
6767
6768 !! test
6769 pre-save transform: nowiki in subst (bug 1188)
6770 !! options
6771 pst
6772 !! input
6773 {{subst:nowikitest}}
6774 !! result
6775 <nowiki>'''not wiki'''</nowiki>
6776 !! end
6777
6778
6779 !! article
6780 Template:commenttest
6781 !! text
6782 This template has <!-- a comment --> in it.
6783 !! endarticle
6784
6785 !! test
6786 pre-save transform: comment in subst (bug 1936)
6787 !! options
6788 pst
6789 !! input
6790 {{subst:commenttest}}
6791 !! result
6792 This template has <!-- a comment --> in it.
6793 !! end
6794
6795 !! test
6796 pre-save transform: unclosed tag
6797 !! options
6798 pst noxml
6799 !! input
6800 <nowiki>'''not wiki'''
6801 !! result
6802 <nowiki>'''not wiki'''
6803 !! end
6804
6805 !! test
6806 pre-save transform: mixed tag case
6807 !! options
6808 pst noxml
6809 !! input
6810 <NOwiki>'''not wiki'''</noWIKI>
6811 !! result
6812 <NOwiki>'''not wiki'''</noWIKI>
6813 !! end
6814
6815 !! test
6816 pre-save transform: unclosed comment in <nowiki>
6817 !! options
6818 pst noxml
6819 !! input
6820 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6821 !! result
6822 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6823 !!end
6824
6825 !! article
6826 Template:dangerous
6827 !!text
6828 <span onmouseover="alert('crap')">Oh no</span>
6829 !!endarticle
6830
6831 !!test
6832 (confirming safety of fix for subst bug 1936)
6833 !! input
6834 {{Template:dangerous}}
6835 !! result
6836 <p><span>Oh no</span>
6837 </p>
6838 !! end
6839
6840 !! test
6841 pre-save transform: comment containing gallery (bug 5024)
6842 !! options
6843 pst
6844 !! input
6845 <!-- <gallery>data</gallery> -->
6846 !!result
6847 <!-- <gallery>data</gallery> -->
6848 !!end
6849
6850 !! test
6851 pre-save transform: comment containing extension
6852 !! options
6853 pst
6854 !! input
6855 <!-- <tag>data</tag> -->
6856 !!result
6857 <!-- <tag>data</tag> -->
6858 !!end
6859
6860 !! test
6861 pre-save transform: comment containing nowiki
6862 !! options
6863 pst
6864 !! input
6865 <!-- <nowiki>data</nowiki> -->
6866 !!result
6867 <!-- <nowiki>data</nowiki> -->
6868 !!end
6869
6870 !! test
6871 pre-save transform: <noinclude> in subst (bug 3298)
6872 !! options
6873 pst
6874 !! input
6875 {{subst:Includes}}
6876 !! result
6877 Foobar
6878 !! end
6879
6880 !! test
6881 pre-save transform: <onlyinclude> in subst (bug 3298)
6882 !! options
6883 pst
6884 !! input
6885 {{subst:Includes2}}
6886 !! result
6887 Foo
6888 !! end
6889
6890 !! article
6891 Template:SubstTest
6892 !!text
6893 {{<includeonly>subst:</includeonly>Includes}}
6894 !! endarticle
6895
6896 !! article
6897 Template:SafeSubstTest
6898 !! text
6899 {{<includeonly>safesubst:</includeonly>Includes}}
6900 !! endarticle
6901
6902 !! test
6903 bug 22297: safesubst: works during PST
6904 !! options
6905 pst
6906 !! input
6907 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
6908 !! result
6909 FoobarFoobar
6910 !! end
6911
6912 !! test
6913 bug 22297: safesubst: works during normal parse
6914 !! input
6915 {{SafeSubstTest}}
6916 !! result
6917 <p>Foobar
6918 </p>
6919 !! end
6920
6921 !! test:
6922 subst: does not work during normal parse
6923 !! input
6924 {{SubstTest}}
6925 !! result
6926 <p>{{subst:Includes}}
6927 </p>
6928 !! end
6929
6930 !! test
6931 pre-save transform: context links ("pipe trick")
6932 !! options
6933 pst
6934 !! input
6935 [[Article (context)|]]
6936 [[Bar:Article|]]
6937 [[:Bar:Article|]]
6938 [[Bar:Article (context)|]]
6939 [[:Bar:Article (context)|]]
6940 [[|Article]]
6941 [[|Article (context)]]
6942 [[Bar:X (Y) Z|]]
6943 [[:Bar:X (Y) Z|]]
6944 !! result
6945 [[Article (context)|Article]]
6946 [[Bar:Article|Article]]
6947 [[:Bar:Article|Article]]
6948 [[Bar:Article (context)|Article]]
6949 [[:Bar:Article (context)|Article]]
6950 [[Article]]
6951 [[Article (context)]]
6952 [[Bar:X (Y) Z|X (Y) Z]]
6953 [[:Bar:X (Y) Z|X (Y) Z]]
6954 !! end
6955
6956 !! test
6957 pre-save transform: context links ("pipe trick") with interwiki prefix
6958 !! options
6959 pst
6960 !! input
6961 [[interwiki:Article|]]
6962 [[:interwiki:Article|]]
6963 [[interwiki:Bar:Article|]]
6964 [[:interwiki:Bar:Article|]]
6965 !! result
6966 [[interwiki:Article|Article]]
6967 [[:interwiki:Article|Article]]
6968 [[interwiki:Bar:Article|Bar:Article]]
6969 [[:interwiki:Bar:Article|Bar:Article]]
6970 !! end
6971
6972 !! test
6973 pre-save transform: context links ("pipe trick") with parens in title
6974 !! options
6975 pst title=[[Somearticle (context)]]
6976 !! input
6977 [[|Article]]
6978 !! result
6979 [[Article (context)|Article]]
6980 !! end
6981
6982 !! test
6983 pre-save transform: context links ("pipe trick") with comma in title
6984 !! options
6985 pst title=[[Someplace, Somewhere]]
6986 !! input
6987 [[|Otherplace]]
6988 [[Otherplace, Elsewhere|]]
6989 [[Otherplace, Elsewhere, Anywhere|]]
6990 !! result
6991 [[Otherplace, Somewhere|Otherplace]]
6992 [[Otherplace, Elsewhere|Otherplace]]
6993 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
6994 !! end
6995
6996 !! test
6997 pre-save transform: context links ("pipe trick") with parens and comma
6998 !! options
6999 pst title=[[Someplace (IGNORED), Somewhere]]
7000 !! input
7001 [[|Otherplace]]
7002 [[Otherplace (place), Elsewhere|]]
7003 !! result
7004 [[Otherplace, Somewhere|Otherplace]]
7005 [[Otherplace (place), Elsewhere|Otherplace]]
7006 !! end
7007
7008 !! test
7009 pre-save transform: context links ("pipe trick") with comma and parens
7010 !! options
7011 pst title=[[Who, me? (context)]]
7012 !! input
7013 [[|Yes, you.]]
7014 [[Me, Myself, and I (1937 song)|]]
7015 !! result
7016 [[Yes, you. (context)|Yes, you.]]
7017 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
7018 !! end
7019
7020 !! test
7021 pre-save transform: context links ("pipe trick") with namespace
7022 !! options
7023 pst title=[[Ns:Somearticle]]
7024 !! input
7025 [[|Article]]
7026 !! result
7027 [[Ns:Article|Article]]
7028 !! end
7029
7030 !! test
7031 pre-save transform: context links ("pipe trick") with namespace and parens
7032 !! options
7033 pst title=[[Ns:Somearticle (context)]]
7034 !! input
7035 [[|Article]]
7036 !! result
7037 [[Ns:Article (context)|Article]]
7038 !! end
7039
7040 !! test
7041 pre-save transform: context links ("pipe trick") with namespace and comma
7042 !! options
7043 pst title=[[Ns:Somearticle, Context, Whatever]]
7044 !! input
7045 [[|Article]]
7046 !! result
7047 [[Ns:Article, Context, Whatever|Article]]
7048 !! end
7049
7050 !! test
7051 pre-save transform: context links ("pipe trick") with namespace, comma and parens
7052 !! options
7053 pst title=[[Ns:Somearticle, Context (context)]]
7054 !! input
7055 [[|Article]]
7056 !! result
7057 [[Ns:Article (context)|Article]]
7058 !! end
7059
7060 !! test
7061 pre-save transform: context links ("pipe trick") with namespace, parens and comma
7062 !! options
7063 pst title=[[Ns:Somearticle (IGNORED), Context]]
7064 !! input
7065 [[|Article]]
7066 !! result
7067 [[Ns:Article, Context|Article]]
7068 !! end
7069
7070 !! test
7071 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
7072 !! options
7073 pst
7074 !! input
7075 [[Article(context)|]]
7076 [[Bar:Article(context)|]]
7077 [[:Bar:Article(context)|]]
7078 [[|Article(context)]]
7079 [[Bar:X(Y)Z|]]
7080 [[:Bar:X(Y)Z|]]
7081 !! result
7082 [[Article(context)|Article]]
7083 [[Bar:Article(context)|Article]]
7084 [[:Bar:Article(context)|Article]]
7085 [[Article(context)]]
7086 [[Bar:X(Y)Z|X(Y)Z]]
7087 [[:Bar:X(Y)Z|X(Y)Z]]
7088 !! end
7089
7090 !! test
7091 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
7092 !! options
7093 pst
7094 !! input
7095 [[Article (context)|]]
7096 [[Bar:Article (context)|]]
7097 [[:Bar:Article (context)|]]
7098 [[|Article (context)]]
7099 [[Bar:X (Y) Z|]]
7100 [[:Bar:X (Y) Z|]]
7101 !! result
7102 [[Article (context)|Article]]
7103 [[Bar:Article (context)|Article]]
7104 [[:Bar:Article (context)|Article]]
7105 [[Article (context)]]
7106 [[Bar:X (Y) Z|X (Y) Z]]
7107 [[:Bar:X (Y) Z|X (Y) Z]]
7108 !! end
7109
7110 !! test
7111 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
7112 !! options
7113 pst
7114 !! input
7115 [[Article(context)|]]
7116 [[Bar:Article(context)|]]
7117 [[:Bar:Article(context)|]]
7118 [[|Article(context)]]
7119 [[Bar:X(Y)Z|]]
7120 [[:Bar:X(Y)Z|]]
7121 !! result
7122 [[Article(context)|Article]]
7123 [[Bar:Article(context)|Article]]
7124 [[:Bar:Article(context)|Article]]
7125 [[Article(context)]]
7126 [[Bar:X(Y)Z|X(Y)Z]]
7127 [[:Bar:X(Y)Z|X(Y)Z]]
7128 !! end
7129
7130 !! test
7131 pre-save transform: context links ("pipe trick") with commas (bug 21660)
7132 !! options
7133 pst
7134 !! input
7135 [[Article (context), context|]]
7136 [[Article (context),context|]]
7137 [[Bar:Article (context), context|]]
7138 [[Bar:Article (context),context|]]
7139 [[:Bar:Article (context), context|]]
7140 [[:Bar:Article (context),context|]]
7141 !! result
7142 [[Article (context), context|Article]]
7143 [[Article (context),context|Article]]
7144 [[Bar:Article (context), context|Article]]
7145 [[Bar:Article (context),context|Article]]
7146 [[:Bar:Article (context), context|Article]]
7147 [[:Bar:Article (context),context|Article]]
7148 !! end
7149
7150 !! test
7151 pre-save transform: trim trailing empty lines
7152 !! options
7153 pst
7154 !! input
7155 Empty lines are trimmed
7156
7157
7158
7159
7160 !! result
7161 Empty lines are trimmed
7162 !! end
7163
7164 !! test
7165 pre-save transform: Signature expansion
7166 !! options
7167 pst
7168 !! input
7169 * ~~~
7170 * <noinclude>~~~</noinclude>
7171 * <includeonly>~~~</includeonly>
7172 * <onlyinclude>~~~</onlyinclude>
7173 !! result
7174 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
7175 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
7176 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
7177 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
7178 !! end
7179
7180
7181 !! test
7182 pre-save transform: Signature expansion in nowiki tags (bug 93)
7183 !! options
7184 pst disabled
7185 !! input
7186 Shall not expand:
7187
7188 <nowiki>~~~~</nowiki>
7189
7190 <includeonly><nowiki>~~~~</nowiki></includeonly>
7191
7192 <noinclude><nowiki>~~~~</nowiki></noinclude>
7193
7194 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7195
7196 {{subst:Foo}} shall be converted to FOO
7197
7198 As well as inside noinclude/onlyinclude
7199 <noinclude>{{subst:Foo}}</noinclude>
7200 <onlyinclude>{{subst:Foo}}</onlyinclude>
7201
7202 But not inside includeonly
7203 <includeonly>{{subst:Foo}}</includeonly>
7204 !! result
7205 Shall not expand:
7206
7207 <nowiki>~~~~</nowiki>
7208
7209 <includeonly><nowiki>~~~~</nowiki></includeonly>
7210
7211 <noinclude><nowiki>~~~~</nowiki></noinclude>
7212
7213 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7214
7215 FOO shall be converted to FOO
7216
7217 As well as inside noinclude/onlyinclude
7218 <noinclude>FOO</noinclude>
7219 <onlyinclude>FOO</onlyinclude>
7220
7221 But not inside includeonly
7222 <includeonly>{{subst:Foo}}</includeonly>
7223 !! end
7224
7225 ###
7226 ### Message transform tests
7227 ###
7228 !! test
7229 message transform: magic variables
7230 !! options
7231 msg
7232 !! input
7233 {{SITENAME}}
7234 !! result
7235 MediaWiki
7236 !! end
7237
7238 !! test
7239 message transform: should not transform wiki markup
7240 !! options
7241 msg
7242 !! input
7243 ''test''
7244 !! result
7245 ''test''
7246 !! end
7247
7248 !! test
7249 message transform: <noinclude> in transcluded template (bug 4926)
7250 !! options
7251 msg
7252 !! input
7253 {{Includes}}
7254 !! result
7255 Foobar
7256 !! end
7257
7258 !! test
7259 message transform: <onlyinclude> in transcluded template (bug 4926)
7260 !! options
7261 msg
7262 !! input
7263 {{Includes2}}
7264 !! result
7265 Foo
7266 !! end
7267
7268 !! test
7269 {{#special:}} page name, known
7270 !! options
7271 msg
7272 !! input
7273 {{#special:Recentchanges}}
7274 !! result
7275 Special:RecentChanges
7276 !! end
7277
7278 !! test
7279 {{#special:}} page name with subpage, known
7280 !! options
7281 msg
7282 !! input
7283 {{#special:Recentchanges/param}}
7284 !! result
7285 Special:RecentChanges/param
7286 !! end
7287
7288 !! test
7289 {{#special:}} page name, unknown
7290 !! options
7291 msg
7292 !! input
7293 {{#special:foobarnonexistent}}
7294 !! result
7295 No such special page
7296 !! end
7297
7298 !! test
7299 {{#speciale:}} page name, known
7300 !! options
7301 msg
7302 !! input
7303 {{#speciale:Recentchanges}}
7304 !! result
7305 Special:RecentChanges
7306 !! end
7307
7308 !! test
7309 {{#speciale:}} page name with subpage, known
7310 !! options
7311 msg
7312 !! input
7313 {{#speciale:Recentchanges/param}}
7314 !! result
7315 Special:RecentChanges/param
7316 !! end
7317
7318 !! test
7319 {{#speciale:}} page name, unknown
7320 !! options
7321 msg
7322 !! input
7323 {{#speciale:foobarnonexistent}}
7324 !! result
7325 No_such_special_page
7326 !! end
7327
7328 ###
7329 ### Images
7330 ###
7331 !! test
7332 Simple image
7333 !! input
7334 [[Image:foobar.jpg]]
7335 !! result
7336 <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>
7337 </p>
7338 !! end
7339
7340 !! test
7341 Right-aligned image
7342 !! input
7343 [[Image:foobar.jpg|right]]
7344 !! result
7345 <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>
7346
7347 !! end
7348
7349 !! test
7350 Simple image (using File: namespace, now canonical)
7351 !! input
7352 [[File:foobar.jpg]]
7353 !! result
7354 <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>
7355 </p>
7356 !! end
7357
7358 !! test
7359 Image with caption
7360 !! input
7361 [[Image:foobar.jpg|right|Caption text]]
7362 !! result
7363 <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>
7364
7365 !! end
7366
7367 !! test
7368 Image with empty attribute
7369 !! input
7370 [[Image:foobar.jpg|right||Caption text]]
7371 !! result
7372 <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>
7373
7374 !! end
7375
7376 !! test
7377 Image with link tails
7378 !! input
7379 123[[Image:foobar.jpg]]456
7380 123[[Image:foobar.jpg|right]]456
7381 123[[Image:foobar.jpg|thumb]]456
7382 !! result
7383 <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
7384 </p>
7385 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
7386 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
7387
7388 !! end
7389
7390 !! test
7391 Image with multiple captions -- only last one is accepted
7392 !! input
7393 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
7394 !! result
7395 <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>
7396
7397 !! end
7398
7399 !! test
7400 Image with width attribute at different positions
7401 !! input
7402 [[Image:foobar.jpg|200px|right|Caption]]
7403 [[Image:foobar.jpg|right|200px|Caption]]
7404 [[Image:foobar.jpg|right|Caption|200px]]
7405 !! result
7406 <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>
7407 <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>
7408 <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>
7409
7410 !! end
7411
7412 !! test
7413 Image with link parameter, wiki target
7414 !! input
7415 [[Image:foobar.jpg|link=Target page]]
7416 !! result
7417 <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>
7418 </p>
7419 !! end
7420
7421 !! test
7422 Image with link parameter, URL target
7423 !! input
7424 [[Image:foobar.jpg|link=http://example.com/]]
7425 !! result
7426 <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>
7427 </p>
7428 !! end
7429
7430 !! test
7431 Image with link parameter, wgExternalLinkTarget
7432 !! input
7433 [[Image:foobar.jpg|link=http://example.com/]]
7434 !! config
7435 wgExternalLinkTarget='foobar'
7436 !! result
7437 <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>
7438 </p>
7439 !! end
7440
7441 !! test
7442 Image with link parameter, wgNoFollowLinks set to false
7443 !! input
7444 [[Image:foobar.jpg|link=http://example.com/]]
7445 !! config
7446 wgNoFollowLinks=false
7447 !! result
7448 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7449 </p>
7450 !! end
7451
7452 !! test
7453 Image with link parameter, wgNoFollowDomainExceptions
7454 !! input
7455 [[Image:foobar.jpg|link=http://example.com/]]
7456 !! config
7457 wgNoFollowDomainExceptions='example.com'
7458 !! result
7459 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7460 </p>
7461 !! end
7462
7463 !! test
7464 Image with link parameter, wgExternalLinkTarget, unnamed parameter
7465 !! input
7466 [[Image:foobar.jpg|link=http://example.com/|Title]]
7467 !! config
7468 wgExternalLinkTarget='foobar'
7469 !! result
7470 <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>
7471 </p>
7472 !! end
7473
7474 !! test
7475 Image with empty link parameter
7476 !! input
7477 [[Image:foobar.jpg|link=]]
7478 !! result
7479 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
7480 </p>
7481 !! end
7482
7483 !! test
7484 Image with link parameter (wiki target) and unnamed parameter
7485 !! input
7486 [[Image:foobar.jpg|link=Target page|Title]]
7487 !! result
7488 <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>
7489 </p>
7490 !! end
7491
7492 !! test
7493 Image with link parameter (URL target) and unnamed parameter
7494 !! input
7495 [[Image:foobar.jpg|link=http://example.com/|Title]]
7496 !! result
7497 <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>
7498 </p>
7499 !! end
7500
7501 !! test
7502 Thumbnail image with link parameter
7503 !! options
7504 php
7505 !! input
7506 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
7507 !! result
7508 <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>
7509
7510 !! end
7511
7512 !! test
7513 Manually-specified thumbnail image
7514 !! options
7515 php
7516 !! input
7517 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
7518 !! result
7519 <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>
7520
7521 !! end
7522
7523 !! test
7524 Manually-specified thumbnail image with explicit link to wiki page
7525 !! options
7526 php
7527 !! input
7528 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
7529 !! result
7530 <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>
7531
7532 !! end
7533
7534 !! test
7535 Manually-specified thumbnail image with explicit link to url
7536 !! options
7537 php
7538 !! input
7539 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
7540 !! result
7541 <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>
7542
7543 !! end
7544
7545 !! test
7546 Manually-specified thumbnail image with explicit no link
7547 !! options
7548 php
7549 !! input
7550 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
7551 !! result
7552 <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>
7553
7554 !! end
7555
7556 !! test
7557 Manually-specified thumbnail image with explicit link and alt text
7558 !! options
7559 php
7560 !! input
7561 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
7562 !! result
7563 <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>
7564
7565 !! end
7566
7567 !! test
7568 Image with frame and link
7569 !! input
7570 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
7571 !! result
7572 <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>
7573
7574 !! end
7575
7576 !! test
7577 Image with frame and link and explicit alt
7578 !! input
7579 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
7580 !! result
7581 <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>
7582
7583 !! end
7584
7585 !! test
7586 Image with wiki markup in implicit alt
7587 !! input
7588 [[Image:Foobar.jpg|testing '''bold''' in alt]]
7589 !! result
7590 <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>
7591 </p>
7592 !! end
7593
7594 !! test
7595 Image with wiki markup in explicit alt
7596 !! input
7597 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
7598 !! result
7599 <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>
7600 </p>
7601 !! end
7602
7603 !! test
7604 Link to image page- image page normally doesn't exists, hence edit link
7605 Add test with existing image page
7606 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
7607 !! input
7608 [[:Image:test]]
7609 !! result
7610 <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>
7611 </p>
7612 !! end
7613
7614 !! test
7615 bug 18784 Link to non-existent image page with caption should use caption as link text
7616 !! input
7617 [[:Image:test|caption]]
7618 !! result
7619 <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>
7620 </p>
7621 !! end
7622
7623 !! test
7624 Frameless image caption with a free URL
7625 !! input
7626 [[Image:foobar.jpg|http://example.com]]
7627 !! result
7628 <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>
7629 </p>
7630 !! end
7631
7632 !! test
7633 Thumbnail image caption with a free URL
7634 !! input
7635 [[Image:foobar.jpg|thumb|http://example.com]]
7636 !! result
7637 <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>
7638
7639 !! end
7640
7641 !! test
7642 Thumbnail image caption with a free URL and explicit alt
7643 !! input
7644 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
7645 !! result
7646 <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>
7647
7648 !! end
7649
7650 !! test
7651 BUG 1887: A ISBN with a thumbnail
7652 !! input
7653 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
7654 !! result
7655 <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>
7656
7657 !! end
7658
7659 !! test
7660 BUG 1887: A RFC with a thumbnail
7661 !! input
7662 [[Image:foobar.jpg|thumb|This is RFC 12354]]
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 class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
7665
7666 !! end
7667
7668 !! test
7669 BUG 1887: A mailto link with a thumbnail
7670 !! input
7671 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
7672 !! result
7673 <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>
7674
7675 !! end
7676
7677 # Pending resolution to bug 368
7678 !! test
7679 BUG 648: Frameless image caption with a link
7680 !! input
7681 [[Image:foobar.jpg|text with a [[link]] in it]]
7682 !! result
7683 <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>
7684 </p>
7685 !! end
7686
7687 !! test
7688 BUG 648: Frameless image caption with a link (suffix)
7689 !! input
7690 [[Image:foobar.jpg|text with a [[link]]foo in it]]
7691 !! result
7692 <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>
7693 </p>
7694 !! end
7695
7696 !! test
7697 BUG 648: Frameless image caption with an interwiki link
7698 !! input
7699 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
7700 !! result
7701 <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>
7702 </p>
7703 !! end
7704
7705 !! test
7706 BUG 648: Frameless image caption with a piped interwiki link
7707 !! input
7708 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
7709 !! result
7710 <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>
7711 </p>
7712 !! end
7713
7714 !! test
7715 Escape HTML special chars in image alt text
7716 !! input
7717 [[Image:foobar.jpg|& < > "]]
7718 !! result
7719 <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>
7720 </p>
7721 !! end
7722
7723 !! test
7724 BUG 499: Alt text should have &#1234;, not &amp;1234;
7725 !! input
7726 [[Image:foobar.jpg|&#9792;]]
7727 !! result
7728 <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>
7729 </p>
7730 !! end
7731
7732 !! test
7733 Broken image caption with link
7734 !! input
7735 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
7736 !! result
7737 <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.
7738 </p>
7739 !! end
7740
7741 !! test
7742 Image caption containing another image
7743 !! input
7744 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
7745 !! result
7746 <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>
7747
7748 !! end
7749
7750 !! test
7751 Image caption containing a newline
7752 !! input
7753 [[Image:Foobar.jpg|This
7754 *is some text]]
7755 !! result
7756 <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>
7757 </p>
7758 !!end
7759
7760 !!test
7761 Parsoid: Image caption containing leading space
7762 (The leading space should not trigger nowiki escaping in wt2wt mode)
7763 !! input
7764 [[Image:Foobar.jpg|thumb| bar]]
7765 !! result
7766 <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>
7767
7768 !!end
7769
7770 !! test
7771 Bug 3090: External links other than http: in image captions
7772 !! input
7773 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
7774 !! result
7775 <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>
7776
7777 !! end
7778
7779 !! test
7780 Custom class
7781 !! input
7782 [[Image:foobar.jpg|a|class=b]]
7783 !! result
7784 <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>
7785 </p>
7786 !! end
7787
7788 !! test
7789 Localized image handling (1).
7790 !! options
7791 language=es
7792 !! input
7793 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
7794 !! result
7795 <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>
7796
7797 !! end
7798
7799 !! test
7800 Localized image handling (2).
7801 !! options
7802 language=es
7803 !! input
7804 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
7805 !! result
7806 <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>
7807
7808 !! end
7809
7810 !! test
7811 "border", "frameless" and "class" attributes on an image.
7812 !! input
7813 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
7814 !! result
7815 <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>
7816 </p>
7817 !! end
7818
7819 !! article
7820 File:Barfoo.jpg
7821 !! text
7822 #REDIRECT [[File:Barfoo.jpg]]
7823 !! endarticle
7824
7825 !! test
7826 Redirected image
7827 !! input
7828 [[Image:Barfoo.jpg]]
7829 !! result
7830 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
7831 </p>
7832 !! end
7833
7834 !! test
7835 Missing image with uploads disabled
7836 !! options
7837 wgEnableUploads=0
7838 !! input
7839 [[Image:Foobaz.jpg]]
7840 !! result
7841 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
7842 </p>
7843 !! end
7844
7845
7846 ###
7847 ### Subpages
7848 ###
7849 !! article
7850 Subpage test/subpage
7851 !! text
7852 foo
7853 !! endarticle
7854
7855 !! test
7856 Subpage link
7857 !! options
7858 subpage title=[[Subpage test]]
7859 !! input
7860 [[/subpage]]
7861 !! result
7862 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
7863 </p>
7864 !! end
7865
7866 !! test
7867 Subpage noslash link
7868 !! options
7869 subpage title=[[Subpage test]]
7870 !!input
7871 [[/subpage/]]
7872 !! result
7873 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
7874 </p>
7875 !! end
7876
7877 !! test
7878 Disabled subpages
7879 !! input
7880 [[/subpage]]
7881 !! result
7882 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
7883 </p>
7884 !! end
7885
7886 !! test
7887 BUG 561: {{/Subpage}}
7888 !! options
7889 subpage title=[[Page]]
7890 !! input
7891 {{/Subpage}}
7892 !! result
7893 <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>
7894 </p>
7895 !! end
7896
7897 ###
7898 ### Categories
7899 ###
7900 !! article
7901 Category:MediaWiki User's Guide
7902 !! text
7903 blah
7904 !! endarticle
7905
7906 !! test
7907 Link to category
7908 !! input
7909 [[:Category:MediaWiki User's Guide]]
7910 !! result
7911 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
7912 </p>
7913 !! end
7914
7915 !! test
7916 Simple category
7917 !! options
7918 cat
7919 !! input
7920 [[Category:MediaWiki User's Guide]]
7921 !! result
7922 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7923 !! end
7924
7925 !! test
7926 PAGESINCATEGORY invalid title fatal (r33546 fix)
7927 !! input
7928 {{PAGESINCATEGORY:<bogus>}}
7929 !! result
7930 <p>0
7931 </p>
7932 !! end
7933
7934 !! test
7935 Category with different sort key
7936 !! options
7937 cat
7938 !! input
7939 [[Category:MediaWiki User's Guide|Foo]]
7940 !! result
7941 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7942 !! end
7943
7944 !! test
7945 Category with identical sort key
7946 !! options
7947 cat
7948 !! input
7949 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7950 !! result
7951 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7952 !! end
7953
7954 !! test
7955 Category with empty sort key
7956 !! options
7957 cat
7958 pst
7959 !! input
7960 [[Category:MediaWiki User's Guide|]]
7961 !! result
7962 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7963 !! end
7964
7965 !! test
7966 Category with empty sort key and parentheses
7967 !! options
7968 cat
7969 pst
7970 !! input
7971 [[Category:Foo (bar)|]]
7972 !! result
7973 [[Category:Foo (bar)|Foo]]
7974 !! end
7975
7976 !! test
7977 Category with link tail
7978 !! options
7979 cat
7980 pst
7981 !! input
7982 123[[Category:Foo]]456
7983 !! result
7984 123[[Category:Foo]]456
7985 !! end
7986
7987 !! test
7988 Category with template
7989 !! options
7990 cat
7991 pst
7992 !! input
7993 [[Category:{{echo|Foo}}]]
7994 !! result
7995 [[Category:{{echo|Foo}}]]
7996 !! end
7997
7998 !! test
7999 Category with template in sort key
8000 !! options
8001 cat
8002 pst
8003 !! input
8004 [[Category:Foo|{{echo|Bar}}]]
8005 !! result
8006 [[Category:Foo|{{echo|Bar}}]]
8007 !! end
8008
8009 !! test
8010 Category with template in sort key and title
8011 !! options
8012 cat
8013 pst
8014 !! input
8015 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8016 !! result
8017 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8018 !! end
8019
8020 !! test
8021 Category / paragraph interactions
8022 !! input
8023 Foo [[Category:Baz]] Bar
8024
8025 Foo [[Category:Baz]]
8026 Bar
8027
8028 Foo
8029 [[Category:Baz]]
8030 Bar
8031
8032 Foo
8033 [[Category:Baz]] Bar
8034
8035 Foo
8036 [[Category:Baz]]
8037 [[Category:Baz]]
8038 [[Category:Baz]]
8039 Bar
8040
8041 [[Category:Baz]]
8042 [[Category:Baz]]
8043 [[Category:Baz]]
8044
8045 [[Category:Baz]]
8046 {{echo|[[Category:Baz]]}}
8047 [[Category:Baz]]
8048 !! result
8049 <p>Foo Bar
8050 </p><p>Foo
8051 Bar
8052 </p><p>Foo
8053 Bar
8054 </p><p>Foo Bar
8055 </p><p>Foo
8056 Bar
8057 </p>
8058 !! end
8059
8060 ###
8061 ### Inter-language links
8062 ###
8063 !! test
8064 Inter-language links
8065 !! options
8066 ill
8067 !! input
8068 [[es:Alimento]]
8069 [[fr:Nourriture]]
8070 [[zh:&#39135;&#21697;]]
8071 !! result
8072 es:Alimento fr:Nourriture zh:食品
8073 !! end
8074
8075 !! test
8076 Duplicate interlanguage links (bug 24502)
8077 !! options
8078 ill
8079 !! input
8080 [[es:1]]
8081 [[es:2]]
8082 [[fr:1]]
8083 [[fr:2]]
8084 !! result
8085 es:1 fr:1
8086 !! end
8087
8088 ###
8089 ### Sections
8090 ###
8091 !! test
8092 Basic section headings
8093 !! input
8094 == Headline 1 ==
8095 Some text
8096
8097 ==Headline 2==
8098 More
8099 ===Smaller headline===
8100 Blah blah
8101 !! result
8102 <h2><span class="mw-headline" id="Headline_1">Headline 1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span></h2>
8103 <p>Some text
8104 </p>
8105 <h2><span class="mw-headline" id="Headline_2">Headline 2</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline 2">edit</a>]</span></h2>
8106 <p>More
8107 </p>
8108 <h3><span class="mw-headline" id="Smaller_headline">Smaller headline</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Smaller headline">edit</a>]</span></h3>
8109 <p>Blah blah
8110 </p>
8111 !! end
8112
8113 !! test
8114 Section headings with TOC
8115 !! input
8116 == Headline 1 ==
8117 === Subheadline 1 ===
8118 ===== Skipping a level =====
8119 ====== Skipping a level ======
8120
8121 == Headline 2 ==
8122 Some text
8123 ===Another headline===
8124 !! result
8125 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8126 <ul>
8127 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
8128 <ul>
8129 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
8130 <ul>
8131 <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>
8132 <ul>
8133 <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>
8134 </ul>
8135 </li>
8136 </ul>
8137 </li>
8138 </ul>
8139 </li>
8140 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
8141 <ul>
8142 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
8143 </ul>
8144 </li>
8145 </ul>
8146 </td></tr></table>
8147 <h2><span class="mw-headline" id="Headline_1">Headline 1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span></h2>
8148 <h3><span class="mw-headline" id="Subheadline_1">Subheadline 1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a>]</span></h3>
8149 <h5><span class="mw-headline" id="Skipping_a_level">Skipping a level</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a>]</span></h5>
8150 <h6><span class="mw-headline" id="Skipping_a_level_2">Skipping a level</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Skipping a level">edit</a>]</span></h6>
8151 <h2><span class="mw-headline" id="Headline_2">Headline 2</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a>]</span></h2>
8152 <p>Some text
8153 </p>
8154 <h3><span class="mw-headline" id="Another_headline">Another headline</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Another headline">edit</a>]</span></h3>
8155
8156 !! end
8157
8158 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
8159 !! test
8160 Handling of sections up to level 6 and beyond
8161 !! input
8162 = Level 1 Heading=
8163 == Level 2 Heading==
8164 === Level 3 Heading===
8165 ==== Level 4 Heading====
8166 ===== Level 5 Heading=====
8167 ====== Level 6 Heading======
8168 ======= Level 7 Heading=======
8169 ======== Level 8 Heading========
8170 ========= Level 9 Heading=========
8171 ========== Level 10 Heading==========
8172 !! result
8173 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8174 <ul>
8175 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
8176 <ul>
8177 <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>
8178 <ul>
8179 <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>
8180 <ul>
8181 <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>
8182 <ul>
8183 <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>
8184 <ul>
8185 <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>
8186 <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>
8187 <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>
8188 <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>
8189 <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>
8190 </ul>
8191 </li>
8192 </ul>
8193 </li>
8194 </ul>
8195 </li>
8196 </ul>
8197 </li>
8198 </ul>
8199 </li>
8200 </ul>
8201 </td></tr></table>
8202 <h1><span class="mw-headline" id="Level_1_Heading">Level 1 Heading</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a>]</span></h1>
8203 <h2><span class="mw-headline" id="Level_2_Heading">Level 2 Heading</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a>]</span></h2>
8204 <h3><span class="mw-headline" id="Level_3_Heading">Level 3 Heading</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a>]</span></h3>
8205 <h4><span class="mw-headline" id="Level_4_Heading">Level 4 Heading</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a>]</span></h4>
8206 <h5><span class="mw-headline" id="Level_5_Heading">Level 5 Heading</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a>]</span></h5>
8207 <h6><span class="mw-headline" id="Level_6_Heading">Level 6 Heading</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a>]</span></h6>
8208 <h6><span class="mw-headline" id=".3D_Level_7_Heading.3D">= Level 7 Heading=</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: = Level 7 Heading=">edit</a>]</span></h6>
8209 <h6><span class="mw-headline" id=".3D.3D_Level_8_Heading.3D.3D">== Level 8 Heading==</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: == Level 8 Heading==">edit</a>]</span></h6>
8210 <h6><span class="mw-headline" id=".3D.3D.3D_Level_9_Heading.3D.3D.3D">=== Level 9 Heading===</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: === Level 9 Heading===">edit</a>]</span></h6>
8211 <h6><span class="mw-headline" id=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D">==== Level 10 Heading====</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ==== Level 10 Heading====">edit</a>]</span></h6>
8212
8213 !! end
8214
8215 !! test
8216 TOC regression (bug 9764)
8217 !! input
8218 == title 1 ==
8219 === title 1.1 ===
8220 ==== title 1.1.1 ====
8221 === title 1.2 ===
8222 == title 2 ==
8223 === title 2.1 ===
8224 !! result
8225 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8226 <ul>
8227 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8228 <ul>
8229 <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>
8230 <ul>
8231 <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>
8232 </ul>
8233 </li>
8234 <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>
8235 </ul>
8236 </li>
8237 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8238 <ul>
8239 <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>
8240 </ul>
8241 </li>
8242 </ul>
8243 </td></tr></table>
8244 <h2><span class="mw-headline" id="title_1">title 1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span></h2>
8245 <h3><span class="mw-headline" id="title_1.1">title 1.1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span></h3>
8246 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span></h4>
8247 <h3><span class="mw-headline" id="title_1.2">title 1.2</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span></h3>
8248 <h2><span class="mw-headline" id="title_2">title 2</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span></h2>
8249 <h3><span class="mw-headline" id="title_2.1">title 2.1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span></h3>
8250
8251 !! end
8252
8253 !! test
8254 TOC with wgMaxTocLevel=3 (bug 6204)
8255 !! options
8256 wgMaxTocLevel=3
8257 !! input
8258 == title 1 ==
8259 === title 1.1 ===
8260 ==== title 1.1.1 ====
8261 === title 1.2 ===
8262 == title 2 ==
8263 === title 2.1 ===
8264 !! result
8265 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8266 <ul>
8267 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8268 <ul>
8269 <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>
8270 <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>
8271 </ul>
8272 </li>
8273 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8274 <ul>
8275 <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>
8276 </ul>
8277 </li>
8278 </ul>
8279 </td></tr></table>
8280 <h2><span class="mw-headline" id="title_1">title 1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span></h2>
8281 <h3><span class="mw-headline" id="title_1.1">title 1.1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span></h3>
8282 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span></h4>
8283 <h3><span class="mw-headline" id="title_1.2">title 1.2</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span></h3>
8284 <h2><span class="mw-headline" id="title_2">title 2</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span></h2>
8285 <h3><span class="mw-headline" id="title_2.1">title 2.1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span></h3>
8286
8287 !! end
8288
8289 !! test
8290 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
8291 !! options
8292 wgMaxTocLevel=3
8293 !! input
8294 ==Section 1==
8295 ===Section 1.1===
8296 ====Section 1.1.1====
8297 ====Section 1.1.1.1====
8298 ==Section 2==
8299 !! result
8300 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8301 <ul>
8302 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
8303 <ul>
8304 <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>
8305 </ul>
8306 </li>
8307 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
8308 </ul>
8309 </td></tr></table>
8310 <h2><span class="mw-headline" id="Section_1">Section 1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a>]</span></h2>
8311 <h3><span class="mw-headline" id="Section_1.1">Section 1.1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 1.1">edit</a>]</span></h3>
8312 <h4><span class="mw-headline" id="Section_1.1.1">Section 1.1.1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Section 1.1.1">edit</a>]</span></h4>
8313 <h4><span class="mw-headline" id="Section_1.1.1.1">Section 1.1.1.1</span> <span class="mw-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></h4>
8314 <h2><span class="mw-headline" id="Section_2">Section 2</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Section 2">edit</a>]</span></h2>
8315
8316 !! end
8317
8318
8319 !! test
8320 Resolving duplicate section names
8321 !! input
8322 == Foo bar ==
8323 == Foo bar ==
8324 !! result
8325 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span></h2>
8326 <h2><span class="mw-headline" id="Foo_bar_2">Foo bar</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo bar">edit</a>]</span></h2>
8327
8328 !! end
8329
8330 !! test
8331 Resolving duplicate section names with differing case (bug 10721)
8332 !! input
8333 == Foo bar ==
8334 == Foo Bar ==
8335 !! result
8336 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span></h2>
8337 <h2><span class="mw-headline" id="Foo_Bar_2">Foo Bar</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a>]</span></h2>
8338
8339 !! end
8340
8341 !! article
8342 Template:sections
8343 !! text
8344 ===Section 1===
8345 ==Section 2==
8346 !! endarticle
8347
8348 !! test
8349 Template with sections, __NOTOC__
8350 !! input
8351 __NOTOC__
8352 ==Section 0==
8353 {{sections}}
8354 ==Section 4==
8355 !! result
8356 <h2><span class="mw-headline" id="Section_0">Section 0</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 0">edit</a>]</span></h2>
8357 <h3><span class="mw-headline" id="Section_1">Section 1</span> <span class="mw-editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-1" title="Template:Sections">edit</a>]</span></h3>
8358 <h2><span class="mw-headline" id="Section_2">Section 2</span> <span class="mw-editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-2" title="Template:Sections">edit</a>]</span></h2>
8359 <h2><span class="mw-headline" id="Section_4">Section 4</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 4">edit</a>]</span></h2>
8360
8361 !! end
8362
8363 !! test
8364 __NOEDITSECTION__ keyword
8365 !! input
8366 __NOEDITSECTION__
8367 ==Section 1==
8368 ==Section 2==
8369 !! result
8370 <h2><span class="mw-headline" id="Section_1">Section 1</span> </h2>
8371 <h2><span class="mw-headline" id="Section_2">Section 2</span> </h2>
8372
8373 !! end
8374
8375 !! test
8376 Link inside a section heading
8377 !! input
8378 ==Section with a [[Main Page|link]] in it==
8379 !! result
8380 <h2><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> <span class="mw-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></h2>
8381
8382 !! end
8383
8384 !! test
8385 TOC regression (bug 12077)
8386 !! input
8387 __TOC__
8388 == title 1 ==
8389 === title 1.1 ===
8390 == title 2 ==
8391 !! result
8392 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8393 <ul>
8394 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8395 <ul>
8396 <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>
8397 </ul>
8398 </li>
8399 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
8400 </ul>
8401 </td></tr></table>
8402 <h2><span class="mw-headline" id="title_1">title 1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span></h2>
8403 <h3><span class="mw-headline" id="title_1.1">title 1.1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span></h3>
8404 <h2><span class="mw-headline" id="title_2">title 2</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 2">edit</a>]</span></h2>
8405
8406 !! end
8407
8408 !! test
8409 BUG 1219 URL next to image (good)
8410 !! input
8411 http://example.com [[Image:foobar.jpg]]
8412 !! result
8413 <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>
8414 </p>
8415 !!end
8416
8417 !! test
8418 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
8419 !! input
8420 ===
8421 The line above must have a trailing space!
8422 === <!--
8423 --> <!-- -->
8424 But just in case it doesn't...
8425 !! result
8426 <h1><span class="mw-headline" id=".3D">=</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: =">edit</a>]</span></h1>
8427 <p>The line above must have a trailing space!
8428 </p>
8429 <h1><span class="mw-headline" id=".3D_2">=</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =">edit</a>]</span></h1>
8430 <p>But just in case it doesn't...
8431 </p>
8432 !! end
8433
8434 !! test
8435 Header with special characters (bug 25462)
8436 !! input
8437 The tooltips shall not show entities to the user (ie. be double escaped)
8438
8439 == text > text ==
8440 section 1
8441
8442 == text < text ==
8443 section 2
8444
8445 == text & text ==
8446 section 3
8447
8448 == text ' text ==
8449 section 4
8450
8451 == text " text ==
8452 section 5
8453 !! result
8454 <p>The tooltips shall not show entities to the user (ie. be double escaped)
8455 </p>
8456 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8457 <ul>
8458 <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>
8459 <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>
8460 <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>
8461 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
8462 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
8463 </ul>
8464 </td></tr></table>
8465 <h2><span class="mw-headline" id="text_.3E_text">text &gt; text</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: text > text">edit</a>]</span></h2>
8466 <p>section 1
8467 </p>
8468 <h2><span class="mw-headline" id="text_.3C_text">text &lt; text</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: text &lt; text">edit</a>]</span></h2>
8469 <p>section 2
8470 </p>
8471 <h2><span class="mw-headline" id="text_.26_text">text &amp; text</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: text &amp; text">edit</a>]</span></h2>
8472 <p>section 3
8473 </p>
8474 <h2><span class="mw-headline" id="text_.27_text">text ' text</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: text ' text">edit</a>]</span></h2>
8475 <p>section 4
8476 </p>
8477 <h2><span class="mw-headline" id="text_.22_text">text " text</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: text &quot; text">edit</a>]</span></h2>
8478 <p>section 5
8479 </p>
8480 !! end
8481
8482 !! test
8483 Headers with excess '=' characters
8484 (Are similar tests necessary beyond the 1st level?)
8485 !! input
8486 =foo==
8487 ==foo=
8488 =''italic'' heading==
8489 ==''italic'' heading=
8490 !! result
8491 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8492 <ul>
8493 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
8494 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
8495 <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>
8496 <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>
8497 </ul>
8498 </td></tr></table>
8499 <h1><span class="mw-headline" id="foo.3D">foo=</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: foo=">edit</a>]</span></h1>
8500 <h1><span class="mw-headline" id=".3Dfoo">=foo</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =foo">edit</a>]</span></h1>
8501 <h1><span class="mw-headline" id="italic_heading.3D"><i>italic</i> heading=</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: italic heading=">edit</a>]</span></h1>
8502 <h1><span class="mw-headline" id=".3Ditalic_heading">=<i>italic</i> heading</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: =italic heading">edit</a>]</span></h1>
8503
8504 !! end
8505
8506 !! test
8507 HTML headers vs TOC (bug 23393)
8508 (__NOEDITSECTION__ for clearer output, doesn't matter here)
8509 !! input
8510 <h1>Header 1</h1>
8511 == Header 1.1 ==
8512 == Header 1.2 ==
8513
8514 <h1>Header 2
8515 </h1>
8516 == Header 2.1 ==
8517 == Header 2.2 ==
8518 __NOEDITSECTION__
8519 !! result
8520 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8521 <ul>
8522 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
8523 <ul>
8524 <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>
8525 <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>
8526 </ul>
8527 </li>
8528 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
8529 <ul>
8530 <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>
8531 <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>
8532 </ul>
8533 </li>
8534 </ul>
8535 </td></tr></table>
8536 <h1><span class="mw-headline" id="Header_1">Header 1</span> </h1>
8537 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span> </h2>
8538 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span> </h2>
8539 <h1><span class="mw-headline" id="Header_2">Header 2</span> </h1>
8540 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span> </h2>
8541 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span> </h2>
8542
8543 !! end
8544
8545 !! test
8546 BUG 1219 URL next to image (broken)
8547 !! input
8548 http://example.com[[Image:foobar.jpg]]
8549 !! result
8550 <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>
8551 </p>
8552 !!end
8553
8554 !! test
8555 Bug 1186 news: in the middle of text
8556 !! input
8557 http://en.wikinews.org/wiki/Wikinews:Workplace
8558 !! result
8559 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
8560 </p>
8561 !!end
8562
8563
8564 !! test
8565 Namespaced link must have a title
8566 !! input
8567 [[Project:]]
8568 !! result
8569 <p>[[Project:]]
8570 </p>
8571 !!end
8572
8573 !! test
8574 Namespaced link must have a title (bad fragment version)
8575 !! input
8576 [[Project:#fragment]]
8577 !! result
8578 <p>[[Project:#fragment]]
8579 </p>
8580 !!end
8581
8582
8583 ###
8584 ### HTML tags and HTML attributes
8585 ###
8586
8587 !! test
8588 div with no attributes
8589 !! input
8590 <div>HTML rocks</div>
8591 !! result
8592 <div>HTML rocks</div>
8593
8594 !! end
8595
8596 !! test
8597 div with double-quoted attribute
8598 !! input
8599 <div id="rock">HTML rocks</div>
8600 !! result
8601 <div id="rock">HTML rocks</div>
8602
8603 !! end
8604
8605 !! test
8606 div with single-quoted attribute
8607 !! input
8608 <div id='rock'>HTML rocks</div>
8609 !! result
8610 <div id="rock">HTML rocks</div>
8611
8612 !! end
8613
8614 !! test
8615 div with unquoted attribute
8616 !! input
8617 <div id=rock>HTML rocks</div>
8618 !! result
8619 <div id="rock">HTML rocks</div>
8620
8621 !! end
8622
8623 !! test
8624 div with illegal double attributes
8625 !! input
8626 <div id="a" id="b">HTML rocks</div>
8627 !! result
8628 <div id="b">HTML rocks</div>
8629
8630 !!end
8631
8632 # FIXME: produce empty string instead of "class" in the PHP parser, following
8633 # the HTML5 spec.
8634 !! test
8635 div with empty attribute value, space before equals
8636 !! options
8637 parsoid
8638 !! input
8639 <div class =>HTML rocks</div>
8640 !! result
8641 <div class="">HTML rocks</div>
8642
8643 !! end
8644
8645 # The PHP parser escapes the opening brace to &#123; for some reason, so
8646 # disabled this test for it.
8647 !! test
8648 div with braces in attribute value
8649 !! options
8650 parsoid
8651 !! input
8652 <div title="{}">Foo</div>
8653 !! result
8654 <div title="{}">Foo</div>
8655 !! end
8656
8657 # This it very inconsistent in the PHP parser: it returns
8658 # class="class" if there is a space between the name and the equal sign (see
8659 # 'div with empty attribute value, space before equals'), but strips the
8660 # attribute completely if the space is missing. We hope that not much content
8661 # depends on this, so are implementing the behavior below in Parsoid for
8662 # consistencies' sake. Disabled for the PHP parser.
8663 # FIXME: fix this behavior in the PHP parser?
8664 !! test
8665 div with empty attribute value, no space before equals
8666 !! options
8667 parsoid
8668 !! input
8669 <div class=>HTML rocks</div>
8670 !! result
8671 <div class="">HTML rocks</div>
8672
8673 !! end
8674
8675 !! test
8676 HTML multiple attributes correction
8677 !! input
8678 <p class="error" class="awesome">Awesome!</p>
8679 !! result
8680 <p class="awesome">Awesome!</p>
8681
8682 !!end
8683
8684 !! test
8685 Table multiple attributes correction
8686 !! input
8687 {|
8688 !+ class="error" class="awesome"| status
8689 |}
8690 !! result
8691 <table>
8692 <tr>
8693 <th class="awesome"> status
8694 </th></tr></table>
8695
8696 !!end
8697
8698 !! test
8699 DIV IN UPPERCASE
8700 !! input
8701 <DIV ID="x">HTML ROCKS</DIV>
8702 !! result
8703 <div id="x">HTML ROCKS</div>
8704
8705 !!end
8706
8707 !! test
8708 Non-ASCII pseudo-tags are rendered as text
8709 !! input
8710 <khyô>
8711 !! result
8712 <p>&lt;khyô&gt;
8713 </p>
8714 !! end
8715
8716 !! test
8717 Pseudo-tag with URL 'name' renders as url link
8718 !! input
8719 <http://example.com/>
8720 !! result
8721 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
8722 </p>
8723 !! end
8724
8725 !! test
8726 text with amp in the middle of nowhere
8727 !! input
8728 Remember AT&T?
8729 !!result
8730 <p>Remember AT&amp;T?
8731 </p>
8732 !! end
8733
8734 !! test
8735 text with character entity: eacute
8736 !! input
8737 I always thought &eacute; was a cute letter.
8738 !! result
8739 <p>I always thought &#233; was a cute letter.
8740 </p>
8741 !! end
8742
8743 !! test
8744 text with entity-escaped character entity-like string: eacute
8745 !! input
8746 I always thought &amp;eacute; was a cute letter.
8747 !! result
8748 <p>I always thought &amp;eacute; was a cute letter.
8749 </p>
8750 !! end
8751
8752 !! test
8753 text with undefined character entity: xacute
8754 !! input
8755 I always thought &xacute; was a cute letter.
8756 !! result
8757 <p>I always thought &amp;xacute; was a cute letter.
8758 </p>
8759 !! end
8760
8761
8762 ###
8763 ### Media links
8764 ###
8765
8766 !! test
8767 Media link
8768 !! input
8769 [[Media:Foobar.jpg]]
8770 !! result
8771 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
8772 </p>
8773 !! end
8774
8775 !! test
8776 Media link with text
8777 !! input
8778 [[Media:Foobar.jpg|A neat file to look at]]
8779 !! result
8780 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
8781 </p>
8782 !! end
8783
8784 # FIXME: this is still bad HTML tag nesting
8785 !! test
8786 Media link with nasty text
8787 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
8788 !! input
8789 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
8790 !! result
8791 <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>
8792
8793 !! end
8794
8795 !! test
8796 Media link to nonexistent file (bug 1702)
8797 !! input
8798 [[Media:No such.jpg]]
8799 !! result
8800 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
8801 </p>
8802 !! end
8803
8804 !! test
8805 Image link to nonexistent file (bug 1850 - good)
8806 !! input
8807 [[Image:No such.jpg]]
8808 !! result
8809 <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>
8810 </p>
8811 !! end
8812
8813 !! test
8814 :Image link to nonexistent file (bug 1850 - bad)
8815 !! input
8816 [[:Image:No such.jpg]]
8817 !! result
8818 <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>
8819 </p>
8820 !! end
8821
8822
8823
8824 !! test
8825 Character reference normalization in link text (bug 1938)
8826 !! input
8827 [[Main Page|this&that]]
8828 !! result
8829 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
8830 </p>
8831 !!end
8832
8833 !! article
8834 אַ
8835 !! text
8836 Test for unicode normalization
8837
8838 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
8839 !! endarticle
8840
8841 !! test
8842 (bug 19451) Links should refer to the normalized form.
8843 !! input
8844 [[&#xFB2E;]]
8845 [[&#x5d0;&#x5b7;]]
8846 [[&#x5d0;ַ]]
8847 [[א&#x5b7;]]
8848 [[אַ]]
8849 !! result
8850 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
8851 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
8852 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
8853 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
8854 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
8855 </p>
8856 !! end
8857
8858 !! test
8859 Empty attribute crash test (bug 2067)
8860 !! input
8861 <font color="">foo</font>
8862 !! result
8863 <p><font color="">foo</font>
8864 </p>
8865 !! end
8866
8867 !! test
8868 Empty attribute crash test single-quotes (bug 2067)
8869 !! input
8870 <font color=''>foo</font>
8871 !! result
8872 <p><font color="">foo</font>
8873 </p>
8874 !! end
8875
8876 !! test
8877 Attribute test: equals, then nothing
8878 !! input
8879 <font color=>foo</font>
8880 !! result
8881 <p><font>foo</font>
8882 </p>
8883 !! end
8884
8885 !! test
8886 Attribute test: unquoted value
8887 !! input
8888 <font color=x>foo</font>
8889 !! result
8890 <p><font color="x">foo</font>
8891 </p>
8892 !! end
8893
8894 !! test
8895 Attribute test: unquoted but illegal value (hash)
8896 !! input
8897 <font color=#x>foo</font>
8898 !! result
8899 <p><font color="#x">foo</font>
8900 </p>
8901 !! end
8902
8903 !! test
8904 Attribute test: no value
8905 !! input
8906 <font color>foo</font>
8907 !! result
8908 <p><font color="color">foo</font>
8909 </p>
8910 !! end
8911
8912 !! test
8913 Bug 2095: link with three closing brackets
8914 !! input
8915 [[Main Page]]]
8916 !! result
8917 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
8918 </p>
8919 !! end
8920
8921 !! test
8922 Bug 2095: link with pipe and three closing brackets
8923 !! input
8924 [[Main Page|link]]]
8925 !! result
8926 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
8927 </p>
8928 !! end
8929
8930 !! test
8931 Bug 2095: link with pipe and three closing brackets, version 2
8932 !! input
8933 [[Main Page|[http://example.com/]]]
8934 !! result
8935 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
8936 </p>
8937 !! end
8938
8939
8940 ###
8941 ### Safety
8942 ###
8943
8944 !! article
8945 Template:Dangerous attribute
8946 !! text
8947 " onmouseover="alert(document.cookie)
8948 !! endarticle
8949
8950 !! article
8951 Template:Dangerous style attribute
8952 !! text
8953 border-size: expression(alert(document.cookie))
8954 !! endarticle
8955
8956 !! article
8957 Template:Div style
8958 !! text
8959 <div style="float: right; {{{1}}}">Magic div</div>
8960 !! endarticle
8961
8962 !! test
8963 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
8964 !! input
8965 <div title="{{test}}"></div>
8966 !! result
8967 <div title="This is a test template"></div>
8968
8969 !! end
8970
8971 !! test
8972 Bug 2304: HTML attribute safety (dangerous template; 2309)
8973 !! input
8974 <div title="{{dangerous attribute}}"></div>
8975 !! result
8976 <div title=""></div>
8977
8978 !! end
8979
8980 !! test
8981 Bug 2304: HTML attribute safety (dangerous style template; 2309)
8982 !! input
8983 <div style="{{dangerous style attribute}}"></div>
8984 !! result
8985 <div style="/* insecure input */"></div>
8986
8987 !! end
8988
8989 !! test
8990 Bug 2304: HTML attribute safety (safe parameter; 2309)
8991 !! input
8992 {{div style|width: 200px}}
8993 !! result
8994 <div style="float: right; width: 200px">Magic div</div>
8995
8996 !! end
8997
8998 !! test
8999 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
9000 !! input
9001 {{div style|width: expression(alert(document.cookie))}}
9002 !! result
9003 <div style="/* insecure input */">Magic div</div>
9004
9005 !! end
9006
9007 !! test
9008 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
9009 !! input
9010 {{div style|"><script>alert(document.cookie)</script>}}
9011 !! result
9012 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9013
9014 !! end
9015
9016 !! test
9017 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
9018 !! input
9019 {{div style|" ><script>alert(document.cookie)</script>}}
9020 !! result
9021 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9022
9023 !! end
9024
9025 !! test
9026 Bug 2304: HTML attribute safety (link)
9027 !! input
9028 <div title="[[Main Page]]"></div>
9029 !! result
9030 <div title="&#91;&#91;Main Page]]"></div>
9031
9032 !! end
9033
9034 !! test
9035 Bug 2304: HTML attribute safety (italics)
9036 !! input
9037 <div title="''foobar''"></div>
9038 !! result
9039 <div title="&#39;&#39;foobar&#39;&#39;"></div>
9040
9041 !! end
9042
9043 !! test
9044 Bug 2304: HTML attribute safety (bold)
9045 !! input
9046 <div title="'''foobar'''"></div>
9047 !! result
9048 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
9049
9050 !! end
9051
9052
9053 !! test
9054 Bug 2304: HTML attribute safety (ISBN)
9055 !! input
9056 <div title="ISBN 1234567890"></div>
9057 !! result
9058 <div title="&#73;SBN 1234567890"></div>
9059
9060 !! end
9061
9062 !! test
9063 Bug 2304: HTML attribute safety (RFC)
9064 !! input
9065 <div title="RFC 1234"></div>
9066 !! result
9067 <div title="&#82;FC 1234"></div>
9068
9069 !! end
9070
9071 !! test
9072 Bug 2304: HTML attribute safety (PMID)
9073 !! input
9074 <div title="PMID 1234567890"></div>
9075 !! result
9076 <div title="&#80;MID 1234567890"></div>
9077
9078 !! end
9079
9080 !! test
9081 Bug 2304: HTML attribute safety (web link)
9082 !! input
9083 <div title="http://example.com/"></div>
9084 !! result
9085 <div title="http&#58;//example.com/"></div>
9086
9087 !! end
9088
9089 !! test
9090 Bug 2304: HTML attribute safety (named web link)
9091 !! input
9092 <div title="[http://example.com/ link]"></div>
9093 !! result
9094 <div title="&#91;http&#58;//example.com/ link]"></div>
9095
9096 !! end
9097
9098 !! test
9099 Bug 3244: HTML attribute safety (extension; safe)
9100 !! input
9101 <div style="<nowiki>background:blue</nowiki>"></div>
9102 !! result
9103 <div style="background:blue"></div>
9104
9105 !! end
9106
9107 !! test
9108 Bug 3244: HTML attribute safety (extension; unsafe)
9109 !! input
9110 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
9111 !! result
9112 <div style="/* insecure input */"></div>
9113
9114 !! end
9115
9116 # More MSIE fun discovered by Tom Gilder
9117
9118 !! test
9119 MSIE CSS safety test: spurious slash
9120 !! input
9121 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
9122 !! result
9123 <div style="/* insecure input */">evil</div>
9124
9125 !! end
9126
9127 !! test
9128 MSIE CSS safety test: hex code
9129 !! input
9130 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
9131 !! result
9132 <div style="/* insecure input */">evil</div>
9133
9134 !! end
9135
9136 !! test
9137 MSIE CSS safety test: comment in url
9138 !! input
9139 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
9140 !! result
9141 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
9142
9143 !! end
9144
9145 !! test
9146 MSIE CSS safety test: comment in expression
9147 !! input
9148 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
9149 !! result
9150 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
9151
9152 !! end
9153
9154
9155 !! test
9156 Table attribute legitimate extension
9157 !! input
9158 {|
9159 !+ style="<nowiki>color:blue</nowiki>"| status
9160 |}
9161 !! result
9162 <table>
9163 <tr>
9164 <th style="color:blue"> status
9165 </th></tr></table>
9166
9167 !!end
9168
9169 !! test
9170 Table attribute safety
9171 !! input
9172 {|
9173 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
9174 |}
9175 !! result
9176 <table>
9177 <tr>
9178 <th style="/* insecure input */"> status
9179 </th></tr></table>
9180
9181 !! end
9182
9183 !! test
9184 CSS line continuation 1
9185 !! input
9186 <div style="background-image: u\&#10;rl(test.jpg);"></div>
9187 !! result
9188 <div style="/* insecure input */"></div>
9189
9190 !! end
9191
9192 !! test
9193 CSS line continuation 2
9194 !! input
9195 <div style="background-image: u\&#13;rl(test.jpg); "></div>
9196 !! result
9197 <div style="/* insecure input */"></div>
9198
9199 !! end
9200
9201 !! article
9202 Template:Identity
9203 !! text
9204 {{{1}}}
9205 !! endarticle
9206
9207 !! test
9208 Expansion of multi-line templates in attribute values (bug 6255)
9209 !! input
9210 <div style="background: {{identity|#00FF00}}">-</div>
9211 !! result
9212 <div style="background: #00FF00">-</div>
9213
9214 !! end
9215
9216
9217 !! test
9218 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
9219 !! input
9220 <div style="background:
9221 #00FF00">-</div>
9222 !! result
9223 <div style="background: #00FF00">-</div>
9224
9225 !! end
9226
9227 !! test
9228 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
9229 !! input
9230 <div style="background: &#10;#00FF00">-</div>
9231 !! result
9232 <div style="background: &#10;#00FF00">-</div>
9233
9234 !! end
9235
9236 ###
9237 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
9238 ###
9239 !! test
9240 Parser hook: empty input
9241 !! input
9242 <tag></tag>
9243 !! result
9244 <pre>
9245 ''
9246 array (
9247 )
9248 </pre>
9249
9250 !! end
9251
9252 !! test
9253 Parser hook: empty input using terminated empty elements
9254 !! input
9255 <tag/>
9256 !! result
9257 <pre>
9258 NULL
9259 array (
9260 )
9261 </pre>
9262
9263 !! end
9264
9265 !! test
9266 Parser hook: empty input using terminated empty elements (space before)
9267 !! input
9268 <tag />
9269 !! result
9270 <pre>
9271 NULL
9272 array (
9273 )
9274 </pre>
9275
9276 !! end
9277
9278 !! test
9279 Parser hook: basic input
9280 !! input
9281 <tag>input</tag>
9282 !! result
9283 <pre>
9284 'input'
9285 array (
9286 )
9287 </pre>
9288
9289 !! end
9290
9291
9292 !! test
9293 Parser hook: case insensitive
9294 !! input
9295 <TAG>input</TAG>
9296 !! result
9297 <pre>
9298 'input'
9299 array (
9300 )
9301 </pre>
9302
9303 !! end
9304
9305
9306 !! test
9307 Parser hook: case insensitive, redux
9308 !! input
9309 <TaG>input</TAg>
9310 !! result
9311 <pre>
9312 'input'
9313 array (
9314 )
9315 </pre>
9316
9317 !! end
9318
9319 !! test
9320 Parser hook: nested tags
9321 !! options
9322 noxml
9323 !! input
9324 <tag><tag></tag></tag>
9325 !! result
9326 <pre>
9327 '<tag>'
9328 array (
9329 )
9330 </pre>&lt;/tag&gt;
9331
9332 !! end
9333
9334 !! test
9335 Parser hook: basic arguments
9336 !! input
9337 <tag width=200 height = "100" depth = '50' square></tag>
9338 !! result
9339 <pre>
9340 ''
9341 array (
9342 'width' => '200',
9343 'height' => '100',
9344 'depth' => '50',
9345 'square' => 'square',
9346 )
9347 </pre>
9348
9349 !! end
9350
9351 !! test
9352 Parser hook: argument containing a forward slash (bug 5344)
9353 !! input
9354 <tag filename='/tmp/bla'></tag>
9355 !! result
9356 <pre>
9357 ''
9358 array (
9359 'filename' => '/tmp/bla',
9360 )
9361 </pre>
9362
9363 !! end
9364
9365 !! test
9366 Parser hook: empty input using terminated empty elements (bug 2374)
9367 !! input
9368 <tag foo=bar/>text
9369 !! result
9370 <pre>
9371 NULL
9372 array (
9373 'foo' => 'bar',
9374 )
9375 </pre>text
9376
9377 !! end
9378
9379 # </tag> should be output literally since there is no matching tag that begins it
9380 !! test
9381 Parser hook: basic arguments using terminated empty elements (bug 2374)
9382 !! input
9383 <tag width=200 height = "100" depth = '50' square/>
9384 other stuff
9385 </tag>
9386 !! result
9387 <pre>
9388 NULL
9389 array (
9390 'width' => '200',
9391 'height' => '100',
9392 'depth' => '50',
9393 'square' => 'square',
9394 )
9395 </pre>
9396 <p>other stuff
9397 &lt;/tag&gt;
9398 </p>
9399 !! end
9400
9401 ###
9402 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
9403 ###
9404
9405 !! test
9406 Parser hook: static parser hook not inside a comment
9407 !! input
9408 <statictag>hello, world</statictag>
9409 <statictag action=flush/>
9410 !! result
9411 <p>hello, world
9412 </p>
9413 !! end
9414
9415
9416 !! test
9417 Parser hook: static parser hook inside a comment
9418 !! input
9419 <!-- <statictag>hello, world</statictag> -->
9420 <statictag action=flush/>
9421 !! result
9422 <p><br />
9423 </p>
9424 !! end
9425
9426 # Nested template calls; this case was broken by Parser.php rev 1.506,
9427 # since reverted.
9428
9429 !! article
9430 Template:One-parameter
9431 !! text
9432 (My parameter is: {{{1}}})
9433 !! endarticle
9434
9435 !! article
9436 Template:Map-one-parameter
9437 !! text
9438 {{{{{1}}}|{{{2}}}}}
9439 !! endarticle
9440
9441 !! test
9442 Nested template calls
9443 !! input
9444 {{Map-one-parameter|One-parameter|param}}
9445 !! result
9446 <p>(My parameter is: param)
9447 </p>
9448 !! end
9449
9450
9451 ###
9452 ### Sanitizer
9453 ###
9454 !! test
9455 Sanitizer: Closing of open tags
9456 !! input
9457 <s></s><table></table>
9458 !! result
9459 <s></s><table></table>
9460
9461 !! end
9462
9463 !! test
9464 Sanitizer: Closing of open but not closed tags
9465 !! input
9466 <s>foo
9467 !! result
9468 <p><s>foo</s>
9469 </p>
9470 !! end
9471
9472 !! test
9473 Sanitizer: Closing of closed but not open tags
9474 !! input
9475 </s>
9476 !! result
9477 <p>&lt;/s&gt;
9478 </p>
9479 !! end
9480
9481 !! test
9482 Sanitizer: Closing of closed but not open table tags
9483 !! input
9484 Table not started</td></tr></table>
9485 !! result
9486 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
9487 </p>
9488 !! end
9489
9490 !! test
9491 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
9492 !! input
9493 <span id="æ: v">byte</span>[[#æ: v|backlink]]
9494 !! result
9495 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
9496 </p>
9497 !! end
9498
9499 !! test
9500 Sanitizer: Validating the contents of the id attribute (bug 4515)
9501 !! options
9502 disabled
9503 !! input
9504 <br id=9 />
9505 !! result
9506 Something, but definitely not <br id="9" />...
9507 !! end
9508
9509 !! test
9510 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
9511 !! options
9512 disabled
9513 !! input
9514 <br id="foo" /><br id="foo" />
9515 !! result
9516 Something need to be done. foo-2 ?
9517 !! end
9518
9519 !! test
9520 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
9521 !! input
9522 <div itemscope>
9523 <meta itemprop="hello" content="world">
9524 <meta http-equiv="refresh" content="5">
9525 <meta itemprop="hello" http-equiv="refresh" content="5">
9526 <link itemprop="hello" href="{{SERVER}}">
9527 <link rel="stylesheet" href="{{SERVER}}">
9528 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
9529 </div>
9530 !! result
9531 <div itemscope="itemscope">
9532 <p> <meta itemprop="hello" content="world" />
9533 &lt;meta http-equiv="refresh" content="5"&gt;
9534 <meta itemprop="hello" content="5" />
9535 </p>
9536 <link itemprop="hello" href="http&#58;//example.org" />
9537 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
9538 <link itemprop="hello" href="http&#58;//example.org" />
9539 </div>
9540
9541 !! end
9542
9543 !! test
9544 Language converter: output gets cut off unexpectedly (bug 5757)
9545 !! options
9546 language=zh
9547 !! input
9548 this bit is safe: }-
9549
9550 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
9551
9552 then we get cut off here: }-
9553
9554 all additional text is vanished
9555 !! result
9556 <p>this bit is safe: }-
9557 </p><p>but if we add a conversion instance: xxx
9558 </p><p>then we get cut off here: }-
9559 </p><p>all additional text is vanished
9560 </p>
9561 !! end
9562
9563 !! test
9564 Self closed html pairs (bug 5487)
9565 !! options
9566 !! input
9567 <center><font id="bug" />Centered text</center>
9568 <div><font id="bug2" />In div text</div>
9569 !! result
9570 <center>&lt;font id="bug" /&gt;Centered text</center>
9571 <div>&lt;font id="bug2" /&gt;In div text</div>
9572
9573 !! end
9574
9575 #
9576 #
9577 #
9578
9579 !! test
9580 Punctuation: nbsp before exclamation
9581 !! input
9582 C'est grave !
9583 !! result
9584 <p>C'est grave&#160;!
9585 </p>
9586 !! end
9587
9588 !! test
9589 Punctuation: CSS !important (bug 11874)
9590 !! input
9591 <div style="width:50% !important">important</div>
9592 !! result
9593 <div style="width:50% !important">important</div>
9594
9595 !!end
9596
9597 !! test
9598 Punctuation: CSS ! important (bug 11874; with space after)
9599 !! input
9600 <div style="width:50% ! important">important</div>
9601 !! result
9602 <div style="width:50% ! important">important</div>
9603
9604 !!end
9605
9606
9607 !! test
9608 HTML bullet list, closed tags (bug 5497)
9609 !! input
9610 <ul>
9611 <li>One</li>
9612 <li>Two</li>
9613 </ul>
9614 !! result
9615 <ul>
9616 <li>One</li>
9617 <li>Two</li>
9618 </ul>
9619
9620 !! end
9621
9622 !! test
9623 HTML bullet list, unclosed tags (bug 5497)
9624 !! options
9625 disabled
9626 !! input
9627 <ul>
9628 <li>One
9629 <li>Two
9630 </ul>
9631 !! result
9632 <ul>
9633 <li>One
9634 </li><li>Two
9635 </li></ul>
9636
9637 !! end
9638
9639 !! test
9640 HTML ordered list, closed tags (bug 5497)
9641 !! input
9642 <ol>
9643 <li>One</li>
9644 <li>Two</li>
9645 </ol>
9646 !! result
9647 <ol>
9648 <li>One</li>
9649 <li>Two</li>
9650 </ol>
9651
9652 !! end
9653
9654 !! test
9655 HTML ordered list, unclosed tags (bug 5497)
9656 !! options
9657 disabled
9658 !! input
9659 <ol>
9660 <li>One
9661 <li>Two
9662 </ol>
9663 !! result
9664 <ol>
9665 <li>One
9666 </li><li>Two
9667 </li></ol>
9668
9669 !! end
9670
9671 !! test
9672 HTML nested bullet list, closed tags (bug 5497)
9673 !! input
9674 <ul>
9675 <li>One</li>
9676 <li>Two:
9677 <ul>
9678 <li>Sub-one</li>
9679 <li>Sub-two</li>
9680 </ul>
9681 </li>
9682 </ul>
9683 !! result
9684 <ul>
9685 <li>One</li>
9686 <li>Two:
9687 <ul>
9688 <li>Sub-one</li>
9689 <li>Sub-two</li>
9690 </ul>
9691 </li>
9692 </ul>
9693
9694 !! end
9695
9696 !! test
9697 HTML nested bullet list, open tags (bug 5497)
9698 !! options
9699 disabled
9700 !! input
9701 <ul>
9702 <li>One
9703 <li>Two:
9704 <ul>
9705 <li>Sub-one
9706 <li>Sub-two
9707 </ul>
9708 </ul>
9709 !! result
9710 <ul>
9711 <li>One
9712 </li><li>Two:
9713 <ul>
9714 <li>Sub-one
9715 </li><li>Sub-two
9716 </li></ul>
9717 </li></ul>
9718
9719 !! end
9720
9721 !! test
9722 HTML nested ordered list, closed tags (bug 5497)
9723 !! input
9724 <ol>
9725 <li>One</li>
9726 <li>Two:
9727 <ol>
9728 <li>Sub-one</li>
9729 <li>Sub-two</li>
9730 </ol>
9731 </li>
9732 </ol>
9733 !! result
9734 <ol>
9735 <li>One</li>
9736 <li>Two:
9737 <ol>
9738 <li>Sub-one</li>
9739 <li>Sub-two</li>
9740 </ol>
9741 </li>
9742 </ol>
9743
9744 !! end
9745
9746 !! test
9747 HTML nested ordered list, open tags (bug 5497)
9748 !! options
9749 disabled
9750 !! input
9751 <ol>
9752 <li>One
9753 <li>Two:
9754 <ol>
9755 <li>Sub-one
9756 <li>Sub-two
9757 </ol>
9758 </ol>
9759 !! result
9760 <ol>
9761 <li>One
9762 </li><li>Two:
9763 <ol>
9764 <li>Sub-one
9765 </li><li>Sub-two
9766 </li></ol>
9767 </li></ol>
9768
9769 !! end
9770
9771 !! test
9772 HTML ordered list item with parameters oddity
9773 !! input
9774 <ol><li id="fragment">One</li></ol>
9775 !! result
9776 <ol><li id="fragment">One</li></ol>
9777
9778 !! end
9779
9780 !!test
9781 bug 5918: autonumbering
9782 !! input
9783 [http://first/] [http://second] [ftp://ftp]
9784
9785 ftp://inlineftp
9786
9787 [mailto:enclosed@mail.tld With target]
9788
9789 [mailto:enclosed@mail.tld]
9790
9791 mailto:inline@mail.tld
9792 !! result
9793 <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>
9794 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
9795 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
9796 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
9797 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
9798 </p>
9799 !! end
9800
9801
9802 #
9803 # Security and HTML correctness
9804 # From Nick Jenkins' fuzz testing
9805 #
9806
9807 !! test
9808 Fuzz testing: Parser13
9809 !! input
9810 {|
9811 | http://a|
9812 !! result
9813 <table>
9814 <tr>
9815 <td>
9816 </td>
9817 </tr>
9818 </table>
9819
9820 !! end
9821
9822 !! test
9823 Fuzz testing: Parser14
9824 !! input
9825 == onmouseover= ==
9826 http://__TOC__
9827 !! result
9828 <h2><span class="mw-headline" id="onmouseover.3D">onmouseover=</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a>]</span></h2>
9829 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9830 <ul>
9831 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
9832 </ul>
9833 </td></tr></table>
9834
9835 !! end
9836
9837 !! test
9838 Fuzz testing: Parser14-table
9839 !! input
9840 ==a==
9841 {| STYLE=__TOC__
9842 !! result
9843 <h2><span class="mw-headline" id="a">a</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a>]</span></h2>
9844 <table style="&#95;_TOC&#95;_">
9845 <tr><td></td></tr>
9846 </table>
9847
9848 !! end
9849
9850 # Known to produce bogus xml (extra </td>)
9851 !! test
9852 Fuzz testing: Parser16
9853 !! options
9854 noxml
9855 !! input
9856 {|
9857 !https://||||||
9858 !! result
9859 <table>
9860 <tr>
9861 <th>https://</th>
9862 <th></th>
9863 <th></th>
9864 <th>
9865 </td>
9866 </tr>
9867 </table>
9868
9869 !! end
9870
9871 !! test
9872 Fuzz testing: Parser21
9873 !! input
9874 {|
9875 ! irc://{{ftp://a" onmouseover="alert('hello world');"
9876 |
9877 !! result
9878 <table>
9879 <tr>
9880 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
9881 </th>
9882 <td>
9883 </td>
9884 </tr>
9885 </table>
9886
9887 !! end
9888
9889 !! test
9890 Fuzz testing: Parser22
9891 !! input
9892 http://===r:::https://b
9893
9894 {|
9895 !!result
9896 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
9897 </p>
9898 <table>
9899 <tr><td></td></tr>
9900 </table>
9901
9902 !! end
9903
9904 # Known to produce bad XML for now
9905 !! test
9906 Fuzz testing: Parser24
9907 !! options
9908 noxml
9909 !! input
9910 {|
9911 {{{|
9912 <u CLASS=
9913 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
9914 <br style="onmouseover='alert(document.cookie);' " />
9915
9916 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9917 |
9918 !! result
9919 <table>
9920 {{{|
9921 <u class="&#124;">}}}} &gt;
9922 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
9923
9924 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9925 <tr>
9926 <td></u>
9927 </td>
9928 </tr>
9929 </table>
9930
9931 !! end
9932
9933 # Note: the current result listed for this is not what the original one was,
9934 # but the original bug was JavaScript injection, which is fixed in any case.
9935 # It's not clear that the original result listed was any more correct than the
9936 # current one. Original result:
9937 # <p>{{{|
9938 # </p>
9939 # <li class="&#124;&#124;">
9940 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9941 !!test
9942 Fuzz testing: Parser25 (bug 6055)
9943 !! input
9944 {{{
9945 |
9946 <LI CLASS=||
9947 >
9948 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
9949 !! result
9950 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9951 </p>
9952 !! end
9953
9954 !!test
9955 Fuzz testing: URL adjacent extension (with space, clean)
9956 !! options
9957 !! input
9958 http://example.com <nowiki>junk</nowiki>
9959 !! result
9960 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
9961 </p>
9962 !!end
9963
9964 !!test
9965 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
9966 !! options
9967 !! input
9968 http://example.com<nowiki>junk</nowiki>
9969 !! result
9970 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
9971 </p>
9972 !!end
9973
9974 !!test
9975 Fuzz testing: URL adjacent extension (no space, dirty; pre)
9976 !! options
9977 !! input
9978 http://example.com<pre>junk</pre>
9979 !! result
9980 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
9981
9982 !!end
9983
9984 !!test
9985 Fuzz testing: image with bogus manual thumbnail
9986 !!input
9987 [[Image:foobar.jpg|thumbnail= ]]
9988 !!result
9989 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
9990
9991 !!end
9992
9993 !! test
9994 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
9995 !! input
9996 <pre dir="&#10;"></pre>
9997 !! result
9998 <pre dir="&#10;"></pre>
9999
10000 !! end
10001
10002 !! test
10003 Parsing optional HTML elements (Bug 6171)
10004 !! options
10005 !! input
10006 <table>
10007 <tr>
10008 <td> Some tabular data</td>
10009 <td> More tabular data ...
10010 <td> And yet som tabular data</td>
10011 </tr>
10012 </table>
10013 !! result
10014 <table>
10015 <tr>
10016 <td> Some tabular data</td>
10017 <td> More tabular data ...
10018 </td><td> And yet som tabular data</td>
10019 </tr>
10020 </table>
10021
10022 !! end
10023
10024 !! test
10025 Correct handling of <td>, <tr> (Bug 6171)
10026 !! options
10027 !! input
10028 <table>
10029 <tr>
10030 <td> Some tabular data</td>
10031 <td> More tabular data ...</td>
10032 <td> And yet som tabular data</td>
10033 </tr>
10034 </table>
10035 !! result
10036 <table>
10037 <tr>
10038 <td> Some tabular data</td>
10039 <td> More tabular data ...</td>
10040 <td> And yet som tabular data</td>
10041 </tr>
10042 </table>
10043
10044 !! end
10045
10046
10047 !! test
10048 Parsing crashing regression (fr:JavaScript)
10049 !! input
10050 </body></x>
10051 !! result
10052 <p>&lt;/body&gt;&lt;/x&gt;
10053 </p>
10054 !! end
10055
10056 !! test
10057 Inline wiki vs wiki block nesting
10058 !! input
10059 '''Bold paragraph
10060
10061 New wiki paragraph
10062 !! result
10063 <p><b>Bold paragraph</b>
10064 </p><p>New wiki paragraph
10065 </p>
10066 !! end
10067
10068 !! test
10069 Inline HTML vs wiki block nesting
10070 !! options
10071 disabled
10072 !! input
10073 <b>Bold paragraph
10074
10075 New wiki paragraph
10076 !! result
10077 <p><b>Bold paragraph</b>
10078 </p><p>New wiki paragraph
10079 </p>
10080 !! end
10081
10082 # Original result was this:
10083 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
10084 # </p>
10085 # While that might be marginally more intuitive, maybe, the six-apostrophe
10086 # construct is clearly pathological and the result stated here (which is what
10087 # the parser actually does) is about as reasonable as anything.
10088 !!test
10089 Mixing markup for italics and bold
10090 !! options
10091 !! input
10092 '''bold''''''bold''bolditalics'''''
10093 !! result
10094 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
10095 </p>
10096 !! end
10097
10098
10099 !! article
10100 Xyzzyx
10101 !! text
10102 Article for special page transclusion test
10103 !! endarticle
10104
10105 !! test
10106 Special page transclusion
10107 !! options
10108 !! input
10109 {{Special:Prefixindex/Xyzzyx}}
10110 !! result
10111 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10112
10113 !! end
10114
10115 !! test
10116 Special page transclusion twice (bug 5021)
10117 !! options
10118 !! input
10119 {{Special:Prefixindex/Xyzzyx}}
10120 {{Special:Prefixindex/Xyzzyx}}
10121 !! result
10122 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10123 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10124
10125 !! end
10126
10127 !! test
10128 Transclusion of default MediaWiki message
10129 !! input
10130 {{MediaWiki:Mainpage}}
10131 !!result
10132 <p>Main Page
10133 </p>
10134 !! end
10135
10136 !! test
10137 Transclusion of nonexistent MediaWiki message
10138 !! input
10139 {{MediaWiki:Mainpagexxx}}
10140 !!result
10141 <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>
10142 </p>
10143 !! end
10144
10145 !! test
10146 Transclusion of MediaWiki message with underscore
10147 !! input
10148 {{MediaWiki:history_short}}
10149 !! result
10150 <p>History
10151 </p>
10152 !! end
10153
10154 !! test
10155 Transclusion of MediaWiki message with space
10156 !! input
10157 {{MediaWiki:history short}}
10158 !! result
10159 <p>History
10160 </p>
10161 !! end
10162
10163 !! test
10164 Invalid header with following text
10165 !! input
10166 = x = y
10167 !! result
10168 <p>= x = y
10169 </p>
10170 !! end
10171
10172
10173 !! test
10174 Section extraction test (section 0)
10175 !! options
10176 section=0
10177 !! input
10178 start
10179 ==a==
10180 ===aa===
10181 ====aaa====
10182 ==b==
10183 ===ba===
10184 ===bb===
10185 ====bba====
10186 ===bc===
10187 ==c==
10188 ===ca===
10189 !! result
10190 start
10191 !! end
10192
10193 !! test
10194 Section extraction test (section 1)
10195 !! options
10196 section=1
10197 !! input
10198 start
10199 ==a==
10200 ===aa===
10201 ====aaa====
10202 ==b==
10203 ===ba===
10204 ===bb===
10205 ====bba====
10206 ===bc===
10207 ==c==
10208 ===ca===
10209 !! result
10210 ==a==
10211 ===aa===
10212 ====aaa====
10213 !! end
10214
10215 !! test
10216 Section extraction test (section 2)
10217 !! options
10218 section=2
10219 !! input
10220 start
10221 ==a==
10222 ===aa===
10223 ====aaa====
10224 ==b==
10225 ===ba===
10226 ===bb===
10227 ====bba====
10228 ===bc===
10229 ==c==
10230 ===ca===
10231 !! result
10232 ===aa===
10233 ====aaa====
10234 !! end
10235
10236 !! test
10237 Section extraction test (section 3)
10238 !! options
10239 section=3
10240 !! input
10241 start
10242 ==a==
10243 ===aa===
10244 ====aaa====
10245 ==b==
10246 ===ba===
10247 ===bb===
10248 ====bba====
10249 ===bc===
10250 ==c==
10251 ===ca===
10252 !! result
10253 ====aaa====
10254 !! end
10255
10256 !! test
10257 Section extraction test (section 4)
10258 !! options
10259 section=4
10260 !! input
10261 start
10262 ==a==
10263 ===aa===
10264 ====aaa====
10265 ==b==
10266 ===ba===
10267 ===bb===
10268 ====bba====
10269 ===bc===
10270 ==c==
10271 ===ca===
10272 !! result
10273 ==b==
10274 ===ba===
10275 ===bb===
10276 ====bba====
10277 ===bc===
10278 !! end
10279
10280 !! test
10281 Section extraction test (section 5)
10282 !! options
10283 section=5
10284 !! input
10285 start
10286 ==a==
10287 ===aa===
10288 ====aaa====
10289 ==b==
10290 ===ba===
10291 ===bb===
10292 ====bba====
10293 ===bc===
10294 ==c==
10295 ===ca===
10296 !! result
10297 ===ba===
10298 !! end
10299
10300 !! test
10301 Section extraction test (section 6)
10302 !! options
10303 section=6
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 ===bb===
10318 ====bba====
10319 !! end
10320
10321 !! test
10322 Section extraction test (section 7)
10323 !! options
10324 section=7
10325 !! input
10326 start
10327 ==a==
10328 ===aa===
10329 ====aaa====
10330 ==b==
10331 ===ba===
10332 ===bb===
10333 ====bba====
10334 ===bc===
10335 ==c==
10336 ===ca===
10337 !! result
10338 ====bba====
10339 !! end
10340
10341 !! test
10342 Section extraction test (section 8)
10343 !! options
10344 section=8
10345 !! input
10346 start
10347 ==a==
10348 ===aa===
10349 ====aaa====
10350 ==b==
10351 ===ba===
10352 ===bb===
10353 ====bba====
10354 ===bc===
10355 ==c==
10356 ===ca===
10357 !! result
10358 ===bc===
10359 !! end
10360
10361 !! test
10362 Section extraction test (section 9)
10363 !! options
10364 section=9
10365 !! input
10366 start
10367 ==a==
10368 ===aa===
10369 ====aaa====
10370 ==b==
10371 ===ba===
10372 ===bb===
10373 ====bba====
10374 ===bc===
10375 ==c==
10376 ===ca===
10377 !! result
10378 ==c==
10379 ===ca===
10380 !! end
10381
10382 !! test
10383 Section extraction test (section 10)
10384 !! options
10385 section=10
10386 !! input
10387 start
10388 ==a==
10389 ===aa===
10390 ====aaa====
10391 ==b==
10392 ===ba===
10393 ===bb===
10394 ====bba====
10395 ===bc===
10396 ==c==
10397 ===ca===
10398 !! result
10399 ===ca===
10400 !! end
10401
10402 !! test
10403 Section extraction test (nonexistent section 11)
10404 !! options
10405 section=11
10406 !! input
10407 start
10408 ==a==
10409 ===aa===
10410 ====aaa====
10411 ==b==
10412 ===ba===
10413 ===bb===
10414 ====bba====
10415 ===bc===
10416 ==c==
10417 ===ca===
10418 !! result
10419 !! end
10420
10421 !! test
10422 Section extraction test with bogus heading (section 1)
10423 !! options
10424 section=1
10425 !! input
10426 ==a==
10427 ==bogus== not a legal section
10428 ==b==
10429 !! result
10430 ==a==
10431 ==bogus== not a legal section
10432 !! end
10433
10434 !! test
10435 Section extraction test with bogus heading (section 2)
10436 !! options
10437 section=2
10438 !! input
10439 ==a==
10440 ==bogus== not a legal section
10441 ==b==
10442 !! result
10443 ==b==
10444 !! end
10445
10446 !! test
10447 Section extraction test with comment after heading (section 1)
10448 !! options
10449 section=1
10450 !! input
10451 ==a==
10452 ==b== <!-- -->
10453 ==c==
10454 !! result
10455 ==a==
10456 !! end
10457
10458 !! test
10459 Section extraction test with comment after heading (section 2)
10460 !! options
10461 section=2
10462 !! input
10463 ==a==
10464 ==b== <!-- -->
10465 ==c==
10466 !! result
10467 ==b== <!-- -->
10468 !! end
10469
10470 !! test
10471 Section extraction test with bogus <nowiki> heading (section 1)
10472 !! options
10473 section=1
10474 !! input
10475 ==a==
10476 ==bogus== <nowiki>not a legal section</nowiki>
10477 ==b==
10478 !! result
10479 ==a==
10480 ==bogus== <nowiki>not a legal section</nowiki>
10481 !! end
10482
10483 !! test
10484 Section extraction test with bogus <nowiki> heading (section 2)
10485 !! options
10486 section=2
10487 !! input
10488 ==a==
10489 ==bogus== <nowiki>not a legal section</nowiki>
10490 ==b==
10491 !! result
10492 ==b==
10493 !! end
10494
10495
10496 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
10497 # instead of respecting commented sections
10498 !! test
10499 Section extraction prefixed by comment (section 1)
10500 !! options
10501 section=1
10502 !! input
10503 <!-- -->==sec1==
10504 ==sec2==
10505 !!result
10506 ==sec2==
10507 !!end
10508
10509 !! test
10510 Section extraction prefixed by comment (section 2)
10511 !! options
10512 section=2
10513 !! input
10514 <!-- -->==sec1==
10515 ==sec2==
10516 !!result
10517
10518 !!end
10519
10520
10521 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
10522 # instead of respecting HTML-style headings
10523 !! test
10524 Section extraction, mixed wiki and html (section 1)
10525 !! options
10526 section=1
10527 !! input
10528 <h2>unmarked</h2>
10529 unmarked
10530 ==1==
10531 one
10532 ==2==
10533 two
10534 !! result
10535 ==1==
10536 one
10537 !! end
10538
10539 !! test
10540 Section extraction, mixed wiki and html (section 2)
10541 !! options
10542 section=2
10543 !! input
10544 <h2>unmarked</h2>
10545 unmarked
10546 ==1==
10547 one
10548 ==2==
10549 two
10550 !! result
10551 ==2==
10552 two
10553 !! end
10554
10555
10556 # Formerly testing for bug 3342
10557 !! test
10558 Section extraction, heading surrounded by <noinclude>
10559 !! options
10560 section=1
10561 !! input
10562 <noinclude>==unmarked==</noinclude>
10563 ==marked==
10564 !! result
10565 ==marked==
10566 !!end
10567
10568 # Test behavior of bug 19910
10569 !! test
10570 Sectiion with all-equals
10571 !! options
10572 section=2
10573 !! input
10574 ===
10575 The line above must have a trailing space
10576 === <!--
10577 --> <!-- -->
10578 But just in case it doesn't...
10579 !! result
10580 === <!--
10581 --> <!-- -->
10582 But just in case it doesn't...
10583 !! end
10584
10585 !! test
10586 Section replacement test (section 0)
10587 !! options
10588 replace=0,"xxx"
10589 !! input
10590 start
10591 ==a==
10592 ===aa===
10593 ====aaa====
10594 ==b==
10595 ===ba===
10596 ===bb===
10597 ====bba====
10598 ===bc===
10599 ==c==
10600 ===ca===
10601 !! result
10602 xxx
10603
10604 ==a==
10605 ===aa===
10606 ====aaa====
10607 ==b==
10608 ===ba===
10609 ===bb===
10610 ====bba====
10611 ===bc===
10612 ==c==
10613 ===ca===
10614 !! end
10615
10616 !! test
10617 Section replacement test (section 1)
10618 !! options
10619 replace=1,"xxx"
10620 !! input
10621 start
10622 ==a==
10623 ===aa===
10624 ====aaa====
10625 ==b==
10626 ===ba===
10627 ===bb===
10628 ====bba====
10629 ===bc===
10630 ==c==
10631 ===ca===
10632 !! result
10633 start
10634 xxx
10635
10636 ==b==
10637 ===ba===
10638 ===bb===
10639 ====bba====
10640 ===bc===
10641 ==c==
10642 ===ca===
10643 !! end
10644
10645 !! test
10646 Section replacement test (section 2)
10647 !! options
10648 replace=2,"xxx"
10649 !! input
10650 start
10651 ==a==
10652 ===aa===
10653 ====aaa====
10654 ==b==
10655 ===ba===
10656 ===bb===
10657 ====bba====
10658 ===bc===
10659 ==c==
10660 ===ca===
10661 !! result
10662 start
10663 ==a==
10664 xxx
10665
10666 ==b==
10667 ===ba===
10668 ===bb===
10669 ====bba====
10670 ===bc===
10671 ==c==
10672 ===ca===
10673 !! end
10674
10675 !! test
10676 Section replacement test (section 3)
10677 !! options
10678 replace=3,"xxx"
10679 !! input
10680 start
10681 ==a==
10682 ===aa===
10683 ====aaa====
10684 ==b==
10685 ===ba===
10686 ===bb===
10687 ====bba====
10688 ===bc===
10689 ==c==
10690 ===ca===
10691 !! result
10692 start
10693 ==a==
10694 ===aa===
10695 xxx
10696
10697 ==b==
10698 ===ba===
10699 ===bb===
10700 ====bba====
10701 ===bc===
10702 ==c==
10703 ===ca===
10704 !! end
10705
10706 !! test
10707 Section replacement test (section 4)
10708 !! options
10709 replace=4,"xxx"
10710 !! input
10711 start
10712 ==a==
10713 ===aa===
10714 ====aaa====
10715 ==b==
10716 ===ba===
10717 ===bb===
10718 ====bba====
10719 ===bc===
10720 ==c==
10721 ===ca===
10722 !! result
10723 start
10724 ==a==
10725 ===aa===
10726 ====aaa====
10727 xxx
10728
10729 ==c==
10730 ===ca===
10731 !! end
10732
10733 !! test
10734 Section replacement test (section 5)
10735 !! options
10736 replace=5,"xxx"
10737 !! input
10738 start
10739 ==a==
10740 ===aa===
10741 ====aaa====
10742 ==b==
10743 ===ba===
10744 ===bb===
10745 ====bba====
10746 ===bc===
10747 ==c==
10748 ===ca===
10749 !! result
10750 start
10751 ==a==
10752 ===aa===
10753 ====aaa====
10754 ==b==
10755 xxx
10756
10757 ===bb===
10758 ====bba====
10759 ===bc===
10760 ==c==
10761 ===ca===
10762 !! end
10763
10764 !! test
10765 Section replacement test (section 6)
10766 !! options
10767 replace=6,"xxx"
10768 !! input
10769 start
10770 ==a==
10771 ===aa===
10772 ====aaa====
10773 ==b==
10774 ===ba===
10775 ===bb===
10776 ====bba====
10777 ===bc===
10778 ==c==
10779 ===ca===
10780 !! result
10781 start
10782 ==a==
10783 ===aa===
10784 ====aaa====
10785 ==b==
10786 ===ba===
10787 xxx
10788
10789 ===bc===
10790 ==c==
10791 ===ca===
10792 !! end
10793
10794 !! test
10795 Section replacement test (section 7)
10796 !! options
10797 replace=7,"xxx"
10798 !! input
10799 start
10800 ==a==
10801 ===aa===
10802 ====aaa====
10803 ==b==
10804 ===ba===
10805 ===bb===
10806 ====bba====
10807 ===bc===
10808 ==c==
10809 ===ca===
10810 !! result
10811 start
10812 ==a==
10813 ===aa===
10814 ====aaa====
10815 ==b==
10816 ===ba===
10817 ===bb===
10818 xxx
10819
10820 ===bc===
10821 ==c==
10822 ===ca===
10823 !! end
10824
10825 !! test
10826 Section replacement test (section 8)
10827 !! options
10828 replace=8,"xxx"
10829 !! input
10830 start
10831 ==a==
10832 ===aa===
10833 ====aaa====
10834 ==b==
10835 ===ba===
10836 ===bb===
10837 ====bba====
10838 ===bc===
10839 ==c==
10840 ===ca===
10841 !! result
10842 start
10843 ==a==
10844 ===aa===
10845 ====aaa====
10846 ==b==
10847 ===ba===
10848 ===bb===
10849 ====bba====
10850 xxx
10851
10852 ==c==
10853 ===ca===
10854 !!end
10855
10856 !! test
10857 Section replacement test (section 9)
10858 !! options
10859 replace=9,"xxx"
10860 !! input
10861 start
10862 ==a==
10863 ===aa===
10864 ====aaa====
10865 ==b==
10866 ===ba===
10867 ===bb===
10868 ====bba====
10869 ===bc===
10870 ==c==
10871 ===ca===
10872 !! result
10873 start
10874 ==a==
10875 ===aa===
10876 ====aaa====
10877 ==b==
10878 ===ba===
10879 ===bb===
10880 ====bba====
10881 ===bc===
10882 xxx
10883 !! end
10884
10885 !! test
10886 Section replacement test (section 10)
10887 !! options
10888 replace=10,"xxx"
10889 !! input
10890 start
10891 ==a==
10892 ===aa===
10893 ====aaa====
10894 ==b==
10895 ===ba===
10896 ===bb===
10897 ====bba====
10898 ===bc===
10899 ==c==
10900 ===ca===
10901 !! result
10902 start
10903 ==a==
10904 ===aa===
10905 ====aaa====
10906 ==b==
10907 ===ba===
10908 ===bb===
10909 ====bba====
10910 ===bc===
10911 ==c==
10912 xxx
10913 !! end
10914
10915 !! test
10916 Section replacement test with initial whitespace (bug 13728)
10917 !! options
10918 replace=2,"xxx"
10919 !! input
10920 Preformatted initial line
10921 ==a==
10922 ===a===
10923 !! result
10924 Preformatted initial line
10925 ==a==
10926 xxx
10927 !! end
10928
10929
10930 !! test
10931 Section extraction, heading followed by pre with 20 spaces (bug 6398)
10932 !! options
10933 section=1
10934 !! input
10935 ==a==
10936 a
10937 !! result
10938 ==a==
10939 a
10940 !! end
10941
10942 !! test
10943 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
10944 !! options
10945 section=1
10946 !! input
10947 ==a==
10948 a
10949 !! result
10950 ==a==
10951 a
10952 !! end
10953
10954
10955 !! test
10956 Section extraction, <pre> around bogus header (bug 10309)
10957 !! options
10958 noxml section=2
10959 !! input
10960 == Section One ==
10961 <pre>
10962 =======
10963 </pre>
10964
10965 == Section Two ==
10966 stuff
10967 !! result
10968 == Section Two ==
10969 stuff
10970 !! end
10971
10972 !! test
10973 Section replacement, <pre> around bogus header (bug 10309)
10974 !! options
10975 noxml replace=2,"xxx"
10976 !! input
10977 == Section One ==
10978 <pre>
10979 =======
10980 </pre>
10981
10982 == Section Two ==
10983 stuff
10984 !! result
10985 == Section One ==
10986 <pre>
10987 =======
10988 </pre>
10989
10990 xxx
10991 !! end
10992
10993
10994
10995 !! test
10996 Handling of &#x0A; in URLs
10997 !! input
10998 **irc://&#x0A;a
10999 !! result
11000 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
11001 </li></ul>
11002 </li></ul>
11003
11004 !!end
11005
11006 !! test
11007 5 quotes, code coverage +1 line (php)
11008 !! options
11009 php
11010 !! input
11011 '''''
11012 !! result
11013 !! end
11014 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
11015 !! test
11016 5 quotes, code coverage +1 line (parsoid)
11017 !! options
11018 parsoid
11019 !! input
11020 '''''
11021 !! result
11022 <p><i><b></b></i></p>
11023 !! end
11024
11025 !! test
11026 Special:Search page linking.
11027 !! input
11028 {{Special:search}}
11029 !! result
11030 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
11031 </p>
11032 !! end
11033
11034 !! test
11035 Say the magic word
11036 !! input
11037 * {{PAGENAME}}
11038 * {{BASEPAGENAME}}
11039 * {{SUBPAGENAME}}
11040 * {{SUBPAGENAMEE}}
11041 * {{ROOTPAGENAME}}
11042 * {{ROOTPAGENAMEE}}
11043 * {{BASEPAGENAME}}
11044 * {{BASEPAGENAMEE}}
11045 * {{TALKPAGENAME}}
11046 * {{TALKPAGENAMEE}}
11047 * {{SUBJECTPAGENAME}}
11048 * {{SUBJECTPAGENAMEE}}
11049 * {{NAMESPACEE}}
11050 * {{NAMESPACE}}
11051 * {{TALKSPACE}}
11052 * {{TALKSPACEE}}
11053 * {{SUBJECTSPACE}}
11054 * {{SUBJECTSPACEE}}
11055 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
11056 !! result
11057 <ul><li> Parser test
11058 </li><li> Parser test
11059 </li><li> Parser test
11060 </li><li> Parser_test
11061 </li><li> Parser test
11062 </li><li> Parser_test
11063 </li><li> Parser test
11064 </li><li> Parser_test
11065 </li><li> Talk:Parser test
11066 </li><li> Talk:Parser_test
11067 </li><li> Parser test
11068 </li><li> Parser_test
11069 </li><li>
11070 </li><li>
11071 </li><li> Talk
11072 </li><li> Talk
11073 </li><li>
11074 </li><li>
11075 </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>
11076 </li></ul>
11077
11078 !! end
11079 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
11080
11081 !! test
11082 Gallery
11083 !! input
11084 <gallery>
11085 image1.png |
11086 image2.gif|||||
11087
11088 image3|
11089 image4 |300px| centre
11090 image5.svg| http://///////
11091 [[x|xx]]]]
11092 * image6
11093 </gallery>
11094 !! result
11095 <ul class="gallery">
11096 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11097 <div style="height: 150px;">Image1.png</div>
11098 <div class="gallerytext">
11099 </div>
11100 </div></li>
11101 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11102 <div style="height: 150px;">Image2.gif</div>
11103 <div class="gallerytext">
11104 <p>||||
11105 </p>
11106 </div>
11107 </div></li>
11108 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11109 <div style="height: 150px;">Image3</div>
11110 <div class="gallerytext">
11111 </div>
11112 </div></li>
11113 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11114 <div style="height: 150px;">Image4</div>
11115 <div class="gallerytext">
11116 <p>300px| centre
11117 </p>
11118 </div>
11119 </div></li>
11120 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11121 <div style="height: 150px;">Image5.svg</div>
11122 <div class="gallerytext">
11123 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
11124 </p>
11125 </div>
11126 </div></li>
11127 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11128 <div style="height: 150px;">* image6</div>
11129 <div class="gallerytext">
11130 </div>
11131 </div></li>
11132 </ul>
11133
11134 !! end
11135
11136 !! test
11137 Gallery (with options)
11138 !! input
11139 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
11140 File:Nonexistant.jpg|caption
11141 File:Nonexistant.jpg
11142 image:foobar.jpg|some '''caption''' [[Main Page]]
11143 image:foobar.jpg
11144 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
11145 </gallery>
11146 !! result
11147 <ul class="gallery" style="max-width: 226px;_width: 226px;">
11148 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
11149 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11150 <div style="height: 70px;">Nonexistant.jpg</div>
11151 <div class="gallerytext">
11152 <p>caption
11153 </p>
11154 </div>
11155 </div></li>
11156 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11157 <div style="height: 70px;">Nonexistant.jpg</div>
11158 <div class="gallerytext">
11159 </div>
11160 </div></li>
11161 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11162 <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>
11163 <div class="gallerytext">
11164 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11165 </p>
11166 </div>
11167 </div></li>
11168 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11169 <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>
11170 <div class="gallerytext">
11171 </div>
11172 </div></li>
11173 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11174 <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>
11175 <div class="gallerytext">
11176 <p>Blabla|blabla.
11177 </p>
11178 </div>
11179 </div></li>
11180 </ul>
11181
11182 !! end
11183
11184 !! test
11185 Gallery with wikitext inside caption
11186 !! input
11187 <gallery>
11188 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
11189 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
11190 </gallery>
11191 !! result
11192 <ul class="gallery">
11193 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11194 <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>
11195 <div class="gallerytext">
11196 <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>
11197 </p>
11198 </div>
11199 </div></li>
11200 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11201 <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>
11202 <div class="gallerytext">
11203 <p>This is a test template
11204 </p>
11205 </div>
11206 </div></li>
11207 </ul>
11208
11209 !! end
11210
11211 !! test
11212 gallery (with showfilename option)
11213 !! input
11214 <gallery showfilename>
11215 File:Nonexistant.jpg|caption
11216 File:Nonexistant.jpg
11217 image:foobar.jpg|some '''caption''' [[Main Page]]
11218 File:Foobar.jpg
11219 </gallery>
11220 !! result
11221 <ul class="gallery">
11222 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11223 <div style="height: 150px;">Nonexistant.jpg</div>
11224 <div class="gallerytext">
11225 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11226 caption
11227 </p>
11228 </div>
11229 </div></li>
11230 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11231 <div style="height: 150px;">Nonexistant.jpg</div>
11232 <div class="gallerytext">
11233 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11234 </p>
11235 </div>
11236 </div></li>
11237 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11238 <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>
11239 <div class="gallerytext">
11240 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11241 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11242 </p>
11243 </div>
11244 </div></li>
11245 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11246 <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>
11247 <div class="gallerytext">
11248 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11249 </p>
11250 </div>
11251 </div></li>
11252 </ul>
11253
11254 !! end
11255
11256 !! test
11257 Gallery (with namespace-less filenames)
11258 !! input
11259 <gallery>
11260 File:Nonexistant.jpg
11261 Nonexistant.jpg
11262 image:foobar.jpg
11263 foobar.jpg
11264 </gallery>
11265 !! result
11266 <ul class="gallery">
11267 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11268 <div style="height: 150px;">Nonexistant.jpg</div>
11269 <div class="gallerytext">
11270 </div>
11271 </div></li>
11272 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11273 <div style="height: 150px;">Nonexistant.jpg</div>
11274 <div class="gallerytext">
11275 </div>
11276 </div></li>
11277 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11278 <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>
11279 <div class="gallerytext">
11280 </div>
11281 </div></li>
11282 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11283 <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>
11284 <div class="gallerytext">
11285 </div>
11286 </div></li>
11287 </ul>
11288
11289 !! end
11290
11291 !! test
11292 HTML Hex character encoding (spells the word "JavaScript")
11293 !! input
11294 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
11295 !! result
11296 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
11297 </p>
11298 !! end
11299
11300 !! test
11301 HTML Hex character encoding bogus encoding (bug 26437 regression check)
11302 !! input
11303 &#xsee;&#XSEE;
11304 !! result
11305 <p>&amp;#xsee;&amp;#XSEE;
11306 </p>
11307 !! end
11308
11309 !! test
11310 HTML Hex character encoding mixed case
11311 !! input
11312 &#xEE;&#Xee;
11313 !! result
11314 <p>&#xee;&#xee;
11315 </p>
11316 !! end
11317
11318 !! test
11319 __FORCETOC__ override
11320 !! input
11321 __NEWSECTIONLINK__
11322 __FORCETOC__
11323 !! result
11324 <p><br />
11325 </p>
11326 !! end
11327
11328 !! test
11329 ISBN code coverage
11330 !! input
11331 ISBN 978-0-1234-56&#x20;789
11332 !! result
11333 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
11334 </p>
11335 !! end
11336
11337 !! test
11338 ISBN followed by 5 spaces
11339 !! input
11340 ISBN
11341 !! result
11342 <p>ISBN
11343 </p>
11344 !! end
11345
11346 !! test
11347 Double ISBN
11348 !! input
11349 ISBN ISBN 1234567890
11350 !! result
11351 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
11352 </p>
11353 !! end
11354
11355 !! test
11356 Bug 22905: <abbr> followed by ISBN followed by </a>
11357 !! input
11358 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
11359 !! result
11360 <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>
11361 </p>
11362 !! end
11363
11364 !! test
11365 Double RFC
11366 !! input
11367 RFC RFC 1234
11368 !! result
11369 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
11370 </p>
11371 !! end
11372
11373 !! test
11374 Double RFC with a wiki link
11375 !! input
11376 RFC [[RFC 1234]]
11377 !! result
11378 <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>
11379 </p>
11380 !! end
11381
11382 !! test
11383 RFC code coverage
11384 !! input
11385 RFC 983&#x20;987
11386 !! result
11387 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
11388 </p>
11389 !! end
11390
11391 !! test
11392 Centre-aligned image
11393 !! input
11394 [[Image:foobar.jpg|centre]]
11395 !! result
11396 <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>
11397
11398 !!end
11399
11400 !! test
11401 None-aligned image
11402 !! input
11403 [[Image:foobar.jpg|none]]
11404 !! result
11405 <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>
11406
11407 !!end
11408
11409 !! test
11410 Width + Height sized image (using px) (height is ignored)
11411 !! input
11412 [[Image:foobar.jpg|640x480px]]
11413 !! result
11414 <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>
11415 </p>
11416 !!end
11417
11418 !! test
11419 Width-sized image (using px, no following whitespace)
11420 !! input
11421 [[Image:foobar.jpg|640px]]
11422 !! result
11423 <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>
11424 </p>
11425 !!end
11426
11427 !! test
11428 Width-sized image (using px, with following whitespace - test regression from r39467)
11429 !! input
11430 [[Image:foobar.jpg|640px ]]
11431 !! result
11432 <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>
11433 </p>
11434 !!end
11435
11436 !! test
11437 Width-sized image (using px, with preceding whitespace - test regression from r39467)
11438 !! input
11439 [[Image:foobar.jpg| 640px]]
11440 !! result
11441 <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>
11442 </p>
11443 !!end
11444
11445 !! test
11446 Another italics / bold test
11447 !! input
11448 ''' ''x'
11449 !! result
11450 <pre>'<i> </i>x'
11451 </pre>
11452 !!end
11453
11454 # Note the results may be incorrect, as parserTest output included this:
11455 # XML error: Mismatched tag at byte 6120:
11456 # ...<dd> </dt></dl> </dd...
11457 !! test
11458 dt/dd/dl test
11459 !! options
11460 disabled
11461 !! input
11462 :;;;::
11463 !! result
11464 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
11465 </dd></dl>
11466 </dd></dl>
11467 </dt></dl>
11468 </dt></dl>
11469 </dt></dl>
11470 </dd></dl>
11471
11472 !!end
11473
11474
11475 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
11476 !! test
11477 Images with the "|" character in the comment
11478 !! input
11479 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
11480 !! result
11481 <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>
11482
11483 !!end
11484
11485 !! test
11486 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
11487 !! input
11488 <html><script>alert(1);</script></html>
11489 !! result
11490 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
11491 </p>
11492 !! end
11493
11494 !! test
11495 HTML with raw HTML ($wgRawHtml==true)
11496 !! options
11497 rawhtml
11498 !! input
11499 <html><script>alert(1);</script></html>
11500 !! result
11501 <p><script>alert(1);</script>
11502 </p>
11503 !! end
11504
11505 !! test
11506 Parents of subpages, one level up
11507 !! options
11508 subpage title=[[Subpage test/L1/L2/L3]]
11509 !! input
11510 [[../|L2]]
11511 !! result
11512 <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>
11513 </p>
11514 !! end
11515
11516
11517 !! test
11518 Parents of subpages, one level up, not named
11519 !! options
11520 subpage title=[[Subpage test/L1/L2/L3]]
11521 !! input
11522 [[../]]
11523 !! result
11524 <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>
11525 </p>
11526 !! end
11527
11528
11529
11530 !! test
11531 Parents of subpages, two levels up
11532 !! options
11533 subpage title=[[Subpage test/L1/L2/L3]]
11534 !! input
11535 [[../../|L1]]2
11536
11537 [[../../|L1]]l
11538 !! result
11539 <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
11540 </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>
11541 </p>
11542 !! end
11543
11544 !! test
11545 Parents of subpages, two levels up, without trailing slash or name.
11546 !! options
11547 subpage title=[[Subpage test/L1/L2/L3]]
11548 !! input
11549 [[../..]]
11550 !! result
11551 <p>[[../..]]
11552 </p>
11553 !! end
11554
11555 !! test
11556 Parents of subpages, two levels up, with lots of extra trailing slashes.
11557 !! options
11558 subpage title=[[Subpage test/L1/L2/L3]]
11559 !! input
11560 [[../../////]]
11561 !! result
11562 <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>
11563 </p>
11564 !! end
11565
11566 !! test
11567 Definition list code coverage
11568 !! input
11569 ; title : def
11570 ; title : def
11571 ;title: def
11572 !! result
11573 <dl><dt> title &#160;</dt><dd> def
11574 </dd><dt> title&#160;</dt><dd> def
11575 </dd><dt>title</dt><dd> def
11576 </dd></dl>
11577
11578 !! end
11579
11580 !! test
11581 Don't fall for the self-closing div
11582 !! input
11583 <div>hello world</div/>
11584 !! result
11585 <div>hello world</div>
11586
11587 !! end
11588
11589 !! test
11590 MSGNW magic word
11591 !! input
11592 {{MSGNW:msg}}
11593 !! result
11594 <p>&#91;&#91;:Template:Msg&#93;&#93;
11595 </p>
11596 !! end
11597
11598 !! test
11599 RAW magic word
11600 !! input
11601 {{RAW:QUERTY}}
11602 !! result
11603 <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>
11604 </p>
11605 !! end
11606
11607 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
11608 !! test
11609 Always escape literal '>' in output, not just after '<'
11610 !! input
11611 ><>
11612 !! result
11613 <p>&gt;&lt;&gt;
11614 </p>
11615 !! end
11616
11617 !! test
11618 Template caching
11619 !! input
11620 {{Test}}
11621 {{Test}}
11622 !! result
11623 <p>This is a test template
11624 This is a test template
11625 </p>
11626 !! end
11627
11628
11629 !! article
11630 MediaWiki:Fake
11631 !! text
11632 ==header==
11633 !! endarticle
11634
11635 !! test
11636 Inclusion of !userCanEdit() content
11637 !! input
11638 {{MediaWiki:Fake}}
11639 !! result
11640 <h2><span class="mw-headline" id="header">header</span> <span class="mw-editsection">[<a href="/index.php?title=MediaWiki:Fake&amp;action=edit&amp;section=T-1" title="MediaWiki:Fake">edit</a>]</span></h2>
11641
11642 !! end
11643
11644
11645 !! test
11646 Out-of-order TOC heading levels
11647 !! input
11648 ==2==
11649 ======6======
11650 ===3===
11651 =1=
11652 =====5=====
11653 ==2==
11654 !! result
11655 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11656 <ul>
11657 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
11658 <ul>
11659 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
11660 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
11661 </ul>
11662 </li>
11663 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
11664 <ul>
11665 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
11666 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
11667 </ul>
11668 </li>
11669 </ul>
11670 </td></tr></table>
11671 <h2><span class="mw-headline" id="2">2</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 2">edit</a>]</span></h2>
11672 <h6><span class="mw-headline" id="6">6</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: 6">edit</a>]</span></h6>
11673 <h3><span class="mw-headline" id="3">3</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: 3">edit</a>]</span></h3>
11674 <h1><span class="mw-headline" id="1">1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 1">edit</a>]</span></h1>
11675 <h5><span class="mw-headline" id="5">5</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: 5">edit</a>]</span></h5>
11676 <h2><span class="mw-headline" id="2_2">2</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: 2">edit</a>]</span></h2>
11677
11678 !! end
11679
11680
11681 !! test
11682 ISBN with a dummy number
11683 !! input
11684 ISBN ---
11685 !! result
11686 <p>ISBN ---
11687 </p>
11688 !! end
11689
11690
11691 !! test
11692 ISBN with space-delimited number
11693 !! input
11694 ISBN 92 9017 032 8
11695 !! result
11696 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
11697 </p>
11698 !! end
11699
11700
11701 !! test
11702 ISBN with multiple spaces, no number
11703 !! input
11704 ISBN foo
11705 !! result
11706 <p>ISBN foo
11707 </p>
11708 !! end
11709
11710
11711 !! test
11712 ISBN length
11713 !! input
11714 ISBN 123456789
11715
11716 ISBN 1234567890
11717
11718 ISBN 12345678901
11719 !! result
11720 <p>ISBN 123456789
11721 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
11722 </p><p>ISBN 12345678901
11723 </p>
11724 !! end
11725
11726
11727 !! test
11728 ISBN with trailing year (bug 8110)
11729 !! input
11730 ISBN 1-234-56789-0 - 2006
11731
11732 ISBN 1 234 56789 0 - 2006
11733 !! result
11734 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
11735 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
11736 </p>
11737 !! end
11738
11739
11740 !! test
11741 anchorencode
11742 !! input
11743 {{anchorencode:foo bar©#%n}}
11744 !! result
11745 <p>foo_bar.C2.A9.23.25n
11746 </p>
11747 !! end
11748
11749 !! test
11750 anchorencode trims spaces
11751 !! input
11752 {{anchorencode: __pretty__please__}}
11753 !! result
11754 <p>pretty_please
11755 </p>
11756 !! end
11757
11758 !! test
11759 anchorencode deals with links
11760 !! input
11761 {{anchorencode: [[hello|world]] [[hi]]}}
11762 !! result
11763 <p>world_hi
11764 </p>
11765 !! end
11766
11767 !! test
11768 anchorencode deals with templates
11769 !! input
11770 {{anchorencode: {{Foo}} }}
11771 !! result
11772 <p>FOO
11773 </p>
11774 !! end
11775
11776 !! test
11777 anchorencode encodes like the TOC generator: (bug 18431)
11778 !! input
11779 === _ +:.3A%3A&&amp;]] ===
11780 {{anchorencode: _ +:.3A%3A&&amp;]] }}
11781 __NOEDITSECTION__
11782 !! result
11783 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span> </h3>
11784 <p>.2B:.3A.253A.26.26.5D.5D
11785 </p>
11786 !! end
11787
11788 # Expected output in the following test is not necessarily expected (there
11789 # should probably be <p> tags inside the <blockquote> in the output) -- it's
11790 # only testing for well-formedness.
11791 !! test
11792 Bug 6200: blockquotes and paragraph formatting
11793 !! input
11794 <blockquote>
11795 foo
11796 </blockquote>
11797
11798 bar
11799
11800 baz
11801 !! result
11802 <blockquote>
11803 foo
11804 </blockquote>
11805 <p>bar
11806 </p>
11807 <pre>baz
11808 </pre>
11809 !! end
11810
11811 !! test
11812 Bug 8293: Use of center tag ruins paragraph formatting
11813 !! input
11814 <center>
11815 foo
11816 </center>
11817
11818 bar
11819
11820 baz
11821 !! result
11822 <center>
11823 <p>foo
11824 </p>
11825 </center>
11826 <p>bar
11827 </p>
11828 <pre>baz
11829 </pre>
11830 !! end
11831
11832 !!test
11833 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
11834 !!options
11835 php
11836 !!input
11837 <span><s>x</span></s>
11838 !!result
11839 <p><span><s>x&lt;/span&gt;</s></span>
11840 </p>
11841 !!end
11842
11843 !!test
11844 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
11845 !!options
11846 parsoid
11847 !!input
11848 <span><s>x</span></s>
11849 !!result
11850 <p><span><s>x</s></span><s></s>
11851 </p>
11852 !!end
11853
11854 ###
11855 ### Language variants related tests
11856 ###
11857 !! test
11858 Self-link in language variants
11859 !! options
11860 title=[[Dunav]] language=sr
11861 !! input
11862 Both [[Dunav]] and [[Дунав]] are names for this river.
11863 !! result
11864 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
11865 </p>
11866 !!end
11867
11868 !! article
11869 Дуна
11870 !! text
11871 content
11872 !! endarticle
11873
11874 !! test
11875 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
11876 !! options
11877 title=[[Duna]] language=sr
11878 !! input
11879 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
11880 !! result
11881 <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.
11882 </p>
11883 !! end
11884
11885 !! test
11886 Link to pages in language variants
11887 !! options
11888 language=sr
11889 !! input
11890 Main Page can be written as [[Маин Паге]]
11891 !! result
11892 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
11893 </p>
11894 !!end
11895
11896
11897 !! test
11898 Multiple links to pages in language variants
11899 !! options
11900 language=sr
11901 !! input
11902 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
11903 !! result
11904 <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>.
11905 </p>
11906 !!end
11907
11908
11909 !! test
11910 Simple template in language variants
11911 !! options
11912 language=sr
11913 !! input
11914 {{тест}}
11915 !! result
11916 <p>This is a test template
11917 </p>
11918 !! end
11919
11920
11921 !! test
11922 Template with explicit namespace in language variants
11923 !! options
11924 language=sr
11925 !! input
11926 {{Template:тест}}
11927 !! result
11928 <p>This is a test template
11929 </p>
11930 !! end
11931
11932
11933 !! test
11934 Basic test for template parameter in language variants
11935 !! options
11936 language=sr
11937 !! input
11938 {{парамтест|param=foo}}
11939 !! result
11940 <p>This is a test template with parameter foo
11941 </p>
11942 !! end
11943
11944
11945 !! test
11946 Simple category in language variants
11947 !! options
11948 language=sr cat
11949 !! input
11950 [[Category:МедиаWики Усер'с Гуиде]]
11951 !! result
11952 <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>
11953 !! end
11954
11955
11956 !! article
11957 Category:分类
11958 !! text
11959 blah
11960 !! endarticle
11961
11962 !! article
11963 Category:分類
11964 !! text
11965 blah
11966 !! endarticle
11967
11968 !! test
11969 Don't convert blue categorylinks to another variant (bug 33210)
11970 !! options
11971 language=zh cat
11972 !! input
11973 [[A]][[Category:分类]]
11974 !! result
11975 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
11976 !! end
11977
11978
11979 !! test
11980 Stripping -{}- tags (language variants)
11981 !! options
11982 language=sr
11983 !! input
11984 Latin proverb: -{Ne nuntium necare}-
11985 !! result
11986 <p>Latin proverb: Ne nuntium necare
11987 </p>
11988 !! end
11989
11990
11991 !! test
11992 Prevent conversion with -{}- tags (language variants)
11993 !! options
11994 language=sr variant=sr-ec
11995 !! input
11996 Latinski: -{Ne nuntium necare}-
11997 !! result
11998 <p>Латински: Ne nuntium necare
11999 </p>
12000 !! end
12001
12002
12003 !! test
12004 Prevent conversion of text with -{}- tags (language variants)
12005 !! options
12006 language=sr variant=sr-ec
12007 !! input
12008 Latinski: -{Ne nuntium necare}-
12009 !! result
12010 <p>Латински: Ne nuntium necare
12011 </p>
12012 !! end
12013
12014
12015 !! test
12016 Prevent conversion of links with -{}- tags (language variants)
12017 !! options
12018 language=sr variant=sr-ec
12019 !! input
12020 -{[[Main Page]]}-
12021 !! result
12022 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12023 </p>
12024 !! end
12025
12026
12027 !! test
12028 -{}- tags within headlines (within html for parserConvert())
12029 !! options
12030 language=sr variant=sr-ec
12031 !! input
12032 == -{Naslov}- ==
12033 !! result
12034 <h2><span class="mw-headline" id="-.7BNaslov.7D-">Naslov</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Уредите одељак „Naslov“">уреди</a>]</span></h2>
12035
12036 !! end
12037
12038
12039 !! test
12040 Explicit definition of language variant alternatives
12041 !! options
12042 language=zh variant=zh-tw
12043 !! input
12044 -{zh:China;zh-tw:Taiwan}-, not China
12045 !! result
12046 <p>Taiwan, not China
12047 </p>
12048 !! end
12049
12050
12051 !! test
12052 Conversion around HTML tags
12053 !! options
12054 language=sr variant=sr-ec
12055 !! input
12056 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
12057 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
12058 !! result
12059 <p>
12060 <span title="ЛаCтин">ски</span>
12061 </p>
12062 !! end
12063
12064
12065 !! test
12066 Explicit session-wise language variant mapping (A flag and - flag)
12067 !! options
12068 language=zh variant=zh-tw
12069 !! input
12070 Taiwan is not China.
12071 But -{A|zh:China;zh-tw:Taiwan}- is China,
12072 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
12073 and -{China}- is China.
12074 !! result
12075 <p>Taiwan is not China.
12076 But Taiwan is Taiwan,
12077 (This should be stripped!)
12078 and China is China.
12079 </p>
12080 !! end
12081
12082 !! test
12083 Explicit session-wise language variant mapping (H flag for hide)
12084 !! options
12085 language=zh variant=zh-tw
12086 !! input
12087 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
12088 Taiwan is China.
12089 !! result
12090 <p>(This should be stripped!)
12091 Taiwan is Taiwan.
12092 </p>
12093 !! end
12094
12095 !! test
12096 Adding explicit conversion rule for title (T flag)
12097 !! options
12098 language=zh variant=zh-tw showtitle
12099 !! input
12100 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12101 !! result
12102 Taiwan
12103 <p>Should be stripped!
12104 </p>
12105 !! end
12106
12107 !! test
12108 Testing that changing the language variant here in the tests actually works
12109 !! options
12110 language=zh variant=zh showtitle
12111 !! input
12112 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12113 !! result
12114 China
12115 <p>Should be stripped!
12116 </p>
12117 !! end
12118
12119 !! test
12120 Recursive conversion of alt and title attrs shouldn't clear converter state
12121 !! options
12122 language=zh variant=zh-cn showtitle
12123 !! input
12124 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
12125 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
12126 !! result
12127 China
12128 <p>
12129 Should be stripped<span title="Exclamation">!</span>
12130 </p>
12131 !! end
12132
12133 !! test
12134 Bug 24072: more test on conversion rule for title
12135 !! options
12136 language=zh variant=zh-tw showtitle
12137 !! input
12138 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12139 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
12140 !! result
12141 Taiwan
12142 <p>This should be stripped!
12143 This won't take interferes with the title rule.
12144 </p>
12145 !! end
12146
12147 !! test
12148 Partly disable title conversion if variant == main language code
12149 !! options
12150 language=zh variant=zh title=[[ZH]] showtitle
12151 !! input
12152 -{T|zh-cn:CN;zh-tw:TW}-
12153 !! result
12154 ZH
12155 <p>
12156 </p>
12157 !! end
12158
12159 !! test
12160 Partly disable title conversion if variant == main language code, more
12161 !! options
12162 language=zh variant=zh title=[[ZH]] showtitle
12163 !! input
12164 -{T|TW}-
12165 !! result
12166 ZH
12167 <p>
12168 </p>
12169 !! end
12170
12171 !! test
12172 Raw output of variant escape tags (R flag)
12173 !! options
12174 language=zh variant=zh-tw
12175 !! input
12176 Raw: -{R|zh:China;zh-tw:Taiwan}-
12177 !! result
12178 <p>Raw: zh:China;zh-tw:Taiwan
12179 </p>
12180 !! end
12181
12182 !! test
12183 Nested using of manual convert syntax
12184 !! options
12185 language=zh variant=zh-hk
12186 !! input
12187 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
12188 !! result
12189 <p>Nested: Hello Hong Kong!
12190 </p>
12191 !! end
12192
12193 !! test
12194 Proper conversion of text in external links
12195 !! options
12196 language=sr variant=sr-ec
12197 !! input
12198 http://www.google.com
12199 gopher://www.google.com
12200 [http://www.google.com http://www.google.com]
12201 [gopher://www.google.com gopher://www.google.com]
12202 [https://www.google.com irc://www.google.com]
12203 [ftp://www.google.com www.google.com/ftp://dir]
12204 [//www.google.com www.google.com]
12205 !! result
12206 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12207 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12208 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12209 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12210 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
12211 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
12212 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
12213 </p>
12214 !! end
12215
12216 !! test
12217 Do not convert roman numbers to language variants
12218 !! options
12219 language=sr variant=sr-ec
12220 !! input
12221 Fridrih IV je car.
12222 !! result
12223 <p>Фридрих IV је цар.
12224 </p>
12225 !! end
12226
12227 !! test
12228 Unclosed language converter markup "-{"
12229 !! options
12230 language=sr
12231 !! input
12232 -{T|hello
12233 !! result
12234 <p>-{T|hello
12235 </p>
12236 !! end
12237
12238 !! test
12239 Don't convert raw rule "-{R|=&gt;}-" to "=>"
12240 !! options
12241 language=sr
12242 !! input
12243 -{R|=&gt;}-
12244 !! result
12245 <p>=&gt;
12246 </p>
12247 !!end
12248
12249 !!article
12250 Template:Bullet
12251 !!text
12252 * Bar
12253 !!endarticle
12254
12255 !! test
12256 Bug 529: Uncovered bullet
12257 !! input
12258 * Foo {{bullet}}
12259 !! result
12260 <ul><li> Foo
12261 </li><li> Bar
12262 </li></ul>
12263
12264 !! end
12265
12266 # Plain MediaWiki does not remove empty lists, but tidy actually does.
12267 # Templates in Wikipedia rely on this behavior, as tidy has always been
12268 # enabled there. These tests are normally run *without* tidy, so specify the
12269 # full output here.
12270 # To test realistic parsing behavior, apply a tidy-like transformation to both
12271 # the expected output and your parser's output.
12272 !! test
12273 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
12274 !! input
12275 ******* Foo {{bullet}}
12276 !! result
12277 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
12278 </li></ul>
12279 </li></ul>
12280 </li></ul>
12281 </li></ul>
12282 </li></ul>
12283 </li></ul>
12284 </li><li> Bar
12285 </li></ul>
12286
12287 !! end
12288
12289 !! test
12290 Bug 529: Uncovered table already at line-start
12291 !! input
12292 x
12293
12294 {{table}}
12295 y
12296 !! result
12297 <p>x
12298 </p>
12299 <table>
12300 <tr>
12301 <td> 1 </td>
12302 <td> 2
12303 </td></tr>
12304 <tr>
12305 <td> 3 </td>
12306 <td> 4
12307 </td></tr></table>
12308 <p>y
12309 </p>
12310 !! end
12311
12312 !! test
12313 Bug 529: Uncovered bullet in parser function result
12314 !! input
12315 * Foo {{lc:{{bullet}} }}
12316 !! result
12317 <ul><li> Foo
12318 </li><li> bar
12319 </li></ul>
12320
12321 !! end
12322
12323 !! test
12324 Bug 5678: Double-parsed template argument
12325 !! input
12326 {{lc:{{{1}}}|hello}}
12327 !! result
12328 <p>{{{1}}}
12329 </p>
12330 !! end
12331
12332 !! test
12333 Bug 5678: Double-parsed template invocation
12334 !! input
12335 {{lc:{{paramtest {{!}} param = hello }} }}
12336 !! result
12337 <p>{{paramtest | param = hello }}
12338 </p>
12339 !! end
12340
12341 !! test
12342 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
12343 !! options
12344 language=cs
12345 title=[[Main Page]]
12346 !! input
12347 {{PRVNÍVELKÉ:ěščř}}
12348 {{prvnívelké:ěščř}}
12349 {{PRVNÍMALÉ:ěščř}}
12350 {{prvnímalé:ěščř}}
12351 {{MALÁ:ěščř}}
12352 {{malá:ěščř}}
12353 {{VELKÁ:ěščř}}
12354 {{velká:ěščř}}
12355 !! result
12356 <p>Ěščř
12357 Ěščř
12358 ěščř
12359 ěščř
12360 ěščř
12361 ěščř
12362 ĚŠČŘ
12363 ĚŠČŘ
12364 </p>
12365 !! end
12366
12367 !! test
12368 Morwen/13: Unclosed link followed by heading
12369 !! input
12370 [[link
12371 ==heading==
12372 !! result
12373 <p>[[link
12374 </p>
12375 <h2><span class="mw-headline" id="heading">heading</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span></h2>
12376
12377 !! end
12378
12379 !! test
12380 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
12381 !! input
12382 {{foo|
12383 =heading=
12384 !! result
12385 <p>{{foo|
12386 </p>
12387 <h1><span class="mw-headline" id="heading">heading</span> </h1>
12388
12389 !! end
12390
12391 !! test
12392 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
12393 !! input
12394 {{foo|
12395 ==heading==
12396 !! result
12397 <p>{{foo|
12398 </p>
12399 <h2><span class="mw-headline" id="heading">heading</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span></h2>
12400
12401 !! end
12402
12403 !! test
12404 Tildes in comments
12405 !! options
12406 pst
12407 !! input
12408 <!-- ~~~~ -->
12409 !! result
12410 <!-- ~~~~ -->
12411 !! end
12412
12413 !! test
12414 Paragraphs inside divs (no extra line breaks)
12415 !! input
12416 <div>Line one
12417
12418 Line two</div>
12419 !! result
12420 <div>Line one
12421 Line two</div>
12422
12423 !! end
12424
12425 !! test
12426 Paragraphs inside divs (extra line break on open)
12427 !! input
12428 <div>
12429 Line one
12430
12431 Line two</div>
12432 !! result
12433 <div>
12434 <p>Line one
12435 </p>
12436 Line two</div>
12437
12438 !! end
12439
12440 !! test
12441 Paragraphs inside divs (extra line break on close)
12442 !! input
12443 <div>Line one
12444
12445 Line two
12446 </div>
12447 !! result
12448 <div>Line one
12449 <p>Line two
12450 </p>
12451 </div>
12452
12453 !! end
12454
12455 !! test
12456 Paragraphs inside divs (extra line break on open and close)
12457 !! input
12458 <div>
12459 Line one
12460
12461 Line two
12462 </div>
12463 !! result
12464 <div>
12465 <p>Line one
12466 </p><p>Line two
12467 </p>
12468 </div>
12469
12470 !! end
12471
12472 !! test
12473 Nesting tags, paragraphs on lines which begin with <div>
12474 !! options
12475 disabled
12476 !! input
12477 <div></div><strong>A
12478 B</strong>
12479 !! result
12480 <div></div>
12481 <p><strong>A
12482 B</strong>
12483 </p>
12484 !! end
12485
12486 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
12487 !! test
12488 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
12489 !! options
12490 disabled
12491 !! input
12492 <blockquote>Line one
12493
12494 Line two</blockquote>
12495 !! result
12496 <blockquote>Line one
12497 Line two</blockquote>
12498
12499 !! end
12500
12501 !! test
12502 Bug 6200: paragraphs inside blockquotes (extra line break on open)
12503 !! options
12504 disabled
12505 !! input
12506 <blockquote>
12507 Line one
12508
12509 Line two</blockquote>
12510 !! result
12511 <blockquote>
12512 <p>Line one
12513 </p>
12514 Line two</blockquote>
12515
12516 !! end
12517
12518 !! test
12519 Bug 6200: paragraphs inside blockquotes (extra line break on close)
12520 !! options
12521 disabled
12522 !! input
12523 <blockquote>Line one
12524
12525 Line two
12526 </blockquote>
12527 !! result
12528 <blockquote>Line one
12529 <p>Line two
12530 </p>
12531 </blockquote>
12532
12533 !! end
12534
12535 !! test
12536 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
12537 !! options
12538 disabled
12539 !! input
12540 <blockquote>
12541 Line one
12542
12543 Line two
12544 </blockquote>
12545 !! result
12546 <blockquote>
12547 <p>Line one
12548 </p><p>Line two
12549 </p>
12550 </blockquote>
12551
12552 !! end
12553
12554 !! test
12555 Paragraphs inside blockquotes/divs (no extra line breaks)
12556 !! input
12557 <blockquote><div>Line one
12558
12559 Line two</div></blockquote>
12560 !! result
12561 <blockquote><div>Line one
12562 Line two</div></blockquote>
12563
12564 !! end
12565
12566 !! test
12567 Paragraphs inside blockquotes/divs (extra line break on open)
12568 !! input
12569 <blockquote><div>
12570 Line one
12571
12572 Line two</div></blockquote>
12573 !! result
12574 <blockquote><div>
12575 <p>Line one
12576 </p>
12577 Line two</div></blockquote>
12578
12579 !! end
12580
12581 !! test
12582 Paragraphs inside blockquotes/divs (extra line break on close)
12583 !! input
12584 <blockquote><div>Line one
12585
12586 Line two
12587 </div></blockquote>
12588 !! result
12589 <blockquote><div>Line one
12590 <p>Line two
12591 </p>
12592 </div></blockquote>
12593
12594 !! end
12595
12596 !! test
12597 Paragraphs inside blockquotes/divs (extra line break on open and close)
12598 !! input
12599 <blockquote><div>
12600 Line one
12601
12602 Line two
12603 </div></blockquote>
12604 !! result
12605 <blockquote><div>
12606 <p>Line one
12607 </p><p>Line two
12608 </p>
12609 </div></blockquote>
12610
12611 !! end
12612
12613 !! test
12614 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
12615 !! options
12616 wgLinkHolderBatchSize=0
12617 !! input
12618 [[meatball:1]]
12619 [[meatball:2]]
12620 [[meatball:3]]
12621 !! result
12622 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
12623 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
12624 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
12625 </p>
12626 !! end
12627
12628 !! test
12629 Free external link invading image caption
12630 !! input
12631 [[Image:Foobar.jpg|thumb|http://x|hello]]
12632 !! result
12633 <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>
12634
12635 !! end
12636
12637 !! test
12638 Bug 15196: localised external link numbers
12639 !! options
12640 language=fa
12641 !! input
12642 [http://en.wikipedia.org/]
12643 !! result
12644 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
12645 </p>
12646 !! end
12647
12648 !! test
12649 Multibyte character in padleft
12650 !! input
12651 {{padleft:-Hello|7|Æ}}
12652 !! result
12653 <p>Æ-Hello
12654 </p>
12655 !! end
12656
12657 !! test
12658 Multibyte character in padright
12659 !! input
12660 {{padright:Hello-|7|Æ}}
12661 !! result
12662 <p>Hello-Æ
12663 </p>
12664 !! end
12665
12666 !!test
12667 formatdate parser function
12668 !!input
12669 {{#formatdate:2009-03-24}}
12670 !! result
12671 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
12672 </p>
12673 !! end
12674
12675 !!test
12676 formatdate parser function, with default format
12677 !!input
12678 {{#formatdate:2009-03-24|mdy}}
12679 !! result
12680 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
12681 </p>
12682 !! end
12683
12684 !! test
12685 Spacing of numbers in formatted dates
12686 !! input
12687 {{#formatdate:January 15}}
12688 !! result
12689 <p><span class="mw-formatted-date" title="01-15">January 15</span>
12690 </p>
12691 !! end
12692
12693 !! test
12694 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
12695 !! options
12696 language=nl title=[[MediaWiki:Common.css]]
12697 !! input
12698 {{#formatdate:2009-03-24|dmy}}
12699 !! result
12700 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
12701 </p>
12702 !! end
12703
12704 #
12705 #
12706 #
12707
12708 #
12709 # Edit comments
12710 #
12711
12712 !! test
12713 Edit comment with link
12714 !! options
12715 comment
12716 !! input
12717 I like the [[Main Page]] a lot
12718 !! result
12719 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
12720 !!end
12721
12722 !! test
12723 Edit comment with link and link text
12724 !! options
12725 comment
12726 !! input
12727 I like the [[Main Page|best pages]] a lot
12728 !! result
12729 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
12730 !!end
12731
12732 !! test
12733 Edit comment with link and link text with suffix
12734 !! options
12735 comment
12736 !! input
12737 I like the [[Main Page|best page]]s a lot
12738 !! result
12739 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
12740 !!end
12741
12742 !! test
12743 Edit comment with section link (non-local, eg in history list)
12744 !! options
12745 comment title=[[Main Page]]
12746 !! input
12747 /* External links */ removed bogus entries
12748 !! result
12749 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12750 !!end
12751
12752 !! test
12753 Edit comment with section link and text before it (non-local, eg in history list)
12754 !! options
12755 comment title=[[Main Page]]
12756 !! input
12757 pre-comment text /* External links */ removed bogus entries
12758 !! result
12759 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>
12760 !!end
12761
12762 !! test
12763 Edit comment with section link (local, eg in diff view)
12764 !! options
12765 comment local title=[[Main Page]]
12766 !! input
12767 /* External links */ removed bogus entries
12768 !! result
12769 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12770 !!end
12771
12772 !! test
12773 Edit comment with subpage link (bug 14080)
12774 !! options
12775 comment
12776 subpage
12777 title=[[Subpage test]]
12778 !! input
12779 Poked at a [[/subpage]] here...
12780 !! result
12781 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
12782 !!end
12783
12784 !! test
12785 Edit comment with subpage link and link text (bug 14080)
12786 !! options
12787 comment
12788 subpage
12789 title=[[Subpage test]]
12790 !! input
12791 Poked at a [[/subpage|neat little page]] here...
12792 !! result
12793 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
12794 !!end
12795
12796 !! test
12797 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
12798 !! options
12799 comment
12800 title=[[Subpage test]]
12801 !! input
12802 Poked at a [[/subpage]] here...
12803 !! result
12804 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...
12805 !!end
12806
12807 !! test
12808 Edit comment with bare anchor link (local, as on diff)
12809 !! options
12810 comment
12811 local
12812 title=[[Main Page]]
12813 !!input
12814 [[#section]]
12815 !! result
12816 <a href="#section">#section</a>
12817 !! end
12818
12819 !! test
12820 Edit comment with bare anchor link (non-local, as on history)
12821 !! options
12822 comment
12823 title=[[Main Page]]
12824 !!input
12825 [[#section]]
12826 !! result
12827 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
12828 !! end
12829
12830 !! test
12831 Anchor starting with underscore
12832 !!input
12833 [[#_ref|One]]
12834 !! result
12835 <p><a href="#_ref">One</a>
12836 </p>
12837 !! end
12838
12839 !! test
12840 Id starting with underscore
12841 !!input
12842 <div id="_ref"></div>
12843 !! result
12844 <div id="_ref"></div>
12845
12846 !! end
12847
12848 !! test
12849 Space normalisation on autocomment (bug 22784)
12850 !! options
12851 comment
12852 title=[[Main Page]]
12853 !!input
12854 /* __hello__world__ */
12855 !! result
12856 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
12857 !! end
12858
12859 !! test
12860 percent-encoding and + signs in comments (Bug 26410)
12861 !! options
12862 comment
12863 !!input
12864 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
12865 !! result
12866 <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>
12867 !! end
12868
12869 !! test
12870 Bad images - basic functionality
12871 !! options
12872 disabled
12873 !! input
12874 [[File:Bad.jpg]]
12875 !! result
12876 !! end
12877
12878 !! test
12879 Bad images - bug 16039: text after bad image disappears
12880 !! options
12881 disabled
12882 !! input
12883 Foo bar
12884 [[File:Bad.jpg]]
12885 Bar foo
12886 !! result
12887 <p>Foo bar
12888 </p><p>Bar foo
12889 </p>
12890 !! end
12891
12892 !! test
12893 Verify that displaytitle works (bug #22501) no displaytitle
12894 !! options
12895 showtitle
12896 !! config
12897 wgAllowDisplayTitle=true
12898 wgRestrictDisplayTitle=false
12899 !! input
12900 this is not the the title
12901 !! result
12902 Parser test
12903 <p>this is not the the title
12904 </p>
12905 !! end
12906
12907 !! test
12908 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
12909 !! options
12910 showtitle
12911 title=[[Screen]]
12912 !! config
12913 wgAllowDisplayTitle=true
12914 wgRestrictDisplayTitle=false
12915 !! input
12916 this is not the the title
12917 {{DISPLAYTITLE:whatever}}
12918 !! result
12919 whatever
12920 <p>this is not the the title
12921 </p>
12922 !! end
12923
12924 !! test
12925 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
12926 !! options
12927 showtitle
12928 title=[[Screen]]
12929 !! config
12930 wgAllowDisplayTitle=true
12931 wgRestrictDisplayTitle=true
12932 !! input
12933 this is not the the title
12934 {{DISPLAYTITLE:whatever}}
12935 !! result
12936 Screen
12937 <p>this is not the the title
12938 </p>
12939 !! end
12940
12941 !! test
12942 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
12943 !! options
12944 showtitle
12945 title=[[Screen]]
12946 !! config
12947 wgAllowDisplayTitle=true
12948 wgRestrictDisplayTitle=true
12949 !! input
12950 this is not the the title
12951 {{DISPLAYTITLE:screen}}
12952 !! result
12953 screen
12954 <p>this is not the the title
12955 </p>
12956 !! end
12957
12958 !! test
12959 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
12960 !! options
12961 showtitle
12962 title=[[Screen]]
12963 !! config
12964 wgAllowDisplayTitle=false
12965 !! input
12966 this is not the the title
12967 {{DISPLAYTITLE:screen}}
12968 !! result
12969 Screen
12970 <p>this is not the the title
12971 <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>
12972 </p>
12973 !! end
12974
12975 !! test
12976 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
12977 !! options
12978 showtitle
12979 title=[[Screen]]
12980 !! config
12981 wgAllowDisplayTitle=false
12982 !! input
12983 this is not the the title
12984 !! result
12985 Screen
12986 <p>this is not the the title
12987 </p>
12988 !! end
12989
12990 !! test
12991 preload: check <noinclude> and <includeonly>
12992 !! options
12993 preload
12994 !! input
12995 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
12996 !! result
12997 Hello kind world.
12998 !! end
12999
13000 !! test
13001 preload: check <onlyinclude>
13002 !! options
13003 preload
13004 !! input
13005 Goodbye <onlyinclude>Hello world</onlyinclude>
13006 !! result
13007 Hello world
13008 !! end
13009
13010 !! test
13011 preload: can pass tags through if we want to
13012 !! options
13013 preload
13014 !! input
13015 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
13016 !! result
13017 <includeonly>Hello world</includeonly>
13018 !! end
13019
13020 !! test
13021 preload: check that it doesn't try to do tricks
13022 !! options
13023 preload
13024 !! input
13025 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13026 !! result
13027 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13028 !! end
13029
13030 !! test
13031 Play a bit with r67090 and bug 3158
13032 !! options
13033 disabled
13034 !! input
13035 <div style="width:50% !important">&nbsp;</div>
13036 <div style="width:50%&nbsp;!important">&nbsp;</div>
13037 <div style="width:50%&#160;!important">&nbsp;</div>
13038 <div style="border : solid;">&nbsp;</div>
13039 !! result
13040 <div style="width:50% !important">&nbsp;</div>
13041 <div style="width:50% !important">&nbsp;</div>
13042 <div style="width:50% !important">&nbsp;</div>
13043 <div style="border&#160;: solid;">&nbsp;</div>
13044
13045 !! end
13046
13047 !! test
13048 HTML5 data attributes
13049 !! input
13050 <span data-foo="bar">Baz</span>
13051 <p data-abc-def_hij="">Quuz</p>
13052 !! result
13053 <p><span data-foo="bar">Baz</span>
13054 </p>
13055 <p data-abc-def_hij="">Quuz</p>
13056
13057 !! end
13058
13059 !! test
13060 percent-encoding and + signs in internal links (Bug 26410)
13061 !! input
13062 [[User:+%]] [[Page+title%]]
13063 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
13064 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
13065 [[%33%45]] [[%33%45+]]
13066 !! result
13067 <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>
13068 <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>
13069 <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>
13070 <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>
13071 </p>
13072 !! end
13073
13074 !! test
13075 Special characters in embedded file links (bug 27679)
13076 !! input
13077 [[File:Contains & ampersand.jpg]]
13078 [[File:Does not exist.jpg|Title with & ampersand]]
13079 !! result
13080 <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>
13081 <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>
13082 </p>
13083 !! end
13084
13085
13086 !! test
13087 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
13088 !! input
13089 Text&apos;s been normalized?
13090 !! result
13091 <p>Text&#39;s been normalized?
13092 </p>
13093 !! end
13094
13095 !! test
13096 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
13097 !! input
13098 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
13099 !! result
13100 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
13101 </p>
13102 !! end
13103
13104 !! test
13105 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
13106 !! input
13107 [http://www.example.org/ ideograms]
13108 !! result
13109 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
13110 </p>
13111 !! end
13112
13113 !! test
13114 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
13115 !! input
13116 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
13117 !! result
13118 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
13119 </p>
13120 !! end
13121
13122 !! article
13123 Mediawiki:loop1
13124 !! text
13125 {{Identical|A}}
13126 !! endarticle
13127
13128 !! article
13129 Mediawiki:loop2
13130 !! text
13131 {{Identical|B}}
13132 !! endarticle
13133
13134 !! article
13135 Template:Identical
13136 !! text
13137 {{int:loop1}}
13138 {{int:loop2}}
13139 !! endarticle
13140
13141 !! test
13142 Bug 31098 Template which includes system messages which includes the template
13143 !! input
13144 {{Identical}}
13145 !! result
13146 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13147 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13148 </p>
13149 !! end
13150
13151 !! test
13152 Bug31490 Turkish: ucfirst 'blah'
13153 !! options
13154 language=tr
13155 !! input
13156 {{ucfirst:blah}}
13157 !! result
13158 <p>Blah
13159 </p>
13160 !! end
13161
13162 !! test
13163 Bug31490 Turkish: ucfirst 'ix'
13164 !! options
13165 language=tr
13166 !! input
13167 {{ucfirst:ix}}
13168 !! result
13169 <p>İx
13170 </p>
13171 !! end
13172
13173 !! test
13174 Bug31490 Turkish: lcfirst 'BLAH'
13175 !! options
13176 language=tr
13177 !! input
13178 {{lcfirst:BLAH}}
13179 !! result
13180 <p>bLAH
13181 </p>
13182 !! end
13183
13184 !! test
13185 Bug31490 Turkish: ucfırst (with a dotless i)
13186 !! options
13187 language=tr
13188 !! input
13189 {{ucfırst:blah}}
13190 !! result
13191 <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>
13192 </p>
13193 !! end
13194
13195 !! test
13196 Bug31490 ucfırst (with a dotless i) with English language
13197 !! options
13198 language=en
13199 !! input
13200 {{ucfırst:blah}}
13201 !! result
13202 <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>
13203 </p>
13204 !! end
13205
13206 !! test
13207 Bug 26375: TOC with italics
13208 !! options
13209 title=[[Main Page]]
13210 !! input
13211 __TOC__
13212 == ''Lost'' episodes ==
13213 !! result
13214 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13215 <ul>
13216 <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>
13217 </ul>
13218 </td></tr></table>
13219 <h2><span class="mw-headline" id="Lost_episodes"><i>Lost</i> episodes</span> <span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Lost episodes">edit</a>]</span></h2>
13220
13221 !! end
13222
13223 !! test
13224 Bug 26375: TOC with bold
13225 !! options
13226 title=[[Main Page]]
13227 !! input
13228 __TOC__
13229 == '''should be bold''' then normal text ==
13230 !! result
13231 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13232 <ul>
13233 <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>
13234 </ul>
13235 </td></tr></table>
13236 <h2><span class="mw-headline" id="should_be_bold_then_normal_text"><b>should be bold</b> then normal text</span> <span class="mw-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></h2>
13237
13238 !! end
13239
13240 !! test
13241 Bug 33845: Headings become cursive in TOC when they contain an image
13242 !! options
13243 title=[[Main Page]]
13244 !! input
13245 __TOC__
13246 == Image [[Image:foobar.jpg]] ==
13247 !! result
13248 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13249 <ul>
13250 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
13251 </ul>
13252 </td></tr></table>
13253 <h2><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> <span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Image">edit</a>]</span></h2>
13254
13255 !! end
13256
13257 !! test
13258 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
13259 !! options
13260 title=[[Main Page]]
13261 !! input
13262 __TOC__
13263 == <blockquote>Quote</blockquote> ==
13264 !! result
13265 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13266 <ul>
13267 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
13268 </ul>
13269 </td></tr></table>
13270 <h2><span class="mw-headline" id="Quote"><blockquote>Quote</blockquote></span> <span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Quote">edit</a>]</span></h2>
13271
13272 !! end
13273
13274 !! test
13275 Unclosed tags in TOC
13276 !! options
13277 title=[[Main Page]]
13278 !! input
13279 __TOC__
13280 == Proof: 2 < 3 ==
13281 <small>Hanc marginis exiguitas non caperet.</small>
13282 QED
13283 !! result
13284 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13285 <ul>
13286 <li class="toclevel-1 tocsection-1"><a href="#Proof:_2_.3C_3"><span class="tocnumber">1</span> <span class="toctext">Proof: 2 &lt; 3</span></a></li>
13287 </ul>
13288 </td></tr></table>
13289 <h2><span class="mw-headline" id="Proof:_2_.3C_3">Proof: 2 &lt; 3</span> <span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Proof: 2 &lt; 3">edit</a>]</span></h2>
13290 <p><small>Hanc marginis exiguitas non caperet.</small>
13291 QED
13292 </p>
13293 !! end
13294
13295 !! test
13296 Multiple tags in TOC
13297 !! input
13298 __TOC__
13299 == <i>Foo</i> <b>Bar</b> ==
13300
13301 == <i>Foo</i> <blockquote>Bar</blockquote> ==
13302 !! result
13303 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13304 <ul>
13305 <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>
13306 <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>
13307 </ul>
13308 </td></tr></table>
13309 <h2><span class="mw-headline" id="Foo_Bar"><i>Foo</i> <b>Bar</b></span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo Bar">edit</a>]</span></h2>
13310 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i> <blockquote>Bar</blockquote></span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a>]</span></h2>
13311
13312 !! end
13313
13314 !! test
13315 Tags with parameters in TOC
13316 !! input
13317 __TOC__
13318 == <sup class="in-h2">Hello</sup> ==
13319
13320 == <sup class="a > b">Evilbye</sup> ==
13321 !! result
13322 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13323 <ul>
13324 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
13325 <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>
13326 </ul>
13327 </td></tr></table>
13328 <h2><span class="mw-headline" id="Hello"><sup class="in-h2">Hello</sup></span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Hello">edit</a>]</span></h2>
13329 <h2><span class="mw-headline" id="b.22.3EEvilbye"><sup> b"&gt;Evilbye</sup></span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b&quot;>Evilbye">edit</a>]</span></h2>
13330
13331 !! end
13332
13333 !! test
13334 span tags with directionality in TOC
13335 !! input
13336 __TOC__
13337 == <span dir="ltr">C++</span> ==
13338
13339 == <span dir="rtl">זבנג!</span> ==
13340
13341 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
13342
13343 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
13344
13345 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
13346 !! result
13347 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13348 <ul>
13349 <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>
13350 <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>
13351 <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>
13352 <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>
13353 <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>
13354 </ul>
13355 </td></tr></table>
13356 <h2><span class="mw-headline" id="C.2B.2B"><span dir="ltr">C++</span></span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: C++">edit</a>]</span></h2>
13357 <h2><span class="mw-headline" id=".D7.96.D7.91.D7.A0.D7.92.21"><span dir="rtl">זבנג!</span></span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: זבנג!">edit</a>]</span></h2>
13358 <h2><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> <span class="mw-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></h2>
13359 <h2><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> <span class="mw-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></h2>
13360 <h2><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> <span class="mw-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></h2>
13361
13362 !! end
13363
13364 !! article
13365 MediaWiki:Bug32057
13366 !! text
13367 == {{int:headline_sample}} ==
13368 !! endarticle
13369
13370 !! test
13371 Bug 32057: Title needed when expanding <h> nodes.
13372 !! options
13373 title=[[Main Page]]
13374 !! input
13375 {{int:Bug32057}}
13376 !! result
13377 <h2><span class="mw-headline" id="Headline_text">Headline text</span> <span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Headline text">edit</a>]</span></h2>
13378
13379 !! end
13380
13381 !! test
13382 Strip marker in urlencode
13383 !! input
13384 {{urlencode:x<nowiki/>y}}
13385 {{urlencode:x<nowiki/>y|wiki}}
13386 {{urlencode:x<nowiki/>y|path}}
13387 !! result
13388 <p>xy
13389 xy
13390 xy
13391 </p>
13392 !! end
13393
13394 !! test
13395 Strip marker in lc
13396 !! input
13397 {{lc:x<nowiki/>y}}
13398 !! result
13399 <p>xy
13400 </p>
13401 !! end
13402
13403 !! test
13404 Strip marker in uc
13405 !! input
13406 {{uc:x<nowiki/>y}}
13407 !! result
13408 <p>XY
13409 </p>
13410 !! end
13411
13412 !! test
13413 Strip marker in formatNum
13414 !! input
13415 {{formatnum:1<nowiki/>2}}
13416 {{formatnum:1<nowiki/>2|R}}
13417 !! result
13418 <p>12
13419 12
13420 </p>
13421 !! end
13422
13423 !! test
13424 Check noCommafy in formatNum
13425 !! options
13426 language=be-tarask
13427 !! input
13428 {{formatnum:123456.78}}
13429 {{formatnum:123456.78|NOSEP}}
13430 !! result
13431 <p>123 456,78
13432 123456.78
13433 </p>
13434 !! end
13435
13436 !! test
13437 Strip marker in grammar
13438 !! options
13439 language=fi
13440 !! input
13441 {{grammar:elative|foo<nowiki/>bar}}
13442 !! result
13443 <p>foobarista
13444 </p>
13445 !! end
13446
13447 !! test
13448 Strip marker in padleft
13449 !! input
13450 {{padleft:|2|x<nowiki/>y}}
13451 !! result
13452 <p>xy
13453 </p>
13454 !! end
13455
13456 !! test
13457 Strip marker in padright
13458 !! input
13459 {{padright:|2|x<nowiki/>y}}
13460 !! result
13461 <p>xy
13462 </p>
13463 !! end
13464
13465 !! test
13466 Strip marker in anchorencode
13467 !! input
13468 {{anchorencode:x<nowiki/>y}}
13469 !! result
13470 <p>xy
13471 </p>
13472 !! end
13473
13474 !! test
13475 nowiki inside link inside heading (bug 18295)
13476 !! input
13477 ==[[foo|x<nowiki>y</nowiki>z]]==
13478 !! result
13479 <h2><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> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: xyz">edit</a>]</span></h2>
13480
13481 !! end
13482
13483 !! test
13484 new support for bdi element (bug 31817)
13485 !! input
13486 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
13487 !! result
13488 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
13489
13490 !!end
13491
13492 !! test
13493 Ignore pipe between table row attributes
13494 !! input
13495 {|
13496 | quux
13497 |- id=foo | style='color: red'
13498 | bar
13499 |}
13500 !! result
13501 <table>
13502 <tr>
13503 <td> quux
13504 </td></tr>
13505 <tr id="foo" style="color: red">
13506 <td> bar
13507 </td></tr></table>
13508
13509 !! end
13510
13511 !!test
13512 Gallery override link with WikiLink (bug 34852)
13513 !! input
13514 <gallery>
13515 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
13516 </gallery>
13517 !! result
13518 <ul class="gallery">
13519 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13520 <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>
13521 <div class="gallerytext">
13522 <p>caption
13523 </p>
13524 </div>
13525 </div></li>
13526 </ul>
13527
13528 !! end
13529
13530 !!test
13531 Gallery override link with absolute external link (bug 34852)
13532 !! input
13533 <gallery>
13534 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
13535 </gallery>
13536 !! result
13537 <ul class="gallery">
13538 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13539 <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>
13540 <div class="gallerytext">
13541 <p>caption
13542 </p>
13543 </div>
13544 </div></li>
13545 </ul>
13546
13547 !! end
13548
13549 !!test
13550 Gallery override link with malicious javascript (bug 34852)
13551 !! input
13552 <gallery>
13553 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
13554 </gallery>
13555 !! result
13556 <ul class="gallery">
13557 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13558 <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>
13559 <div class="gallerytext">
13560 <p>caption
13561 </p>
13562 </div>
13563 </div></li>
13564 </ul>
13565
13566 !! end
13567
13568 !!test
13569 Gallery with invalid title as link (bug 43964)
13570 !! input
13571 <gallery>
13572 File:foobar.jpg|link=<
13573 </gallery>
13574 !! result
13575 <ul class="gallery">
13576 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13577 <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>
13578 <div class="gallerytext">
13579 </div>
13580 </div></li>
13581 </ul>
13582
13583 !! end
13584
13585 !!test
13586 Language parser function
13587 !! input
13588 {{#language:ar}}
13589 !! result
13590 <p>العربية
13591 </p>
13592 !! end
13593
13594 !!test
13595 Padleft and padright as substr
13596 !! input
13597 {{padleft:|3|abcde}}
13598 {{padright:|3|abcde}}
13599 !! result
13600 <p>abc
13601 abc
13602 </p>
13603 !! end
13604
13605 !!test
13606 Bug 34939 - Case insensitive link parsing ([HttP://])
13607 !! input
13608 [HttP://MediaWiki.Org/]
13609 !! result
13610 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
13611 </p>
13612 !! end
13613
13614 !!test
13615 Bug 34939 - Case insensitive link parsing ([HttP:// title])
13616 !! input
13617 [HttP://MediaWiki.Org/ MediaWiki]
13618 !! result
13619 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
13620 </p>
13621 !! end
13622
13623 !!test
13624 Bug 34939 - Case insensitive link parsing (HttP://)
13625 !! input
13626 HttP://MediaWiki.Org/
13627 !! result
13628 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
13629 </p>
13630 !! end
13631
13632 ###
13633 ### Parsoids-specific tests
13634 ### Parsoid-PHP parser incompatibilities
13635 ###
13636 !!test
13637 1. SOL-sensitive wikitext tokens as template-args
13638 !!options
13639 parsoid
13640 !!input
13641 {{echo|*a}}
13642 {{echo|#a}}
13643 {{echo|:a}}
13644 !!result
13645 <p>*a
13646 #a
13647 :a
13648 </p>
13649 !!end
13650
13651 #### The following section of tests are primarily to test
13652 #### wikitext escaping capabilities of Parsoid. Given that
13653 #### escaping can be done any number of ways, the wikitext (input)
13654 #### is always adjusted to reflect how Parsoid adds nowiki
13655 #### escape tags.
13656 ####
13657 #### We are marking several tests as parsoid-only since the
13658 #### HTML in the result section is different from what the
13659 #### PHP parser generates for it.
13660
13661
13662 #### --------------- Headings ---------------
13663 #### 0. Unnested
13664 #### 1. Nested inside html <h1>=foo=</h1>
13665 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
13666 #### 3. Nested inside html with wikitext split by html tags
13667 #### 4. No escape needed
13668 #### 5. Empty headings <h1></h1>
13669 #### 6. Heading chars in SOL context
13670 #### ----------------------------------------
13671 !! test
13672 Headings: 0. Unnested
13673 !! options
13674 parsoid
13675 !! input
13676 <nowiki>=foo=</nowiki>
13677
13678 <nowiki> =foo= </nowiki>
13679 <!--cmt-->
13680 <nowiki>=foo=</nowiki>
13681
13682 =foo''a''<nowiki>=</nowiki>
13683 !! result
13684 <p>=foo=
13685 </p><p> =foo=
13686 </p><p><!--cmt-->=foo=
13687 </p><p>=foo<i>a</i>=
13688 </p>
13689 !!end
13690
13691 !! test
13692 Headings: 1. Nested inside html
13693 !! options
13694 parsoid
13695 !! input
13696 =<nowiki>=foo=</nowiki>=
13697 ==<nowiki>=foo=</nowiki>==
13698 ===<nowiki>=foo=</nowiki>===
13699 ====<nowiki>=foo=</nowiki>====
13700 =====<nowiki>=foo=</nowiki>=====
13701 ======<nowiki>=foo=</nowiki>======
13702 !! result
13703 <h1>=foo=</h1>
13704 <h2>=foo=</h2>
13705 <h3>=foo=</h3>
13706 <h4>=foo=</h4>
13707 <h5>=foo=</h5>
13708 <h6>=foo=</h6>
13709 !!end
13710
13711 !! test
13712 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
13713 !! options
13714 parsoid
13715 !! input
13716 =foo=
13717 <nowiki>*bar</nowiki>
13718 =foo=
13719 =bar
13720 =foo=
13721 <nowiki>=bar=</nowiki>
13722 !! result
13723 <h1>foo</h1>*bar
13724 <h1>foo</h1>=bar
13725 <h1>foo</h1>=bar=
13726 !!end
13727
13728 !! test
13729 Headings: 3. Nested inside html with wikitext split by html tags
13730 !! options
13731 parsoid
13732 !! input
13733 =='''bold'''<nowiki>foo=</nowiki>=
13734 !! result
13735 <h1>=<b>bold</b>foo=</h1>
13736 !!end
13737
13738 !! test
13739 Headings: 4a. No escaping needed (testing just h1 and h2)
13740 !! options
13741 parsoid
13742 !! input
13743 ==foo=
13744 =foo==
13745 = =foo= =
13746 ==foo= bar=
13747 ===foo==
13748 ==foo===
13749 =''=''foo==
13750 =<nowiki>=</nowiki>=
13751 !! result
13752 <h1>=foo</h1>
13753 <h1>foo=</h1>
13754 <h1> =foo= </h1>
13755 <h1>=foo= bar</h1>
13756 <h2>=foo</h2>
13757 <h2>foo=</h2>
13758 <h1><i>=</i>foo=</h1>
13759 <h1>=</h1>
13760
13761 !!end
13762
13763 !! test
13764 Headings: 4b. No escaping needed (inside p-tags)
13765 !! options
13766 parsoid
13767 !! input
13768 ===
13769 =foo= x
13770 =foo= <s></s>
13771 !! result
13772 <p>===
13773 =foo= x
13774 =foo= <s></s>
13775 </p>
13776 !!end
13777
13778 !! test
13779 Headings: 5. Empty headings
13780 !! options
13781 parsoid
13782 !! input
13783 =<nowiki/>=
13784 ==<nowiki/>==
13785 ===<nowiki/>===
13786 ====<nowiki/>====
13787 =====<nowiki/>=====
13788 ======<nowiki/>======
13789 !! result
13790 <h1></h1>
13791 <h2></h2>
13792 <h3></h3>
13793 <h4></h4>
13794 <h5></h5>
13795 <h6></h6>
13796 !!end
13797
13798 !! test
13799 Headings: 6. Heading chars in SOL context
13800 !! options
13801 parsoid
13802 !! input
13803 <!--cmt--><nowiki>=h1=</nowiki>
13804 <!--cmt--><nowiki> =h1= </nowiki>
13805 !! result
13806 <p><!--cmt-->=h1=
13807 <!--cmt--> =h1=
13808 </p>
13809 !!end
13810
13811 #### --------------- Lists ---------------
13812 #### 0. Outside nests (*foo, etc.)
13813 #### 1. Nested inside html <ul><li>*foo</li></ul>
13814 #### 2. Inside definition lists
13815 #### 3. Only bullets at start should be escaped
13816 #### 4. No escapes needed
13817 #### 5. No unnecessary escapes
13818 #### 6. Escape bullets in SOL position
13819 #### 7. Escape bullets in a multi-line context
13820 #### ----------------------------------------
13821
13822 !! test
13823 Lists: 0. Outside nests
13824 !! input
13825 <nowiki>*foo</nowiki>
13826
13827 <nowiki>#foo</nowiki>
13828 !! result
13829 <p>*foo
13830 </p><p>#foo
13831 </p>
13832 !!end
13833
13834 !! test
13835 Lists: 1. Nested inside html
13836 !! input
13837 *<nowiki>*foo</nowiki>
13838
13839 *<nowiki>#foo</nowiki>
13840
13841 *<nowiki>:foo</nowiki>
13842
13843 *<nowiki>;foo</nowiki>
13844
13845 #<nowiki>*foo</nowiki>
13846
13847 #<nowiki>#foo</nowiki>
13848
13849 #<nowiki>:foo</nowiki>
13850
13851 #<nowiki>;foo</nowiki>
13852 !! result
13853 <ul><li>*foo
13854 </li></ul>
13855 <ul><li>#foo
13856 </li></ul>
13857 <ul><li>:foo
13858 </li></ul>
13859 <ul><li>;foo
13860 </li></ul>
13861 <ol><li>*foo
13862 </li></ol>
13863 <ol><li>#foo
13864 </li></ol>
13865 <ol><li>:foo
13866 </li></ol>
13867 <ol><li>;foo
13868 </li></ol>
13869
13870 !!end
13871
13872 !! test
13873 Lists: 2. Inside definition lists
13874 !! input
13875 ;<nowiki>;foo</nowiki>
13876
13877 ;<nowiki>:foo</nowiki>
13878
13879 ;<nowiki>:foo</nowiki>
13880 :bar
13881
13882 :<nowiki>:foo</nowiki>
13883 !! result
13884 <dl><dt>;foo
13885 </dt></dl>
13886 <dl><dt>:foo
13887 </dt></dl>
13888 <dl><dt>:foo
13889 </dt><dd>bar
13890 </dd></dl>
13891 <dl><dd>:foo
13892 </dd></dl>
13893
13894 !!end
13895
13896 !! test
13897 Lists: 3. Only bullets at start of text should be escaped
13898 !! input
13899 *<nowiki>*foo*bar</nowiki>
13900
13901 *<nowiki>*foo</nowiki>''it''*bar
13902 !! result
13903 <ul><li>*foo*bar
13904 </li></ul>
13905 <ul><li>*foo<i>it</i>*bar
13906 </li></ul>
13907
13908 !!end
13909
13910 !! test
13911 Lists: 4. No escapes needed
13912 !! options
13913 parsoid
13914 !! input
13915 *foo*bar
13916
13917 *''foo''*bar
13918
13919 *[[Foo]]: bar
13920 !! result
13921 <ul><li>foo*bar
13922 </li></ul>
13923 <ul><li><i>foo</i>*bar
13924 </li></ul>
13925 <ul><li><a href="Foo" rel="mw:WikiLink">Foo</a>: bar
13926 </li></ul>
13927 !!end
13928
13929 !! test
13930 Lists: 5. No unnecessary escapes
13931 !! input
13932 * bar <span><nowiki>[[foo]]</nowiki></span>
13933
13934 *=bar <span><nowiki>[[foo]]</nowiki></span>
13935
13936 *[[bar <span><nowiki>[[foo]]</nowiki></span>
13937
13938 *]]bar <span><nowiki>[[foo]]</nowiki></span>
13939
13940 *=bar <span>foo]]</span>=
13941
13942 * <s></s>: a
13943 !! result
13944 <ul><li> bar <span>[[foo]]</span>
13945 </li></ul>
13946 <ul><li>=bar <span>[[foo]]</span>
13947 </li></ul>
13948 <ul><li>[[bar <span>[[foo]]</span>
13949 </li></ul>
13950 <ul><li>]]bar <span>[[foo]]</span>
13951 </li></ul>
13952 <ul><li>=bar <span>foo]]</span>=
13953 </li></ul>
13954 <ul><li> <s></s>: a
13955 </li></ul>
13956
13957 !!end
13958
13959 !! test
13960 Lists: 6. Escape bullets in SOL position
13961 !! options
13962 parsoid
13963 !! input
13964 <!--cmt--><nowiki>*foo</nowiki>
13965 !! result
13966 <p><!--cmt-->*foo
13967 </p>
13968 !!end
13969
13970 !! test
13971 Lists: 7. Escape bullets in a multi-line context
13972 !! input
13973 <nowiki>a
13974 *b</nowiki>
13975 !! result
13976 <p>a
13977 *b
13978 </p>
13979 !!end
13980
13981 #### --------------- HRs ---------------
13982 #### 1. Single line
13983 #### -----------------------------------
13984
13985 !! test
13986 HRs: 1. Single line
13987 !! options
13988 parsoid
13989 !! input
13990 ----<nowiki>----</nowiki>
13991 ----=foo=
13992 ----*foo
13993 !! result
13994 <hr>----
13995 <hr>=foo=
13996 <hr>*foo
13997 !! end
13998
13999 #### --------------- Tables ---------------
14000 #### 1a. Simple example
14001 #### 1b. No escaping needed (!foo)
14002 #### 1c. No escaping needed (|foo)
14003 #### 1d. No escaping needed (|}foo)
14004 ####
14005 #### 2a. Nested in td (<td>foo|bar</td>)
14006 #### 2b. Nested in td (<td>foo||bar</td>)
14007 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
14008 ####
14009 #### 3a. Nested in th (<th>foo!bar</th>)
14010 #### 3b. Nested in th (<th>foo!!bar</th>)
14011 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
14012 ####
14013 #### 4a. Escape -
14014 #### 4b. Escape +
14015 #### 4c. No escaping needed
14016 #### --------------------------------------
14017
14018 !! test
14019 Tables: 1a. Simple example
14020 !! input
14021 <nowiki>{|
14022 |}</nowiki>
14023 !! result
14024 <p>{|
14025 |}
14026 </p>
14027 !! end
14028
14029 !! test
14030 Tables: 1b. No escaping needed
14031 !! input
14032 !foo
14033 !! result
14034 <p>!foo
14035 </p>
14036 !! end
14037
14038 !! test
14039 Tables: 1c. No escaping needed
14040 !! input
14041 |foo
14042 !! result
14043 <p>|foo
14044 </p>
14045 !! end
14046
14047 !! test
14048 Tables: 1d. No escaping needed
14049 !! input
14050 |}foo
14051 !! result
14052 <p>|}foo
14053 </p>
14054 !! end
14055
14056 !! test
14057 Tables: 2a. Nested in td
14058 !! options
14059 parsoid
14060 !! input
14061 {|
14062 |<nowiki>foo|bar</nowiki>
14063 |}
14064 !! result
14065 <table><tbody>
14066 <tr><td>foo|bar
14067 </td></tr></tbody></table>
14068
14069 !! end
14070
14071 !! test
14072 Tables: 2b. Nested in td
14073 !! options
14074 parsoid
14075 !! input
14076 {|
14077 |<nowiki>foo||bar</nowiki>
14078 |''it''<nowiki>foo||bar</nowiki>
14079 |}
14080 !! result
14081 <table><tbody>
14082 <tr><td>foo||bar
14083 </td><td><i>it</i>foo||bar
14084 </td></tr></tbody></table>
14085
14086 !! end
14087
14088 !! test
14089 Tables: 2c. Nested in td -- no escaping needed
14090 !! options
14091 parsoid
14092 !! input
14093 {|
14094 |foo!!bar
14095 |}
14096 !! result
14097 <table><tbody>
14098 <tr><td>foo!!bar
14099 </td></tr></tbody></table>
14100
14101 !! end
14102
14103 !! test
14104 Tables: 3a. Nested in th
14105 !! options
14106 parsoid
14107 !! input
14108 {|
14109 !foo!bar
14110 |}
14111 !! result
14112 <table><tbody>
14113 <tr><th>foo!bar
14114 </th></tr></tbody></table>
14115
14116 !! end
14117
14118 !! test
14119 Tables: 3b. Nested in th
14120 !! options
14121 parsoid
14122 !! input
14123 {|
14124 !<nowiki>foo!!bar</nowiki>
14125 |}
14126 !! result
14127 <table><tbody>
14128 <tr><th>foo!!bar
14129 </th></tr></tbody></table>
14130
14131 !! end
14132
14133 !! test
14134 Tables: 3c. Nested in th -- no escaping needed
14135 !! options
14136 parsoid
14137 !! input
14138 {|
14139 !<nowiki>foo||bar</nowiki>
14140 |}
14141 !! result
14142 <table><tbody>
14143 <tr><th>foo||bar
14144 </th></tr></tbody></table>
14145
14146 !! end
14147
14148 !! test
14149 Tables: 4a. Escape -
14150 !! options
14151 parsoid
14152 !! input
14153 {|
14154 |-
14155 !-bar
14156 |-
14157 |<nowiki>-bar</nowiki>
14158 |}
14159 !! result
14160 <table><tbody>
14161 <tr><th>-bar</th></tr>
14162 <tr><td>-bar</td></tr>
14163 </tbody></table>
14164 !! end
14165
14166 !! test
14167 Tables: 4b. Escape +
14168 !! options
14169 parsoid
14170 !! input
14171 {|
14172 |-
14173 !+bar
14174 |-
14175 |<nowiki>+bar</nowiki>
14176 |}
14177 !! result
14178 <table><tbody>
14179 <tr><th>+bar</th></tr>
14180 <tr><td>+bar</td></tr>
14181 </tbody></table>
14182 !! end
14183
14184 !! test
14185 Tables: 4c. No escaping needed
14186 !! options
14187 parsoid
14188 !! input
14189 {|
14190 |-
14191 |foo-bar
14192 |foo+bar
14193 |-
14194 |''foo''-bar
14195 |''foo''+bar
14196 |}
14197 !! result
14198 <table><tbody>
14199 <tr><td>foo-bar</td><td>foo+bar</td></tr>
14200 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
14201 </tbody></table>
14202 !! end
14203
14204 ### SSS FIXME: Disabled right now because accurate html2wt
14205 ### on this snippet requires data-parsoid flags that we've
14206 ### stripped out of these tests. We should scheme how we
14207 ### we want to handle these kind of tests that require
14208 ### data-parsoid flags for accurate html2wt serialization
14209
14210 !! test
14211 Tables: 4d. No escaping needed
14212 !! options
14213 disabled
14214 !! input
14215 {|
14216 ||+1
14217 ||-2
14218 |}
14219 !! result
14220 <table>
14221 <tr>
14222 <td>+1
14223 </td>
14224 <td>-2
14225 </td></tr></table>
14226
14227 !! end
14228
14229 #### --------------- Links ---------------
14230 #### 1. Quote marks in link text
14231 #### 2. Wikilinks: Escapes needed
14232 #### 3. Wikilinks: No escapes needed
14233 #### 4. Extlinks: Escapes needed
14234 #### 5. Extlinks: No escapes needed
14235 #### --------------------------------------
14236 !! test
14237 Links 1. Quote marks in link text
14238 !! options
14239 parsoid
14240 !! input
14241 [[Foo|<nowiki>Foo''boo''</nowiki>]]
14242 !! result
14243 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
14244 !! end
14245
14246 !! test
14247 Links 2. WikiLinks: Escapes needed
14248 !! options
14249 parsoid
14250 !! input
14251 [[Foo|<nowiki>[Foobar]</nowiki>]]
14252 [[Foo|<nowiki>Foobar]</nowiki>]]
14253 [[Foo|x [Foobar] x]]
14254 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
14255 [[Foo|<nowiki>[[Bar]]</nowiki>]]
14256 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
14257 [[Foo|<nowiki>|Bar</nowiki>]]
14258 [[Foo|<nowiki>]]bar</nowiki>]]
14259 [[Foo|<nowiki>[[bar</nowiki>]]
14260 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
14261 !! result
14262 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
14263 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
14264 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
14265 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
14266 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
14267 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
14268 <a href="Foo" rel="mw:WikiLink">|Bar</a>
14269 <a href="Foo" rel="mw:WikiLink">]]bar</a>
14270 <a href="Foo" rel="mw:WikiLink">[[bar</a>
14271 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
14272 !! end
14273
14274 !! test
14275 Links 3. WikiLinks: No escapes needed
14276 !! options
14277 parsoid
14278 !! input
14279 [[Foo|[Foobar]]
14280 [[Foo|foo|bar]]
14281 !! result
14282 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
14283 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
14284 !! end
14285
14286 !! test
14287 Links 4. ExtLinks: Escapes needed
14288 !! options
14289 parsoid
14290 !! input
14291 [http://google.com <nowiki>[google]</nowiki>]
14292 [http://google.com <nowiki>google]</nowiki>]
14293 !! result
14294 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
14295 <a href="http://google.com" rel="mw:ExtLink">google]</a>
14296 !! end
14297
14298 !! test
14299 Links 5. ExtLinks: No escapes needed
14300 !! options
14301 parsoid
14302 !! input
14303 [http://google.com [google]
14304 !! result
14305 <a href="http://google.com" rel="mw:ExtLink">[google</a>
14306 !! end
14307
14308 #### --------------- Quotes ---------------
14309 #### 1. Quotes inside <b> and <i>
14310 #### 2. Link fragments separated by <i> and <b> tags
14311 #### 3. Link fragments inside <i> and <b>
14312 #### --------------------------------------
14313 !! test
14314 1. Quotes inside <b> and <i>
14315 !! input
14316 ''<nowiki>'foo'</nowiki>''
14317 ''<nowiki>''foo''</nowiki>''
14318 ''<nowiki>'''foo'''</nowiki>''
14319 '''<nowiki>'foo'</nowiki>'''
14320 '''<nowiki>''foo''</nowiki>'''
14321 '''<nowiki>'''foo'''</nowiki>'''
14322 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
14323 !! result
14324 <p><i>'foo'</i>
14325 <i>''foo''</i>
14326 <i>'''foo'''</i>
14327 <b>'foo'</b>
14328 <b>''foo''</b>
14329 <b>'''foo'''</b>
14330 <b>foo'<i>bar'</i>baz</b>
14331 </p>
14332 !! end
14333
14334 !! test
14335 2. Link fragments separated by <i> and <b> tags
14336 !! input
14337 [[''foo''<nowiki>hello]]</nowiki>
14338
14339 [['''foo'''<nowiki>hello]]</nowiki>
14340 !! result
14341 <p>[[<i>foo</i>hello]]
14342 </p><p>[[<b>foo</b>hello]]
14343 </p>
14344 !! end
14345
14346 !! test
14347 2. Link fragments inside <i> and <b>
14348 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
14349 this is one of the shortcomings of this format)
14350 !! input
14351 ''[[foo''<nowiki>]]</nowiki>
14352
14353 '''[[foo'''<nowiki>]]</nowiki>
14354 !! result
14355 <p><i>[[foo</i>]]
14356 </p><p><b>[[foo</b>]]
14357 </p>
14358 !! end
14359
14360 #### --------------- Paragraphs ---------------
14361 #### 1. No unnecessary escapes
14362 #### --------------------------------------
14363
14364 !! test
14365 1. No unnecessary escapes
14366 !! input
14367 bar <span><nowiki>[[foo]]</nowiki></span>
14368
14369 =bar <span><nowiki>[[foo]]</nowiki></span>
14370
14371 [[bar <span><nowiki>[[foo]]</nowiki></span>
14372
14373 ]]bar <span><nowiki>[[foo]]</nowiki></span>
14374
14375 =bar <span>foo]]</span><nowiki>=</nowiki>
14376 !! result
14377 <p>bar <span>[[foo]]</span>
14378 </p><p>=bar <span>[[foo]]</span>
14379 </p><p>[[bar <span>[[foo]]</span>
14380 </p><p>]]bar <span>[[foo]]</span>
14381 </p><p>=bar <span>foo]]</span>=
14382 </p>
14383 !!end
14384
14385 #### --------------- PRE ------------------
14386 #### 1. Leading space in SOL context should be escaped
14387 #### --------------------------------------
14388 !! test
14389 1. Leading space in SOL context should be escaped
14390 !! options
14391 parsoid
14392 !! input
14393 <nowiki> foo</nowiki>
14394 <!--cmt--><nowiki> foo</nowiki>
14395 !! result
14396 <p> foo
14397 <!--cmt--> foo
14398 </p>
14399 !! end
14400
14401 #### --------------- HTML tags ---------------
14402 #### 1. a tags
14403 #### 2. other tags
14404 #### 3. multi-line html tag
14405 #### --------------------------------------
14406 !! test
14407 1. a tags
14408 !! options
14409 parsoid
14410 !! input
14411 <a href="http://google.com">google</a>
14412 !! result
14413 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
14414 !! end
14415
14416 !! test
14417 2. other tags
14418 !! input
14419 <nowiki><div>foo</div>
14420 <div style="color:red">foo</div></nowiki>
14421 !! result
14422 <p>&lt;div&gt;foo&lt;/div&gt;
14423 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
14424 </p>
14425 !! end
14426
14427 !! test
14428 3. multi-line html tag
14429 !! input
14430 <nowiki><div
14431 >foo</div
14432 ></nowiki>
14433 !! result
14434 <p>&lt;div
14435 &gt;foo&lt;/div
14436 &gt;
14437 </p>
14438 !! end
14439
14440 #### --------------- Others ---------------
14441 !! test
14442 Escaping nowikis
14443 !! input
14444 &lt;nowiki&gt;foo&lt;/nowiki&gt;
14445 !! result
14446 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
14447 </p>
14448 !! end
14449 !! test
14450
14451 Tag-like HTML structures are passed through as text
14452 !! input
14453 <x y>
14454
14455 <x.y>
14456
14457 <x-y>
14458
14459 1>2
14460
14461 x<y
14462
14463 a>b
14464
14465 1<d e>f
14466 !! result
14467 <p>&lt;x y&gt;
14468 </p><p>&lt;x.y&gt;
14469 </p><p>&lt;x-y&gt;
14470 </p><p>1&gt;2
14471 </p><p>x&lt;y
14472 </p><p>a&gt;b
14473 </p><p>1&lt;d e&gt;f
14474 </p>
14475 !! end
14476
14477
14478 # This fails in the PHP parser (see bug 40670,
14479 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
14480 !! test
14481 Tag names followed by punctuation should not be recognized as tags
14482 !! options
14483 parsoid
14484 !! input
14485 <s.ome> text
14486 !! result
14487 <p>&lt;s.ome&gt; text
14488 </p>
14489 !! end
14490
14491 !! test
14492 HTML tag with necessary entities in attributes
14493 !! input
14494 <span title="&amp;amp;">foo</span>
14495 !! result
14496 <p><span title="&amp;amp;">foo</span>
14497 </p>
14498 !! end
14499
14500 !! test
14501 HTML tag with 'unnecessary' entity encoding in attributes
14502 !! input
14503 <span title="&amp;">foo</span>
14504 !! result
14505 <p><span title="&amp;">foo</span>
14506 </p>
14507 !! end
14508
14509 !! test
14510 HTML tag with broken attribute value quoting
14511 !! input
14512 <span title="Hello world>Foo</span>
14513 !! result
14514 <p><span>Foo</span>
14515 </p>
14516 !! end
14517
14518 !! test
14519 Parsoid-only: HTML tag with broken attribute value quoting
14520 !! options
14521 parsoid
14522 !! input
14523 <span title="Hello world>Foo</span>
14524 !! result
14525 <p><span title="Hello world">Foo</span>
14526 </p>
14527 !! end
14528
14529 !! test
14530 Table with broken attribute value quoting
14531 !! input
14532 {|
14533 | title="Hello world|Foo
14534 |}
14535 !! result
14536 <table>
14537 <tr>
14538 <td>Foo
14539 </td></tr></table>
14540
14541 !! end
14542
14543 !! test
14544 Table with broken attribute value quoting on consecutive lines
14545 !! input
14546 {|
14547 | title="Hello world|Foo
14548 | style="color:red|Bar
14549 |}
14550 !! result
14551 <table>
14552 <tr>
14553 <td>Foo
14554 </td>
14555 <td>Bar
14556 </td></tr></table>
14557
14558 !! end
14559
14560 !! test
14561 Parsoid-only: Table with broken attribute value quoting on consecutive lines
14562 !! options
14563 parsoid
14564 !! input
14565 {|
14566 | title="Hello world|Foo
14567 | style="color:red|Bar
14568 |}
14569 !! result
14570 <table><tbody>
14571 <tr>
14572 <td title="Hello world">Foo
14573 </td><td style="color: red">Bar
14574 </td></tr></tbody></table>
14575
14576 !! end
14577
14578 !! test
14579 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
14580 !! options
14581 parsoid
14582 !! input
14583 {{}}
14584 !! result
14585 {{}}
14586 !! end
14587
14588 !! test
14589 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
14590 !! options
14591 parsoid
14592 !! input
14593 }}{{
14594 !! result
14595 }}{{
14596 !! end
14597
14598 !!test
14599 Accept empty td cell attribute
14600 !!input
14601 {|
14602 | align="center" | foo || |
14603 |}
14604 !!result
14605 <table>
14606 <tr>
14607 <td align="center"> foo </td>
14608 <td>
14609 </td></tr></table>
14610
14611 !!end
14612
14613 !!test
14614 Non-empty attributes in th-cells
14615 !!input
14616 {|
14617 ! Foo !! style="color: red" | Bar
14618 |}
14619 !!result
14620 <table>
14621 <tr>
14622 <th> Foo </th>
14623 <th style="color: red"> Bar
14624 </th></tr></table>
14625
14626 !!end
14627
14628 !!test
14629 Accept empty attributes in th-cells
14630 !!input
14631 {|
14632 !| foo !!| bar
14633 |}
14634 !!result
14635 <table>
14636 <tr>
14637 <th> foo </th>
14638 <th> bar
14639 </th></tr></table>
14640
14641 !!end
14642
14643 !!test
14644 Empty table rows go away
14645 !!input
14646 {|
14647 | Hello
14648 | there
14649 |- class="foo"
14650 |-
14651 |}
14652 !! result
14653 <table>
14654 <tr>
14655 <td> Hello
14656 </td>
14657 <td> there
14658 </td></tr>
14659
14660 </table>
14661
14662 !! end
14663
14664 ###
14665 ### Parsoid-centric tests for testing RTing of inter-element separators
14666 ### Edge cases not tested by existing parser tests and specific to
14667 ### Parsoid-specific serialization strategies.
14668 ###
14669
14670 !!test
14671 RT-ed inter-element separators should be valid separators
14672 !!input
14673 {|
14674 |- [[foo]]
14675 |}
14676 !!result
14677 <table>
14678
14679 </table>
14680
14681 !!end
14682
14683 !!test
14684 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
14685 (Parsoid-only since PHP parser relies on Tidy for correct output)
14686 !!options
14687 parsoid
14688 !!input
14689 {|
14690 |<small>foo
14691 bar
14692 |}
14693
14694 {|
14695 |<small>foo<small>
14696 |}
14697 !!result
14698 !!end
14699
14700 !!test
14701 Empty TD followed by TD with tpl-generated attribute
14702 !!input
14703 {|
14704 |-
14705 |
14706 |{{echo|style='color:red'}}|foo
14707 |}
14708 !!result
14709 <table>
14710
14711 <tr>
14712 <td>
14713 </td>
14714 <td>foo
14715 </td></tr></table>
14716
14717 !!end
14718
14719 !!test
14720 Indented table with an empty td
14721 !!input
14722 {|
14723 |-
14724 |
14725 |foo
14726 |}
14727 !!result
14728 <table>
14729
14730 <tr>
14731 <td>
14732 </td>
14733 <td>foo
14734 </td></tr></table>
14735
14736 !!end
14737
14738 !!test
14739 Empty TR followed by a template-generated TR
14740 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
14741 !!options
14742 parsoid
14743 !!input
14744 {|
14745 |-
14746 {{echo|<tr><td>foo</td></tr>}}
14747 |}
14748 !!result
14749 <table>
14750 <tbody>
14751 <tr>
14752 </tr>
14753 <tr>
14754 <td>foo</td></tr></tbody></table>
14755 !!end
14756
14757 ## PHP and parsoid output differ for this, and since this is primarily
14758 ## for testing Parsoid's serializer, marking this Parsoid only
14759 !!test
14760 Empty TR followed by mixed-ws-comment line should RT correctly
14761 !!options
14762 parsoid
14763 !!input
14764 {|
14765 |-
14766 <!--c-->
14767 |-
14768 <!--c--> <!--d-->
14769 |}
14770 !!result
14771 <table>
14772 <tbody>
14773 <tr>
14774 <td> <!--c--></td></tr>
14775 <tr>
14776 <td><!--c--> <!--d--></td></tr>
14777 </tbody></table>
14778
14779 !!end
14780
14781 !!test
14782 Multi-line image caption generated by templates with/without trailing newlines
14783 !!options
14784 parsoid
14785 !!input
14786 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
14787 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
14788 !!result
14789 <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>
14790 <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>
14791
14792 !!end
14793
14794 ## PHP emits broken html for this, and since this is primarily
14795 ## a Parsoid serializer test, marking this Parsoid only
14796 !!test
14797 Improperly nested inline or quotes tags with whitespace in between
14798 !!options
14799 parsoid
14800 !!input
14801 <span> <s>x</span> </s>
14802 ''' ''x''' ''
14803 !!result
14804 <p><span> <s>x</s></span><s> </s>
14805 <b> <i>x</i></b><i> </i>
14806 </p>
14807 !!end
14808
14809 TODO:
14810 more images
14811 more tables
14812 character entities
14813 and much more
14814 Try for 100% code coverage