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