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