skin: Convert table of contents from <table> to <div>
[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 Extra newlines: More paragraphs with indented comment
308 !! input
309 a
310
311 <!--boo-->
312
313 b
314 !!result
315 <p>a
316 </p><p><br />
317 b
318 </p>
319 !!end
320
321 !! test
322 Extra newlines followed by heading
323 !! input
324 a
325
326
327
328 =b=
329 [[a]]
330
331
332 =b=
333 !! result
334 <p>a
335 </p><p><br />
336 </p>
337 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a>]</span></h1>
338 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
339 </p><p><br />
340 </p>
341 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a>]</span></h1>
342
343 !! end
344
345 !! test
346 Extra newlines between heading and content are swallowed
347 !! input
348 =b=
349
350
351
352 [[a]]
353 !! result
354 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a>]</span></h1>
355 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
356 </p>
357 !! end
358
359 !! test
360 Parsing an URL
361 !! input
362 http://fr.wikipedia.org/wiki/🍺
363 <!-- EasterEgg we love beer, better be able be able to link to it -->
364 !! result
365 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
366 </p>
367 !! end
368
369 !! test
370 Simple list
371 !! input
372 * Item 1
373 * Item 2
374 !! result
375 <ul><li> Item 1
376 </li><li> Item 2
377 </li></ul>
378
379 !! end
380
381 !! test
382 Italics and bold
383 !! input
384 * plain
385 * plain''italic''plain
386 * plain''italic''plain''italic''plain
387 * plain'''bold'''plain
388 * plain'''bold'''plain'''bold'''plain
389 * plain''italic''plain'''bold'''plain
390 * plain'''bold'''plain''italic''plain
391 * plain''italic'''bold-italic'''italic''plain
392 * plain'''bold''bold-italic''bold'''plain
393 * plain'''''bold-italic'''italic''plain
394 * plain'''''bold-italic''bold'''plain
395 * plain''italic'''bold-italic'''''plain
396 * plain'''bold''bold-italic'''''plain
397 * plain l'''italic''plain
398 * plain l''''bold''' plain
399 !! result
400 <ul><li> plain
401 </li><li> plain<i>italic</i>plain
402 </li><li> plain<i>italic</i>plain<i>italic</i>plain
403 </li><li> plain<b>bold</b>plain
404 </li><li> plain<b>bold</b>plain<b>bold</b>plain
405 </li><li> plain<i>italic</i>plain<b>bold</b>plain
406 </li><li> plain<b>bold</b>plain<i>italic</i>plain
407 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
408 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
409 </li><li> plain<i><b>bold-italic</b>italic</i>plain
410 </li><li> plain<b><i>bold-italic</i>bold</b>plain
411 </li><li> plain<i>italic<b>bold-italic</b></i>plain
412 </li><li> plain<b>bold<i>bold-italic</i></b>plain
413 </li><li> plain l'<i>italic</i>plain
414 </li><li> plain l'<b>bold</b> plain
415 </li></ul>
416
417 !! end
418
419 # this example taken from the simple/Moon article
420 !! test
421 Italics and possessives
422 !! input
423 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
424 !! result
425 <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
426 </p>
427 !! end
428
429 ###
430 ### 2-quote opening sequence tests
431 ###
432 !! test
433 Italics and bold: 2-quote opening sequence: (2,2)
434 !! input
435 ''foo''
436 !! result
437 <p><i>foo</i>
438 </p>
439 !!end
440
441
442 !! test
443 Italics and bold: 2-quote opening sequence: (2,3)
444 !! input
445 ''foo'''
446 !! result
447 <p><i>foo'</i>
448 </p>
449 !!end
450
451
452 !! test
453 Italics and bold: 2-quote opening sequence: (2,4)
454 !! input
455 ''foo''''
456 !! result
457 <p><i>foo''</i>
458 </p>
459 !!end
460
461
462 !! test
463 Italics and bold: 2-quote opening sequence: (2,5) (php)
464 !! options
465 php
466 !! input
467 ''foo'''''
468 !! result
469 <p><i>foo</i>
470 </p>
471 !!end
472 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
473 !! test
474 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
475 !! options
476 parsoid
477 !! input
478 ''foo'''''
479 !! result
480 <p><i>foo</i><b></b>
481 </p>
482 !!end
483
484
485 ###
486 ### 3-quote opening sequence tests
487 ###
488
489 !! test
490 Italics and bold: 3-quote opening sequence: (3,2)
491 !! input
492 '''foo''
493 !! result
494 <p>'<i>foo</i>
495 </p>
496 !!end
497
498
499 !! test
500 Italics and bold: 3-quote opening sequence: (3,3)
501 !! input
502 '''foo'''
503 !! result
504 <p><b>foo</b>
505 </p>
506 !!end
507
508
509 !! test
510 Italics and bold: 3-quote opening sequence: (3,4)
511 !! input
512 '''foo''''
513 !! result
514 <p><b>foo'</b>
515 </p>
516 !!end
517
518
519 !! test
520 Italics and bold: 3-quote opening sequence: (3,5) (php)
521 !! options
522 php
523 !! input
524 '''foo'''''
525 !! result
526 <p><b>foo</b>
527 </p>
528 !!end
529 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
530 !! test
531 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
532 !! options
533 parsoid
534 !! input
535 '''foo'''''
536 !! result
537 <p><b>foo<i></i></b>
538 </p>
539 !!end
540
541
542 ###
543 ### 4-quote opening sequence tests
544 ###
545
546 !! test
547 Italics and bold: 4-quote opening sequence: (4,2)
548 !! input
549 ''''foo''
550 !! result
551 <p>''<i>foo</i>
552 </p>
553 !!end
554
555
556 !! test
557 Italics and bold: 4-quote opening sequence: (4,3)
558 !! input
559 ''''foo'''
560 !! result
561 <p>'<b>foo</b>
562 </p>
563 !!end
564
565
566 !! test
567 Italics and bold: 4-quote opening sequence: (4,4)
568 !! input
569 ''''foo''''
570 !! result
571 <p>'<b>foo'</b>
572 </p>
573 !!end
574
575
576 !! test
577 Italics and bold: 4-quote opening sequence: (4,5) (php)
578 !! options
579 php
580 !! input
581 ''''foo'''''
582 !! result
583 <p>'<b>foo</b>
584 </p>
585 !!end
586 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
587 !! test
588 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
589 !! options
590 parsoid
591 !! input
592 ''''foo'''''
593 !! result
594 <p>'<b>foo<i></i></b>
595 </p>
596 !!end
597
598
599 ###
600 ### 5-quote opening sequence tests
601 ###
602
603 !! test
604 Italics and bold: 5-quote opening sequence: (5,2) (php)
605 !! options
606 php
607 !! input
608 '''''foo''
609 !! result
610 <p><b><i>foo</i></b>
611 </p>
612 !!end
613 # Parsoid reverses the nesting order, compared to the PHP parser
614 !! test
615 Italics and bold: 5-quote opening sequence: (5,2) (parsoid)
616 !! options
617 parsoid
618 !! input
619 '''''foo''
620 !! result
621 <p><i><b>foo</b></i>
622 </p>
623 !!end
624
625
626 !! test
627 Italics and bold: 5-quote opening sequence: (5,3)
628 !! input
629 '''''foo'''
630 !! result
631 <p><i><b>foo</b></i>
632 </p>
633 !!end
634
635
636 !! test
637 Italics and bold: 5-quote opening sequence: (5,4)
638 !! input
639 '''''foo''''
640 !! result
641 <p><i><b>foo'</b></i>
642 </p>
643 !!end
644
645
646 !! test
647 Italics and bold: 5-quote opening sequence: (5,5)
648 !! input
649 '''''foo'''''
650 !! result
651 <p><i><b>foo</b></i>
652 </p>
653 !!end
654
655 ###
656 ### multiple quote sequences in a line
657 ###
658 !! test
659 Italics and bold: multiple quote sequences: (2,4,2)
660 !! input
661 ''foo''''bar''
662 !! result
663 <p><i>foo'<b>bar</b></i>
664 </p>
665 !!end
666
667
668 !! test
669 Italics and bold: multiple quote sequences: (2,4,3)
670 !! input
671 ''foo''''bar'''
672 !! result
673 <p><i>foo'<b>bar</b></i>
674 </p>
675 !!end
676
677
678 !! test
679 Italics and bold: multiple quote sequences: (2,4,4)
680 !! input
681 ''foo''''bar''''
682 !! result
683 <p><i>foo'<b>bar'</b></i>
684 </p>
685 !!end
686
687
688 !! test
689 Italics and bold: multiple quote sequences: (3,4,2) (php)
690 !! options
691 php
692 !! input
693 '''foo''''bar''
694 !! result
695 <p><b>foo'</b>bar
696 </p>
697 !!end
698 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
699 !! test
700 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
701 !! options
702 parsoid
703 !! input
704 '''foo''''bar''
705 !! result
706 <p><b>foo'</b>bar<i></i>
707 </p>
708 !!end
709
710
711 !! test
712 Italics and bold: multiple quote sequences: (3,4,3) (php)
713 !! options
714 php
715 !! input
716 '''foo''''bar'''
717 !! result
718 <p><b>foo'</b>bar
719 </p>
720 !!end
721 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
722 !! test
723 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
724 !! options
725 parsoid
726 !! input
727 '''foo''''bar'''
728 !! result
729 <p><b>foo'</b>bar<b></b>
730 </p>
731 !!end
732
733 ###
734 ### other quote tests
735 ###
736 !! test
737 Italics and bold: other quote tests: (2,3,5)
738 !! input
739 ''this is about '''foo's family'''''
740 !! result
741 <p><i>this is about <b>foo's family</b></i>
742 </p>
743 !!end
744
745
746 !! test
747 Italics and bold: other quote tests: (2,(3,3),2)
748 !! input
749 ''this is about '''foo's''' family''
750 !! result
751 <p><i>this is about <b>foo's</b> family</i>
752 </p>
753 !!end
754
755
756 !! test
757 Italics and bold: other quote tests: (3,2,3,2)
758 !! input
759 '''this is about ''foo'''s family''
760 !! result
761 <p><b>this is about <i>foo</i></b><i>s family</i>
762 </p>
763 !!end
764
765
766 # The Parsoid team believes the PHP parser's output on this test is wrong.
767 # It only checks for convert-to-bold-on-single-character-word when the word
768 # matches with a bold tag ("'''") that is *odd* in the list of quote tokens.
769 # This means that the bold token in position 2 (0-indexed) gets converted by
770 # parsoid, but doesn't get changed by the PHP parser.
771 !! test
772 Italics and bold: other quote tests: (3,2,3,3) (php)
773 !! options
774 php
775 !! input
776 '''this is about ''foo'''s family'''
777 !! result
778 <p>'<i>this is about </i>foo<b>s family</b>
779 </p>
780 !!end
781 # This is the output the Parsoid team believes to be correct.
782 !! test
783 Italics and bold: other quote tests: (3,2,3,3) (parsoid)
784 !! options
785 parsoid
786 !! input
787 '''this is about ''foo'''s family'''
788 !! result
789 <p><b>this is about <i>foo'</i>s family</b>
790 </p>
791 !!end
792
793
794 !! test
795 Italics and bold: other quote tests: (3,(2,2),3)
796 !! input
797 '''this is about ''foo's'' family'''
798 !! result
799 <p><b>this is about <i>foo's</i> family</b>
800 </p>
801 !!end
802
803
804 !! test
805 Italicized possessive
806 !! input
807 The ''[[Main Page]]'''s talk page.
808 !! result
809 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
810 </p>
811 !! end
812
813 ###
814 ### Non-html5 tags
815 ###
816
817 !! test
818 Non-html5 tags should be accepted
819 !! input
820 <center>''foo''</center>
821 <big>''foo''</big>
822 <font>''foo''</font>
823 <strike>''foo''</strike>
824 <tt>''foo''</tt>
825 !! result
826 <center><i>foo</i></center>
827 <p><big><i>foo</i></big>
828 <font><i>foo</i></font>
829 <strike><i>foo</i></strike>
830 <tt><i>foo</i></tt>
831 </p>
832 !! end
833
834 ###
835 ### <nowiki> test cases
836 ###
837
838 !! test
839 <nowiki> unordered list
840 !! input
841 <nowiki>* This is not an unordered list item.</nowiki>
842 !! result
843 <p>* This is not an unordered list item.
844 </p>
845 !! end
846
847 !! test
848 <nowiki> spacing
849 !! input
850 <nowiki>Lorem ipsum dolor
851
852 sed abit.
853 sed nullum.
854
855 :and a colon
856 </nowiki>
857 !! result
858 <p>Lorem ipsum dolor
859
860 sed abit.
861 sed nullum.
862
863 :and a colon
864
865 </p>
866 !! end
867
868 !! test
869 nowiki 3
870 !! input
871 :There is not nowiki.
872 :There is <nowiki>nowiki</nowiki>.
873
874 #There is not nowiki.
875 #There is <nowiki>nowiki</nowiki>.
876
877 *There is not nowiki.
878 *There is <nowiki>nowiki</nowiki>.
879 !! result
880 <dl><dd>There is not nowiki.
881 </dd><dd>There is nowiki.
882 </dd></dl>
883 <ol><li>There is not nowiki.
884 </li><li>There is nowiki.
885 </li></ol>
886 <ul><li>There is not nowiki.
887 </li><li>There is nowiki.
888 </li></ul>
889
890 !! end
891
892 !! test
893 Entities inside <nowiki>
894 !! input
895 <nowiki>&lt;</nowiki>
896 !! result
897 <p>&lt;
898 </p>
899 !! end
900
901
902 ###
903 ### Comments
904 ###
905 !! test
906 Comments and Indent-Pre
907 !! input
908 <!-- comment 1 --> asdf
909
910 <!-- comment 1 --> asdf
911 <!-- comment 2 -->
912
913 <!-- comment 1 --> asdf
914 <!-- comment 2 -->xyz
915
916 <!-- comment 1 --> asdf
917 <!-- comment 2 --> xyz
918 !! result
919 <pre>asdf
920 </pre>
921 <pre>asdf
922 </pre>
923 <pre>asdf
924 </pre>
925 <p>xyz
926 </p>
927 <pre>asdf
928 xyz
929 </pre>
930 !! end
931
932 !! test
933 Comment test 2a
934 !! input
935 asdf
936 <!-- comment 1 -->
937 jkl
938 !! result
939 <p>asdf
940 jkl
941 </p>
942 !! end
943
944 !! test
945 Comment test 2b
946 !! input
947 asdf
948 <!-- comment 1 -->
949
950 jkl
951 !! result
952 <p>asdf
953 </p><p>jkl
954 </p>
955 !! end
956
957 !! test
958 Comment test 3
959 !! input
960 asdf
961 <!-- comment 1 -->
962 <!-- comment 2 -->
963 jkl
964 !! result
965 <p>asdf
966 jkl
967 </p>
968 !! end
969
970 !! test
971 Comment test 4
972 !! input
973 asdf<!-- comment 1 -->jkl
974 !! result
975 <p>asdfjkl
976 </p>
977 !! end
978
979 !! test
980 Comment spacing
981 !! input
982 a
983 <!-- foo --> b <!-- bar -->
984 c
985 !! result
986 <p>a
987 </p>
988 <pre> b
989 </pre>
990 <p>c
991 </p>
992 !! end
993
994 !! test
995 Comment whitespace
996 !! input
997 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
998 !! result
999
1000 !! end
1001
1002 !! test
1003 Comment semantics and delimiters
1004 !! input
1005 <!-- --><!----><!-----><!------>
1006 !! result
1007
1008 !! end
1009
1010 !! test
1011 Comment semantics and delimiters, redux
1012 !! input
1013 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1014 -- foo -- funky huh? ... -->
1015 !! result
1016
1017 !! end
1018
1019 !! test
1020 Comment semantics and delimiters: directors cut
1021 !! input
1022 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1023 everything starting with < followed by !-- until the first -- and > we see,
1024 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1025 -->-->
1026 !! result
1027 <p>--&gt;
1028 </p>
1029 !! end
1030
1031 !! test
1032 Comment semantics: nesting
1033 !! input
1034 <!--<!-- no, we're not going to do anything fancy here -->-->
1035 !! result
1036 <p>--&gt;
1037 </p>
1038 !! end
1039
1040 !! test
1041 Comment semantics: unclosed comment at end
1042 !! input
1043 <!--This comment will run out to the end of the document
1044 !! result
1045
1046 !! end
1047
1048 !! test
1049 Comment in template title
1050 !! input
1051 {{f<!---->oo}}
1052 !! result
1053 <p>FOO
1054 </p>
1055 !! end
1056
1057 !! test
1058 Comment on its own line post-expand
1059 !! input
1060 a
1061 {{blank}}<!---->
1062 b
1063 !! result
1064 <p>a
1065 </p><p>b
1066 </p>
1067 !! end
1068
1069 !! test
1070 Comment on its own line post-expand with non-significant whitespace
1071 !! input
1072 a
1073 {{blank}} <!---->
1074 b
1075 !! result
1076 <p>a
1077 </p><p>b
1078 </p>
1079 !! end
1080
1081 ###
1082 ### paragraph wraping tests
1083 ###
1084 !! test
1085 No block tags
1086 !! input
1087 a
1088
1089 b
1090 !! result
1091 <p>a
1092 </p><p>b
1093 </p>
1094 !! end
1095 !! test
1096 Block tag on one line
1097 !! input
1098 a <div>foo</div>
1099
1100 b
1101 !! result
1102 a <div>foo</div>
1103 <p>b
1104 </p>
1105 !! end
1106
1107 !! test
1108 Block tag on both lines
1109 !! input
1110 a <div>foo</div>
1111
1112 b <div>foo</div>
1113 !! result
1114 a <div>foo</div>
1115 b <div>foo</div>
1116
1117 !! end
1118
1119 !! test
1120 Multiple lines without block tags
1121 !! input
1122 <div>foo</div> a
1123 b
1124 c
1125 d<!--foo--> e
1126 x <div>foo</div> z
1127 !! result
1128 <div>foo</div> a
1129 <p>b
1130 c
1131 d e
1132 </p>
1133 x <div>foo</div> z
1134
1135 !! end
1136
1137 !! test
1138 Empty lines between lines with block tags
1139 !! input
1140 <div></div>
1141
1142
1143 <div></div>a
1144
1145 b
1146 <div>a</div>b
1147
1148 <div>b</div>d
1149
1150
1151 <div>e</div>
1152 !! result
1153 <div></div>
1154 <p><br />
1155 </p>
1156 <div></div>a
1157 <p>b
1158 </p>
1159 <div>a</div>b
1160 <div>b</div>d
1161 <p><br />
1162 </p>
1163 <div>e</div>
1164
1165 !! end
1166
1167 ###
1168 ### Preformatted text
1169 ###
1170 !! test
1171 Preformatted text
1172 !! input
1173 This is some
1174 Preformatted text
1175 With ''italic''
1176 And '''bold'''
1177 And a [[Main Page|link]]
1178 !! result
1179 <pre>This is some
1180 Preformatted text
1181 With <i>italic</i>
1182 And <b>bold</b>
1183 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1184 </pre>
1185 !! end
1186
1187 !! test
1188 Ident preformatting with inline content
1189 !! input
1190 a
1191 ''b''
1192 !! result
1193 <pre>a
1194 <i>b</i>
1195 </pre>
1196 !! end
1197
1198 !! test
1199 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1200 !! input
1201 <pre><nowiki>
1202 <b>
1203 <cite>
1204 <em>
1205 </nowiki></pre>
1206 !! result
1207 <pre>
1208 &lt;b&gt;
1209 &lt;cite&gt;
1210 &lt;em&gt;
1211 </pre>
1212
1213 !! end
1214
1215 !! test
1216 Regression with preformatted in <center>
1217 !! input
1218 <center>
1219 Blah
1220 </center>
1221 !! result
1222 <center>
1223 <pre>Blah
1224 </pre>
1225 </center>
1226
1227 !! end
1228
1229 # Expected output in the following test is not really expected (there should be
1230 # <pre> in the output) -- it's only testing for well-formedness.
1231 !! test
1232 Bug 6200: Preformatted in <blockquote>
1233 !! input
1234 <blockquote>
1235 Blah
1236 </blockquote>
1237 !! result
1238 <blockquote>
1239 Blah
1240 </blockquote>
1241
1242 !! end
1243
1244 !! test
1245 <pre> with attributes (bug 3202)
1246 !! input
1247 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1248 !! result
1249 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1250
1251 !! end
1252
1253 !! test
1254 <pre> with width attribute (bug 3202)
1255 !! input
1256 <pre width="8">Narrow screen goodies</pre>
1257 !! result
1258 <pre width="8">Narrow screen goodies</pre>
1259
1260 !! end
1261
1262 !! test
1263 <pre> with forbidden attribute (bug 3202)
1264 !! input
1265 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1266 !! result
1267 <pre width="8">Narrow screen goodies</pre>
1268
1269 !! end
1270
1271 !! test
1272 Entities inside <pre>
1273 !! input
1274 <pre>&lt;</pre>
1275 !! result
1276 <pre>&lt;</pre>
1277
1278 !! end
1279
1280 !! test
1281 <pre> with forbidden attribute values (bug 3202)
1282 !! input
1283 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1284 !! result
1285 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1286
1287 !! end
1288
1289 !! test
1290 <nowiki> inside <pre> (bug 13238)
1291 !! input
1292 <pre>
1293 <nowiki>
1294 </pre>
1295 <pre>
1296 <nowiki></nowiki>
1297 </pre>
1298 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1299 !! result
1300 <pre>
1301 &lt;nowiki&gt;
1302 </pre>
1303 <pre>
1304
1305 </pre>
1306 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1307
1308 !! end
1309
1310 !! test
1311 <nowiki> and <pre> preference (first one wins)
1312 !! input
1313 <pre>
1314 <nowiki>
1315 </pre>
1316 </nowiki>
1317 </pre>
1318
1319 <nowiki>
1320 <pre>
1321 <nowiki>
1322 </pre>
1323 </nowiki>
1324 </pre>
1325
1326 !! result
1327 <pre>
1328 &lt;nowiki&gt;
1329 </pre>
1330 <p>&lt;/nowiki&gt;
1331 &lt;/pre&gt;
1332 </p><p>
1333 &lt;pre&gt;
1334 &lt;nowiki&gt;
1335 &lt;/pre&gt;
1336
1337 &lt;/pre&gt;
1338 </p>
1339 !! end
1340
1341 !! test
1342 </pre> inside nowiki
1343 !! input
1344 <nowiki></pre></nowiki>
1345 !! result
1346 <p>&lt;/pre&gt;
1347 </p>
1348 !! end
1349
1350 !!test
1351 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1352 !!input
1353 {{echo|}}
1354 !!result
1355
1356 !!end
1357
1358 !!test
1359 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1360 !!input
1361 {{echo|
1362 foo}}
1363 !!result
1364 <p>foo
1365 </p>
1366 !!end
1367
1368 !! test
1369 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1370 !! input
1371 {{echo|a
1372 b}}
1373 !!result
1374 <pre>a
1375 </pre>
1376 <p>b
1377 </p>
1378 !!end
1379
1380 !! test
1381 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1382 !! input
1383 {{echo|a
1384 b
1385 c
1386 d
1387 e
1388 }}
1389 !!result
1390 <pre>a
1391 </pre>
1392 <p>b
1393 c
1394 </p>
1395 <pre>d
1396 </pre>
1397 <p>e
1398 </p>
1399 !!end
1400
1401 !!test
1402 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1403 !!input
1404 {{echo| foo}}
1405
1406 {{echo| foo}}{{echo| bar}}
1407
1408 {{echo| foo}}
1409 {{echo| bar}}
1410
1411 {{echo|<!--cmt--> foo}}
1412
1413 <!--cmt-->{{echo| foo}}
1414
1415 {{echo|{{echo| }}bar}}
1416 !!result
1417 <pre>foo
1418 </pre>
1419 <pre>foo bar
1420 </pre>
1421 <pre>foo
1422 bar
1423 </pre>
1424 <pre>foo
1425 </pre>
1426 <pre>foo
1427 </pre>
1428 <pre>bar
1429 </pre>
1430 !!end
1431
1432 !! test
1433 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1434 !! input
1435 {{echo| }}a
1436
1437 {{echo|
1438 }}a
1439
1440 {{echo|
1441 b}}
1442
1443 {{echo|a
1444 }}b
1445
1446 {{echo|a
1447 }} b
1448 !!result
1449 <pre>a
1450 </pre>
1451 <p><br />
1452 </p>
1453 <pre>a
1454 </pre>
1455 <p><br />
1456 </p>
1457 <pre>b
1458 </pre>
1459 <p>a
1460 </p>
1461 <pre>b
1462 </pre>
1463 <p>a
1464 </p>
1465 <pre>b
1466 </pre>
1467 !!end
1468
1469 !! test
1470 Templates: Single-line variant of parameter whitespace stripping test
1471 !! input
1472 {{echo| a}}
1473
1474 {{echo|1= a}}
1475
1476 {{echo|{{echo| a}}}}
1477
1478 {{echo|1={{echo| a}}}}
1479 !! result
1480 <pre>a
1481 </pre>
1482 <p>a
1483 </p>
1484 <pre>a
1485 </pre>
1486 <p>a
1487 </p>
1488 !! end
1489
1490 !! test
1491 Templates: Strip whitespace from named parameters, but not positional ones
1492 !! input
1493 {{echo|
1494 foo}}
1495
1496 {{echo|
1497 * foo}}
1498
1499 {{echo| 1 =
1500 foo}}
1501
1502 {{echo| 1 =
1503 * foo}}
1504 !! result
1505 <pre>foo
1506 </pre>
1507 <p><br />
1508 </p>
1509 <ul><li> foo
1510 </li></ul>
1511 <p>foo
1512 </p>
1513 <ul><li> foo
1514 </li></ul>
1515
1516 !! end
1517
1518 !! test
1519 Templates: Parsoid parameter escaping test 1
1520 !! options
1521 parsoid
1522 !! input
1523 {{echo|[foo]|{{echo|[bar]}}}}
1524 !! result
1525 <p about="#mwt1" typeof="mw:Transclusion"
1526 data-mw="{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;[foo]&quot;},&quot;2&quot;:{&quot;wt&quot;:&quot;{{echo|[bar]}}&quot;}},&quot;i&quot;:0}">[foo]</p>
1527 !! end
1528
1529 ###
1530 ### Parsoid-centric tests for testing RT edge cases for pre
1531 ###
1532
1533 !!test
1534 1a. Indent-Pre and Comments
1535 !!input
1536 a
1537 <!--a-->
1538 c
1539 !!result
1540 <pre>a
1541 </pre>
1542 <p>c
1543 </p>
1544 !!end
1545
1546 !!test
1547 1b. Indent-Pre and Comments
1548 !!input
1549 a
1550 <!--a-->
1551 c
1552 !!result
1553 <pre>a
1554 </pre>
1555 <p>c
1556 </p>
1557 !!end
1558
1559 !!test
1560 1c. Indent-Pre and Comments
1561 !!input
1562 <!--a--> a
1563
1564 <!--a--> a
1565 !!result
1566 <pre> a
1567 </pre>
1568 <pre> a
1569 </pre>
1570 !!end
1571
1572 !!test
1573 2a. Indent-Pre and tables
1574 !!input
1575 {|
1576 |-
1577 !h1!!h2
1578 |foo||bar
1579 |}
1580 !!result
1581 <table>
1582
1583 <tr>
1584 <th>h1</th>
1585 <th>h2
1586 </th>
1587 <td>foo</td>
1588 <td>bar
1589 </td></tr></table>
1590
1591 !!end
1592
1593 !!test
1594 2b. Indent-Pre and tables
1595 !!input
1596 {|
1597 |-
1598 |foo
1599 |}
1600 !!result
1601 <table>
1602
1603 <tr>
1604 <td>foo
1605 </td></tr></table>
1606
1607 !!end
1608
1609 !!test
1610 2c. Indent-Pre and tables (bug 42252)
1611 !!input
1612 {|
1613 |+ foo
1614 ! | bar
1615 |}
1616 !!result
1617 <table>
1618 <caption> foo
1619 </caption>
1620 <tr>
1621 <th> bar
1622 </th></tr></table>
1623
1624 !!end
1625
1626 !!test
1627 3a. Indent-Pre and block tags (single-line html)
1628 !!input
1629 <p> foo </p>
1630 <div> foo </div>
1631 <span> foo </span>
1632 !!result
1633 <p> foo </p>
1634 <div> foo </div>
1635 <pre><span> foo </span>
1636 </pre>
1637 !!end
1638
1639 !!test
1640 3b. Indent-Pre and block tags (pre-content on separate line)
1641 !!input
1642 <p>
1643 foo
1644 </p>
1645
1646 <div>
1647 foo
1648 </div>
1649
1650 <center>
1651 foo
1652 </center>
1653
1654 <blockquote>
1655 foo
1656 </blockquote>
1657
1658 <table><tr><td>
1659 foo
1660 </td></tr></table>
1661
1662 <ul><li>
1663 foo
1664 </li></ul>
1665
1666 !!result
1667 <p>
1668 foo
1669 </p>
1670 <div>
1671 <pre>foo
1672 </pre>
1673 </div>
1674 <center>
1675 <pre>foo
1676 </pre>
1677 </center>
1678 <blockquote>
1679 foo
1680 </blockquote>
1681 <table><tr><td>
1682 <pre>foo
1683 </pre>
1684 </td></tr></table>
1685 <ul><li>
1686 foo
1687 </li></ul>
1688
1689 !!end
1690
1691 !!test
1692 4. Multiple spaces at start-of-line
1693 !!input
1694 <p> foo </p>
1695 foo
1696 {|
1697 |foo
1698 |}
1699 !!result
1700 <p> foo </p>
1701 <pre> foo
1702 </pre>
1703 <table>
1704 <tr>
1705 <td>foo
1706 </td></tr></table>
1707
1708 !!end
1709
1710 !! test
1711 5. White-space in indent-pre
1712 NOTE: the white-space char on 2nd line is significant
1713 !! input
1714 a<br/>
1715
1716 b
1717 !! result
1718 <pre>a<br />
1719
1720 b
1721 </pre>
1722 !! end
1723
1724 ###
1725 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1726 ###
1727
1728 !!test
1729 HTML-pre: 1. embedded newlines
1730 !!input
1731 <pre>foo</pre>
1732
1733 <pre>
1734 foo
1735 </pre>
1736
1737 <pre>
1738
1739 foo
1740 </pre>
1741
1742 <pre>
1743
1744
1745 foo
1746 </pre>
1747 !!result
1748 <pre>foo</pre>
1749 <pre>
1750 foo
1751 </pre>
1752 <pre>
1753
1754 foo
1755 </pre>
1756 <pre>
1757
1758
1759 foo
1760 </pre>
1761
1762 !!end
1763
1764 !!test
1765 HTML-pre: 2: indented text
1766 !!input
1767 <pre>
1768 foo
1769 </pre>
1770 !!result
1771 <pre>
1772 foo
1773 </pre>
1774
1775 !!end
1776
1777 !!test
1778 HTML-pre: 3: other wikitext
1779 !!input
1780 <pre>
1781 * foo
1782 # bar
1783 = no-h =
1784 '' no-italic ''
1785 [[ NoLink ]]
1786 </pre>
1787 !!result
1788 <pre>
1789 * foo
1790 # bar
1791 = no-h =
1792 '' no-italic ''
1793 [[ NoLink ]]
1794 </pre>
1795
1796 !!end
1797
1798 ###
1799 ### Definition lists
1800 ###
1801 !! test
1802 Simple definition
1803 !! input
1804 ; name : Definition
1805 !! result
1806 <dl><dt> name&#160;</dt><dd> Definition
1807 </dd></dl>
1808
1809 !! end
1810
1811 !! test
1812 Definition list for indentation only
1813 !! input
1814 : Indented text
1815 !! result
1816 <dl><dd> Indented text
1817 </dd></dl>
1818
1819 !! end
1820
1821 !! test
1822 Definition list with no space
1823 !! input
1824 ;name:Definition
1825 !! result
1826 <dl><dt>name</dt><dd>Definition
1827 </dd></dl>
1828
1829 !!end
1830
1831 !! test
1832 Definition list with URL link
1833 !! input
1834 ; http://example.com/ : definition
1835 !! result
1836 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
1837 </dd></dl>
1838
1839 !! end
1840
1841 !! test
1842 Definition list with bracketed URL link
1843 !! input
1844 ;[http://www.example.com/ Example]:Something about it
1845 !! result
1846 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
1847 </dd></dl>
1848
1849 !! end
1850
1851 !! test
1852 Definition list with wikilink containing colon
1853 !! input
1854 ; [[Help:FAQ]]: The least-read page on Wikipedia
1855 !! result
1856 <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
1857 </dd></dl>
1858
1859 !! end
1860
1861 # At Brion's and JeLuF's insistence... :)
1862 !! test
1863 Definition list with news link containing colon
1864 !! input
1865 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
1866 !! result
1867 <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!
1868 </dd></dl>
1869
1870 !! end
1871
1872 !! test
1873 Malformed definition list with colon
1874 !! input
1875 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
1876 !! result
1877 <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
1878 </dt></dl>
1879
1880 !! end
1881
1882 !! test
1883 Definition lists: colon in external link text
1884 !! input
1885 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
1886 !! result
1887 <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
1888 </dd></dl>
1889
1890 !! end
1891
1892 !! test
1893 Definition lists: colon in HTML attribute
1894 !! input
1895 ;<b style="display: inline">bold</b>
1896 !! result
1897 <dl><dt><b style="display: inline">bold</b>
1898 </dt></dl>
1899
1900 !! end
1901
1902 !! test
1903 Definition lists: self-closed tag
1904 !! input
1905 ;one<br/>two : two-line fun
1906 !! result
1907 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
1908 </dd></dl>
1909
1910 !! end
1911
1912 !! test
1913 Bug 11748: Literal closing tags
1914 !! input
1915 <dl>
1916 <dt>test 1</dt>
1917 <dd>test test test test test</dd>
1918 <dt>test 2</dt>
1919 <dd>test test test test test</dd>
1920 </dl>
1921 !! result
1922 <dl>
1923 <dt>test 1</dt>
1924 <dd>test test test test test</dd>
1925 <dt>test 2</dt>
1926 <dd>test test test test test</dd>
1927 </dl>
1928
1929 !! end
1930
1931 !! test
1932 Definition and unordered list using wiki syntax nested in unordered list using html tags.
1933 !! input
1934 <ul><li>
1935 ; term : description
1936 * unordered
1937 </li>
1938 </ul>
1939 !! result
1940 <ul><li>
1941 <dl><dt> term&#160;</dt><dd> description
1942 </dd></dl>
1943 <ul><li> unordered
1944 </li></ul>
1945 </li>
1946 </ul>
1947
1948 !! end
1949
1950 !! test
1951
1952 Definition list with empty definition and following paragraph
1953 !! input
1954 ; term:
1955 Paragraph text
1956 !! result
1957 <dl><dt> term</dt><dd>
1958 </dd></dl>
1959 <p>Paragraph text
1960 </p>
1961 !! end
1962
1963 !! test
1964 Nested definition lists using html syntax
1965 !! input
1966 <dl><dd>
1967 <dl>
1968 <dd>Foo</dd>
1969 </dl>
1970 </dd></dl>
1971 !! result
1972 <dl><dd>
1973 <dl>
1974 <dd>Foo</dd>
1975 </dl>
1976 </dd></dl>
1977
1978 !! end
1979
1980 !! test
1981 Definition Lists: No nesting: Multiple dd's
1982 !! input
1983 ;x
1984 :a
1985 :b
1986 !! result
1987 <dl><dt>x
1988 </dt><dd>a
1989 </dd><dd>b
1990 </dd></dl>
1991
1992 !! end
1993
1994 !! test
1995 Definition Lists: Indentation: Regular
1996 !! input
1997 :i1
1998 ::i2
1999 :::i3
2000 !! result
2001 <dl><dd>i1
2002 <dl><dd>i2
2003 <dl><dd>i3
2004 </dd></dl>
2005 </dd></dl>
2006 </dd></dl>
2007
2008 !! end
2009
2010 !! test
2011 Definition Lists: Indentation: Missing 1st level
2012 !! input
2013 ::i2
2014 :::i3
2015 !! result
2016 <dl><dd><dl><dd>i2
2017 <dl><dd>i3
2018 </dd></dl>
2019 </dd></dl>
2020 </dd></dl>
2021
2022 !! end
2023
2024 !! test
2025 Definition Lists: Indentation: Multi-level indent
2026 !! input
2027 :::i3
2028 !! result
2029 <dl><dd><dl><dd><dl><dd>i3
2030 </dd></dl>
2031 </dd></dl>
2032 </dd></dl>
2033
2034 !! end
2035
2036 !! test
2037 Definition Lists: Hacky use to indent tables
2038 !! input
2039 ::{|
2040 |foo
2041 |bar
2042 |}
2043 this text
2044 should be left alone
2045 !! result
2046 <dl><dd><dl><dd><table>
2047 <tr>
2048 <td>foo
2049 </td>
2050 <td>bar
2051 </td></tr></table></dd></dl></dd></dl>
2052 <p>this text
2053 should be left alone
2054 </p>
2055 !! end
2056 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2057 ## as an empty dt item. It also ignores all but the last ";" when followed
2058 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2059 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2060 ## ";"s.
2061 ##
2062 ## Ex: ";;t2 ::d2" is transformed into:
2063 ##
2064 ## <dl>
2065 ## <dt>t2 </dt>
2066 ## <dd>
2067 ## <dl>
2068 ## <dt></dt>
2069 ## <dd>d2</dd>
2070 ## </dl>
2071 ## </dd>
2072 ## </dl>
2073 ##
2074 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2075 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2076 ##
2077 ## <dl>
2078 ## <dt>
2079 ## <dl>
2080 ## <dt>t2 </dt>
2081 ## <dd>:d2</dd>
2082 ## </dl>
2083 ## </dt>
2084 ## </dl>
2085 ##
2086 ## All Parsoid only definition list tests have this difference.
2087 ##
2088 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2089 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2090
2091 !! test
2092 Table / list interaction: indented table with lists in table contents
2093 !! input
2094 :{|
2095 |-
2096 | a
2097 * b
2098 |-
2099 | c
2100 * d
2101 |}
2102 !! result
2103 <dl><dd><table>
2104
2105 <tr>
2106 <td> a
2107 <ul><li> b
2108 </li></ul>
2109 </td></tr>
2110 <tr>
2111 <td> c
2112 <ul><li> d
2113 </li></ul>
2114 </td></tr></table></dd></dl>
2115
2116 !! end
2117
2118 !!test
2119 Table / list interaction: lists nested in tables nested in indented lists
2120 !!input
2121 :{|
2122 |
2123 :a
2124 :b
2125 |
2126 *c
2127 *d
2128 |}
2129
2130 *e
2131 *f
2132 !!result
2133 <dl><dd><table>
2134 <tr>
2135 <td>
2136 <dl><dd>a
2137 </dd><dd>b
2138 </dd></dl>
2139 </td>
2140 <td>
2141 <ul><li>c
2142 </li><li>d
2143 </li></ul>
2144 </td></tr></table></dd></dl>
2145 <ul><li>e
2146 </li><li>f
2147 </li></ul>
2148
2149 !!end
2150
2151 !! test
2152 Definition Lists: Nesting: Multi-level (Parsoid only)
2153 !! options
2154 parsoid
2155 !! input
2156 ;t1 :d1
2157 ;;t2 ::d2
2158 ;;;t3 :::d3
2159 !! result
2160 <dl>
2161 <dt>t1 </dt>
2162 <dd>d1</dd>
2163 <dt>
2164 <dl>
2165 <dt>t2 </dt>
2166 <dd>:d2</dd>
2167 <dt>
2168 <dl>
2169 <dt>t3 </dt>
2170 <dd>::d3</dd>
2171 </dl>
2172 </dt>
2173 </dl>
2174 </dt>
2175 </dl>
2176
2177
2178 !! end
2179
2180
2181 !! test
2182 Definition Lists: Nesting: Test 2 (Parsoid only)
2183 !! options
2184 parsoid
2185 !! input
2186 ;t1
2187 ::d2
2188 !! result
2189 <dl>
2190 <dt>t1</dt>
2191 <dd>
2192 <dl>
2193 <dd>d2</dd>
2194 </dl>
2195 </dd>
2196 </dl>
2197
2198 !! end
2199
2200
2201 !! test
2202 Definition Lists: Nesting: Test 3 (Parsoid only)
2203 !! options
2204 parsoid
2205 !! input
2206 :;t1
2207 ::::d2
2208 !! result
2209 <dl>
2210 <dd>
2211 <dl>
2212 <dt>t1</dt>
2213 <dd>
2214 <dl>
2215 <dd>
2216 <dl>
2217 <dd>d2</dd>
2218 </dl>
2219 </dd>
2220 </dl>
2221 </dd>
2222 </dl>
2223 </dd>
2224 </dl>
2225
2226 !! end
2227
2228
2229 !! test
2230 Definition Lists: Nesting: Test 4
2231 !! input
2232 ::;t3
2233 :::d3
2234 !! result
2235 <dl><dd><dl><dd><dl><dt>t3
2236 </dt><dd>d3
2237 </dd></dl>
2238 </dd></dl>
2239 </dd></dl>
2240
2241 !! end
2242
2243
2244 ## The Parsoid team believes the following three test exposes a
2245 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2246 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2247 !! test
2248 Definition Lists: Mixed Lists: Test 1 (php)
2249 !! options
2250 php
2251 !! input
2252 :;* foo
2253 ::* bar
2254 :; baz
2255 !! result
2256 <dl><dd><dl><dt><ul><li> foo
2257 </li><li> bar
2258 </li></ul>
2259 </dt></dl>
2260 <dl><dt> baz
2261 </dt></dl>
2262 </dd></dl>
2263
2264 !! end
2265 !! test
2266 Definition Lists: Mixed Lists: Test 1 (parsoid)
2267 !! options
2268 parsoid
2269 !! input
2270 :;* foo
2271 ::* bar
2272 :; baz
2273 !! result
2274 <dl><dd><dl><dt><ul><li> foo
2275 </li></ul></dt><dd><ul><li> bar
2276 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2277 !! end
2278
2279 !! test
2280 Definition Lists: Mixed Lists: Test 2
2281 !! input
2282 *: d1
2283 *: d2
2284 !! result
2285 <ul><li><dl><dd> d1
2286 </dd><dd> d2
2287 </dd></dl>
2288 </li></ul>
2289
2290 !! end
2291
2292
2293 !! test
2294 Definition Lists: Mixed Lists: Test 3
2295 !! input
2296 *::: d1
2297 *::: d2
2298 !! result
2299 <ul><li><dl><dd><dl><dd><dl><dd> d1
2300 </dd><dd> d2
2301 </dd></dl>
2302 </dd></dl>
2303 </dd></dl>
2304 </li></ul>
2305
2306 !! end
2307
2308
2309 !! test
2310 Definition Lists: Mixed Lists: Test 4
2311 !! input
2312 *;d1 :d2
2313 *;d3 :d4
2314 !! result
2315 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2316 </dd><dt>d3&#160;</dt><dd>d4
2317 </dd></dl>
2318 </li></ul>
2319
2320 !! end
2321
2322
2323 !! test
2324 Definition Lists: Mixed Lists: Test 5
2325 !! input
2326 *:d1
2327 *:: d2
2328 !! result
2329 <ul><li><dl><dd>d1
2330 <dl><dd> d2
2331 </dd></dl>
2332 </dd></dl>
2333 </li></ul>
2334
2335 !! end
2336
2337
2338 !! test
2339 Definition Lists: Mixed Lists: Test 6
2340 !! input
2341 #*:d1
2342 #*::: d3
2343 !! result
2344 <ol><li><ul><li><dl><dd>d1
2345 <dl><dd><dl><dd> d3
2346 </dd></dl>
2347 </dd></dl>
2348 </dd></dl>
2349 </li></ul>
2350 </li></ol>
2351
2352 !! end
2353
2354
2355 !! test
2356 Definition Lists: Mixed Lists: Test 7
2357 !! input
2358 :* d1
2359 :* d2
2360 !! result
2361 <dl><dd><ul><li> d1
2362 </li><li> d2
2363 </li></ul>
2364 </dd></dl>
2365
2366 !! end
2367
2368
2369 !! test
2370 Definition Lists: Mixed Lists: Test 8
2371 !! input
2372 :* d1
2373 ::* d2
2374 !! result
2375 <dl><dd><ul><li> d1
2376 </li></ul>
2377 <dl><dd><ul><li> d2
2378 </li></ul>
2379 </dd></dl>
2380 </dd></dl>
2381
2382 !! end
2383
2384
2385 !! test
2386 Definition Lists: Mixed Lists: Test 9
2387 !! input
2388 *;foo :bar
2389 !! result
2390 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2391 </dd></dl>
2392 </li></ul>
2393
2394 !! end
2395
2396
2397 !! test
2398 Definition Lists: Mixed Lists: Test 10
2399 !! input
2400 *#;foo :bar
2401 !! result
2402 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2403 </dd></dl>
2404 </li></ol>
2405 </li></ul>
2406
2407 !! end
2408
2409 # The Parsoid team disagrees with the PHP parser's seemingly-random
2410 # rules regarding dd/dt on the next two tests. Parsoid is more
2411 # consistent, and recognizes the shared nesting and keeps the
2412 # still-open tags around until the nesting is complete.
2413
2414 !! test
2415 Definition Lists: Mixed Lists: Test 11 (php)
2416 !! options
2417 php
2418 !! input
2419 *#*#;*;;foo :bar
2420 *#*#;boo :baz
2421 !! result
2422 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2423 </dt></dl>
2424 </dd></dl>
2425 </li></ul>
2426 </dd></dl>
2427 <dl><dt>boo&#160;</dt><dd>baz
2428 </dd></dl>
2429 </li></ol>
2430 </li></ul>
2431 </li></ol>
2432 </li></ul>
2433
2434 !! end
2435 !! test
2436 Definition Lists: Mixed Lists: Test 11 (parsoid)
2437 !! options
2438 parsoid
2439 !! input
2440 *#*#;*;;foo :bar
2441 *#*#;boo :baz
2442 !! result
2443 <ul>
2444 <li>
2445 <ol>
2446 <li>
2447 <ul>
2448 <li>
2449 <ol>
2450 <li>
2451 <dl>
2452 <dt>
2453 <ul>
2454 <li>
2455 <dl>
2456 <dt>
2457 <dl>
2458 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2459 <dd data-parsoid='{"stx":"row"}'>bar</dd></dl></dt></dl></li></ul></dt>
2460 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2461 <dd data-parsoid='{"stx":"row"}'>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2462 !! end
2463
2464
2465 !! test
2466 Definition Lists: Weird Ones: Test 1 (php)
2467 !! options
2468 php
2469 !! input
2470 *#;*::;; foo : bar (who uses this?)
2471 !! result
2472 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2473 </dt></dl>
2474 </dd></dl>
2475 </dd></dl>
2476 </dd></dl>
2477 </li></ul>
2478 </dd></dl>
2479 </li></ol>
2480 </li></ul>
2481
2482 !! end
2483 !! test
2484 Definition Lists: Weird Ones: Test 1 (parsoid)
2485 !! options
2486 parsoid
2487 !! input
2488 *#;*::;; foo : bar (who uses this?)
2489 !! result
2490 <ul>
2491 <li>
2492 <ol>
2493 <li>
2494 <dl>
2495 <dt>
2496 <ul>
2497 <li>
2498 <dl>
2499 <dd>
2500 <dl>
2501 <dd>
2502 <dl>
2503 <dt>
2504 <dl>
2505 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2506 <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>
2507 !! end
2508
2509 ###
2510 ### External links
2511 ###
2512 !! test
2513 External links: non-bracketed
2514 !! input
2515 Non-bracketed: http://example.com
2516 !! result
2517 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2518 </p>
2519 !! end
2520
2521 !! test
2522 External links: numbered
2523 !! input
2524 Numbered: [http://example.com]
2525 Numbered: [http://example.net]
2526 Numbered: [http://example.com]
2527 !! result
2528 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2529 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2530 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2531 </p>
2532 !!end
2533
2534 !! test
2535 External links: specified text
2536 !! input
2537 Specified text: [http://example.com link]
2538 !! result
2539 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2540 </p>
2541 !!end
2542
2543 !! test
2544 External links: trail
2545 !! input
2546 Linktrails should not work for external links: [http://example.com link]s
2547 !! result
2548 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2549 </p>
2550 !! end
2551
2552 !! test
2553 External links: dollar sign in URL
2554 !! input
2555 http://example.com/1$2345
2556 !! result
2557 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2558 </p>
2559 !! end
2560
2561 !! test
2562 External links: dollar sign in URL (named)
2563 !! input
2564 [http://example.com/1$2345]
2565 !! result
2566 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2567 </p>
2568 !!end
2569
2570 !! test
2571 External links: open square bracket forbidden in URL (bug 4377)
2572 !! input
2573 http://example.com/1[2345
2574 !! result
2575 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2576 </p>
2577 !! end
2578
2579 !! test
2580 External links: open square bracket forbidden in URL (named) (bug 4377)
2581 !! input
2582 [http://example.com/1[2345]
2583 !! result
2584 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2585 </p>
2586 !!end
2587
2588 !! test
2589 External links: nowiki in URL link text (bug 6230)
2590 !!input
2591 [http://example.com/ <nowiki>''example site''</nowiki>]
2592 !! result
2593 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2594 </p>
2595 !! end
2596
2597 !! test
2598 External links: newline forbidden in text (bug 6230 regression check)
2599 !! input
2600 [http://example.com/ first
2601 second]
2602 !! result
2603 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2604 second]
2605 </p>
2606 !!end
2607
2608 !! test
2609 External links: Pipe char between url and text
2610 !! input
2611 [http://example.com | link]
2612 !! result
2613 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2614 </p>
2615 !!end
2616
2617 !! test
2618 External links: protocol-relative URL in brackets
2619 !! input
2620 [//example.com/ Test]
2621 !! result
2622 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2623 </p>
2624 !! end
2625
2626 !! test
2627 External links: protocol-relative URL in brackets without text
2628 !! input
2629 [//example.com]
2630 !! result
2631 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2632 </p>
2633 !! end
2634
2635 !! test
2636 External links: protocol-relative URL in free text is left alone
2637 !! input
2638 //example.com/Foo
2639 !! result
2640 <p>//example.com/Foo
2641 </p>
2642 !!end
2643
2644 !! test
2645 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2646 !! input
2647 foo//example.com/Foo
2648 !! result
2649 <p>foo//example.com/Foo
2650 </p>
2651 !! end
2652
2653 !! test
2654 External image
2655 !! input
2656 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2657 !! result
2658 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2659 </p>
2660 !! end
2661
2662 !! test
2663 External image from https
2664 !! input
2665 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2666 !! result
2667 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2668 </p>
2669 !! end
2670
2671 !! test
2672 Link to non-http image, no img tag
2673 !! input
2674 Link to non-http image, no img tag: ftp://example.com/test.jpg
2675 !! result
2676 <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>
2677 </p>
2678 !! end
2679
2680 !! test
2681 External links: terminating separator
2682 !! input
2683 Terminating separator: http://example.com/thing,
2684 !! result
2685 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2686 </p>
2687 !! end
2688
2689 !! test
2690 External links: intervening separator
2691 !! input
2692 Intervening separator: http://example.com/1,2,3
2693 !! result
2694 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2695 </p>
2696 !! end
2697
2698 !! test
2699 External links: old bug with URL in query
2700 !! input
2701 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2702 !! result
2703 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2704 </p>
2705 !! end
2706
2707 !! test
2708 External links: old URL-in-URL bug, mixed protocols
2709 !! input
2710 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2711 !! result
2712 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2713 </p>
2714 !!end
2715
2716 !! test
2717 External links: URL in text
2718 !! input
2719 URL in text: [http://example.com http://example.com]
2720 !! result
2721 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2722 </p>
2723 !! end
2724
2725 !! test
2726 External links: Clickable images
2727 !! input
2728 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2729 !! result
2730 <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>
2731 </p>
2732 !!end
2733
2734 !! test
2735 External links: raw ampersand
2736 !! input
2737 Old &amp; use: http://x&y
2738 !! result
2739 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2740 </p>
2741 !! end
2742
2743 !! test
2744 External links: encoded ampersand
2745 !! input
2746 Old &amp; use: http://x&amp;y
2747 !! result
2748 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2749 </p>
2750 !! end
2751
2752 !! test
2753 External links: encoded equals (bug 6102)
2754 !! input
2755 http://example.com/?foo&#61;bar
2756 !! result
2757 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2758 </p>
2759 !! end
2760
2761 !! test
2762 External links: [raw ampersand]
2763 !! input
2764 Old &amp; use: [http://x&y]
2765 !! result
2766 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2767 </p>
2768 !! end
2769
2770 !! test
2771 External links: [encoded ampersand]
2772 !! input
2773 Old &amp; use: [http://x&amp;y]
2774 !! result
2775 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2776 </p>
2777 !! end
2778
2779 !! test
2780 External links: [encoded equals] (bug 6102)
2781 !! input
2782 [http://example.com/?foo&#61;bar]
2783 !! result
2784 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2785 </p>
2786 !! end
2787
2788 !! test
2789 External links: [IDN ignored character reference in hostname; strip it right off]
2790 !! input
2791 [http://e&zwnj;xample.com/]
2792 !! result
2793 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2794 </p>
2795 !! end
2796
2797 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2798 # Where an external link could easily circumvent the sanitization of the text of
2799 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2800 # test demands a higher standard. That's a bit strange.
2801 #
2802 # Example:
2803 #
2804 # http://e‌xample.com -> [http://example.com|http://example.com]
2805 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2806 #
2807 # The first example is sanitized, but the second is not. Any security benefits
2808 # from this production are trivial to circumvent. Either remove this test and
2809 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2810 # the test accordingly.
2811 #
2812 # All our love,
2813 # The Parsoid team.
2814 !! test
2815 External links: IDN ignored character reference in hostname; strip it right off
2816 !! input
2817 http://e&zwnj;xample.com/
2818 !! result
2819 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
2820 </p>
2821 !! end
2822
2823 !! test
2824 External links: www.jpeg.org (bug 554)
2825 !! input
2826 http://www.jpeg.org
2827 !!result
2828 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
2829 </p>
2830 !! end
2831
2832 !! test
2833 External links: URL within URL (original bug 2)
2834 !! input
2835 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
2836 !! result
2837 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
2838 </p>
2839 !! end
2840
2841 !! test
2842 BUG 361: URL inside bracketed URL
2843 !! input
2844 [http://www.example.com/foo http://www.example.com/bar]
2845 !! result
2846 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
2847 </p>
2848 !! end
2849
2850 !! test
2851 BUG 361: URL within URL, not bracketed
2852 !! input
2853 http://www.example.com/foo?=http://www.example.com/bar
2854 !! result
2855 <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>
2856 </p>
2857 !! end
2858
2859 !! test
2860 BUG 289: ">"-token in URL-tail
2861 !! input
2862 http://www.example.com/<hello>
2863 !! result
2864 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
2865 </p>
2866 !!end
2867
2868 !! test
2869 BUG 289: literal ">"-token in URL-tail
2870 !! input
2871 http://www.example.com/<b>html</b>
2872 !! result
2873 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
2874 </p>
2875 !!end
2876
2877 !! test
2878 BUG 289: ">"-token in bracketed URL
2879 !! input
2880 [http://www.example.com/<hello> stuff]
2881 !! result
2882 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
2883 </p>
2884 !!end
2885
2886 !! test
2887 BUG 289: literal ">"-token in bracketed URL
2888 !! input
2889 [http://www.example.com/<b>html</b> stuff]
2890 !! result
2891 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
2892 </p>
2893 !!end
2894
2895 !! test
2896 BUG 289: literal double quote at end of URL
2897 !! input
2898 http://www.example.com/"hello"
2899 !! result
2900 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
2901 </p>
2902 !!end
2903
2904 !! test
2905 BUG 289: literal double quote in bracketed URL
2906 !! input
2907 [http://www.example.com/"hello" stuff]
2908 !! result
2909 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
2910 </p>
2911 !!end
2912
2913 !! test
2914 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
2915 !! input
2916 [http://www.example.com test]
2917 !! result
2918 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
2919 </p>
2920 !! end
2921
2922 !! test
2923 External links: link text with spaces
2924 !! input
2925 [http://www.example.com a b c]
2926 [http://www.example.com ''a'' ''b'']
2927 !! result
2928 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
2929 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
2930 </p>
2931 !! end
2932
2933 !! test
2934 External links: wiki links within external link (Bug 3695)
2935 !! input
2936 [http://example.com [[wikilink]] embedded in ext link]
2937 !! result
2938 <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>
2939 </p>
2940 !! end
2941
2942 !! test
2943 BUG 787: Links with one slash after the url protocol are invalid
2944 !! input
2945 http:/example.com
2946
2947 [http:/example.com title]
2948 !! result
2949 <p>http:/example.com
2950 </p><p>[http:/example.com title]
2951 </p>
2952 !! end
2953
2954 !! test
2955 Bracketed external links with template-generated invalid target
2956 !! input
2957 [{{echo|http:/example.com}} title]
2958 !! result
2959 <p>[http:/example.com title]
2960 </p>
2961 !! end
2962
2963 !! test
2964 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
2965 !! input
2966 ''[http://example.com text'']
2967 [http://example.com '''text]'''
2968 ''Something [http://example.com in italic'']
2969 ''Something [http://example.com mixed''''', even bold]'''
2970 '''''Now [http://example.com both''''']
2971 !! result
2972 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
2973 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
2974 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
2975 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
2976 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
2977 </p>
2978 !! end
2979
2980
2981 !! test
2982 Bug 4781: %26 in URL
2983 !! input
2984 http://www.example.com/?title=AT%26T
2985 !! result
2986 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
2987 </p>
2988 !! end
2989
2990 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
2991 # % is actually legal in HTML5. Any change in output would need testing though.
2992 !! test
2993 Bug 4781, 5267: %25 in URL
2994 !! input
2995 http://www.example.com/?title=100%25_Bran
2996 !! result
2997 <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>
2998 </p>
2999 !! end
3000
3001 !! test
3002 Bug 4781, 5267: %28, %29 in URL
3003 !! input
3004 http://www.example.com/?title=Ben-Hur_%281959_film%29
3005 !! result
3006 <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>
3007 </p>
3008 !! end
3009
3010
3011 !! test
3012 Bug 4781: %26 in autonumber URL
3013 !! input
3014 [http://www.example.com/?title=AT%26T]
3015 !! result
3016 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3017 </p>
3018 !! end
3019
3020 !! test
3021 Bug 4781, 5267: %26 in autonumber URL
3022 !! input
3023 [http://www.example.com/?title=100%25_Bran]
3024 !! result
3025 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3026 </p>
3027 !! end
3028
3029 !! test
3030 Bug 4781, 5267: %28, %29 in autonumber URL
3031 !! input
3032 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3033 !! result
3034 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3035 </p>
3036 !! end
3037
3038
3039 !! test
3040 Bug 4781: %26 in bracketed URL
3041 !! input
3042 [http://www.example.com/?title=AT%26T link]
3043 !! result
3044 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3045 </p>
3046 !! end
3047
3048 !! test
3049 Bug 4781, 5267: %26 in bracketed URL
3050 !! input
3051 [http://www.example.com/?title=100%25_Bran link]
3052 !! result
3053 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3054 </p>
3055 !! end
3056
3057 !! test
3058 Bug 4781, 5267: %28, %29 in bracketed URL
3059 !! input
3060 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3061 !! result
3062 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3063 </p>
3064 !! end
3065
3066 !! test
3067 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3068 !! input
3069 Some [http://example.com/ pretty ''italics'' and stuff]!
3070 !! result
3071 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3072 </p>
3073 !! end
3074
3075 !! test
3076 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3077 !! input
3078 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3079 !! result
3080 <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>
3081 </p>
3082 !! end
3083
3084 !! test
3085 External link containing double-single-quotes with no space separating the url from text in italics
3086 !! input
3087 [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]].]
3088 !! result
3089 <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>
3090 </p>
3091 !! end
3092
3093 !! test
3094 External link with comments in link text
3095 !! input
3096 [http://www.google.com Google <!-- comment -->]
3097 !! result
3098 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3099 </p>
3100 !! end
3101
3102 !! test
3103 URL-encoding in URL functions (single parameter)
3104 !! input
3105 {{localurl:Some page|amp=&}}
3106 !! result
3107 <p>/index.php?title=Some_page&amp;amp=&amp;
3108 </p>
3109 !! end
3110
3111 !! test
3112 URL-encoding in URL functions (multiple parameters)
3113 !! input
3114 {{localurl:Some page|q=?&amp=&}}
3115 !! result
3116 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3117 </p>
3118 !! end
3119
3120 !! test
3121 Brackets in urls
3122 !! input
3123 http://example.com/index.php?foozoid%5B%5D=bar
3124
3125 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3126 !! result
3127 <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>
3128 </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>
3129 </p>
3130 !! end
3131
3132 !! test
3133 IPv6 urls (bug 21261)
3134 !! options
3135 disabled
3136 !! input
3137 http://[2404:130:0:1000::187:2]/index.php
3138 !! result
3139 <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>
3140 </p>
3141 !! end
3142
3143 !! test
3144 Non-extlinks in brackets
3145 !! input
3146 [foo]
3147 [foo bar]
3148 [foo ''bar'']
3149 [fool's] errand
3150 [fool's errand]
3151 [{{echo|foo}}]
3152 [{{echo|foo}} bar]
3153 [{{echo|foo}} ''bar'']
3154 [{{echo|foo}}l's] errand
3155 [{{echo|foo}}l's errand]
3156 [url={{echo|foo}}]
3157 [url=http://example.com]
3158 !! result
3159 <p>[foo]
3160 [foo bar]
3161 [foo <i>bar</i>]
3162 [fool's] errand
3163 [fool's errand]
3164 [foo]
3165 [foo bar]
3166 [foo <i>bar</i>]
3167 [fool's] errand
3168 [fool's errand]
3169 [url=foo]
3170 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3171 </p>
3172 !! end
3173
3174 ###
3175 ### Quotes
3176 ###
3177
3178 !! test
3179 Quotes
3180 !! input
3181 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3182
3183 Normal text. '''''Bold italic text.''''' Normal text.
3184 !!result
3185 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3186 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3187 </p>
3188 !! end
3189
3190
3191 !! test
3192 Unclosed and unmatched quotes (php)
3193 !! options
3194 php
3195 !! input
3196 '''''Bold italic text '''with bold deactivated''' in between.'''''
3197
3198 '''''Bold italic text ''with italic deactivated'' in between.'''''
3199
3200 '''Bold text..
3201
3202 ..spanning two paragraphs (should not work).'''
3203
3204 '''Bold tag left open
3205
3206 ''Italic tag left open
3207
3208 Normal text.
3209
3210 <!-- Unmatching number of opening, closing tags: -->
3211 '''This year''''s election ''should'' beat '''last year''''s.
3212
3213 ''Tom'''s car is bigger than ''Susan'''s.
3214
3215 Plain ''italic'''s plain
3216 !! result
3217 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3218 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3219 </p><p><b>Bold text..</b>
3220 </p><p>..spanning two paragraphs (should not work).
3221 </p><p><b>Bold tag left open</b>
3222 </p><p><i>Italic tag left open</i>
3223 </p><p>Normal text.
3224 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3225 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3226 </p><p>Plain <i>italic'</i>s plain
3227 </p>
3228 !! end
3229 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3230 # parser strips. The wikitext contains just the first half of the bold
3231 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3232 # differently than the PHP parser.)
3233 !! test
3234 Unclosed and unmatched quotes (parsoid)
3235 !! options
3236 parsoid
3237 !! input
3238 '''''Bold italic text '''with bold deactivated''' in between.'''''
3239
3240 '''''Bold italic text ''with italic deactivated'' in between.'''''
3241
3242 '''Bold text..
3243
3244 ..spanning two paragraphs (should not work).'''
3245
3246 '''Bold tag left open
3247
3248 ''Italic tag left open
3249
3250 Normal text.
3251
3252 <!-- Unmatching number of opening, closing tags: -->
3253 '''This year''''s election ''should'' beat '''last year''''s.
3254
3255 ''Tom'''s car is bigger than ''Susan'''s.
3256
3257 Plain ''italic'''s plain
3258 !! result
3259 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3260 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3261 </p><p><b>Bold text..</b>
3262 </p><p>..spanning two paragraphs (should not work).<b></b>
3263 </p><p><b>Bold tag left open</b>
3264 </p><p><i>Italic tag left open</i>
3265 </p><p>Normal text.
3266 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3267 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3268 </p><p>Plain <i>italic'</i>s plain
3269 </p>
3270 !! end
3271
3272 ###
3273 ### Tables
3274 ###
3275 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3276 ###
3277
3278 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3279 # is the bare minimun required by the spec, see:
3280 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3281 !! test
3282 A table with no data. (php)
3283 !! options
3284 php
3285 !! input
3286 {||}
3287 !! result
3288 !! end
3289 # Parsoid team replies: empty table tags are legal in HTML5
3290 !! test
3291 A table with no data. (parsoid)
3292 !! options
3293 parsoid
3294 !! input
3295 {||}
3296 !! result
3297 <table></table>
3298 !! end
3299
3300 # A table with nothing but a caption is invalid XHTML, we might want to render
3301 # this as <p>caption</p>
3302 !! test
3303 A table with nothing but a caption (php)
3304 !! options
3305 php
3306 !! input
3307 {|
3308 |+ caption
3309 |}
3310 !! result
3311 <table>
3312 <caption> caption
3313 </caption><tr><td></td></tr></table>
3314
3315 !! end
3316 # Parsoid team replies: table with only a caption is legal in HTML5
3317 !! test
3318 A table with nothing but a caption (parsoid)
3319 !! options
3320 parsoid
3321 !! input
3322 {|
3323 |+ caption
3324 |}
3325 !! result
3326 <table><caption> caption</caption></table>
3327 !! end
3328
3329 !! test
3330 A table with caption with default-spaced attributes and a table row
3331 !! input
3332 {|
3333 |+ style="color: red;" | caption1
3334 |-
3335 | foo
3336 |}
3337 !! result
3338 <table>
3339 <caption style="color: red;"> caption1
3340 </caption>
3341 <tr>
3342 <td> foo
3343 </td></tr></table>
3344
3345 !! end
3346
3347 !! test
3348 A table with captions with non-default spaced attributes and a table row
3349 !! input
3350 {|
3351 |+style="color: red;"|caption2
3352 |+ style="color: red;"| caption3
3353 |-
3354 | foo
3355 |}
3356 !! result
3357 <table>
3358 <caption style="color: red;">caption2
3359 </caption>
3360 <caption style="color: red;"> caption3
3361 </caption>
3362 <tr>
3363 <td> foo
3364 </td></tr></table>
3365
3366 !! end
3367
3368 !! test
3369 Table td-cell syntax variations
3370 !! input
3371 {|
3372 | foo bar foo | baz
3373 | foo bar foo || baz
3374 | style='color:red;' | baz
3375 | style='color:red;' || baz
3376 |}
3377 !! result
3378 <table>
3379 <tr>
3380 <td> baz
3381 </td>
3382 <td> foo bar foo </td>
3383 <td> baz
3384 </td>
3385 <td style="color:red;"> baz
3386 </td>
3387 <td> style='color:red;' </td>
3388 <td> baz
3389 </td></tr></table>
3390
3391 !! end
3392
3393 !! test
3394 Simple table
3395 !! input
3396 {|
3397 | 1 || 2
3398 |-
3399 | 3 || 4
3400 |}
3401 !! result
3402 <table>
3403 <tr>
3404 <td> 1 </td>
3405 <td> 2
3406 </td></tr>
3407 <tr>
3408 <td> 3 </td>
3409 <td> 4
3410 </td></tr></table>
3411
3412 !! end
3413
3414 !! test
3415 Simple table but with multiple dashes for row wikitext
3416 !! input
3417 {|
3418 | foo
3419 |-----
3420 | bar
3421 |}
3422 !! result
3423 <table>
3424 <tr>
3425 <td> foo
3426 </td></tr>
3427 <tr>
3428 <td> bar
3429 </td></tr></table>
3430
3431 !! end
3432 !! test
3433 Multiplication table
3434 !! input
3435 {| border="1" cellpadding="2"
3436 |+Multiplication table
3437 |-
3438 ! &times; !! 1 !! 2 !! 3
3439 |-
3440 ! 1
3441 | 1 || 2 || 3
3442 |-
3443 ! 2
3444 | 2 || 4 || 6
3445 |-
3446 ! 3
3447 | 3 || 6 || 9
3448 |-
3449 ! 4
3450 | 4 || 8 || 12
3451 |-
3452 ! 5
3453 | 5 || 10 || 15
3454 |}
3455 !! result
3456 <table border="1" cellpadding="2">
3457 <caption>Multiplication table
3458 </caption>
3459 <tr>
3460 <th> &#215; </th>
3461 <th> 1 </th>
3462 <th> 2 </th>
3463 <th> 3
3464 </th></tr>
3465 <tr>
3466 <th> 1
3467 </th>
3468 <td> 1 </td>
3469 <td> 2 </td>
3470 <td> 3
3471 </td></tr>
3472 <tr>
3473 <th> 2
3474 </th>
3475 <td> 2 </td>
3476 <td> 4 </td>
3477 <td> 6
3478 </td></tr>
3479 <tr>
3480 <th> 3
3481 </th>
3482 <td> 3 </td>
3483 <td> 6 </td>
3484 <td> 9
3485 </td></tr>
3486 <tr>
3487 <th> 4
3488 </th>
3489 <td> 4 </td>
3490 <td> 8 </td>
3491 <td> 12
3492 </td></tr>
3493 <tr>
3494 <th> 5
3495 </th>
3496 <td> 5 </td>
3497 <td> 10 </td>
3498 <td> 15
3499 </td></tr></table>
3500
3501 !! end
3502
3503 !! test
3504 Accept "||" in table headings
3505 !! input
3506 {|
3507 !h1 || h2
3508 |}
3509 !! result
3510 <table>
3511 <tr>
3512 <th>h1 </th>
3513 <th> h2
3514 </th></tr></table>
3515
3516 !! end
3517
3518 !! test
3519 Accept "||" in indented table headings
3520 !! input
3521 :{|
3522 !h1 || h2
3523 |}
3524 !! result
3525 <dl><dd><table>
3526 <tr>
3527 <th>h1 </th>
3528 <th> h2
3529 </th></tr></table></dd></dl>
3530
3531 !! end
3532
3533 !! test
3534 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3535 !! input
3536 {|
3537 !| h1
3538 || a
3539 |}
3540 !! result
3541 <table>
3542 <tr>
3543 <th> h1
3544 </th>
3545 <td> a
3546 </td></tr></table>
3547
3548 !! end
3549
3550 !!test
3551 Accept "| !" at start of line in tables (ignore !-attribute)
3552 !!input
3553 {|
3554 |-
3555 | !style="color:red" | bar
3556 |}
3557 !!result
3558 <table>
3559
3560 <tr>
3561 <td> bar
3562 </td></tr></table>
3563
3564 !!end
3565
3566 !!test
3567 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 +/-
3568 !!input
3569 {|
3570 |-
3571 |style='color:red;'|+1
3572 |style='color:blue;'|-1
3573 |-
3574 | 1 || 2 || 3
3575 | 1 ||+2 ||-3
3576 |-
3577 | +1
3578 | -1
3579 |}
3580 !!result
3581 <table>
3582
3583 <tr>
3584 <td style="color:red;">+1
3585 </td>
3586 <td style="color:blue;">-1
3587 </td></tr>
3588 <tr>
3589 <td> 1 </td>
3590 <td> 2 </td>
3591 <td> 3
3592 </td>
3593 <td> 1 </td>
3594 <td>+2 </td>
3595 <td>-3
3596 </td></tr>
3597 <tr>
3598 <td> +1
3599 </td>
3600 <td> -1
3601 </td></tr></table>
3602
3603 !!end
3604
3605 !! test
3606 Table rowspan
3607 !! input
3608 {| border=1
3609 | Cell 1, row 1
3610 |rowspan=2| Cell 2, row 1 (and 2)
3611 | Cell 3, row 1
3612 |-
3613 | Cell 1, row 2
3614 | Cell 3, row 2
3615 |}
3616 !! result
3617 <table border="1">
3618 <tr>
3619 <td> Cell 1, row 1
3620 </td>
3621 <td rowspan="2"> Cell 2, row 1 (and 2)
3622 </td>
3623 <td> Cell 3, row 1
3624 </td></tr>
3625 <tr>
3626 <td> Cell 1, row 2
3627 </td>
3628 <td> Cell 3, row 2
3629 </td></tr></table>
3630
3631 !! end
3632
3633 !! test
3634 Nested table
3635 !! input
3636 {| border=1
3637 | &alpha;
3638 |
3639 {| bgcolor=#ABCDEF border=2
3640 |nested
3641 |-
3642 |table
3643 |}
3644 |the original table again
3645 |}
3646 !! result
3647 <table border="1">
3648 <tr>
3649 <td> &#945;
3650 </td>
3651 <td>
3652 <table bgcolor="#ABCDEF" border="2">
3653 <tr>
3654 <td>nested
3655 </td></tr>
3656 <tr>
3657 <td>table
3658 </td></tr></table>
3659 </td>
3660 <td>the original table again
3661 </td></tr></table>
3662
3663 !! end
3664
3665 !! test
3666 Invalid attributes in table cell (bug 1830)
3667 !! input
3668 {|
3669 |Cell:|broken
3670 |}
3671 !! result
3672 <table>
3673 <tr>
3674 <td>broken
3675 </td></tr></table>
3676
3677 !! end
3678
3679
3680 !! test
3681 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3682 !! input
3683 {|
3684 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3685 !! result
3686 <table>
3687 <tr>
3688 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3689 <td>]" onmouseover="alert(document.cookie)"&gt;test
3690 </td>
3691 </tr>
3692 </table>
3693
3694 !! end
3695
3696
3697 !! test
3698 Indented table markup mixed with indented pre content (proposed in bug 6200)
3699 !! input
3700 <table>
3701 <tr>
3702 <td>
3703 Text that should be rendered preformatted
3704 </td>
3705 </tr>
3706 </table>
3707 !! result
3708 <table>
3709 <tr>
3710 <td>
3711 <pre>Text that should be rendered preformatted
3712 </pre>
3713 </td>
3714 </tr>
3715 </table>
3716
3717 !! end
3718
3719 !! test
3720 Template-generated table cell attributes and cell content
3721 !! input
3722 {|
3723 |{{table_attribs}}
3724 |}
3725 !! result
3726 <table>
3727 <tr>
3728 <td style="color: red"> Foo
3729 </td></tr></table>
3730
3731 !! end
3732
3733 !! test
3734 Table with row followed by newlines and table heading
3735 !! input
3736 {|
3737 |-
3738
3739 ! foo
3740 |}
3741 !! result
3742 <table>
3743
3744
3745 <tr>
3746 <th> foo
3747 </th></tr></table>
3748
3749 !! end
3750
3751 !! test
3752 Table with empty line following the start tag
3753 !! input
3754 {|
3755
3756 |-
3757 | foo
3758 |}
3759 !! result
3760 <table>
3761
3762
3763 <tr>
3764 <td> foo
3765 </td></tr></table>
3766
3767 !! end
3768
3769 # FIXME: Preserve the attribute properly (with an empty string as value) in
3770 # the PHP parser. Parsoid implements the behavior below.
3771 !! test
3772 Table attributes with empty value
3773 !! options
3774 parsoid
3775 !! input
3776 {|
3777 | style=| hello
3778 |}
3779 !! result
3780 <table>
3781 <tbody>
3782 <tr>
3783 <td style=""> hello
3784 </td></tr></tbody></table>
3785
3786 !! end
3787
3788 !! test
3789 Wikitext table with a lot of comments
3790 !! input
3791 {|
3792 <!-- c0 -->
3793 | foo
3794 <!-- c1 -->
3795 |- <!-- c2 -->
3796 <!-- c3 -->
3797 |<!-- c4 -->
3798 <!-- c5 -->
3799 |}
3800 !! result
3801 <table>
3802 <tr>
3803 <td> foo
3804 </td></tr>
3805 <tr>
3806 <td>
3807 </td></tr></table>
3808
3809 !! end
3810
3811 !! test
3812 Wikitext table with double-line table cell
3813 !! input
3814 {|
3815 |a
3816 b
3817 |}
3818 !! result
3819 <table>
3820 <tr>
3821 <td>a
3822 <p>b
3823 </p>
3824 </td></tr></table>
3825
3826 !! end
3827
3828 !! test
3829 Table cell with a single comment
3830 !! input
3831 {|
3832 | <!-- c1 -->
3833 | a
3834 |}
3835 !! result
3836 <table>
3837 <tr>
3838 <td>
3839 </td>
3840 <td> a
3841 </td></tr></table>
3842
3843 !! end
3844
3845 # The expected HTML structure in this test is debatable. The PHP parser does
3846 # not parse this kind of table at all. The main focus for Parsoid is on
3847 # round-tripping, so this output is ok for now. TODO: revisit!
3848 !! test
3849 Wikitext table with html-syntax row (Parsoid)
3850 !! options
3851 parsoid
3852 !! input
3853 {|
3854 |-
3855 <td>foo</td>
3856 |}
3857 !! result
3858 <table>
3859 <tbody>
3860 <tr>
3861 <td>foo</td></tr></tbody></table>
3862 !! end
3863
3864 ###
3865 ### Internal links
3866 ###
3867 !! test
3868 Plain link, capitalized
3869 !! input
3870 [[Main Page]]
3871 !! result
3872 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
3873 </p>
3874 !! end
3875
3876 !! test
3877 Plain link, uncapitalized
3878 !! input
3879 [[main Page]]
3880 !! result
3881 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
3882 </p>
3883 !! end
3884
3885 !! test
3886 Piped link
3887 !! input
3888 [[Main Page|The Main Page]]
3889 !! result
3890 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
3891 </p>
3892 !! end
3893
3894 !! test
3895 Piped link with comment in link text
3896 !! input
3897 [[Main Page|The Main<!--front--> Page]]
3898 !! result
3899 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
3900 </p>
3901 !! end
3902
3903 !! test
3904 Broken link
3905 !! input
3906 [[Zigzagzogzagzig]]
3907 !! result
3908 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
3909 </p>
3910 !! end
3911
3912 !! test
3913 Broken link with fragment
3914 !! input
3915 [[Zigzagzogzagzig#zug]]
3916 !! result
3917 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
3918 </p>
3919 !! end
3920
3921 !! test
3922 Special page link with fragment
3923 !! input
3924 [[Special:Version#anchor]]
3925 !! result
3926 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
3927 </p>
3928 !! end
3929
3930 !! test
3931 Nonexistent special page link with fragment
3932 !! input
3933 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
3934 !! result
3935 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
3936 </p>
3937 !! end
3938
3939 !! test
3940 Link with prefix
3941 !! input
3942 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
3943 !! result
3944 <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>
3945 </p>
3946 !! end
3947
3948 !! test
3949 Link with suffix
3950 !! input
3951 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
3952 !! result
3953 <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>!!!
3954 </p>
3955 !! end
3956
3957 !! article
3958 prefixed article
3959 !! text
3960 Some text
3961 !! endarticle
3962
3963 !! test
3964 Bug 43661: Piped links with identical prefixes
3965 !! input
3966 [[prefixed article|prefixed articles with spaces]]
3967
3968 [[prefixed article|prefixed articlesaoeu]]
3969
3970 [[Main Page|Main Page test]]
3971 !! result
3972 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
3973 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
3974 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
3975 </p>
3976 !! end
3977
3978
3979 !! test
3980 Link with HTML entity in suffix / tail
3981 !! input
3982 [[Main Page]]&quot;, [[Main Page]]&#97;
3983 !! result
3984 <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;
3985 </p>
3986 !! end
3987
3988 !! test
3989 Link with 3 brackets
3990 !! input
3991 [[[main page]]]
3992 !! result
3993 <p>[[[main page]]]
3994 </p>
3995 !! end
3996
3997 !! test
3998 Piped link with 3 brackets
3999 !! input
4000 [[[main page|the main page]]]
4001 !! result
4002 <p>[[[main page|the main page]]]
4003 </p>
4004 !! end
4005
4006 !! test
4007 Link with multiple pipes
4008 !! input
4009 [[Main Page|The|Main|Page]]
4010 !! result
4011 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
4012 </p>
4013 !! end
4014
4015 !! test
4016 Link to namespaces
4017 !! input
4018 [[Talk:Parser testing]], [[Meta:Disclaimers]]
4019 !! result
4020 <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>
4021 </p>
4022 !! end
4023
4024 !! test
4025 Piped link to namespace
4026 !! input
4027 [[Meta:Disclaimers|The disclaimers]]
4028 !! result
4029 <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>
4030 </p>
4031 !! end
4032
4033 !! test
4034 Link containing }
4035 !! input
4036 [[Usually caused by a typo (oops}]]
4037 !! result
4038 <p>[[Usually caused by a typo (oops}]]
4039 </p>
4040 !! end
4041
4042 !! test
4043 Link containing % (not as a hex sequence)
4044 !! input
4045 [[7% Solution]]
4046 !! result
4047 <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>
4048 </p>
4049 !! end
4050
4051 !! test
4052 Link containing % as a single hex sequence interpreted to char
4053 !! input
4054 [[7%25 Solution]]
4055 !! result
4056 <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>
4057 </p>
4058 !!end
4059
4060 !! test
4061 Link containing % as a double hex sequence interpreted to hex sequence
4062 !! input
4063 [[7%2525 Solution]]
4064 !! result
4065 <p>[[7%2525 Solution]]
4066 </p>
4067 !!end
4068
4069 !! test
4070 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
4071 Example for such a section: == < ==
4072 !! input
4073 [[%23%3c]][[%23%3e]]
4074 !! result
4075 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
4076 </p>
4077 !! end
4078
4079 !! test
4080 Link containing "<#" and ">#" as a hex sequences
4081 !! input
4082 [[%3c%23]][[%3e%23]]
4083 !! result
4084 <p>[[%3c%23]][[%3e%23]]
4085 </p>
4086 !! end
4087
4088 !! test
4089 Link containing an equals sign
4090 !! input
4091 [[Special:BookSources/isbn=4-00-026157-6]]
4092 !! result
4093 <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>
4094 </p>
4095 !! end
4096
4097 !! article
4098 Foo~bar
4099 !! text
4100 Just a test of an article title containing a tilde.
4101 !! endarticle
4102
4103 # note that links containing signatures, like [[Foo~~~~]], are
4104 # massaged by the pre-save transform (PST) and so the tildes are never
4105 # seen by the parser.
4106 !! test
4107 Link containing a tilde
4108 !! input
4109 [[Foo~bar]]
4110 !! result
4111 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
4112 </p>
4113 !! end
4114
4115 !! test
4116 Link containing double-single-quotes '' (bug 4598)
4117 !! input
4118 [[Lista d''e paise d''o munno]]
4119 !! result
4120 <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>
4121 </p>
4122 !! end
4123
4124 !! test
4125 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4126 !! input
4127 Some [[Link|pretty ''italics'' and stuff]]!
4128 !! result
4129 <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>!
4130 </p>
4131 !! end
4132
4133 !! test
4134 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4135 !! input
4136 ''Some [[Link|pretty ''italics'' and stuff]]!
4137 !! result
4138 <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>
4139 </p>
4140 !! end
4141
4142 !! test
4143 Link with double quotes in title part (literal) and alternate part (interpreted)
4144 !! input
4145 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4146
4147 [[''Pentecoste'']]
4148
4149 [[''Pentecoste''|Pentecoste]]
4150
4151 [[''Pentecoste''|''Pentecoste'']]
4152 !! result
4153 <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>
4154 </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>
4155 </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>
4156 </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>
4157 </p>
4158 !! end
4159
4160 !! test
4161 Broken image links with HTML captions (bug 39700)
4162 !! input
4163 [[File:Nonexistent|<script></script>]]
4164 [[File:Nonexistent|100px|<script></script>]]
4165 [[File:Nonexistent|&lt;]]
4166 [[File:Nonexistent|a<i>b</i>c]]
4167 !! result
4168 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4169 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4170 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4171 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4172 </p>
4173 !! end
4174
4175 !! test
4176 Plain link to URL
4177 !! input
4178 [[http://www.example.com]]
4179 !! result
4180 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4181 </p>
4182 !! end
4183
4184 !! test
4185 Plain link to URL with link text
4186 !! input
4187 [[http://www.example.com Link text]]
4188 !! result
4189 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4190 </p>
4191 !! end
4192
4193 !! test
4194 Plain link to protocol-relative URL
4195 !! input
4196 [[//www.example.com]]
4197 !! result
4198 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4199 </p>
4200 !! end
4201
4202 !! test
4203 Plain link to protocol-relative URL with link text
4204 !! input
4205 [[//www.example.com Link text]]
4206 !! result
4207 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4208 </p>
4209 !! end
4210
4211 !! test
4212 Plain link to page with question mark in title
4213 !! input
4214 [[A?b]]
4215
4216 [[A?b|Baz]]
4217 !! result
4218 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4219 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4220 </p>
4221 !! end
4222
4223
4224 # I'm fairly sure the expected result here is wrong.
4225 # We want these to be URL links, not pseudo-pages with URLs for titles....
4226 # However the current output is also pretty screwy.
4227 #
4228 # ----
4229 # I'm changing it to match the current output--it arguably makes more
4230 # sense in the light of the test above. Old expected result was:
4231 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4232 #</p>
4233 # But I think this test is bordering on "garbage in, garbage out" anyway.
4234 # -- wtm
4235 !! test
4236 Piped link to URL
4237 !! input
4238 Piped link to URL: [[http://www.example.com|an example URL]]
4239 !! result
4240 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4241 </p>
4242 !! end
4243
4244 !! test
4245 BUG 2: [[page|http://url/]] should link to page, not http://url/
4246 !! input
4247 [[Main Page|http://url/]]
4248 !! result
4249 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4250 </p>
4251 !! end
4252
4253 !! test
4254 BUG 337: Escaped self-links should be bold
4255 !! options
4256 title=[[Bug462]]
4257 !! input
4258 [[Bu&#103;462]] [[Bug462]]
4259 !! result
4260 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4261 </p>
4262 !! end
4263
4264 !! test
4265 Self-link to section should not be bold
4266 !! options
4267 title=[[Main Page]]
4268 !! input
4269 [[Main Page#section]]
4270 !! result
4271 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4272 </p>
4273 !! end
4274
4275 !! article
4276 00
4277 !! text
4278 This is 00.
4279 !! endarticle
4280
4281 !!test
4282 Self-link to numeric title
4283 !!options
4284 title=[[0]]
4285 !!input
4286 [[0]]
4287 !!result
4288 <p><strong class="selflink">0</strong>
4289 </p>
4290 !!end
4291
4292 !!test
4293 Link to numeric-equivalent title
4294 !!options
4295 title=[[0]]
4296 !!input
4297 [[00]]
4298 !!result
4299 <p><a href="/wiki/00" title="00">00</a>
4300 </p>
4301 !!end
4302
4303 !! test
4304 <nowiki> inside a link
4305 !! input
4306 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4307 !! result
4308 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4309 </p>
4310 !! end
4311
4312 !! test
4313 Non-breaking spaces in title
4314 !! input
4315 [[&nbsp; Main &nbsp; Page &nbsp;]]
4316 !! result
4317 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4318 </p>
4319 !!end
4320
4321 !! test
4322 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4323 !! options
4324 language=ca
4325 !! input
4326 '''[[Main Page]]'''
4327 !! result
4328 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4329 </p>
4330 !! end
4331
4332 !! test
4333 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4334 !! options
4335 language=ca
4336 !! input
4337 ''[[Main Page]]''
4338 !! result
4339 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4340 </p>
4341 !! end
4342
4343 !! test
4344 Internal link with en linktrail: no apostrophes (bug 27473)
4345 !! options
4346 language=en
4347 !! input
4348 [[Something]]'nice
4349 !! result
4350 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4351 </p>
4352 !! end
4353
4354 !! test
4355 Internal link with ca linktrail with apostrophes (bug 27473)
4356 !! options
4357 language=ca
4358 !! input
4359 [[Something]]'nice
4360 !! result
4361 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4362 </p>
4363 !! end
4364
4365 !! test
4366 Internal link with kaa linktrail with apostrophes (bug 27473)
4367 !! options
4368 language=kaa
4369 !! input
4370 [[Something]]'nice
4371 !! result
4372 <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>
4373 </p>
4374 !! end
4375
4376 !! article
4377 Söfnuður
4378 !! text
4379 Test.
4380 !! endarticle
4381
4382 !! test
4383 Internal link with is link prefix
4384 !! options
4385 language=is
4386 !! input
4387 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
4388 !! result
4389 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
4390 </p>
4391 !! end
4392
4393 !! article
4394 Mótmælendatrú
4395 !! text
4396 Test.
4397 !! endarticle
4398
4399 !! test
4400 Internal link with is link trail and link prefix
4401 !! options
4402 language=is
4403 !! input
4404 [[mótmælendatrú|xxx]]ar
4405 [[mótmælendatrú]]ar
4406 mótmælenda[[söfnuður]]
4407 mótmælenda[[söfnuður|söfnuðir]]
4408 mótmælenda[[söfnuður|söfnuðir]]xxx
4409 !! result
4410 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
4411 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
4412 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
4413 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
4414 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
4415 </p>
4416 !! end
4417
4418 !! test
4419 Parsoid link trail escaping
4420 !! options
4421 parsoid=html2wt,html2html
4422 !! input
4423 [[apple]]<nowiki/>s
4424 !! result
4425 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
4426 !! end
4427
4428 !! test
4429 Parsoid link prefix escaping
4430 !! options
4431 language=is
4432 parsoid=html2wt,html2html
4433 !! input
4434 Aðrir mótmælenda<nowiki/>[[söfnuður]]
4435 !! result
4436 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
4437 !! end
4438
4439 !! test
4440 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4441 !! input
4442 [[Foo| bar]]
4443
4444 [[Foo| ''bar'']]
4445
4446 [http://wp.org foo]
4447
4448 [http://wp.org ''foo'']
4449 !! result
4450 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
4451 </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>
4452 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4453 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4454 </p>
4455 !! end
4456
4457 ###
4458 ### Interwiki links (see maintenance/interwiki.sql)
4459 ###
4460
4461 !! test
4462 Inline interwiki link
4463 !! input
4464 [[MeatBall:SoftSecurity]]
4465 !! result
4466 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4467 </p>
4468 !! end
4469
4470 !! test
4471 Inline interwiki link with empty title (bug 2372)
4472 !! input
4473 [[MeatBall:]]
4474 !! result
4475 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4476 </p>
4477 !! end
4478
4479 !! test
4480 Interwiki link encoding conversion (bug 1636)
4481 !! input
4482 *[[Wikipedia:ro:Olteni&#0355;a]]
4483 *[[Wikipedia:ro:Olteni&#355;a]]
4484 !! result
4485 <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>
4486 </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>
4487 </li></ul>
4488
4489 !! end
4490
4491 !! test
4492 Interwiki link with fragment (bug 2130)
4493 !! input
4494 [[MeatBall:SoftSecurity#foo]]
4495 !! result
4496 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4497 </p>
4498 !! end
4499
4500 !! test
4501 Interlanguage link
4502 !! input
4503 Blah blah blah
4504 [[zh:Chinese]]
4505 !!result
4506 <p>Blah blah blah
4507 </p>
4508 !! end
4509
4510 !! test
4511 Double interlanguage link
4512 !! input
4513 Blah blah blah
4514 [[es:Spanish]]
4515 [[zh:Chinese]]
4516 !!result
4517 <p>Blah blah blah
4518 </p>
4519 !! end
4520
4521 !! test
4522 Interlanguage link, with prefix links
4523 !! options
4524 language=ln
4525 !! input
4526 Blah blah blah
4527 [[zh:Chinese]]
4528 !!result
4529 <p>Blah blah blah
4530 </p>
4531 !! end
4532
4533 !! test
4534 Double interlanguage link, with prefix links (bug 8897)
4535 !! options
4536 language=ln
4537 !! input
4538 Blah blah blah
4539 [[es:Spanish]]
4540 [[zh:Chinese]]
4541 !!result
4542 <p>Blah blah blah
4543 </p>
4544 !! end
4545
4546 !! test
4547 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4548 !! options
4549 language=ln
4550 !! input
4551 [[WW&nbsp;II]]
4552 !!result
4553 <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>
4554 </p>
4555 !! end
4556
4557 !! test
4558 Parsoid: handle constructor well
4559 !! options
4560 parsoid
4561 !! input
4562 [[constructor]]
4563
4564 [[constructor:foo]]
4565 !! result
4566 <p data-parsoid="{&quot;dsr&quot;:[0,15,0,0]}"><a rel="mw:WikiLink" href="./Constructor" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Constructor&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor&quot;},&quot;dsr&quot;:[0,15,2,2]}">constructor</a></p>
4567
4568
4569 <p data-parsoid="{&quot;dsr&quot;:[17,36,0,0]}"><a rel="mw:WikiLink" href="./Foo" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Foo&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor:foo&quot;},&quot;dsr&quot;:[17,36,2,2]}">constructor:foo</a></p>
4570 !! end
4571
4572 ##
4573 ## Redirects, Parsoid-only
4574 ##
4575 !! test
4576 Simple redirect to page
4577 !! options
4578 parsoid
4579 !! input
4580 #REDIRECT [[Main Page]]
4581 !! result
4582 <link rel="mw:PageProp/redirect" href="./Main_Page">
4583 !! end
4584
4585 !! test
4586 Redirect to category
4587 !! options
4588 parsoid=wt2html
4589 !! input
4590 #REDIRECT [[Category:Foo]]
4591 !! result
4592 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
4593 !! end
4594
4595 !! test
4596 Redirect to category page
4597 !! options
4598 parsoid=wt2html,html2html
4599 !! input
4600 #REDIRECT [[:Category:Foo]]
4601 !! result
4602 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
4603 !! end
4604
4605 !! test
4606 Redirect to image page
4607 !! options
4608 parsoid
4609 !! input
4610 #REDIRECT [[File:Wiki.png]]
4611 !! result
4612 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
4613 !! end
4614
4615 !! test
4616 Redirect to language
4617 !! options
4618 parsoid
4619 !! input
4620 #REDIRECT [[en:File:Wiki.png]]
4621 !! result
4622 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
4623 !! end
4624
4625 !! test
4626 Redirect to interwiki
4627 !! options
4628 parsoid
4629 !! input
4630 #REDIRECT [[meatball:File:Wiki.png]]
4631 !! result
4632 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
4633 !! end
4634
4635 ##
4636 ## XHTML tidiness
4637 ###
4638
4639 !! test
4640 <br> to <br />
4641 !! input
4642 1<br>2<br />3
4643 !! result
4644 <p>1<br />2<br />3
4645 </p>
4646 !! end
4647
4648 !! test
4649 Broken br tag sanitization
4650 !! input
4651 </br>
4652 !! result
4653 <p>&lt;/br&gt;
4654 </p>
4655 !! end
4656
4657 !! test
4658 Incorrecly removing closing slashes from correctly formed XHTML
4659 !! input
4660 <br style="clear:both;" />
4661 !! result
4662 <p><br style="clear:both;" />
4663 </p>
4664 !! end
4665
4666 !! test
4667 Failing to transform badly formed HTML into correct XHTML
4668 !! input
4669 <br style="clear: left;">
4670 <br style="clear: right;">
4671 <br style="clear: both;">
4672 !! result
4673 <p><br style="clear: left;" />
4674 <br style="clear: right;" />
4675 <br style="clear: both;" />
4676 </p>
4677 !!end
4678
4679 !! test
4680 Handling html with a div self-closing tag
4681 !! input
4682 <div title />
4683 <div title/>
4684 <div title/ >
4685 <div title=bar />
4686 <div title=bar/>
4687 <div title=bar/ >
4688 !! result
4689 <p>&lt;div title /&gt;
4690 &lt;div title/&gt;
4691 </p>
4692 <div>
4693 <p>&lt;div title=bar /&gt;
4694 &lt;div title=bar/&gt;
4695 </p>
4696 <div title="bar/"></div>
4697 </div>
4698
4699 !! end
4700
4701 !! test
4702 Handling html with a br self-closing tag
4703 !! input
4704 <br title />
4705 <br title/>
4706 <br title/ >
4707 <br title=bar />
4708 <br title=bar/>
4709 <br title=bar/ >
4710 !! result
4711 <p><br title="title" />
4712 <br title="title" />
4713 <br />
4714 <br title="bar" />
4715 <br title="bar" />
4716 <br title="bar/" />
4717 </p>
4718 !! end
4719
4720 !! test
4721 Horizontal ruler (should it add that extra space?)
4722 !! input
4723 <hr>
4724 <hr >
4725 foo <hr
4726 > bar
4727 !! result
4728 <hr />
4729 <hr />
4730 foo <hr /> bar
4731
4732 !! end
4733
4734 !! test
4735 Horizontal ruler -- 4+ dashes render hr
4736 !! input
4737 ----
4738 !! result
4739 <hr />
4740
4741 !! end
4742
4743 !! test
4744 Horizontal ruler -- eats additional dashes on the same line
4745 !! input
4746 ---------
4747 !! result
4748 <hr />
4749
4750 !! end
4751
4752 !! test
4753 Horizontal ruler -- does not collapse dashes on consecutive lines
4754 !! input
4755 ----
4756 ----
4757 !! result
4758 <hr />
4759 <hr />
4760
4761 !! end
4762
4763 !! test
4764 Horizontal ruler -- <4 dashes render as plain text
4765 !! input
4766 ---
4767 !! result
4768 <p>---
4769 </p>
4770 !! end
4771
4772 !! test
4773 Horizontal ruler -- Supports content following dashes on same line
4774 !! input
4775 ---- Foo
4776 !! result
4777 <hr /> Foo
4778
4779 !! end
4780
4781 ###
4782 ### Block-level elements
4783 ###
4784 !! test
4785 Common list
4786 !! input
4787 *Common list
4788 * item 2
4789 *item 3
4790 !! result
4791 <ul><li>Common list
4792 </li><li> item 2
4793 </li><li>item 3
4794 </li></ul>
4795
4796 !! end
4797
4798 !! test
4799 Numbered list
4800 !! input
4801 #Numbered list
4802 #item 2
4803 # item 3
4804 !! result
4805 <ol><li>Numbered list
4806 </li><li>item 2
4807 </li><li> item 3
4808 </li></ol>
4809
4810 !! end
4811
4812 !! test
4813 Mixed list
4814 !! input
4815 *Mixed list
4816 *# with numbers
4817 ** and bullets
4818 *# and numbers
4819 *bullets again
4820 **bullet level 2
4821 ***bullet level 3
4822 ***#Number on level 4
4823 **bullet level 2
4824 **#Number on level 3
4825 **#Number on level 3
4826 *#number level 2
4827 *Level 1
4828 *** Level 3
4829 #** Level 3, but ordered
4830 !! result
4831 <ul><li>Mixed list
4832 <ol><li> with numbers
4833 </li></ol>
4834 <ul><li> and bullets
4835 </li></ul>
4836 <ol><li> and numbers
4837 </li></ol>
4838 </li><li>bullets again
4839 <ul><li>bullet level 2
4840 <ul><li>bullet level 3
4841 <ol><li>Number on level 4
4842 </li></ol>
4843 </li></ul>
4844 </li><li>bullet level 2
4845 <ol><li>Number on level 3
4846 </li><li>Number on level 3
4847 </li></ol>
4848 </li></ul>
4849 <ol><li>number level 2
4850 </li></ol>
4851 </li><li>Level 1
4852 <ul><li><ul><li> Level 3
4853 </li></ul>
4854 </li></ul>
4855 </li></ul>
4856 <ol><li><ul><li><ul><li> Level 3, but ordered
4857 </li></ul>
4858 </li></ul>
4859 </li></ol>
4860
4861 !! end
4862
4863 !! test
4864 Nested lists 1
4865 !! input
4866 *foo
4867 **bar
4868 !! result
4869 <ul><li>foo
4870 <ul><li>bar
4871 </li></ul>
4872 </li></ul>
4873
4874 !! end
4875
4876 !! test
4877 Nested lists 2
4878 !! input
4879 **foo
4880 *bar
4881 !! result
4882 <ul><li><ul><li>foo
4883 </li></ul>
4884 </li><li>bar
4885 </li></ul>
4886
4887 !! end
4888
4889 !! test
4890 Nested lists 3 (first element empty)
4891 !! input
4892 *
4893 **bar
4894 !! result
4895 <ul><li>
4896 <ul><li>bar
4897 </li></ul>
4898 </li></ul>
4899
4900 !! end
4901
4902 !! test
4903 Nested lists 4 (first element empty)
4904 !! input
4905 **
4906 *bar
4907 !! result
4908 <ul><li><ul><li>
4909 </li></ul>
4910 </li><li>bar
4911 </li></ul>
4912
4913 !! end
4914
4915 !! test
4916 Nested lists 5 (both elements empty)
4917 !! input
4918 **
4919 *
4920 !! result
4921 <ul><li><ul><li>
4922 </li></ul>
4923 </li><li>
4924 </li></ul>
4925
4926 !! end
4927
4928 !! test
4929 Nested lists 6 (both elements empty)
4930 !! input
4931 *
4932 **
4933 !! result
4934 <ul><li>
4935 <ul><li>
4936 </li></ul>
4937 </li></ul>
4938
4939 !! end
4940
4941 !! test
4942 Nested lists 7 (skip initial nesting levels)
4943 !! input
4944 *** foo
4945 !! result
4946 <ul><li><ul><li><ul><li> foo
4947 </li></ul>
4948 </li></ul>
4949 </li></ul>
4950
4951 !! end
4952
4953 !! test
4954 Nested lists 8 (multiple nesting transitions)
4955 !! input
4956 * foo
4957 *** bar
4958 ** baz
4959 * boo
4960 !! result
4961 <ul><li> foo
4962 <ul><li><ul><li> bar
4963 </li></ul>
4964 </li><li> baz
4965 </li></ul>
4966 </li><li> boo
4967 </li></ul>
4968
4969 !! end
4970
4971 !! test
4972 1. Lists with start-of-line-transparent tokens before bullets: Comments
4973 !! input
4974 *foo
4975 *<!--cmt-->bar
4976 <!--cmt-->*baz
4977 !! result
4978 <ul><li>foo
4979 </li><li>bar
4980 </li><li>baz
4981 </li></ul>
4982
4983 !! end
4984
4985 !! test
4986 2. Lists with start-of-line-transparent tokens before bullets: Template close
4987 !! input
4988 *foo {{echo|bar
4989 }}*baz
4990 !! result
4991 <ul><li>foo bar
4992 </li><li>baz
4993 </li></ul>
4994
4995 !! end
4996
4997 !! test
4998 Unbalanced closing block tags break a list
4999 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5000 !! options
5001 parsoid
5002 !! input
5003 <div>
5004 *a</div><div>
5005 *b</div>
5006 !! result
5007 <div>
5008 <ul><li>a
5009 </li></ul></div><div>
5010 <ul><li>b
5011 </li></ul></div>
5012 !! end
5013
5014 !! test
5015 Unbalanced closing non-block tags don't break a list
5016 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5017 !! options
5018 parsoid
5019 !! input
5020 <span>
5021 *a</span><span>
5022 *b</span>
5023 !! result
5024 <p><span></span>
5025 </p>
5026 <ul><li>a<span></span>
5027 </li><li>b
5028 </li></ul>
5029 !! end
5030
5031 !! test
5032 Unclosed formatting tags that straddle lists are closed and reopened
5033 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5034 !! options
5035 parsoid
5036 !! input
5037 # <s> a
5038 # b </s>
5039 !! result
5040 <ol><li> <s> a </s>
5041 </li><li> <s> b </s>
5042 </li></ol>
5043 !! end
5044
5045 !!test
5046 List embedded in a non-block tag
5047 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
5048 !! options
5049 parsoid
5050 !!input
5051 <small>
5052 * foo
5053 </small>
5054 !!result
5055 <p><small></small></p>
5056 <small>
5057 <ul>
5058 <li> foo</li>
5059 </ul>
5060 </small>
5061 <p><small></small></p>
5062 !!end
5063
5064 !! test
5065 List items are not parsed correctly following a <pre> block (bug 785)
5066 !! input
5067 * <pre>foo</pre>
5068 * <pre>bar</pre>
5069 * zar
5070 !! result
5071 <ul><li> <pre>foo</pre>
5072 </li><li> <pre>bar</pre>
5073 </li><li> zar
5074 </li></ul>
5075
5076 !! end
5077
5078 !! test
5079 List items from template
5080 !! input
5081
5082 {{inner list}}
5083 * item 2
5084
5085 * item 0
5086 {{inner list}}
5087 * item 2
5088
5089 * item 0
5090 * notSOL{{inner list}}
5091 * item 2
5092 !! result
5093 <ul><li> item 1
5094 </li><li> item 2
5095 </li></ul>
5096 <ul><li> item 0
5097 </li><li> item 1
5098 </li><li> item 2
5099 </li></ul>
5100 <ul><li> item 0
5101 </li><li> notSOL
5102 </li><li> item 1
5103 </li><li> item 2
5104 </li></ul>
5105
5106 !! end
5107
5108 !! test
5109 List interrupted by empty line or heading
5110 !! input
5111 * foo
5112
5113 ** bar
5114 == A heading ==
5115 * Another list item
5116 !! result
5117 <ul><li> foo
5118 </li></ul>
5119 <ul><li><ul><li> bar
5120 </li></ul>
5121 </li></ul>
5122 <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>
5123 <ul><li> Another list item
5124 </li></ul>
5125
5126 !!end
5127
5128 !!test
5129 Multiple list tags generated by templates
5130 !!input
5131 {{echo|<li>}}a
5132 {{echo|<li>}}b
5133 {{echo|<li>}}c
5134 !!result
5135 <li>a
5136 <li>b
5137 <li>c</li>
5138 </li>
5139 </li>
5140
5141 !!end
5142
5143 !!test
5144 Single-comment whitespace lines dont break lists, but multi-comment whitespace lines do
5145 !!input
5146 *a
5147 <!--This line will NOT split the list-->
5148 *b
5149 <!--This line will NOT split the list either-->
5150 *c
5151 <!--foo--> <!--This line with more than 1 comment will split the list-->
5152 *d
5153 !!result
5154 <ul><li>a
5155 </li><li>b
5156 </li><li>c
5157 </li></ul>
5158 <ul><li>d
5159 </li></ul>
5160
5161 !!end
5162
5163 !!test
5164 Test the li-hack
5165 (Cannot test this with PHP parser since it relies on Tidy for the hack)
5166 !!options
5167 parsoid=wt2html,wt2wt
5168 !!input
5169 * foo
5170 * <li>li-hack
5171 * {{echo|<li>templated li-hack}}
5172 * <!--foo--> <li> unsupported li-hack with preceding comments
5173
5174 <ul>
5175 <li><li>not a li-hack
5176 </li>
5177 </ul>
5178 !!result
5179 <ul><li> foo</li>
5180 <li>li-hack</li>
5181 <li about="#mwt1" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<li>templated li-hack"}}}'>templated li-hack</li>
5182 <li> <!--foo--> </li><li> li-hack with preceding comments</li></ul>
5183
5184 <ul>
5185 <li></li><li>not a li-hack
5186 </li>
5187 </ul>
5188 !!end
5189
5190 ###
5191 ### Magic Words
5192 ###
5193
5194 !! test
5195 Magic Word: {{CURRENTDAY}}
5196 !! input
5197 {{CURRENTDAY}}
5198 !! result
5199 <p>1
5200 </p>
5201 !! end
5202
5203 !! test
5204 Magic Word: {{CURRENTDAY2}}
5205 !! input
5206 {{CURRENTDAY2}}
5207 !! result
5208 <p>01
5209 </p>
5210 !! end
5211
5212 !! test
5213 Magic Word: {{CURRENTDAYNAME}}
5214 !! input
5215 {{CURRENTDAYNAME}}
5216 !! result
5217 <p>Thursday
5218 </p>
5219 !! end
5220
5221 !! test
5222 Magic Word: {{CURRENTDOW}}
5223 !! input
5224 {{CURRENTDOW}}
5225 !! result
5226 <p>4
5227 </p>
5228 !! end
5229
5230 !! test
5231 Magic Word: {{CURRENTMONTH}}
5232 !! input
5233 {{CURRENTMONTH}}
5234 !! result
5235 <p>01
5236 </p>
5237 !! end
5238
5239 !! test
5240 Magic Word: {{CURRENTMONTHABBREV}}
5241 !! input
5242 {{CURRENTMONTHABBREV}}
5243 !! result
5244 <p>Jan
5245 </p>
5246 !! end
5247
5248 !! test
5249 Magic Word: {{CURRENTMONTHNAME}}
5250 !! input
5251 {{CURRENTMONTHNAME}}
5252 !! result
5253 <p>January
5254 </p>
5255 !! end
5256
5257 !! test
5258 Magic Word: {{CURRENTMONTHNAMEGEN}}
5259 !! input
5260 {{CURRENTMONTHNAMEGEN}}
5261 !! result
5262 <p>January
5263 </p>
5264 !! end
5265
5266 !! test
5267 Magic Word: {{CURRENTTIME}}
5268 !! input
5269 {{CURRENTTIME}}
5270 !! result
5271 <p>00:02
5272 </p>
5273 !! end
5274
5275 !! test
5276 Magic Word: {{CURRENTWEEK}} (@bug 4594)
5277 !! input
5278 {{CURRENTWEEK}}
5279 !! result
5280 <p>1
5281 </p>
5282 !! end
5283
5284 !! test
5285 Magic Word: {{CURRENTYEAR}}
5286 !! input
5287 {{CURRENTYEAR}}
5288 !! result
5289 <p>1970
5290 </p>
5291 !! end
5292
5293 !! test
5294 Magic Word: {{FULLPAGENAME}}
5295 !! options
5296 title=[[User:Ævar Arnfjörð Bjarmason]]
5297 !! input
5298 {{FULLPAGENAME}}
5299 !! result
5300 <p>User:Ævar Arnfjörð Bjarmason
5301 </p>
5302 !! end
5303
5304 !! test
5305 Magic Word: {{FULLPAGENAMEE}}
5306 !! options
5307 title=[[User:Ævar Arnfjörð Bjarmason]]
5308 !! input
5309 {{FULLPAGENAMEE}}
5310 !! result
5311 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5312 </p>
5313 !! end
5314
5315 !! test
5316 Magic Word: {{NAMESPACE}}
5317 !! options
5318 title=[[User:Ævar Arnfjörð Bjarmason]]
5319 !! input
5320 {{NAMESPACE}}
5321 !! result
5322 <p>User
5323 </p>
5324 !! end
5325
5326 !! test
5327 Magic Word: {{NAMESPACEE}}
5328 !! options
5329 title=[[User:Ævar Arnfjörð Bjarmason]]
5330 !! input
5331 {{NAMESPACEE}}
5332 !! result
5333 <p>User
5334 </p>
5335 !! end
5336
5337 !! test
5338 Magic Word: {{NAMESPACENUMBER}}
5339 !! options
5340 title=[[User:Ævar Arnfjörð Bjarmason]]
5341 !! input
5342 {{NAMESPACENUMBER}}
5343 !! result
5344 <p>2
5345 </p>
5346 !! end
5347
5348 !! test
5349 Magic Word: {{NUMBEROFFILES}}
5350 !! input
5351 {{NUMBEROFFILES}}
5352 !! result
5353 <p>4
5354 </p>
5355 !! end
5356
5357 !! test
5358 Magic Word: {{PAGENAME}}
5359 !! options
5360 title=[[User:Ævar Arnfjörð Bjarmason]]
5361 !! input
5362 {{PAGENAME}}
5363 !! result
5364 <p>Ævar Arnfjörð Bjarmason
5365 </p>
5366 !! end
5367
5368 !! test
5369 Magic Word: {{PAGENAME}} with metacharacters
5370 !! options
5371 title=[['foo & bar = baz']]
5372 !! input
5373 ''{{PAGENAME}}''
5374 !! result
5375 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
5376 </p>
5377 !! end
5378
5379 !! test
5380 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
5381 !! options
5382 title=[[*RFC 1234 http://example.com/]]
5383 !! input
5384 {{PAGENAME}}
5385 !! result
5386 <p>&#42;RFC&#32;1234 http&#58;//example.com/
5387 </p>
5388 !! end
5389
5390 !! test
5391 Magic Word: {{PAGENAMEE}}
5392 !! options
5393 title=[[User:Ævar Arnfjörð Bjarmason]]
5394 !! input
5395 {{PAGENAMEE}}
5396 !! result
5397 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5398 </p>
5399 !! end
5400
5401 !! test
5402 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
5403 !! options
5404 title=[[*RFC 1234 http://example.com/]]
5405 !! input
5406 {{PAGENAMEE}}
5407 !! result
5408 <p>&#42;RFC_1234_http&#58;//example.com/
5409 </p>
5410 !! end
5411
5412 !! test
5413 Magic Word: {{REVISIONID}}
5414 !! input
5415 {{REVISIONID}}
5416 !! result
5417 <p>1337
5418 </p>
5419 !! end
5420
5421 !! test
5422 Magic Word: {{SCRIPTPATH}}
5423 !! input
5424 {{SCRIPTPATH}}
5425 !! result
5426 <p>/
5427 </p>
5428 !! end
5429
5430 !! test
5431 Magic Word: {{SERVER}}
5432 !! input
5433 {{SERVER}}
5434 !! result
5435 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5436 </p>
5437 !! end
5438
5439 !! test
5440 Magic Word: {{SERVERNAME}}
5441 !! input
5442 {{SERVERNAME}}
5443 !! result
5444 <p>example.org
5445 </p>
5446 !! end
5447
5448 !! test
5449 Magic Word: {{SITENAME}}
5450 !! input
5451 {{SITENAME}}
5452 !! result
5453 <p>MediaWiki
5454 </p>
5455 !! end
5456
5457 !! test
5458 Case-sensitive magic words, when cased differently, should just be template transclusions
5459 !! input
5460 {{CurrentMonth}}
5461 {{currentday}}
5462 {{cURreNTweEK}}
5463 {{currentHour}}
5464 !! result
5465 <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>
5466 <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>
5467 <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>
5468 <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>
5469 </p>
5470 !! end
5471
5472 !! test
5473 Case-insensitive magic words should still work with weird casing.
5474 !! input
5475 {{sErVeRNaMe}}
5476 {{LCFirst:AOEU}}
5477 {{ucFIRST:aoeu}}
5478 {{SERver}}
5479 !! result
5480 <p>example.org
5481 aOEU
5482 Aoeu
5483 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5484 </p>
5485 !! end
5486
5487 !! test
5488 Namespace 1 {{ns:1}}
5489 !! input
5490 {{ns:1}}
5491 !! result
5492 <p>Talk
5493 </p>
5494 !! end
5495
5496 !! test
5497 Namespace 1 {{ns:01}}
5498 !! input
5499 {{ns:01}}
5500 !! result
5501 <p>Talk
5502 </p>
5503 !! end
5504
5505 !! test
5506 Namespace 0 {{ns:0}} (bug 4783)
5507 !! input
5508 {{ns:0}}
5509 !! result
5510
5511 !! end
5512
5513 !! test
5514 Namespace 0 {{ns:00}} (bug 4783)
5515 !! input
5516 {{ns:00}}
5517 !! result
5518
5519 !! end
5520
5521 !! test
5522 Namespace -1 {{ns:-1}}
5523 !! input
5524 {{ns:-1}}
5525 !! result
5526 <p>Special
5527 </p>
5528 !! end
5529
5530 !! test
5531 Namespace User {{ns:User}}
5532 !! input
5533 {{ns:User}}
5534 !! result
5535 <p>User
5536 </p>
5537 !! end
5538
5539 !! test
5540 Namespace User talk {{ns:User_talk}}
5541 !! input
5542 {{ns:User_talk}}
5543 !! result
5544 <p>User talk
5545 </p>
5546 !! end
5547
5548 !! test
5549 Namespace User talk {{ns:uSeR tAlK}}
5550 !! input
5551 {{ns:uSeR tAlK}}
5552 !! result
5553 <p>User talk
5554 </p>
5555 !! end
5556
5557 !! test
5558 Namespace File {{ns:File}}
5559 !! input
5560 {{ns:File}}
5561 !! result
5562 <p>File
5563 </p>
5564 !! end
5565
5566 !! test
5567 Namespace File {{ns:Image}}
5568 !! input
5569 {{ns:Image}}
5570 !! result
5571 <p>File
5572 </p>
5573 !! end
5574
5575 !! test
5576 Namespace (lang=de) Benutzer {{ns:User}}
5577 !! options
5578 language=de
5579 !! input
5580 {{ns:User}}
5581 !! result
5582 <p>Benutzer
5583 </p>
5584 !! end
5585
5586 !! test
5587 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
5588 !! options
5589 language=de
5590 !! input
5591 {{ns:3}}
5592 !! result
5593 <p>Benutzer Diskussion
5594 </p>
5595 !! end
5596
5597
5598 !! test
5599 Urlencode
5600 !! input
5601 {{urlencode:hi world?!}}
5602 {{urlencode:hi world?!|WIKI}}
5603 {{urlencode:hi world?!|PATH}}
5604 {{urlencode:hi world?!|QUERY}}
5605 !! result
5606 <p>hi+world%3F%21
5607 hi_world%3F!
5608 hi%20world%3F%21
5609 hi+world%3F%21
5610 </p>
5611 !! end
5612
5613 ###
5614 ### Magic links
5615 ###
5616 !! test
5617 Magic links: internal link to RFC (bug 479)
5618 !! input
5619 [[RFC 123]]
5620 !! result
5621 <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>
5622 </p>
5623 !! end
5624
5625 !! test
5626 Magic links: RFC (bug 479)
5627 !! input
5628 RFC 822
5629 !! result
5630 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
5631 </p>
5632 !! end
5633
5634 !! test
5635 Magic links: ISBN (bug 1937)
5636 !! input
5637 ISBN 0-306-40615-2
5638 !! result
5639 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
5640 </p>
5641 !! end
5642
5643 !! test
5644 Magic links: PMID incorrectly converts space to underscore
5645 !! input
5646 PMID 1234
5647 !! result
5648 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
5649 </p>
5650 !! end
5651
5652 ###
5653 ### Templates
5654 ####
5655
5656 !! test
5657 Nonexistent template
5658 !! input
5659 {{thistemplatedoesnotexist}}
5660 !! result
5661 <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>
5662 </p>
5663 !! end
5664
5665 !! test
5666 Template with invalid target containing tags
5667 !! input
5668 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5669 !! result
5670 <p>{{a<b>b</b>|foo|a=b|a = b}}
5671 </p>
5672 !! end
5673
5674 !! test
5675 Template with invalid target containing unclosed tag
5676 !! input
5677 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5678 !! result
5679 <p>{{a<b>|foo|a=b|a = b}}</b>
5680 </p>
5681 !! end
5682
5683 !! article
5684 Template:test
5685 !! text
5686 This is a test template
5687 !! endarticle
5688
5689 !! test
5690 Simple template
5691 !! input
5692 {{test}}
5693 !! result
5694 <p>This is a test template
5695 </p>
5696 !! end
5697
5698 !! test
5699 Template with explicit namespace
5700 !! input
5701 {{Template:test}}
5702 !! result
5703 <p>This is a test template
5704 </p>
5705 !! end
5706
5707
5708 !! article
5709 Template:paramtest
5710 !! text
5711 This is a test template with parameter {{{param}}}
5712 !! endarticle
5713
5714 !! test
5715 Template parameter
5716 !! input
5717 {{paramtest|param=foo}}
5718 !! result
5719 <p>This is a test template with parameter foo
5720 </p>
5721 !! end
5722
5723 !! article
5724 Template:paramtestnum
5725 !! text
5726 [[{{{1}}}|{{{2}}}]]
5727 !! endarticle
5728
5729 !! test
5730 Template unnamed parameter
5731 !! input
5732 {{paramtestnum|Main Page|the main page}}
5733 !! result
5734 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
5735 </p>
5736 !! end
5737
5738 !! article
5739 Template:templatesimple
5740 !! text
5741 (test)
5742 !! endarticle
5743
5744 !! article
5745 Template:templateredirect
5746 !! text
5747 #redirect [[Template:templatesimple]]
5748 !! endarticle
5749
5750 !! article
5751 Template:templateasargtestnum
5752 !! text
5753 {{{{{1}}}}}
5754 !! endarticle
5755
5756 !! article
5757 Template:templateasargtest
5758 !! text
5759 {{template{{{templ}}}}}
5760 !! endarticle
5761
5762 !! article
5763 Template:templateasargtest2
5764 !! text
5765 {{{{{templ}}}}}
5766 !! endarticle
5767
5768 !! test
5769 Template with template name as unnamed argument
5770 !! input
5771 {{templateasargtestnum|templatesimple}}
5772 !! result
5773 <p>(test)
5774 </p>
5775 !! end
5776
5777 !! test
5778 Template with template name as argument
5779 !! input
5780 {{templateasargtest|templ=simple}}
5781 !! result
5782 <p>(test)
5783 </p>
5784 !! end
5785
5786 !! test
5787 Template with template name as argument (2)
5788 !! input
5789 {{templateasargtest2|templ=templatesimple}}
5790 !! result
5791 <p>(test)
5792 </p>
5793 !! end
5794
5795 !! article
5796 Template:templateasargtestdefault
5797 !! text
5798 {{{{{templ|templatesimple}}}}}
5799 !! endarticle
5800
5801 !! article
5802 Template:templa
5803 !! text
5804 '''templ'''
5805 !! endarticle
5806
5807 !! test
5808 Template with default value
5809 !! input
5810 {{templateasargtestdefault}}
5811 !! result
5812 <p>(test)
5813 </p>
5814 !! end
5815
5816 !! test
5817 Template with default value (value set)
5818 !! input
5819 {{templateasargtestdefault|templ=templa}}
5820 !! result
5821 <p><b>templ</b>
5822 </p>
5823 !! end
5824
5825 !! test
5826 Template redirect
5827 !! input
5828 {{templateredirect}}
5829 !! result
5830 <p>(test)
5831 </p>
5832 !! end
5833
5834 !! test
5835 Template with argument in separate line
5836 !! input
5837 {{ templateasargtest |
5838 templ = simple }}
5839 !! result
5840 <p>(test)
5841 </p>
5842 !! end
5843
5844 !! test
5845 Template with complex template as argument
5846 !! input
5847 {{paramtest|
5848 param ={{ templateasargtest |
5849 templ = simple }}}}
5850 !! result
5851 <p>This is a test template with parameter (test)
5852 </p>
5853 !! end
5854
5855 !! test
5856 Template with thumb image (with link in description)
5857 !! input
5858 {{paramtest|
5859 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
5860 !! result
5861 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>
5862
5863 !! end
5864
5865 !! article
5866 Template:complextemplate
5867 !! text
5868 {{{1}}} {{paramtest|
5869 param ={{{param}}}}}
5870 !! endarticle
5871
5872 !! test
5873 Template with complex arguments
5874 !! input
5875 {{complextemplate|
5876 param ={{ templateasargtest |
5877 templ = simple }}|[[Template:complextemplate|link]]}}
5878 !! result
5879 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
5880 </p>
5881 !! end
5882
5883 !! test
5884 BUG 553: link with two variables in a piped link
5885 !! input
5886 {|
5887 |[[{{{1}}}|{{{2}}}]]
5888 |}
5889 !! result
5890 <table>
5891 <tr>
5892 <td>[[{{{1}}}|{{{2}}}]]
5893 </td></tr></table>
5894
5895 !! end
5896
5897 !! test
5898 Magic variable as template parameter
5899 !! input
5900 {{paramtest|param={{SITENAME}}}}
5901 !! result
5902 <p>This is a test template with parameter MediaWiki
5903 </p>
5904 !! end
5905
5906 !! article
5907 Template:linktest
5908 !! text
5909 [[{{{param}}}|link]]
5910 !! endarticle
5911
5912 !! test
5913 Template parameter as link source
5914 !! input
5915 {{linktest|param=Main Page}}
5916 !! result
5917 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
5918 </p>
5919 !! end
5920
5921 !!test
5922 Template-generated attribute string (k='v')
5923 !!input
5924 <span {{attr_str|id|v1}}>bar</span>
5925 !!result
5926 <p><span id="v1">bar</span>
5927 </p>
5928 !!end
5929
5930 !!article
5931 Template:paramtest2
5932 !! text
5933 including another template, {{paramtest|param={{{arg}}}}}
5934 !! endarticle
5935
5936 !! test
5937 Template passing argument to another template
5938 !! input
5939 {{paramtest2|arg='hmm'}}
5940 !! result
5941 <p>including another template, This is a test template with parameter 'hmm'
5942 </p>
5943 !! end
5944
5945 !! article
5946 Template:Linktest2
5947 !! text
5948 Main Page
5949 !! endarticle
5950
5951 !! test
5952 Template as link source
5953 !! input
5954 [[{{linktest2}}]]
5955
5956 [[{{linktest2}}|Main Page]]
5957
5958 [[{{linktest2}}]]Page
5959 !! result
5960 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5961 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5962 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
5963 </p>
5964 !! end
5965
5966
5967 !! article
5968 Template:loop1
5969 !! text
5970 {{loop2}}
5971 !! endarticle
5972
5973 !! article
5974 Template:loop2
5975 !! text
5976 {{loop1}}
5977 !! endarticle
5978
5979 !! test
5980 Template infinite loop
5981 !! input
5982 {{loop1}}
5983 !! result
5984 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
5985 </p>
5986 !! end
5987
5988 !! test
5989 Template from main namespace
5990 !! input
5991 {{:Main Page}}
5992 !! result
5993 <p>blah blah
5994 </p>
5995 !! end
5996
5997 !! article
5998 Template:table
5999 !! text
6000 {|
6001 | 1 || 2
6002 |-
6003 | 3 || 4
6004 |}
6005 !! endarticle
6006
6007 !! test
6008 BUG 529: Template with table, not included at beginning of line
6009 !! input
6010 foo {{table}}
6011 !! result
6012 <p>foo
6013 </p>
6014 <table>
6015 <tr>
6016 <td> 1 </td>
6017 <td> 2
6018 </td></tr>
6019 <tr>
6020 <td> 3 </td>
6021 <td> 4
6022 </td></tr></table>
6023
6024 !! end
6025
6026 !! test
6027 BUG 523: Template shouldn't eat newline (or add an extra one before table)
6028 !! input
6029 foo
6030 {{table}}
6031 !! result
6032 <p>foo
6033 </p>
6034 <table>
6035 <tr>
6036 <td> 1 </td>
6037 <td> 2
6038 </td></tr>
6039 <tr>
6040 <td> 3 </td>
6041 <td> 4
6042 </td></tr></table>
6043
6044 !! end
6045
6046 !! test
6047 BUG 41: Template parameters shown as broken links
6048 !! input
6049 {{{parameter}}}
6050 !! result
6051 <p>{{{parameter}}}
6052 </p>
6053 !! end
6054
6055 !! test
6056 Template with targets containing wikilinks
6057 !! input
6058 {{[[foo]]}}
6059
6060 {{[[{{echo|foo}}]]}}
6061
6062 {{{{echo|[[foo}}]]}}
6063 !! result
6064 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6065 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6066 </p><p>{{[[foo}}]]
6067 </p>
6068 !! end
6069
6070 !! article
6071 Template:MSGNW test
6072 !! text
6073 ''None'' of '''this''' should be
6074 * interpreted
6075 but rather passed unmodified
6076 {{test}}
6077 !! endarticle
6078
6079 # hmm, fix this or just deprecate msgnw and document its behavior?
6080 !! test
6081 msgnw keyword
6082 !! options
6083 disabled
6084 !! input
6085 {{msgnw:MSGNW test}}
6086 !! result
6087 <p>''None'' of '''this''' should be
6088 * interpreted
6089 but rather passed unmodified
6090 {{test}}
6091 </p>
6092 !! end
6093
6094 !! test
6095 int keyword
6096 !! input
6097 {{int:youhavenewmessages|lots of money|not!}}
6098 !! result
6099 <p>You have lots of money (not!).
6100 </p>
6101 !! end
6102
6103 !! article
6104 Template:Includes
6105 !! text
6106 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6107 !! endarticle
6108
6109 !! test
6110 <includeonly> and <noinclude> being included
6111 !! input
6112 {{Includes}}
6113 !! result
6114 <p>Foobar
6115 </p>
6116 !! end
6117
6118 !! article
6119 Template:Includes2
6120 !! text
6121 <onlyinclude>Foo</onlyinclude>bar
6122 !! endarticle
6123
6124 !! test
6125 <onlyinclude> being included
6126 !! input
6127 {{Includes2}}
6128 !! result
6129 <p>Foo
6130 </p>
6131 !! end
6132
6133
6134 !! article
6135 Template:Includes3
6136 !! text
6137 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
6138 !! endarticle
6139
6140 !! test
6141 <onlyinclude> and <includeonly> being included
6142 !! input
6143 {{Includes3}}
6144 !! result
6145 <p>Foo
6146 </p>
6147 !! end
6148
6149 !! test
6150 <includeonly> and <noinclude> on a page
6151 !! input
6152 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6153 !! result
6154 <p>Foozar
6155 </p>
6156 !! end
6157
6158 !! test
6159 Un-closed <noinclude>
6160 !! input
6161 <noinclude>
6162 !! result
6163 !! end
6164
6165 !! test
6166 <onlyinclude> on a page
6167 !! input
6168 <onlyinclude>Foo</onlyinclude>bar
6169 !! result
6170 <p>Foobar
6171 </p>
6172 !! end
6173
6174 !! test
6175 Un-closed <onlyinclude>
6176 !! input
6177 <onlyinclude>
6178 !! result
6179 !! end
6180
6181 !!test
6182 Self-closed noinclude, includeonly, onlyinclude tags
6183 !!input
6184 <noinclude />
6185 <includeonly />
6186 <onlyinclude />
6187 !!result
6188 <p><br />
6189 </p>
6190 !!end
6191
6192 !!test
6193 Unbalanced includeonly and noinclude tags
6194 !!input
6195 {|
6196 |a</noinclude>
6197 |b</noinclude></noinclude>
6198 |c</noinclude></includeonly>
6199 |d</includeonly></includeonly>
6200 |}
6201 !!result
6202 <table>
6203 <tr>
6204 <td>a
6205 </td>
6206 <td>b
6207 </td>
6208 <td>c&lt;/includeonly&gt;
6209 </td>
6210 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
6211 </td></tr></table>
6212
6213 !!end
6214
6215 !! article
6216 Template:Includeonly section
6217 !! text
6218 <includeonly>
6219 ==Includeonly section==
6220 </includeonly>
6221 ==Section T-1==
6222 !!endarticle
6223
6224 !! test
6225 Bug 6563: Edit link generation for section shown by <includeonly>
6226 !! input
6227 {{includeonly section}}
6228 !! result
6229 <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>
6230 <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>
6231
6232 !! end
6233
6234 # Uses same input as the contents of [[Template:Includeonly section]]
6235 !! test
6236 Bug 6563: Section extraction for section shown by <includeonly>
6237 !! options
6238 section=T-2
6239 !! input
6240 <includeonly>
6241 ==Includeonly section==
6242 </includeonly>
6243 ==Section T-2==
6244 !! result
6245 ==Section T-2==
6246 !! end
6247
6248 !! test
6249 Bug 6563: Edit link generation for section suppressed by <includeonly>
6250 !! input
6251 <includeonly>
6252 ==Includeonly section==
6253 </includeonly>
6254 ==Section 1==
6255 !! result
6256 <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>
6257
6258 !! end
6259
6260 !! test
6261 Bug 6563: Section extraction for section suppressed by <includeonly>
6262 !! options
6263 section=1
6264 !! input
6265 <includeonly>
6266 ==Includeonly section==
6267 </includeonly>
6268 ==Section 1==
6269 !! result
6270 ==Section 1==
6271 !! end
6272
6273 !! test
6274 Un-closed <includeonly>
6275 !! input
6276 <includeonly>
6277 !! result
6278 !! end
6279
6280 ###
6281 ### <includeonly> and <noinclude> in attributes
6282 ###
6283 !!test
6284 0. includeonly around the entire attribute
6285 !!input
6286 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
6287 !!result
6288 <p><span id="v2">bar</span>
6289 </p>
6290 !!end
6291
6292 !!test
6293 1. includeonly in html attr key
6294 !!input
6295 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
6296 !!result
6297 <p><span id="foo">bar</span>
6298 </p>
6299 !!end
6300
6301 !!test
6302 2. includeonly in html attr value
6303 !!input
6304 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
6305 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
6306 !!result
6307 <p><span id="v1">bar</span>
6308 <span id="v1">bar</span>
6309 </p>
6310 !!end
6311
6312 !!test
6313 3. includeonly in part of an attr value
6314 !!input
6315 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
6316 !!result
6317 <p><span style="color:red;">bar</span>
6318 </p>
6319 !!end
6320
6321 ###
6322 ### Testing parsing of templates where a template arg
6323 ### has the same name as the template itself.
6324 ###
6325
6326 !! article
6327 Template:quote
6328 !! text
6329 {{{quote|{{{1}}}}}}
6330 !! endarticle
6331
6332 !!test
6333 Templates: Template Name/Arg clash: 1. Use of positional param
6334 !!input
6335 {{quote|foo}}
6336 !!result
6337 <p>foo
6338 </p>
6339 !!end
6340
6341 !!test
6342 Templates: Template Name/Arg clash: 2. Use of named param
6343 !!input
6344 {{quote|quote=foo}}
6345 !!result
6346 <p>foo
6347 </p>
6348 !!end
6349
6350 !!test
6351 Templates: Template Name/Arg clash: 3. Use of named param with empty input
6352 !!input
6353 {{quote|quote}}
6354 !!result
6355 <p>quote
6356 </p>
6357 !!end
6358
6359 ###
6360 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
6361 ###
6362
6363 !!test
6364 Templates: 1. Simple use
6365 !!input
6366 {{echo|Foo}}
6367 !!result
6368 <p>Foo
6369 </p>
6370 !!end
6371
6372 !!test
6373 Templates: 2. Inside a block tag
6374 !!input
6375 <div>{{echo|Foo}}</div>
6376 !!result
6377 <div>Foo</div>
6378
6379 !!end
6380
6381 !!test
6382 Templates: P-wrapping: 1a. Templates on consecutive lines
6383 !!input
6384 {{echo|Foo}}
6385 {{echo|bar}}
6386 !!result
6387 <p>Foo
6388 bar
6389 </p>
6390 !!end
6391
6392 !!test
6393 Templates: P-wrapping: 1b. Templates on consecutive lines
6394 !!input
6395 Foo
6396
6397 {{echo|bar}}
6398 {{echo|baz}}
6399 !!result
6400 <p>Foo
6401 </p><p>bar
6402 baz
6403 </p>
6404 !!end
6405
6406 !!test
6407 Templates: P-wrapping: 1c. Templates on consecutive lines
6408 !!input
6409 {{echo|Foo}}
6410 {{echo|bar}} <div>baz</div>
6411 !!result
6412 <p>Foo
6413 </p>
6414 bar <div>baz</div>
6415
6416 !!end
6417
6418 !!test
6419 Templates: P-wrapping: 1d. Template preceded by comment-only line
6420 !!options
6421 parsoid=wt2html,wt2wt
6422 !!input
6423 <!-- foo -->
6424 {{echo|Bar}}
6425 !!result
6426 <!-- foo -->
6427 <p typeof="mw:Transclusion">Bar
6428 </p>
6429 !!end
6430
6431 !!test
6432 Templates: Inline Text: 1. Multiple tmeplate uses
6433 !!input
6434 {{echo|Foo}}bar{{echo|baz}}
6435 !!result
6436 <p>Foobarbaz
6437 </p>
6438 !!end
6439
6440 !!test
6441 Templates: Inline Text: 2. Back-to-back template uses
6442 !!input
6443 {{echo|Foo}}{{echo|bar}}
6444 !!result
6445 <p>Foobar
6446 </p>
6447 !!end
6448
6449 !!test
6450 Templates: Block Tags: 1. Multiple template uses
6451 !!input
6452 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
6453 !!result
6454 <div>Foo</div><div>bar</div><div>baz</div>
6455
6456 !!end
6457
6458 !!test
6459 Templates: Block Tags: 2. Back-to-back template uses
6460 !!input
6461 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
6462 !!result
6463 <div>Foo</div><div>bar</div>
6464
6465 !!end
6466
6467 !!test
6468 Templates: Links: 1. Simple example
6469 !!input
6470 {{echo|[[Foo|bar]]}}
6471 !!result
6472 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6473 </p>
6474 !!end
6475
6476 !!test
6477 Templates: Links: 2. Generation of link href
6478 !!input
6479 [[{{echo|Foo}}|bar]]
6480 !!result
6481 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6482 </p>
6483 !!end
6484
6485 !!test
6486 Templates: Links: 3. Generation of part of a link href
6487 !!input
6488 [[Fo{{echo|o}}|bar]]
6489
6490 [[Foo{{echo|bar}}]]
6491
6492 [[Foo{{echo|bar}}baz]]
6493
6494 [[Foo{{echo|bar}}|bar]]
6495
6496 [[:Foo{{echo|bar}}]]
6497
6498 [[:Foo{{echo|bar}}|bar]]
6499 !!result
6500 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6501 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6502 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
6503 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6504 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6505 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6506 </p>
6507 !!end
6508
6509 !!test
6510 Templates: Links: 4. Multiple templates generating link href
6511 !!input
6512 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
6513 !!result
6514 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6515 </p>
6516 !!end
6517
6518 !!test
6519 Templates: Links: 5. Generation of link text
6520 !!input
6521 [[Foo|{{echo|bar}}]]
6522 !!result
6523 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6524 </p>
6525 !!end
6526
6527 !!test
6528 Templates: Links: 5. Nested templates (only outermost template should be marked)
6529 !!input
6530 {{echo|[[{{echo|Foo}}|bar]]}}
6531 !!result
6532 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6533 </p>
6534 !!end
6535
6536 !!test
6537 Templates: HTML Tag: 1. Generation of HTML attr. key
6538 !!input
6539 <div {{echo|style}}="color:red;">foo</div>
6540 !!result
6541 <div style="color:red;">foo</div>
6542
6543 !!end
6544
6545 !!test
6546 Templates: HTML Tag: 2. Generation of HTML attr. value
6547 !!input
6548 <div style={{echo|'color:red;'}}>foo</div>
6549 !!result
6550 <div style="color:red;">foo</div>
6551
6552 !!end
6553
6554 !!test
6555 Templates: HTML Tag: 3. Generation of HTML attr key and value
6556 !!input
6557 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
6558 !!result
6559 <div style="color:red;">foo</div>
6560
6561 !!end
6562
6563 !!test
6564 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
6565 !!input
6566 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
6567 !!result
6568 <div title="This is a long title with just one piece templated">foo</div>
6569
6570 !!end
6571
6572 !!test
6573 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
6574 !!input
6575 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
6576 !!result
6577 <div title="This is a long title with just one piece templated">foo</div>
6578
6579 !!end
6580
6581 !!test
6582 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
6583 !!input
6584 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
6585 !!result
6586 <div title="This is a long title with just one piece templated">foo</div>
6587
6588 !!end
6589
6590 !!test
6591 Templates: HTML Tag: 7. Generation of partial attribute key string
6592 !!input
6593 <div st{{echo|yle}}="color:red;">foo</div>
6594 !!result
6595 <div style="color:red;">foo</div>
6596
6597 !!end
6598
6599 !!test
6600 Templates: HTML Tables: 1. Generating start of a HTML table
6601 !!input
6602 {{echo|<table><tr><td>foo</td>}}</tr></table>
6603 !!result
6604 <table><tr><td>foo</td></tr></table>
6605
6606 !!end
6607
6608 !!test
6609 Templates: HTML Tables: 2a. Generating middle of a HTML table
6610 !!input
6611 <table><tr>{{echo|<td>foo</td>}}</tr></table>
6612 !!result
6613 <table><tr><td>foo</td></tr></table>
6614
6615 !!end
6616
6617 !!test
6618 Templates: HTML Tables: 2b. Generating middle of a HTML table
6619 !!input
6620 <table>{{echo|<tr><td>foo</td></tr>}}</table>
6621 !!result
6622 <table><tr><td>foo</td></tr></table>
6623
6624 !!end
6625
6626 !!test
6627 Templates: HTML Tables: 3. Generating end of a HTML table
6628 !!input
6629 <table><tr>{{echo|<td>foo</td></tr></table>}}
6630 !!result
6631 <table><tr><td>foo</td></tr></table>
6632
6633 !!end
6634
6635 !!test
6636 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
6637 !!input
6638 {{echo|<table>}}<tr><td>foo</td></tr></table>
6639 !!result
6640 <table><tr><td>foo</td></tr></table>
6641
6642 !!end
6643
6644 !!test
6645 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
6646 !!input
6647 <table>{{echo|<tr>}}<td>foo</td></tr></table>
6648 !!result
6649 <table><tr><td>foo</td></tr></table>
6650
6651 !!end
6652
6653 !!test
6654 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
6655 !!input
6656 <table><tr>{{echo|<td>}}foo</td></tr></table>
6657 !!result
6658 <table><tr><td>foo</td></tr></table>
6659
6660 !!end
6661
6662 !!test
6663 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
6664 !!input
6665 <table><tr><td>foo{{echo|</td>}}</tr></table>
6666 !!result
6667 <table><tr><td>foo</td></tr></table>
6668
6669 !!end
6670
6671 !!test
6672 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
6673 !!input
6674 <table><tr><td>foo</td>{{echo|</tr>}}</table>
6675 !!result
6676 <table><tr><td>foo</td></tr></table>
6677
6678 !!end
6679
6680 !!test
6681 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
6682 !!input
6683 <table><tr><td>foo</td></tr>{{echo|</table>}}
6684 !!result
6685 <table><tr><td>foo</td></tr></table>
6686
6687 !!end
6688
6689 !!test
6690 Templates: Wiki Tables: 1a. Fostering of entire template content
6691 !!input
6692 {|
6693 {{echo|a}}
6694 |}
6695 !!result
6696 <table>
6697 a
6698 <tr><td></td></tr></table>
6699
6700 !!end
6701
6702 !!test
6703 Templates: Wiki Tables: 1b. Fostering of entire template content
6704 !!input
6705 {|
6706 {{echo|<div>}}
6707 foo
6708 {{echo|</div>}}
6709 |}
6710 !!result
6711 <table>
6712 <div>
6713 <p>foo
6714 </p>
6715 </div>
6716 <tr><td></td></tr></table>
6717
6718 !!end
6719
6720 !!test
6721 Templates: Wiki Tables: 2. Fostering of partial template content
6722 !!input
6723 {|
6724 {{echo|a
6725 <div>b</div>}}
6726 |}
6727 !!result
6728 <table>
6729 a
6730 <div>b</div>
6731 <tr><td></td></tr></table>
6732
6733 !!end
6734
6735 !!test
6736 Templates: Wiki Tables: 3. td-content via multiple templates
6737 !!input
6738 {|
6739 {{echo|{{pipe}}a}}{{echo|b}}
6740 |}
6741 !!result
6742 <table>
6743 <tr>
6744 <td>ab
6745 </td></tr></table>
6746
6747 !!end
6748
6749 !!test
6750 Templates: Wiki Tables: 4. Templated tags, no content
6751 !!input
6752 {{tbl-start}}
6753 {{tbl-end}}
6754 !!result
6755 <table>
6756 <tr><td></td></tr></table>
6757
6758 !!end
6759
6760 !!test
6761 Templates: Wiki Tables: 5. Templated tags, regular td-tags
6762 !!input
6763 {{tbl-start}}
6764 |foo
6765 {{tbl-end}}
6766 !!result
6767 <table>
6768 <tr>
6769 <td>foo
6770 </td></tr></table>
6771
6772 !!end
6773
6774 !!test
6775 Templates: Wiki Tables: 6. Templated tags, templated td-tags
6776 !!input
6777 {{tbl-start}}
6778 {{!}}foo
6779 {{tbl-end}}
6780 !!result
6781 <table>
6782 <tr>
6783 <td>foo
6784 </td></tr></table>
6785
6786 !!end
6787
6788 !!test
6789 Templates: Lists: Multi-line list-items via templates
6790 !!input
6791 *{{echo|a {{nonexistent|
6792 unused}}}}
6793 *{{echo|b {{nonexistent|
6794 unused}}}}
6795 !!result
6796 <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>
6797 </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>
6798 </li></ul>
6799
6800 !!end
6801
6802 !!test
6803 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
6804 !!input
6805 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
6806 !!result
6807 <p><i>ab</i>c<i>d</i>e
6808 </p>
6809 !!end
6810
6811 !!test
6812 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
6813 (PHP parser generates misnested html)
6814 !! options
6815 parsoid=wt2html,wt2wt
6816 !!input
6817 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
6818 !!result
6819 <p><span typeof="mw:Transclusion"><i>a</i></span><i typeof="mw:Transclusion"><span>b</span></i><span>c</span><i>d</i><span>e</span></p>
6820 !!end
6821
6822 !!test
6823 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
6824 (PHP parser generates misnested html)
6825 !! options
6826 parsoid=wt2html,wt2wt
6827 !!input
6828 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
6829 !!result
6830 <div typeof="mw:Transclusion"><i>a</i></div>
6831 <div typeof="mw:Transclusion"><i>b</i>c<i>d</i></div>
6832 <div typeof="mw:Transclusion">e</div>
6833 !!end
6834
6835 !!test
6836 Templates: Ugly nesting: 4. Divs opened/closed across templates
6837 !!input
6838 a<div>b{{echo|c</div>d}}e
6839 !!result
6840 a<div>bc</div>de
6841
6842 !!end
6843
6844 !!test
6845 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
6846 (Parsoid-centric)
6847 !! options
6848 parsoid
6849 !!input
6850 {|
6851 |{{echo|foo</table>}}
6852 |bar
6853 |}
6854 !!result
6855 <table typeof="mw:Transclusion">
6856 <tbody>
6857 <tr>
6858 <td>foo</td></tr></tbody></table><span>bar</span>
6859 !!end
6860
6861 !!test
6862 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
6863 (Parsoid-centric)
6864 !! options
6865 parsoid
6866 !!input
6867 <table>
6868 <tr>
6869 <td>
6870 <table>
6871 <tr>
6872 <td>1. {{echo|foo </table>}}</td>
6873 <td> bar </td>
6874 <td>2. {{echo|baz </table>}}</td>
6875 </tr>
6876 <tr>
6877 <td>abc</td>
6878 </tr>
6879 </table>
6880 </td>
6881 </tr>
6882 <tr>
6883 <td>xyz</td>
6884 </tr>
6885 </table>
6886 !!result
6887 <table about="#mwt1" typeof="mw:Transclusion">
6888 <tbody><tr >
6889 <td >
6890 <table >
6891 <tbody><tr >
6892 <td >1. foo </td></tr></tbody></table></td>
6893 <td > bar </td>
6894 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
6895 </span><span about="#mwt1">
6896
6897 abc</span><span about="#mwt1">
6898 </span><span about="#mwt1">
6899 </span><span about="#mwt1">
6900 </span><span about="#mwt1">
6901 </span><span about="#mwt1">
6902
6903 xyz</span><span about="#mwt1">
6904 </span><span about="#mwt1">
6905 </span>
6906 !!end
6907
6908 !! test
6909 Templates: Ugly templates: 3. newline-only template parameter
6910 !! input
6911 foo {{echo|
6912 }}
6913 !! result
6914 <p>foo
6915 </p>
6916 !! end
6917
6918 # This looks like a bug: a single newline triggers p/br for some reason.
6919 !! test
6920 Templates: Ugly templates: 4. newline-only template parameter inconsistency
6921 !! input
6922 {{echo|
6923 }}
6924 !! result
6925 <p><br />
6926 </p>
6927 !! end
6928
6929
6930 !!test
6931 Parser Functions: 1. Simple example
6932 !!input
6933 {{uc:foo}}
6934 !!result
6935 <p>FOO
6936 </p>
6937 !!end
6938
6939 !!test
6940 Parser Functions: 2. Nested use (only outermost should be marked up)
6941 !!input
6942 {{uc:{{lc:FOO}}}}
6943 !!result
6944 <p>FOO
6945 </p>
6946 !!end
6947
6948 ###
6949 ### Pre-save transform tests
6950 ###
6951 !! test
6952 pre-save transform: subst:
6953 !! options
6954 PST
6955 !! input
6956 {{subst:test}}
6957 !! result
6958 This is a test template
6959 !! end
6960
6961 !! test
6962 pre-save transform: normal template
6963 !! options
6964 PST
6965 !! input
6966 {{test}}
6967 !! result
6968 {{test}}
6969 !! end
6970
6971 !! test
6972 pre-save transform: nonexistent template
6973 !! options
6974 PST
6975 !! input
6976 {{thistemplatedoesnotexist}}
6977 !! result
6978 {{thistemplatedoesnotexist}}
6979 !! end
6980
6981
6982 !! test
6983 pre-save transform: subst magic variables
6984 !! options
6985 PST
6986 !! input
6987 {{subst:SITENAME}}
6988 !! result
6989 MediaWiki
6990 !! end
6991
6992 # This is bug 89, which I fixed. -- wtm
6993 !! test
6994 pre-save transform: subst: templates with parameters
6995 !! options
6996 pst
6997 !! input
6998 {{subst:paramtest|param="something else"}}
6999 !! result
7000 This is a test template with parameter "something else"
7001 !! end
7002
7003 !! article
7004 Template:nowikitest
7005 !! text
7006 <nowiki>'''not wiki'''</nowiki>
7007 !! endarticle
7008
7009 !! test
7010 pre-save transform: nowiki in subst (bug 1188)
7011 !! options
7012 pst
7013 !! input
7014 {{subst:nowikitest}}
7015 !! result
7016 <nowiki>'''not wiki'''</nowiki>
7017 !! end
7018
7019
7020 !! article
7021 Template:commenttest
7022 !! text
7023 This template has <!-- a comment --> in it.
7024 !! endarticle
7025
7026 !! test
7027 pre-save transform: comment in subst (bug 1936)
7028 !! options
7029 pst
7030 !! input
7031 {{subst:commenttest}}
7032 !! result
7033 This template has <!-- a comment --> in it.
7034 !! end
7035
7036 !! test
7037 pre-save transform: unclosed tag
7038 !! options
7039 pst noxml
7040 !! input
7041 <nowiki>'''not wiki'''
7042 !! result
7043 <nowiki>'''not wiki'''
7044 !! end
7045
7046 !! test
7047 pre-save transform: mixed tag case
7048 !! options
7049 pst noxml
7050 !! input
7051 <NOwiki>'''not wiki'''</noWIKI>
7052 !! result
7053 <NOwiki>'''not wiki'''</noWIKI>
7054 !! end
7055
7056 !! test
7057 pre-save transform: unclosed comment in <nowiki>
7058 !! options
7059 pst noxml
7060 !! input
7061 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7062 !! result
7063 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7064 !!end
7065
7066 # Leading @ in this template definition works around a limitation
7067 # in parsoid's parserTests which otherwise strips the <span> from the
7068 # result (confusing it for a template wrapper)
7069 !! article
7070 Template:dangerous
7071 !!text
7072 @<span onmouseover="alert('crap')">Oh no</span>
7073 !!endarticle
7074
7075 !!test
7076 (confirming safety of fix for subst bug 1936)
7077 !! input
7078 {{Template:dangerous}}
7079 !! result
7080 <p>@<span>Oh no</span>
7081 </p>
7082 !! end
7083
7084 !! test
7085 pre-save transform: comment containing gallery (bug 5024)
7086 !! options
7087 pst
7088 !! input
7089 <!-- <gallery>data</gallery> -->
7090 !!result
7091 <!-- <gallery>data</gallery> -->
7092 !!end
7093
7094 !! test
7095 pre-save transform: comment containing extension
7096 !! options
7097 pst
7098 !! input
7099 <!-- <tag>data</tag> -->
7100 !!result
7101 <!-- <tag>data</tag> -->
7102 !!end
7103
7104 !! test
7105 pre-save transform: comment containing nowiki
7106 !! options
7107 pst
7108 !! input
7109 <!-- <nowiki>data</nowiki> -->
7110 !!result
7111 <!-- <nowiki>data</nowiki> -->
7112 !!end
7113
7114 !! test
7115 pre-save transform: <noinclude> in subst (bug 3298)
7116 !! options
7117 pst
7118 !! input
7119 {{subst:Includes}}
7120 !! result
7121 Foobar
7122 !! end
7123
7124 !! test
7125 pre-save transform: <onlyinclude> in subst (bug 3298)
7126 !! options
7127 pst
7128 !! input
7129 {{subst:Includes2}}
7130 !! result
7131 Foo
7132 !! end
7133
7134 !! article
7135 Template:SubstTest
7136 !!text
7137 {{<includeonly>subst:</includeonly>Includes}}
7138 !! endarticle
7139
7140 !! article
7141 Template:SafeSubstTest
7142 !! text
7143 {{<includeonly>safesubst:</includeonly>Includes}}
7144 !! endarticle
7145
7146 !! test
7147 bug 22297: safesubst: works during PST
7148 !! options
7149 pst
7150 !! input
7151 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
7152 !! result
7153 FoobarFoobar
7154 !! end
7155
7156 !! test
7157 bug 22297: safesubst: works during normal parse
7158 !! input
7159 {{SafeSubstTest}}
7160 !! result
7161 <p>Foobar
7162 </p>
7163 !! end
7164
7165 !! test:
7166 subst: does not work during normal parse
7167 !! input
7168 {{SubstTest}}
7169 !! result
7170 <p>{{subst:Includes}}
7171 </p>
7172 !! end
7173
7174 !! test
7175 pre-save transform: context links ("pipe trick")
7176 !! options
7177 pst
7178 !! input
7179 [[Article (context)|]]
7180 [[Bar:Article|]]
7181 [[:Bar:Article|]]
7182 [[Bar:Article (context)|]]
7183 [[:Bar:Article (context)|]]
7184 [[|Article]]
7185 [[|Article (context)]]
7186 [[Bar:X (Y) Z|]]
7187 [[:Bar:X (Y) Z|]]
7188 !! result
7189 [[Article (context)|Article]]
7190 [[Bar:Article|Article]]
7191 [[:Bar:Article|Article]]
7192 [[Bar:Article (context)|Article]]
7193 [[:Bar:Article (context)|Article]]
7194 [[Article]]
7195 [[Article (context)]]
7196 [[Bar:X (Y) Z|X (Y) Z]]
7197 [[:Bar:X (Y) Z|X (Y) Z]]
7198 !! end
7199
7200 !! test
7201 pre-save transform: context links ("pipe trick") with interwiki prefix
7202 !! options
7203 pst
7204 !! input
7205 [[interwiki:Article|]]
7206 [[:interwiki:Article|]]
7207 [[interwiki:Bar:Article|]]
7208 [[:interwiki:Bar:Article|]]
7209 !! result
7210 [[interwiki:Article|Article]]
7211 [[:interwiki:Article|Article]]
7212 [[interwiki:Bar:Article|Bar:Article]]
7213 [[:interwiki:Bar:Article|Bar:Article]]
7214 !! end
7215
7216 !! test
7217 pre-save transform: context links ("pipe trick") with parens in title
7218 !! options
7219 pst title=[[Somearticle (context)]]
7220 !! input
7221 [[|Article]]
7222 !! result
7223 [[Article (context)|Article]]
7224 !! end
7225
7226 !! test
7227 pre-save transform: context links ("pipe trick") with comma in title
7228 !! options
7229 pst title=[[Someplace, Somewhere]]
7230 !! input
7231 [[|Otherplace]]
7232 [[Otherplace, Elsewhere|]]
7233 [[Otherplace, Elsewhere, Anywhere|]]
7234 !! result
7235 [[Otherplace, Somewhere|Otherplace]]
7236 [[Otherplace, Elsewhere|Otherplace]]
7237 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
7238 !! end
7239
7240 !! test
7241 pre-save transform: context links ("pipe trick") with parens and comma
7242 !! options
7243 pst title=[[Someplace (IGNORED), Somewhere]]
7244 !! input
7245 [[|Otherplace]]
7246 [[Otherplace (place), Elsewhere|]]
7247 !! result
7248 [[Otherplace, Somewhere|Otherplace]]
7249 [[Otherplace (place), Elsewhere|Otherplace]]
7250 !! end
7251
7252 !! test
7253 pre-save transform: context links ("pipe trick") with comma and parens
7254 !! options
7255 pst title=[[Who, me? (context)]]
7256 !! input
7257 [[|Yes, you.]]
7258 [[Me, Myself, and I (1937 song)|]]
7259 !! result
7260 [[Yes, you. (context)|Yes, you.]]
7261 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
7262 !! end
7263
7264 !! test
7265 pre-save transform: context links ("pipe trick") with namespace
7266 !! options
7267 pst title=[[Ns:Somearticle]]
7268 !! input
7269 [[|Article]]
7270 !! result
7271 [[Ns:Article|Article]]
7272 !! end
7273
7274 !! test
7275 pre-save transform: context links ("pipe trick") with namespace and parens
7276 !! options
7277 pst title=[[Ns:Somearticle (context)]]
7278 !! input
7279 [[|Article]]
7280 !! result
7281 [[Ns:Article (context)|Article]]
7282 !! end
7283
7284 !! test
7285 pre-save transform: context links ("pipe trick") with namespace and comma
7286 !! options
7287 pst title=[[Ns:Somearticle, Context, Whatever]]
7288 !! input
7289 [[|Article]]
7290 !! result
7291 [[Ns:Article, Context, Whatever|Article]]
7292 !! end
7293
7294 !! test
7295 pre-save transform: context links ("pipe trick") with namespace, comma and parens
7296 !! options
7297 pst title=[[Ns:Somearticle, Context (context)]]
7298 !! input
7299 [[|Article]]
7300 !! result
7301 [[Ns:Article (context)|Article]]
7302 !! end
7303
7304 !! test
7305 pre-save transform: context links ("pipe trick") with namespace, parens and comma
7306 !! options
7307 pst title=[[Ns:Somearticle (IGNORED), Context]]
7308 !! input
7309 [[|Article]]
7310 !! result
7311 [[Ns:Article, Context|Article]]
7312 !! end
7313
7314 !! test
7315 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
7316 !! options
7317 pst
7318 !! input
7319 [[Article(context)|]]
7320 [[Bar:Article(context)|]]
7321 [[:Bar:Article(context)|]]
7322 [[|Article(context)]]
7323 [[Bar:X(Y)Z|]]
7324 [[:Bar:X(Y)Z|]]
7325 !! result
7326 [[Article(context)|Article]]
7327 [[Bar:Article(context)|Article]]
7328 [[:Bar:Article(context)|Article]]
7329 [[Article(context)]]
7330 [[Bar:X(Y)Z|X(Y)Z]]
7331 [[:Bar:X(Y)Z|X(Y)Z]]
7332 !! end
7333
7334 !! test
7335 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
7336 !! options
7337 pst
7338 !! input
7339 [[Article (context)|]]
7340 [[Bar:Article (context)|]]
7341 [[:Bar:Article (context)|]]
7342 [[|Article (context)]]
7343 [[Bar:X (Y) Z|]]
7344 [[:Bar:X (Y) Z|]]
7345 !! result
7346 [[Article (context)|Article]]
7347 [[Bar:Article (context)|Article]]
7348 [[:Bar:Article (context)|Article]]
7349 [[Article (context)]]
7350 [[Bar:X (Y) Z|X (Y) Z]]
7351 [[:Bar:X (Y) Z|X (Y) Z]]
7352 !! end
7353
7354 !! test
7355 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
7356 !! options
7357 pst
7358 !! input
7359 [[Article(context)|]]
7360 [[Bar:Article(context)|]]
7361 [[:Bar:Article(context)|]]
7362 [[|Article(context)]]
7363 [[Bar:X(Y)Z|]]
7364 [[:Bar:X(Y)Z|]]
7365 !! result
7366 [[Article(context)|Article]]
7367 [[Bar:Article(context)|Article]]
7368 [[:Bar:Article(context)|Article]]
7369 [[Article(context)]]
7370 [[Bar:X(Y)Z|X(Y)Z]]
7371 [[:Bar:X(Y)Z|X(Y)Z]]
7372 !! end
7373
7374 !! test
7375 pre-save transform: context links ("pipe trick") with commas (bug 21660)
7376 !! options
7377 pst
7378 !! input
7379 [[Article (context), context|]]
7380 [[Article (context),context|]]
7381 [[Bar:Article (context), context|]]
7382 [[Bar:Article (context),context|]]
7383 [[:Bar:Article (context), context|]]
7384 [[:Bar:Article (context),context|]]
7385 !! result
7386 [[Article (context), context|Article]]
7387 [[Article (context),context|Article]]
7388 [[Bar:Article (context), context|Article]]
7389 [[Bar:Article (context),context|Article]]
7390 [[:Bar:Article (context), context|Article]]
7391 [[:Bar:Article (context),context|Article]]
7392 !! end
7393
7394 !! test
7395 pre-save transform: trim trailing empty lines
7396 !! options
7397 pst
7398 !! input
7399 Empty lines are trimmed
7400
7401
7402
7403
7404 !! result
7405 Empty lines are trimmed
7406 !! end
7407
7408 !! test
7409 pre-save transform: Signature expansion
7410 !! options
7411 pst
7412 !! input
7413 * ~~~
7414 * <noinclude>~~~</noinclude>
7415 * <includeonly>~~~</includeonly>
7416 * <onlyinclude>~~~</onlyinclude>
7417 !! result
7418 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
7419 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
7420 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
7421 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
7422 !! end
7423
7424
7425 !! test
7426 pre-save transform: Signature expansion in nowiki tags (bug 93)
7427 !! options
7428 pst disabled
7429 !! input
7430 Shall not expand:
7431
7432 <nowiki>~~~~</nowiki>
7433
7434 <includeonly><nowiki>~~~~</nowiki></includeonly>
7435
7436 <noinclude><nowiki>~~~~</nowiki></noinclude>
7437
7438 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7439
7440 {{subst:Foo}} shall be converted to FOO
7441
7442 As well as inside noinclude/onlyinclude
7443 <noinclude>{{subst:Foo}}</noinclude>
7444 <onlyinclude>{{subst:Foo}}</onlyinclude>
7445
7446 But not inside includeonly
7447 <includeonly>{{subst:Foo}}</includeonly>
7448 !! result
7449 Shall not expand:
7450
7451 <nowiki>~~~~</nowiki>
7452
7453 <includeonly><nowiki>~~~~</nowiki></includeonly>
7454
7455 <noinclude><nowiki>~~~~</nowiki></noinclude>
7456
7457 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7458
7459 FOO shall be converted to FOO
7460
7461 As well as inside noinclude/onlyinclude
7462 <noinclude>FOO</noinclude>
7463 <onlyinclude>FOO</onlyinclude>
7464
7465 But not inside includeonly
7466 <includeonly>{{subst:Foo}}</includeonly>
7467 !! end
7468
7469 ###
7470 ### Message transform tests
7471 ###
7472 !! test
7473 message transform: magic variables
7474 !! options
7475 msg
7476 !! input
7477 {{SITENAME}}
7478 !! result
7479 MediaWiki
7480 !! end
7481
7482 !! test
7483 message transform: should not transform wiki markup
7484 !! options
7485 msg
7486 !! input
7487 ''test''
7488 !! result
7489 ''test''
7490 !! end
7491
7492 !! test
7493 message transform: <noinclude> in transcluded template (bug 4926)
7494 !! options
7495 msg
7496 !! input
7497 {{Includes}}
7498 !! result
7499 Foobar
7500 !! end
7501
7502 !! test
7503 message transform: <onlyinclude> in transcluded template (bug 4926)
7504 !! options
7505 msg
7506 !! input
7507 {{Includes2}}
7508 !! result
7509 Foo
7510 !! end
7511
7512 !! test
7513 {{#special:}} page name, known
7514 !! options
7515 msg
7516 !! input
7517 {{#special:Recentchanges}}
7518 !! result
7519 Special:RecentChanges
7520 !! end
7521
7522 !! test
7523 {{#special:}} page name with subpage, known
7524 !! options
7525 msg
7526 !! input
7527 {{#special:Recentchanges/param}}
7528 !! result
7529 Special:RecentChanges/param
7530 !! end
7531
7532 !! test
7533 {{#special:}} page name, unknown
7534 !! options
7535 msg
7536 !! input
7537 {{#special:foobar nonexistent}}
7538 !! result
7539 Special:Foobar nonexistent
7540 !! end
7541
7542 !! test
7543 {{#speciale:}} page name, known
7544 !! options
7545 msg
7546 !! input
7547 {{#speciale:Recentchanges}}
7548 !! result
7549 Special:RecentChanges
7550 !! end
7551
7552 !! test
7553 {{#speciale:}} page name with subpage, known
7554 !! options
7555 msg
7556 !! input
7557 {{#speciale:Recentchanges/param}}
7558 !! result
7559 Special:RecentChanges/param
7560 !! end
7561
7562 !! test
7563 {{#speciale:}} page name, unknown
7564 !! options
7565 msg
7566 !! input
7567 {{#speciale:foobar nonexistent}}
7568 !! result
7569 Special:Foobar_nonexistent
7570 !! end
7571
7572 ###
7573 ### Images
7574 ###
7575 !! test
7576 Simple image
7577 !! input
7578 [[Image:foobar.jpg]]
7579 !! result
7580 <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>
7581 </p>
7582 !! end
7583
7584 !! test
7585 Right-aligned image
7586 !! input
7587 [[Image:foobar.jpg|right]]
7588 !! result
7589 <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>
7590
7591 !! end
7592
7593 !! test
7594 Simple image (using File: namespace, now canonical)
7595 !! input
7596 [[File:foobar.jpg]]
7597 !! result
7598 <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>
7599 </p>
7600 !! end
7601
7602 !! test
7603 Image with caption
7604 !! input
7605 [[Image:foobar.jpg|right|Caption text]]
7606 !! result
7607 <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>
7608
7609 !! end
7610
7611 !! test
7612 Image with empty attribute
7613 !! input
7614 [[Image:foobar.jpg|right||Caption text]]
7615 !! result
7616 <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>
7617
7618 !! end
7619
7620 !! test
7621 Image with link tails
7622 !! input
7623 123[[Image:foobar.jpg]]456
7624 123[[Image:foobar.jpg|right]]456
7625 123[[Image:foobar.jpg|thumb]]456
7626 !! result
7627 <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
7628 </p>
7629 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
7630 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
7631
7632 !! end
7633
7634 !! test
7635 Image with multiple captions -- only last one is accepted
7636 !! input
7637 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
7638 !! result
7639 <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>
7640
7641 !! end
7642
7643 !! test
7644 Image with width attribute at different positions
7645 !! input
7646 [[Image:foobar.jpg|200px|right|Caption]]
7647 [[Image:foobar.jpg|right|200px|Caption]]
7648 [[Image:foobar.jpg|right|Caption|200px]]
7649 !! result
7650 <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>
7651 <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>
7652 <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>
7653
7654 !! end
7655
7656 !! test
7657 Image with link parameter, wiki target
7658 !! input
7659 [[Image:foobar.jpg|link=Target page]]
7660 !! result
7661 <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>
7662 </p>
7663 !! end
7664
7665 !! test
7666 Image with link parameter, URL target
7667 !! input
7668 [[Image:foobar.jpg|link=http://example.com/]]
7669 !! result
7670 <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>
7671 </p>
7672 !! end
7673
7674 !! test
7675 Image with link parameter, wgExternalLinkTarget
7676 !! input
7677 [[Image:foobar.jpg|link=http://example.com/]]
7678 !! config
7679 wgExternalLinkTarget='foobar'
7680 !! result
7681 <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>
7682 </p>
7683 !! end
7684
7685 !! test
7686 Image with link parameter, wgNoFollowLinks set to false
7687 !! input
7688 [[Image:foobar.jpg|link=http://example.com/]]
7689 !! config
7690 wgNoFollowLinks=false
7691 !! result
7692 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7693 </p>
7694 !! end
7695
7696 !! test
7697 Image with link parameter, wgNoFollowDomainExceptions
7698 !! input
7699 [[Image:foobar.jpg|link=http://example.com/]]
7700 !! config
7701 wgNoFollowDomainExceptions='example.com'
7702 !! result
7703 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7704 </p>
7705 !! end
7706
7707 !! test
7708 Image with link parameter, wgExternalLinkTarget, unnamed parameter
7709 !! input
7710 [[Image:foobar.jpg|link=http://example.com/|Title]]
7711 !! config
7712 wgExternalLinkTarget='foobar'
7713 !! result
7714 <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>
7715 </p>
7716 !! end
7717
7718 !! test
7719 Image with empty link parameter
7720 !! input
7721 [[Image:foobar.jpg|link=]]
7722 !! result
7723 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
7724 </p>
7725 !! end
7726
7727 !! test
7728 Image with link parameter (wiki target) and unnamed parameter
7729 !! input
7730 [[Image:foobar.jpg|link=Target page|Title]]
7731 !! result
7732 <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>
7733 </p>
7734 !! end
7735
7736 !! test
7737 Image with link parameter (URL target) and unnamed parameter
7738 !! input
7739 [[Image:foobar.jpg|link=http://example.com/|Title]]
7740 !! result
7741 <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>
7742 </p>
7743 !! end
7744
7745 !! test
7746 Thumbnail image with link parameter
7747 !! options
7748 php
7749 !! input
7750 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
7751 !! result
7752 <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>
7753
7754 !! end
7755
7756 !! test
7757 Manually-specified thumbnail image
7758 !! options
7759 php
7760 !! input
7761 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
7762 !! result
7763 <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>
7764
7765 !! end
7766
7767 !! test
7768 Manually-specified thumbnail image with explicit link to wiki page
7769 !! options
7770 php
7771 !! input
7772 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
7773 !! result
7774 <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>
7775
7776 !! end
7777
7778 !! test
7779 Manually-specified thumbnail image with explicit link to url
7780 !! options
7781 php
7782 !! input
7783 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
7784 !! result
7785 <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>
7786
7787 !! end
7788
7789 !! test
7790 Manually-specified thumbnail image with explicit no link
7791 !! options
7792 php
7793 !! input
7794 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
7795 !! result
7796 <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>
7797
7798 !! end
7799
7800 !! test
7801 Manually-specified thumbnail image with explicit link and alt text
7802 !! options
7803 php
7804 !! input
7805 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
7806 !! result
7807 <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>
7808
7809 !! end
7810
7811 !! test
7812 Image with frame and link
7813 !! input
7814 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
7815 !! result
7816 <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>
7817
7818 !! end
7819
7820 !! test
7821 Image with frame and link and explicit alt
7822 !! input
7823 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
7824 !! result
7825 <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>
7826
7827 !! end
7828
7829 !! test
7830 Image with wiki markup in implicit alt
7831 !! input
7832 [[Image:Foobar.jpg|testing '''bold''' in alt]]
7833 !! result
7834 <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>
7835 </p>
7836 !! end
7837
7838 !! test
7839 Image with wiki markup in explicit alt
7840 !! input
7841 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
7842 !! result
7843 <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>
7844 </p>
7845 !! end
7846
7847 !! test
7848 Link to image page- image page normally doesn't exists, hence edit link
7849 Add test with existing image page
7850 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
7851 !! input
7852 [[:Image:test]]
7853 !! result
7854 <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>
7855 </p>
7856 !! end
7857
7858 !! test
7859 bug 18784 Link to non-existent image page with caption should use caption as link text
7860 !! input
7861 [[:Image:test|caption]]
7862 !! result
7863 <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>
7864 </p>
7865 !! end
7866
7867 !! test
7868 Frameless image caption with a free URL
7869 !! input
7870 [[Image:foobar.jpg|http://example.com]]
7871 !! result
7872 <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>
7873 </p>
7874 !! end
7875
7876 !! test
7877 Thumbnail image caption with a free URL
7878 !! input
7879 [[Image:foobar.jpg|thumb|http://example.com]]
7880 !! result
7881 <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>
7882
7883 !! end
7884
7885 !! test
7886 Thumbnail image caption with a free URL and explicit alt
7887 !! input
7888 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
7889 !! result
7890 <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>
7891
7892 !! end
7893
7894
7895 !! test
7896 SVG thumbnails with no language set
7897 !! options
7898 !! input
7899 [[File:Foobar.svg|thumb|width=200]]
7900 !! result
7901 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="180" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>width=200</div></div></div>
7902
7903 !! end
7904
7905 !! test
7906 SVG thumbnails with language de
7907 !! options
7908 !! input
7909 [[File:Foobar.svg|thumb|width=200|lang=de]]
7910 !! result
7911 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=File:Foobar.svg&amp;lang=de" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/langde-180px-Foobar.svg.png" width="180" height="180" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/langde-270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/langde-360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>width=200</div></div></div>
7912
7913 !! end
7914
7915 !! test
7916 SVG thumbnails with invalid language code
7917 !! options
7918 !! input
7919 [[File:Foobar.svg|thumb|width=200|lang=invalid.language.code]]
7920 !! result
7921 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="180" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>lang=invalid.language.code</div></div></div>
7922
7923 !! end
7924
7925 !! test
7926 BUG 1887: A ISBN with a thumbnail
7927 !! input
7928 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
7929 !! result
7930 <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>
7931
7932 !! end
7933
7934 !! test
7935 BUG 1887: A RFC with a thumbnail
7936 !! input
7937 [[Image:foobar.jpg|thumb|This is RFC 12354]]
7938 !! result
7939 <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>
7940
7941 !! end
7942
7943 !! test
7944 BUG 1887: A mailto link with a thumbnail
7945 !! input
7946 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
7947 !! result
7948 <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>
7949
7950 !! end
7951
7952 # Pending resolution to bug 368
7953 !! test
7954 BUG 648: Frameless image caption with a link
7955 !! input
7956 [[Image:foobar.jpg|text with a [[link]] in it]]
7957 !! result
7958 <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>
7959 </p>
7960 !! end
7961
7962 !! test
7963 BUG 648: Frameless image caption with a link (suffix)
7964 !! input
7965 [[Image:foobar.jpg|text with a [[link]]foo in it]]
7966 !! result
7967 <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>
7968 </p>
7969 !! end
7970
7971 !! test
7972 BUG 648: Frameless image caption with an interwiki link
7973 !! input
7974 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
7975 !! result
7976 <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>
7977 </p>
7978 !! end
7979
7980 !! test
7981 BUG 648: Frameless image caption with a piped interwiki link
7982 !! input
7983 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
7984 !! result
7985 <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>
7986 </p>
7987 !! end
7988
7989 !! test
7990 Escape HTML special chars in image alt text
7991 !! input
7992 [[Image:foobar.jpg|& < > "]]
7993 !! result
7994 <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>
7995 </p>
7996 !! end
7997
7998 !! test
7999 BUG 499: Alt text should have &#1234;, not &amp;1234;
8000 !! input
8001 [[Image:foobar.jpg|&#9792;]]
8002 !! result
8003 <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>
8004 </p>
8005 !! end
8006
8007 !! test
8008 Broken image caption with link
8009 !! input
8010 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
8011 !! result
8012 <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.
8013 </p>
8014 !! end
8015
8016 !! test
8017 Image caption containing another image
8018 !! input
8019 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
8020 !! result
8021 <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>
8022
8023 !! end
8024
8025 !! test
8026 Image caption containing a newline
8027 !! input
8028 [[Image:Foobar.jpg|This
8029 *is some text]]
8030 !! result
8031 <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>
8032 </p>
8033 !!end
8034
8035 !!test
8036 Parsoid: Image caption containing leading space
8037 (The leading space should not trigger nowiki escaping in wt2wt mode)
8038 !! input
8039 [[Image:Foobar.jpg|thumb| bar]]
8040 !! result
8041 <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>
8042
8043 !!end
8044
8045 !! test
8046 Bug 3090: External links other than http: in image captions
8047 !! input
8048 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
8049 !! result
8050 <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>
8051
8052 !! end
8053
8054 !! test
8055 Custom class
8056 !! input
8057 [[Image:foobar.jpg|a|class=b]]
8058 !! result
8059 <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>
8060 </p>
8061 !! end
8062
8063 !! test
8064 Localized image handling (1).
8065 !! options
8066 language=es
8067 !! input
8068 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
8069 !! result
8070 <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>
8071
8072 !! end
8073
8074 !! test
8075 Localized image handling (2).
8076 !! options
8077 language=es
8078 !! input
8079 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
8080 !! result
8081 <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>
8082
8083 !! end
8084
8085 !! test
8086 "border", "frameless" and "class" attributes on an image.
8087 !! input
8088 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
8089 !! result
8090 <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>
8091 </p>
8092 !! end
8093
8094 !! article
8095 File:Barfoo.jpg
8096 !! text
8097 #REDIRECT [[File:Barfoo.jpg]]
8098 !! endarticle
8099
8100 !! test
8101 Redirected image
8102 !! input
8103 [[Image:Barfoo.jpg]]
8104 !! result
8105 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
8106 </p>
8107 !! end
8108
8109 !! test
8110 Missing image with uploads disabled
8111 !! options
8112 wgEnableUploads=0
8113 !! input
8114 [[Image:Foobaz.jpg]]
8115 !! result
8116 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
8117 </p>
8118 !! end
8119
8120 # Parsoid-specific testing for images
8121 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
8122 # Currently imperfect due to a flaw in the Parsoid testrunner
8123 # Work in progress
8124
8125 !! test
8126 Parsoid-specific image handling - simple image
8127 !! options
8128 parsoid
8129 !! input
8130 [[Image:Foobar.jpg]]
8131 !! result
8132 <p>
8133 <span class="mw-default-size" typeof="mw:Image">
8134 <a href="File:Foobar.jpg">
8135 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8136 </a>
8137 </span>
8138 </p>
8139 !! end
8140
8141 !! test
8142 Parsoid-specific image handling - simple image without link
8143 !! options
8144 parsoid
8145 !! input
8146 [[Image:Foobar.jpg|link=]]
8147 !! result
8148 <p>
8149 <span class="mw-default-size" typeof="mw:Image">
8150 <span>
8151 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8152 </span>
8153 </span>
8154 </p>
8155 !! end
8156
8157 !! test
8158 Parsoid-specific image handling - simple image with specific link
8159 !! options
8160 parsoid
8161 !! input
8162 [[Image:Foobar.jpg|link=Main Page]]
8163 !! result
8164 <p>
8165 <span class="mw-default-size" typeof="mw:Image">
8166 <a href="Main_Page">
8167 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8168 </a>
8169 </span>
8170 </p>
8171 !! end
8172
8173 !! test
8174 Parsoid-specific image handling - simple image with size and middle alignment
8175 !! options
8176 parsoid
8177 !! input
8178 [[Image:Foobar.jpg|50px|middle]]
8179 !! result
8180 <p>
8181 <span class="mw-valign-middle" typeof="mw:Image">
8182 <a href="File:Foobar.jpg">
8183 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8184 </a>
8185 </span>
8186 </p>
8187 !! end
8188
8189 !! test
8190 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
8191 !! options
8192 parsoid
8193 !! input
8194 [[Image:Foobar.jpg|500x10px|baseline|caption]]
8195 !! result
8196 <p>
8197 <span class="mw-valign-baseline" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8198 <a href="File:Foobar.jpg">
8199 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89">
8200 </a>
8201 </span>
8202 </p>
8203 !! end
8204
8205 !! test
8206 Parsoid-specific image handling - simple image with border and size spec
8207 !! options
8208 parsoid
8209 !! input
8210 [[Image:Foobar.jpg|50px|border|caption]]
8211 !! result
8212 <p>
8213 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8214 <a href="File:Foobar.jpg">
8215 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8216 </a>
8217 </span>
8218 </p>
8219 !! end
8220
8221 !! test
8222 Parsoid-specific image handling - thumbnail with halign, valign, and caption
8223 !! options
8224 parsoid
8225 !! input
8226 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
8227 !! result
8228 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
8229 <a href="File:Foobar.jpg">
8230 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/180px-Foobar.jpg" height="21" width="180" />
8231 </a>
8232 <figcaption>caption content</figcaption>
8233 </figure>
8234 !! end
8235
8236 !! test
8237 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
8238 !! options
8239 parsoid
8240 !! input
8241 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
8242 !! result
8243 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
8244 <a href="File:Foobar.jpg">
8245 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
8246 </a>
8247 <figcaption>caption</figcaption>
8248 </figure>
8249 !! end
8250
8251 !! test
8252 Parsoid-specific image handling - framed image with specific size and caption
8253 !! options
8254 parsoid
8255 !! input
8256 [[Image:Foobar.jpg|500x50px|frame|caption]]
8257 !! result
8258 <figure typeof="mw:Image/Frame">
8259 <a href="File:Foobar.jpg">
8260 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8261 </a>
8262 <figcaption>caption</figcaption>
8263 </figure>
8264 !! end
8265
8266 !! test
8267 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
8268 !! options
8269 parsoid
8270 !! input
8271 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
8272 !! result
8273 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
8274 <a href="File:Foobar.jpg">
8275 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8276 </a>
8277 <figcaption>caption</figcaption>
8278 </figure>
8279 !! end
8280
8281 !! test
8282 Parsoid-specific image handling - frameless image with specific size, border, and caption
8283 !! options
8284 parsoid
8285 !! input
8286 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
8287 !! result
8288 <p>
8289 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8290 <a href="File:Foobar.jpg">
8291 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8292 </a>
8293 </p>
8294 !! end
8295
8296 #!! test
8297 #Parsoid-specific image handling - simple image with a formatted caption
8298 #!! options
8299 #parsoid
8300 #!! input
8301 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
8302 #!! result
8303 #<p>
8304 #<span typeof="mw:Image">
8305 #<a class="mw-default-size" href="Image:Foobar.jpg">
8306 #<img alt="Foobar.jpg" class="mw-default-size" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8307 #</a>
8308 #<span>abc</span>
8309 #</span>
8310 #</p>
8311
8312
8313 ###
8314 ### Subpages
8315 ###
8316 !! article
8317 Subpage test/subpage
8318 !! text
8319 foo
8320 !! endarticle
8321
8322 !! test
8323 Subpage link
8324 !! options
8325 subpage title=[[Subpage test]]
8326 !! input
8327 [[/subpage]]
8328 !! result
8329 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
8330 </p>
8331 !! end
8332
8333 !! test
8334 Subpage noslash link
8335 !! options
8336 subpage title=[[Subpage test]]
8337 !!input
8338 [[/subpage/]]
8339 !! result
8340 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
8341 </p>
8342 !! end
8343
8344 !! test
8345 Disabled subpages
8346 !! input
8347 [[/subpage]]
8348 !! result
8349 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
8350 </p>
8351 !! end
8352
8353 !! test
8354 BUG 561: {{/Subpage}}
8355 !! options
8356 subpage title=[[Page]]
8357 !! input
8358 {{/Subpage}}
8359 !! result
8360 <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>
8361 </p>
8362 !! end
8363
8364 ###
8365 ### Categories
8366 ###
8367 !! article
8368 Category:MediaWiki User's Guide
8369 !! text
8370 blah
8371 !! endarticle
8372
8373 !! test
8374 Link to category
8375 !! input
8376 [[:Category:MediaWiki User's Guide]]
8377 !! result
8378 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
8379 </p>
8380 !! end
8381
8382 !! test
8383 Simple category
8384 !! options
8385 cat
8386 !! input
8387 [[Category:MediaWiki User's Guide]]
8388 !! result
8389 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8390 !! end
8391
8392 !! test
8393 PAGESINCATEGORY invalid title fatal (r33546 fix)
8394 !! input
8395 {{PAGESINCATEGORY:<bogus>}}
8396 !! result
8397 <p>0
8398 </p>
8399 !! end
8400
8401 !! test
8402 Category with different sort key
8403 !! options
8404 cat
8405 !! input
8406 [[Category:MediaWiki User's Guide|Foo]]
8407 !! result
8408 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8409 !! end
8410
8411 !! test
8412 Category with identical sort key
8413 !! options
8414 cat
8415 !! input
8416 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8417 !! result
8418 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8419 !! end
8420
8421 !! test
8422 Category with empty sort key
8423 !! options
8424 cat
8425 pst
8426 !! input
8427 [[Category:MediaWiki User's Guide|]]
8428 !! result
8429 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8430 !! end
8431
8432 !! test
8433 Category with empty sort key and parentheses
8434 !! options
8435 cat
8436 pst
8437 !! input
8438 [[Category:Foo (bar)|]]
8439 !! result
8440 [[Category:Foo (bar)|Foo]]
8441 !! end
8442
8443 !! test
8444 Category with link tail
8445 !! options
8446 cat
8447 pst
8448 !! input
8449 123[[Category:Foo]]456
8450 !! result
8451 123[[Category:Foo]]456
8452 !! end
8453
8454 !! test
8455 Category with template
8456 !! options
8457 cat
8458 pst
8459 !! input
8460 [[Category:{{echo|Foo}}]]
8461 !! result
8462 [[Category:{{echo|Foo}}]]
8463 !! end
8464
8465 !! test
8466 Category with template in sort key
8467 !! options
8468 cat
8469 pst
8470 !! input
8471 [[Category:Foo|{{echo|Bar}}]]
8472 !! result
8473 [[Category:Foo|{{echo|Bar}}]]
8474 !! end
8475
8476 !! test
8477 Category with template in sort key and title
8478 !! options
8479 cat
8480 pst
8481 !! input
8482 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8483 !! result
8484 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8485 !! end
8486
8487 !! test
8488 Category / paragraph interactions
8489 !! input
8490 Foo [[Category:Baz]] Bar
8491
8492 Foo [[Category:Baz]]
8493 Bar
8494
8495 Foo
8496 [[Category:Baz]]
8497 Bar
8498
8499 Foo
8500 [[Category:Baz]] Bar
8501
8502 Foo
8503 [[Category:Baz]]
8504 [[Category:Baz]]
8505 [[Category:Baz]]
8506 Bar
8507
8508 [[Category:Baz]]
8509 [[Category:Baz]]
8510 [[Category:Baz]]
8511
8512 [[Category:Baz]]
8513 {{echo|[[Category:Baz]]}}
8514 [[Category:Baz]]
8515 !! result
8516 <p>Foo Bar
8517 </p><p>Foo
8518 Bar
8519 </p><p>Foo
8520 Bar
8521 </p><p>Foo Bar
8522 </p><p>Foo
8523 Bar
8524 </p>
8525 !! end
8526
8527 !! test
8528 Parsoid: Serialize link to category page with colon escape
8529 !! options
8530 parsoid
8531 !! input
8532
8533 [[:Category:Foo]]
8534 [[:Category:Foo|Bar]]
8535 !! result
8536 <p>
8537 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
8538 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
8539 </p>
8540 !! end
8541
8542 !! test
8543 Parsoid: Serialize link to file page with colon escape
8544 !! options
8545 parsoid
8546 !! input
8547
8548 [[:File:Foo.png]]
8549 [[:File:Foo.png|Bar]]
8550 !! result
8551 <p>
8552 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
8553 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
8554 </p>
8555 !! end
8556
8557 !! test
8558 Parsoid: Serialize a genuine category link without colon escape
8559 !! options
8560 parsoid
8561 !! input
8562 [[Category:Foo]]
8563 [[Category:Foo|Bar]]
8564 !! result
8565 <link rel="mw:WikiLink/Category" href="Category:Foo">
8566 <link rel="mw:WikiLink/Category" href="Category:Foo#Bar">
8567 !! end
8568
8569 ###
8570 ### Inter-language links
8571 ###
8572 !! test
8573 Inter-language links
8574 !! options
8575 ill
8576 !! input
8577 [[es:Alimento]]
8578 [[fr:Nourriture]]
8579 [[zh:&#39135;&#21697;]]
8580 !! result
8581 es:Alimento fr:Nourriture zh:食品
8582 !! end
8583
8584 !! test
8585 Duplicate interlanguage links (bug 24502)
8586 !! options
8587 ill
8588 !! input
8589 [[es:1]]
8590 [[es:2]]
8591 [[fr:1]]
8592 [[fr:2]]
8593 !! result
8594 es:1 fr:1
8595 !! end
8596
8597 ###
8598 ### Sections
8599 ###
8600 !! test
8601 Basic section headings
8602 !! input
8603 == Headline 1 ==
8604 Some text
8605
8606 ==Headline 2==
8607 More
8608 ===Smaller headline===
8609 Blah blah
8610 !! result
8611 <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>
8612 <p>Some text
8613 </p>
8614 <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>
8615 <p>More
8616 </p>
8617 <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>
8618 <p>Blah blah
8619 </p>
8620 !! end
8621
8622 !! test
8623 Section headings with TOC
8624 !! input
8625 == Headline 1 ==
8626 === Subheadline 1 ===
8627 ===== Skipping a level =====
8628 ====== Skipping a level ======
8629
8630 == Headline 2 ==
8631 Some text
8632 ===Another headline===
8633 !! result
8634 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8635 <ul>
8636 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
8637 <ul>
8638 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
8639 <ul>
8640 <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>
8641 <ul>
8642 <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>
8643 </ul>
8644 </li>
8645 </ul>
8646 </li>
8647 </ul>
8648 </li>
8649 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
8650 <ul>
8651 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
8652 </ul>
8653 </li>
8654 </ul>
8655 </div>
8656 <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>
8657 <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>
8658 <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>
8659 <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>
8660 <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>
8661 <p>Some text
8662 </p>
8663 <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>
8664
8665 !! end
8666
8667 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
8668 !! test
8669 Handling of sections up to level 6 and beyond
8670 !! input
8671 = Level 1 Heading=
8672 == Level 2 Heading==
8673 === Level 3 Heading===
8674 ==== Level 4 Heading====
8675 ===== Level 5 Heading=====
8676 ====== Level 6 Heading======
8677 ======= Level 7 Heading=======
8678 ======== Level 8 Heading========
8679 ========= Level 9 Heading=========
8680 ========== Level 10 Heading==========
8681 !! result
8682 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8683 <ul>
8684 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
8685 <ul>
8686 <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>
8687 <ul>
8688 <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>
8689 <ul>
8690 <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>
8691 <ul>
8692 <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>
8693 <ul>
8694 <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>
8695 <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>
8696 <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>
8697 <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>
8698 <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>
8699 </ul>
8700 </li>
8701 </ul>
8702 </li>
8703 </ul>
8704 </li>
8705 </ul>
8706 </li>
8707 </ul>
8708 </li>
8709 </ul>
8710 </div>
8711 <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>
8712 <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>
8713 <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>
8714 <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>
8715 <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>
8716 <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>
8717 <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>
8718 <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>
8719 <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>
8720 <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>
8721
8722 !! end
8723
8724 !! test
8725 TOC regression (bug 9764)
8726 !! input
8727 == title 1 ==
8728 === title 1.1 ===
8729 ==== title 1.1.1 ====
8730 === title 1.2 ===
8731 == title 2 ==
8732 === title 2.1 ===
8733 !! result
8734 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8735 <ul>
8736 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8737 <ul>
8738 <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>
8739 <ul>
8740 <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>
8741 </ul>
8742 </li>
8743 <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>
8744 </ul>
8745 </li>
8746 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8747 <ul>
8748 <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>
8749 </ul>
8750 </li>
8751 </ul>
8752 </div>
8753 <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>
8754 <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>
8755 <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>
8756 <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>
8757 <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>
8758 <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>
8759
8760 !! end
8761
8762 !! test
8763 TOC with wgMaxTocLevel=3 (bug 6204)
8764 !! options
8765 wgMaxTocLevel=3
8766 !! input
8767 == title 1 ==
8768 === title 1.1 ===
8769 ==== title 1.1.1 ====
8770 === title 1.2 ===
8771 == title 2 ==
8772 === title 2.1 ===
8773 !! result
8774 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8775 <ul>
8776 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8777 <ul>
8778 <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>
8779 <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>
8780 </ul>
8781 </li>
8782 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8783 <ul>
8784 <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>
8785 </ul>
8786 </li>
8787 </ul>
8788 </div>
8789 <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>
8790 <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>
8791 <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>
8792 <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>
8793 <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>
8794 <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>
8795
8796 !! end
8797
8798 !! test
8799 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
8800 !! options
8801 wgMaxTocLevel=3
8802 !! input
8803 ==Section 1==
8804 ===Section 1.1===
8805 ====Section 1.1.1====
8806 ====Section 1.1.1.1====
8807 ==Section 2==
8808 !! result
8809 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8810 <ul>
8811 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
8812 <ul>
8813 <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>
8814 </ul>
8815 </li>
8816 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
8817 </ul>
8818 </div>
8819 <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>
8820 <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>
8821 <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>
8822 <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>
8823 <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>
8824
8825 !! end
8826
8827
8828 !! test
8829 Resolving duplicate section names
8830 !! input
8831 == Foo bar ==
8832 == Foo bar ==
8833 !! result
8834 <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>
8835 <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>
8836
8837 !! end
8838
8839 !! test
8840 Resolving duplicate section names with differing case (bug 10721)
8841 !! input
8842 == Foo bar ==
8843 == Foo Bar ==
8844 !! result
8845 <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>
8846 <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>
8847
8848 !! end
8849
8850 !! article
8851 Template:sections
8852 !! text
8853 ===Section 1===
8854 ==Section 2==
8855 !! endarticle
8856
8857 !! test
8858 Template with sections, __NOTOC__
8859 !! input
8860 __NOTOC__
8861 ==Section 0==
8862 {{sections}}
8863 ==Section 4==
8864 !! result
8865 <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>
8866 <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>
8867 <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>
8868 <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>
8869
8870 !! end
8871
8872 !! test
8873 __NOEDITSECTION__ keyword
8874 !! input
8875 __NOEDITSECTION__
8876 ==Section 1==
8877 ==Section 2==
8878 !! result
8879 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
8880 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
8881
8882 !! end
8883
8884 !! test
8885 Link inside a section heading
8886 !! input
8887 ==Section with a [[Main Page|link]] in it==
8888 !! result
8889 <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>
8890
8891 !! end
8892
8893 !! test
8894 TOC regression (bug 12077)
8895 !! input
8896 __TOC__
8897 == title 1 ==
8898 === title 1.1 ===
8899 == title 2 ==
8900 !! result
8901 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8902 <ul>
8903 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8904 <ul>
8905 <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>
8906 </ul>
8907 </li>
8908 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
8909 </ul>
8910 </div>
8911 <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>
8912 <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>
8913 <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>
8914
8915 !! end
8916
8917 !! test
8918 BUG 1219 URL next to image (good)
8919 !! input
8920 http://example.com [[Image:foobar.jpg]]
8921 !! result
8922 <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>
8923 </p>
8924 !!end
8925
8926 !! test
8927 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
8928 !! input
8929 ===
8930 The line above must have a trailing space!
8931 === <!--
8932 --> <!-- -->
8933 But just in case it doesn't...
8934 !! result
8935 <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>
8936 <p>The line above must have a trailing space!
8937 </p>
8938 <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>
8939 <p>But just in case it doesn't...
8940 </p>
8941 !! end
8942
8943 !! test
8944 Header with special characters (bug 25462)
8945 !! input
8946 The tooltips shall not show entities to the user (ie. be double escaped)
8947
8948 == text > text ==
8949 section 1
8950
8951 == text < text ==
8952 section 2
8953
8954 == text & text ==
8955 section 3
8956
8957 == text ' text ==
8958 section 4
8959
8960 == text " text ==
8961 section 5
8962 !! result
8963 <p>The tooltips shall not show entities to the user (ie. be double escaped)
8964 </p>
8965 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8966 <ul>
8967 <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>
8968 <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>
8969 <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>
8970 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
8971 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
8972 </ul>
8973 </div>
8974 <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>
8975 <p>section 1
8976 </p>
8977 <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>
8978 <p>section 2
8979 </p>
8980 <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>
8981 <p>section 3
8982 </p>
8983 <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>
8984 <p>section 4
8985 </p>
8986 <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>
8987 <p>section 5
8988 </p>
8989 !! end
8990
8991 !! test
8992 Headers with excess '=' characters
8993 (Are similar tests necessary beyond the 1st level?)
8994 !! input
8995 =foo==
8996 ==foo=
8997 =''italic'' heading==
8998 ==''italic'' heading=
8999 !! result
9000 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9001 <ul>
9002 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
9003 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
9004 <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>
9005 <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>
9006 </ul>
9007 </div>
9008 <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>
9009 <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>
9010 <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>
9011 <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>
9012
9013 !! end
9014
9015 !! test
9016 HTML headers vs TOC (bug 23393)
9017 (__NOEDITSECTION__ for clearer output, doesn't matter here)
9018 !! input
9019 <h1>Header 1</h1>
9020 == Header 1.1 ==
9021 == Header 1.2 ==
9022
9023 <h1>Header 2
9024 </h1>
9025 == Header 2.1 ==
9026 == Header 2.2 ==
9027 __NOEDITSECTION__
9028 !! result
9029 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9030 <ul>
9031 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
9032 <ul>
9033 <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>
9034 <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>
9035 </ul>
9036 </li>
9037 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
9038 <ul>
9039 <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>
9040 <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>
9041 </ul>
9042 </li>
9043 </ul>
9044 </div>
9045 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
9046 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
9047 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
9048 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
9049 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
9050 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
9051
9052 !! end
9053
9054 !! test
9055 BUG 1219 URL next to image (broken)
9056 !! input
9057 http://example.com[[Image:foobar.jpg]]
9058 !! result
9059 <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>
9060 </p>
9061 !!end
9062
9063 !! test
9064 Bug 1186 news: in the middle of text
9065 !! input
9066 http://en.wikinews.org/wiki/Wikinews:Workplace
9067 !! result
9068 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
9069 </p>
9070 !!end
9071
9072
9073 !! test
9074 Namespaced link must have a title
9075 !! input
9076 [[Project:]]
9077 !! result
9078 <p>[[Project:]]
9079 </p>
9080 !!end
9081
9082 !! test
9083 Namespaced link must have a title (bad fragment version)
9084 !! input
9085 [[Project:#fragment]]
9086 !! result
9087 <p>[[Project:#fragment]]
9088 </p>
9089 !!end
9090
9091
9092 ###
9093 ### HTML tags and HTML attributes
9094 ###
9095
9096 !! test
9097 div with no attributes
9098 !! input
9099 <div>HTML rocks</div>
9100 !! result
9101 <div>HTML rocks</div>
9102
9103 !! end
9104
9105 !! test
9106 div with double-quoted attribute
9107 !! input
9108 <div id="rock">HTML rocks</div>
9109 !! result
9110 <div id="rock">HTML rocks</div>
9111
9112 !! end
9113
9114 !! test
9115 div with single-quoted attribute
9116 !! input
9117 <div id='rock'>HTML rocks</div>
9118 !! result
9119 <div id="rock">HTML rocks</div>
9120
9121 !! end
9122
9123 !! test
9124 div with unquoted attribute
9125 !! input
9126 <div id=rock>HTML rocks</div>
9127 !! result
9128 <div id="rock">HTML rocks</div>
9129
9130 !! end
9131
9132 !! test
9133 div with illegal double attributes
9134 !! input
9135 <div id="a" id="b">HTML rocks</div>
9136 !! result
9137 <div id="b">HTML rocks</div>
9138
9139 !!end
9140
9141 # FIXME: produce empty string instead of "class" in the PHP parser, following
9142 # the HTML5 spec.
9143 !! test
9144 div with empty attribute value, space before equals
9145 !! options
9146 parsoid
9147 !! input
9148 <div class =>HTML rocks</div>
9149 !! result
9150 <div class="">HTML rocks</div>
9151
9152 !! end
9153
9154 # The PHP parser escapes the opening brace to &#123; for some reason, so
9155 # disabled this test for it.
9156 !! test
9157 div with braces in attribute value
9158 !! options
9159 parsoid
9160 !! input
9161 <div title="{}">Foo</div>
9162 !! result
9163 <div title="{}">Foo</div>
9164 !! end
9165
9166 # This it very inconsistent in the PHP parser: it returns
9167 # class="class" if there is a space between the name and the equal sign (see
9168 # 'div with empty attribute value, space before equals'), but strips the
9169 # attribute completely if the space is missing. We hope that not much content
9170 # depends on this, so are implementing the behavior below in Parsoid for
9171 # consistencies' sake. Disabled for the PHP parser.
9172 # FIXME: fix this behavior in the PHP parser?
9173 !! test
9174 div with empty attribute value, no space before equals
9175 !! options
9176 parsoid
9177 !! input
9178 <div class=>HTML rocks</div>
9179 !! result
9180 <div class="">HTML rocks</div>
9181
9182 !! end
9183
9184 !! test
9185 HTML multiple attributes correction
9186 !! input
9187 <p class="error" class="awesome">Awesome!</p>
9188 !! result
9189 <p class="awesome">Awesome!</p>
9190
9191 !!end
9192
9193 !! test
9194 Table multiple attributes correction
9195 !! input
9196 {|
9197 !+ class="error" class="awesome"| status
9198 |}
9199 !! result
9200 <table>
9201 <tr>
9202 <th class="awesome"> status
9203 </th></tr></table>
9204
9205 !!end
9206
9207 !! test
9208 DIV IN UPPERCASE
9209 !! input
9210 <DIV ID="x">HTML ROCKS</DIV>
9211 !! result
9212 <div id="x">HTML ROCKS</div>
9213
9214 !!end
9215
9216 !! test
9217 Non-ASCII pseudo-tags are rendered as text
9218 !! input
9219 <khyô>
9220 !! result
9221 <p>&lt;khyô&gt;
9222 </p>
9223 !! end
9224
9225 !! test
9226 Pseudo-tag with URL 'name' renders as url link
9227 !! input
9228 <http://example.com/>
9229 !! result
9230 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
9231 </p>
9232 !! end
9233
9234 !! test
9235 text with amp in the middle of nowhere
9236 !! input
9237 Remember AT&T?
9238 !!result
9239 <p>Remember AT&amp;T?
9240 </p>
9241 !! end
9242
9243 !! test
9244 text with character entity: eacute
9245 !! input
9246 I always thought &eacute; was a cute letter.
9247 !! result
9248 <p>I always thought &#233; was a cute letter.
9249 </p>
9250 !! end
9251
9252 !! test
9253 text with entity-escaped character entity-like string: eacute
9254 !! input
9255 I always thought &amp;eacute; was a cute letter.
9256 !! result
9257 <p>I always thought &amp;eacute; was a cute letter.
9258 </p>
9259 !! end
9260
9261 !! test
9262 text with undefined character entity: xacute
9263 !! input
9264 I always thought &xacute; was a cute letter.
9265 !! result
9266 <p>I always thought &amp;xacute; was a cute letter.
9267 </p>
9268 !! end
9269
9270
9271 ###
9272 ### Media links
9273 ###
9274
9275 !! test
9276 Media link
9277 !! input
9278 [[Media:Foobar.jpg]]
9279 !! result
9280 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
9281 </p>
9282 !! end
9283
9284 !! test
9285 Media link with text
9286 !! input
9287 [[Media:Foobar.jpg|A neat file to look at]]
9288 !! result
9289 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
9290 </p>
9291 !! end
9292
9293 # FIXME: this is still bad HTML tag nesting
9294 !! test
9295 Media link with nasty text
9296 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
9297 !! input
9298 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
9299 !! result
9300 <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>
9301
9302 !! end
9303
9304 !! test
9305 Media link to nonexistent file (bug 1702)
9306 !! input
9307 [[Media:No such.jpg]]
9308 !! result
9309 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
9310 </p>
9311 !! end
9312
9313 !! test
9314 Image link to nonexistent file (bug 1850 - good)
9315 !! input
9316 [[Image:No such.jpg]]
9317 !! result
9318 <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>
9319 </p>
9320 !! end
9321
9322 !! test
9323 :Image link to nonexistent file (bug 1850 - bad)
9324 !! input
9325 [[:Image:No such.jpg]]
9326 !! result
9327 <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>
9328 </p>
9329 !! end
9330
9331
9332
9333 !! test
9334 Character reference normalization in link text (bug 1938)
9335 !! input
9336 [[Main Page|this&that]]
9337 !! result
9338 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
9339 </p>
9340 !!end
9341
9342 !! article
9343 אַ
9344 !! text
9345 Test for unicode normalization
9346
9347 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
9348 !! endarticle
9349
9350 !! test
9351 (bug 19451) Links should refer to the normalized form.
9352 !! input
9353 [[&#xFB2E;]]
9354 [[&#x5d0;&#x5b7;]]
9355 [[&#x5d0;ַ]]
9356 [[א&#x5b7;]]
9357 [[אַ]]
9358 !! result
9359 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
9360 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
9361 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
9362 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
9363 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
9364 </p>
9365 !! end
9366
9367 !! test
9368 Empty attribute crash test (bug 2067)
9369 !! input
9370 <font color="">foo</font>
9371 !! result
9372 <p><font color="">foo</font>
9373 </p>
9374 !! end
9375
9376 !! test
9377 Empty attribute crash test single-quotes (bug 2067)
9378 !! input
9379 <font color=''>foo</font>
9380 !! result
9381 <p><font color="">foo</font>
9382 </p>
9383 !! end
9384
9385 !! test
9386 Attribute test: equals, then nothing
9387 !! input
9388 <font color=>foo</font>
9389 !! result
9390 <p><font>foo</font>
9391 </p>
9392 !! end
9393
9394 !! test
9395 Attribute test: unquoted value
9396 !! input
9397 <font color=x>foo</font>
9398 !! result
9399 <p><font color="x">foo</font>
9400 </p>
9401 !! end
9402
9403 !! test
9404 Attribute test: unquoted but illegal value (hash)
9405 !! input
9406 <font color=#x>foo</font>
9407 !! result
9408 <p><font color="#x">foo</font>
9409 </p>
9410 !! end
9411
9412 !! test
9413 Attribute test: no value
9414 !! input
9415 <font color>foo</font>
9416 !! result
9417 <p><font color="color">foo</font>
9418 </p>
9419 !! end
9420
9421 !! test
9422 Bug 2095: link with three closing brackets
9423 !! input
9424 [[Main Page]]]
9425 !! result
9426 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
9427 </p>
9428 !! end
9429
9430 !! test
9431 Bug 2095: link with pipe and three closing brackets
9432 !! input
9433 [[Main Page|link]]]
9434 !! result
9435 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
9436 </p>
9437 !! end
9438
9439 !! test
9440 Bug 2095: link with pipe and three closing brackets, version 2
9441 !! input
9442 [[Main Page|[http://example.com/]]]
9443 !! result
9444 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
9445 </p>
9446 !! end
9447
9448
9449 ###
9450 ### Safety
9451 ###
9452
9453 !! article
9454 Template:Dangerous attribute
9455 !! text
9456 " onmouseover="alert(document.cookie)
9457 !! endarticle
9458
9459 !! article
9460 Template:Dangerous style attribute
9461 !! text
9462 border-size: expression(alert(document.cookie))
9463 !! endarticle
9464
9465 !! article
9466 Template:Div style
9467 !! text
9468 <div style="float: right; {{{1}}}">Magic div</div>
9469 !! endarticle
9470
9471 !! test
9472 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
9473 !! input
9474 <div title="{{test}}"></div>
9475 !! result
9476 <div title="This is a test template"></div>
9477
9478 !! end
9479
9480 !! test
9481 Bug 2304: HTML attribute safety (dangerous template; 2309)
9482 !! input
9483 <div title="{{dangerous attribute}}"></div>
9484 !! result
9485 <div title=""></div>
9486
9487 !! end
9488
9489 !! test
9490 Bug 2304: HTML attribute safety (dangerous style template; 2309)
9491 !! input
9492 <div style="{{dangerous style attribute}}"></div>
9493 !! result
9494 <div style="/* insecure input */"></div>
9495
9496 !! end
9497
9498 !! test
9499 Bug 2304: HTML attribute safety (safe parameter; 2309)
9500 !! input
9501 {{div style|width: 200px}}
9502 !! result
9503 <div style="float: right; width: 200px">Magic div</div>
9504
9505 !! end
9506
9507 !! test
9508 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
9509 !! input
9510 {{div style|width: expression(alert(document.cookie))}}
9511 !! result
9512 <div style="/* insecure input */">Magic div</div>
9513
9514 !! end
9515
9516 !! test
9517 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
9518 !! input
9519 {{div style|"><script>alert(document.cookie)</script>}}
9520 !! result
9521 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9522
9523 !! end
9524
9525 !! test
9526 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
9527 !! input
9528 {{div style|" ><script>alert(document.cookie)</script>}}
9529 !! result
9530 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9531
9532 !! end
9533
9534 !! test
9535 Bug 2304: HTML attribute safety (link)
9536 !! input
9537 <div title="[[Main Page]]"></div>
9538 !! result
9539 <div title="&#91;&#91;Main Page]]"></div>
9540
9541 !! end
9542
9543 !! test
9544 Bug 2304: HTML attribute safety (italics)
9545 !! input
9546 <div title="''foobar''"></div>
9547 !! result
9548 <div title="&#39;&#39;foobar&#39;&#39;"></div>
9549
9550 !! end
9551
9552 !! test
9553 Bug 2304: HTML attribute safety (bold)
9554 !! input
9555 <div title="'''foobar'''"></div>
9556 !! result
9557 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
9558
9559 !! end
9560
9561
9562 !! test
9563 Bug 2304: HTML attribute safety (ISBN)
9564 !! input
9565 <div title="ISBN 1234567890"></div>
9566 !! result
9567 <div title="&#73;SBN 1234567890"></div>
9568
9569 !! end
9570
9571 !! test
9572 Bug 2304: HTML attribute safety (RFC)
9573 !! input
9574 <div title="RFC 1234"></div>
9575 !! result
9576 <div title="&#82;FC 1234"></div>
9577
9578 !! end
9579
9580 !! test
9581 Bug 2304: HTML attribute safety (PMID)
9582 !! input
9583 <div title="PMID 1234567890"></div>
9584 !! result
9585 <div title="&#80;MID 1234567890"></div>
9586
9587 !! end
9588
9589 !! test
9590 Bug 2304: HTML attribute safety (web link)
9591 !! input
9592 <div title="http://example.com/"></div>
9593 !! result
9594 <div title="http&#58;//example.com/"></div>
9595
9596 !! end
9597
9598 !! test
9599 Bug 2304: HTML attribute safety (named web link)
9600 !! input
9601 <div title="[http://example.com/ link]"></div>
9602 !! result
9603 <div title="&#91;http&#58;//example.com/ link]"></div>
9604
9605 !! end
9606
9607 !! test
9608 Bug 3244: HTML attribute safety (extension; safe)
9609 !! input
9610 <div style="<nowiki>background:blue</nowiki>"></div>
9611 !! result
9612 <div style="background:blue"></div>
9613
9614 !! end
9615
9616 !! test
9617 Bug 3244: HTML attribute safety (extension; unsafe)
9618 !! input
9619 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
9620 !! result
9621 <div style="/* insecure input */"></div>
9622
9623 !! end
9624
9625 # More MSIE fun discovered by Tom Gilder
9626
9627 !! test
9628 MSIE CSS safety test: spurious slash
9629 !! input
9630 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
9631 !! result
9632 <div style="/* insecure input */">evil</div>
9633
9634 !! end
9635
9636 !! test
9637 MSIE CSS safety test: hex code
9638 !! input
9639 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
9640 !! result
9641 <div style="/* insecure input */">evil</div>
9642
9643 !! end
9644
9645 !! test
9646 MSIE CSS safety test: comment in url
9647 !! input
9648 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
9649 !! result
9650 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
9651
9652 !! end
9653
9654 !! test
9655 MSIE CSS safety test: comment in expression
9656 !! input
9657 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
9658 !! result
9659 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
9660
9661 !! end
9662
9663
9664 !! test
9665 Table attribute legitimate extension
9666 !! input
9667 {|
9668 !+ style="<nowiki>color:blue</nowiki>"| status
9669 |}
9670 !! result
9671 <table>
9672 <tr>
9673 <th style="color:blue"> status
9674 </th></tr></table>
9675
9676 !!end
9677
9678 !! test
9679 Table attribute safety
9680 !! input
9681 {|
9682 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
9683 |}
9684 !! result
9685 <table>
9686 <tr>
9687 <th style="/* insecure input */"> status
9688 </th></tr></table>
9689
9690 !! end
9691
9692 !! test
9693 CSS line continuation 1
9694 !! input
9695 <div style="background-image: u\&#10;rl(test.jpg);"></div>
9696 !! result
9697 <div style="/* insecure input */"></div>
9698
9699 !! end
9700
9701 !! test
9702 CSS line continuation 2
9703 !! input
9704 <div style="background-image: u\&#13;rl(test.jpg); "></div>
9705 !! result
9706 <div style="/* insecure input */"></div>
9707
9708 !! end
9709
9710 !! article
9711 Template:Identity
9712 !! text
9713 {{{1}}}
9714 !! endarticle
9715
9716 !! test
9717 Expansion of multi-line templates in attribute values (bug 6255)
9718 !! input
9719 <div style="background: {{identity|#00FF00}}">-</div>
9720 !! result
9721 <div style="background: #00FF00">-</div>
9722
9723 !! end
9724
9725
9726 !! test
9727 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
9728 !! input
9729 <div style="background:
9730 #00FF00">-</div>
9731 !! result
9732 <div style="background: #00FF00">-</div>
9733
9734 !! end
9735
9736 !! test
9737 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
9738 !! input
9739 <div style="background: &#10;#00FF00">-</div>
9740 !! result
9741 <div style="background: &#10;#00FF00">-</div>
9742
9743 !! end
9744
9745 ###
9746 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
9747 ###
9748 !! test
9749 Parser hook: empty input
9750 !! input
9751 <tag></tag>
9752 !! result
9753 <pre>
9754 ''
9755 array (
9756 )
9757 </pre>
9758
9759 !! end
9760
9761 !! test
9762 Parser hook: empty input using terminated empty elements
9763 !! input
9764 <tag/>
9765 !! result
9766 <pre>
9767 NULL
9768 array (
9769 )
9770 </pre>
9771
9772 !! end
9773
9774 !! test
9775 Parser hook: empty input using terminated empty elements (space before)
9776 !! input
9777 <tag />
9778 !! result
9779 <pre>
9780 NULL
9781 array (
9782 )
9783 </pre>
9784
9785 !! end
9786
9787 !! test
9788 Parser hook: basic input
9789 !! input
9790 <tag>input</tag>
9791 !! result
9792 <pre>
9793 'input'
9794 array (
9795 )
9796 </pre>
9797
9798 !! end
9799
9800
9801 !! test
9802 Parser hook: case insensitive
9803 !! input
9804 <TAG>input</TAG>
9805 !! result
9806 <pre>
9807 'input'
9808 array (
9809 )
9810 </pre>
9811
9812 !! end
9813
9814
9815 !! test
9816 Parser hook: case insensitive, redux
9817 !! input
9818 <TaG>input</TAg>
9819 !! result
9820 <pre>
9821 'input'
9822 array (
9823 )
9824 </pre>
9825
9826 !! end
9827
9828 !! test
9829 Parser hook: nested tags
9830 !! options
9831 noxml
9832 !! input
9833 <tag><tag></tag></tag>
9834 !! result
9835 <pre>
9836 '<tag>'
9837 array (
9838 )
9839 </pre>&lt;/tag&gt;
9840
9841 !! end
9842
9843 !! test
9844 Parser hook: basic arguments
9845 !! input
9846 <tag width=200 height = "100" depth = '50' square></tag>
9847 !! result
9848 <pre>
9849 ''
9850 array (
9851 'width' => '200',
9852 'height' => '100',
9853 'depth' => '50',
9854 'square' => 'square',
9855 )
9856 </pre>
9857
9858 !! end
9859
9860 !! test
9861 Parser hook: argument containing a forward slash (bug 5344)
9862 !! input
9863 <tag filename='/tmp/bla'></tag>
9864 !! result
9865 <pre>
9866 ''
9867 array (
9868 'filename' => '/tmp/bla',
9869 )
9870 </pre>
9871
9872 !! end
9873
9874 !! test
9875 Parser hook: empty input using terminated empty elements (bug 2374)
9876 !! input
9877 <tag foo=bar/>text
9878 !! result
9879 <pre>
9880 NULL
9881 array (
9882 'foo' => 'bar',
9883 )
9884 </pre>text
9885
9886 !! end
9887
9888 # </tag> should be output literally since there is no matching tag that begins it
9889 !! test
9890 Parser hook: basic arguments using terminated empty elements (bug 2374)
9891 !! input
9892 <tag width=200 height = "100" depth = '50' square/>
9893 other stuff
9894 </tag>
9895 !! result
9896 <pre>
9897 NULL
9898 array (
9899 'width' => '200',
9900 'height' => '100',
9901 'depth' => '50',
9902 'square' => 'square',
9903 )
9904 </pre>
9905 <p>other stuff
9906 &lt;/tag&gt;
9907 </p>
9908 !! end
9909
9910 ###
9911 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
9912 ###
9913
9914 !! test
9915 Parser hook: static parser hook not inside a comment
9916 !! input
9917 <statictag>hello, world</statictag>
9918 <statictag action=flush/>
9919 !! result
9920 <p>hello, world
9921 </p>
9922 !! end
9923
9924
9925 !! test
9926 Parser hook: static parser hook inside a comment
9927 !! input
9928 <!-- <statictag>hello, world</statictag> -->
9929 <statictag action=flush/>
9930 !! result
9931 <p><br />
9932 </p>
9933 !! end
9934
9935 # Nested template calls; this case was broken by Parser.php rev 1.506,
9936 # since reverted.
9937
9938 !! article
9939 Template:One-parameter
9940 !! text
9941 (My parameter is: {{{1}}})
9942 !! endarticle
9943
9944 !! article
9945 Template:Map-one-parameter
9946 !! text
9947 {{{{{1}}}|{{{2}}}}}
9948 !! endarticle
9949
9950 !! test
9951 Nested template calls
9952 !! input
9953 {{Map-one-parameter|One-parameter|param}}
9954 !! result
9955 <p>(My parameter is: param)
9956 </p>
9957 !! end
9958
9959
9960 ###
9961 ### Sanitizer
9962 ###
9963 !! test
9964 Sanitizer: Closing of open tags
9965 !! input
9966 <s></s><table></table>
9967 !! result
9968 <s></s><table></table>
9969
9970 !! end
9971
9972 !! test
9973 Sanitizer: Closing of open but not closed tags
9974 !! input
9975 <s>foo
9976 !! result
9977 <p><s>foo</s>
9978 </p>
9979 !! end
9980
9981 !! test
9982 Sanitizer: Closing of closed but not open tags
9983 !! input
9984 </s>
9985 !! result
9986 <p>&lt;/s&gt;
9987 </p>
9988 !! end
9989
9990 !! test
9991 Sanitizer: Closing of closed but not open table tags
9992 !! input
9993 Table not started</td></tr></table>
9994 !! result
9995 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
9996 </p>
9997 !! end
9998
9999 !! test
10000 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
10001 !! input
10002 <span id="æ: v">byte</span>[[#æ: v|backlink]]
10003 !! result
10004 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
10005 </p>
10006 !! end
10007
10008 !! test
10009 Sanitizer: Validating the contents of the id attribute (bug 4515)
10010 !! options
10011 disabled
10012 !! input
10013 <br id=9 />
10014 !! result
10015 Something, but definitely not <br id="9" />...
10016 !! end
10017
10018 !! test
10019 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
10020 !! options
10021 disabled
10022 !! input
10023 <br id="foo" /><br id="foo" />
10024 !! result
10025 Something need to be done. foo-2 ?
10026 !! end
10027
10028 !! test
10029 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
10030 !! input
10031 <div itemscope>
10032 <meta itemprop="hello" content="world">
10033 <meta http-equiv="refresh" content="5">
10034 <meta itemprop="hello" http-equiv="refresh" content="5">
10035 <link itemprop="hello" href="{{SERVER}}">
10036 <link rel="stylesheet" href="{{SERVER}}">
10037 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
10038 </div>
10039 !! result
10040 <div itemscope="itemscope">
10041 <p> <meta itemprop="hello" content="world" />
10042 &lt;meta http-equiv="refresh" content="5"&gt;
10043 <meta itemprop="hello" content="5" />
10044 </p>
10045 <link itemprop="hello" href="http&#58;//example.org" />
10046 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
10047 <link itemprop="hello" href="http&#58;//example.org" />
10048 </div>
10049
10050 !! end
10051
10052 !! test
10053 Language converter: output gets cut off unexpectedly (bug 5757)
10054 !! options
10055 language=zh
10056 !! input
10057 this bit is safe: }-
10058
10059 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
10060
10061 then we get cut off here: }-
10062
10063 all additional text is vanished
10064 !! result
10065 <p>this bit is safe: }-
10066 </p><p>but if we add a conversion instance: xxx
10067 </p><p>then we get cut off here: }-
10068 </p><p>all additional text is vanished
10069 </p>
10070 !! end
10071
10072 !! test
10073 Self closed html pairs (bug 5487)
10074 !! options
10075 !! input
10076 <center><font id="bug" />Centered text</center>
10077 <div><font id="bug2" />In div text</div>
10078 !! result
10079 <center>&lt;font id="bug" /&gt;Centered text</center>
10080 <div>&lt;font id="bug2" /&gt;In div text</div>
10081
10082 !! end
10083
10084 #
10085 #
10086 #
10087
10088 !! test
10089 Punctuation: nbsp before exclamation
10090 !! input
10091 C'est grave !
10092 !! result
10093 <p>C'est grave&#160;!
10094 </p>
10095 !! end
10096
10097 !! test
10098 Punctuation: CSS !important (bug 11874)
10099 !! input
10100 <div style="width:50% !important">important</div>
10101 !! result
10102 <div style="width:50% !important">important</div>
10103
10104 !!end
10105
10106 !! test
10107 Punctuation: CSS ! important (bug 11874; with space after)
10108 !! input
10109 <div style="width:50% ! important">important</div>
10110 !! result
10111 <div style="width:50% ! important">important</div>
10112
10113 !!end
10114
10115
10116 !! test
10117 HTML bullet list, closed tags (bug 5497)
10118 !! input
10119 <ul>
10120 <li>One</li>
10121 <li>Two</li>
10122 </ul>
10123 !! result
10124 <ul>
10125 <li>One</li>
10126 <li>Two</li>
10127 </ul>
10128
10129 !! end
10130
10131 !! test
10132 HTML bullet list, unclosed tags (bug 5497)
10133 !! options
10134 disabled
10135 !! input
10136 <ul>
10137 <li>One
10138 <li>Two
10139 </ul>
10140 !! result
10141 <ul>
10142 <li>One
10143 </li><li>Two
10144 </li></ul>
10145
10146 !! end
10147
10148 !! test
10149 HTML ordered list, closed tags (bug 5497)
10150 !! input
10151 <ol>
10152 <li>One</li>
10153 <li>Two</li>
10154 </ol>
10155 !! result
10156 <ol>
10157 <li>One</li>
10158 <li>Two</li>
10159 </ol>
10160
10161 !! end
10162
10163 !! test
10164 HTML ordered list, unclosed tags (bug 5497)
10165 !! options
10166 disabled
10167 !! input
10168 <ol>
10169 <li>One
10170 <li>Two
10171 </ol>
10172 !! result
10173 <ol>
10174 <li>One
10175 </li><li>Two
10176 </li></ol>
10177
10178 !! end
10179
10180 !! test
10181 HTML nested bullet list, closed tags (bug 5497)
10182 !! input
10183 <ul>
10184 <li>One</li>
10185 <li>Two:
10186 <ul>
10187 <li>Sub-one</li>
10188 <li>Sub-two</li>
10189 </ul>
10190 </li>
10191 </ul>
10192 !! result
10193 <ul>
10194 <li>One</li>
10195 <li>Two:
10196 <ul>
10197 <li>Sub-one</li>
10198 <li>Sub-two</li>
10199 </ul>
10200 </li>
10201 </ul>
10202
10203 !! end
10204
10205 !! test
10206 HTML nested bullet list, open tags (bug 5497)
10207 !! options
10208 disabled
10209 !! input
10210 <ul>
10211 <li>One
10212 <li>Two:
10213 <ul>
10214 <li>Sub-one
10215 <li>Sub-two
10216 </ul>
10217 </ul>
10218 !! result
10219 <ul>
10220 <li>One
10221 </li><li>Two:
10222 <ul>
10223 <li>Sub-one
10224 </li><li>Sub-two
10225 </li></ul>
10226 </li></ul>
10227
10228 !! end
10229
10230 !! test
10231 HTML nested ordered list, closed tags (bug 5497)
10232 !! input
10233 <ol>
10234 <li>One</li>
10235 <li>Two:
10236 <ol>
10237 <li>Sub-one</li>
10238 <li>Sub-two</li>
10239 </ol>
10240 </li>
10241 </ol>
10242 !! result
10243 <ol>
10244 <li>One</li>
10245 <li>Two:
10246 <ol>
10247 <li>Sub-one</li>
10248 <li>Sub-two</li>
10249 </ol>
10250 </li>
10251 </ol>
10252
10253 !! end
10254
10255 !! test
10256 HTML nested ordered list, open tags (bug 5497)
10257 !! options
10258 disabled
10259 !! input
10260 <ol>
10261 <li>One
10262 <li>Two:
10263 <ol>
10264 <li>Sub-one
10265 <li>Sub-two
10266 </ol>
10267 </ol>
10268 !! result
10269 <ol>
10270 <li>One
10271 </li><li>Two:
10272 <ol>
10273 <li>Sub-one
10274 </li><li>Sub-two
10275 </li></ol>
10276 </li></ol>
10277
10278 !! end
10279
10280 !! test
10281 HTML ordered list item with parameters oddity
10282 !! input
10283 <ol><li id="fragment">One</li></ol>
10284 !! result
10285 <ol><li id="fragment">One</li></ol>
10286
10287 !! end
10288
10289 !!test
10290 bug 5918: autonumbering
10291 !! input
10292 [http://first/] [http://second] [ftp://ftp]
10293
10294 ftp://inlineftp
10295
10296 [mailto:enclosed@mail.tld With target]
10297
10298 [mailto:enclosed@mail.tld]
10299
10300 mailto:inline@mail.tld
10301 !! result
10302 <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>
10303 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
10304 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
10305 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
10306 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
10307 </p>
10308 !! end
10309
10310
10311 #
10312 # Security and HTML correctness
10313 # From Nick Jenkins' fuzz testing
10314 #
10315
10316 !! test
10317 Fuzz testing: Parser13
10318 !! input
10319 {|
10320 | http://a|
10321 !! result
10322 <table>
10323 <tr>
10324 <td>
10325 </td>
10326 </tr>
10327 </table>
10328
10329 !! end
10330
10331 !! test
10332 Fuzz testing: Parser14
10333 !! input
10334 == onmouseover= ==
10335 http://__TOC__
10336 !! result
10337 <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>
10338 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10339 <ul>
10340 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
10341 </ul>
10342 </div>
10343
10344 !! end
10345
10346 !! test
10347 Fuzz testing: Parser14-table
10348 !! input
10349 ==a==
10350 {| STYLE=__TOC__
10351 !! result
10352 <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>
10353 <table style="&#95;_TOC&#95;_">
10354 <tr><td></td></tr>
10355 </table>
10356
10357 !! end
10358
10359 # Known to produce bogus xml (extra </td>)
10360 !! test
10361 Fuzz testing: Parser16
10362 !! options
10363 noxml
10364 !! input
10365 {|
10366 !https://||||||
10367 !! result
10368 <table>
10369 <tr>
10370 <th>https://</th>
10371 <th></th>
10372 <th></th>
10373 <th>
10374 </td>
10375 </tr>
10376 </table>
10377
10378 !! end
10379
10380 !! test
10381 Fuzz testing: Parser21
10382 !! input
10383 {|
10384 ! irc://{{ftp://a" onmouseover="alert('hello world');"
10385 |
10386 !! result
10387 <table>
10388 <tr>
10389 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
10390 </th>
10391 <td>
10392 </td>
10393 </tr>
10394 </table>
10395
10396 !! end
10397
10398 !! test
10399 Fuzz testing: Parser22
10400 !! input
10401 http://===r:::https://b
10402
10403 {|
10404 !!result
10405 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
10406 </p>
10407 <table>
10408 <tr><td></td></tr>
10409 </table>
10410
10411 !! end
10412
10413 # Known to produce bad XML for now
10414 !! test
10415 Fuzz testing: Parser24
10416 !! options
10417 noxml
10418 !! input
10419 {|
10420 {{{|
10421 <u CLASS=
10422 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
10423 <br style="onmouseover='alert(document.cookie);' " />
10424
10425 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10426 |
10427 !! result
10428 <table>
10429 {{{|
10430 <u class="&#124;">}}}} &gt;
10431 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
10432
10433 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10434 <tr>
10435 <td></u>
10436 </td>
10437 </tr>
10438 </table>
10439
10440 !! end
10441
10442 # Note: the current result listed for this is not what the original one was,
10443 # but the original bug was JavaScript injection, which is fixed in any case.
10444 # It's not clear that the original result listed was any more correct than the
10445 # current one. Original result:
10446 # <p>{{{|
10447 # </p>
10448 # <li class="&#124;&#124;">
10449 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10450 !!test
10451 Fuzz testing: Parser25 (bug 6055)
10452 !! input
10453 {{{
10454 |
10455 <LI CLASS=||
10456 >
10457 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
10458 !! result
10459 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10460 </p>
10461 !! end
10462
10463 !!test
10464 Fuzz testing: URL adjacent extension (with space, clean)
10465 !! options
10466 !! input
10467 http://example.com <nowiki>junk</nowiki>
10468 !! result
10469 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
10470 </p>
10471 !!end
10472
10473 !!test
10474 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
10475 !! options
10476 !! input
10477 http://example.com<nowiki>junk</nowiki>
10478 !! result
10479 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
10480 </p>
10481 !!end
10482
10483 !!test
10484 Fuzz testing: URL adjacent extension (no space, dirty; pre)
10485 !! options
10486 !! input
10487 http://example.com<pre>junk</pre>
10488 !! result
10489 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
10490
10491 !!end
10492
10493 !!test
10494 Fuzz testing: image with bogus manual thumbnail
10495 !!input
10496 [[Image:foobar.jpg|thumbnail= ]]
10497 !!result
10498 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
10499
10500 !!end
10501
10502 !! test
10503 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
10504 !! input
10505 <pre dir="&#10;"></pre>
10506 !! result
10507 <pre dir="&#10;"></pre>
10508
10509 !! end
10510
10511 !! test
10512 Parsing optional HTML elements (Bug 6171)
10513 !! options
10514 !! input
10515 <table>
10516 <tr>
10517 <td> Some tabular data</td>
10518 <td> More tabular data ...
10519 <td> And yet som tabular data</td>
10520 </tr>
10521 </table>
10522 !! result
10523 <table>
10524 <tr>
10525 <td> Some tabular data</td>
10526 <td> More tabular data ...
10527 </td><td> And yet som tabular data</td>
10528 </tr>
10529 </table>
10530
10531 !! end
10532
10533 !! test
10534 Correct handling of <td>, <tr> (Bug 6171)
10535 !! options
10536 !! input
10537 <table>
10538 <tr>
10539 <td> Some tabular data</td>
10540 <td> More tabular data ...</td>
10541 <td> And yet som tabular data</td>
10542 </tr>
10543 </table>
10544 !! result
10545 <table>
10546 <tr>
10547 <td> Some tabular data</td>
10548 <td> More tabular data ...</td>
10549 <td> And yet som tabular data</td>
10550 </tr>
10551 </table>
10552
10553 !! end
10554
10555
10556 !! test
10557 Parsing crashing regression (fr:JavaScript)
10558 !! input
10559 </body></x>
10560 !! result
10561 <p>&lt;/body&gt;&lt;/x&gt;
10562 </p>
10563 !! end
10564
10565 !! test
10566 Inline wiki vs wiki block nesting
10567 !! input
10568 '''Bold paragraph
10569
10570 New wiki paragraph
10571 !! result
10572 <p><b>Bold paragraph</b>
10573 </p><p>New wiki paragraph
10574 </p>
10575 !! end
10576
10577 !! test
10578 Inline HTML vs wiki block nesting
10579 !! options
10580 disabled
10581 !! input
10582 <b>Bold paragraph
10583
10584 New wiki paragraph
10585 !! result
10586 <p><b>Bold paragraph</b>
10587 </p><p>New wiki paragraph
10588 </p>
10589 !! end
10590
10591 # Original result was this:
10592 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
10593 # </p>
10594 # While that might be marginally more intuitive, maybe, the six-apostrophe
10595 # construct is clearly pathological and the result stated here (which is what
10596 # the parser actually does) is about as reasonable as anything.
10597 !!test
10598 Mixing markup for italics and bold
10599 !! options
10600 !! input
10601 '''bold''''''bold''bolditalics'''''
10602 !! result
10603 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
10604 </p>
10605 !! end
10606
10607
10608 !! article
10609 Xyzzyx
10610 !! text
10611 Article for special page transclusion test
10612 !! endarticle
10613
10614 !! test
10615 Special page transclusion
10616 !! options
10617 !! input
10618 {{Special:Prefixindex/Xyzzyx}}
10619 !! result
10620 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10621
10622 !! end
10623
10624 !! test
10625 Special page transclusion twice (bug 5021)
10626 !! options
10627 !! input
10628 {{Special:Prefixindex/Xyzzyx}}
10629 {{Special:Prefixindex/Xyzzyx}}
10630 !! result
10631 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10632 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10633
10634 !! end
10635
10636 !! test
10637 Transclusion of default MediaWiki message
10638 !! input
10639 {{MediaWiki:Mainpage}}
10640 !!result
10641 <p>Main Page
10642 </p>
10643 !! end
10644
10645 !! test
10646 Transclusion of nonexistent MediaWiki message
10647 !! input
10648 {{MediaWiki:Mainpagexxx}}
10649 !!result
10650 <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>
10651 </p>
10652 !! end
10653
10654 !! test
10655 Transclusion of MediaWiki message with underscore
10656 !! input
10657 {{MediaWiki:history_short}}
10658 !! result
10659 <p>History
10660 </p>
10661 !! end
10662
10663 !! test
10664 Transclusion of MediaWiki message with space
10665 !! input
10666 {{MediaWiki:history short}}
10667 !! result
10668 <p>History
10669 </p>
10670 !! end
10671
10672 !! test
10673 Invalid header with following text
10674 !! input
10675 = x = y
10676 !! result
10677 <p>= x = y
10678 </p>
10679 !! end
10680
10681
10682 !! test
10683 Section extraction test (section 0)
10684 !! options
10685 section=0
10686 !! input
10687 start
10688 ==a==
10689 ===aa===
10690 ====aaa====
10691 ==b==
10692 ===ba===
10693 ===bb===
10694 ====bba====
10695 ===bc===
10696 ==c==
10697 ===ca===
10698 !! result
10699 start
10700 !! end
10701
10702 !! test
10703 Section extraction test (section 1)
10704 !! options
10705 section=1
10706 !! input
10707 start
10708 ==a==
10709 ===aa===
10710 ====aaa====
10711 ==b==
10712 ===ba===
10713 ===bb===
10714 ====bba====
10715 ===bc===
10716 ==c==
10717 ===ca===
10718 !! result
10719 ==a==
10720 ===aa===
10721 ====aaa====
10722 !! end
10723
10724 !! test
10725 Section extraction test (section 2)
10726 !! options
10727 section=2
10728 !! input
10729 start
10730 ==a==
10731 ===aa===
10732 ====aaa====
10733 ==b==
10734 ===ba===
10735 ===bb===
10736 ====bba====
10737 ===bc===
10738 ==c==
10739 ===ca===
10740 !! result
10741 ===aa===
10742 ====aaa====
10743 !! end
10744
10745 !! test
10746 Section extraction test (section 3)
10747 !! options
10748 section=3
10749 !! input
10750 start
10751 ==a==
10752 ===aa===
10753 ====aaa====
10754 ==b==
10755 ===ba===
10756 ===bb===
10757 ====bba====
10758 ===bc===
10759 ==c==
10760 ===ca===
10761 !! result
10762 ====aaa====
10763 !! end
10764
10765 !! test
10766 Section extraction test (section 4)
10767 !! options
10768 section=4
10769 !! input
10770 start
10771 ==a==
10772 ===aa===
10773 ====aaa====
10774 ==b==
10775 ===ba===
10776 ===bb===
10777 ====bba====
10778 ===bc===
10779 ==c==
10780 ===ca===
10781 !! result
10782 ==b==
10783 ===ba===
10784 ===bb===
10785 ====bba====
10786 ===bc===
10787 !! end
10788
10789 !! test
10790 Section extraction test (section 5)
10791 !! options
10792 section=5
10793 !! input
10794 start
10795 ==a==
10796 ===aa===
10797 ====aaa====
10798 ==b==
10799 ===ba===
10800 ===bb===
10801 ====bba====
10802 ===bc===
10803 ==c==
10804 ===ca===
10805 !! result
10806 ===ba===
10807 !! end
10808
10809 !! test
10810 Section extraction test (section 6)
10811 !! options
10812 section=6
10813 !! input
10814 start
10815 ==a==
10816 ===aa===
10817 ====aaa====
10818 ==b==
10819 ===ba===
10820 ===bb===
10821 ====bba====
10822 ===bc===
10823 ==c==
10824 ===ca===
10825 !! result
10826 ===bb===
10827 ====bba====
10828 !! end
10829
10830 !! test
10831 Section extraction test (section 7)
10832 !! options
10833 section=7
10834 !! input
10835 start
10836 ==a==
10837 ===aa===
10838 ====aaa====
10839 ==b==
10840 ===ba===
10841 ===bb===
10842 ====bba====
10843 ===bc===
10844 ==c==
10845 ===ca===
10846 !! result
10847 ====bba====
10848 !! end
10849
10850 !! test
10851 Section extraction test (section 8)
10852 !! options
10853 section=8
10854 !! input
10855 start
10856 ==a==
10857 ===aa===
10858 ====aaa====
10859 ==b==
10860 ===ba===
10861 ===bb===
10862 ====bba====
10863 ===bc===
10864 ==c==
10865 ===ca===
10866 !! result
10867 ===bc===
10868 !! end
10869
10870 !! test
10871 Section extraction test (section 9)
10872 !! options
10873 section=9
10874 !! input
10875 start
10876 ==a==
10877 ===aa===
10878 ====aaa====
10879 ==b==
10880 ===ba===
10881 ===bb===
10882 ====bba====
10883 ===bc===
10884 ==c==
10885 ===ca===
10886 !! result
10887 ==c==
10888 ===ca===
10889 !! end
10890
10891 !! test
10892 Section extraction test (section 10)
10893 !! options
10894 section=10
10895 !! input
10896 start
10897 ==a==
10898 ===aa===
10899 ====aaa====
10900 ==b==
10901 ===ba===
10902 ===bb===
10903 ====bba====
10904 ===bc===
10905 ==c==
10906 ===ca===
10907 !! result
10908 ===ca===
10909 !! end
10910
10911 !! test
10912 Section extraction test (nonexistent section 11)
10913 !! options
10914 section=11
10915 !! input
10916 start
10917 ==a==
10918 ===aa===
10919 ====aaa====
10920 ==b==
10921 ===ba===
10922 ===bb===
10923 ====bba====
10924 ===bc===
10925 ==c==
10926 ===ca===
10927 !! result
10928 !! end
10929
10930 !! test
10931 Section extraction test with bogus heading (section 1)
10932 !! options
10933 section=1
10934 !! input
10935 ==a==
10936 ==bogus== not a legal section
10937 ==b==
10938 !! result
10939 ==a==
10940 ==bogus== not a legal section
10941 !! end
10942
10943 !! test
10944 Section extraction test with bogus heading (section 2)
10945 !! options
10946 section=2
10947 !! input
10948 ==a==
10949 ==bogus== not a legal section
10950 ==b==
10951 !! result
10952 ==b==
10953 !! end
10954
10955 !! test
10956 Section extraction test with comment after heading (section 1)
10957 !! options
10958 section=1
10959 !! input
10960 ==a==
10961 ==b== <!-- -->
10962 ==c==
10963 !! result
10964 ==a==
10965 !! end
10966
10967 !! test
10968 Section extraction test with comment after heading (section 2)
10969 !! options
10970 section=2
10971 !! input
10972 ==a==
10973 ==b== <!-- -->
10974 ==c==
10975 !! result
10976 ==b== <!-- -->
10977 !! end
10978
10979 !! test
10980 Section extraction test with bogus <nowiki> heading (section 1)
10981 !! options
10982 section=1
10983 !! input
10984 ==a==
10985 ==bogus== <nowiki>not a legal section</nowiki>
10986 ==b==
10987 !! result
10988 ==a==
10989 ==bogus== <nowiki>not a legal section</nowiki>
10990 !! end
10991
10992 !! test
10993 Section extraction test with bogus <nowiki> heading (section 2)
10994 !! options
10995 section=2
10996 !! input
10997 ==a==
10998 ==bogus== <nowiki>not a legal section</nowiki>
10999 ==b==
11000 !! result
11001 ==b==
11002 !! end
11003
11004
11005 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
11006 # instead of respecting commented sections
11007 !! test
11008 Section extraction prefixed by comment (section 1)
11009 !! options
11010 section=1
11011 !! input
11012 <!-- -->==sec1==
11013 ==sec2==
11014 !!result
11015 ==sec2==
11016 !!end
11017
11018 !! test
11019 Section extraction prefixed by comment (section 2)
11020 !! options
11021 section=2
11022 !! input
11023 <!-- -->==sec1==
11024 ==sec2==
11025 !!result
11026
11027 !!end
11028
11029
11030 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
11031 # instead of respecting HTML-style headings
11032 !! test
11033 Section extraction, mixed wiki and html (section 1)
11034 !! options
11035 section=1
11036 !! input
11037 <h2>unmarked</h2>
11038 unmarked
11039 ==1==
11040 one
11041 ==2==
11042 two
11043 !! result
11044 ==1==
11045 one
11046 !! end
11047
11048 !! test
11049 Section extraction, mixed wiki and html (section 2)
11050 !! options
11051 section=2
11052 !! input
11053 <h2>unmarked</h2>
11054 unmarked
11055 ==1==
11056 one
11057 ==2==
11058 two
11059 !! result
11060 ==2==
11061 two
11062 !! end
11063
11064
11065 # Formerly testing for bug 3342
11066 !! test
11067 Section extraction, heading surrounded by <noinclude>
11068 !! options
11069 section=1
11070 !! input
11071 <noinclude>==unmarked==</noinclude>
11072 ==marked==
11073 !! result
11074 ==marked==
11075 !!end
11076
11077 # Test behavior of bug 19910
11078 !! test
11079 Sectiion with all-equals
11080 !! options
11081 section=2
11082 !! input
11083 ===
11084 The line above must have a trailing space
11085 === <!--
11086 --> <!-- -->
11087 But just in case it doesn't...
11088 !! result
11089 === <!--
11090 --> <!-- -->
11091 But just in case it doesn't...
11092 !! end
11093
11094 !! test
11095 Section replacement test (section 0)
11096 !! options
11097 replace=0,"xxx"
11098 !! input
11099 start
11100 ==a==
11101 ===aa===
11102 ====aaa====
11103 ==b==
11104 ===ba===
11105 ===bb===
11106 ====bba====
11107 ===bc===
11108 ==c==
11109 ===ca===
11110 !! result
11111 xxx
11112
11113 ==a==
11114 ===aa===
11115 ====aaa====
11116 ==b==
11117 ===ba===
11118 ===bb===
11119 ====bba====
11120 ===bc===
11121 ==c==
11122 ===ca===
11123 !! end
11124
11125 !! test
11126 Section replacement test (section 1)
11127 !! options
11128 replace=1,"xxx"
11129 !! input
11130 start
11131 ==a==
11132 ===aa===
11133 ====aaa====
11134 ==b==
11135 ===ba===
11136 ===bb===
11137 ====bba====
11138 ===bc===
11139 ==c==
11140 ===ca===
11141 !! result
11142 start
11143 xxx
11144
11145 ==b==
11146 ===ba===
11147 ===bb===
11148 ====bba====
11149 ===bc===
11150 ==c==
11151 ===ca===
11152 !! end
11153
11154 !! test
11155 Section replacement test (section 2)
11156 !! options
11157 replace=2,"xxx"
11158 !! input
11159 start
11160 ==a==
11161 ===aa===
11162 ====aaa====
11163 ==b==
11164 ===ba===
11165 ===bb===
11166 ====bba====
11167 ===bc===
11168 ==c==
11169 ===ca===
11170 !! result
11171 start
11172 ==a==
11173 xxx
11174
11175 ==b==
11176 ===ba===
11177 ===bb===
11178 ====bba====
11179 ===bc===
11180 ==c==
11181 ===ca===
11182 !! end
11183
11184 !! test
11185 Section replacement test (section 3)
11186 !! options
11187 replace=3,"xxx"
11188 !! input
11189 start
11190 ==a==
11191 ===aa===
11192 ====aaa====
11193 ==b==
11194 ===ba===
11195 ===bb===
11196 ====bba====
11197 ===bc===
11198 ==c==
11199 ===ca===
11200 !! result
11201 start
11202 ==a==
11203 ===aa===
11204 xxx
11205
11206 ==b==
11207 ===ba===
11208 ===bb===
11209 ====bba====
11210 ===bc===
11211 ==c==
11212 ===ca===
11213 !! end
11214
11215 !! test
11216 Section replacement test (section 4)
11217 !! options
11218 replace=4,"xxx"
11219 !! input
11220 start
11221 ==a==
11222 ===aa===
11223 ====aaa====
11224 ==b==
11225 ===ba===
11226 ===bb===
11227 ====bba====
11228 ===bc===
11229 ==c==
11230 ===ca===
11231 !! result
11232 start
11233 ==a==
11234 ===aa===
11235 ====aaa====
11236 xxx
11237
11238 ==c==
11239 ===ca===
11240 !! end
11241
11242 !! test
11243 Section replacement test (section 5)
11244 !! options
11245 replace=5,"xxx"
11246 !! input
11247 start
11248 ==a==
11249 ===aa===
11250 ====aaa====
11251 ==b==
11252 ===ba===
11253 ===bb===
11254 ====bba====
11255 ===bc===
11256 ==c==
11257 ===ca===
11258 !! result
11259 start
11260 ==a==
11261 ===aa===
11262 ====aaa====
11263 ==b==
11264 xxx
11265
11266 ===bb===
11267 ====bba====
11268 ===bc===
11269 ==c==
11270 ===ca===
11271 !! end
11272
11273 !! test
11274 Section replacement test (section 6)
11275 !! options
11276 replace=6,"xxx"
11277 !! input
11278 start
11279 ==a==
11280 ===aa===
11281 ====aaa====
11282 ==b==
11283 ===ba===
11284 ===bb===
11285 ====bba====
11286 ===bc===
11287 ==c==
11288 ===ca===
11289 !! result
11290 start
11291 ==a==
11292 ===aa===
11293 ====aaa====
11294 ==b==
11295 ===ba===
11296 xxx
11297
11298 ===bc===
11299 ==c==
11300 ===ca===
11301 !! end
11302
11303 !! test
11304 Section replacement test (section 7)
11305 !! options
11306 replace=7,"xxx"
11307 !! input
11308 start
11309 ==a==
11310 ===aa===
11311 ====aaa====
11312 ==b==
11313 ===ba===
11314 ===bb===
11315 ====bba====
11316 ===bc===
11317 ==c==
11318 ===ca===
11319 !! result
11320 start
11321 ==a==
11322 ===aa===
11323 ====aaa====
11324 ==b==
11325 ===ba===
11326 ===bb===
11327 xxx
11328
11329 ===bc===
11330 ==c==
11331 ===ca===
11332 !! end
11333
11334 !! test
11335 Section replacement test (section 8)
11336 !! options
11337 replace=8,"xxx"
11338 !! input
11339 start
11340 ==a==
11341 ===aa===
11342 ====aaa====
11343 ==b==
11344 ===ba===
11345 ===bb===
11346 ====bba====
11347 ===bc===
11348 ==c==
11349 ===ca===
11350 !! result
11351 start
11352 ==a==
11353 ===aa===
11354 ====aaa====
11355 ==b==
11356 ===ba===
11357 ===bb===
11358 ====bba====
11359 xxx
11360
11361 ==c==
11362 ===ca===
11363 !!end
11364
11365 !! test
11366 Section replacement test (section 9)
11367 !! options
11368 replace=9,"xxx"
11369 !! input
11370 start
11371 ==a==
11372 ===aa===
11373 ====aaa====
11374 ==b==
11375 ===ba===
11376 ===bb===
11377 ====bba====
11378 ===bc===
11379 ==c==
11380 ===ca===
11381 !! result
11382 start
11383 ==a==
11384 ===aa===
11385 ====aaa====
11386 ==b==
11387 ===ba===
11388 ===bb===
11389 ====bba====
11390 ===bc===
11391 xxx
11392 !! end
11393
11394 !! test
11395 Section replacement test (section 10)
11396 !! options
11397 replace=10,"xxx"
11398 !! input
11399 start
11400 ==a==
11401 ===aa===
11402 ====aaa====
11403 ==b==
11404 ===ba===
11405 ===bb===
11406 ====bba====
11407 ===bc===
11408 ==c==
11409 ===ca===
11410 !! result
11411 start
11412 ==a==
11413 ===aa===
11414 ====aaa====
11415 ==b==
11416 ===ba===
11417 ===bb===
11418 ====bba====
11419 ===bc===
11420 ==c==
11421 xxx
11422 !! end
11423
11424 !! test
11425 Section replacement test with initial whitespace (bug 13728)
11426 !! options
11427 replace=2,"xxx"
11428 !! input
11429 Preformatted initial line
11430 ==a==
11431 ===a===
11432 !! result
11433 Preformatted initial line
11434 ==a==
11435 xxx
11436 !! end
11437
11438
11439 !! test
11440 Section extraction, heading followed by pre with 20 spaces (bug 6398)
11441 !! options
11442 section=1
11443 !! input
11444 ==a==
11445 a
11446 !! result
11447 ==a==
11448 a
11449 !! end
11450
11451 !! test
11452 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
11453 !! options
11454 section=1
11455 !! input
11456 ==a==
11457 a
11458 !! result
11459 ==a==
11460 a
11461 !! end
11462
11463
11464 !! test
11465 Section extraction, <pre> around bogus header (bug 10309)
11466 !! options
11467 noxml section=2
11468 !! input
11469 == Section One ==
11470 <pre>
11471 =======
11472 </pre>
11473
11474 == Section Two ==
11475 stuff
11476 !! result
11477 == Section Two ==
11478 stuff
11479 !! end
11480
11481 !! test
11482 Section replacement, <pre> around bogus header (bug 10309)
11483 !! options
11484 noxml replace=2,"xxx"
11485 !! input
11486 == Section One ==
11487 <pre>
11488 =======
11489 </pre>
11490
11491 == Section Two ==
11492 stuff
11493 !! result
11494 == Section One ==
11495 <pre>
11496 =======
11497 </pre>
11498
11499 xxx
11500 !! end
11501
11502
11503
11504 !! test
11505 Handling of &#x0A; in URLs
11506 !! input
11507 **irc://&#x0A;a
11508 !! result
11509 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
11510 </li></ul>
11511 </li></ul>
11512
11513 !!end
11514
11515 !! test
11516 5 quotes, code coverage +1 line (php)
11517 !! options
11518 php
11519 !! input
11520 '''''
11521 !! result
11522 !! end
11523 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
11524 !! test
11525 5 quotes, code coverage +1 line (parsoid)
11526 !! options
11527 parsoid
11528 !! input
11529 '''''
11530 !! result
11531 <p><i><b></b></i></p>
11532 !! end
11533
11534 !! test
11535 Special:Search page linking.
11536 !! input
11537 {{Special:search}}
11538 !! result
11539 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
11540 </p>
11541 !! end
11542
11543 !! test
11544 Say the magic word
11545 !! input
11546 * {{PAGENAME}}
11547 * {{BASEPAGENAME}}
11548 * {{SUBPAGENAME}}
11549 * {{SUBPAGENAMEE}}
11550 * {{ROOTPAGENAME}}
11551 * {{ROOTPAGENAMEE}}
11552 * {{BASEPAGENAME}}
11553 * {{BASEPAGENAMEE}}
11554 * {{TALKPAGENAME}}
11555 * {{TALKPAGENAMEE}}
11556 * {{SUBJECTPAGENAME}}
11557 * {{SUBJECTPAGENAMEE}}
11558 * {{NAMESPACEE}}
11559 * {{NAMESPACE}}
11560 * {{TALKSPACE}}
11561 * {{TALKSPACEE}}
11562 * {{SUBJECTSPACE}}
11563 * {{SUBJECTSPACEE}}
11564 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
11565 !! result
11566 <ul><li> Parser test
11567 </li><li> Parser test
11568 </li><li> Parser test
11569 </li><li> Parser_test
11570 </li><li> Parser test
11571 </li><li> Parser_test
11572 </li><li> Parser test
11573 </li><li> Parser_test
11574 </li><li> Talk:Parser test
11575 </li><li> Talk:Parser_test
11576 </li><li> Parser test
11577 </li><li> Parser_test
11578 </li><li>
11579 </li><li>
11580 </li><li> Talk
11581 </li><li> Talk
11582 </li><li>
11583 </li><li>
11584 </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>
11585 </li></ul>
11586
11587 !! end
11588 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
11589
11590 !! test
11591 Gallery
11592 !! input
11593 <gallery>
11594 image1.png |
11595 image2.gif|||||
11596
11597 image3|
11598 image4 |300px| centre
11599 image5.svg| http://///////
11600 [[x|xx]]]]
11601 * image6
11602 </gallery>
11603 !! result
11604 <ul class="gallery">
11605 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11606 <div style="height: 150px;">Image1.png</div>
11607 <div class="gallerytext">
11608 </div>
11609 </div></li>
11610 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11611 <div style="height: 150px;">Image2.gif</div>
11612 <div class="gallerytext">
11613 <p>||||
11614 </p>
11615 </div>
11616 </div></li>
11617 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11618 <div style="height: 150px;">Image3</div>
11619 <div class="gallerytext">
11620 </div>
11621 </div></li>
11622 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11623 <div style="height: 150px;">Image4</div>
11624 <div class="gallerytext">
11625 <p>300px| centre
11626 </p>
11627 </div>
11628 </div></li>
11629 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11630 <div style="height: 150px;">Image5.svg</div>
11631 <div class="gallerytext">
11632 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
11633 </p>
11634 </div>
11635 </div></li>
11636 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11637 <div style="height: 150px;">* image6</div>
11638 <div class="gallerytext">
11639 </div>
11640 </div></li>
11641 </ul>
11642
11643 !! end
11644
11645 !! test
11646 Gallery (with options)
11647 !! input
11648 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
11649 File:Nonexistant.jpg|caption
11650 File:Nonexistant.jpg
11651 image:foobar.jpg|some '''caption''' [[Main Page]]
11652 image:foobar.jpg
11653 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
11654 </gallery>
11655 !! result
11656 <ul class="gallery" style="max-width: 226px;_width: 226px;">
11657 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
11658 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11659 <div style="height: 70px;">Nonexistant.jpg</div>
11660 <div class="gallerytext">
11661 <p>caption
11662 </p>
11663 </div>
11664 </div></li>
11665 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11666 <div style="height: 70px;">Nonexistant.jpg</div>
11667 <div class="gallerytext">
11668 </div>
11669 </div></li>
11670 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11671 <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>
11672 <div class="gallerytext">
11673 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11674 </p>
11675 </div>
11676 </div></li>
11677 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11678 <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>
11679 <div class="gallerytext">
11680 </div>
11681 </div></li>
11682 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11683 <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>
11684 <div class="gallerytext">
11685 <p>Blabla|blabla.
11686 </p>
11687 </div>
11688 </div></li>
11689 </ul>
11690
11691 !! end
11692
11693 !! test
11694 Gallery with wikitext inside caption
11695 !! input
11696 <gallery>
11697 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
11698 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
11699 </gallery>
11700 !! result
11701 <ul class="gallery">
11702 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11703 <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>
11704 <div class="gallerytext">
11705 <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>
11706 </p>
11707 </div>
11708 </div></li>
11709 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11710 <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>
11711 <div class="gallerytext">
11712 <p>This is a test template
11713 </p>
11714 </div>
11715 </div></li>
11716 </ul>
11717
11718 !! end
11719
11720 !! test
11721 gallery (with showfilename option)
11722 !! input
11723 <gallery showfilename>
11724 File:Nonexistant.jpg|caption
11725 File:Nonexistant.jpg
11726 image:foobar.jpg|some '''caption''' [[Main Page]]
11727 File:Foobar.jpg
11728 </gallery>
11729 !! result
11730 <ul class="gallery">
11731 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11732 <div style="height: 150px;">Nonexistant.jpg</div>
11733 <div class="gallerytext">
11734 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11735 caption
11736 </p>
11737 </div>
11738 </div></li>
11739 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11740 <div style="height: 150px;">Nonexistant.jpg</div>
11741 <div class="gallerytext">
11742 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11743 </p>
11744 </div>
11745 </div></li>
11746 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11747 <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>
11748 <div class="gallerytext">
11749 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11750 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11751 </p>
11752 </div>
11753 </div></li>
11754 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11755 <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>
11756 <div class="gallerytext">
11757 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11758 </p>
11759 </div>
11760 </div></li>
11761 </ul>
11762
11763 !! end
11764
11765 !! test
11766 Gallery (with namespace-less filenames)
11767 !! input
11768 <gallery>
11769 File:Nonexistant.jpg
11770 Nonexistant.jpg
11771 image:foobar.jpg
11772 foobar.jpg
11773 </gallery>
11774 !! result
11775 <ul class="gallery">
11776 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11777 <div style="height: 150px;">Nonexistant.jpg</div>
11778 <div class="gallerytext">
11779 </div>
11780 </div></li>
11781 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11782 <div style="height: 150px;">Nonexistant.jpg</div>
11783 <div class="gallerytext">
11784 </div>
11785 </div></li>
11786 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11787 <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>
11788 <div class="gallerytext">
11789 </div>
11790 </div></li>
11791 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11792 <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>
11793 <div class="gallerytext">
11794 </div>
11795 </div></li>
11796 </ul>
11797
11798 !! end
11799
11800 !! test
11801 HTML Hex character encoding (spells the word "JavaScript")
11802 !! input
11803 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
11804 !! result
11805 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
11806 </p>
11807 !! end
11808
11809 !! test
11810 HTML Hex character encoding bogus encoding (bug 26437 regression check)
11811 !! input
11812 &#xsee;&#XSEE;
11813 !! result
11814 <p>&amp;#xsee;&amp;#XSEE;
11815 </p>
11816 !! end
11817
11818 !! test
11819 HTML Hex character encoding mixed case
11820 !! input
11821 &#xEE;&#Xee;
11822 !! result
11823 <p>&#xee;&#xee;
11824 </p>
11825 !! end
11826
11827 !! test
11828 __FORCETOC__ override
11829 !! input
11830 __NEWSECTIONLINK__
11831 __FORCETOC__
11832 !! result
11833 <p><br />
11834 </p>
11835 !! end
11836
11837 !! test
11838 ISBN code coverage
11839 !! input
11840 ISBN 978-0-1234-56&#x20;789
11841 !! result
11842 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
11843 </p>
11844 !! end
11845
11846 !! test
11847 ISBN followed by 5 spaces
11848 !! input
11849 ISBN
11850 !! result
11851 <p>ISBN
11852 </p>
11853 !! end
11854
11855 !! test
11856 Double ISBN
11857 !! input
11858 ISBN ISBN 1234567890
11859 !! result
11860 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
11861 </p>
11862 !! end
11863
11864 !! test
11865 Bug 22905: <abbr> followed by ISBN followed by </a>
11866 !! input
11867 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
11868 !! result
11869 <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>
11870 </p>
11871 !! end
11872
11873 !! test
11874 Double RFC
11875 !! input
11876 RFC RFC 1234
11877 !! result
11878 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
11879 </p>
11880 !! end
11881
11882 !! test
11883 Double RFC with a wiki link
11884 !! input
11885 RFC [[RFC 1234]]
11886 !! result
11887 <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>
11888 </p>
11889 !! end
11890
11891 !! test
11892 RFC code coverage
11893 !! input
11894 RFC 983&#x20;987
11895 !! result
11896 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
11897 </p>
11898 !! end
11899
11900 !! test
11901 Centre-aligned image
11902 !! input
11903 [[Image:foobar.jpg|centre]]
11904 !! result
11905 <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>
11906
11907 !!end
11908
11909 !! test
11910 None-aligned image
11911 !! input
11912 [[Image:foobar.jpg|none]]
11913 !! result
11914 <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>
11915
11916 !!end
11917
11918 !! test
11919 Width + Height sized image (using px) (height is ignored)
11920 !! input
11921 [[Image:foobar.jpg|640x480px]]
11922 !! result
11923 <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>
11924 </p>
11925 !!end
11926
11927 !! test
11928 Width-sized image (using px, no following whitespace)
11929 !! input
11930 [[Image:foobar.jpg|640px]]
11931 !! result
11932 <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>
11933 </p>
11934 !!end
11935
11936 !! test
11937 Width-sized image (using px, with following whitespace - test regression from r39467)
11938 !! input
11939 [[Image:foobar.jpg|640px ]]
11940 !! result
11941 <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>
11942 </p>
11943 !!end
11944
11945 !! test
11946 Width-sized image (using px, with preceding whitespace - test regression from r39467)
11947 !! input
11948 [[Image:foobar.jpg| 640px]]
11949 !! result
11950 <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>
11951 </p>
11952 !!end
11953
11954 !! test
11955 Another italics / bold test
11956 !! input
11957 ''' ''x'
11958 !! result
11959 <pre>'<i> </i>x'
11960 </pre>
11961 !!end
11962
11963 # Note the results may be incorrect, as parserTest output included this:
11964 # XML error: Mismatched tag at byte 6120:
11965 # ...<dd> </dt></dl> </dd...
11966 !! test
11967 dt/dd/dl test
11968 !! options
11969 disabled
11970 !! input
11971 :;;;::
11972 !! result
11973 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
11974 </dd></dl>
11975 </dd></dl>
11976 </dt></dl>
11977 </dt></dl>
11978 </dt></dl>
11979 </dd></dl>
11980
11981 !!end
11982
11983
11984 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
11985 !! test
11986 Images with the "|" character in the comment
11987 !! input
11988 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
11989 !! result
11990 <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>
11991
11992 !!end
11993
11994 !! test
11995 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
11996 !! input
11997 <html><script>alert(1);</script></html>
11998 !! result
11999 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
12000 </p>
12001 !! end
12002
12003 !! test
12004 HTML with raw HTML ($wgRawHtml==true)
12005 !! options
12006 rawhtml
12007 !! input
12008 <html><script>alert(1);</script></html>
12009 !! result
12010 <p><script>alert(1);</script>
12011 </p>
12012 !! end
12013
12014 !! test
12015 Parents of subpages, one level up
12016 !! options
12017 subpage title=[[Subpage test/L1/L2/L3]]
12018 !! input
12019 [[../|L2]]
12020 !! result
12021 <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>
12022 </p>
12023 !! end
12024
12025
12026 !! test
12027 Parents of subpages, one level up, not named
12028 !! options
12029 subpage title=[[Subpage test/L1/L2/L3]]
12030 !! input
12031 [[../]]
12032 !! result
12033 <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>
12034 </p>
12035 !! end
12036
12037
12038
12039 !! test
12040 Parents of subpages, two levels up
12041 !! options
12042 subpage title=[[Subpage test/L1/L2/L3]]
12043 !! input
12044 [[../../|L1]]2
12045
12046 [[../../|L1]]l
12047 !! result
12048 <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
12049 </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>
12050 </p>
12051 !! end
12052
12053 !! test
12054 Parents of subpages, two levels up, without trailing slash or name.
12055 !! options
12056 subpage title=[[Subpage test/L1/L2/L3]]
12057 !! input
12058 [[../..]]
12059 !! result
12060 <p>[[../..]]
12061 </p>
12062 !! end
12063
12064 !! test
12065 Parents of subpages, two levels up, with lots of extra trailing slashes.
12066 !! options
12067 subpage title=[[Subpage test/L1/L2/L3]]
12068 !! input
12069 [[../../////]]
12070 !! result
12071 <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>
12072 </p>
12073 !! end
12074
12075 !! test
12076 Definition list code coverage
12077 !! input
12078 ; title : def
12079 ; title : def
12080 ;title: def
12081 !! result
12082 <dl><dt> title &#160;</dt><dd> def
12083 </dd><dt> title&#160;</dt><dd> def
12084 </dd><dt>title</dt><dd> def
12085 </dd></dl>
12086
12087 !! end
12088
12089 !! test
12090 Don't fall for the self-closing div
12091 !! input
12092 <div>hello world</div/>
12093 !! result
12094 <div>hello world</div>
12095
12096 !! end
12097
12098 !! test
12099 MSGNW magic word
12100 !! input
12101 {{MSGNW:msg}}
12102 !! result
12103 <p>&#91;&#91;:Template:Msg&#93;&#93;
12104 </p>
12105 !! end
12106
12107 !! test
12108 RAW magic word
12109 !! input
12110 {{RAW:QUERTY}}
12111 !! result
12112 <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>
12113 </p>
12114 !! end
12115
12116 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
12117 !! test
12118 Always escape literal '>' in output, not just after '<'
12119 !! input
12120 ><>
12121 !! result
12122 <p>&gt;&lt;&gt;
12123 </p>
12124 !! end
12125
12126 !! test
12127 Template caching
12128 !! input
12129 {{Test}}
12130 {{Test}}
12131 !! result
12132 <p>This is a test template
12133 This is a test template
12134 </p>
12135 !! end
12136
12137
12138 !! article
12139 MediaWiki:Fake
12140 !! text
12141 ==header==
12142 !! endarticle
12143
12144 !! test
12145 Inclusion of !userCanEdit() content
12146 !! input
12147 {{MediaWiki:Fake}}
12148 !! result
12149 <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>
12150
12151 !! end
12152
12153
12154 !! test
12155 Out-of-order TOC heading levels
12156 !! input
12157 ==2==
12158 ======6======
12159 ===3===
12160 =1=
12161 =====5=====
12162 ==2==
12163 !! result
12164 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12165 <ul>
12166 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
12167 <ul>
12168 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
12169 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
12170 </ul>
12171 </li>
12172 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
12173 <ul>
12174 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
12175 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
12176 </ul>
12177 </li>
12178 </ul>
12179 </div>
12180 <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>
12181 <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>
12182 <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>
12183 <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>
12184 <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>
12185 <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>
12186
12187 !! end
12188
12189
12190 !! test
12191 ISBN with a dummy number
12192 !! input
12193 ISBN ---
12194 !! result
12195 <p>ISBN ---
12196 </p>
12197 !! end
12198
12199
12200 !! test
12201 ISBN with space-delimited number
12202 !! input
12203 ISBN 92 9017 032 8
12204 !! result
12205 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
12206 </p>
12207 !! end
12208
12209
12210 !! test
12211 ISBN with multiple spaces, no number
12212 !! input
12213 ISBN foo
12214 !! result
12215 <p>ISBN foo
12216 </p>
12217 !! end
12218
12219
12220 !! test
12221 ISBN length
12222 !! input
12223 ISBN 123456789
12224
12225 ISBN 1234567890
12226
12227 ISBN 12345678901
12228 !! result
12229 <p>ISBN 123456789
12230 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
12231 </p><p>ISBN 12345678901
12232 </p>
12233 !! end
12234
12235
12236 !! test
12237 ISBN with trailing year (bug 8110)
12238 !! input
12239 ISBN 1-234-56789-0 - 2006
12240
12241 ISBN 1 234 56789 0 - 2006
12242 !! result
12243 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
12244 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
12245 </p>
12246 !! end
12247
12248
12249 !! test
12250 anchorencode
12251 !! input
12252 {{anchorencode:foo bar©#%n}}
12253 !! result
12254 <p>foo_bar.C2.A9.23.25n
12255 </p>
12256 !! end
12257
12258 !! test
12259 anchorencode trims spaces
12260 !! input
12261 {{anchorencode: __pretty__please__}}
12262 !! result
12263 <p>pretty_please
12264 </p>
12265 !! end
12266
12267 !! test
12268 anchorencode deals with links
12269 !! input
12270 {{anchorencode: [[hello|world]] [[hi]]}}
12271 !! result
12272 <p>world_hi
12273 </p>
12274 !! end
12275
12276 !! test
12277 anchorencode deals with templates
12278 !! input
12279 {{anchorencode: {{Foo}} }}
12280 !! result
12281 <p>FOO
12282 </p>
12283 !! end
12284
12285 !! test
12286 anchorencode encodes like the TOC generator: (bug 18431)
12287 !! input
12288 === _ +:.3A%3A&&amp;]] ===
12289 {{anchorencode: _ +:.3A%3A&&amp;]] }}
12290 __NOEDITSECTION__
12291 !! result
12292 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
12293 <p>.2B:.3A.253A.26.26.5D.5D
12294 </p>
12295 !! end
12296
12297 # Expected output in the following test is not necessarily expected (there
12298 # should probably be <p> tags inside the <blockquote> in the output) -- it's
12299 # only testing for well-formedness.
12300 !! test
12301 Bug 6200: blockquotes and paragraph formatting
12302 !! input
12303 <blockquote>
12304 foo
12305 </blockquote>
12306
12307 bar
12308
12309 baz
12310 !! result
12311 <blockquote>
12312 foo
12313 </blockquote>
12314 <p>bar
12315 </p>
12316 <pre>baz
12317 </pre>
12318 !! end
12319
12320 !! test
12321 Bug 8293: Use of center tag ruins paragraph formatting
12322 !! input
12323 <center>
12324 foo
12325 </center>
12326
12327 bar
12328
12329 baz
12330 !! result
12331 <center>
12332 <p>foo
12333 </p>
12334 </center>
12335 <p>bar
12336 </p>
12337 <pre>baz
12338 </pre>
12339 !! end
12340
12341 !!test
12342 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
12343 !!options
12344 php
12345 !!input
12346 <span><s>x</span></s>
12347 !!result
12348 <p><span><s>x&lt;/span&gt;</s></span>
12349 </p>
12350 !!end
12351
12352 !!test
12353 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
12354 !!options
12355 parsoid
12356 !!input
12357 <span><s>x</span></s>
12358 !!result
12359 <p><span><s>x</s></span><s></s>
12360 </p>
12361 !!end
12362
12363 ###
12364 ### Language variants related tests
12365 ###
12366 !! test
12367 Self-link in language variants
12368 !! options
12369 title=[[Dunav]] language=sr
12370 !! input
12371 Both [[Dunav]] and [[Дунав]] are names for this river.
12372 !! result
12373 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
12374 </p>
12375 !!end
12376
12377 !! article
12378 Дуна
12379 !! text
12380 content
12381 !! endarticle
12382
12383 !! test
12384 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
12385 !! options
12386 title=[[Duna]] language=sr
12387 !! input
12388 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
12389 !! result
12390 <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.
12391 </p>
12392 !! end
12393
12394 !! test
12395 Link to pages in language variants
12396 !! options
12397 language=sr
12398 !! input
12399 Main Page can be written as [[Маин Паге]]
12400 !! result
12401 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
12402 </p>
12403 !!end
12404
12405
12406 !! test
12407 Multiple links to pages in language variants
12408 !! options
12409 language=sr
12410 !! input
12411 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
12412 !! result
12413 <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>.
12414 </p>
12415 !!end
12416
12417
12418 !! test
12419 Simple template in language variants
12420 !! options
12421 language=sr
12422 !! input
12423 {{тест}}
12424 !! result
12425 <p>This is a test template
12426 </p>
12427 !! end
12428
12429
12430 !! test
12431 Template with explicit namespace in language variants
12432 !! options
12433 language=sr
12434 !! input
12435 {{Template:тест}}
12436 !! result
12437 <p>This is a test template
12438 </p>
12439 !! end
12440
12441
12442 !! test
12443 Basic test for template parameter in language variants
12444 !! options
12445 language=sr
12446 !! input
12447 {{парамтест|param=foo}}
12448 !! result
12449 <p>This is a test template with parameter foo
12450 </p>
12451 !! end
12452
12453
12454 !! test
12455 Simple category in language variants
12456 !! options
12457 language=sr cat
12458 !! input
12459 [[Category:МедиаWики Усер'с Гуиде]]
12460 !! result
12461 <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>
12462 !! end
12463
12464
12465 !! article
12466 Category:分类
12467 !! text
12468 blah
12469 !! endarticle
12470
12471 !! article
12472 Category:分類
12473 !! text
12474 blah
12475 !! endarticle
12476
12477 !! test
12478 Don't convert blue categorylinks to another variant (bug 33210)
12479 !! options
12480 language=zh cat
12481 !! input
12482 [[A]][[Category:分类]]
12483 !! result
12484 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
12485 !! end
12486
12487
12488 !! test
12489 Stripping -{}- tags (language variants)
12490 !! options
12491 language=sr
12492 !! input
12493 Latin proverb: -{Ne nuntium necare}-
12494 !! result
12495 <p>Latin proverb: Ne nuntium necare
12496 </p>
12497 !! end
12498
12499
12500 !! test
12501 Prevent conversion with -{}- tags (language variants)
12502 !! options
12503 language=sr variant=sr-ec
12504 !! input
12505 Latinski: -{Ne nuntium necare}-
12506 !! result
12507 <p>Латински: Ne nuntium necare
12508 </p>
12509 !! end
12510
12511
12512 !! test
12513 Prevent conversion of text with -{}- tags (language variants)
12514 !! options
12515 language=sr variant=sr-ec
12516 !! input
12517 Latinski: -{Ne nuntium necare}-
12518 !! result
12519 <p>Латински: Ne nuntium necare
12520 </p>
12521 !! end
12522
12523
12524 !! test
12525 Prevent conversion of links with -{}- tags (language variants)
12526 !! options
12527 language=sr variant=sr-ec
12528 !! input
12529 -{[[Main Page]]}-
12530 !! result
12531 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12532 </p>
12533 !! end
12534
12535
12536 !! test
12537 -{}- tags within headlines (within html for parserConvert())
12538 !! options
12539 language=sr variant=sr-ec
12540 !! input
12541 == -{Naslov}- ==
12542 !! result
12543 <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>
12544
12545 !! end
12546
12547
12548 !! test
12549 Explicit definition of language variant alternatives
12550 !! options
12551 language=zh variant=zh-tw
12552 !! input
12553 -{zh:China;zh-tw:Taiwan}-, not China
12554 !! result
12555 <p>Taiwan, not China
12556 </p>
12557 !! end
12558
12559
12560 !! test
12561 Conversion around HTML tags
12562 !! options
12563 language=sr variant=sr-ec
12564 !! input
12565 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
12566 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
12567 !! result
12568 <p>
12569 <span title="ЛаCтин">ски</span>
12570 </p>
12571 !! end
12572
12573
12574 !! test
12575 Explicit session-wise language variant mapping (A flag and - flag)
12576 !! options
12577 language=zh variant=zh-tw
12578 !! input
12579 Taiwan is not China.
12580 But -{A|zh:China;zh-tw:Taiwan}- is China,
12581 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
12582 and -{China}- is China.
12583 !! result
12584 <p>Taiwan is not China.
12585 But Taiwan is Taiwan,
12586 (This should be stripped!)
12587 and China is China.
12588 </p>
12589 !! end
12590
12591 !! test
12592 Explicit session-wise language variant mapping (H flag for hide)
12593 !! options
12594 language=zh variant=zh-tw
12595 !! input
12596 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
12597 Taiwan is China.
12598 !! result
12599 <p>(This should be stripped!)
12600 Taiwan is Taiwan.
12601 </p>
12602 !! end
12603
12604 !! test
12605 Adding explicit conversion rule for title (T flag)
12606 !! options
12607 language=zh variant=zh-tw showtitle
12608 !! input
12609 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12610 !! result
12611 Taiwan
12612 <p>Should be stripped!
12613 </p>
12614 !! end
12615
12616 !! test
12617 Testing that changing the language variant here in the tests actually works
12618 !! options
12619 language=zh variant=zh showtitle
12620 !! input
12621 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12622 !! result
12623 China
12624 <p>Should be stripped!
12625 </p>
12626 !! end
12627
12628 !! test
12629 Recursive conversion of alt and title attrs shouldn't clear converter state
12630 !! options
12631 language=zh variant=zh-cn showtitle
12632 !! input
12633 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
12634 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
12635 !! result
12636 China
12637 <p>
12638 Should be stripped<span title="Exclamation">!</span>
12639 </p>
12640 !! end
12641
12642 !! test
12643 Bug 24072: more test on conversion rule for title
12644 !! options
12645 language=zh variant=zh-tw showtitle
12646 !! input
12647 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12648 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
12649 !! result
12650 Taiwan
12651 <p>This should be stripped!
12652 This won't take interferes with the title rule.
12653 </p>
12654 !! end
12655
12656 !! test
12657 Partly disable title conversion if variant == main language code
12658 !! options
12659 language=zh variant=zh title=[[ZH]] showtitle
12660 !! input
12661 -{T|zh-cn:CN;zh-tw:TW}-
12662 !! result
12663 ZH
12664 <p>
12665 </p>
12666 !! end
12667
12668 !! test
12669 Partly disable title conversion if variant == main language code, more
12670 !! options
12671 language=zh variant=zh title=[[ZH]] showtitle
12672 !! input
12673 -{T|TW}-
12674 !! result
12675 ZH
12676 <p>
12677 </p>
12678 !! end
12679
12680 !! test
12681 Raw output of variant escape tags (R flag)
12682 !! options
12683 language=zh variant=zh-tw
12684 !! input
12685 Raw: -{R|zh:China;zh-tw:Taiwan}-
12686 !! result
12687 <p>Raw: zh:China;zh-tw:Taiwan
12688 </p>
12689 !! end
12690
12691 !! test
12692 Nested using of manual convert syntax
12693 !! options
12694 language=zh variant=zh-hk
12695 !! input
12696 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
12697 !! result
12698 <p>Nested: Hello Hong Kong!
12699 </p>
12700 !! end
12701
12702 !! test
12703 Proper conversion of text in external links
12704 !! options
12705 language=sr variant=sr-ec
12706 !! input
12707 http://www.google.com
12708 gopher://www.google.com
12709 [http://www.google.com http://www.google.com]
12710 [gopher://www.google.com gopher://www.google.com]
12711 [https://www.google.com irc://www.google.com]
12712 [ftp://www.google.com www.google.com/ftp://dir]
12713 [//www.google.com www.google.com]
12714 !! result
12715 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12716 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12717 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12718 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12719 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
12720 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
12721 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
12722 </p>
12723 !! end
12724
12725 !! test
12726 Do not convert roman numbers to language variants
12727 !! options
12728 language=sr variant=sr-ec
12729 !! input
12730 Fridrih IV je car.
12731 !! result
12732 <p>Фридрих IV је цар.
12733 </p>
12734 !! end
12735
12736 !! test
12737 Unclosed language converter markup "-{"
12738 !! options
12739 language=sr
12740 !! input
12741 -{T|hello
12742 !! result
12743 <p>-{T|hello
12744 </p>
12745 !! end
12746
12747 !! test
12748 Don't convert raw rule "-{R|=&gt;}-" to "=>"
12749 !! options
12750 language=sr
12751 !! input
12752 -{R|=&gt;}-
12753 !! result
12754 <p>=&gt;
12755 </p>
12756 !!end
12757
12758 !!article
12759 Template:Bullet
12760 !!text
12761 * Bar
12762 !!endarticle
12763
12764 !! test
12765 Bug 529: Uncovered bullet
12766 !! input
12767 * Foo {{bullet}}
12768 !! result
12769 <ul><li> Foo
12770 </li><li> Bar
12771 </li></ul>
12772
12773 !! end
12774
12775 # Plain MediaWiki does not remove empty lists, but tidy actually does.
12776 # Templates in Wikipedia rely on this behavior, as tidy has always been
12777 # enabled there. These tests are normally run *without* tidy, so specify the
12778 # full output here.
12779 # To test realistic parsing behavior, apply a tidy-like transformation to both
12780 # the expected output and your parser's output.
12781 !! test
12782 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
12783 !! input
12784 ******* Foo {{bullet}}
12785 !! result
12786 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
12787 </li></ul>
12788 </li></ul>
12789 </li></ul>
12790 </li></ul>
12791 </li></ul>
12792 </li></ul>
12793 </li><li> Bar
12794 </li></ul>
12795
12796 !! end
12797
12798 !! test
12799 Bug 529: Uncovered table already at line-start
12800 !! input
12801 x
12802
12803 {{table}}
12804 y
12805 !! result
12806 <p>x
12807 </p>
12808 <table>
12809 <tr>
12810 <td> 1 </td>
12811 <td> 2
12812 </td></tr>
12813 <tr>
12814 <td> 3 </td>
12815 <td> 4
12816 </td></tr></table>
12817 <p>y
12818 </p>
12819 !! end
12820
12821 !! test
12822 Bug 529: Uncovered bullet in parser function result
12823 !! input
12824 * Foo {{lc:{{bullet}} }}
12825 !! result
12826 <ul><li> Foo
12827 </li><li> bar
12828 </li></ul>
12829
12830 !! end
12831
12832 !! test
12833 Bug 5678: Double-parsed template argument
12834 !! input
12835 {{lc:{{{1}}}|hello}}
12836 !! result
12837 <p>{{{1}}}
12838 </p>
12839 !! end
12840
12841 !! test
12842 Bug 5678: Double-parsed template invocation
12843 !! input
12844 {{lc:{{paramtest {{!}} param = hello }} }}
12845 !! result
12846 <p>{{paramtest | param = hello }}
12847 </p>
12848 !! end
12849
12850 !! test
12851 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
12852 !! options
12853 language=cs
12854 title=[[Main Page]]
12855 !! input
12856 {{PRVNÍVELKÉ:ěščř}}
12857 {{prvnívelké:ěščř}}
12858 {{PRVNÍMALÉ:ěščř}}
12859 {{prvnímalé:ěščř}}
12860 {{MALÁ:ěščř}}
12861 {{malá:ěščř}}
12862 {{VELKÁ:ěščř}}
12863 {{velká:ěščř}}
12864 !! result
12865 <p>Ěščř
12866 Ěščř
12867 ěščř
12868 ěščř
12869 ěščř
12870 ěščř
12871 ĚŠČŘ
12872 ĚŠČŘ
12873 </p>
12874 !! end
12875
12876 !! test
12877 Morwen/13: Unclosed link followed by heading
12878 !! input
12879 [[link
12880 ==heading==
12881 !! result
12882 <p>[[link
12883 </p>
12884 <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>
12885
12886 !! end
12887
12888 !! test
12889 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
12890 !! input
12891 {{foo|
12892 =heading=
12893 !! result
12894 <p>{{foo|
12895 </p>
12896 <h1><span class="mw-headline" id="heading">heading</span></h1>
12897
12898 !! end
12899
12900 !! test
12901 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
12902 !! input
12903 {{foo|
12904 ==heading==
12905 !! result
12906 <p>{{foo|
12907 </p>
12908 <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>
12909
12910 !! end
12911
12912 !! test
12913 Tildes in comments
12914 !! options
12915 pst
12916 !! input
12917 <!-- ~~~~ -->
12918 !! result
12919 <!-- ~~~~ -->
12920 !! end
12921
12922 !! test
12923 Paragraphs inside divs (no extra line breaks)
12924 !! input
12925 <div>Line one
12926
12927 Line two</div>
12928 !! result
12929 <div>Line one
12930 Line two</div>
12931
12932 !! end
12933
12934 !! test
12935 Paragraphs inside divs (extra line break on open)
12936 !! input
12937 <div>
12938 Line one
12939
12940 Line two</div>
12941 !! result
12942 <div>
12943 <p>Line one
12944 </p>
12945 Line two</div>
12946
12947 !! end
12948
12949 !! test
12950 Paragraphs inside divs (extra line break on close)
12951 !! input
12952 <div>Line one
12953
12954 Line two
12955 </div>
12956 !! result
12957 <div>Line one
12958 <p>Line two
12959 </p>
12960 </div>
12961
12962 !! end
12963
12964 !! test
12965 Paragraphs inside divs (extra line break on open and close)
12966 !! input
12967 <div>
12968 Line one
12969
12970 Line two
12971 </div>
12972 !! result
12973 <div>
12974 <p>Line one
12975 </p><p>Line two
12976 </p>
12977 </div>
12978
12979 !! end
12980
12981 !! test
12982 Nesting tags, paragraphs on lines which begin with <div>
12983 !! options
12984 disabled
12985 !! input
12986 <div></div><strong>A
12987 B</strong>
12988 !! result
12989 <div></div>
12990 <p><strong>A
12991 B</strong>
12992 </p>
12993 !! end
12994
12995 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
12996 !! test
12997 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
12998 !! options
12999 disabled
13000 !! input
13001 <blockquote>Line one
13002
13003 Line two</blockquote>
13004 !! result
13005 <blockquote>Line one
13006 Line two</blockquote>
13007
13008 !! end
13009
13010 !! test
13011 Bug 6200: paragraphs inside blockquotes (extra line break on open)
13012 !! options
13013 disabled
13014 !! input
13015 <blockquote>
13016 Line one
13017
13018 Line two</blockquote>
13019 !! result
13020 <blockquote>
13021 <p>Line one
13022 </p>
13023 Line two</blockquote>
13024
13025 !! end
13026
13027 !! test
13028 Bug 6200: paragraphs inside blockquotes (extra line break on close)
13029 !! options
13030 disabled
13031 !! input
13032 <blockquote>Line one
13033
13034 Line two
13035 </blockquote>
13036 !! result
13037 <blockquote>Line one
13038 <p>Line two
13039 </p>
13040 </blockquote>
13041
13042 !! end
13043
13044 !! test
13045 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
13046 !! options
13047 disabled
13048 !! input
13049 <blockquote>
13050 Line one
13051
13052 Line two
13053 </blockquote>
13054 !! result
13055 <blockquote>
13056 <p>Line one
13057 </p><p>Line two
13058 </p>
13059 </blockquote>
13060
13061 !! end
13062
13063 !! test
13064 Paragraphs inside blockquotes/divs (no extra line breaks)
13065 !! input
13066 <blockquote><div>Line one
13067
13068 Line two</div></blockquote>
13069 !! result
13070 <blockquote><div>Line one
13071 Line two</div></blockquote>
13072
13073 !! end
13074
13075 !! test
13076 Paragraphs inside blockquotes/divs (extra line break on open)
13077 !! input
13078 <blockquote><div>
13079 Line one
13080
13081 Line two</div></blockquote>
13082 !! result
13083 <blockquote><div>
13084 <p>Line one
13085 </p>
13086 Line two</div></blockquote>
13087
13088 !! end
13089
13090 !! test
13091 Paragraphs inside blockquotes/divs (extra line break on close)
13092 !! input
13093 <blockquote><div>Line one
13094
13095 Line two
13096 </div></blockquote>
13097 !! result
13098 <blockquote><div>Line one
13099 <p>Line two
13100 </p>
13101 </div></blockquote>
13102
13103 !! end
13104
13105 !! test
13106 Paragraphs inside blockquotes/divs (extra line break on open and close)
13107 !! input
13108 <blockquote><div>
13109 Line one
13110
13111 Line two
13112 </div></blockquote>
13113 !! result
13114 <blockquote><div>
13115 <p>Line one
13116 </p><p>Line two
13117 </p>
13118 </div></blockquote>
13119
13120 !! end
13121
13122 !! test
13123 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
13124 !! options
13125 wgLinkHolderBatchSize=0
13126 !! input
13127 [[meatball:1]]
13128 [[meatball:2]]
13129 [[meatball:3]]
13130 !! result
13131 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
13132 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
13133 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
13134 </p>
13135 !! end
13136
13137 !! test
13138 Free external link invading image caption
13139 !! input
13140 [[Image:Foobar.jpg|thumb|http://x|hello]]
13141 !! result
13142 <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>
13143
13144 !! end
13145
13146 !! test
13147 Bug 15196: localised external link numbers
13148 !! options
13149 language=fa
13150 !! input
13151 [http://en.wikipedia.org/]
13152 !! result
13153 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
13154 </p>
13155 !! end
13156
13157 !! test
13158 Multibyte character in padleft
13159 !! input
13160 {{padleft:-Hello|7|Æ}}
13161 !! result
13162 <p>Æ-Hello
13163 </p>
13164 !! end
13165
13166 !! test
13167 Multibyte character in padright
13168 !! input
13169 {{padright:Hello-|7|Æ}}
13170 !! result
13171 <p>Hello-Æ
13172 </p>
13173 !! end
13174
13175 !!test
13176 formatdate parser function
13177 !!input
13178 {{#formatdate:2009-03-24}}
13179 !! result
13180 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
13181 </p>
13182 !! end
13183
13184 !!test
13185 formatdate parser function, with default format
13186 !!input
13187 {{#formatdate:2009-03-24|mdy}}
13188 !! result
13189 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
13190 </p>
13191 !! end
13192
13193 !! test
13194 Spacing of numbers in formatted dates
13195 !! input
13196 {{#formatdate:January 15}}
13197 !! result
13198 <p><span class="mw-formatted-date" title="01-15">January 15</span>
13199 </p>
13200 !! end
13201
13202 !! test
13203 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
13204 !! options
13205 language=nl title=[[MediaWiki:Common.css]]
13206 !! input
13207 {{#formatdate:2009-03-24|dmy}}
13208 !! result
13209 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
13210 </p>
13211 !! end
13212
13213 #
13214 #
13215 #
13216
13217 #
13218 # Edit comments
13219 #
13220
13221 !! test
13222 Edit comment with link
13223 !! options
13224 comment
13225 !! input
13226 I like the [[Main Page]] a lot
13227 !! result
13228 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
13229 !!end
13230
13231 !! test
13232 Edit comment with link and link text
13233 !! options
13234 comment
13235 !! input
13236 I like the [[Main Page|best pages]] a lot
13237 !! result
13238 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13239 !!end
13240
13241 !! test
13242 Edit comment with link and link text with suffix
13243 !! options
13244 comment
13245 !! input
13246 I like the [[Main Page|best page]]s a lot
13247 !! result
13248 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13249 !!end
13250
13251 !! test
13252 Edit comment with section link (non-local, eg in history list)
13253 !! options
13254 comment title=[[Main Page]]
13255 !! input
13256 /* External links */ removed bogus entries
13257 !! result
13258 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13259 !!end
13260
13261 !! test
13262 Edit comment with section link and text before it (non-local, eg in history list)
13263 !! options
13264 comment title=[[Main Page]]
13265 !! input
13266 pre-comment text /* External links */ removed bogus entries
13267 !! result
13268 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>
13269 !!end
13270
13271 !! test
13272 Edit comment with section link (local, eg in diff view)
13273 !! options
13274 comment local title=[[Main Page]]
13275 !! input
13276 /* External links */ removed bogus entries
13277 !! result
13278 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13279 !!end
13280
13281 !! test
13282 Edit comment with subpage link (bug 14080)
13283 !! options
13284 comment
13285 subpage
13286 title=[[Subpage test]]
13287 !! input
13288 Poked at a [[/subpage]] here...
13289 !! result
13290 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
13291 !!end
13292
13293 !! test
13294 Edit comment with subpage link and link text (bug 14080)
13295 !! options
13296 comment
13297 subpage
13298 title=[[Subpage test]]
13299 !! input
13300 Poked at a [[/subpage|neat little page]] here...
13301 !! result
13302 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
13303 !!end
13304
13305 !! test
13306 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
13307 !! options
13308 comment
13309 title=[[Subpage test]]
13310 !! input
13311 Poked at a [[/subpage]] here...
13312 !! result
13313 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...
13314 !!end
13315
13316 !! test
13317 Edit comment with bare anchor link (local, as on diff)
13318 !! options
13319 comment
13320 local
13321 title=[[Main Page]]
13322 !!input
13323 [[#section]]
13324 !! result
13325 <a href="#section">#section</a>
13326 !! end
13327
13328 !! test
13329 Edit comment with bare anchor link (non-local, as on history)
13330 !! options
13331 comment
13332 title=[[Main Page]]
13333 !!input
13334 [[#section]]
13335 !! result
13336 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
13337 !! end
13338
13339 !! test
13340 Anchor starting with underscore
13341 !!input
13342 [[#_ref|One]]
13343 !! result
13344 <p><a href="#_ref">One</a>
13345 </p>
13346 !! end
13347
13348 !! test
13349 Id starting with underscore
13350 !!input
13351 <div id="_ref"></div>
13352 !! result
13353 <div id="_ref"></div>
13354
13355 !! end
13356
13357 !! test
13358 Space normalisation on autocomment (bug 22784)
13359 !! options
13360 comment
13361 title=[[Main Page]]
13362 !!input
13363 /* __hello__world__ */
13364 !! result
13365 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
13366 !! end
13367
13368 !! test
13369 percent-encoding and + signs in comments (Bug 26410)
13370 !! options
13371 comment
13372 !!input
13373 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
13374 !! result
13375 <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>
13376 !! end
13377
13378 !! test
13379 Bad images - basic functionality
13380 !! options
13381 disabled
13382 !! input
13383 [[File:Bad.jpg]]
13384 !! result
13385 !! end
13386
13387 !! test
13388 Bad images - bug 16039: text after bad image disappears
13389 !! options
13390 disabled
13391 !! input
13392 Foo bar
13393 [[File:Bad.jpg]]
13394 Bar foo
13395 !! result
13396 <p>Foo bar
13397 </p><p>Bar foo
13398 </p>
13399 !! end
13400
13401 !! test
13402 Verify that displaytitle works (bug #22501) no displaytitle
13403 !! options
13404 showtitle
13405 !! config
13406 wgAllowDisplayTitle=true
13407 wgRestrictDisplayTitle=false
13408 !! input
13409 this is not the the title
13410 !! result
13411 Parser test
13412 <p>this is not the the title
13413 </p>
13414 !! end
13415
13416 !! test
13417 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
13418 !! options
13419 showtitle
13420 title=[[Screen]]
13421 !! config
13422 wgAllowDisplayTitle=true
13423 wgRestrictDisplayTitle=false
13424 !! input
13425 this is not the the title
13426 {{DISPLAYTITLE:whatever}}
13427 !! result
13428 whatever
13429 <p>this is not the the title
13430 </p>
13431 !! end
13432
13433 !! test
13434 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
13435 !! options
13436 showtitle
13437 title=[[Screen]]
13438 !! config
13439 wgAllowDisplayTitle=true
13440 wgRestrictDisplayTitle=true
13441 !! input
13442 this is not the the title
13443 {{DISPLAYTITLE:whatever}}
13444 !! result
13445 Screen
13446 <p>this is not the the title
13447 </p>
13448 !! end
13449
13450 !! test
13451 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
13452 !! options
13453 showtitle
13454 title=[[Screen]]
13455 !! config
13456 wgAllowDisplayTitle=true
13457 wgRestrictDisplayTitle=true
13458 !! input
13459 this is not the the title
13460 {{DISPLAYTITLE:screen}}
13461 !! result
13462 screen
13463 <p>this is not the the title
13464 </p>
13465 !! end
13466
13467 !! test
13468 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
13469 !! options
13470 showtitle
13471 title=[[Screen]]
13472 !! config
13473 wgAllowDisplayTitle=false
13474 !! input
13475 this is not the the title
13476 {{DISPLAYTITLE:screen}}
13477 !! result
13478 Screen
13479 <p>this is not the the title
13480 <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>
13481 </p>
13482 !! end
13483
13484 !! test
13485 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
13486 !! options
13487 showtitle
13488 title=[[Screen]]
13489 !! config
13490 wgAllowDisplayTitle=false
13491 !! input
13492 this is not the the title
13493 !! result
13494 Screen
13495 <p>this is not the the title
13496 </p>
13497 !! end
13498
13499 !! test
13500 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
13501 !! options
13502 showtitle
13503 title=[[Screen]]
13504 !! config
13505 wgAllowDisplayTitle=true
13506 wgRestrictDisplayTitle=true
13507 !! input
13508 this is not the the title
13509 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
13510 !! result
13511 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
13512 <p>this is not the the title
13513 </p>
13514 !! end
13515
13516 !! test
13517 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
13518 !! options
13519 showtitle
13520 title=[[Screen]]
13521 !! config
13522 wgAllowDisplayTitle=true
13523 wgRestrictDisplayTitle=true
13524 !! input
13525 this is not the the title
13526 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
13527 !! result
13528 <span style="color: red;">s</span>creen
13529 <p>this is not the the title
13530 </p>
13531 !! end
13532
13533 !! test
13534 preload: check <noinclude> and <includeonly>
13535 !! options
13536 preload
13537 !! input
13538 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
13539 !! result
13540 Hello kind world.
13541 !! end
13542
13543 !! test
13544 preload: check <onlyinclude>
13545 !! options
13546 preload
13547 !! input
13548 Goodbye <onlyinclude>Hello world</onlyinclude>
13549 !! result
13550 Hello world
13551 !! end
13552
13553 !! test
13554 preload: can pass tags through if we want to
13555 !! options
13556 preload
13557 !! input
13558 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
13559 !! result
13560 <includeonly>Hello world</includeonly>
13561 !! end
13562
13563 !! test
13564 preload: check that it doesn't try to do tricks
13565 !! options
13566 preload
13567 !! input
13568 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13569 !! result
13570 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13571 !! end
13572
13573 !! test
13574 Play a bit with r67090 and bug 3158
13575 !! options
13576 disabled
13577 !! input
13578 <div style="width:50% !important">&nbsp;</div>
13579 <div style="width:50%&nbsp;!important">&nbsp;</div>
13580 <div style="width:50%&#160;!important">&nbsp;</div>
13581 <div style="border : solid;">&nbsp;</div>
13582 !! result
13583 <div style="width:50% !important">&nbsp;</div>
13584 <div style="width:50% !important">&nbsp;</div>
13585 <div style="width:50% !important">&nbsp;</div>
13586 <div style="border&#160;: solid;">&nbsp;</div>
13587
13588 !! end
13589
13590 !! test
13591 HTML5 data attributes
13592 !! input
13593 <span data-foo="bar">Baz</span>
13594 <p data-abc-def_hij="">Quuz</p>
13595 !! result
13596 <p><span data-foo="bar">Baz</span>
13597 </p>
13598 <p data-abc-def_hij="">Quuz</p>
13599
13600 !! end
13601
13602 !! test
13603 percent-encoding and + signs in internal links (Bug 26410)
13604 !! input
13605 [[User:+%]] [[Page+title%]]
13606 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
13607 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
13608 [[%33%45]] [[%33%45+]]
13609 !! result
13610 <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>
13611 <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>
13612 <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>
13613 <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>
13614 </p>
13615 !! end
13616
13617 !! test
13618 Special characters in embedded file links (bug 27679)
13619 !! input
13620 [[File:Contains & ampersand.jpg]]
13621 [[File:Does not exist.jpg|Title with & ampersand]]
13622 !! result
13623 <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>
13624 <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>
13625 </p>
13626 !! end
13627
13628
13629 !! test
13630 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
13631 !! input
13632 Text&apos;s been normalized?
13633 !! result
13634 <p>Text&#39;s been normalized?
13635 </p>
13636 !! end
13637
13638 !! test
13639 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
13640 !! input
13641 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
13642 !! result
13643 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
13644 </p>
13645 !! end
13646
13647 !! test
13648 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
13649 !! input
13650 [http://www.example.org/ ideograms]
13651 !! result
13652 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
13653 </p>
13654 !! end
13655
13656 !! test
13657 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
13658 !! input
13659 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
13660 !! result
13661 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
13662 </p>
13663 !! end
13664
13665 !! article
13666 Mediawiki:loop1
13667 !! text
13668 {{Identical|A}}
13669 !! endarticle
13670
13671 !! article
13672 Mediawiki:loop2
13673 !! text
13674 {{Identical|B}}
13675 !! endarticle
13676
13677 !! article
13678 Template:Identical
13679 !! text
13680 {{int:loop1}}
13681 {{int:loop2}}
13682 !! endarticle
13683
13684 !! test
13685 Bug 31098 Template which includes system messages which includes the template
13686 !! input
13687 {{Identical}}
13688 !! result
13689 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13690 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13691 </p>
13692 !! end
13693
13694 !! test
13695 Bug31490 Turkish: ucfirst 'blah'
13696 !! options
13697 language=tr
13698 !! input
13699 {{ucfirst:blah}}
13700 !! result
13701 <p>Blah
13702 </p>
13703 !! end
13704
13705 !! test
13706 Bug31490 Turkish: ucfirst 'ix'
13707 !! options
13708 language=tr
13709 !! input
13710 {{ucfirst:ix}}
13711 !! result
13712 <p>İx
13713 </p>
13714 !! end
13715
13716 !! test
13717 Bug31490 Turkish: lcfirst 'BLAH'
13718 !! options
13719 language=tr
13720 !! input
13721 {{lcfirst:BLAH}}
13722 !! result
13723 <p>bLAH
13724 </p>
13725 !! end
13726
13727 !! test
13728 Bug31490 Turkish: ucfırst (with a dotless i)
13729 !! options
13730 language=tr
13731 !! input
13732 {{ucfırst:blah}}
13733 !! result
13734 <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>
13735 </p>
13736 !! end
13737
13738 !! test
13739 Bug31490 ucfırst (with a dotless i) with English language
13740 !! options
13741 language=en
13742 !! input
13743 {{ucfırst:blah}}
13744 !! result
13745 <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>
13746 </p>
13747 !! end
13748
13749 !! test
13750 Bug 26375: TOC with italics
13751 !! options
13752 title=[[Main Page]]
13753 !! input
13754 __TOC__
13755 == ''Lost'' episodes ==
13756 !! result
13757 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13758 <ul>
13759 <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>
13760 </ul>
13761 </div>
13762 <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>
13763
13764 !! end
13765
13766 !! test
13767 Bug 26375: TOC with bold
13768 !! options
13769 title=[[Main Page]]
13770 !! input
13771 __TOC__
13772 == '''should be bold''' then normal text ==
13773 !! result
13774 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13775 <ul>
13776 <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>
13777 </ul>
13778 </div>
13779 <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>
13780
13781 !! end
13782
13783 !! test
13784 Bug 33845: Headings become cursive in TOC when they contain an image
13785 !! options
13786 title=[[Main Page]]
13787 !! input
13788 __TOC__
13789 == Image [[Image:foobar.jpg]] ==
13790 !! result
13791 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13792 <ul>
13793 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
13794 </ul>
13795 </div>
13796 <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>
13797
13798 !! end
13799
13800 !! test
13801 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
13802 !! options
13803 title=[[Main Page]]
13804 !! input
13805 __TOC__
13806 == <blockquote>Quote</blockquote> ==
13807 !! result
13808 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13809 <ul>
13810 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
13811 </ul>
13812 </div>
13813 <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>
13814
13815 !! end
13816
13817 !! test
13818 Unclosed tags in TOC
13819 !! options
13820 title=[[Main Page]]
13821 !! input
13822 __TOC__
13823 == Proof: 2 < 3 ==
13824 <small>Hanc marginis exiguitas non caperet.</small>
13825 QED
13826 !! result
13827 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13828 <ul>
13829 <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>
13830 </ul>
13831 </div>
13832 <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>
13833 <p><small>Hanc marginis exiguitas non caperet.</small>
13834 QED
13835 </p>
13836 !! end
13837
13838 !! test
13839 Multiple tags in TOC
13840 !! input
13841 __TOC__
13842 == <i>Foo</i> <b>Bar</b> ==
13843
13844 == <i>Foo</i> <blockquote>Bar</blockquote> ==
13845 !! result
13846 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13847 <ul>
13848 <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>
13849 <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>
13850 </ul>
13851 </div>
13852 <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>
13853 <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>
13854
13855 !! end
13856
13857 !! test
13858 Tags with parameters in TOC
13859 !! input
13860 __TOC__
13861 == <sup class="in-h2">Hello</sup> ==
13862
13863 == <sup class="a > b">Evilbye</sup> ==
13864 !! result
13865 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13866 <ul>
13867 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
13868 <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>
13869 </ul>
13870 </div>
13871 <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>
13872 <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>
13873
13874 !! end
13875
13876 !! test
13877 span tags with directionality in TOC
13878 !! input
13879 __TOC__
13880 == <span dir="ltr">C++</span> ==
13881
13882 == <span dir="rtl">זבנג!</span> ==
13883
13884 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
13885
13886 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
13887
13888 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
13889 !! result
13890 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13891 <ul>
13892 <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>
13893 <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>
13894 <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>
13895 <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>
13896 <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>
13897 </ul>
13898 </div>
13899 <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>
13900 <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>
13901 <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>
13902 <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>
13903 <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>
13904
13905 !! end
13906
13907 !! article
13908 MediaWiki:Bug32057
13909 !! text
13910 == {{int:headline_sample}} ==
13911 !! endarticle
13912
13913 !! test
13914 Bug 32057: Title needed when expanding <h> nodes.
13915 !! options
13916 title=[[Main Page]]
13917 !! input
13918 {{int:Bug32057}}
13919 !! result
13920 <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>
13921
13922 !! end
13923
13924 !! test
13925 Strip marker in urlencode
13926 !! input
13927 {{urlencode:x<nowiki/>y}}
13928 {{urlencode:x<nowiki/>y|wiki}}
13929 {{urlencode:x<nowiki/>y|path}}
13930 !! result
13931 <p>xy
13932 xy
13933 xy
13934 </p>
13935 !! end
13936
13937 !! test
13938 Strip marker in lc
13939 !! input
13940 {{lc:x<nowiki/>y}}
13941 !! result
13942 <p>xy
13943 </p>
13944 !! end
13945
13946 !! test
13947 Strip marker in uc
13948 !! input
13949 {{uc:x<nowiki/>y}}
13950 !! result
13951 <p>XY
13952 </p>
13953 !! end
13954
13955 !! test
13956 Strip marker in formatNum
13957 !! input
13958 {{formatnum:1<nowiki/>2}}
13959 {{formatnum:1<nowiki/>2|R}}
13960 !! result
13961 <p>12
13962 12
13963 </p>
13964 !! end
13965
13966 !! test
13967 Check noCommafy in formatNum
13968 !! options
13969 language=be-tarask
13970 !! input
13971 {{formatnum:123456.78}}
13972 {{formatnum:123456.78|NOSEP}}
13973 !! result
13974 <p>123 456,78
13975 123456.78
13976 </p>
13977 !! end
13978
13979 !! test
13980 Strip marker in grammar
13981 !! options
13982 language=fi
13983 !! input
13984 {{grammar:elative|foo<nowiki/>bar}}
13985 !! result
13986 <p>foobarista
13987 </p>
13988 !! end
13989
13990 !! test
13991 Strip marker in padleft
13992 !! input
13993 {{padleft:|2|x<nowiki/>y}}
13994 !! result
13995 <p>xy
13996 </p>
13997 !! end
13998
13999 !! test
14000 Strip marker in padright
14001 !! input
14002 {{padright:|2|x<nowiki/>y}}
14003 !! result
14004 <p>xy
14005 </p>
14006 !! end
14007
14008 !! test
14009 Strip marker in anchorencode
14010 !! input
14011 {{anchorencode:x<nowiki/>y}}
14012 !! result
14013 <p>xy
14014 </p>
14015 !! end
14016
14017 !! test
14018 nowiki inside link inside heading (bug 18295)
14019 !! input
14020 ==[[foo|x<nowiki>y</nowiki>z]]==
14021 !! result
14022 <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>
14023
14024 !! end
14025
14026 !! test
14027 new support for bdi element (bug 31817)
14028 !! input
14029 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14030 !! result
14031 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14032
14033 !!end
14034
14035 !! test
14036 Ignore pipe between table row attributes
14037 !! input
14038 {|
14039 | quux
14040 |- id=foo | style='color: red'
14041 | bar
14042 |}
14043 !! result
14044 <table>
14045 <tr>
14046 <td> quux
14047 </td></tr>
14048 <tr id="foo" style="color: red">
14049 <td> bar
14050 </td></tr></table>
14051
14052 !! end
14053
14054 !!test
14055 Gallery override link with WikiLink (bug 34852)
14056 !! input
14057 <gallery>
14058 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
14059 </gallery>
14060 !! result
14061 <ul class="gallery">
14062 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14063 <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>
14064 <div class="gallerytext">
14065 <p>caption
14066 </p>
14067 </div>
14068 </div></li>
14069 </ul>
14070
14071 !! end
14072
14073 !!test
14074 Gallery override link with absolute external link (bug 34852)
14075 !! input
14076 <gallery>
14077 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
14078 </gallery>
14079 !! result
14080 <ul class="gallery">
14081 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14082 <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>
14083 <div class="gallerytext">
14084 <p>caption
14085 </p>
14086 </div>
14087 </div></li>
14088 </ul>
14089
14090 !! end
14091
14092 !!test
14093 Gallery override link with malicious javascript (bug 34852)
14094 !! input
14095 <gallery>
14096 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
14097 </gallery>
14098 !! result
14099 <ul class="gallery">
14100 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14101 <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>
14102 <div class="gallerytext">
14103 <p>caption
14104 </p>
14105 </div>
14106 </div></li>
14107 </ul>
14108
14109 !! end
14110
14111 !!test
14112 Gallery with invalid title as link (bug 43964)
14113 !! input
14114 <gallery>
14115 File:foobar.jpg|link=<
14116 </gallery>
14117 !! result
14118 <ul class="gallery">
14119 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14120 <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>
14121 <div class="gallerytext">
14122 </div>
14123 </div></li>
14124 </ul>
14125
14126 !! end
14127
14128 !!test
14129 Language parser function
14130 !! input
14131 {{#language:ar}}
14132 !! result
14133 <p>العربية
14134 </p>
14135 !! end
14136
14137 !!test
14138 Padleft and padright as substr
14139 !! input
14140 {{padleft:|3|abcde}}
14141 {{padright:|3|abcde}}
14142 !! result
14143 <p>abc
14144 abc
14145 </p>
14146 !! end
14147
14148 !!test
14149 Special parser function
14150 !! input
14151 {{#special:RandomPage}}
14152 {{#special:BaDtItLe}}
14153 {{#special:Foobar}}
14154 !! result
14155 <p>Special:Random
14156 Special:Badtitle
14157 Special:Foobar
14158 </p>
14159 !! end
14160
14161 !!test
14162 Bug 34939 - Case insensitive link parsing ([HttP://])
14163 !! input
14164 [HttP://MediaWiki.Org/]
14165 !! result
14166 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
14167 </p>
14168 !! end
14169
14170 !!test
14171 Bug 34939 - Case insensitive link parsing ([HttP:// title])
14172 !! input
14173 [HttP://MediaWiki.Org/ MediaWiki]
14174 !! result
14175 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
14176 </p>
14177 !! end
14178
14179 !!test
14180 Bug 34939 - Case insensitive link parsing (HttP://)
14181 !! input
14182 HttP://MediaWiki.Org/
14183 !! result
14184 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
14185 </p>
14186 !! end
14187
14188
14189 ###
14190 ### Parsoids-specific tests
14191 ### Parsoid-PHP parser incompatibilities
14192 ###
14193 !!test
14194 1. SOL-sensitive wikitext tokens as template-args
14195 !!options
14196 parsoid=wt2html,wt2wt
14197 !!input
14198 {{echo|*a}}
14199 {{echo|#a}}
14200 {{echo|:a}}
14201 !!result
14202 <span about="#mwt1" typeof="mw:Transclusion">
14203 </span><ul about="#mwt1"><li>a</li></ul>
14204 <span about="#mwt2" typeof="mw:Transclusion">
14205 </span><ol about="#mwt2"><li>a</li></ol>
14206 <span about="#mwt3" typeof="mw:Transclusion">
14207 </span><dl about="#mwt3"><dd>a</dd></dl>
14208 !!end
14209
14210 #### ----------------------------------------------------------------
14211 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
14212 #### tags. Parsoid's output for these tags differs from that of the
14213 #### PHP parser.
14214 #### ----------------------------------------------------------------
14215
14216 !!test
14217 Ref: 1. ref-location should be replaced with an index span
14218 !!options
14219 parsoid
14220 !!input
14221 A <ref>foo</ref>
14222 B <ref name="x">foo</ref>
14223 C <ref name="y" />
14224 !!result
14225 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span>
14226 B <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}' id="cite_ref-x-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-2">[2]</a></span>
14227 C <span about="#mwt3" class="reference" data-mw='{"name":"ref","attrs":{"name":"y"}}' id="cite_ref-y-3-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-y-3">[3]</a></span></p>
14228 !!end
14229
14230 !!test
14231 Ref: 2. ref-tags with identical names should all get the same index
14232 !!options
14233 parsoid
14234 !!input
14235 A <ref name="x">foo</ref>
14236 B <ref name="x" />
14237 !!result
14238 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}' id="cite_ref-x-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span>
14239 B <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{"name":"x"}}' id="cite_ref-x-1-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span></p>
14240 !!end
14241
14242 !!test
14243 Ref: 3. spaces in ref-names should be ignored
14244 !!options
14245 parsoid
14246 !!input
14247 A <ref name="x">foo</ref>
14248 B <ref name=" x " />
14249 C <ref name= x />
14250 !!result
14251 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}' id="cite_ref-x-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span>
14252 B <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{"name":"x"}}' id="cite_ref-x-1-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span>
14253 C <span about="#mwt3" class="reference" data-mw='{"name":"ref","attrs":{"name":"x"}}' id="cite_ref-x-1-2" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span></p>
14254 !!end
14255
14256 !!test
14257 Ref: 4. 'constructor' should be accepted as a valid ref-name
14258 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
14259 !!options
14260 parsoid
14261 !!input
14262 A <ref name="constructor">foo</ref>
14263 !!result
14264 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"constructor"}}' id="cite_ref-constructor-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-constructor-1">[1]</a></span></p>
14265 !!end
14266
14267 !!test
14268 Ref: 5. body should accept generic wikitext
14269 !!options
14270 parsoid
14271 !!input
14272 A <ref>
14273 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
14274 </ref>
14275
14276 <references />
14277 !!result
14278 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"This is a <b data-parsoid=\"{&amp;quot;dsr&amp;quot;:[19,40,3,3]}\"><a rel=\"mw:WikiLink\" href=\"./Bolded_link\" data-parsoid=\"{&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;./Bolded_link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;bolded link&amp;quot;},&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;dsr&amp;quot;:[22,37,2,2]}\">bolded link</a></b> and this is a <span about=\"#mwt3\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;transclusion&amp;quot;}}}\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;{{echo|transclusion}}&amp;quot;,&amp;quot;dsr&amp;quot;:[55,76,null,null]}\">transclusion</span>\n"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
14279
14280 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14281 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> This is a <b><a rel="mw:WikiLink" href="./Bolded_link">bolded link</a></b> and this is a <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"transclusion"}}}'>transclusion</span>
14282 </li></ol>
14283 !!end
14284
14285 !!test
14286 Ref: 6. indent-pres should not be output in ref-body
14287 !!options
14288 parsoid
14289 !!input
14290 A <ref>
14291 foo
14292 bar
14293 baz
14294 </ref>
14295
14296 <references />
14297 !!result
14298 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo\n bar\n baz\n"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
14299
14300 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14301 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
14302 bar
14303 baz
14304 </li></ol>
14305 !!end
14306
14307 !!test
14308 Ref: 6. No p-wrapping in ref-body
14309 !!options
14310 parsoid
14311 !!input
14312 A <ref>
14313 foo
14314
14315 bar
14316
14317
14318 baz
14319
14320
14321
14322 booz
14323 </ref>
14324
14325 <references />
14326 !!result
14327 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo\n\nbar\n\n\nbaz\n\n\n\nbooz\n"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
14328
14329 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14330 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
14331
14332 bar
14333
14334
14335 baz
14336
14337
14338
14339 booz
14340 </li></ol>
14341 !!end
14342
14343 !!test
14344 Ref: 8. transclusion wikitext has lower precedence
14345 !!options
14346 parsoid
14347 !!input
14348 A <ref> foo {{echo|</ref> B C}}
14349
14350 <references />
14351 !!result
14352 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo <span typeof=\"mw:Nowiki\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;{{&amp;quot;,&amp;quot;dsr&amp;quot;:[12,14,2,null]}\">{{</span>echo|"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> B C<span typeof="mw:Nowiki">}}</span></p>
14353
14354 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14355 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <span typeof="mw:Nowiki">{{</span>echo|</li></ol>
14356 !!end
14357
14358 !!test
14359 Ref: 9. unclosed comments should not leak out of ref-body
14360 !!options
14361 parsoid
14362 !!input
14363 A <ref> foo <!--</ref> B C
14364
14365 <references />
14366 !!result
14367 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo <!---->"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> B C</p>
14368
14369 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14370 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li></ol>
14371 !!end
14372
14373 !!test
14374 Ref: 10. Unclosed HTML tags should not leak out of ref-body
14375 !!options
14376 parsoid
14377 !!input
14378 A <ref> <b> foo </ref> B C
14379
14380 <references />
14381 !!result
14382 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"<b data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;autoInsertedEnd&amp;quot;:true,&amp;quot;dsr&amp;quot;:[8,16,3,0]}\"> foo </b>"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> B C</p>
14383
14384 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14385 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> <b> foo </b></li></ol>
14386 !!end
14387
14388 !!test
14389 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
14390 !!options
14391 parsoid
14392 !!input
14393 A <ref>foo</ref> B
14394 C <ref>bar</ref> D
14395 !!result
14396 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> B
14397 C <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[2]</a></span> D</p>
14398 !!end
14399
14400 !!test
14401 Ref: 12. ref-tags act as trailing newline migration barrier
14402 !!options
14403 parsoid
14404 !!input
14405 <!--the newline at the end of this line moves out of the p-tag-->a
14406
14407 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
14408 <ref />
14409
14410 c
14411 !!result
14412 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
14413
14414
14415 <p>b<!--the newline at the end of this line stays inside the p-tag--> <span about="#mwt1" class="reference" data-mw='{"name":"ref","attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span>
14416 <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[2]</a></span></p>
14417
14418
14419 <p>c</p>
14420 !!end
14421
14422 !!test
14423 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
14424 !!options
14425 parsoid
14426 !!input
14427 <ref>foo</ref> A
14428 <ref>bar
14429 </ref> B
14430 !!result
14431 <p><span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> A
14432 <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"bar\n"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[2]</a></span> B</p>
14433 !!end
14434
14435 !!test
14436 Ref: 14. A nested ref-tag should be emitted as plain text
14437 !!options
14438 parsoid
14439 !!input
14440 <ref>foo <ref>bar</ref> baz</ref>
14441
14442 <references />
14443 !!result
14444 <p><span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo &amp;lt;ref&amp;gt;bar"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> baz&lt;/ref&gt;</p>
14445
14446 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo &lt;ref&gt;bar</li></ol>
14447 !!end
14448
14449 !!test
14450 Ref: 15. ref-tags with identical names should get identical indexes
14451 !!options
14452 parsoid
14453 !!input
14454 A1 <ref name="a">foo</ref> A2 <ref name="a" />
14455 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
14456
14457 <references />
14458 !!result
14459 <p>A1 <span about="#mwt3" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"a"}}' id="cite_ref-a-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-a-1">[1]</a></span> A2 <span about="#mwt4" class="reference" data-mw='{"name":"ref","attrs":{"name":"a"}}' id="cite_ref-a-1-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-a-1">[1]</a></span>
14460 B1 <span about="#mwt7" class="reference" data-mw='{"name":"ref","attrs":{"name":"b"}}' id="cite_ref-b-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-b-2">[2]</a></span> B2 <span about="#mwt8" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"name":"b"}}' id="cite_ref-b-2-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-b-2">[2]</a></span></p>
14461
14462 <ol about="#mwt10" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy">↑ <a href="#cite_ref-a-1-0">1.0</a> <a href="#cite_ref-a-1-1">1.1</a></span> foo</li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy">↑ <a href="#cite_ref-b-2-0">2.0</a> <a href="#cite_ref-b-2-1">2.1</a></span> bar</li></ol>
14463 !!end
14464
14465 !!test
14466 References: 1. references tag without any refs should be handled properly
14467 !!options
14468 parsoid
14469 !!input
14470 <references />
14471 !!result
14472 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"></ol>
14473 !!end
14474
14475 !!test
14476 References: 2. references tag with group only outputs references from that group
14477 !!options
14478 parsoid
14479 !!input
14480 A <ref group="a">foo</ref>
14481 B <ref group="b">bar</ref>
14482
14483 <references group='a' />
14484 !!result
14485 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"group":"a"}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[a 1]</a></span>
14486 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"group":"b"}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[b 1]</a></span></p>
14487
14488 <ol about="#mwt6" class="references" data-mw='{"name":"references","attrs":{"group":"a"}}' typeof="mw:Extension/references"><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
14489 !!end
14490
14491 !!test
14492 References: 3. ref list should be cleared after processing references
14493 !!options
14494 parsoid
14495 !!input
14496 A <ref>foo</ref>
14497
14498 <references />
14499
14500 B <ref>bar</ref>
14501
14502 <references />
14503 !!result
14504 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
14505
14506 <ol about="#mwt4" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
14507
14508 <p>B <span about="#mwt6" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
14509
14510 <ol about="#mwt8" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> bar</li></ol>
14511 !!end
14512
14513 !!test
14514 References: 4. only referenced group should be cleared after processing references
14515 !!options
14516 parsoid
14517 !!input
14518 A <ref group="a">afoo</ref>
14519 B <ref>bfoo</ref>
14520
14521 <references group="a"/>
14522
14523 C <ref>cfoo</ref>
14524
14525 <references />
14526 !!result
14527 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"afoo"},"attrs":{"group":"a"}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[a 1]</a></span>
14528 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bfoo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"<ref>bfoo</ref>","dsr":[30,45,5,6]}'><a href="#cite_note-1">[1]</a></span></p>
14529
14530 <ol about="#mwt6" class="references" data-mw='{"name":"references","attrs":{"group":"a"}}' typeof="mw:Extension/references"><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> afoo</li></ol>
14531
14532 <p>C <span about="#mwt8" class="reference" data-mw='{"name":"ref","body":{"html":"cfoo"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[2]</a></span></p>
14533
14534 <ol about="#mwt10" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> bfoo</li><li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2-0">↑</a></span> cfoo</li></ol>
14535 !!end
14536
14537 !!test
14538 References: 5. ref tags in references should be processed while ignoring all other content
14539 !!options
14540 parsoid
14541 !!input
14542 A <ref name="a" />
14543 B <ref name="b">bar</ref>
14544
14545 <references>
14546 <ref name="a">foo</ref>
14547 This should just get lost.
14548 </references>
14549 !!result
14550 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{"name":"a"}}' id="cite_ref-a-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-a-1">[1]</a></span>
14551 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"name":"b"}}' id="cite_ref-b-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-b-2">[2]</a></span></p>
14552
14553 <ol about="#mwt7" class="references" data-mw='{"name":"references","body":{"extsrc":"<ref name=\"a\">foo</ref>\nThis should just get lost."},"attrs":{}}' typeof="mw:Extension/references"><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy"><a href="#cite_ref-a-1-0">↑</a></span> foo</li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b-2-0">↑</a></span> bar</li></ol>
14554 !!end
14555
14556 #### ----------------------------------------------------------------
14557 #### The following section of tests are primarily to test
14558 #### wikitext escaping capabilities of Parsoid. Given that
14559 #### escaping can be done any number of ways, the wikitext (input)
14560 #### is always adjusted to reflect how Parsoid adds nowiki
14561 #### escape tags.
14562 ####
14563 #### We are marking several tests as parsoid-only since the
14564 #### HTML in the result section is different from what the
14565 #### PHP parser generates for it.
14566 #### ----------------------------------------------------------------
14567
14568
14569 #### --------------- Headings ---------------
14570 #### 0. Unnested
14571 #### 1. Nested inside html <h1>=foo=</h1>
14572 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
14573 #### 3. Nested inside html with wikitext split by html tags
14574 #### 4. No escape needed
14575 #### 5. Empty headings <h1></h1>
14576 #### 6. Heading chars in SOL context
14577 #### ----------------------------------------
14578 !! test
14579 Headings: 0. Unnested
14580 !! options
14581 parsoid
14582 !! input
14583 <nowiki>=foo=</nowiki>
14584
14585 <nowiki> =foo= </nowiki>
14586 <!--cmt-->
14587 <nowiki>=foo=</nowiki>
14588
14589 =foo''a''<nowiki>=</nowiki>
14590 !! result
14591 <p><span typeof="mw:Nowiki">=foo=</span></p>
14592
14593 <p><span typeof="mw:Nowiki"> =foo= </span>
14594 <!--cmt-->
14595 <span typeof="mw:Nowiki">=foo=</span></p>
14596
14597 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
14598 !!end
14599
14600 !! test
14601 Headings: 1. Nested inside html
14602 !! options
14603 parsoid
14604 !! input
14605 =<nowiki>=foo=</nowiki>=
14606
14607 ==<nowiki>=foo=</nowiki>==
14608
14609 ===<nowiki>=foo=</nowiki>===
14610
14611 ====<nowiki>=foo=</nowiki>====
14612
14613 =====<nowiki>=foo=</nowiki>=====
14614
14615 ======<nowiki>=foo=</nowiki>======
14616 !! result
14617 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
14618 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
14619 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
14620 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
14621 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
14622 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
14623 !!end
14624
14625 !! test
14626 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
14627 !! options
14628 parsoid
14629 !! input
14630 =foo=
14631 <nowiki>*bar</nowiki>
14632
14633 =foo=
14634 =bar
14635
14636 =foo=
14637 <nowiki>=bar=</nowiki>
14638 !! result
14639 <h1>foo</h1>*bar
14640 <h1>foo</h1>=bar
14641 <h1>foo</h1>=bar=
14642 !!end
14643
14644 !! test
14645 Headings: 3. Nested inside html with wikitext split by html tags
14646 !! options
14647 parsoid
14648 !! input
14649 =='''bold'''<nowiki>foo=</nowiki>=
14650 !! result
14651 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
14652 !!end
14653
14654 !! test
14655 Headings: 4a. No escaping needed (testing just h1 and h2)
14656 !! options
14657 parsoid
14658 !! input
14659 ==foo=
14660
14661 =foo==
14662
14663 = =foo= =
14664
14665 ==foo= bar=
14666
14667 ===foo==
14668
14669 ==foo===
14670
14671 =''=''foo==
14672
14673 =<nowiki>=</nowiki>=
14674 !! result
14675 <h1>=foo</h1>
14676 <h1>foo=</h1>
14677 <h1> =foo= </h1>
14678 <h1>=foo= bar</h1>
14679 <h2>=foo</h2>
14680 <h2>foo=</h2>
14681 <h1><i>=</i>foo=</h1>
14682 <h1><span typeof="mw:Nowiki">=</span></h1>
14683 !!end
14684
14685 !! test
14686 Headings: 4b. No escaping needed (inside p-tags)
14687 !! options
14688 parsoid
14689 !! input
14690 ===
14691 =foo= x
14692 =foo= <s></s>
14693 !! result
14694 <p>===
14695 =foo= x
14696 =foo= <s></s>
14697 </p>
14698 !!end
14699
14700 !! test
14701 Headings: 5. Empty headings
14702 !! options
14703 parsoid
14704 !! input
14705 =<nowiki/>=
14706
14707 ==<nowiki/>==
14708
14709 ===<nowiki/>===
14710
14711 ====<nowiki/>====
14712
14713 =====<nowiki/>=====
14714
14715 ======<nowiki/>======
14716 !! result
14717 <h1></h1>
14718 <h2></h2>
14719 <h3></h3>
14720 <h4></h4>
14721 <h5></h5>
14722 <h6></h6>
14723 !!end
14724
14725 !! test
14726 Headings: 6a. Heading chars in SOL context (with trailing spaces)
14727 !! options
14728 parsoid
14729 !! input
14730 <nowiki>=a=</nowiki>
14731
14732 <nowiki>=a= </nowiki>
14733
14734 <nowiki>=a= </nowiki>
14735
14736 <nowiki>=a= </nowiki>
14737 !! result
14738 <p>=a=</p>
14739 <p>=a= </p>
14740 <p>=a= </p>
14741 <p>=a= </p>
14742 !!end
14743
14744 !! test
14745 Headings: 6b. Heading chars in SOL context (with trailing newlines)
14746 !! options
14747 parsoid
14748 !! input
14749 <nowiki>=a=
14750 b</nowiki>
14751
14752 <nowiki>=a=
14753 b</nowiki>
14754
14755 <nowiki>=a=
14756 b</nowiki>
14757
14758 <nowiki>=a=
14759 b</nowiki>
14760 !! result
14761 <p>=a=
14762 b</p>
14763 <p>=a=
14764 b</p>
14765 <p>=a=
14766 b</p>
14767 <p>=a=
14768 b</p>
14769 </p>
14770 !!end
14771
14772 !! test
14773 Headings: 6c. Heading chars in SOL context (leading newline break)
14774 !! options
14775 parsoid
14776 !! input
14777 <nowiki>a
14778 =b=</nowiki>
14779 !! result
14780 <p>a
14781 =b=</p>
14782 !!end
14783
14784 !! test
14785 Headings: 6d. Heading chars in SOL context (with interspersed comments)
14786 !! options
14787 parsoid
14788 !! input
14789 <!--c0--><nowiki>=a=</nowiki>
14790 <!--c1-->
14791 <nowiki>=a= </nowiki><!--c2--> <!--c3-->
14792 !! result
14793 <p><!--c0-->=a=</p>
14794 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
14795 !!end
14796
14797 !! test
14798 Headings: 6d. Heading chars in SOL context (No escaping needed)
14799 !! options
14800 parsoid=html2wt
14801 !! input
14802 =a=<div>b</div>
14803 !! result
14804 =a=<div>b</div>
14805 !!end
14806
14807 #### --------------- Lists ---------------
14808 #### 0. Outside nests (*foo, etc.)
14809 #### 1. Nested inside html <ul><li>*foo</li></ul>
14810 #### 2. Inside definition lists
14811 #### 3. Only bullets at start should be escaped
14812 #### 4. No escapes needed
14813 #### 5. No unnecessary escapes
14814 #### 6. Escape bullets in SOL position
14815 #### 7. Escape bullets in a multi-line context
14816 #### ----------------------------------------
14817
14818 !! test
14819 Lists: 0. Outside nests
14820 !! input
14821 <nowiki>*foo</nowiki>
14822
14823 <nowiki>#foo</nowiki>
14824 !! result
14825 <p>*foo
14826 </p><p>#foo
14827 </p>
14828 !!end
14829
14830 !! test
14831 Lists: 1. Nested inside html
14832 !! input
14833 *<nowiki>*foo</nowiki>
14834
14835 *<nowiki>#foo</nowiki>
14836
14837 *<nowiki>:foo</nowiki>
14838
14839 *<nowiki>;foo</nowiki>
14840
14841 #<nowiki>*foo</nowiki>
14842
14843 #<nowiki>#foo</nowiki>
14844
14845 #<nowiki>:foo</nowiki>
14846
14847 #<nowiki>;foo</nowiki>
14848 !! result
14849 <ul><li>*foo
14850 </li></ul>
14851 <ul><li>#foo
14852 </li></ul>
14853 <ul><li>:foo
14854 </li></ul>
14855 <ul><li>;foo
14856 </li></ul>
14857 <ol><li>*foo
14858 </li></ol>
14859 <ol><li>#foo
14860 </li></ol>
14861 <ol><li>:foo
14862 </li></ol>
14863 <ol><li>;foo
14864 </li></ol>
14865
14866 !!end
14867
14868 !! test
14869 Lists: 2. Inside definition lists
14870 !! input
14871 ;<nowiki>;foo</nowiki>
14872
14873 ;<nowiki>:foo</nowiki>
14874
14875 ;<nowiki>:foo</nowiki>
14876 :bar
14877
14878 :<nowiki>:foo</nowiki>
14879 !! result
14880 <dl><dt>;foo
14881 </dt></dl>
14882 <dl><dt>:foo
14883 </dt></dl>
14884 <dl><dt>:foo
14885 </dt><dd>bar
14886 </dd></dl>
14887 <dl><dd>:foo
14888 </dd></dl>
14889
14890 !!end
14891
14892 !! test
14893 Lists: 3. Only bullets at start of text should be escaped
14894 !! input
14895 *<nowiki>*foo*bar</nowiki>
14896
14897 *<nowiki>*foo</nowiki>''it''*bar
14898 !! result
14899 <ul><li>*foo*bar
14900 </li></ul>
14901 <ul><li>*foo<i>it</i>*bar
14902 </li></ul>
14903
14904 !!end
14905
14906 !! test
14907 Lists: 4. No escapes needed
14908 !! options
14909 parsoid
14910 !! input
14911 *foo*bar
14912
14913 *''foo''*bar
14914
14915 *[[Foo]]: bar
14916 !! result
14917 <ul><li>foo*bar
14918 </li></ul>
14919 <ul><li><i>foo</i>*bar
14920 </li></ul>
14921 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
14922 </li></ul>
14923 !!end
14924
14925 !! test
14926 Lists: 5. No unnecessary escapes
14927 !! input
14928 * bar <span><nowiki>[[foo]]</nowiki></span>
14929
14930 *=bar <span><nowiki>[[foo]]</nowiki></span>
14931
14932 *[[bar <span><nowiki>[[foo]]</nowiki></span>
14933
14934 *]]bar <span><nowiki>[[foo]]</nowiki></span>
14935
14936 *=bar <span>foo]]</span>=
14937
14938 * <s></s>: a
14939 !! result
14940 <ul><li> bar <span>[[foo]]</span>
14941 </li></ul>
14942 <ul><li>=bar <span>[[foo]]</span>
14943 </li></ul>
14944 <ul><li>[[bar <span>[[foo]]</span>
14945 </li></ul>
14946 <ul><li>]]bar <span>[[foo]]</span>
14947 </li></ul>
14948 <ul><li>=bar <span>foo]]</span>=
14949 </li></ul>
14950 <ul><li> <s></s>: a
14951 </li></ul>
14952
14953 !!end
14954
14955 !! test
14956 Lists: 6. Escape bullets in SOL position
14957 !! options
14958 parsoid
14959 !! input
14960 <!--cmt--><nowiki>*foo</nowiki>
14961 !! result
14962 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
14963 !!end
14964
14965 !! test
14966 Lists: 7. Escape bullets in a multi-line context
14967 !! input
14968 <nowiki>a
14969 *b</nowiki>
14970 !! result
14971 <p>a
14972 *b
14973 </p>
14974 !!end
14975
14976 #### --------------- HRs ---------------
14977 #### 1. Single line
14978 #### -----------------------------------
14979
14980 !! test
14981 HRs: 1. Single line
14982 !! options
14983 parsoid
14984 !! input
14985 ----<nowiki>----</nowiki>
14986 ----=foo=
14987 ----*foo
14988 !! result
14989 <hr><span typeof="mw:Nowiki">----</span>
14990 <hr>=foo=
14991 <hr>*foo
14992 !! end
14993
14994 #### --------------- Tables ---------------
14995 #### 1a. Simple example
14996 #### 1b. No escaping needed (!foo)
14997 #### 1c. No escaping needed (|foo)
14998 #### 1d. No escaping needed (|}foo)
14999 ####
15000 #### 2a. Nested in td (<td>foo|bar</td>)
15001 #### 2b. Nested in td (<td>foo||bar</td>)
15002 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
15003 ####
15004 #### 3a. Nested in th (<th>foo!bar</th>)
15005 #### 3b. Nested in th (<th>foo!!bar</th>)
15006 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
15007 ####
15008 #### 4a. Escape -
15009 #### 4b. Escape +
15010 #### 4c. No escaping needed
15011 #### --------------------------------------
15012
15013 !! test
15014 Tables: 1a. Simple example
15015 !! input
15016 <nowiki>{|
15017 |}</nowiki>
15018 !! result
15019 <p>{|
15020 |}
15021 </p>
15022 !! end
15023
15024 !! test
15025 Tables: 1b. No escaping needed
15026 !! input
15027 !foo
15028 !! result
15029 <p>!foo
15030 </p>
15031 !! end
15032
15033 !! test
15034 Tables: 1c. No escaping needed
15035 !! input
15036 |foo
15037 !! result
15038 <p>|foo
15039 </p>
15040 !! end
15041
15042 !! test
15043 Tables: 1d. No escaping needed
15044 !! input
15045 |}foo
15046 !! result
15047 <p>|}foo
15048 </p>
15049 !! end
15050
15051 !! test
15052 Tables: 2a. Nested in td
15053 !! options
15054 parsoid
15055 !! input
15056 {|
15057 |<nowiki>foo|bar</nowiki>
15058 |}
15059 !! result
15060 <table><tbody><tr>
15061 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
15062 !! end
15063
15064 !! test
15065 Tables: 2b. Nested in td
15066 !! options
15067 parsoid
15068 !! input
15069 {|
15070 |<nowiki>foo||bar</nowiki>
15071 |''it''<nowiki>foo||bar</nowiki>
15072 |}
15073 !! result
15074 <table><tbody><tr>
15075 <td><span typeof="mw:Nowiki">foo||bar</span></td>
15076 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
15077 !! end
15078
15079 !! test
15080 Tables: 2c. Nested in td -- no escaping needed
15081 !! options
15082 parsoid
15083 !! input
15084 {|
15085 |foo!!bar
15086 |}
15087 !! result
15088 <table><tbody><tr><td>foo!!bar
15089 </td></tr></tbody></table>
15090
15091 !! end
15092
15093 !! test
15094 Tables: 3a. Nested in th
15095 !! options
15096 parsoid
15097 !! input
15098 {|
15099 !foo!bar
15100 |}
15101 !! result
15102 <table><tbody><tr><th>foo!bar
15103 </th></tr></tbody></table>
15104
15105 !! end
15106
15107 !! test
15108 Tables: 3b. Nested in th
15109 !! options
15110 parsoid
15111 !! input
15112 {|
15113 !<nowiki>foo!!bar</nowiki>
15114 |}
15115 !! result
15116 <table>
15117 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
15118 </tbody></table>
15119 !! end
15120
15121 !! test
15122 Tables: 3c. Nested in th -- no escaping needed
15123 !! options
15124 parsoid
15125 !! input
15126 {|
15127 !<nowiki>foo||bar</nowiki>
15128 |}
15129 !! result
15130 <table><tbody><tr>
15131 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
15132 !! end
15133
15134 !! test
15135 Tables: 4a. Escape -
15136 !! options
15137 parsoid
15138 !! input
15139 {|
15140 |-
15141 !-bar
15142 |-
15143 |<nowiki>-bar</nowiki>
15144 |}
15145 !! result
15146 <table><tbody>
15147 <tr><th>-bar</th></tr>
15148 <tr>
15149 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
15150 !! end
15151
15152 !! test
15153 Tables: 4b. Escape +
15154 !! options
15155 parsoid
15156 !! input
15157 {|
15158 |-
15159 !+bar
15160 |-
15161 |<nowiki>+bar</nowiki>
15162 |}
15163 !! result
15164 <table><tbody>
15165 <tr><th>+bar</th></tr>
15166 <tr>
15167 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
15168 !! end
15169
15170 !! test
15171 Tables: 4c. No escaping needed
15172 !! options
15173 parsoid
15174 !! input
15175 {|
15176 |-
15177 |foo-bar
15178 |foo+bar
15179 |-
15180 |''foo''-bar
15181 |''foo''+bar
15182 |}
15183 !! result
15184 <table><tbody>
15185 <tr><td>foo-bar</td><td>foo+bar</td></tr>
15186 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
15187 </tbody></table>
15188 !! end
15189
15190 ### SSS FIXME: Disabled right now because accurate html2wt
15191 ### on this snippet requires data-parsoid flags that we've
15192 ### stripped out of these tests. We should scheme how we
15193 ### we want to handle these kind of tests that require
15194 ### data-parsoid flags for accurate html2wt serialization
15195
15196 !! test
15197 Tables: 4d. No escaping needed
15198 !! options
15199 disabled
15200 !! input
15201 {|
15202 ||+1
15203 ||-2
15204 |}
15205 !! result
15206 <table>
15207 <tr>
15208 <td>+1
15209 </td>
15210 <td>-2
15211 </td></tr></table>
15212
15213 !! end
15214
15215 #### --------------- Links ----------------
15216 #### 1. Quote marks in link text
15217 #### 2. Wikilinks: Escapes needed
15218 #### 3. Wikilinks: No escapes needed
15219 #### 4. Extlinks: Escapes needed
15220 #### 5. Extlinks: No escapes needed
15221 #### --------------------------------------
15222 !! test
15223 Links 1. Quote marks in link text
15224 !! options
15225 parsoid
15226 !! input
15227 [[Foo|<nowiki>Foo''boo''</nowiki>]]
15228 !! result
15229 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
15230 !! end
15231
15232 !! test
15233 Links 2. WikiLinks: Escapes needed
15234 !! options
15235 parsoid
15236 !! input
15237 [[Foo|<nowiki>[Foobar]</nowiki>]]
15238 [[Foo|<nowiki>Foobar]</nowiki>]]
15239 [[Foo|x [Foobar] x]]
15240 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
15241 [[Foo|<nowiki>[[Bar]]</nowiki>]]
15242 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
15243 [[Foo|<nowiki>|Bar</nowiki>]]
15244 [[Foo|<nowiki>]]bar</nowiki>]]
15245 [[Foo|<nowiki>[[bar</nowiki>]]
15246 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
15247 !! result
15248 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
15249 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
15250 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
15251 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
15252 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
15253 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
15254 <a href="Foo" rel="mw:WikiLink">|Bar</a>
15255 <a href="Foo" rel="mw:WikiLink">]]bar</a>
15256 <a href="Foo" rel="mw:WikiLink">[[bar</a>
15257 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
15258 !! end
15259
15260 !! test
15261 Links 3. WikiLinks: No escapes needed
15262 !! options
15263 parsoid
15264 !! input
15265 [[Foo|[Foobar]]
15266 [[Foo|foo|bar]]
15267 !! result
15268 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
15269 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
15270 !! end
15271
15272 !! test
15273 Links 4. ExtLinks: Escapes needed
15274 !! options
15275 parsoid
15276 !! input
15277 [http://google.com <nowiki>[google]</nowiki>]
15278 [http://google.com <nowiki>google]</nowiki>]
15279 !! result
15280 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
15281 <a href="http://google.com" rel="mw:ExtLink">google]</a>
15282 !! end
15283
15284 !! test
15285 Links 5. ExtLinks: No escapes needed
15286 !! options
15287 parsoid
15288 !! input
15289 [http://google.com [google]
15290 !! result
15291 <a href="http://google.com" rel="mw:ExtLink">[google</a>
15292 !! end
15293
15294 #### --------------- Quotes ---------------
15295 #### 1. Quotes inside <b> and <i>
15296 #### 2. Link fragments separated by <i> and <b> tags
15297 #### 3. Link fragments inside <i> and <b>
15298 #### --------------------------------------
15299 !! test
15300 1. Quotes inside <b> and <i>
15301 !! input
15302 ''<nowiki>'foo'</nowiki>''
15303 ''<nowiki>''foo''</nowiki>''
15304 ''<nowiki>'''foo'''</nowiki>''
15305 ''foo''<nowiki>'s</nowiki>
15306 '''<nowiki>'foo'</nowiki>'''
15307 '''<nowiki>''foo''</nowiki>'''
15308 '''<nowiki>'''foo'''</nowiki>'''
15309 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
15310 '''foo'''<nowiki>'s</nowiki>
15311 !! result
15312 <p><i>'foo'</i>
15313 <i>''foo''</i>
15314 <i>'''foo'''</i>
15315 <i>foo</i>'s
15316 <b>'foo'</b>
15317 <b>''foo''</b>
15318 <b>'''foo'''</b>
15319 <b>foo'<i>bar'</i>baz</b>
15320 <b>foo</b>'s
15321 </p>
15322 !! end
15323
15324 !! test
15325 2. Link fragments separated by <i> and <b> tags
15326 !! input
15327 [[''foo''<nowiki>hello]]</nowiki>
15328
15329 [['''foo'''<nowiki>hello]]</nowiki>
15330 !! result
15331 <p>[[<i>foo</i>hello]]
15332 </p><p>[[<b>foo</b>hello]]
15333 </p>
15334 !! end
15335
15336 !! test
15337 2. Link fragments inside <i> and <b>
15338 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
15339 this is one of the shortcomings of this format)
15340 !! input
15341 ''[[foo''<nowiki>]]</nowiki>
15342
15343 '''[[foo'''<nowiki>]]</nowiki>
15344 !! result
15345 <p><i>[[foo</i>]]
15346 </p><p><b>[[foo</b>]]
15347 </p>
15348 !! end
15349
15350 #### ----------- Paragraphs ---------------
15351 #### 1. No unnecessary escapes
15352 #### --------------------------------------
15353
15354 !! test
15355 1. No unnecessary escapes
15356 !! input
15357 bar <span><nowiki>[[foo]]</nowiki></span>
15358
15359 =bar <span><nowiki>[[foo]]</nowiki></span>
15360
15361 [[bar <span><nowiki>[[foo]]</nowiki></span>
15362
15363 ]]bar <span><nowiki>[[foo]]</nowiki></span>
15364
15365 =bar <span>foo]]</span><nowiki>=</nowiki>
15366 !! result
15367 <p>bar <span>[[foo]]</span>
15368 </p><p>=bar <span>[[foo]]</span>
15369 </p><p>[[bar <span>[[foo]]</span>
15370 </p><p>]]bar <span>[[foo]]</span>
15371 </p><p>=bar <span>foo]]</span>=
15372 </p>
15373 !!end
15374
15375 #### ----------------------- PRE --------------------------
15376 #### 1. Leading whitespace in SOL context should be escaped
15377 #### ------------------------------------------------------
15378 !! test
15379 1. Leading whitespace in SOL context should be escaped
15380 !! options
15381 parsoid
15382 !! input
15383 <nowiki> a</nowiki>
15384
15385 <nowiki> a</nowiki>
15386
15387 <nowiki> a(tab)</nowiki>
15388
15389 <nowiki> a</nowiki>
15390 <!--cmt-->
15391 <nowiki> a</nowiki>
15392
15393 <nowiki>a
15394 b</nowiki>
15395
15396 <nowiki>a
15397 b</nowiki>
15398
15399 <nowiki>a
15400 b</nowiki>
15401 !! result
15402 <p> a</p>
15403 <p> a</p>
15404 <p> a(tab)</p>
15405 <p> a</p>
15406 <p><!--cmt--> a</p>
15407 <p>a
15408 b</p>
15409 <p>a
15410 b</p>
15411 <p>a
15412 b</p>
15413 !! end
15414
15415 #### --------------- HTML tags ---------------
15416 #### 1. a tags
15417 #### 2. other tags
15418 #### 3. multi-line html tag
15419 #### -----------------------------------------
15420 !! test
15421 1. a tags
15422 !! options
15423 parsoid
15424 !! input
15425 <a href="http://google.com">google</a>
15426 !! result
15427 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
15428 !! end
15429
15430 !! test
15431 2. other tags
15432 !! input
15433 <nowiki><div>foo</div>
15434 <div style="color:red">foo</div></nowiki>
15435 !! result
15436 <p>&lt;div&gt;foo&lt;/div&gt;
15437 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
15438 </p>
15439 !! end
15440
15441 !! test
15442 3. multi-line html tag
15443 !! input
15444 <nowiki><div
15445 >foo</div
15446 ></nowiki>
15447 !! result
15448 <p>&lt;div
15449 &gt;foo&lt;/div
15450 &gt;
15451 </p>
15452 !! end
15453
15454 #### --------------- Others ---------------
15455 !! test
15456 Escaping nowikis
15457 !! input
15458 &lt;nowiki&gt;foo&lt;/nowiki&gt;
15459 !! result
15460 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
15461 </p>
15462 !! end
15463 !! test
15464
15465 Tag-like HTML structures are passed through as text
15466 !! input
15467 <x y>
15468
15469 <x.y>
15470
15471 <x-y>
15472
15473 1>2
15474
15475 x<y
15476
15477 a>b
15478
15479 1<d e>f
15480 !! result
15481 <p>&lt;x y&gt;
15482 </p><p>&lt;x.y&gt;
15483 </p><p>&lt;x-y&gt;
15484 </p><p>1&gt;2
15485 </p><p>x&lt;y
15486 </p><p>a&gt;b
15487 </p><p>1&lt;d e&gt;f
15488 </p>
15489 !! end
15490
15491
15492 # This fails in the PHP parser (see bug 40670,
15493 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
15494 !! test
15495 Tag names followed by punctuation should not be recognized as tags
15496 !! options
15497 parsoid
15498 !! input
15499 <s.ome> text
15500 !! result
15501 <p>&lt;s.ome&gt; text
15502 </p>
15503 !! end
15504
15505 !! test
15506 HTML tag with necessary entities in attributes
15507 !! input
15508 <span title="&amp;amp;">foo</span>
15509 !! result
15510 <p><span title="&amp;amp;">foo</span>
15511 </p>
15512 !! end
15513
15514 !! test
15515 HTML tag with 'unnecessary' entity encoding in attributes
15516 !! input
15517 <span title="&amp;">foo</span>
15518 !! result
15519 <p><span title="&amp;">foo</span>
15520 </p>
15521 !! end
15522
15523 !! test
15524 HTML tag with broken attribute value quoting
15525 !! input
15526 <span title="Hello world>Foo</span>
15527 !! result
15528 <p><span>Foo</span>
15529 </p>
15530 !! end
15531
15532 !! test
15533 Parsoid-only: HTML tag with broken attribute value quoting
15534 !! options
15535 parsoid
15536 !! input
15537 <span title="Hello world>Foo</span>
15538 !! result
15539 <p><span title="Hello world">Foo</span>
15540 </p>
15541 !! end
15542
15543 !! test
15544 Table with broken attribute value quoting
15545 !! input
15546 {|
15547 | title="Hello world|Foo
15548 |}
15549 !! result
15550 <table>
15551 <tr>
15552 <td>Foo
15553 </td></tr></table>
15554
15555 !! end
15556
15557 !! test
15558 Table with broken attribute value quoting on consecutive lines
15559 !! input
15560 {|
15561 | title="Hello world|Foo
15562 | style="color:red|Bar
15563 |}
15564 !! result
15565 <table>
15566 <tr>
15567 <td>Foo
15568 </td>
15569 <td>Bar
15570 </td></tr></table>
15571
15572 !! end
15573
15574 !! test
15575 Parsoid-only: Table with broken attribute value quoting on consecutive lines
15576 !! options
15577 parsoid
15578 !! input
15579 {|
15580 | title="Hello world|Foo
15581 | style="color:red|Bar
15582 |}
15583 !! result
15584 <table><tbody>
15585 <tr>
15586 <td title="Hello world">Foo
15587 </td><td style="color: red">Bar
15588 </td></tr></tbody></table>
15589
15590 !! end
15591
15592 !! test
15593 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
15594 !! options
15595 parsoid
15596 !! input
15597 {{}}
15598 !! result
15599 {{}}
15600 !! end
15601
15602 !! test
15603 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
15604 !! options
15605 parsoid
15606 !! input
15607 }}{{
15608 !! result
15609 }}{{
15610 !! end
15611
15612 !!test
15613 Accept empty td cell attribute
15614 !!input
15615 {|
15616 | align="center" | foo || |
15617 |}
15618 !!result
15619 <table>
15620 <tr>
15621 <td align="center"> foo </td>
15622 <td>
15623 </td></tr></table>
15624
15625 !!end
15626
15627 !!test
15628 Non-empty attributes in th-cells
15629 !!input
15630 {|
15631 ! Foo !! style="color: red" | Bar
15632 |}
15633 !!result
15634 <table>
15635 <tr>
15636 <th> Foo </th>
15637 <th style="color: red"> Bar
15638 </th></tr></table>
15639
15640 !!end
15641
15642 !!test
15643 Accept empty attributes in th-cells
15644 !!input
15645 {|
15646 !| foo !!| bar
15647 |}
15648 !!result
15649 <table>
15650 <tr>
15651 <th> foo </th>
15652 <th> bar
15653 </th></tr></table>
15654
15655 !!end
15656
15657 !!test
15658 Empty table rows go away
15659 !!input
15660 {|
15661 | Hello
15662 | there
15663 |- class="foo"
15664 |-
15665 |}
15666 !! result
15667 <table>
15668 <tr>
15669 <td> Hello
15670 </td>
15671 <td> there
15672 </td></tr>
15673
15674 </table>
15675
15676 !! end
15677
15678 ###
15679 ### Parsoid-centric tests for testing RTing of inter-element separators
15680 ### Edge cases not tested by existing parser tests and specific to
15681 ### Parsoid-specific serialization strategies.
15682 ###
15683
15684 !!test
15685 RT-ed inter-element separators should be valid separators
15686 !!input
15687 {|
15688 |- [[foo]]
15689 |}
15690 !!result
15691 <table>
15692
15693 </table>
15694
15695 !!end
15696
15697 !!test
15698 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
15699 (Parsoid-only since PHP parser relies on Tidy for correct output)
15700 !!options
15701 parsoid
15702 !!input
15703 {|
15704 |<small>foo
15705 bar
15706 |}
15707
15708 {|
15709 |<small>foo<small>
15710 |}
15711 !!result
15712 !!end
15713
15714 !!test
15715 Empty TD followed by TD with tpl-generated attribute
15716 !!input
15717 {|
15718 |-
15719 |
15720 |{{echo|style='color:red'}}|foo
15721 |}
15722 !!result
15723 <table>
15724
15725 <tr>
15726 <td>
15727 </td>
15728 <td>foo
15729 </td></tr></table>
15730
15731 !!end
15732
15733 !!test
15734 Indented table with an empty td
15735 !!input
15736 {|
15737 |-
15738 |
15739 |foo
15740 |}
15741 !!result
15742 <table>
15743
15744 <tr>
15745 <td>
15746 </td>
15747 <td>foo
15748 </td></tr></table>
15749
15750 !!end
15751
15752 !!test
15753 Empty TR followed by a template-generated TR
15754 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
15755 !!options
15756 parsoid=wt2html,wt2wt
15757 !!input
15758 {|
15759 |-
15760 {{echo|<tr><td>foo</td></tr>}}
15761 |}
15762 !!result
15763 <table>
15764 <tbody>
15765 <tr></tr>
15766 <tr typeof="mw:Transclusion">
15767 <td>foo</td></tr></tbody></table>
15768 !!end
15769
15770 ## PHP and parsoid output differ for this, and since this is primarily
15771 ## for testing Parsoid's serializer, marking this Parsoid only
15772 !!test
15773 Empty TR followed by mixed-ws-comment line should RT correctly
15774 !!options
15775 parsoid
15776 !!input
15777 {|
15778 |-
15779 <!--c-->
15780 |-
15781 <!--c--> <!--d-->
15782 |}
15783 !!result
15784 <table>
15785 <tbody>
15786 <tr>
15787 <td> <!--c--></td></tr>
15788 <tr>
15789 <td><!--c--> <!--d--></td></tr>
15790 </tbody></table>
15791
15792 !!end
15793
15794 !!test
15795 Multi-line image caption generated by templates with/without trailing newlines
15796 !!options
15797 parsoid
15798 !!input
15799 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
15800 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
15801 !!result
15802 <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>
15803 <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>
15804
15805 !!end
15806
15807 ## PHP emits broken html for this, and since this is primarily
15808 ## a Parsoid serializer test, marking this Parsoid only
15809 !!test
15810 Improperly nested inline or quotes tags with whitespace in between
15811 !!options
15812 parsoid
15813 !!input
15814 <span> <s>x</span> </s>
15815 ''' ''x''' ''
15816 !!result
15817 <p><span> <s>x</s></span><s> </s>
15818 <b> <i>x</i></b><i> </i>
15819 </p>
15820 !!end
15821
15822
15823 TODO:
15824 more images
15825 more tables
15826 character entities
15827 and much more
15828 Try for 100% code coverage