Merge "SpecialUserlogin: fix typo in comment"
[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"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></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"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></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"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></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 ### Parsoid-centric tests for testing RT edge cases for pre
1530 ###
1531
1532 !!test
1533 1a. Indent-Pre and Comments
1534 !!input
1535 a
1536 <!--a-->
1537 c
1538 !!result
1539 <pre>a
1540 </pre>
1541 <p>c
1542 </p>
1543 !!end
1544
1545 !!test
1546 1b. Indent-Pre and Comments
1547 !!input
1548 a
1549 <!--a-->
1550 c
1551 !!result
1552 <pre>a
1553 </pre>
1554 <p>c
1555 </p>
1556 !!end
1557
1558 !!test
1559 1c. Indent-Pre and Comments
1560 !!input
1561 <!--a--> a
1562
1563 <!--a--> a
1564 !!result
1565 <pre> a
1566 </pre>
1567 <pre> a
1568 </pre>
1569 !!end
1570
1571 !!test
1572 2a. Indent-Pre and tables
1573 !!input
1574 {|
1575 |-
1576 !h1!!h2
1577 |foo||bar
1578 |}
1579 !!result
1580 <table>
1581
1582 <tr>
1583 <th>h1</th>
1584 <th>h2
1585 </th>
1586 <td>foo</td>
1587 <td>bar
1588 </td></tr></table>
1589
1590 !!end
1591
1592 !!test
1593 2b. Indent-Pre and tables
1594 !!input
1595 {|
1596 |-
1597 |foo
1598 |}
1599 !!result
1600 <table>
1601
1602 <tr>
1603 <td>foo
1604 </td></tr></table>
1605
1606 !!end
1607
1608 !!test
1609 2c. Indent-Pre and tables (bug 42252)
1610 !!input
1611 {|
1612 |+ foo
1613 ! | bar
1614 |}
1615 !!result
1616 <table>
1617 <caption> foo
1618 </caption>
1619 <tr>
1620 <th> bar
1621 </th></tr></table>
1622
1623 !!end
1624
1625 !!test
1626 3a. Indent-Pre and block tags (single-line html)
1627 !!input
1628 <p> foo </p>
1629 <div> foo </div>
1630 <span> foo </span>
1631 !!result
1632 <p> foo </p>
1633 <div> foo </div>
1634 <pre><span> foo </span>
1635 </pre>
1636 !!end
1637
1638 !!test
1639 3b. Indent-Pre and block tags (pre-content on separate line)
1640 !!input
1641 <p>
1642 foo
1643 </p>
1644
1645 <div>
1646 foo
1647 </div>
1648
1649 <center>
1650 foo
1651 </center>
1652
1653 <blockquote>
1654 foo
1655 </blockquote>
1656
1657 <table><tr><td>
1658 foo
1659 </td></tr></table>
1660
1661 <ul><li>
1662 foo
1663 </li></ul>
1664
1665 !!result
1666 <p>
1667 foo
1668 </p>
1669 <div>
1670 <pre>foo
1671 </pre>
1672 </div>
1673 <center>
1674 <pre>foo
1675 </pre>
1676 </center>
1677 <blockquote>
1678 foo
1679 </blockquote>
1680 <table><tr><td>
1681 <pre>foo
1682 </pre>
1683 </td></tr></table>
1684 <ul><li>
1685 foo
1686 </li></ul>
1687
1688 !!end
1689
1690 !!test
1691 4. Multiple spaces at start-of-line
1692 !!input
1693 <p> foo </p>
1694 foo
1695 {|
1696 |foo
1697 |}
1698 !!result
1699 <p> foo </p>
1700 <pre> foo
1701 </pre>
1702 <table>
1703 <tr>
1704 <td>foo
1705 </td></tr></table>
1706
1707 !!end
1708
1709 !! test
1710 5. White-space in indent-pre
1711 NOTE: the white-space char on 2nd line is significant
1712 !! input
1713 a<br/>
1714
1715 b
1716 !! result
1717 <pre>a<br />
1718
1719 b
1720 </pre>
1721 !! end
1722
1723 ###
1724 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1725 ###
1726
1727 !!test
1728 HTML-pre: 1. embedded newlines
1729 !!input
1730 <pre>foo</pre>
1731
1732 <pre>
1733 foo
1734 </pre>
1735
1736 <pre>
1737
1738 foo
1739 </pre>
1740
1741 <pre>
1742
1743
1744 foo
1745 </pre>
1746 !!result
1747 <pre>foo</pre>
1748 <pre>
1749 foo
1750 </pre>
1751 <pre>
1752
1753 foo
1754 </pre>
1755 <pre>
1756
1757
1758 foo
1759 </pre>
1760
1761 !!end
1762
1763 !!test
1764 HTML-pre: 2: indented text
1765 !!input
1766 <pre>
1767 foo
1768 </pre>
1769 !!result
1770 <pre>
1771 foo
1772 </pre>
1773
1774 !!end
1775
1776 !!test
1777 HTML-pre: 3: other wikitext
1778 !!input
1779 <pre>
1780 * foo
1781 # bar
1782 = no-h =
1783 '' no-italic ''
1784 [[ NoLink ]]
1785 </pre>
1786 !!result
1787 <pre>
1788 * foo
1789 # bar
1790 = no-h =
1791 '' no-italic ''
1792 [[ NoLink ]]
1793 </pre>
1794
1795 !!end
1796
1797 ###
1798 ### Definition lists
1799 ###
1800 !! test
1801 Simple definition
1802 !! input
1803 ; name : Definition
1804 !! result
1805 <dl><dt> name&#160;</dt><dd> Definition
1806 </dd></dl>
1807
1808 !! end
1809
1810 !! test
1811 Definition list for indentation only
1812 !! input
1813 : Indented text
1814 !! result
1815 <dl><dd> Indented text
1816 </dd></dl>
1817
1818 !! end
1819
1820 !! test
1821 Definition list with no space
1822 !! input
1823 ;name:Definition
1824 !! result
1825 <dl><dt>name</dt><dd>Definition
1826 </dd></dl>
1827
1828 !!end
1829
1830 !! test
1831 Definition list with URL link
1832 !! input
1833 ; http://example.com/ : definition
1834 !! result
1835 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
1836 </dd></dl>
1837
1838 !! end
1839
1840 !! test
1841 Definition list with bracketed URL link
1842 !! input
1843 ;[http://www.example.com/ Example]:Something about it
1844 !! result
1845 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
1846 </dd></dl>
1847
1848 !! end
1849
1850 !! test
1851 Definition list with wikilink containing colon
1852 !! input
1853 ; [[Help:FAQ]]: The least-read page on Wikipedia
1854 !! result
1855 <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
1856 </dd></dl>
1857
1858 !! end
1859
1860 # At Brion's and JeLuF's insistence... :)
1861 !! test
1862 Definition list with news link containing colon
1863 !! input
1864 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
1865 !! result
1866 <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!
1867 </dd></dl>
1868
1869 !! end
1870
1871 !! test
1872 Malformed definition list with colon
1873 !! input
1874 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
1875 !! result
1876 <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
1877 </dt></dl>
1878
1879 !! end
1880
1881 !! test
1882 Definition lists: colon in external link text
1883 !! input
1884 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
1885 !! result
1886 <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
1887 </dd></dl>
1888
1889 !! end
1890
1891 !! test
1892 Definition lists: colon in HTML attribute
1893 !! input
1894 ;<b style="display: inline">bold</b>
1895 !! result
1896 <dl><dt><b style="display: inline">bold</b>
1897 </dt></dl>
1898
1899 !! end
1900
1901 !! test
1902 Definition lists: self-closed tag
1903 !! input
1904 ;one<br/>two : two-line fun
1905 !! result
1906 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
1907 </dd></dl>
1908
1909 !! end
1910
1911 !! test
1912 Bug 11748: Literal closing tags
1913 !! input
1914 <dl>
1915 <dt>test 1</dt>
1916 <dd>test test test test test</dd>
1917 <dt>test 2</dt>
1918 <dd>test test test test test</dd>
1919 </dl>
1920 !! result
1921 <dl>
1922 <dt>test 1</dt>
1923 <dd>test test test test test</dd>
1924 <dt>test 2</dt>
1925 <dd>test test test test test</dd>
1926 </dl>
1927
1928 !! end
1929
1930 !! test
1931 Definition and unordered list using wiki syntax nested in unordered list using html tags.
1932 !! input
1933 <ul><li>
1934 ; term : description
1935 * unordered
1936 </li>
1937 </ul>
1938 !! result
1939 <ul><li>
1940 <dl><dt> term&#160;</dt><dd> description
1941 </dd></dl>
1942 <ul><li> unordered
1943 </li></ul>
1944 </li>
1945 </ul>
1946
1947 !! end
1948
1949 !! test
1950
1951 Definition list with empty definition and following paragraph
1952 !! input
1953 ; term:
1954 Paragraph text
1955 !! result
1956 <dl><dt> term</dt><dd>
1957 </dd></dl>
1958 <p>Paragraph text
1959 </p>
1960 !! end
1961
1962 !! test
1963 Nested definition lists using html syntax
1964 !! input
1965 <dl><dd>
1966 <dl>
1967 <dd>Foo</dd>
1968 </dl>
1969 </dd></dl>
1970 !! result
1971 <dl><dd>
1972 <dl>
1973 <dd>Foo</dd>
1974 </dl>
1975 </dd></dl>
1976
1977 !! end
1978
1979 !! test
1980 Definition Lists: No nesting: Multiple dd's
1981 !! input
1982 ;x
1983 :a
1984 :b
1985 !! result
1986 <dl><dt>x
1987 </dt><dd>a
1988 </dd><dd>b
1989 </dd></dl>
1990
1991 !! end
1992
1993 !! test
1994 Definition Lists: Indentation: Regular
1995 !! input
1996 :i1
1997 ::i2
1998 :::i3
1999 !! result
2000 <dl><dd>i1
2001 <dl><dd>i2
2002 <dl><dd>i3
2003 </dd></dl>
2004 </dd></dl>
2005 </dd></dl>
2006
2007 !! end
2008
2009 !! test
2010 Definition Lists: Indentation: Missing 1st level
2011 !! input
2012 ::i2
2013 :::i3
2014 !! result
2015 <dl><dd><dl><dd>i2
2016 <dl><dd>i3
2017 </dd></dl>
2018 </dd></dl>
2019 </dd></dl>
2020
2021 !! end
2022
2023 !! test
2024 Definition Lists: Indentation: Multi-level indent
2025 !! input
2026 :::i3
2027 !! result
2028 <dl><dd><dl><dd><dl><dd>i3
2029 </dd></dl>
2030 </dd></dl>
2031 </dd></dl>
2032
2033 !! end
2034
2035 !! test
2036 Definition Lists: Hacky use to indent tables
2037 !! input
2038 ::{|
2039 |foo
2040 |bar
2041 |}
2042 this text
2043 should be left alone
2044 !! result
2045 <dl><dd><dl><dd><table>
2046 <tr>
2047 <td>foo
2048 </td>
2049 <td>bar
2050 </td></tr></table></dd></dl></dd></dl>
2051 <p>this text
2052 should be left alone
2053 </p>
2054 !! end
2055 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2056 ## as an empty dt item. It also ignores all but the last ";" when followed
2057 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2058 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2059 ## ";"s.
2060 ##
2061 ## Ex: ";;t2 ::d2" is transformed into:
2062 ##
2063 ## <dl>
2064 ## <dt>t2 </dt>
2065 ## <dd>
2066 ## <dl>
2067 ## <dt></dt>
2068 ## <dd>d2</dd>
2069 ## </dl>
2070 ## </dd>
2071 ## </dl>
2072 ##
2073 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2074 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2075 ##
2076 ## <dl>
2077 ## <dt>
2078 ## <dl>
2079 ## <dt>t2 </dt>
2080 ## <dd>:d2</dd>
2081 ## </dl>
2082 ## </dt>
2083 ## </dl>
2084 ##
2085 ## All Parsoid only definition list tests have this difference.
2086 ##
2087 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2088 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2089
2090 !! test
2091 Table / list interaction: indented table with lists in table contents
2092 !! input
2093 :{|
2094 |-
2095 | a
2096 * b
2097 |-
2098 | c
2099 * d
2100 |}
2101 !! result
2102 <dl><dd><table>
2103
2104 <tr>
2105 <td> a
2106 <ul><li> b
2107 </li></ul>
2108 </td></tr>
2109 <tr>
2110 <td> c
2111 <ul><li> d
2112 </li></ul>
2113 </td></tr></table></dd></dl>
2114
2115 !! end
2116
2117 !!test
2118 Table / list interaction: lists nested in tables nested in indented lists
2119 !!input
2120 :{|
2121 |
2122 :a
2123 :b
2124 |
2125 *c
2126 *d
2127 |}
2128
2129 *e
2130 *f
2131 !!result
2132 <dl><dd><table>
2133 <tr>
2134 <td>
2135 <dl><dd>a
2136 </dd><dd>b
2137 </dd></dl>
2138 </td>
2139 <td>
2140 <ul><li>c
2141 </li><li>d
2142 </li></ul>
2143 </td></tr></table></dd></dl>
2144 <ul><li>e
2145 </li><li>f
2146 </li></ul>
2147
2148 !!end
2149
2150 !! test
2151 Definition Lists: Nesting: Multi-level (Parsoid only)
2152 !! options
2153 parsoid
2154 !! input
2155 ;t1 :d1
2156 ;;t2 ::d2
2157 ;;;t3 :::d3
2158 !! result
2159 <dl>
2160 <dt>t1 </dt>
2161 <dd>d1</dd>
2162 <dt>
2163 <dl>
2164 <dt>t2 </dt>
2165 <dd>:d2</dd>
2166 <dt>
2167 <dl>
2168 <dt>t3 </dt>
2169 <dd>::d3</dd>
2170 </dl>
2171 </dt>
2172 </dl>
2173 </dt>
2174 </dl>
2175
2176
2177 !! end
2178
2179
2180 !! test
2181 Definition Lists: Nesting: Test 2 (Parsoid only)
2182 !! options
2183 parsoid
2184 !! input
2185 ;t1
2186 ::d2
2187 !! result
2188 <dl>
2189 <dt>t1</dt>
2190 <dd>
2191 <dl>
2192 <dd>d2</dd>
2193 </dl>
2194 </dd>
2195 </dl>
2196
2197 !! end
2198
2199
2200 !! test
2201 Definition Lists: Nesting: Test 3 (Parsoid only)
2202 !! options
2203 parsoid
2204 !! input
2205 :;t1
2206 ::::d2
2207 !! result
2208 <dl>
2209 <dd>
2210 <dl>
2211 <dt>t1</dt>
2212 <dd>
2213 <dl>
2214 <dd>
2215 <dl>
2216 <dd>d2</dd>
2217 </dl>
2218 </dd>
2219 </dl>
2220 </dd>
2221 </dl>
2222 </dd>
2223 </dl>
2224
2225 !! end
2226
2227
2228 !! test
2229 Definition Lists: Nesting: Test 4
2230 !! input
2231 ::;t3
2232 :::d3
2233 !! result
2234 <dl><dd><dl><dd><dl><dt>t3
2235 </dt><dd>d3
2236 </dd></dl>
2237 </dd></dl>
2238 </dd></dl>
2239
2240 !! end
2241
2242
2243 ## The Parsoid team believes the following three test exposes a
2244 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2245 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2246 !! test
2247 Definition Lists: Mixed Lists: Test 1 (php)
2248 !! options
2249 php
2250 !! input
2251 :;* foo
2252 ::* bar
2253 :; baz
2254 !! result
2255 <dl><dd><dl><dt><ul><li> foo
2256 </li><li> bar
2257 </li></ul>
2258 </dt></dl>
2259 <dl><dt> baz
2260 </dt></dl>
2261 </dd></dl>
2262
2263 !! end
2264 !! test
2265 Definition Lists: Mixed Lists: Test 1 (parsoid)
2266 !! options
2267 parsoid
2268 !! input
2269 :;* foo
2270 ::* bar
2271 :; baz
2272 !! result
2273 <dl><dd><dl><dt><ul><li> foo
2274 </li></ul></dt><dd><ul><li> bar
2275 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2276 !! end
2277
2278 !! test
2279 Definition Lists: Mixed Lists: Test 2
2280 !! input
2281 *: d1
2282 *: d2
2283 !! result
2284 <ul><li><dl><dd> d1
2285 </dd><dd> d2
2286 </dd></dl>
2287 </li></ul>
2288
2289 !! end
2290
2291
2292 !! test
2293 Definition Lists: Mixed Lists: Test 3
2294 !! input
2295 *::: d1
2296 *::: d2
2297 !! result
2298 <ul><li><dl><dd><dl><dd><dl><dd> d1
2299 </dd><dd> d2
2300 </dd></dl>
2301 </dd></dl>
2302 </dd></dl>
2303 </li></ul>
2304
2305 !! end
2306
2307
2308 !! test
2309 Definition Lists: Mixed Lists: Test 4
2310 !! input
2311 *;d1 :d2
2312 *;d3 :d4
2313 !! result
2314 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2315 </dd><dt>d3&#160;</dt><dd>d4
2316 </dd></dl>
2317 </li></ul>
2318
2319 !! end
2320
2321
2322 !! test
2323 Definition Lists: Mixed Lists: Test 5
2324 !! input
2325 *:d1
2326 *:: d2
2327 !! result
2328 <ul><li><dl><dd>d1
2329 <dl><dd> d2
2330 </dd></dl>
2331 </dd></dl>
2332 </li></ul>
2333
2334 !! end
2335
2336
2337 !! test
2338 Definition Lists: Mixed Lists: Test 6
2339 !! input
2340 #*:d1
2341 #*::: d3
2342 !! result
2343 <ol><li><ul><li><dl><dd>d1
2344 <dl><dd><dl><dd> d3
2345 </dd></dl>
2346 </dd></dl>
2347 </dd></dl>
2348 </li></ul>
2349 </li></ol>
2350
2351 !! end
2352
2353
2354 !! test
2355 Definition Lists: Mixed Lists: Test 7
2356 !! input
2357 :* d1
2358 :* d2
2359 !! result
2360 <dl><dd><ul><li> d1
2361 </li><li> d2
2362 </li></ul>
2363 </dd></dl>
2364
2365 !! end
2366
2367
2368 !! test
2369 Definition Lists: Mixed Lists: Test 8
2370 !! input
2371 :* d1
2372 ::* d2
2373 !! result
2374 <dl><dd><ul><li> d1
2375 </li></ul>
2376 <dl><dd><ul><li> d2
2377 </li></ul>
2378 </dd></dl>
2379 </dd></dl>
2380
2381 !! end
2382
2383
2384 !! test
2385 Definition Lists: Mixed Lists: Test 9
2386 !! input
2387 *;foo :bar
2388 !! result
2389 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2390 </dd></dl>
2391 </li></ul>
2392
2393 !! end
2394
2395
2396 !! test
2397 Definition Lists: Mixed Lists: Test 10
2398 !! input
2399 *#;foo :bar
2400 !! result
2401 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2402 </dd></dl>
2403 </li></ol>
2404 </li></ul>
2405
2406 !! end
2407
2408 # The Parsoid team disagrees with the PHP parser's seemingly-random
2409 # rules regarding dd/dt on the next two tests. Parsoid is more
2410 # consistent, and recognizes the shared nesting and keeps the
2411 # still-open tags around until the nesting is complete.
2412
2413 !! test
2414 Definition Lists: Mixed Lists: Test 11 (php)
2415 !! options
2416 php
2417 !! input
2418 *#*#;*;;foo :bar
2419 *#*#;boo :baz
2420 !! result
2421 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2422 </dt></dl>
2423 </dd></dl>
2424 </li></ul>
2425 </dd></dl>
2426 <dl><dt>boo&#160;</dt><dd>baz
2427 </dd></dl>
2428 </li></ol>
2429 </li></ul>
2430 </li></ol>
2431 </li></ul>
2432
2433 !! end
2434 !! test
2435 Definition Lists: Mixed Lists: Test 11 (parsoid)
2436 !! options
2437 parsoid
2438 !! input
2439 *#*#;*;;foo :bar
2440 *#*#;boo :baz
2441 !! result
2442 <ul>
2443 <li>
2444 <ol>
2445 <li>
2446 <ul>
2447 <li>
2448 <ol>
2449 <li>
2450 <dl>
2451 <dt>
2452 <ul>
2453 <li>
2454 <dl>
2455 <dt>
2456 <dl>
2457 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2458 <dd data-parsoid='{"stx":"row"}'>bar</dd></dl></dt></dl></li></ul></dt>
2459 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2460 <dd data-parsoid='{"stx":"row"}'>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2461 !! end
2462
2463
2464 !! test
2465 Definition Lists: Weird Ones: Test 1 (php)
2466 !! options
2467 php
2468 !! input
2469 *#;*::;; foo : bar (who uses this?)
2470 !! result
2471 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2472 </dt></dl>
2473 </dd></dl>
2474 </dd></dl>
2475 </dd></dl>
2476 </li></ul>
2477 </dd></dl>
2478 </li></ol>
2479 </li></ul>
2480
2481 !! end
2482 !! test
2483 Definition Lists: Weird Ones: Test 1 (parsoid)
2484 !! options
2485 parsoid
2486 !! input
2487 *#;*::;; foo : bar (who uses this?)
2488 !! result
2489 <ul>
2490 <li>
2491 <ol>
2492 <li>
2493 <dl>
2494 <dt>
2495 <ul>
2496 <li>
2497 <dl>
2498 <dd>
2499 <dl>
2500 <dd>
2501 <dl>
2502 <dt>
2503 <dl>
2504 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2505 <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>
2506 !! end
2507
2508 ###
2509 ### External links
2510 ###
2511 !! test
2512 External links: non-bracketed
2513 !! input
2514 Non-bracketed: http://example.com
2515 !! result
2516 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2517 </p>
2518 !! end
2519
2520 !! test
2521 External links: numbered
2522 !! input
2523 Numbered: [http://example.com]
2524 Numbered: [http://example.net]
2525 Numbered: [http://example.com]
2526 !! result
2527 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2528 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2529 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2530 </p>
2531 !!end
2532
2533 !! test
2534 External links: specified text
2535 !! input
2536 Specified text: [http://example.com link]
2537 !! result
2538 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2539 </p>
2540 !!end
2541
2542 !! test
2543 External links: trail
2544 !! input
2545 Linktrails should not work for external links: [http://example.com link]s
2546 !! result
2547 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2548 </p>
2549 !! end
2550
2551 !! test
2552 External links: dollar sign in URL
2553 !! input
2554 http://example.com/1$2345
2555 !! result
2556 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2557 </p>
2558 !! end
2559
2560 !! test
2561 External links: dollar sign in URL (named)
2562 !! input
2563 [http://example.com/1$2345]
2564 !! result
2565 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2566 </p>
2567 !!end
2568
2569 !! test
2570 External links: open square bracket forbidden in URL (bug 4377)
2571 !! input
2572 http://example.com/1[2345
2573 !! result
2574 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2575 </p>
2576 !! end
2577
2578 !! test
2579 External links: open square bracket forbidden in URL (named) (bug 4377)
2580 !! input
2581 [http://example.com/1[2345]
2582 !! result
2583 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2584 </p>
2585 !!end
2586
2587 !! test
2588 External links: nowiki in URL link text (bug 6230)
2589 !!input
2590 [http://example.com/ <nowiki>''example site''</nowiki>]
2591 !! result
2592 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2593 </p>
2594 !! end
2595
2596 !! test
2597 External links: newline forbidden in text (bug 6230 regression check)
2598 !! input
2599 [http://example.com/ first
2600 second]
2601 !! result
2602 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2603 second]
2604 </p>
2605 !!end
2606
2607 !! test
2608 External links: Pipe char between url and text
2609 !! input
2610 [http://example.com | link]
2611 !! result
2612 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2613 </p>
2614 !!end
2615
2616 !! test
2617 External links: protocol-relative URL in brackets
2618 !! input
2619 [//example.com/ Test]
2620 !! result
2621 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2622 </p>
2623 !! end
2624
2625 !! test
2626 External links: protocol-relative URL in brackets without text
2627 !! input
2628 [//example.com]
2629 !! result
2630 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2631 </p>
2632 !! end
2633
2634 !! test
2635 External links: protocol-relative URL in free text is left alone
2636 !! input
2637 //example.com/Foo
2638 !! result
2639 <p>//example.com/Foo
2640 </p>
2641 !!end
2642
2643 !! test
2644 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2645 !! input
2646 foo//example.com/Foo
2647 !! result
2648 <p>foo//example.com/Foo
2649 </p>
2650 !! end
2651
2652 !! test
2653 External image
2654 !! input
2655 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2656 !! result
2657 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2658 </p>
2659 !! end
2660
2661 !! test
2662 External image from https
2663 !! input
2664 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2665 !! result
2666 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2667 </p>
2668 !! end
2669
2670 !! test
2671 Link to non-http image, no img tag
2672 !! input
2673 Link to non-http image, no img tag: ftp://example.com/test.jpg
2674 !! result
2675 <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>
2676 </p>
2677 !! end
2678
2679 !! test
2680 External links: terminating separator
2681 !! input
2682 Terminating separator: http://example.com/thing,
2683 !! result
2684 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2685 </p>
2686 !! end
2687
2688 !! test
2689 External links: intervening separator
2690 !! input
2691 Intervening separator: http://example.com/1,2,3
2692 !! result
2693 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2694 </p>
2695 !! end
2696
2697 !! test
2698 External links: old bug with URL in query
2699 !! input
2700 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2701 !! result
2702 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2703 </p>
2704 !! end
2705
2706 !! test
2707 External links: old URL-in-URL bug, mixed protocols
2708 !! input
2709 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2710 !! result
2711 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2712 </p>
2713 !!end
2714
2715 !! test
2716 External links: URL in text
2717 !! input
2718 URL in text: [http://example.com http://example.com]
2719 !! result
2720 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2721 </p>
2722 !! end
2723
2724 !! test
2725 External links: Clickable images
2726 !! input
2727 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2728 !! result
2729 <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>
2730 </p>
2731 !!end
2732
2733 !! test
2734 External links: raw ampersand
2735 !! input
2736 Old &amp; use: http://x&y
2737 !! result
2738 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2739 </p>
2740 !! end
2741
2742 !! test
2743 External links: encoded ampersand
2744 !! input
2745 Old &amp; use: http://x&amp;y
2746 !! result
2747 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2748 </p>
2749 !! end
2750
2751 !! test
2752 External links: encoded equals (bug 6102)
2753 !! input
2754 http://example.com/?foo&#61;bar
2755 !! result
2756 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2757 </p>
2758 !! end
2759
2760 !! test
2761 External links: [raw ampersand]
2762 !! input
2763 Old &amp; use: [http://x&y]
2764 !! result
2765 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2766 </p>
2767 !! end
2768
2769 !! test
2770 External links: [encoded ampersand]
2771 !! input
2772 Old &amp; use: [http://x&amp;y]
2773 !! result
2774 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2775 </p>
2776 !! end
2777
2778 !! test
2779 External links: [encoded equals] (bug 6102)
2780 !! input
2781 [http://example.com/?foo&#61;bar]
2782 !! result
2783 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2784 </p>
2785 !! end
2786
2787 !! test
2788 External links: [IDN ignored character reference in hostname; strip it right off]
2789 !! input
2790 [http://e&zwnj;xample.com/]
2791 !! result
2792 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2793 </p>
2794 !! end
2795
2796 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2797 # Where an external link could easily circumvent the sanitization of the text of
2798 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2799 # test demands a higher standard. That's a bit strange.
2800 #
2801 # Example:
2802 #
2803 # http://e‌xample.com -> [http://example.com|http://example.com]
2804 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2805 #
2806 # The first example is sanitized, but the second is not. Any security benefits
2807 # from this production are trivial to circumvent. Either remove this test and
2808 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2809 # the test accordingly.
2810 #
2811 # All our love,
2812 # The Parsoid team.
2813 !! test
2814 External links: IDN ignored character reference in hostname; strip it right off
2815 !! input
2816 http://e&zwnj;xample.com/
2817 !! result
2818 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
2819 </p>
2820 !! end
2821
2822 !! test
2823 External links: www.jpeg.org (bug 554)
2824 !! input
2825 http://www.jpeg.org
2826 !!result
2827 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
2828 </p>
2829 !! end
2830
2831 !! test
2832 External links: URL within URL (original bug 2)
2833 !! input
2834 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
2835 !! result
2836 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
2837 </p>
2838 !! end
2839
2840 !! test
2841 BUG 361: URL inside bracketed URL
2842 !! input
2843 [http://www.example.com/foo http://www.example.com/bar]
2844 !! result
2845 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
2846 </p>
2847 !! end
2848
2849 !! test
2850 BUG 361: URL within URL, not bracketed
2851 !! input
2852 http://www.example.com/foo?=http://www.example.com/bar
2853 !! result
2854 <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>
2855 </p>
2856 !! end
2857
2858 !! test
2859 BUG 289: ">"-token in URL-tail
2860 !! input
2861 http://www.example.com/<hello>
2862 !! result
2863 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
2864 </p>
2865 !!end
2866
2867 !! test
2868 BUG 289: literal ">"-token in URL-tail
2869 !! input
2870 http://www.example.com/<b>html</b>
2871 !! result
2872 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
2873 </p>
2874 !!end
2875
2876 !! test
2877 BUG 289: ">"-token in bracketed URL
2878 !! input
2879 [http://www.example.com/<hello> stuff]
2880 !! result
2881 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
2882 </p>
2883 !!end
2884
2885 !! test
2886 BUG 289: literal ">"-token in bracketed URL
2887 !! input
2888 [http://www.example.com/<b>html</b> stuff]
2889 !! result
2890 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
2891 </p>
2892 !!end
2893
2894 !! test
2895 BUG 289: literal double quote at end of URL
2896 !! input
2897 http://www.example.com/"hello"
2898 !! result
2899 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
2900 </p>
2901 !!end
2902
2903 !! test
2904 BUG 289: literal double quote in bracketed URL
2905 !! input
2906 [http://www.example.com/"hello" stuff]
2907 !! result
2908 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
2909 </p>
2910 !!end
2911
2912 !! test
2913 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
2914 !! input
2915 [http://www.example.com test]
2916 !! result
2917 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
2918 </p>
2919 !! end
2920
2921 !! test
2922 External links: link text with spaces
2923 !! input
2924 [http://www.example.com a b c]
2925 [http://www.example.com ''a'' ''b'']
2926 !! result
2927 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
2928 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
2929 </p>
2930 !! end
2931
2932 !! test
2933 External links: wiki links within external link (Bug 3695)
2934 !! input
2935 [http://example.com [[wikilink]] embedded in ext link]
2936 !! result
2937 <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>
2938 </p>
2939 !! end
2940
2941 !! test
2942 BUG 787: Links with one slash after the url protocol are invalid
2943 !! input
2944 http:/example.com
2945
2946 [http:/example.com title]
2947 !! result
2948 <p>http:/example.com
2949 </p><p>[http:/example.com title]
2950 </p>
2951 !! end
2952
2953 !! test
2954 Bracketed external links with template-generated invalid target
2955 !! input
2956 [{{echo|http:/example.com}} title]
2957 !! result
2958 <p>[http:/example.com title]
2959 </p>
2960 !! end
2961
2962 !! test
2963 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
2964 !! input
2965 ''[http://example.com text'']
2966 [http://example.com '''text]'''
2967 ''Something [http://example.com in italic'']
2968 ''Something [http://example.com mixed''''', even bold]'''
2969 '''''Now [http://example.com both''''']
2970 !! result
2971 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
2972 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
2973 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
2974 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
2975 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
2976 </p>
2977 !! end
2978
2979
2980 !! test
2981 Bug 4781: %26 in URL
2982 !! input
2983 http://www.example.com/?title=AT%26T
2984 !! result
2985 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
2986 </p>
2987 !! end
2988
2989 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
2990 # % is actually legal in HTML5. Any change in output would need testing though.
2991 !! test
2992 Bug 4781, 5267: %25 in URL
2993 !! input
2994 http://www.example.com/?title=100%25_Bran
2995 !! result
2996 <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>
2997 </p>
2998 !! end
2999
3000 !! test
3001 Bug 4781, 5267: %28, %29 in URL
3002 !! input
3003 http://www.example.com/?title=Ben-Hur_%281959_film%29
3004 !! result
3005 <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>
3006 </p>
3007 !! end
3008
3009
3010 !! test
3011 Bug 4781: %26 in autonumber URL
3012 !! input
3013 [http://www.example.com/?title=AT%26T]
3014 !! result
3015 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3016 </p>
3017 !! end
3018
3019 !! test
3020 Bug 4781, 5267: %26 in autonumber URL
3021 !! input
3022 [http://www.example.com/?title=100%25_Bran]
3023 !! result
3024 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3025 </p>
3026 !! end
3027
3028 !! test
3029 Bug 4781, 5267: %28, %29 in autonumber URL
3030 !! input
3031 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3032 !! result
3033 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3034 </p>
3035 !! end
3036
3037
3038 !! test
3039 Bug 4781: %26 in bracketed URL
3040 !! input
3041 [http://www.example.com/?title=AT%26T link]
3042 !! result
3043 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3044 </p>
3045 !! end
3046
3047 !! test
3048 Bug 4781, 5267: %26 in bracketed URL
3049 !! input
3050 [http://www.example.com/?title=100%25_Bran link]
3051 !! result
3052 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3053 </p>
3054 !! end
3055
3056 !! test
3057 Bug 4781, 5267: %28, %29 in bracketed URL
3058 !! input
3059 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3060 !! result
3061 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3062 </p>
3063 !! end
3064
3065 !! test
3066 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3067 !! input
3068 Some [http://example.com/ pretty ''italics'' and stuff]!
3069 !! result
3070 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3071 </p>
3072 !! end
3073
3074 !! test
3075 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3076 !! input
3077 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3078 !! result
3079 <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>
3080 </p>
3081 !! end
3082
3083 !! test
3084 External link containing double-single-quotes with no space separating the url from text in italics
3085 !! input
3086 [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]].]
3087 !! result
3088 <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>
3089 </p>
3090 !! end
3091
3092 !! test
3093 External link with comments in link text
3094 !! input
3095 [http://www.google.com Google <!-- comment -->]
3096 !! result
3097 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3098 </p>
3099 !! end
3100
3101 !! test
3102 URL-encoding in URL functions (single parameter)
3103 !! input
3104 {{localurl:Some page|amp=&}}
3105 !! result
3106 <p>/index.php?title=Some_page&amp;amp=&amp;
3107 </p>
3108 !! end
3109
3110 !! test
3111 URL-encoding in URL functions (multiple parameters)
3112 !! input
3113 {{localurl:Some page|q=?&amp=&}}
3114 !! result
3115 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3116 </p>
3117 !! end
3118
3119 !! test
3120 Brackets in urls
3121 !! input
3122 http://example.com/index.php?foozoid%5B%5D=bar
3123
3124 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3125 !! result
3126 <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>
3127 </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>
3128 </p>
3129 !! end
3130
3131 !! test
3132 IPv6 urls (bug 21261)
3133 !! options
3134 disabled
3135 !! input
3136 http://[2404:130:0:1000::187:2]/index.php
3137 !! result
3138 <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>
3139 </p>
3140 !! end
3141
3142 !! test
3143 Non-extlinks in brackets
3144 !! input
3145 [foo]
3146 [foo bar]
3147 [foo ''bar'']
3148 [fool's] errand
3149 [fool's errand]
3150 [{{echo|foo}}]
3151 [{{echo|foo}} bar]
3152 [{{echo|foo}} ''bar'']
3153 [{{echo|foo}}l's] errand
3154 [{{echo|foo}}l's errand]
3155 [url={{echo|foo}}]
3156 [url=http://example.com]
3157 !! result
3158 <p>[foo]
3159 [foo bar]
3160 [foo <i>bar</i>]
3161 [fool's] errand
3162 [fool's errand]
3163 [foo]
3164 [foo bar]
3165 [foo <i>bar</i>]
3166 [fool's] errand
3167 [fool's errand]
3168 [url=foo]
3169 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3170 </p>
3171 !! end
3172
3173 ###
3174 ### Quotes
3175 ###
3176
3177 !! test
3178 Quotes
3179 !! input
3180 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3181
3182 Normal text. '''''Bold italic text.''''' Normal text.
3183 !!result
3184 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3185 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3186 </p>
3187 !! end
3188
3189
3190 !! test
3191 Unclosed and unmatched quotes (php)
3192 !! options
3193 php
3194 !! input
3195 '''''Bold italic text '''with bold deactivated''' in between.'''''
3196
3197 '''''Bold italic text ''with italic deactivated'' in between.'''''
3198
3199 '''Bold text..
3200
3201 ..spanning two paragraphs (should not work).'''
3202
3203 '''Bold tag left open
3204
3205 ''Italic tag left open
3206
3207 Normal text.
3208
3209 <!-- Unmatching number of opening, closing tags: -->
3210 '''This year''''s election ''should'' beat '''last year''''s.
3211
3212 ''Tom'''s car is bigger than ''Susan'''s.
3213
3214 Plain ''italic'''s plain
3215 !! result
3216 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3217 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3218 </p><p><b>Bold text..</b>
3219 </p><p>..spanning two paragraphs (should not work).
3220 </p><p><b>Bold tag left open</b>
3221 </p><p><i>Italic tag left open</i>
3222 </p><p>Normal text.
3223 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3224 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3225 </p><p>Plain <i>italic'</i>s plain
3226 </p>
3227 !! end
3228 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3229 # parser strips. The wikitext contains just the first half of the bold
3230 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3231 # differently than the PHP parser.)
3232 !! test
3233 Unclosed and unmatched quotes (parsoid)
3234 !! options
3235 parsoid
3236 !! input
3237 '''''Bold italic text '''with bold deactivated''' in between.'''''
3238
3239 '''''Bold italic text ''with italic deactivated'' in between.'''''
3240
3241 '''Bold text..
3242
3243 ..spanning two paragraphs (should not work).'''
3244
3245 '''Bold tag left open
3246
3247 ''Italic tag left open
3248
3249 Normal text.
3250
3251 <!-- Unmatching number of opening, closing tags: -->
3252 '''This year''''s election ''should'' beat '''last year''''s.
3253
3254 ''Tom'''s car is bigger than ''Susan'''s.
3255
3256 Plain ''italic'''s plain
3257 !! result
3258 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3259 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3260 </p><p><b>Bold text..</b>
3261 </p><p>..spanning two paragraphs (should not work).<b></b>
3262 </p><p><b>Bold tag left open</b>
3263 </p><p><i>Italic tag left open</i>
3264 </p><p>Normal text.
3265 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3266 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3267 </p><p>Plain <i>italic'</i>s plain
3268 </p>
3269 !! end
3270
3271 ###
3272 ### Tables
3273 ###
3274 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3275 ###
3276
3277 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3278 # is the bare minimun required by the spec, see:
3279 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3280 !! test
3281 A table with no data. (php)
3282 !! options
3283 php
3284 !! input
3285 {||}
3286 !! result
3287 !! end
3288 # Parsoid team replies: empty table tags are legal in HTML5
3289 !! test
3290 A table with no data. (parsoid)
3291 !! options
3292 parsoid
3293 !! input
3294 {||}
3295 !! result
3296 <table></table>
3297 !! end
3298
3299 # A table with nothing but a caption is invalid XHTML, we might want to render
3300 # this as <p>caption</p>
3301 !! test
3302 A table with nothing but a caption (php)
3303 !! options
3304 php
3305 !! input
3306 {|
3307 |+ caption
3308 |}
3309 !! result
3310 <table>
3311 <caption> caption
3312 </caption><tr><td></td></tr></table>
3313
3314 !! end
3315 # Parsoid team replies: table with only a caption is legal in HTML5
3316 !! test
3317 A table with nothing but a caption (parsoid)
3318 !! options
3319 parsoid
3320 !! input
3321 {|
3322 |+ caption
3323 |}
3324 !! result
3325 <table><caption> caption</caption></table>
3326 !! end
3327
3328 !! test
3329 A table with caption with default-spaced attributes and a table row
3330 !! input
3331 {|
3332 |+ style="color: red;" | caption1
3333 |-
3334 | foo
3335 |}
3336 !! result
3337 <table>
3338 <caption style="color: red;"> caption1
3339 </caption>
3340 <tr>
3341 <td> foo
3342 </td></tr></table>
3343
3344 !! end
3345
3346 !! test
3347 A table with captions with non-default spaced attributes and a table row
3348 !! input
3349 {|
3350 |+style="color: red;"|caption2
3351 |+ style="color: red;"| caption3
3352 |-
3353 | foo
3354 |}
3355 !! result
3356 <table>
3357 <caption style="color: red;">caption2
3358 </caption>
3359 <caption style="color: red;"> caption3
3360 </caption>
3361 <tr>
3362 <td> foo
3363 </td></tr></table>
3364
3365 !! end
3366
3367 !! test
3368 Table td-cell syntax variations
3369 !! input
3370 {|
3371 | foo bar foo | baz
3372 | foo bar foo || baz
3373 | style='color:red;' | baz
3374 | style='color:red;' || baz
3375 |}
3376 !! result
3377 <table>
3378 <tr>
3379 <td> baz
3380 </td>
3381 <td> foo bar foo </td>
3382 <td> baz
3383 </td>
3384 <td style="color:red;"> baz
3385 </td>
3386 <td> style='color:red;' </td>
3387 <td> baz
3388 </td></tr></table>
3389
3390 !! end
3391
3392 !! test
3393 Simple table
3394 !! input
3395 {|
3396 | 1 || 2
3397 |-
3398 | 3 || 4
3399 |}
3400 !! result
3401 <table>
3402 <tr>
3403 <td> 1 </td>
3404 <td> 2
3405 </td></tr>
3406 <tr>
3407 <td> 3 </td>
3408 <td> 4
3409 </td></tr></table>
3410
3411 !! end
3412
3413 !! test
3414 Simple table but with multiple dashes for row wikitext
3415 !! input
3416 {|
3417 | foo
3418 |-----
3419 | bar
3420 |}
3421 !! result
3422 <table>
3423 <tr>
3424 <td> foo
3425 </td></tr>
3426 <tr>
3427 <td> bar
3428 </td></tr></table>
3429
3430 !! end
3431 !! test
3432 Multiplication table
3433 !! input
3434 {| border="1" cellpadding="2"
3435 |+Multiplication table
3436 |-
3437 ! &times; !! 1 !! 2 !! 3
3438 |-
3439 ! 1
3440 | 1 || 2 || 3
3441 |-
3442 ! 2
3443 | 2 || 4 || 6
3444 |-
3445 ! 3
3446 | 3 || 6 || 9
3447 |-
3448 ! 4
3449 | 4 || 8 || 12
3450 |-
3451 ! 5
3452 | 5 || 10 || 15
3453 |}
3454 !! result
3455 <table border="1" cellpadding="2">
3456 <caption>Multiplication table
3457 </caption>
3458 <tr>
3459 <th> &#215; </th>
3460 <th> 1 </th>
3461 <th> 2 </th>
3462 <th> 3
3463 </th></tr>
3464 <tr>
3465 <th> 1
3466 </th>
3467 <td> 1 </td>
3468 <td> 2 </td>
3469 <td> 3
3470 </td></tr>
3471 <tr>
3472 <th> 2
3473 </th>
3474 <td> 2 </td>
3475 <td> 4 </td>
3476 <td> 6
3477 </td></tr>
3478 <tr>
3479 <th> 3
3480 </th>
3481 <td> 3 </td>
3482 <td> 6 </td>
3483 <td> 9
3484 </td></tr>
3485 <tr>
3486 <th> 4
3487 </th>
3488 <td> 4 </td>
3489 <td> 8 </td>
3490 <td> 12
3491 </td></tr>
3492 <tr>
3493 <th> 5
3494 </th>
3495 <td> 5 </td>
3496 <td> 10 </td>
3497 <td> 15
3498 </td></tr></table>
3499
3500 !! end
3501
3502 !! test
3503 Accept "||" in table headings
3504 !! input
3505 {|
3506 !h1 || h2
3507 |}
3508 !! result
3509 <table>
3510 <tr>
3511 <th>h1 </th>
3512 <th> h2
3513 </th></tr></table>
3514
3515 !! end
3516
3517 !! test
3518 Accept "||" in indented table headings
3519 !! input
3520 :{|
3521 !h1 || h2
3522 |}
3523 !! result
3524 <dl><dd><table>
3525 <tr>
3526 <th>h1 </th>
3527 <th> h2
3528 </th></tr></table></dd></dl>
3529
3530 !! end
3531
3532 !! test
3533 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3534 !! input
3535 {|
3536 !| h1
3537 || a
3538 |}
3539 !! result
3540 <table>
3541 <tr>
3542 <th> h1
3543 </th>
3544 <td> a
3545 </td></tr></table>
3546
3547 !! end
3548
3549 !!test
3550 Accept "| !" at start of line in tables (ignore !-attribute)
3551 !!input
3552 {|
3553 |-
3554 | !style="color:red" | bar
3555 |}
3556 !!result
3557 <table>
3558
3559 <tr>
3560 <td> bar
3561 </td></tr></table>
3562
3563 !!end
3564
3565 !!test
3566 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 +/-
3567 !!input
3568 {|
3569 |-
3570 |style='color:red;'|+1
3571 |style='color:blue;'|-1
3572 |-
3573 | 1 || 2 || 3
3574 | 1 ||+2 ||-3
3575 |-
3576 | +1
3577 | -1
3578 |}
3579 !!result
3580 <table>
3581
3582 <tr>
3583 <td style="color:red;">+1
3584 </td>
3585 <td style="color:blue;">-1
3586 </td></tr>
3587 <tr>
3588 <td> 1 </td>
3589 <td> 2 </td>
3590 <td> 3
3591 </td>
3592 <td> 1 </td>
3593 <td>+2 </td>
3594 <td>-3
3595 </td></tr>
3596 <tr>
3597 <td> +1
3598 </td>
3599 <td> -1
3600 </td></tr></table>
3601
3602 !!end
3603
3604 !! test
3605 Table rowspan
3606 !! input
3607 {| border=1
3608 | Cell 1, row 1
3609 |rowspan=2| Cell 2, row 1 (and 2)
3610 | Cell 3, row 1
3611 |-
3612 | Cell 1, row 2
3613 | Cell 3, row 2
3614 |}
3615 !! result
3616 <table border="1">
3617 <tr>
3618 <td> Cell 1, row 1
3619 </td>
3620 <td rowspan="2"> Cell 2, row 1 (and 2)
3621 </td>
3622 <td> Cell 3, row 1
3623 </td></tr>
3624 <tr>
3625 <td> Cell 1, row 2
3626 </td>
3627 <td> Cell 3, row 2
3628 </td></tr></table>
3629
3630 !! end
3631
3632 !! test
3633 Nested table
3634 !! input
3635 {| border=1
3636 | &alpha;
3637 |
3638 {| bgcolor=#ABCDEF border=2
3639 |nested
3640 |-
3641 |table
3642 |}
3643 |the original table again
3644 |}
3645 !! result
3646 <table border="1">
3647 <tr>
3648 <td> &#945;
3649 </td>
3650 <td>
3651 <table bgcolor="#ABCDEF" border="2">
3652 <tr>
3653 <td>nested
3654 </td></tr>
3655 <tr>
3656 <td>table
3657 </td></tr></table>
3658 </td>
3659 <td>the original table again
3660 </td></tr></table>
3661
3662 !! end
3663
3664 !! test
3665 Invalid attributes in table cell (bug 1830)
3666 !! input
3667 {|
3668 |Cell:|broken
3669 |}
3670 !! result
3671 <table>
3672 <tr>
3673 <td>broken
3674 </td></tr></table>
3675
3676 !! end
3677
3678
3679 !! test
3680 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3681 !! input
3682 {|
3683 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3684 !! result
3685 <table>
3686 <tr>
3687 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3688 <td>]" onmouseover="alert(document.cookie)"&gt;test
3689 </td>
3690 </tr>
3691 </table>
3692
3693 !! end
3694
3695
3696 !! test
3697 Indented table markup mixed with indented pre content (proposed in bug 6200)
3698 !! input
3699 <table>
3700 <tr>
3701 <td>
3702 Text that should be rendered preformatted
3703 </td>
3704 </tr>
3705 </table>
3706 !! result
3707 <table>
3708 <tr>
3709 <td>
3710 <pre>Text that should be rendered preformatted
3711 </pre>
3712 </td>
3713 </tr>
3714 </table>
3715
3716 !! end
3717
3718 !! test
3719 Template-generated table cell attributes and cell content
3720 !! input
3721 {|
3722 |{{table_attribs}}
3723 |}
3724 !! result
3725 <table>
3726 <tr>
3727 <td style="color: red"> Foo
3728 </td></tr></table>
3729
3730 !! end
3731
3732 !! test
3733 Table with row followed by newlines and table heading
3734 !! input
3735 {|
3736 |-
3737
3738 ! foo
3739 |}
3740 !! result
3741 <table>
3742
3743
3744 <tr>
3745 <th> foo
3746 </th></tr></table>
3747
3748 !! end
3749
3750 !! test
3751 Table with empty line following the start tag
3752 !! input
3753 {|
3754
3755 |-
3756 | foo
3757 |}
3758 !! result
3759 <table>
3760
3761
3762 <tr>
3763 <td> foo
3764 </td></tr></table>
3765
3766 !! end
3767
3768 # FIXME: Preserve the attribute properly (with an empty string as value) in
3769 # the PHP parser. Parsoid implements the behavior below.
3770 !! test
3771 Table attributes with empty value
3772 !! options
3773 parsoid
3774 !! input
3775 {|
3776 | style=| hello
3777 |}
3778 !! result
3779 <table>
3780 <tbody>
3781 <tr>
3782 <td style=""> hello
3783 </td></tr></tbody></table>
3784
3785 !! end
3786
3787 !! test
3788 Wikitext table with a lot of comments
3789 !! input
3790 {|
3791 <!-- c0 -->
3792 | foo
3793 <!-- c1 -->
3794 |- <!-- c2 -->
3795 <!-- c3 -->
3796 |<!-- c4 -->
3797 <!-- c5 -->
3798 |}
3799 !! result
3800 <table>
3801 <tr>
3802 <td> foo
3803 </td></tr>
3804 <tr>
3805 <td>
3806 </td></tr></table>
3807
3808 !! end
3809
3810 !! test
3811 Wikitext table with double-line table cell
3812 !! input
3813 {|
3814 |a
3815 b
3816 |}
3817 !! result
3818 <table>
3819 <tr>
3820 <td>a
3821 <p>b
3822 </p>
3823 </td></tr></table>
3824
3825 !! end
3826
3827 !! test
3828 Table cell with a single comment
3829 !! input
3830 {|
3831 | <!-- c1 -->
3832 | a
3833 |}
3834 !! result
3835 <table>
3836 <tr>
3837 <td>
3838 </td>
3839 <td> a
3840 </td></tr></table>
3841
3842 !! end
3843
3844 # The expected HTML structure in this test is debatable. The PHP parser does
3845 # not parse this kind of table at all. The main focus for Parsoid is on
3846 # round-tripping, so this output is ok for now. TODO: revisit!
3847 !! test
3848 Wikitext table with html-syntax row (Parsoid)
3849 !! options
3850 parsoid
3851 !! input
3852 {|
3853 |-
3854 <td>foo</td>
3855 |}
3856 !! result
3857 <table>
3858 <tbody>
3859 <tr>
3860 <td>foo</td></tr></tbody></table>
3861 !! end
3862
3863 ###
3864 ### Internal links
3865 ###
3866 !! test
3867 Plain link, capitalized
3868 !! input
3869 [[Main Page]]
3870 !! result
3871 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
3872 </p>
3873 !! end
3874
3875 !! test
3876 Plain link, uncapitalized
3877 !! input
3878 [[main Page]]
3879 !! result
3880 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
3881 </p>
3882 !! end
3883
3884 !! test
3885 Piped link
3886 !! input
3887 [[Main Page|The Main Page]]
3888 !! result
3889 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
3890 </p>
3891 !! end
3892
3893 !! test
3894 Piped link with comment in link text
3895 !! input
3896 [[Main Page|The Main<!--front--> Page]]
3897 !! result
3898 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
3899 </p>
3900 !! end
3901
3902 !! test
3903 Broken link
3904 !! input
3905 [[Zigzagzogzagzig]]
3906 !! result
3907 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
3908 </p>
3909 !! end
3910
3911 !! test
3912 Broken link with fragment
3913 !! input
3914 [[Zigzagzogzagzig#zug]]
3915 !! result
3916 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
3917 </p>
3918 !! end
3919
3920 !! test
3921 Special page link with fragment
3922 !! input
3923 [[Special:Version#anchor]]
3924 !! result
3925 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
3926 </p>
3927 !! end
3928
3929 !! test
3930 Nonexistent special page link with fragment
3931 !! input
3932 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
3933 !! result
3934 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
3935 </p>
3936 !! end
3937
3938 !! test
3939 Link with prefix
3940 !! input
3941 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
3942 !! result
3943 <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>
3944 </p>
3945 !! end
3946
3947 !! test
3948 Link with suffix
3949 !! input
3950 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
3951 !! result
3952 <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>!!!
3953 </p>
3954 !! end
3955
3956 !! article
3957 prefixed article
3958 !! text
3959 Some text
3960 !! endarticle
3961
3962 !! test
3963 Bug 43661: Piped links with identical prefixes
3964 !! input
3965 [[prefixed article|prefixed articles with spaces]]
3966
3967 [[prefixed article|prefixed articlesaoeu]]
3968
3969 [[Main Page|Main Page test]]
3970 !! result
3971 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
3972 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
3973 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
3974 </p>
3975 !! end
3976
3977
3978 !! test
3979 Link with HTML entity in suffix / tail
3980 !! input
3981 [[Main Page]]&quot;, [[Main Page]]&#97;
3982 !! result
3983 <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;
3984 </p>
3985 !! end
3986
3987 !! test
3988 Link with 3 brackets
3989 !! input
3990 [[[main page]]]
3991 !! result
3992 <p>[[[main page]]]
3993 </p>
3994 !! end
3995
3996 !! test
3997 Piped link with 3 brackets
3998 !! input
3999 [[[main page|the main page]]]
4000 !! result
4001 <p>[[[main page|the main page]]]
4002 </p>
4003 !! end
4004
4005 !! test
4006 Link with multiple pipes
4007 !! input
4008 [[Main Page|The|Main|Page]]
4009 !! result
4010 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
4011 </p>
4012 !! end
4013
4014 !! test
4015 Link to namespaces
4016 !! input
4017 [[Talk:Parser testing]], [[Meta:Disclaimers]]
4018 !! result
4019 <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>
4020 </p>
4021 !! end
4022
4023 !! test
4024 Piped link to namespace
4025 !! input
4026 [[Meta:Disclaimers|The disclaimers]]
4027 !! result
4028 <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>
4029 </p>
4030 !! end
4031
4032 !! test
4033 Link containing }
4034 !! input
4035 [[Usually caused by a typo (oops}]]
4036 !! result
4037 <p>[[Usually caused by a typo (oops}]]
4038 </p>
4039 !! end
4040
4041 !! test
4042 Link containing % (not as a hex sequence)
4043 !! input
4044 [[7% Solution]]
4045 !! result
4046 <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>
4047 </p>
4048 !! end
4049
4050 !! test
4051 Link containing % as a single hex sequence interpreted to char
4052 !! input
4053 [[7%25 Solution]]
4054 !! result
4055 <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>
4056 </p>
4057 !!end
4058
4059 !! test
4060 Link containing % as a double hex sequence interpreted to hex sequence
4061 !! input
4062 [[7%2525 Solution]]
4063 !! result
4064 <p>[[7%2525 Solution]]
4065 </p>
4066 !!end
4067
4068 !! test
4069 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
4070 Example for such a section: == < ==
4071 !! input
4072 [[%23%3c]][[%23%3e]]
4073 !! result
4074 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
4075 </p>
4076 !! end
4077
4078 !! test
4079 Link containing "<#" and ">#" as a hex sequences
4080 !! input
4081 [[%3c%23]][[%3e%23]]
4082 !! result
4083 <p>[[%3c%23]][[%3e%23]]
4084 </p>
4085 !! end
4086
4087 !! test
4088 Link containing an equals sign
4089 !! input
4090 [[Special:BookSources/isbn=4-00-026157-6]]
4091 !! result
4092 <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>
4093 </p>
4094 !! end
4095
4096 !! article
4097 Foo~bar
4098 !! text
4099 Just a test of an article title containing a tilde.
4100 !! endarticle
4101
4102 # note that links containing signatures, like [[Foo~~~~]], are
4103 # massaged by the pre-save transform (PST) and so the tildes are never
4104 # seen by the parser.
4105 !! test
4106 Link containing a tilde
4107 !! input
4108 [[Foo~bar]]
4109 !! result
4110 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
4111 </p>
4112 !! end
4113
4114 !! test
4115 Link containing double-single-quotes '' (bug 4598)
4116 !! input
4117 [[Lista d''e paise d''o munno]]
4118 !! result
4119 <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>
4120 </p>
4121 !! end
4122
4123 !! test
4124 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4125 !! input
4126 Some [[Link|pretty ''italics'' and stuff]]!
4127 !! result
4128 <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>!
4129 </p>
4130 !! end
4131
4132 !! test
4133 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4134 !! input
4135 ''Some [[Link|pretty ''italics'' and stuff]]!
4136 !! result
4137 <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>
4138 </p>
4139 !! end
4140
4141 !! test
4142 Link with double quotes in title part (literal) and alternate part (interpreted)
4143 !! input
4144 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4145
4146 [[''Pentecoste'']]
4147
4148 [[''Pentecoste''|Pentecoste]]
4149
4150 [[''Pentecoste''|''Pentecoste'']]
4151 !! result
4152 <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>
4153 </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>
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)"><i>Pentecoste</i></a>
4156 </p>
4157 !! end
4158
4159 !! test
4160 Broken image links with HTML captions (bug 39700)
4161 !! input
4162 [[File:Nonexistent|<script></script>]]
4163 [[File:Nonexistent|100px|<script></script>]]
4164 [[File:Nonexistent|&lt;]]
4165 [[File:Nonexistent|a<i>b</i>c]]
4166 !! result
4167 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4168 <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;</a>
4170 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4171 </p>
4172 !! end
4173
4174 !! test
4175 Plain link to URL
4176 !! input
4177 [[http://www.example.com]]
4178 !! result
4179 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4180 </p>
4181 !! end
4182
4183 !! test
4184 Plain link to URL with link text
4185 !! input
4186 [[http://www.example.com Link text]]
4187 !! result
4188 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4189 </p>
4190 !! end
4191
4192 !! test
4193 Plain link to protocol-relative URL
4194 !! input
4195 [[//www.example.com]]
4196 !! result
4197 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4198 </p>
4199 !! end
4200
4201 !! test
4202 Plain link to protocol-relative URL with link text
4203 !! input
4204 [[//www.example.com Link text]]
4205 !! result
4206 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4207 </p>
4208 !! end
4209
4210 !! test
4211 Plain link to page with question mark in title
4212 !! input
4213 [[A?b]]
4214
4215 [[A?b|Baz]]
4216 !! result
4217 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4218 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4219 </p>
4220 !! end
4221
4222
4223 # I'm fairly sure the expected result here is wrong.
4224 # We want these to be URL links, not pseudo-pages with URLs for titles....
4225 # However the current output is also pretty screwy.
4226 #
4227 # ----
4228 # I'm changing it to match the current output--it arguably makes more
4229 # sense in the light of the test above. Old expected result was:
4230 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4231 #</p>
4232 # But I think this test is bordering on "garbage in, garbage out" anyway.
4233 # -- wtm
4234 !! test
4235 Piped link to URL
4236 !! input
4237 Piped link to URL: [[http://www.example.com|an example URL]]
4238 !! result
4239 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4240 </p>
4241 !! end
4242
4243 !! test
4244 BUG 2: [[page|http://url/]] should link to page, not http://url/
4245 !! input
4246 [[Main Page|http://url/]]
4247 !! result
4248 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4249 </p>
4250 !! end
4251
4252 !! test
4253 BUG 337: Escaped self-links should be bold
4254 !! options
4255 title=[[Bug462]]
4256 !! input
4257 [[Bu&#103;462]] [[Bug462]]
4258 !! result
4259 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4260 </p>
4261 !! end
4262
4263 !! test
4264 Self-link to section should not be bold
4265 !! options
4266 title=[[Main Page]]
4267 !! input
4268 [[Main Page#section]]
4269 !! result
4270 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4271 </p>
4272 !! end
4273
4274 !! article
4275 00
4276 !! text
4277 This is 00.
4278 !! endarticle
4279
4280 !!test
4281 Self-link to numeric title
4282 !!options
4283 title=[[0]]
4284 !!input
4285 [[0]]
4286 !!result
4287 <p><strong class="selflink">0</strong>
4288 </p>
4289 !!end
4290
4291 !!test
4292 Link to numeric-equivalent title
4293 !!options
4294 title=[[0]]
4295 !!input
4296 [[00]]
4297 !!result
4298 <p><a href="/wiki/00" title="00">00</a>
4299 </p>
4300 !!end
4301
4302 !! test
4303 <nowiki> inside a link
4304 !! input
4305 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4306 !! result
4307 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4308 </p>
4309 !! end
4310
4311 !! test
4312 Non-breaking spaces in title
4313 !! input
4314 [[&nbsp; Main &nbsp; Page &nbsp;]]
4315 !! result
4316 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4317 </p>
4318 !!end
4319
4320 !! test
4321 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4322 !! options
4323 language=ca
4324 !! input
4325 '''[[Main Page]]'''
4326 !! result
4327 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4328 </p>
4329 !! end
4330
4331 !! test
4332 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4333 !! options
4334 language=ca
4335 !! input
4336 ''[[Main Page]]''
4337 !! result
4338 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4339 </p>
4340 !! end
4341
4342 !! test
4343 Internal link with en linktrail: no apostrophes (bug 27473)
4344 !! options
4345 language=en
4346 !! input
4347 [[Something]]'nice
4348 !! result
4349 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4350 </p>
4351 !! end
4352
4353 !! test
4354 Internal link with ca linktrail with apostrophes (bug 27473)
4355 !! options
4356 language=ca
4357 !! input
4358 [[Something]]'nice
4359 !! result
4360 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4361 </p>
4362 !! end
4363
4364 !! test
4365 Internal link with kaa linktrail with apostrophes (bug 27473)
4366 !! options
4367 language=kaa
4368 !! input
4369 [[Something]]'nice
4370 !! result
4371 <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>
4372 </p>
4373 !! end
4374
4375 !! article
4376 Söfnuður
4377 !! text
4378 Test.
4379 !! endarticle
4380
4381 !! test
4382 Internal link with is link prefix
4383 !! options
4384 language=is
4385 !! input
4386 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
4387 !! result
4388 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
4389 </p>
4390 !! end
4391
4392 !! article
4393 Mótmælendatrú
4394 !! text
4395 Test.
4396 !! endarticle
4397
4398 !! test
4399 Internal link with is link trail and link prefix
4400 !! options
4401 language=is
4402 !! input
4403 [[mótmælendatrú|xxx]]ar
4404 [[mótmælendatrú]]ar
4405 mótmælenda[[söfnuður]]
4406 mótmælenda[[söfnuður|söfnuðir]]
4407 mótmælenda[[söfnuður|söfnuðir]]xxx
4408 !! result
4409 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
4410 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
4411 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
4412 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
4413 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
4414 </p>
4415 !! end
4416
4417 !! test
4418 Parsoid link trail escaping
4419 !! options
4420 parsoid=html2wt,html2html
4421 !! input
4422 [[apple]]<nowiki/>s
4423 !! result
4424 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
4425 !! end
4426
4427 !! test
4428 Parsoid link prefix escaping
4429 !! options
4430 language=is
4431 parsoid=html2wt,html2html
4432 !! input
4433 Aðrir mótmælenda<nowiki/>[[söfnuður]]
4434 !! result
4435 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
4436 !! end
4437
4438 !! test
4439 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4440 !! input
4441 [[Foo| bar]]
4442
4443 [[Foo| ''bar'']]
4444
4445 [http://wp.org foo]
4446
4447 [http://wp.org ''foo'']
4448 !! result
4449 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
4450 </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>
4451 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4452 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4453 </p>
4454 !! end
4455
4456 ###
4457 ### Interwiki links (see maintenance/interwiki.sql)
4458 ###
4459
4460 !! test
4461 Inline interwiki link
4462 !! input
4463 [[MeatBall:SoftSecurity]]
4464 !! result
4465 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4466 </p>
4467 !! end
4468
4469 !! test
4470 Inline interwiki link with empty title (bug 2372)
4471 !! input
4472 [[MeatBall:]]
4473 !! result
4474 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4475 </p>
4476 !! end
4477
4478 !! test
4479 Interwiki link encoding conversion (bug 1636)
4480 !! input
4481 *[[Wikipedia:ro:Olteni&#0355;a]]
4482 *[[Wikipedia:ro:Olteni&#355;a]]
4483 !! result
4484 <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>
4485 </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>
4486 </li></ul>
4487
4488 !! end
4489
4490 !! test
4491 Interwiki link with fragment (bug 2130)
4492 !! input
4493 [[MeatBall:SoftSecurity#foo]]
4494 !! result
4495 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4496 </p>
4497 !! end
4498
4499 !! test
4500 Interlanguage link
4501 !! input
4502 Blah blah blah
4503 [[zh:Chinese]]
4504 !!result
4505 <p>Blah blah blah
4506 </p>
4507 !! end
4508
4509 !! test
4510 Double interlanguage link
4511 !! input
4512 Blah blah blah
4513 [[es:Spanish]]
4514 [[zh:Chinese]]
4515 !!result
4516 <p>Blah blah blah
4517 </p>
4518 !! end
4519
4520 !! test
4521 Interlanguage link, with prefix links
4522 !! options
4523 language=ln
4524 !! input
4525 Blah blah blah
4526 [[zh:Chinese]]
4527 !!result
4528 <p>Blah blah blah
4529 </p>
4530 !! end
4531
4532 !! test
4533 Double interlanguage link, with prefix links (bug 8897)
4534 !! options
4535 language=ln
4536 !! input
4537 Blah blah blah
4538 [[es:Spanish]]
4539 [[zh:Chinese]]
4540 !!result
4541 <p>Blah blah blah
4542 </p>
4543 !! end
4544
4545 !! test
4546 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4547 !! options
4548 language=ln
4549 !! input
4550 [[WW&nbsp;II]]
4551 !!result
4552 <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>
4553 </p>
4554 !! end
4555
4556 !! test
4557 Parsoid: handle constructor well
4558 !! options
4559 parsoid
4560 !! input
4561 [[constructor]]
4562
4563 [[constructor:foo]]
4564 !! result
4565 <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>
4566
4567
4568 <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>
4569 !! end
4570
4571 ##
4572 ## Redirects, Parsoid-only
4573 ##
4574 !! test
4575 Simple redirect to page
4576 !! options
4577 parsoid
4578 !! input
4579 #REDIRECT [[Main Page]]
4580 !! result
4581 <link rel="mw:PageProp/redirect" href="./Main_Page">
4582 !! end
4583
4584 !! test
4585 Redirect to category
4586 !! options
4587 parsoid=wt2html
4588 !! input
4589 #REDIRECT [[Category:Foo]]
4590 !! result
4591 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
4592 !! end
4593
4594 !! test
4595 Redirect to category page
4596 !! options
4597 parsoid=wt2html,html2html
4598 !! input
4599 #REDIRECT [[:Category:Foo]]
4600 !! result
4601 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
4602 !! end
4603
4604 !! test
4605 Redirect to image page
4606 !! options
4607 parsoid
4608 !! input
4609 #REDIRECT [[File:Wiki.png]]
4610 !! result
4611 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
4612 !! end
4613
4614 !! test
4615 Redirect to language
4616 !! options
4617 parsoid
4618 !! input
4619 #REDIRECT [[en:File:Wiki.png]]
4620 !! result
4621 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
4622 !! end
4623
4624 !! test
4625 Redirect to interwiki
4626 !! options
4627 parsoid
4628 !! input
4629 #REDIRECT [[meatball:File:Wiki.png]]
4630 !! result
4631 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
4632 !! end
4633 ##
4634 ## XHTML tidiness
4635 ###
4636
4637 !! test
4638 <br> to <br />
4639 !! input
4640 1<br>2<br />3
4641 !! result
4642 <p>1<br />2<br />3
4643 </p>
4644 !! end
4645
4646 !! test
4647 Broken br tag sanitization
4648 !! input
4649 </br>
4650 !! result
4651 <p>&lt;/br&gt;
4652 </p>
4653 !! end
4654
4655 !! test
4656 Incorrecly removing closing slashes from correctly formed XHTML
4657 !! input
4658 <br style="clear:both;" />
4659 !! result
4660 <p><br style="clear:both;" />
4661 </p>
4662 !! end
4663
4664 !! test
4665 Failing to transform badly formed HTML into correct XHTML
4666 !! input
4667 <br style="clear: left;">
4668 <br style="clear: right;">
4669 <br style="clear: both;">
4670 !! result
4671 <p><br style="clear: left;" />
4672 <br style="clear: right;" />
4673 <br style="clear: both;" />
4674 </p>
4675 !!end
4676
4677 !! test
4678 Handling html with a div self-closing tag
4679 !! input
4680 <div title />
4681 <div title/>
4682 <div title/ >
4683 <div title=bar />
4684 <div title=bar/>
4685 <div title=bar/ >
4686 !! result
4687 <p>&lt;div title /&gt;
4688 &lt;div title/&gt;
4689 </p>
4690 <div>
4691 <p>&lt;div title=bar /&gt;
4692 &lt;div title=bar/&gt;
4693 </p>
4694 <div title="bar/"></div>
4695 </div>
4696
4697 !! end
4698
4699 !! test
4700 Handling html with a br self-closing tag
4701 !! input
4702 <br title />
4703 <br title/>
4704 <br title/ >
4705 <br title=bar />
4706 <br title=bar/>
4707 <br title=bar/ >
4708 !! result
4709 <p><br title="title" />
4710 <br title="title" />
4711 <br />
4712 <br title="bar" />
4713 <br title="bar" />
4714 <br title="bar/" />
4715 </p>
4716 !! end
4717
4718 !! test
4719 Horizontal ruler (should it add that extra space?)
4720 !! input
4721 <hr>
4722 <hr >
4723 foo <hr
4724 > bar
4725 !! result
4726 <hr />
4727 <hr />
4728 foo <hr /> bar
4729
4730 !! end
4731
4732 !! test
4733 Horizontal ruler -- 4+ dashes render hr
4734 !! input
4735 ----
4736 !! result
4737 <hr />
4738
4739 !! end
4740
4741 !! test
4742 Horizontal ruler -- eats additional dashes on the same line
4743 !! input
4744 ---------
4745 !! result
4746 <hr />
4747
4748 !! end
4749
4750 !! test
4751 Horizontal ruler -- does not collapse dashes on consecutive lines
4752 !! input
4753 ----
4754 ----
4755 !! result
4756 <hr />
4757 <hr />
4758
4759 !! end
4760
4761 !! test
4762 Horizontal ruler -- <4 dashes render as plain text
4763 !! input
4764 ---
4765 !! result
4766 <p>---
4767 </p>
4768 !! end
4769
4770 !! test
4771 Horizontal ruler -- Supports content following dashes on same line
4772 !! input
4773 ---- Foo
4774 !! result
4775 <hr /> Foo
4776
4777 !! end
4778
4779 ###
4780 ### Block-level elements
4781 ###
4782 !! test
4783 Common list
4784 !! input
4785 *Common list
4786 * item 2
4787 *item 3
4788 !! result
4789 <ul><li>Common list
4790 </li><li> item 2
4791 </li><li>item 3
4792 </li></ul>
4793
4794 !! end
4795
4796 !! test
4797 Numbered list
4798 !! input
4799 #Numbered list
4800 #item 2
4801 # item 3
4802 !! result
4803 <ol><li>Numbered list
4804 </li><li>item 2
4805 </li><li> item 3
4806 </li></ol>
4807
4808 !! end
4809
4810 !! test
4811 Mixed list
4812 !! input
4813 *Mixed list
4814 *# with numbers
4815 ** and bullets
4816 *# and numbers
4817 *bullets again
4818 **bullet level 2
4819 ***bullet level 3
4820 ***#Number on level 4
4821 **bullet level 2
4822 **#Number on level 3
4823 **#Number on level 3
4824 *#number level 2
4825 *Level 1
4826 *** Level 3
4827 #** Level 3, but ordered
4828 !! result
4829 <ul><li>Mixed list
4830 <ol><li> with numbers
4831 </li></ol>
4832 <ul><li> and bullets
4833 </li></ul>
4834 <ol><li> and numbers
4835 </li></ol>
4836 </li><li>bullets again
4837 <ul><li>bullet level 2
4838 <ul><li>bullet level 3
4839 <ol><li>Number on level 4
4840 </li></ol>
4841 </li></ul>
4842 </li><li>bullet level 2
4843 <ol><li>Number on level 3
4844 </li><li>Number on level 3
4845 </li></ol>
4846 </li></ul>
4847 <ol><li>number level 2
4848 </li></ol>
4849 </li><li>Level 1
4850 <ul><li><ul><li> Level 3
4851 </li></ul>
4852 </li></ul>
4853 </li></ul>
4854 <ol><li><ul><li><ul><li> Level 3, but ordered
4855 </li></ul>
4856 </li></ul>
4857 </li></ol>
4858
4859 !! end
4860
4861 !! test
4862 Nested lists 1
4863 !! input
4864 *foo
4865 **bar
4866 !! result
4867 <ul><li>foo
4868 <ul><li>bar
4869 </li></ul>
4870 </li></ul>
4871
4872 !! end
4873
4874 !! test
4875 Nested lists 2
4876 !! input
4877 **foo
4878 *bar
4879 !! result
4880 <ul><li><ul><li>foo
4881 </li></ul>
4882 </li><li>bar
4883 </li></ul>
4884
4885 !! end
4886
4887 !! test
4888 Nested lists 3 (first element empty)
4889 !! input
4890 *
4891 **bar
4892 !! result
4893 <ul><li>
4894 <ul><li>bar
4895 </li></ul>
4896 </li></ul>
4897
4898 !! end
4899
4900 !! test
4901 Nested lists 4 (first element empty)
4902 !! input
4903 **
4904 *bar
4905 !! result
4906 <ul><li><ul><li>
4907 </li></ul>
4908 </li><li>bar
4909 </li></ul>
4910
4911 !! end
4912
4913 !! test
4914 Nested lists 5 (both elements empty)
4915 !! input
4916 **
4917 *
4918 !! result
4919 <ul><li><ul><li>
4920 </li></ul>
4921 </li><li>
4922 </li></ul>
4923
4924 !! end
4925
4926 !! test
4927 Nested lists 6 (both elements empty)
4928 !! input
4929 *
4930 **
4931 !! result
4932 <ul><li>
4933 <ul><li>
4934 </li></ul>
4935 </li></ul>
4936
4937 !! end
4938
4939 !! test
4940 Nested lists 7 (skip initial nesting levels)
4941 !! input
4942 *** foo
4943 !! result
4944 <ul><li><ul><li><ul><li> foo
4945 </li></ul>
4946 </li></ul>
4947 </li></ul>
4948
4949 !! end
4950
4951 !! test
4952 Nested lists 8 (multiple nesting transitions)
4953 !! input
4954 * foo
4955 *** bar
4956 ** baz
4957 * boo
4958 !! result
4959 <ul><li> foo
4960 <ul><li><ul><li> bar
4961 </li></ul>
4962 </li><li> baz
4963 </li></ul>
4964 </li><li> boo
4965 </li></ul>
4966
4967 !! end
4968
4969 !! test
4970 1. Lists with start-of-line-transparent tokens before bullets: Comments
4971 !! input
4972 *foo
4973 *<!--cmt-->bar
4974 <!--cmt-->*baz
4975 !! result
4976 <ul><li>foo
4977 </li><li>bar
4978 </li><li>baz
4979 </li></ul>
4980
4981 !! end
4982
4983 !! test
4984 2. Lists with start-of-line-transparent tokens before bullets: Template close
4985 !! input
4986 *foo {{echo|bar
4987 }}*baz
4988 !! result
4989 <ul><li>foo bar
4990 </li><li>baz
4991 </li></ul>
4992
4993 !! end
4994
4995 !! test
4996 Unbalanced closing block tags break a list
4997 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
4998 !! options
4999 parsoid
5000 !! input
5001 <div>
5002 *a</div><div>
5003 *b</div>
5004 !! result
5005 <div>
5006 <ul><li>a
5007 </li></ul></div><div>
5008 <ul><li>b
5009 </li></ul></div>
5010 !! end
5011
5012 !! test
5013 Unbalanced closing non-block tags don't break a list
5014 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5015 !! options
5016 parsoid
5017 !! input
5018 <span>
5019 *a</span><span>
5020 *b</span>
5021 !! result
5022 <p><span></span>
5023 </p>
5024 <ul><li>a<span></span>
5025 </li><li>b
5026 </li></ul>
5027 !! end
5028
5029 !! test
5030 Unclosed formatting tags that straddle lists are closed and reopened
5031 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5032 !! options
5033 parsoid
5034 !! input
5035 # <s> a
5036 # b </s>
5037 !! result
5038 <ol><li> <s> a </s>
5039 </li><li> <s> b </s>
5040 </li></ol>
5041 !! end
5042
5043 !!test
5044 List embedded in a non-block tag
5045 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
5046 !! options
5047 parsoid
5048 !!input
5049 <small>
5050 * foo
5051 </small>
5052 !!result
5053 <p><small></small></p>
5054 <small>
5055 <ul>
5056 <li> foo</li>
5057 </ul>
5058 </small>
5059 <p><small></small></p>
5060 !!end
5061
5062 !! test
5063 List items are not parsed correctly following a <pre> block (bug 785)
5064 !! input
5065 * <pre>foo</pre>
5066 * <pre>bar</pre>
5067 * zar
5068 !! result
5069 <ul><li> <pre>foo</pre>
5070 </li><li> <pre>bar</pre>
5071 </li><li> zar
5072 </li></ul>
5073
5074 !! end
5075
5076 !! test
5077 List items from template
5078 !! input
5079
5080 {{inner list}}
5081 * item 2
5082
5083 * item 0
5084 {{inner list}}
5085 * item 2
5086
5087 * item 0
5088 * notSOL{{inner list}}
5089 * item 2
5090 !! result
5091 <ul><li> item 1
5092 </li><li> item 2
5093 </li></ul>
5094 <ul><li> item 0
5095 </li><li> item 1
5096 </li><li> item 2
5097 </li></ul>
5098 <ul><li> item 0
5099 </li><li> notSOL
5100 </li><li> item 1
5101 </li><li> item 2
5102 </li></ul>
5103
5104 !! end
5105
5106 !! test
5107 List interrupted by empty line or heading
5108 !! input
5109 * foo
5110
5111 ** bar
5112 == A heading ==
5113 * Another list item
5114 !! result
5115 <ul><li> foo
5116 </li></ul>
5117 <ul><li><ul><li> bar
5118 </li></ul>
5119 </li></ul>
5120 <h2><span class="mw-headline" id="A_heading">A heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
5121 <ul><li> Another list item
5122 </li></ul>
5123
5124 !!end
5125
5126 !!test
5127 Multiple list tags generated by templates
5128 !!input
5129 {{echo|<li>}}a
5130 {{echo|<li>}}b
5131 {{echo|<li>}}c
5132 !!result
5133 <li>a
5134 <li>b
5135 <li>c</li>
5136 </li>
5137 </li>
5138
5139 !!end
5140
5141 !!test
5142 Single-comment whitespace lines dont break lists, but multi-comment whitespace lines do
5143 !!input
5144 *a
5145 <!--This line will NOT split the list-->
5146 *b
5147 <!--This line will NOT split the list either-->
5148 *c
5149 <!--foo--> <!--This line with more than 1 comment will split the list-->
5150 *d
5151 !!result
5152 <ul><li>a
5153 </li><li>b
5154 </li><li>c
5155 </li></ul>
5156 <ul><li>d
5157 </li></ul>
5158
5159 !!end
5160
5161 !!test
5162 Test the li-hack
5163 (Cannot test this with PHP parser since it relies on Tidy for the hack)
5164 !!options
5165 parsoid=wt2html,wt2wt
5166 !!input
5167 * foo
5168 * <li>li-hack
5169 * {{echo|<li>templated li-hack}}
5170 * <!--foo--> <li> unsupported li-hack with preceding comments
5171
5172 <ul>
5173 <li><li>not a li-hack
5174 </li>
5175 </ul>
5176 !!result
5177 <ul><li> foo</li>
5178 <li>li-hack</li>
5179 <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>
5180 <li> <!--foo--> </li><li> li-hack with preceding comments</li></ul>
5181
5182 <ul>
5183 <li></li><li>not a li-hack
5184 </li>
5185 </ul>
5186 !!end
5187 ###
5188 ### Magic Words
5189 ###
5190
5191 !! test
5192 Magic Word: {{CURRENTDAY}}
5193 !! input
5194 {{CURRENTDAY}}
5195 !! result
5196 <p>1
5197 </p>
5198 !! end
5199
5200 !! test
5201 Magic Word: {{CURRENTDAY2}}
5202 !! input
5203 {{CURRENTDAY2}}
5204 !! result
5205 <p>01
5206 </p>
5207 !! end
5208
5209 !! test
5210 Magic Word: {{CURRENTDAYNAME}}
5211 !! input
5212 {{CURRENTDAYNAME}}
5213 !! result
5214 <p>Thursday
5215 </p>
5216 !! end
5217
5218 !! test
5219 Magic Word: {{CURRENTDOW}}
5220 !! input
5221 {{CURRENTDOW}}
5222 !! result
5223 <p>4
5224 </p>
5225 !! end
5226
5227 !! test
5228 Magic Word: {{CURRENTMONTH}}
5229 !! input
5230 {{CURRENTMONTH}}
5231 !! result
5232 <p>01
5233 </p>
5234 !! end
5235
5236 !! test
5237 Magic Word: {{CURRENTMONTHABBREV}}
5238 !! input
5239 {{CURRENTMONTHABBREV}}
5240 !! result
5241 <p>Jan
5242 </p>
5243 !! end
5244
5245 !! test
5246 Magic Word: {{CURRENTMONTHNAME}}
5247 !! input
5248 {{CURRENTMONTHNAME}}
5249 !! result
5250 <p>January
5251 </p>
5252 !! end
5253
5254 !! test
5255 Magic Word: {{CURRENTMONTHNAMEGEN}}
5256 !! input
5257 {{CURRENTMONTHNAMEGEN}}
5258 !! result
5259 <p>January
5260 </p>
5261 !! end
5262
5263 !! test
5264 Magic Word: {{CURRENTTIME}}
5265 !! input
5266 {{CURRENTTIME}}
5267 !! result
5268 <p>00:02
5269 </p>
5270 !! end
5271
5272 !! test
5273 Magic Word: {{CURRENTWEEK}} (@bug 4594)
5274 !! input
5275 {{CURRENTWEEK}}
5276 !! result
5277 <p>1
5278 </p>
5279 !! end
5280
5281 !! test
5282 Magic Word: {{CURRENTYEAR}}
5283 !! input
5284 {{CURRENTYEAR}}
5285 !! result
5286 <p>1970
5287 </p>
5288 !! end
5289
5290 !! test
5291 Magic Word: {{FULLPAGENAME}}
5292 !! options
5293 title=[[User:Ævar Arnfjörð Bjarmason]]
5294 !! input
5295 {{FULLPAGENAME}}
5296 !! result
5297 <p>User:Ævar Arnfjörð Bjarmason
5298 </p>
5299 !! end
5300
5301 !! test
5302 Magic Word: {{FULLPAGENAMEE}}
5303 !! options
5304 title=[[User:Ævar Arnfjörð Bjarmason]]
5305 !! input
5306 {{FULLPAGENAMEE}}
5307 !! result
5308 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5309 </p>
5310 !! end
5311
5312 !! test
5313 Magic Word: {{NAMESPACE}}
5314 !! options
5315 title=[[User:Ævar Arnfjörð Bjarmason]]
5316 !! input
5317 {{NAMESPACE}}
5318 !! result
5319 <p>User
5320 </p>
5321 !! end
5322
5323 !! test
5324 Magic Word: {{NAMESPACEE}}
5325 !! options
5326 title=[[User:Ævar Arnfjörð Bjarmason]]
5327 !! input
5328 {{NAMESPACEE}}
5329 !! result
5330 <p>User
5331 </p>
5332 !! end
5333
5334 !! test
5335 Magic Word: {{NAMESPACENUMBER}}
5336 !! options
5337 title=[[User:Ævar Arnfjörð Bjarmason]]
5338 !! input
5339 {{NAMESPACENUMBER}}
5340 !! result
5341 <p>2
5342 </p>
5343 !! end
5344
5345 !! test
5346 Magic Word: {{NUMBEROFFILES}}
5347 !! input
5348 {{NUMBEROFFILES}}
5349 !! result
5350 <p>4
5351 </p>
5352 !! end
5353
5354 !! test
5355 Magic Word: {{PAGENAME}}
5356 !! options
5357 title=[[User:Ævar Arnfjörð Bjarmason]]
5358 !! input
5359 {{PAGENAME}}
5360 !! result
5361 <p>Ævar Arnfjörð Bjarmason
5362 </p>
5363 !! end
5364
5365 !! test
5366 Magic Word: {{PAGENAME}} with metacharacters
5367 !! options
5368 title=[['foo & bar = baz']]
5369 !! input
5370 ''{{PAGENAME}}''
5371 !! result
5372 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
5373 </p>
5374 !! end
5375
5376 !! test
5377 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
5378 !! options
5379 title=[[*RFC 1234 http://example.com/]]
5380 !! input
5381 {{PAGENAME}}
5382 !! result
5383 <p>&#42;RFC&#32;1234 http&#58;//example.com/
5384 </p>
5385 !! end
5386
5387 !! test
5388 Magic Word: {{PAGENAMEE}}
5389 !! options
5390 title=[[User:Ævar Arnfjörð Bjarmason]]
5391 !! input
5392 {{PAGENAMEE}}
5393 !! result
5394 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5395 </p>
5396 !! end
5397
5398 !! test
5399 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
5400 !! options
5401 title=[[*RFC 1234 http://example.com/]]
5402 !! input
5403 {{PAGENAMEE}}
5404 !! result
5405 <p>&#42;RFC_1234_http&#58;//example.com/
5406 </p>
5407 !! end
5408
5409 !! test
5410 Magic Word: {{REVISIONID}}
5411 !! input
5412 {{REVISIONID}}
5413 !! result
5414 <p>1337
5415 </p>
5416 !! end
5417
5418 !! test
5419 Magic Word: {{SCRIPTPATH}}
5420 !! input
5421 {{SCRIPTPATH}}
5422 !! result
5423 <p>/
5424 </p>
5425 !! end
5426
5427 !! test
5428 Magic Word: {{SERVER}}
5429 !! input
5430 {{SERVER}}
5431 !! result
5432 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5433 </p>
5434 !! end
5435
5436 !! test
5437 Magic Word: {{SERVERNAME}}
5438 !! input
5439 {{SERVERNAME}}
5440 !! result
5441 <p>example.org
5442 </p>
5443 !! end
5444
5445 !! test
5446 Magic Word: {{SITENAME}}
5447 !! input
5448 {{SITENAME}}
5449 !! result
5450 <p>MediaWiki
5451 </p>
5452 !! end
5453
5454 !! test
5455 Case-sensitive magic words, when cased differently, should just be template transclusions
5456 !! input
5457 {{CurrentMonth}}
5458 {{currentday}}
5459 {{cURreNTweEK}}
5460 {{currentHour}}
5461 !! result
5462 <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>
5463 <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>
5464 <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>
5465 <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>
5466 </p>
5467 !! end
5468
5469 !! test
5470 Case-insensitive magic words should still work with weird casing.
5471 !! input
5472 {{sErVeRNaMe}}
5473 {{LCFirst:AOEU}}
5474 {{ucFIRST:aoeu}}
5475 {{SERver}}
5476 !! result
5477 <p>example.org
5478 aOEU
5479 Aoeu
5480 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5481 </p>
5482 !! end
5483
5484 !! test
5485 Namespace 1 {{ns:1}}
5486 !! input
5487 {{ns:1}}
5488 !! result
5489 <p>Talk
5490 </p>
5491 !! end
5492
5493 !! test
5494 Namespace 1 {{ns:01}}
5495 !! input
5496 {{ns:01}}
5497 !! result
5498 <p>Talk
5499 </p>
5500 !! end
5501
5502 !! test
5503 Namespace 0 {{ns:0}} (bug 4783)
5504 !! input
5505 {{ns:0}}
5506 !! result
5507
5508 !! end
5509
5510 !! test
5511 Namespace 0 {{ns:00}} (bug 4783)
5512 !! input
5513 {{ns:00}}
5514 !! result
5515
5516 !! end
5517
5518 !! test
5519 Namespace -1 {{ns:-1}}
5520 !! input
5521 {{ns:-1}}
5522 !! result
5523 <p>Special
5524 </p>
5525 !! end
5526
5527 !! test
5528 Namespace User {{ns:User}}
5529 !! input
5530 {{ns:User}}
5531 !! result
5532 <p>User
5533 </p>
5534 !! end
5535
5536 !! test
5537 Namespace User talk {{ns:User_talk}}
5538 !! input
5539 {{ns:User_talk}}
5540 !! result
5541 <p>User talk
5542 </p>
5543 !! end
5544
5545 !! test
5546 Namespace User talk {{ns:uSeR tAlK}}
5547 !! input
5548 {{ns:uSeR tAlK}}
5549 !! result
5550 <p>User talk
5551 </p>
5552 !! end
5553
5554 !! test
5555 Namespace File {{ns:File}}
5556 !! input
5557 {{ns:File}}
5558 !! result
5559 <p>File
5560 </p>
5561 !! end
5562
5563 !! test
5564 Namespace File {{ns:Image}}
5565 !! input
5566 {{ns:Image}}
5567 !! result
5568 <p>File
5569 </p>
5570 !! end
5571
5572 !! test
5573 Namespace (lang=de) Benutzer {{ns:User}}
5574 !! options
5575 language=de
5576 !! input
5577 {{ns:User}}
5578 !! result
5579 <p>Benutzer
5580 </p>
5581 !! end
5582
5583 !! test
5584 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
5585 !! options
5586 language=de
5587 !! input
5588 {{ns:3}}
5589 !! result
5590 <p>Benutzer Diskussion
5591 </p>
5592 !! end
5593
5594
5595 !! test
5596 Urlencode
5597 !! input
5598 {{urlencode:hi world?!}}
5599 {{urlencode:hi world?!|WIKI}}
5600 {{urlencode:hi world?!|PATH}}
5601 {{urlencode:hi world?!|QUERY}}
5602 !! result
5603 <p>hi+world%3F%21
5604 hi_world%3F!
5605 hi%20world%3F%21
5606 hi+world%3F%21
5607 </p>
5608 !! end
5609
5610 ###
5611 ### Magic links
5612 ###
5613 !! test
5614 Magic links: internal link to RFC (bug 479)
5615 !! input
5616 [[RFC 123]]
5617 !! result
5618 <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>
5619 </p>
5620 !! end
5621
5622 !! test
5623 Magic links: RFC (bug 479)
5624 !! input
5625 RFC 822
5626 !! result
5627 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
5628 </p>
5629 !! end
5630
5631 !! test
5632 Magic links: ISBN (bug 1937)
5633 !! input
5634 ISBN 0-306-40615-2
5635 !! result
5636 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
5637 </p>
5638 !! end
5639
5640 !! test
5641 Magic links: PMID incorrectly converts space to underscore
5642 !! input
5643 PMID 1234
5644 !! result
5645 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
5646 </p>
5647 !! end
5648
5649 ###
5650 ### Templates
5651 ####
5652
5653 !! test
5654 Nonexistent template
5655 !! input
5656 {{thistemplatedoesnotexist}}
5657 !! result
5658 <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>
5659 </p>
5660 !! end
5661
5662 !! test
5663 Template with invalid target containing tags
5664 !! input
5665 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5666 !! result
5667 <p>{{a<b>b</b>|foo|a=b|a = b}}
5668 </p>
5669 !! end
5670
5671 !! test
5672 Template with invalid target containing unclosed tag
5673 !! input
5674 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5675 !! result
5676 <p>{{a<b>|foo|a=b|a = b}}</b>
5677 </p>
5678 !! end
5679
5680 !! article
5681 Template:test
5682 !! text
5683 This is a test template
5684 !! endarticle
5685
5686 !! test
5687 Simple template
5688 !! input
5689 {{test}}
5690 !! result
5691 <p>This is a test template
5692 </p>
5693 !! end
5694
5695 !! test
5696 Template with explicit namespace
5697 !! input
5698 {{Template:test}}
5699 !! result
5700 <p>This is a test template
5701 </p>
5702 !! end
5703
5704
5705 !! article
5706 Template:paramtest
5707 !! text
5708 This is a test template with parameter {{{param}}}
5709 !! endarticle
5710
5711 !! test
5712 Template parameter
5713 !! input
5714 {{paramtest|param=foo}}
5715 !! result
5716 <p>This is a test template with parameter foo
5717 </p>
5718 !! end
5719
5720 !! article
5721 Template:paramtestnum
5722 !! text
5723 [[{{{1}}}|{{{2}}}]]
5724 !! endarticle
5725
5726 !! test
5727 Template unnamed parameter
5728 !! input
5729 {{paramtestnum|Main Page|the main page}}
5730 !! result
5731 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
5732 </p>
5733 !! end
5734
5735 !! article
5736 Template:templatesimple
5737 !! text
5738 (test)
5739 !! endarticle
5740
5741 !! article
5742 Template:templateredirect
5743 !! text
5744 #redirect [[Template:templatesimple]]
5745 !! endarticle
5746
5747 !! article
5748 Template:templateasargtestnum
5749 !! text
5750 {{{{{1}}}}}
5751 !! endarticle
5752
5753 !! article
5754 Template:templateasargtest
5755 !! text
5756 {{template{{{templ}}}}}
5757 !! endarticle
5758
5759 !! article
5760 Template:templateasargtest2
5761 !! text
5762 {{{{{templ}}}}}
5763 !! endarticle
5764
5765 !! test
5766 Template with template name as unnamed argument
5767 !! input
5768 {{templateasargtestnum|templatesimple}}
5769 !! result
5770 <p>(test)
5771 </p>
5772 !! end
5773
5774 !! test
5775 Template with template name as argument
5776 !! input
5777 {{templateasargtest|templ=simple}}
5778 !! result
5779 <p>(test)
5780 </p>
5781 !! end
5782
5783 !! test
5784 Template with template name as argument (2)
5785 !! input
5786 {{templateasargtest2|templ=templatesimple}}
5787 !! result
5788 <p>(test)
5789 </p>
5790 !! end
5791
5792 !! article
5793 Template:templateasargtestdefault
5794 !! text
5795 {{{{{templ|templatesimple}}}}}
5796 !! endarticle
5797
5798 !! article
5799 Template:templa
5800 !! text
5801 '''templ'''
5802 !! endarticle
5803
5804 !! test
5805 Template with default value
5806 !! input
5807 {{templateasargtestdefault}}
5808 !! result
5809 <p>(test)
5810 </p>
5811 !! end
5812
5813 !! test
5814 Template with default value (value set)
5815 !! input
5816 {{templateasargtestdefault|templ=templa}}
5817 !! result
5818 <p><b>templ</b>
5819 </p>
5820 !! end
5821
5822 !! test
5823 Template redirect
5824 !! input
5825 {{templateredirect}}
5826 !! result
5827 <p>(test)
5828 </p>
5829 !! end
5830
5831 !! test
5832 Template with argument in separate line
5833 !! input
5834 {{ templateasargtest |
5835 templ = simple }}
5836 !! result
5837 <p>(test)
5838 </p>
5839 !! end
5840
5841 !! test
5842 Template with complex template as argument
5843 !! input
5844 {{paramtest|
5845 param ={{ templateasargtest |
5846 templ = simple }}}}
5847 !! result
5848 <p>This is a test template with parameter (test)
5849 </p>
5850 !! end
5851
5852 !! test
5853 Template with thumb image (with link in description)
5854 !! input
5855 {{paramtest|
5856 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
5857 !! result
5858 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>
5859
5860 !! end
5861
5862 !! article
5863 Template:complextemplate
5864 !! text
5865 {{{1}}} {{paramtest|
5866 param ={{{param}}}}}
5867 !! endarticle
5868
5869 !! test
5870 Template with complex arguments
5871 !! input
5872 {{complextemplate|
5873 param ={{ templateasargtest |
5874 templ = simple }}|[[Template:complextemplate|link]]}}
5875 !! result
5876 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
5877 </p>
5878 !! end
5879
5880 !! test
5881 BUG 553: link with two variables in a piped link
5882 !! input
5883 {|
5884 |[[{{{1}}}|{{{2}}}]]
5885 |}
5886 !! result
5887 <table>
5888 <tr>
5889 <td>[[{{{1}}}|{{{2}}}]]
5890 </td></tr></table>
5891
5892 !! end
5893
5894 !! test
5895 Magic variable as template parameter
5896 !! input
5897 {{paramtest|param={{SITENAME}}}}
5898 !! result
5899 <p>This is a test template with parameter MediaWiki
5900 </p>
5901 !! end
5902
5903 !! article
5904 Template:linktest
5905 !! text
5906 [[{{{param}}}|link]]
5907 !! endarticle
5908
5909 !! test
5910 Template parameter as link source
5911 !! input
5912 {{linktest|param=Main Page}}
5913 !! result
5914 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
5915 </p>
5916 !! end
5917
5918 !!test
5919 Template-generated attribute string (k='v')
5920 !!input
5921 <span {{attr_str|id|v1}}>bar</span>
5922 !!result
5923 <p><span id="v1">bar</span>
5924 </p>
5925 !!end
5926
5927 !!article
5928 Template:paramtest2
5929 !! text
5930 including another template, {{paramtest|param={{{arg}}}}}
5931 !! endarticle
5932
5933 !! test
5934 Template passing argument to another template
5935 !! input
5936 {{paramtest2|arg='hmm'}}
5937 !! result
5938 <p>including another template, This is a test template with parameter 'hmm'
5939 </p>
5940 !! end
5941
5942 !! article
5943 Template:Linktest2
5944 !! text
5945 Main Page
5946 !! endarticle
5947
5948 !! test
5949 Template as link source
5950 !! input
5951 [[{{linktest2}}]]
5952
5953 [[{{linktest2}}|Main Page]]
5954
5955 [[{{linktest2}}]]Page
5956 !! result
5957 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5958 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5959 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
5960 </p>
5961 !! end
5962
5963
5964 !! article
5965 Template:loop1
5966 !! text
5967 {{loop2}}
5968 !! endarticle
5969
5970 !! article
5971 Template:loop2
5972 !! text
5973 {{loop1}}
5974 !! endarticle
5975
5976 !! test
5977 Template infinite loop
5978 !! input
5979 {{loop1}}
5980 !! result
5981 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
5982 </p>
5983 !! end
5984
5985 !! test
5986 Template from main namespace
5987 !! input
5988 {{:Main Page}}
5989 !! result
5990 <p>blah blah
5991 </p>
5992 !! end
5993
5994 !! article
5995 Template:table
5996 !! text
5997 {|
5998 | 1 || 2
5999 |-
6000 | 3 || 4
6001 |}
6002 !! endarticle
6003
6004 !! test
6005 BUG 529: Template with table, not included at beginning of line
6006 !! input
6007 foo {{table}}
6008 !! result
6009 <p>foo
6010 </p>
6011 <table>
6012 <tr>
6013 <td> 1 </td>
6014 <td> 2
6015 </td></tr>
6016 <tr>
6017 <td> 3 </td>
6018 <td> 4
6019 </td></tr></table>
6020
6021 !! end
6022
6023 !! test
6024 BUG 523: Template shouldn't eat newline (or add an extra one before table)
6025 !! input
6026 foo
6027 {{table}}
6028 !! result
6029 <p>foo
6030 </p>
6031 <table>
6032 <tr>
6033 <td> 1 </td>
6034 <td> 2
6035 </td></tr>
6036 <tr>
6037 <td> 3 </td>
6038 <td> 4
6039 </td></tr></table>
6040
6041 !! end
6042
6043 !! test
6044 BUG 41: Template parameters shown as broken links
6045 !! input
6046 {{{parameter}}}
6047 !! result
6048 <p>{{{parameter}}}
6049 </p>
6050 !! end
6051
6052 !! test
6053 Template with targets containing wikilinks
6054 !! input
6055 {{[[foo]]}}
6056
6057 {{[[{{echo|foo}}]]}}
6058
6059 {{{{echo|[[foo}}]]}}
6060 !! result
6061 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6062 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6063 </p><p>{{[[foo}}]]
6064 </p>
6065 !! end
6066
6067 !! article
6068 Template:MSGNW test
6069 !! text
6070 ''None'' of '''this''' should be
6071 * interpreted
6072 but rather passed unmodified
6073 {{test}}
6074 !! endarticle
6075
6076 # hmm, fix this or just deprecate msgnw and document its behavior?
6077 !! test
6078 msgnw keyword
6079 !! options
6080 disabled
6081 !! input
6082 {{msgnw:MSGNW test}}
6083 !! result
6084 <p>''None'' of '''this''' should be
6085 * interpreted
6086 but rather passed unmodified
6087 {{test}}
6088 </p>
6089 !! end
6090
6091 !! test
6092 int keyword
6093 !! input
6094 {{int:youhavenewmessages|lots of money|not!}}
6095 !! result
6096 <p>You have lots of money (not!).
6097 </p>
6098 !! end
6099
6100 !! article
6101 Template:Includes
6102 !! text
6103 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6104 !! endarticle
6105
6106 !! test
6107 <includeonly> and <noinclude> being included
6108 !! input
6109 {{Includes}}
6110 !! result
6111 <p>Foobar
6112 </p>
6113 !! end
6114
6115 !! article
6116 Template:Includes2
6117 !! text
6118 <onlyinclude>Foo</onlyinclude>bar
6119 !! endarticle
6120
6121 !! test
6122 <onlyinclude> being included
6123 !! input
6124 {{Includes2}}
6125 !! result
6126 <p>Foo
6127 </p>
6128 !! end
6129
6130
6131 !! article
6132 Template:Includes3
6133 !! text
6134 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
6135 !! endarticle
6136
6137 !! test
6138 <onlyinclude> and <includeonly> being included
6139 !! input
6140 {{Includes3}}
6141 !! result
6142 <p>Foo
6143 </p>
6144 !! end
6145
6146 !! test
6147 <includeonly> and <noinclude> on a page
6148 !! input
6149 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6150 !! result
6151 <p>Foozar
6152 </p>
6153 !! end
6154
6155 !! test
6156 Un-closed <noinclude>
6157 !! input
6158 <noinclude>
6159 !! result
6160 !! end
6161
6162 !! test
6163 <onlyinclude> on a page
6164 !! input
6165 <onlyinclude>Foo</onlyinclude>bar
6166 !! result
6167 <p>Foobar
6168 </p>
6169 !! end
6170
6171 !! test
6172 Un-closed <onlyinclude>
6173 !! input
6174 <onlyinclude>
6175 !! result
6176 !! end
6177
6178 !!test
6179 Self-closed noinclude, includeonly, onlyinclude tags
6180 !!input
6181 <noinclude />
6182 <includeonly />
6183 <onlyinclude />
6184 !!result
6185 <p><br />
6186 </p>
6187 !!end
6188
6189 !!test
6190 Unbalanced includeonly and noinclude tags
6191 !!input
6192 {|
6193 |a</noinclude>
6194 |b</noinclude></noinclude>
6195 |c</noinclude></includeonly>
6196 |d</includeonly></includeonly>
6197 |}
6198 !!result
6199 <table>
6200 <tr>
6201 <td>a
6202 </td>
6203 <td>b
6204 </td>
6205 <td>c&lt;/includeonly&gt;
6206 </td>
6207 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
6208 </td></tr></table>
6209
6210 !!end
6211
6212 !! article
6213 Template:Includeonly section
6214 !! text
6215 <includeonly>
6216 ==Includeonly section==
6217 </includeonly>
6218 ==Section T-1==
6219 !!endarticle
6220
6221 !! test
6222 Bug 6563: Edit link generation for section shown by <includeonly>
6223 !! input
6224 {{includeonly section}}
6225 !! result
6226 <h2><span class="mw-headline" id="Includeonly_section">Includeonly section</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
6227 <h2><span class="mw-headline" id="Section_T-1">Section T-1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
6228
6229 !! end
6230
6231 # Uses same input as the contents of [[Template:Includeonly section]]
6232 !! test
6233 Bug 6563: Section extraction for section shown by <includeonly>
6234 !! options
6235 section=T-2
6236 !! input
6237 <includeonly>
6238 ==Includeonly section==
6239 </includeonly>
6240 ==Section T-2==
6241 !! result
6242 ==Section T-2==
6243 !! end
6244
6245 !! test
6246 Bug 6563: Edit link generation for section suppressed by <includeonly>
6247 !! input
6248 <includeonly>
6249 ==Includeonly section==
6250 </includeonly>
6251 ==Section 1==
6252 !! result
6253 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
6254
6255 !! end
6256
6257 !! test
6258 Bug 6563: Section extraction for section suppressed by <includeonly>
6259 !! options
6260 section=1
6261 !! input
6262 <includeonly>
6263 ==Includeonly section==
6264 </includeonly>
6265 ==Section 1==
6266 !! result
6267 ==Section 1==
6268 !! end
6269
6270 !! test
6271 Un-closed <includeonly>
6272 !! input
6273 <includeonly>
6274 !! result
6275 !! end
6276
6277 ###
6278 ### <includeonly> and <noinclude> in attributes
6279 ###
6280 !!test
6281 0. includeonly around the entire attribute
6282 !!input
6283 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
6284 !!result
6285 <p><span id="v2">bar</span>
6286 </p>
6287 !!end
6288
6289 !!test
6290 1. includeonly in html attr key
6291 !!input
6292 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
6293 !!result
6294 <p><span id="foo">bar</span>
6295 </p>
6296 !!end
6297
6298 !!test
6299 2. includeonly in html attr value
6300 !!input
6301 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
6302 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
6303 !!result
6304 <p><span id="v1">bar</span>
6305 <span id="v1">bar</span>
6306 </p>
6307 !!end
6308
6309 !!test
6310 3. includeonly in part of an attr value
6311 !!input
6312 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
6313 !!result
6314 <p><span style="color:red;">bar</span>
6315 </p>
6316 !!end
6317
6318 ###
6319 ### Testing parsing of templates where a template arg
6320 ### has the same name as the template itself.
6321 ###
6322
6323 !! article
6324 Template:quote
6325 !! text
6326 {{{quote|{{{1}}}}}}
6327 !! endarticle
6328
6329 !!test
6330 Templates: Template Name/Arg clash: 1. Use of positional param
6331 !!input
6332 {{quote|foo}}
6333 !!result
6334 <p>foo
6335 </p>
6336 !!end
6337
6338 !!test
6339 Templates: Template Name/Arg clash: 2. Use of named param
6340 !!input
6341 {{quote|quote=foo}}
6342 !!result
6343 <p>foo
6344 </p>
6345 !!end
6346
6347 !!test
6348 Templates: Template Name/Arg clash: 3. Use of named param with empty input
6349 !!input
6350 {{quote|quote}}
6351 !!result
6352 <p>quote
6353 </p>
6354 !!end
6355
6356 ###
6357 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
6358 ###
6359
6360 !!test
6361 Templates: 1. Simple use
6362 !!input
6363 {{echo|Foo}}
6364 !!result
6365 <p>Foo
6366 </p>
6367 !!end
6368
6369 !!test
6370 Templates: 2. Inside a block tag
6371 !!input
6372 <div>{{echo|Foo}}</div>
6373 !!result
6374 <div>Foo</div>
6375
6376 !!end
6377
6378 !!test
6379 Templates: P-wrapping: 1a. Templates on consecutive lines
6380 !!input
6381 {{echo|Foo}}
6382 {{echo|bar}}
6383 !!result
6384 <p>Foo
6385 bar
6386 </p>
6387 !!end
6388
6389 !!test
6390 Templates: P-wrapping: 1b. Templates on consecutive lines
6391 !!input
6392 Foo
6393
6394 {{echo|bar}}
6395 {{echo|baz}}
6396 !!result
6397 <p>Foo
6398 </p><p>bar
6399 baz
6400 </p>
6401 !!end
6402
6403 !!test
6404 Templates: P-wrapping: 1c. Templates on consecutive lines
6405 !!input
6406 {{echo|Foo}}
6407 {{echo|bar}} <div>baz</div>
6408 !!result
6409 <p>Foo
6410 </p>
6411 bar <div>baz</div>
6412
6413 !!end
6414
6415 !!test
6416 Templates: P-wrapping: 1d. Template preceded by comment-only line
6417 !!options
6418 parsoid=wt2html,wt2wt
6419 !!input
6420 <!-- foo -->
6421 {{echo|Bar}}
6422 !!result
6423 <!-- foo -->
6424 <p typeof="mw:Transclusion">Bar
6425 </p>
6426 !!end
6427
6428 !!test
6429 Templates: Inline Text: 1. Multiple tmeplate uses
6430 !!input
6431 {{echo|Foo}}bar{{echo|baz}}
6432 !!result
6433 <p>Foobarbaz
6434 </p>
6435 !!end
6436
6437 !!test
6438 Templates: Inline Text: 2. Back-to-back template uses
6439 !!input
6440 {{echo|Foo}}{{echo|bar}}
6441 !!result
6442 <p>Foobar
6443 </p>
6444 !!end
6445
6446 !!test
6447 Templates: Block Tags: 1. Multiple template uses
6448 !!input
6449 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
6450 !!result
6451 <div>Foo</div><div>bar</div><div>baz</div>
6452
6453 !!end
6454
6455 !!test
6456 Templates: Block Tags: 2. Back-to-back template uses
6457 !!input
6458 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
6459 !!result
6460 <div>Foo</div><div>bar</div>
6461
6462 !!end
6463
6464 !!test
6465 Templates: Links: 1. Simple example
6466 !!input
6467 {{echo|[[Foo|bar]]}}
6468 !!result
6469 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6470 </p>
6471 !!end
6472
6473 !!test
6474 Templates: Links: 2. Generation of link href
6475 !!input
6476 [[{{echo|Foo}}|bar]]
6477 !!result
6478 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6479 </p>
6480 !!end
6481
6482 !!test
6483 Templates: Links: 3. Generation of part of a link href
6484 !!input
6485 [[Fo{{echo|o}}|bar]]
6486
6487 [[Foo{{echo|bar}}]]
6488
6489 [[Foo{{echo|bar}}baz]]
6490
6491 [[Foo{{echo|bar}}|bar]]
6492
6493 [[:Foo{{echo|bar}}]]
6494
6495 [[:Foo{{echo|bar}}|bar]]
6496 !!result
6497 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6498 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6499 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
6500 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (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=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6503 </p>
6504 !!end
6505
6506 !!test
6507 Templates: Links: 4. Multiple templates generating link href
6508 !!input
6509 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
6510 !!result
6511 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6512 </p>
6513 !!end
6514
6515 !!test
6516 Templates: Links: 5. Generation of link text
6517 !!input
6518 [[Foo|{{echo|bar}}]]
6519 !!result
6520 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6521 </p>
6522 !!end
6523
6524 !!test
6525 Templates: Links: 5. Nested templates (only outermost template should be marked)
6526 !!input
6527 {{echo|[[{{echo|Foo}}|bar]]}}
6528 !!result
6529 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6530 </p>
6531 !!end
6532
6533 !!test
6534 Templates: HTML Tag: 1. Generation of HTML attr. key
6535 !!input
6536 <div {{echo|style}}="color:red;">foo</div>
6537 !!result
6538 <div style="color:red;">foo</div>
6539
6540 !!end
6541
6542 !!test
6543 Templates: HTML Tag: 2. Generation of HTML attr. value
6544 !!input
6545 <div style={{echo|'color:red;'}}>foo</div>
6546 !!result
6547 <div style="color:red;">foo</div>
6548
6549 !!end
6550
6551 !!test
6552 Templates: HTML Tag: 3. Generation of HTML attr key and value
6553 !!input
6554 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
6555 !!result
6556 <div style="color:red;">foo</div>
6557
6558 !!end
6559
6560 !!test
6561 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
6562 !!input
6563 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
6564 !!result
6565 <div title="This is a long title with just one piece templated">foo</div>
6566
6567 !!end
6568
6569 !!test
6570 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
6571 !!input
6572 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
6573 !!result
6574 <div title="This is a long title with just one piece templated">foo</div>
6575
6576 !!end
6577
6578 !!test
6579 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
6580 !!input
6581 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
6582 !!result
6583 <div title="This is a long title with just one piece templated">foo</div>
6584
6585 !!end
6586
6587 !!test
6588 Templates: HTML Tag: 7. Generation of partial attribute key string
6589 !!input
6590 <div st{{echo|yle}}="color:red;">foo</div>
6591 !!result
6592 <div style="color:red;">foo</div>
6593
6594 !!end
6595
6596 !!test
6597 Templates: HTML Tables: 1. Generating start of a HTML table
6598 !!input
6599 {{echo|<table><tr><td>foo</td>}}</tr></table>
6600 !!result
6601 <table><tr><td>foo</td></tr></table>
6602
6603 !!end
6604
6605 !!test
6606 Templates: HTML Tables: 2a. Generating middle of a HTML table
6607 !!input
6608 <table><tr>{{echo|<td>foo</td>}}</tr></table>
6609 !!result
6610 <table><tr><td>foo</td></tr></table>
6611
6612 !!end
6613
6614 !!test
6615 Templates: HTML Tables: 2b. Generating middle of a HTML table
6616 !!input
6617 <table>{{echo|<tr><td>foo</td></tr>}}</table>
6618 !!result
6619 <table><tr><td>foo</td></tr></table>
6620
6621 !!end
6622
6623 !!test
6624 Templates: HTML Tables: 3. Generating end of a HTML table
6625 !!input
6626 <table><tr>{{echo|<td>foo</td></tr></table>}}
6627 !!result
6628 <table><tr><td>foo</td></tr></table>
6629
6630 !!end
6631
6632 !!test
6633 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
6634 !!input
6635 {{echo|<table>}}<tr><td>foo</td></tr></table>
6636 !!result
6637 <table><tr><td>foo</td></tr></table>
6638
6639 !!end
6640
6641 !!test
6642 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
6643 !!input
6644 <table>{{echo|<tr>}}<td>foo</td></tr></table>
6645 !!result
6646 <table><tr><td>foo</td></tr></table>
6647
6648 !!end
6649
6650 !!test
6651 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
6652 !!input
6653 <table><tr>{{echo|<td>}}foo</td></tr></table>
6654 !!result
6655 <table><tr><td>foo</td></tr></table>
6656
6657 !!end
6658
6659 !!test
6660 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
6661 !!input
6662 <table><tr><td>foo{{echo|</td>}}</tr></table>
6663 !!result
6664 <table><tr><td>foo</td></tr></table>
6665
6666 !!end
6667
6668 !!test
6669 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
6670 !!input
6671 <table><tr><td>foo</td>{{echo|</tr>}}</table>
6672 !!result
6673 <table><tr><td>foo</td></tr></table>
6674
6675 !!end
6676
6677 !!test
6678 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
6679 !!input
6680 <table><tr><td>foo</td></tr>{{echo|</table>}}
6681 !!result
6682 <table><tr><td>foo</td></tr></table>
6683
6684 !!end
6685
6686 !!test
6687 Templates: Wiki Tables: 1a. Fostering of entire template content
6688 !!input
6689 {|
6690 {{echo|a}}
6691 |}
6692 !!result
6693 <table>
6694 a
6695 <tr><td></td></tr></table>
6696
6697 !!end
6698
6699 !!test
6700 Templates: Wiki Tables: 1b. Fostering of entire template content
6701 !!input
6702 {|
6703 {{echo|<div>}}
6704 foo
6705 {{echo|</div>}}
6706 |}
6707 !!result
6708 <table>
6709 <div>
6710 <p>foo
6711 </p>
6712 </div>
6713 <tr><td></td></tr></table>
6714
6715 !!end
6716
6717 !!test
6718 Templates: Wiki Tables: 2. Fostering of partial template content
6719 !!input
6720 {|
6721 {{echo|a
6722 <div>b</div>}}
6723 |}
6724 !!result
6725 <table>
6726 a
6727 <div>b</div>
6728 <tr><td></td></tr></table>
6729
6730 !!end
6731
6732 !!test
6733 Templates: Wiki Tables: 3. td-content via multiple templates
6734 !!input
6735 {|
6736 {{echo|{{pipe}}a}}{{echo|b}}
6737 |}
6738 !!result
6739 <table>
6740 <tr>
6741 <td>ab
6742 </td></tr></table>
6743
6744 !!end
6745
6746 !!test
6747 Templates: Wiki Tables: 4. Templated tags, no content
6748 !!input
6749 {{tbl-start}}
6750 {{tbl-end}}
6751 !!result
6752 <table>
6753 <tr><td></td></tr></table>
6754
6755 !!end
6756
6757 !!test
6758 Templates: Wiki Tables: 5. Templated tags, regular td-tags
6759 !!input
6760 {{tbl-start}}
6761 |foo
6762 {{tbl-end}}
6763 !!result
6764 <table>
6765 <tr>
6766 <td>foo
6767 </td></tr></table>
6768
6769 !!end
6770
6771 !!test
6772 Templates: Wiki Tables: 6. Templated tags, templated td-tags
6773 !!input
6774 {{tbl-start}}
6775 {{!}}foo
6776 {{tbl-end}}
6777 !!result
6778 <table>
6779 <tr>
6780 <td>foo
6781 </td></tr></table>
6782
6783 !!end
6784
6785 !!test
6786 Templates: Lists: Multi-line list-items via templates
6787 !!input
6788 *{{echo|a {{nonexistent|
6789 unused}}}}
6790 *{{echo|b {{nonexistent|
6791 unused}}}}
6792 !!result
6793 <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>
6794 </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>
6795 </li></ul>
6796
6797 !!end
6798
6799 !!test
6800 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
6801 !!input
6802 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
6803 !!result
6804 <p><i>ab</i>c<i>d</i>e
6805 </p>
6806 !!end
6807
6808 !!test
6809 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
6810 (PHP parser generates misnested html)
6811 !! options
6812 parsoid=wt2html,wt2wt
6813 !!input
6814 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
6815 !!result
6816 <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>
6817 !!end
6818
6819 !!test
6820 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
6821 (PHP parser generates misnested html)
6822 !! options
6823 parsoid=wt2html,wt2wt
6824 !!input
6825 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
6826 !!result
6827 <div typeof="mw:Transclusion"><i>a</i></div>
6828 <div typeof="mw:Transclusion"><i>b</i>c<i>d</i></div>
6829 <div typeof="mw:Transclusion">e</div>
6830 !!end
6831
6832 !!test
6833 Templates: Ugly nesting: 4. Divs opened/closed across templates
6834 !!input
6835 a<div>b{{echo|c</div>d}}e
6836 !!result
6837 a<div>bc</div>de
6838
6839 !!end
6840
6841 !!test
6842 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
6843 (Parsoid-centric)
6844 !! options
6845 parsoid
6846 !!input
6847 {|
6848 |{{echo|foo</table>}}
6849 |bar
6850 |}
6851 !!result
6852 <table typeof="mw:Transclusion">
6853 <tbody>
6854 <tr>
6855 <td>foo</td></tr></tbody></table><span>bar</span>
6856 !!end
6857
6858 !!test
6859 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
6860 (Parsoid-centric)
6861 !! options
6862 parsoid
6863 !!input
6864 <table>
6865 <tr>
6866 <td>
6867 <table>
6868 <tr>
6869 <td>1. {{echo|foo </table>}}</td>
6870 <td> bar </td>
6871 <td>2. {{echo|baz </table>}}</td>
6872 </tr>
6873 <tr>
6874 <td>abc</td>
6875 </tr>
6876 </table>
6877 </td>
6878 </tr>
6879 <tr>
6880 <td>xyz</td>
6881 </tr>
6882 </table>
6883 !!result
6884 <table about="#mwt1" typeof="mw:Transclusion">
6885 <tbody><tr >
6886 <td >
6887 <table >
6888 <tbody><tr >
6889 <td >1. foo </td></tr></tbody></table></td>
6890 <td > bar </td>
6891 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
6892 </span><span about="#mwt1">
6893
6894 abc</span><span about="#mwt1">
6895 </span><span about="#mwt1">
6896 </span><span about="#mwt1">
6897 </span><span about="#mwt1">
6898 </span><span about="#mwt1">
6899
6900 xyz</span><span about="#mwt1">
6901 </span><span about="#mwt1">
6902 </span>
6903 !!end
6904
6905 !! test
6906 Templates: Ugly templates: 3. newline-only template parameter
6907 !! input
6908 foo {{echo|
6909 }}
6910 !! result
6911 <p>foo
6912 </p>
6913 !! end
6914
6915 # This looks like a bug: a single newline triggers p/br for some reason.
6916 !! test
6917 Templates: Ugly templates: 4. newline-only template parameter inconsistency
6918 !! input
6919 {{echo|
6920 }}
6921 !! result
6922 <p><br />
6923 </p>
6924 !! end
6925
6926
6927 !!test
6928 Parser Functions: 1. Simple example
6929 !!input
6930 {{uc:foo}}
6931 !!result
6932 <p>FOO
6933 </p>
6934 !!end
6935
6936 !!test
6937 Parser Functions: 2. Nested use (only outermost should be marked up)
6938 !!input
6939 {{uc:{{lc:FOO}}}}
6940 !!result
6941 <p>FOO
6942 </p>
6943 !!end
6944
6945 ###
6946 ### Pre-save transform tests
6947 ###
6948 !! test
6949 pre-save transform: subst:
6950 !! options
6951 PST
6952 !! input
6953 {{subst:test}}
6954 !! result
6955 This is a test template
6956 !! end
6957
6958 !! test
6959 pre-save transform: normal template
6960 !! options
6961 PST
6962 !! input
6963 {{test}}
6964 !! result
6965 {{test}}
6966 !! end
6967
6968 !! test
6969 pre-save transform: nonexistent template
6970 !! options
6971 PST
6972 !! input
6973 {{thistemplatedoesnotexist}}
6974 !! result
6975 {{thistemplatedoesnotexist}}
6976 !! end
6977
6978
6979 !! test
6980 pre-save transform: subst magic variables
6981 !! options
6982 PST
6983 !! input
6984 {{subst:SITENAME}}
6985 !! result
6986 MediaWiki
6987 !! end
6988
6989 # This is bug 89, which I fixed. -- wtm
6990 !! test
6991 pre-save transform: subst: templates with parameters
6992 !! options
6993 pst
6994 !! input
6995 {{subst:paramtest|param="something else"}}
6996 !! result
6997 This is a test template with parameter "something else"
6998 !! end
6999
7000 !! article
7001 Template:nowikitest
7002 !! text
7003 <nowiki>'''not wiki'''</nowiki>
7004 !! endarticle
7005
7006 !! test
7007 pre-save transform: nowiki in subst (bug 1188)
7008 !! options
7009 pst
7010 !! input
7011 {{subst:nowikitest}}
7012 !! result
7013 <nowiki>'''not wiki'''</nowiki>
7014 !! end
7015
7016
7017 !! article
7018 Template:commenttest
7019 !! text
7020 This template has <!-- a comment --> in it.
7021 !! endarticle
7022
7023 !! test
7024 pre-save transform: comment in subst (bug 1936)
7025 !! options
7026 pst
7027 !! input
7028 {{subst:commenttest}}
7029 !! result
7030 This template has <!-- a comment --> in it.
7031 !! end
7032
7033 !! test
7034 pre-save transform: unclosed tag
7035 !! options
7036 pst noxml
7037 !! input
7038 <nowiki>'''not wiki'''
7039 !! result
7040 <nowiki>'''not wiki'''
7041 !! end
7042
7043 !! test
7044 pre-save transform: mixed tag case
7045 !! options
7046 pst noxml
7047 !! input
7048 <NOwiki>'''not wiki'''</noWIKI>
7049 !! result
7050 <NOwiki>'''not wiki'''</noWIKI>
7051 !! end
7052
7053 !! test
7054 pre-save transform: unclosed comment in <nowiki>
7055 !! options
7056 pst noxml
7057 !! input
7058 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7059 !! result
7060 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7061 !!end
7062
7063 # Leading @ in this template definition works around a limitation
7064 # in parsoid's parserTests which otherwise strips the <span> from the
7065 # result (confusing it for a template wrapper)
7066 !! article
7067 Template:dangerous
7068 !!text
7069 @<span onmouseover="alert('crap')">Oh no</span>
7070 !!endarticle
7071
7072 !!test
7073 (confirming safety of fix for subst bug 1936)
7074 !! input
7075 {{Template:dangerous}}
7076 !! result
7077 <p>@<span>Oh no</span>
7078 </p>
7079 !! end
7080
7081 !! test
7082 pre-save transform: comment containing gallery (bug 5024)
7083 !! options
7084 pst
7085 !! input
7086 <!-- <gallery>data</gallery> -->
7087 !!result
7088 <!-- <gallery>data</gallery> -->
7089 !!end
7090
7091 !! test
7092 pre-save transform: comment containing extension
7093 !! options
7094 pst
7095 !! input
7096 <!-- <tag>data</tag> -->
7097 !!result
7098 <!-- <tag>data</tag> -->
7099 !!end
7100
7101 !! test
7102 pre-save transform: comment containing nowiki
7103 !! options
7104 pst
7105 !! input
7106 <!-- <nowiki>data</nowiki> -->
7107 !!result
7108 <!-- <nowiki>data</nowiki> -->
7109 !!end
7110
7111 !! test
7112 pre-save transform: <noinclude> in subst (bug 3298)
7113 !! options
7114 pst
7115 !! input
7116 {{subst:Includes}}
7117 !! result
7118 Foobar
7119 !! end
7120
7121 !! test
7122 pre-save transform: <onlyinclude> in subst (bug 3298)
7123 !! options
7124 pst
7125 !! input
7126 {{subst:Includes2}}
7127 !! result
7128 Foo
7129 !! end
7130
7131 !! article
7132 Template:SubstTest
7133 !!text
7134 {{<includeonly>subst:</includeonly>Includes}}
7135 !! endarticle
7136
7137 !! article
7138 Template:SafeSubstTest
7139 !! text
7140 {{<includeonly>safesubst:</includeonly>Includes}}
7141 !! endarticle
7142
7143 !! test
7144 bug 22297: safesubst: works during PST
7145 !! options
7146 pst
7147 !! input
7148 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
7149 !! result
7150 FoobarFoobar
7151 !! end
7152
7153 !! test
7154 bug 22297: safesubst: works during normal parse
7155 !! input
7156 {{SafeSubstTest}}
7157 !! result
7158 <p>Foobar
7159 </p>
7160 !! end
7161
7162 !! test:
7163 subst: does not work during normal parse
7164 !! input
7165 {{SubstTest}}
7166 !! result
7167 <p>{{subst:Includes}}
7168 </p>
7169 !! end
7170
7171 !! test
7172 pre-save transform: context links ("pipe trick")
7173 !! options
7174 pst
7175 !! input
7176 [[Article (context)|]]
7177 [[Bar:Article|]]
7178 [[:Bar:Article|]]
7179 [[Bar:Article (context)|]]
7180 [[:Bar:Article (context)|]]
7181 [[|Article]]
7182 [[|Article (context)]]
7183 [[Bar:X (Y) Z|]]
7184 [[:Bar:X (Y) Z|]]
7185 !! result
7186 [[Article (context)|Article]]
7187 [[Bar:Article|Article]]
7188 [[:Bar:Article|Article]]
7189 [[Bar:Article (context)|Article]]
7190 [[:Bar:Article (context)|Article]]
7191 [[Article]]
7192 [[Article (context)]]
7193 [[Bar:X (Y) Z|X (Y) Z]]
7194 [[:Bar:X (Y) Z|X (Y) Z]]
7195 !! end
7196
7197 !! test
7198 pre-save transform: context links ("pipe trick") with interwiki prefix
7199 !! options
7200 pst
7201 !! input
7202 [[interwiki:Article|]]
7203 [[:interwiki:Article|]]
7204 [[interwiki:Bar:Article|]]
7205 [[:interwiki:Bar:Article|]]
7206 !! result
7207 [[interwiki:Article|Article]]
7208 [[:interwiki:Article|Article]]
7209 [[interwiki:Bar:Article|Bar:Article]]
7210 [[:interwiki:Bar:Article|Bar:Article]]
7211 !! end
7212
7213 !! test
7214 pre-save transform: context links ("pipe trick") with parens in title
7215 !! options
7216 pst title=[[Somearticle (context)]]
7217 !! input
7218 [[|Article]]
7219 !! result
7220 [[Article (context)|Article]]
7221 !! end
7222
7223 !! test
7224 pre-save transform: context links ("pipe trick") with comma in title
7225 !! options
7226 pst title=[[Someplace, Somewhere]]
7227 !! input
7228 [[|Otherplace]]
7229 [[Otherplace, Elsewhere|]]
7230 [[Otherplace, Elsewhere, Anywhere|]]
7231 !! result
7232 [[Otherplace, Somewhere|Otherplace]]
7233 [[Otherplace, Elsewhere|Otherplace]]
7234 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
7235 !! end
7236
7237 !! test
7238 pre-save transform: context links ("pipe trick") with parens and comma
7239 !! options
7240 pst title=[[Someplace (IGNORED), Somewhere]]
7241 !! input
7242 [[|Otherplace]]
7243 [[Otherplace (place), Elsewhere|]]
7244 !! result
7245 [[Otherplace, Somewhere|Otherplace]]
7246 [[Otherplace (place), Elsewhere|Otherplace]]
7247 !! end
7248
7249 !! test
7250 pre-save transform: context links ("pipe trick") with comma and parens
7251 !! options
7252 pst title=[[Who, me? (context)]]
7253 !! input
7254 [[|Yes, you.]]
7255 [[Me, Myself, and I (1937 song)|]]
7256 !! result
7257 [[Yes, you. (context)|Yes, you.]]
7258 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
7259 !! end
7260
7261 !! test
7262 pre-save transform: context links ("pipe trick") with namespace
7263 !! options
7264 pst title=[[Ns:Somearticle]]
7265 !! input
7266 [[|Article]]
7267 !! result
7268 [[Ns:Article|Article]]
7269 !! end
7270
7271 !! test
7272 pre-save transform: context links ("pipe trick") with namespace and parens
7273 !! options
7274 pst title=[[Ns:Somearticle (context)]]
7275 !! input
7276 [[|Article]]
7277 !! result
7278 [[Ns:Article (context)|Article]]
7279 !! end
7280
7281 !! test
7282 pre-save transform: context links ("pipe trick") with namespace and comma
7283 !! options
7284 pst title=[[Ns:Somearticle, Context, Whatever]]
7285 !! input
7286 [[|Article]]
7287 !! result
7288 [[Ns:Article, Context, Whatever|Article]]
7289 !! end
7290
7291 !! test
7292 pre-save transform: context links ("pipe trick") with namespace, comma and parens
7293 !! options
7294 pst title=[[Ns:Somearticle, Context (context)]]
7295 !! input
7296 [[|Article]]
7297 !! result
7298 [[Ns:Article (context)|Article]]
7299 !! end
7300
7301 !! test
7302 pre-save transform: context links ("pipe trick") with namespace, parens and comma
7303 !! options
7304 pst title=[[Ns:Somearticle (IGNORED), Context]]
7305 !! input
7306 [[|Article]]
7307 !! result
7308 [[Ns:Article, Context|Article]]
7309 !! end
7310
7311 !! test
7312 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
7313 !! options
7314 pst
7315 !! input
7316 [[Article(context)|]]
7317 [[Bar:Article(context)|]]
7318 [[:Bar:Article(context)|]]
7319 [[|Article(context)]]
7320 [[Bar:X(Y)Z|]]
7321 [[:Bar:X(Y)Z|]]
7322 !! result
7323 [[Article(context)|Article]]
7324 [[Bar:Article(context)|Article]]
7325 [[:Bar:Article(context)|Article]]
7326 [[Article(context)]]
7327 [[Bar:X(Y)Z|X(Y)Z]]
7328 [[:Bar:X(Y)Z|X(Y)Z]]
7329 !! end
7330
7331 !! test
7332 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
7333 !! options
7334 pst
7335 !! input
7336 [[Article (context)|]]
7337 [[Bar:Article (context)|]]
7338 [[:Bar:Article (context)|]]
7339 [[|Article (context)]]
7340 [[Bar:X (Y) Z|]]
7341 [[:Bar:X (Y) Z|]]
7342 !! result
7343 [[Article (context)|Article]]
7344 [[Bar:Article (context)|Article]]
7345 [[:Bar:Article (context)|Article]]
7346 [[Article (context)]]
7347 [[Bar:X (Y) Z|X (Y) Z]]
7348 [[:Bar:X (Y) Z|X (Y) Z]]
7349 !! end
7350
7351 !! test
7352 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
7353 !! options
7354 pst
7355 !! input
7356 [[Article(context)|]]
7357 [[Bar:Article(context)|]]
7358 [[:Bar:Article(context)|]]
7359 [[|Article(context)]]
7360 [[Bar:X(Y)Z|]]
7361 [[:Bar:X(Y)Z|]]
7362 !! result
7363 [[Article(context)|Article]]
7364 [[Bar:Article(context)|Article]]
7365 [[:Bar:Article(context)|Article]]
7366 [[Article(context)]]
7367 [[Bar:X(Y)Z|X(Y)Z]]
7368 [[:Bar:X(Y)Z|X(Y)Z]]
7369 !! end
7370
7371 !! test
7372 pre-save transform: context links ("pipe trick") with commas (bug 21660)
7373 !! options
7374 pst
7375 !! input
7376 [[Article (context), context|]]
7377 [[Article (context),context|]]
7378 [[Bar:Article (context), context|]]
7379 [[Bar:Article (context),context|]]
7380 [[:Bar:Article (context), context|]]
7381 [[:Bar:Article (context),context|]]
7382 !! result
7383 [[Article (context), context|Article]]
7384 [[Article (context),context|Article]]
7385 [[Bar:Article (context), context|Article]]
7386 [[Bar:Article (context),context|Article]]
7387 [[:Bar:Article (context), context|Article]]
7388 [[:Bar:Article (context),context|Article]]
7389 !! end
7390
7391 !! test
7392 pre-save transform: trim trailing empty lines
7393 !! options
7394 pst
7395 !! input
7396 Empty lines are trimmed
7397
7398
7399
7400
7401 !! result
7402 Empty lines are trimmed
7403 !! end
7404
7405 !! test
7406 pre-save transform: Signature expansion
7407 !! options
7408 pst
7409 !! input
7410 * ~~~
7411 * <noinclude>~~~</noinclude>
7412 * <includeonly>~~~</includeonly>
7413 * <onlyinclude>~~~</onlyinclude>
7414 !! result
7415 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
7416 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
7417 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
7418 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
7419 !! end
7420
7421
7422 !! test
7423 pre-save transform: Signature expansion in nowiki tags (bug 93)
7424 !! options
7425 pst disabled
7426 !! input
7427 Shall not expand:
7428
7429 <nowiki>~~~~</nowiki>
7430
7431 <includeonly><nowiki>~~~~</nowiki></includeonly>
7432
7433 <noinclude><nowiki>~~~~</nowiki></noinclude>
7434
7435 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7436
7437 {{subst:Foo}} shall be converted to FOO
7438
7439 As well as inside noinclude/onlyinclude
7440 <noinclude>{{subst:Foo}}</noinclude>
7441 <onlyinclude>{{subst:Foo}}</onlyinclude>
7442
7443 But not inside includeonly
7444 <includeonly>{{subst:Foo}}</includeonly>
7445 !! result
7446 Shall not expand:
7447
7448 <nowiki>~~~~</nowiki>
7449
7450 <includeonly><nowiki>~~~~</nowiki></includeonly>
7451
7452 <noinclude><nowiki>~~~~</nowiki></noinclude>
7453
7454 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7455
7456 FOO shall be converted to FOO
7457
7458 As well as inside noinclude/onlyinclude
7459 <noinclude>FOO</noinclude>
7460 <onlyinclude>FOO</onlyinclude>
7461
7462 But not inside includeonly
7463 <includeonly>{{subst:Foo}}</includeonly>
7464 !! end
7465
7466 ###
7467 ### Message transform tests
7468 ###
7469 !! test
7470 message transform: magic variables
7471 !! options
7472 msg
7473 !! input
7474 {{SITENAME}}
7475 !! result
7476 MediaWiki
7477 !! end
7478
7479 !! test
7480 message transform: should not transform wiki markup
7481 !! options
7482 msg
7483 !! input
7484 ''test''
7485 !! result
7486 ''test''
7487 !! end
7488
7489 !! test
7490 message transform: <noinclude> in transcluded template (bug 4926)
7491 !! options
7492 msg
7493 !! input
7494 {{Includes}}
7495 !! result
7496 Foobar
7497 !! end
7498
7499 !! test
7500 message transform: <onlyinclude> in transcluded template (bug 4926)
7501 !! options
7502 msg
7503 !! input
7504 {{Includes2}}
7505 !! result
7506 Foo
7507 !! end
7508
7509 !! test
7510 {{#special:}} page name, known
7511 !! options
7512 msg
7513 !! input
7514 {{#special:Recentchanges}}
7515 !! result
7516 Special:RecentChanges
7517 !! end
7518
7519 !! test
7520 {{#special:}} page name with subpage, known
7521 !! options
7522 msg
7523 !! input
7524 {{#special:Recentchanges/param}}
7525 !! result
7526 Special:RecentChanges/param
7527 !! end
7528
7529 !! test
7530 {{#special:}} page name, unknown
7531 !! options
7532 msg
7533 !! input
7534 {{#special:foobar nonexistent}}
7535 !! result
7536 Special:Foobar nonexistent
7537 !! end
7538
7539 !! test
7540 {{#speciale:}} page name, known
7541 !! options
7542 msg
7543 !! input
7544 {{#speciale:Recentchanges}}
7545 !! result
7546 Special:RecentChanges
7547 !! end
7548
7549 !! test
7550 {{#speciale:}} page name with subpage, known
7551 !! options
7552 msg
7553 !! input
7554 {{#speciale:Recentchanges/param}}
7555 !! result
7556 Special:RecentChanges/param
7557 !! end
7558
7559 !! test
7560 {{#speciale:}} page name, unknown
7561 !! options
7562 msg
7563 !! input
7564 {{#speciale:foobar nonexistent}}
7565 !! result
7566 Special:Foobar_nonexistent
7567 !! end
7568
7569 ###
7570 ### Images
7571 ###
7572 !! test
7573 Simple image
7574 !! input
7575 [[Image:foobar.jpg]]
7576 !! result
7577 <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>
7578 </p>
7579 !! end
7580
7581 !! test
7582 Right-aligned image
7583 !! input
7584 [[Image:foobar.jpg|right]]
7585 !! result
7586 <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>
7587
7588 !! end
7589
7590 !! test
7591 Simple image (using File: namespace, now canonical)
7592 !! input
7593 [[File:foobar.jpg]]
7594 !! result
7595 <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>
7596 </p>
7597 !! end
7598
7599 !! test
7600 Image with caption
7601 !! input
7602 [[Image:foobar.jpg|right|Caption text]]
7603 !! result
7604 <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>
7605
7606 !! end
7607
7608 !! test
7609 Image with empty attribute
7610 !! input
7611 [[Image:foobar.jpg|right||Caption text]]
7612 !! result
7613 <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>
7614
7615 !! end
7616
7617 !! test
7618 Image with link tails
7619 !! input
7620 123[[Image:foobar.jpg]]456
7621 123[[Image:foobar.jpg|right]]456
7622 123[[Image:foobar.jpg|thumb]]456
7623 !! result
7624 <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
7625 </p>
7626 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
7627 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
7628
7629 !! end
7630
7631 !! test
7632 Image with multiple captions -- only last one is accepted
7633 !! input
7634 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
7635 !! result
7636 <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>
7637
7638 !! end
7639
7640 !! test
7641 Image with width attribute at different positions
7642 !! input
7643 [[Image:foobar.jpg|200px|right|Caption]]
7644 [[Image:foobar.jpg|right|200px|Caption]]
7645 [[Image:foobar.jpg|right|Caption|200px]]
7646 !! result
7647 <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>
7648 <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>
7649 <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>
7650
7651 !! end
7652
7653 !! test
7654 Image with link parameter, wiki target
7655 !! input
7656 [[Image:foobar.jpg|link=Target page]]
7657 !! result
7658 <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>
7659 </p>
7660 !! end
7661
7662 !! test
7663 Image with link parameter, URL target
7664 !! input
7665 [[Image:foobar.jpg|link=http://example.com/]]
7666 !! result
7667 <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>
7668 </p>
7669 !! end
7670
7671 !! test
7672 Image with link parameter, wgExternalLinkTarget
7673 !! input
7674 [[Image:foobar.jpg|link=http://example.com/]]
7675 !! config
7676 wgExternalLinkTarget='foobar'
7677 !! result
7678 <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>
7679 </p>
7680 !! end
7681
7682 !! test
7683 Image with link parameter, wgNoFollowLinks set to false
7684 !! input
7685 [[Image:foobar.jpg|link=http://example.com/]]
7686 !! config
7687 wgNoFollowLinks=false
7688 !! result
7689 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7690 </p>
7691 !! end
7692
7693 !! test
7694 Image with link parameter, wgNoFollowDomainExceptions
7695 !! input
7696 [[Image:foobar.jpg|link=http://example.com/]]
7697 !! config
7698 wgNoFollowDomainExceptions='example.com'
7699 !! result
7700 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7701 </p>
7702 !! end
7703
7704 !! test
7705 Image with link parameter, wgExternalLinkTarget, unnamed parameter
7706 !! input
7707 [[Image:foobar.jpg|link=http://example.com/|Title]]
7708 !! config
7709 wgExternalLinkTarget='foobar'
7710 !! result
7711 <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>
7712 </p>
7713 !! end
7714
7715 !! test
7716 Image with empty link parameter
7717 !! input
7718 [[Image:foobar.jpg|link=]]
7719 !! result
7720 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
7721 </p>
7722 !! end
7723
7724 !! test
7725 Image with link parameter (wiki target) and unnamed parameter
7726 !! input
7727 [[Image:foobar.jpg|link=Target page|Title]]
7728 !! result
7729 <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>
7730 </p>
7731 !! end
7732
7733 !! test
7734 Image with link parameter (URL target) and unnamed parameter
7735 !! input
7736 [[Image:foobar.jpg|link=http://example.com/|Title]]
7737 !! result
7738 <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>
7739 </p>
7740 !! end
7741
7742 !! test
7743 Thumbnail image with link parameter
7744 !! options
7745 php
7746 !! input
7747 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
7748 !! result
7749 <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>
7750
7751 !! end
7752
7753 !! test
7754 Manually-specified thumbnail image
7755 !! options
7756 php
7757 !! input
7758 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
7759 !! result
7760 <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>
7761
7762 !! end
7763
7764 !! test
7765 Manually-specified thumbnail image with explicit link to wiki page
7766 !! options
7767 php
7768 !! input
7769 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
7770 !! result
7771 <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>
7772
7773 !! end
7774
7775 !! test
7776 Manually-specified thumbnail image with explicit link to url
7777 !! options
7778 php
7779 !! input
7780 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
7781 !! result
7782 <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>
7783
7784 !! end
7785
7786 !! test
7787 Manually-specified thumbnail image with explicit no link
7788 !! options
7789 php
7790 !! input
7791 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
7792 !! result
7793 <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>
7794
7795 !! end
7796
7797 !! test
7798 Manually-specified thumbnail image with explicit link and alt text
7799 !! options
7800 php
7801 !! input
7802 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
7803 !! result
7804 <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>
7805
7806 !! end
7807
7808 !! test
7809 Image with frame and link
7810 !! input
7811 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
7812 !! result
7813 <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>
7814
7815 !! end
7816
7817 !! test
7818 Image with frame and link and explicit alt
7819 !! input
7820 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
7821 !! result
7822 <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>
7823
7824 !! end
7825
7826 !! test
7827 Image with wiki markup in implicit alt
7828 !! input
7829 [[Image:Foobar.jpg|testing '''bold''' in alt]]
7830 !! result
7831 <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>
7832 </p>
7833 !! end
7834
7835 !! test
7836 Image with wiki markup in explicit alt
7837 !! input
7838 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
7839 !! result
7840 <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>
7841 </p>
7842 !! end
7843
7844 !! test
7845 Link to image page- image page normally doesn't exists, hence edit link
7846 Add test with existing image page
7847 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
7848 !! input
7849 [[:Image:test]]
7850 !! result
7851 <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>
7852 </p>
7853 !! end
7854
7855 !! test
7856 bug 18784 Link to non-existent image page with caption should use caption as link text
7857 !! input
7858 [[:Image:test|caption]]
7859 !! result
7860 <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>
7861 </p>
7862 !! end
7863
7864 !! test
7865 Frameless image caption with a free URL
7866 !! input
7867 [[Image:foobar.jpg|http://example.com]]
7868 !! result
7869 <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>
7870 </p>
7871 !! end
7872
7873 !! test
7874 Thumbnail image caption with a free URL
7875 !! input
7876 [[Image:foobar.jpg|thumb|http://example.com]]
7877 !! result
7878 <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>
7879
7880 !! end
7881
7882 !! test
7883 Thumbnail image caption with a free URL and explicit alt
7884 !! input
7885 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
7886 !! result
7887 <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>
7888
7889 !! end
7890
7891 !! test
7892 SVG thumbnails with no language set
7893 !! options
7894 !! input
7895 [[File:Foobar.svg|thumb|width=200]]
7896 !! result
7897 <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>
7898
7899 !! end
7900
7901 !! test
7902 SVG thumbnails with language de
7903 !! options
7904 !! input
7905 [[File:Foobar.svg|thumb|width=200|lang=de]]
7906 !! result
7907 <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>
7908
7909 !! end
7910
7911 !! test
7912 SVG thumbnails with invalid language code
7913 !! options
7914 !! input
7915 [[File:Foobar.svg|thumb|width=200|lang=invalid.language.code]]
7916 !! result
7917 <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>
7918
7919 !! end
7920 !! test
7921 BUG 1887: A ISBN with a thumbnail
7922 !! input
7923 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
7924 !! result
7925 <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>
7926
7927 !! end
7928
7929 !! test
7930 BUG 1887: A RFC with a thumbnail
7931 !! input
7932 [[Image:foobar.jpg|thumb|This is RFC 12354]]
7933 !! result
7934 <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>
7935
7936 !! end
7937
7938 !! test
7939 BUG 1887: A mailto link with a thumbnail
7940 !! input
7941 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
7942 !! result
7943 <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>
7944
7945 !! end
7946
7947 # Pending resolution to bug 368
7948 !! test
7949 BUG 648: Frameless image caption with a link
7950 !! input
7951 [[Image:foobar.jpg|text with a [[link]] in it]]
7952 !! result
7953 <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>
7954 </p>
7955 !! end
7956
7957 !! test
7958 BUG 648: Frameless image caption with a link (suffix)
7959 !! input
7960 [[Image:foobar.jpg|text with a [[link]]foo in it]]
7961 !! result
7962 <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>
7963 </p>
7964 !! end
7965
7966 !! test
7967 BUG 648: Frameless image caption with an interwiki link
7968 !! input
7969 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
7970 !! result
7971 <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>
7972 </p>
7973 !! end
7974
7975 !! test
7976 BUG 648: Frameless image caption with a piped interwiki link
7977 !! input
7978 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
7979 !! result
7980 <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>
7981 </p>
7982 !! end
7983
7984 !! test
7985 Escape HTML special chars in image alt text
7986 !! input
7987 [[Image:foobar.jpg|& < > "]]
7988 !! result
7989 <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>
7990 </p>
7991 !! end
7992
7993 !! test
7994 BUG 499: Alt text should have &#1234;, not &amp;1234;
7995 !! input
7996 [[Image:foobar.jpg|&#9792;]]
7997 !! result
7998 <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>
7999 </p>
8000 !! end
8001
8002 !! test
8003 Broken image caption with link
8004 !! input
8005 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
8006 !! result
8007 <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.
8008 </p>
8009 !! end
8010
8011 !! test
8012 Image caption containing another image
8013 !! input
8014 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
8015 !! result
8016 <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>
8017
8018 !! end
8019
8020 !! test
8021 Image caption containing a newline
8022 !! input
8023 [[Image:Foobar.jpg|This
8024 *is some text]]
8025 !! result
8026 <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>
8027 </p>
8028 !!end
8029
8030 !!test
8031 Parsoid: Image caption containing leading space
8032 (The leading space should not trigger nowiki escaping in wt2wt mode)
8033 !! input
8034 [[Image:Foobar.jpg|thumb| bar]]
8035 !! result
8036 <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>
8037
8038 !!end
8039
8040 !! test
8041 Bug 3090: External links other than http: in image captions
8042 !! input
8043 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
8044 !! result
8045 <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>
8046
8047 !! end
8048
8049 !! test
8050 Custom class
8051 !! input
8052 [[Image:foobar.jpg|a|class=b]]
8053 !! result
8054 <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>
8055 </p>
8056 !! end
8057
8058 !! test
8059 Localized image handling (1).
8060 !! options
8061 language=es
8062 !! input
8063 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
8064 !! result
8065 <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>
8066
8067 !! end
8068
8069 !! test
8070 Localized image handling (2).
8071 !! options
8072 language=es
8073 !! input
8074 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
8075 !! result
8076 <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>
8077
8078 !! end
8079
8080 !! test
8081 "border", "frameless" and "class" attributes on an image.
8082 !! input
8083 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
8084 !! result
8085 <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>
8086 </p>
8087 !! end
8088
8089 !! article
8090 File:Barfoo.jpg
8091 !! text
8092 #REDIRECT [[File:Barfoo.jpg]]
8093 !! endarticle
8094
8095 !! test
8096 Redirected image
8097 !! input
8098 [[Image:Barfoo.jpg]]
8099 !! result
8100 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
8101 </p>
8102 !! end
8103
8104 !! test
8105 Missing image with uploads disabled
8106 !! options
8107 wgEnableUploads=0
8108 !! input
8109 [[Image:Foobaz.jpg]]
8110 !! result
8111 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
8112 </p>
8113 !! end
8114
8115 # Parsoid-specific testing for images
8116 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
8117 # Currently imperfect due to a flaw in the Parsoid testrunner
8118 # Work in progress
8119
8120 !! test
8121 Parsoid-specific image handling - simple image
8122 !! options
8123 parsoid
8124 !! input
8125 [[Image:Foobar.jpg]]
8126 !! result
8127 <p>
8128 <span class="mw-default-size" typeof="mw:Image">
8129 <a href="File:Foobar.jpg">
8130 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8131 </a>
8132 </span>
8133 </p>
8134 !! end
8135
8136 !! test
8137 Parsoid-specific image handling - simple image without link
8138 !! options
8139 parsoid
8140 !! input
8141 [[Image:Foobar.jpg|link=]]
8142 !! result
8143 <p>
8144 <span class="mw-default-size" typeof="mw:Image">
8145 <span>
8146 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8147 </span>
8148 </span>
8149 </p>
8150 !! end
8151
8152 !! test
8153 Parsoid-specific image handling - simple image with specific link
8154 !! options
8155 parsoid
8156 !! input
8157 [[Image:Foobar.jpg|link=Main Page]]
8158 !! result
8159 <p>
8160 <span class="mw-default-size" typeof="mw:Image">
8161 <a href="Main_Page">
8162 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8163 </a>
8164 </span>
8165 </p>
8166 !! end
8167
8168 !! test
8169 Parsoid-specific image handling - simple image with size and middle alignment
8170 !! options
8171 parsoid
8172 !! input
8173 [[Image:Foobar.jpg|50px|middle]]
8174 !! result
8175 <p>
8176 <span class="mw-valign-middle" typeof="mw:Image">
8177 <a href="File:Foobar.jpg">
8178 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8179 </a>
8180 </span>
8181 </p>
8182 !! end
8183
8184 !! test
8185 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
8186 !! options
8187 parsoid
8188 !! input
8189 [[Image:Foobar.jpg|500x10px|baseline|caption]]
8190 !! result
8191 <p>
8192 <span class="mw-valign-baseline" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8193 <a href="File:Foobar.jpg">
8194 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89">
8195 </a>
8196 </span>
8197 </p>
8198 !! end
8199
8200 !! test
8201 Parsoid-specific image handling - simple image with border and size spec
8202 !! options
8203 parsoid
8204 !! input
8205 [[Image:Foobar.jpg|50px|border|caption]]
8206 !! result
8207 <p>
8208 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8209 <a href="File:Foobar.jpg">
8210 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8211 </a>
8212 </span>
8213 </p>
8214 !! end
8215
8216 !! test
8217 Parsoid-specific image handling - thumbnail with halign, valign, and caption
8218 !! options
8219 parsoid
8220 !! input
8221 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
8222 !! result
8223 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
8224 <a href="File:Foobar.jpg">
8225 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/180px-Foobar.jpg" height="21" width="180" />
8226 </a>
8227 <figcaption>caption content</figcaption>
8228 </figure>
8229 !! end
8230
8231 !! test
8232 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
8233 !! options
8234 parsoid
8235 !! input
8236 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
8237 !! result
8238 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
8239 <a href="File:Foobar.jpg">
8240 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
8241 </a>
8242 <figcaption>caption</figcaption>
8243 </figure>
8244 !! end
8245
8246 !! test
8247 Parsoid-specific image handling - framed image with specific size and caption
8248 !! options
8249 parsoid
8250 !! input
8251 [[Image:Foobar.jpg|500x50px|frame|caption]]
8252 !! result
8253 <figure typeof="mw:Image/Frame">
8254 <a href="File:Foobar.jpg">
8255 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8256 </a>
8257 <figcaption>caption</figcaption>
8258 </figure>
8259 !! end
8260
8261 !! test
8262 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
8263 !! options
8264 parsoid
8265 !! input
8266 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
8267 !! result
8268 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
8269 <a href="File:Foobar.jpg">
8270 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8271 </a>
8272 <figcaption>caption</figcaption>
8273 </figure>
8274 !! end
8275
8276 !! test
8277 Parsoid-specific image handling - frameless image with specific size, border, and caption
8278 !! options
8279 parsoid
8280 !! input
8281 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
8282 !! result
8283 <p>
8284 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8285 <a href="File:Foobar.jpg">
8286 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8287 </a>
8288 </p>
8289 !! end
8290
8291 #!! test
8292 #Parsoid-specific image handling - simple image with a formatted caption
8293 #!! options
8294 #parsoid
8295 #!! input
8296 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
8297 #!! result
8298 #<p>
8299 #<span typeof="mw:Image">
8300 #<a class="mw-default-size" href="Image:Foobar.jpg">
8301 #<img alt="Foobar.jpg" class="mw-default-size" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8302 #</a>
8303 #<span>abc</span>
8304 #</span>
8305 #</p>
8306
8307 ###
8308 ### Subpages
8309 ###
8310 !! article
8311 Subpage test/subpage
8312 !! text
8313 foo
8314 !! endarticle
8315
8316 !! test
8317 Subpage link
8318 !! options
8319 subpage title=[[Subpage test]]
8320 !! input
8321 [[/subpage]]
8322 !! result
8323 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
8324 </p>
8325 !! end
8326
8327 !! test
8328 Subpage noslash link
8329 !! options
8330 subpage title=[[Subpage test]]
8331 !!input
8332 [[/subpage/]]
8333 !! result
8334 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
8335 </p>
8336 !! end
8337
8338 !! test
8339 Disabled subpages
8340 !! input
8341 [[/subpage]]
8342 !! result
8343 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
8344 </p>
8345 !! end
8346
8347 !! test
8348 BUG 561: {{/Subpage}}
8349 !! options
8350 subpage title=[[Page]]
8351 !! input
8352 {{/Subpage}}
8353 !! result
8354 <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>
8355 </p>
8356 !! end
8357
8358 ###
8359 ### Categories
8360 ###
8361 !! article
8362 Category:MediaWiki User's Guide
8363 !! text
8364 blah
8365 !! endarticle
8366
8367 !! test
8368 Link to category
8369 !! input
8370 [[:Category:MediaWiki User's Guide]]
8371 !! result
8372 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
8373 </p>
8374 !! end
8375
8376 !! test
8377 Simple category
8378 !! options
8379 cat
8380 !! input
8381 [[Category:MediaWiki User's Guide]]
8382 !! result
8383 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8384 !! end
8385
8386 !! test
8387 PAGESINCATEGORY invalid title fatal (r33546 fix)
8388 !! input
8389 {{PAGESINCATEGORY:<bogus>}}
8390 !! result
8391 <p>0
8392 </p>
8393 !! end
8394
8395 !! test
8396 Category with different sort key
8397 !! options
8398 cat
8399 !! input
8400 [[Category:MediaWiki User's Guide|Foo]]
8401 !! result
8402 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8403 !! end
8404
8405 !! test
8406 Category with identical sort key
8407 !! options
8408 cat
8409 !! input
8410 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8411 !! result
8412 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8413 !! end
8414
8415 !! test
8416 Category with empty sort key
8417 !! options
8418 cat
8419 pst
8420 !! input
8421 [[Category:MediaWiki User's Guide|]]
8422 !! result
8423 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8424 !! end
8425
8426 !! test
8427 Category with empty sort key and parentheses
8428 !! options
8429 cat
8430 pst
8431 !! input
8432 [[Category:Foo (bar)|]]
8433 !! result
8434 [[Category:Foo (bar)|Foo]]
8435 !! end
8436
8437 !! test
8438 Category with link tail
8439 !! options
8440 cat
8441 pst
8442 !! input
8443 123[[Category:Foo]]456
8444 !! result
8445 123[[Category:Foo]]456
8446 !! end
8447
8448 !! test
8449 Category with template
8450 !! options
8451 cat
8452 pst
8453 !! input
8454 [[Category:{{echo|Foo}}]]
8455 !! result
8456 [[Category:{{echo|Foo}}]]
8457 !! end
8458
8459 !! test
8460 Category with template in sort key
8461 !! options
8462 cat
8463 pst
8464 !! input
8465 [[Category:Foo|{{echo|Bar}}]]
8466 !! result
8467 [[Category:Foo|{{echo|Bar}}]]
8468 !! end
8469
8470 !! test
8471 Category with template in sort key and title
8472 !! options
8473 cat
8474 pst
8475 !! input
8476 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8477 !! result
8478 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8479 !! end
8480
8481 !! test
8482 Category / paragraph interactions
8483 !! input
8484 Foo [[Category:Baz]] Bar
8485
8486 Foo [[Category:Baz]]
8487 Bar
8488
8489 Foo
8490 [[Category:Baz]]
8491 Bar
8492
8493 Foo
8494 [[Category:Baz]] Bar
8495
8496 Foo
8497 [[Category:Baz]]
8498 [[Category:Baz]]
8499 [[Category:Baz]]
8500 Bar
8501
8502 [[Category:Baz]]
8503 [[Category:Baz]]
8504 [[Category:Baz]]
8505
8506 [[Category:Baz]]
8507 {{echo|[[Category:Baz]]}}
8508 [[Category:Baz]]
8509 !! result
8510 <p>Foo Bar
8511 </p><p>Foo
8512 Bar
8513 </p><p>Foo
8514 Bar
8515 </p><p>Foo Bar
8516 </p><p>Foo
8517 Bar
8518 </p>
8519 !! end
8520
8521 !! test
8522 Parsoid: Serialize link to category page with colon escape
8523 !! options
8524 parsoid
8525 !! input
8526
8527 [[:Category:Foo]]
8528 [[:Category:Foo|Bar]]
8529 !! result
8530 <p>
8531 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
8532 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
8533 </p>
8534 !! end
8535
8536 !! test
8537 Parsoid: Serialize link to file page with colon escape
8538 !! options
8539 parsoid
8540 !! input
8541
8542 [[:File:Foo.png]]
8543 [[:File:Foo.png|Bar]]
8544 !! result
8545 <p>
8546 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
8547 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
8548 </p>
8549 !! end
8550
8551 !! test
8552 Parsoid: Serialize a genuine category link without colon escape
8553 !! options
8554 parsoid
8555 !! input
8556 [[Category:Foo]]
8557 [[Category:Foo|Bar]]
8558 !! result
8559 <link rel="mw:WikiLink/Category" href="Category:Foo">
8560 <link rel="mw:WikiLink/Category" href="Category:Foo#Bar">
8561 !! end
8562 ###
8563 ### Inter-language links
8564 ###
8565 !! test
8566 Inter-language links
8567 !! options
8568 ill
8569 !! input
8570 [[es:Alimento]]
8571 [[fr:Nourriture]]
8572 [[zh:&#39135;&#21697;]]
8573 !! result
8574 es:Alimento fr:Nourriture zh:食品
8575 !! end
8576
8577 !! test
8578 Duplicate interlanguage links (bug 24502)
8579 !! options
8580 ill
8581 !! input
8582 [[es:1]]
8583 [[es:2]]
8584 [[fr:1]]
8585 [[fr:2]]
8586 !! result
8587 es:1 fr:1
8588 !! end
8589
8590 ###
8591 ### Sections
8592 ###
8593 !! test
8594 Basic section headings
8595 !! input
8596 == Headline 1 ==
8597 Some text
8598
8599 ==Headline 2==
8600 More
8601 ===Smaller headline===
8602 Blah blah
8603 !! result
8604 <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8605 <p>Some text
8606 </p>
8607 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8608 <p>More
8609 </p>
8610 <h3><span class="mw-headline" id="Smaller_headline">Smaller headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Smaller headline">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
8611 <p>Blah blah
8612 </p>
8613 !! end
8614
8615 !! test
8616 Section headings with TOC
8617 !! input
8618 == Headline 1 ==
8619 === Subheadline 1 ===
8620 ===== Skipping a level =====
8621 ====== Skipping a level ======
8622
8623 == Headline 2 ==
8624 Some text
8625 ===Another headline===
8626 !! result
8627 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8628 <ul>
8629 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
8630 <ul>
8631 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
8632 <ul>
8633 <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>
8634 <ul>
8635 <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>
8636 </ul>
8637 </li>
8638 </ul>
8639 </li>
8640 </ul>
8641 </li>
8642 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
8643 <ul>
8644 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
8645 </ul>
8646 </li>
8647 </ul>
8648 </div>
8649 <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8650 <h3><span class="mw-headline" id="Subheadline_1">Subheadline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
8651 <h5><span class="mw-headline" id="Skipping_a_level">Skipping a level</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
8652 <h6><span class="mw-headline" id="Skipping_a_level_2">Skipping a level</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Skipping a level">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
8653 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8654 <p>Some text
8655 </p>
8656 <h3><span class="mw-headline" id="Another_headline">Another headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Another headline">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
8657
8658 !! end
8659
8660 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
8661 !! test
8662 Handling of sections up to level 6 and beyond
8663 !! input
8664 = Level 1 Heading=
8665 == Level 2 Heading==
8666 === Level 3 Heading===
8667 ==== Level 4 Heading====
8668 ===== Level 5 Heading=====
8669 ====== Level 6 Heading======
8670 ======= Level 7 Heading=======
8671 ======== Level 8 Heading========
8672 ========= Level 9 Heading=========
8673 ========== Level 10 Heading==========
8674 !! result
8675 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8676 <ul>
8677 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
8678 <ul>
8679 <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>
8680 <ul>
8681 <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>
8682 <ul>
8683 <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>
8684 <ul>
8685 <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>
8686 <ul>
8687 <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>
8688 <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>
8689 <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>
8690 <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>
8691 <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>
8692 </ul>
8693 </li>
8694 </ul>
8695 </li>
8696 </ul>
8697 </li>
8698 </ul>
8699 </li>
8700 </ul>
8701 </li>
8702 </ul>
8703 </div>
8704 <h1><span class="mw-headline" id="Level_1_Heading">Level 1 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
8705 <h2><span class="mw-headline" id="Level_2_Heading">Level 2 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8706 <h3><span class="mw-headline" id="Level_3_Heading">Level 3 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
8707 <h4><span class="mw-headline" id="Level_4_Heading">Level 4 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
8708 <h5><span class="mw-headline" id="Level_5_Heading">Level 5 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
8709 <h6><span class="mw-headline" id="Level_6_Heading">Level 6 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
8710 <h6><span class="mw-headline" id=".3D_Level_7_Heading.3D">= Level 7 Heading=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: = Level 7 Heading=">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
8711 <h6><span class="mw-headline" id=".3D.3D_Level_8_Heading.3D.3D">== Level 8 Heading==</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: == Level 8 Heading==">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
8712 <h6><span class="mw-headline" id=".3D.3D.3D_Level_9_Heading.3D.3D.3D">=== Level 9 Heading===</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: === Level 9 Heading===">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
8713 <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"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ==== Level 10 Heading====">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
8714
8715 !! end
8716
8717 !! test
8718 TOC regression (bug 9764)
8719 !! input
8720 == title 1 ==
8721 === title 1.1 ===
8722 ==== title 1.1.1 ====
8723 === title 1.2 ===
8724 == title 2 ==
8725 === title 2.1 ===
8726 !! result
8727 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8728 <ul>
8729 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8730 <ul>
8731 <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>
8732 <ul>
8733 <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>
8734 </ul>
8735 </li>
8736 <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>
8737 </ul>
8738 </li>
8739 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8740 <ul>
8741 <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>
8742 </ul>
8743 </li>
8744 </ul>
8745 </div>
8746 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8747 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
8748 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
8749 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
8750 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8751 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
8752
8753 !! end
8754
8755 !! test
8756 TOC with wgMaxTocLevel=3 (bug 6204)
8757 !! options
8758 wgMaxTocLevel=3
8759 !! input
8760 == title 1 ==
8761 === title 1.1 ===
8762 ==== title 1.1.1 ====
8763 === title 1.2 ===
8764 == title 2 ==
8765 === title 2.1 ===
8766 !! result
8767 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8768 <ul>
8769 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8770 <ul>
8771 <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>
8772 <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>
8773 </ul>
8774 </li>
8775 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8776 <ul>
8777 <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>
8778 </ul>
8779 </li>
8780 </ul>
8781 </div>
8782 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8783 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
8784 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
8785 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
8786 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8787 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
8788
8789 !! end
8790
8791 !! test
8792 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
8793 !! options
8794 wgMaxTocLevel=3
8795 !! input
8796 ==Section 1==
8797 ===Section 1.1===
8798 ====Section 1.1.1====
8799 ====Section 1.1.1.1====
8800 ==Section 2==
8801 !! result
8802 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8803 <ul>
8804 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
8805 <ul>
8806 <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>
8807 </ul>
8808 </li>
8809 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
8810 </ul>
8811 </div>
8812 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8813 <h3><span class="mw-headline" id="Section_1.1">Section 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
8814 <h4><span class="mw-headline" id="Section_1.1.1">Section 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Section 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
8815 <h4><span class="mw-headline" id="Section_1.1.1.1">Section 1.1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Section 1.1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
8816 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Section 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8817
8818 !! end
8819
8820
8821 !! test
8822 Resolving duplicate section names
8823 !! input
8824 == Foo bar ==
8825 == Foo bar ==
8826 !! result
8827 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8828 <h2><span class="mw-headline" id="Foo_bar_2">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8829
8830 !! end
8831
8832 !! test
8833 Resolving duplicate section names with differing case (bug 10721)
8834 !! input
8835 == Foo bar ==
8836 == Foo Bar ==
8837 !! result
8838 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8839 <h2><span class="mw-headline" id="Foo_Bar_2">Foo Bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8840
8841 !! end
8842
8843 !! article
8844 Template:sections
8845 !! text
8846 ===Section 1===
8847 ==Section 2==
8848 !! endarticle
8849
8850 !! test
8851 Template with sections, __NOTOC__
8852 !! input
8853 __NOTOC__
8854 ==Section 0==
8855 {{sections}}
8856 ==Section 4==
8857 !! result
8858 <h2><span class="mw-headline" id="Section_0">Section 0</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 0">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8859 <h3><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-1" title="Template:Sections">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
8860 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-2" title="Template:Sections">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8861 <h2><span class="mw-headline" id="Section_4">Section 4</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 4">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8862
8863 !! end
8864
8865 !! test
8866 __NOEDITSECTION__ keyword
8867 !! input
8868 __NOEDITSECTION__
8869 ==Section 1==
8870 ==Section 2==
8871 !! result
8872 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
8873 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
8874
8875 !! end
8876
8877 !! test
8878 Link inside a section heading
8879 !! input
8880 ==Section with a [[Main Page|link]] in it==
8881 !! result
8882 <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"><span class="mw-editsection-bracket">[</span><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 class="mw-editsection-bracket">]</span></span></h2>
8883
8884 !! end
8885
8886 !! test
8887 TOC regression (bug 12077)
8888 !! input
8889 __TOC__
8890 == title 1 ==
8891 === title 1.1 ===
8892 == title 2 ==
8893 !! result
8894 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8895 <ul>
8896 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8897 <ul>
8898 <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>
8899 </ul>
8900 </li>
8901 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
8902 </ul>
8903 </div>
8904 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8905 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
8906 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8907
8908 !! end
8909
8910 !! test
8911 BUG 1219 URL next to image (good)
8912 !! input
8913 http://example.com [[Image:foobar.jpg]]
8914 !! result
8915 <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>
8916 </p>
8917 !!end
8918
8919 !! test
8920 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
8921 !! input
8922 ===
8923 The line above must have a trailing space!
8924 === <!--
8925 --> <!-- -->
8926 But just in case it doesn't...
8927 !! result
8928 <h1><span class="mw-headline" id=".3D">=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
8929 <p>The line above must have a trailing space!
8930 </p>
8931 <h1><span class="mw-headline" id=".3D_2">=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
8932 <p>But just in case it doesn't...
8933 </p>
8934 !! end
8935
8936 !! test
8937 Header with special characters (bug 25462)
8938 !! input
8939 The tooltips shall not show entities to the user (ie. be double escaped)
8940
8941 == text > text ==
8942 section 1
8943
8944 == text < text ==
8945 section 2
8946
8947 == text & text ==
8948 section 3
8949
8950 == text ' text ==
8951 section 4
8952
8953 == text " text ==
8954 section 5
8955 !! result
8956 <p>The tooltips shall not show entities to the user (ie. be double escaped)
8957 </p>
8958 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8959 <ul>
8960 <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>
8961 <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>
8962 <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>
8963 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
8964 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
8965 </ul>
8966 </div>
8967 <h2><span class="mw-headline" id="text_.3E_text">text &gt; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: text > text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8968 <p>section 1
8969 </p>
8970 <h2><span class="mw-headline" id="text_.3C_text">text &lt; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: text &lt; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8971 <p>section 2
8972 </p>
8973 <h2><span class="mw-headline" id="text_.26_text">text &amp; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: text &amp; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8974 <p>section 3
8975 </p>
8976 <h2><span class="mw-headline" id="text_.27_text">text ' text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: text ' text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8977 <p>section 4
8978 </p>
8979 <h2><span class="mw-headline" id="text_.22_text">text " text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: text &quot; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8980 <p>section 5
8981 </p>
8982 !! end
8983
8984 !! test
8985 Headers with excess '=' characters
8986 (Are similar tests necessary beyond the 1st level?)
8987 !! input
8988 =foo==
8989 ==foo=
8990 =''italic'' heading==
8991 ==''italic'' heading=
8992 !! result
8993 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8994 <ul>
8995 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
8996 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
8997 <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>
8998 <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>
8999 </ul>
9000 </div>
9001 <h1><span class="mw-headline" id="foo.3D">foo=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: foo=">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
9002 <h1><span class="mw-headline" id=".3Dfoo">=foo</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =foo">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
9003 <h1><span class="mw-headline" id="italic_heading.3D"><i>italic</i> heading=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: italic heading=">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
9004 <h1><span class="mw-headline" id=".3Ditalic_heading">=<i>italic</i> heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: =italic heading">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
9005
9006 !! end
9007
9008 !! test
9009 HTML headers vs TOC (bug 23393)
9010 (__NOEDITSECTION__ for clearer output, doesn't matter here)
9011 !! input
9012 <h1>Header 1</h1>
9013 == Header 1.1 ==
9014 == Header 1.2 ==
9015
9016 <h1>Header 2
9017 </h1>
9018 == Header 2.1 ==
9019 == Header 2.2 ==
9020 __NOEDITSECTION__
9021 !! result
9022 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9023 <ul>
9024 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
9025 <ul>
9026 <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>
9027 <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>
9028 </ul>
9029 </li>
9030 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
9031 <ul>
9032 <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>
9033 <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>
9034 </ul>
9035 </li>
9036 </ul>
9037 </div>
9038 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
9039 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
9040 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
9041 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
9042 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
9043 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
9044
9045 !! end
9046
9047 !! test
9048 BUG 1219 URL next to image (broken)
9049 !! input
9050 http://example.com[[Image:foobar.jpg]]
9051 !! result
9052 <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>
9053 </p>
9054 !!end
9055
9056 !! test
9057 Bug 1186 news: in the middle of text
9058 !! input
9059 http://en.wikinews.org/wiki/Wikinews:Workplace
9060 !! result
9061 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
9062 </p>
9063 !!end
9064
9065
9066 !! test
9067 Namespaced link must have a title
9068 !! input
9069 [[Project:]]
9070 !! result
9071 <p>[[Project:]]
9072 </p>
9073 !!end
9074
9075 !! test
9076 Namespaced link must have a title (bad fragment version)
9077 !! input
9078 [[Project:#fragment]]
9079 !! result
9080 <p>[[Project:#fragment]]
9081 </p>
9082 !!end
9083
9084
9085 ###
9086 ### HTML tags and HTML attributes
9087 ###
9088
9089 !! test
9090 div with no attributes
9091 !! input
9092 <div>HTML rocks</div>
9093 !! result
9094 <div>HTML rocks</div>
9095
9096 !! end
9097
9098 !! test
9099 div with double-quoted attribute
9100 !! input
9101 <div id="rock">HTML rocks</div>
9102 !! result
9103 <div id="rock">HTML rocks</div>
9104
9105 !! end
9106
9107 !! test
9108 div with single-quoted attribute
9109 !! input
9110 <div id='rock'>HTML rocks</div>
9111 !! result
9112 <div id="rock">HTML rocks</div>
9113
9114 !! end
9115
9116 !! test
9117 div with unquoted attribute
9118 !! input
9119 <div id=rock>HTML rocks</div>
9120 !! result
9121 <div id="rock">HTML rocks</div>
9122
9123 !! end
9124
9125 !! test
9126 div with illegal double attributes
9127 !! input
9128 <div id="a" id="b">HTML rocks</div>
9129 !! result
9130 <div id="b">HTML rocks</div>
9131
9132 !!end
9133
9134 # FIXME: produce empty string instead of "class" in the PHP parser, following
9135 # the HTML5 spec.
9136 !! test
9137 div with empty attribute value, space before equals
9138 !! options
9139 parsoid
9140 !! input
9141 <div class =>HTML rocks</div>
9142 !! result
9143 <div class="">HTML rocks</div>
9144
9145 !! end
9146
9147 # The PHP parser escapes the opening brace to &#123; for some reason, so
9148 # disabled this test for it.
9149 !! test
9150 div with braces in attribute value
9151 !! options
9152 parsoid
9153 !! input
9154 <div title="{}">Foo</div>
9155 !! result
9156 <div title="{}">Foo</div>
9157 !! end
9158
9159 # This it very inconsistent in the PHP parser: it returns
9160 # class="class" if there is a space between the name and the equal sign (see
9161 # 'div with empty attribute value, space before equals'), but strips the
9162 # attribute completely if the space is missing. We hope that not much content
9163 # depends on this, so are implementing the behavior below in Parsoid for
9164 # consistencies' sake. Disabled for the PHP parser.
9165 # FIXME: fix this behavior in the PHP parser?
9166 !! test
9167 div with empty attribute value, no space before equals
9168 !! options
9169 parsoid
9170 !! input
9171 <div class=>HTML rocks</div>
9172 !! result
9173 <div class="">HTML rocks</div>
9174
9175 !! end
9176
9177 !! test
9178 HTML multiple attributes correction
9179 !! input
9180 <p class="error" class="awesome">Awesome!</p>
9181 !! result
9182 <p class="awesome">Awesome!</p>
9183
9184 !!end
9185
9186 !! test
9187 Table multiple attributes correction
9188 !! input
9189 {|
9190 !+ class="error" class="awesome"| status
9191 |}
9192 !! result
9193 <table>
9194 <tr>
9195 <th class="awesome"> status
9196 </th></tr></table>
9197
9198 !!end
9199
9200 !! test
9201 DIV IN UPPERCASE
9202 !! input
9203 <DIV ID="x">HTML ROCKS</DIV>
9204 !! result
9205 <div id="x">HTML ROCKS</div>
9206
9207 !!end
9208
9209 !! test
9210 Non-ASCII pseudo-tags are rendered as text
9211 !! input
9212 <khyô>
9213 !! result
9214 <p>&lt;khyô&gt;
9215 </p>
9216 !! end
9217
9218 !! test
9219 Pseudo-tag with URL 'name' renders as url link
9220 !! input
9221 <http://example.com/>
9222 !! result
9223 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
9224 </p>
9225 !! end
9226
9227 !! test
9228 text with amp in the middle of nowhere
9229 !! input
9230 Remember AT&T?
9231 !!result
9232 <p>Remember AT&amp;T?
9233 </p>
9234 !! end
9235
9236 !! test
9237 text with character entity: eacute
9238 !! input
9239 I always thought &eacute; was a cute letter.
9240 !! result
9241 <p>I always thought &#233; was a cute letter.
9242 </p>
9243 !! end
9244
9245 !! test
9246 text with entity-escaped character entity-like string: eacute
9247 !! input
9248 I always thought &amp;eacute; was a cute letter.
9249 !! result
9250 <p>I always thought &amp;eacute; was a cute letter.
9251 </p>
9252 !! end
9253
9254 !! test
9255 text with undefined character entity: xacute
9256 !! input
9257 I always thought &xacute; was a cute letter.
9258 !! result
9259 <p>I always thought &amp;xacute; was a cute letter.
9260 </p>
9261 !! end
9262
9263
9264 ###
9265 ### Media links
9266 ###
9267
9268 !! test
9269 Media link
9270 !! input
9271 [[Media:Foobar.jpg]]
9272 !! result
9273 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
9274 </p>
9275 !! end
9276
9277 !! test
9278 Media link with text
9279 !! input
9280 [[Media:Foobar.jpg|A neat file to look at]]
9281 !! result
9282 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
9283 </p>
9284 !! end
9285
9286 # FIXME: this is still bad HTML tag nesting
9287 !! test
9288 Media link with nasty text
9289 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
9290 !! input
9291 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
9292 !! result
9293 <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>
9294
9295 !! end
9296
9297 !! test
9298 Media link to nonexistent file (bug 1702)
9299 !! input
9300 [[Media:No such.jpg]]
9301 !! result
9302 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
9303 </p>
9304 !! end
9305
9306 !! test
9307 Image link to nonexistent file (bug 1850 - good)
9308 !! input
9309 [[Image:No such.jpg]]
9310 !! result
9311 <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>
9312 </p>
9313 !! end
9314
9315 !! test
9316 :Image link to nonexistent file (bug 1850 - bad)
9317 !! input
9318 [[:Image:No such.jpg]]
9319 !! result
9320 <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>
9321 </p>
9322 !! end
9323
9324
9325
9326 !! test
9327 Character reference normalization in link text (bug 1938)
9328 !! input
9329 [[Main Page|this&that]]
9330 !! result
9331 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
9332 </p>
9333 !!end
9334
9335 !! article
9336 אַ
9337 !! text
9338 Test for unicode normalization
9339
9340 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
9341 !! endarticle
9342
9343 !! test
9344 (bug 19451) Links should refer to the normalized form.
9345 !! input
9346 [[&#xFB2E;]]
9347 [[&#x5d0;&#x5b7;]]
9348 [[&#x5d0;ַ]]
9349 [[א&#x5b7;]]
9350 [[אַ]]
9351 !! result
9352 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
9353 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
9354 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
9355 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
9356 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
9357 </p>
9358 !! end
9359
9360 !! test
9361 Empty attribute crash test (bug 2067)
9362 !! input
9363 <font color="">foo</font>
9364 !! result
9365 <p><font color="">foo</font>
9366 </p>
9367 !! end
9368
9369 !! test
9370 Empty attribute crash test single-quotes (bug 2067)
9371 !! input
9372 <font color=''>foo</font>
9373 !! result
9374 <p><font color="">foo</font>
9375 </p>
9376 !! end
9377
9378 !! test
9379 Attribute test: equals, then nothing
9380 !! input
9381 <font color=>foo</font>
9382 !! result
9383 <p><font>foo</font>
9384 </p>
9385 !! end
9386
9387 !! test
9388 Attribute test: unquoted value
9389 !! input
9390 <font color=x>foo</font>
9391 !! result
9392 <p><font color="x">foo</font>
9393 </p>
9394 !! end
9395
9396 !! test
9397 Attribute test: unquoted but illegal value (hash)
9398 !! input
9399 <font color=#x>foo</font>
9400 !! result
9401 <p><font color="#x">foo</font>
9402 </p>
9403 !! end
9404
9405 !! test
9406 Attribute test: no value
9407 !! input
9408 <font color>foo</font>
9409 !! result
9410 <p><font color="color">foo</font>
9411 </p>
9412 !! end
9413
9414 !! test
9415 Bug 2095: link with three closing brackets
9416 !! input
9417 [[Main Page]]]
9418 !! result
9419 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
9420 </p>
9421 !! end
9422
9423 !! test
9424 Bug 2095: link with pipe and three closing brackets
9425 !! input
9426 [[Main Page|link]]]
9427 !! result
9428 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
9429 </p>
9430 !! end
9431
9432 !! test
9433 Bug 2095: link with pipe and three closing brackets, version 2
9434 !! input
9435 [[Main Page|[http://example.com/]]]
9436 !! result
9437 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
9438 </p>
9439 !! end
9440
9441
9442 ###
9443 ### Safety
9444 ###
9445
9446 !! article
9447 Template:Dangerous attribute
9448 !! text
9449 " onmouseover="alert(document.cookie)
9450 !! endarticle
9451
9452 !! article
9453 Template:Dangerous style attribute
9454 !! text
9455 border-size: expression(alert(document.cookie))
9456 !! endarticle
9457
9458 !! article
9459 Template:Div style
9460 !! text
9461 <div style="float: right; {{{1}}}">Magic div</div>
9462 !! endarticle
9463
9464 !! test
9465 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
9466 !! input
9467 <div title="{{test}}"></div>
9468 !! result
9469 <div title="This is a test template"></div>
9470
9471 !! end
9472
9473 !! test
9474 Bug 2304: HTML attribute safety (dangerous template; 2309)
9475 !! input
9476 <div title="{{dangerous attribute}}"></div>
9477 !! result
9478 <div title=""></div>
9479
9480 !! end
9481
9482 !! test
9483 Bug 2304: HTML attribute safety (dangerous style template; 2309)
9484 !! input
9485 <div style="{{dangerous style attribute}}"></div>
9486 !! result
9487 <div style="/* insecure input */"></div>
9488
9489 !! end
9490
9491 !! test
9492 Bug 2304: HTML attribute safety (safe parameter; 2309)
9493 !! input
9494 {{div style|width: 200px}}
9495 !! result
9496 <div style="float: right; width: 200px">Magic div</div>
9497
9498 !! end
9499
9500 !! test
9501 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
9502 !! input
9503 {{div style|width: expression(alert(document.cookie))}}
9504 !! result
9505 <div style="/* insecure input */">Magic div</div>
9506
9507 !! end
9508
9509 !! test
9510 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
9511 !! input
9512 {{div style|"><script>alert(document.cookie)</script>}}
9513 !! result
9514 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9515
9516 !! end
9517
9518 !! test
9519 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
9520 !! input
9521 {{div style|" ><script>alert(document.cookie)</script>}}
9522 !! result
9523 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9524
9525 !! end
9526
9527 !! test
9528 Bug 2304: HTML attribute safety (link)
9529 !! input
9530 <div title="[[Main Page]]"></div>
9531 !! result
9532 <div title="&#91;&#91;Main Page]]"></div>
9533
9534 !! end
9535
9536 !! test
9537 Bug 2304: HTML attribute safety (italics)
9538 !! input
9539 <div title="''foobar''"></div>
9540 !! result
9541 <div title="&#39;&#39;foobar&#39;&#39;"></div>
9542
9543 !! end
9544
9545 !! test
9546 Bug 2304: HTML attribute safety (bold)
9547 !! input
9548 <div title="'''foobar'''"></div>
9549 !! result
9550 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
9551
9552 !! end
9553
9554
9555 !! test
9556 Bug 2304: HTML attribute safety (ISBN)
9557 !! input
9558 <div title="ISBN 1234567890"></div>
9559 !! result
9560 <div title="&#73;SBN 1234567890"></div>
9561
9562 !! end
9563
9564 !! test
9565 Bug 2304: HTML attribute safety (RFC)
9566 !! input
9567 <div title="RFC 1234"></div>
9568 !! result
9569 <div title="&#82;FC 1234"></div>
9570
9571 !! end
9572
9573 !! test
9574 Bug 2304: HTML attribute safety (PMID)
9575 !! input
9576 <div title="PMID 1234567890"></div>
9577 !! result
9578 <div title="&#80;MID 1234567890"></div>
9579
9580 !! end
9581
9582 !! test
9583 Bug 2304: HTML attribute safety (web link)
9584 !! input
9585 <div title="http://example.com/"></div>
9586 !! result
9587 <div title="http&#58;//example.com/"></div>
9588
9589 !! end
9590
9591 !! test
9592 Bug 2304: HTML attribute safety (named web link)
9593 !! input
9594 <div title="[http://example.com/ link]"></div>
9595 !! result
9596 <div title="&#91;http&#58;//example.com/ link]"></div>
9597
9598 !! end
9599
9600 !! test
9601 Bug 3244: HTML attribute safety (extension; safe)
9602 !! input
9603 <div style="<nowiki>background:blue</nowiki>"></div>
9604 !! result
9605 <div style="background:blue"></div>
9606
9607 !! end
9608
9609 !! test
9610 Bug 3244: HTML attribute safety (extension; unsafe)
9611 !! input
9612 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
9613 !! result
9614 <div style="/* insecure input */"></div>
9615
9616 !! end
9617
9618 # More MSIE fun discovered by Tom Gilder
9619
9620 !! test
9621 MSIE CSS safety test: spurious slash
9622 !! input
9623 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
9624 !! result
9625 <div style="/* insecure input */">evil</div>
9626
9627 !! end
9628
9629 !! test
9630 MSIE CSS safety test: hex code
9631 !! input
9632 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
9633 !! result
9634 <div style="/* insecure input */">evil</div>
9635
9636 !! end
9637
9638 !! test
9639 MSIE CSS safety test: comment in url
9640 !! input
9641 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
9642 !! result
9643 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
9644
9645 !! end
9646
9647 !! test
9648 MSIE CSS safety test: comment in expression
9649 !! input
9650 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
9651 !! result
9652 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
9653
9654 !! end
9655
9656
9657 !! test
9658 Table attribute legitimate extension
9659 !! input
9660 {|
9661 !+ style="<nowiki>color:blue</nowiki>"| status
9662 |}
9663 !! result
9664 <table>
9665 <tr>
9666 <th style="color:blue"> status
9667 </th></tr></table>
9668
9669 !!end
9670
9671 !! test
9672 Table attribute safety
9673 !! input
9674 {|
9675 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
9676 |}
9677 !! result
9678 <table>
9679 <tr>
9680 <th style="/* insecure input */"> status
9681 </th></tr></table>
9682
9683 !! end
9684
9685 !! test
9686 CSS line continuation 1
9687 !! input
9688 <div style="background-image: u\&#10;rl(test.jpg);"></div>
9689 !! result
9690 <div style="/* insecure input */"></div>
9691
9692 !! end
9693
9694 !! test
9695 CSS line continuation 2
9696 !! input
9697 <div style="background-image: u\&#13;rl(test.jpg); "></div>
9698 !! result
9699 <div style="/* insecure input */"></div>
9700
9701 !! end
9702
9703 !! article
9704 Template:Identity
9705 !! text
9706 {{{1}}}
9707 !! endarticle
9708
9709 !! test
9710 Expansion of multi-line templates in attribute values (bug 6255)
9711 !! input
9712 <div style="background: {{identity|#00FF00}}">-</div>
9713 !! result
9714 <div style="background: #00FF00">-</div>
9715
9716 !! end
9717
9718
9719 !! test
9720 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
9721 !! input
9722 <div style="background:
9723 #00FF00">-</div>
9724 !! result
9725 <div style="background: #00FF00">-</div>
9726
9727 !! end
9728
9729 !! test
9730 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
9731 !! input
9732 <div style="background: &#10;#00FF00">-</div>
9733 !! result
9734 <div style="background: &#10;#00FF00">-</div>
9735
9736 !! end
9737
9738 ###
9739 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
9740 ###
9741 !! test
9742 Parser hook: empty input
9743 !! input
9744 <tag></tag>
9745 !! result
9746 <pre>
9747 ''
9748 array (
9749 )
9750 </pre>
9751
9752 !! end
9753
9754 !! test
9755 Parser hook: empty input using terminated empty elements
9756 !! input
9757 <tag/>
9758 !! result
9759 <pre>
9760 NULL
9761 array (
9762 )
9763 </pre>
9764
9765 !! end
9766
9767 !! test
9768 Parser hook: empty input using terminated empty elements (space before)
9769 !! input
9770 <tag />
9771 !! result
9772 <pre>
9773 NULL
9774 array (
9775 )
9776 </pre>
9777
9778 !! end
9779
9780 !! test
9781 Parser hook: basic input
9782 !! input
9783 <tag>input</tag>
9784 !! result
9785 <pre>
9786 'input'
9787 array (
9788 )
9789 </pre>
9790
9791 !! end
9792
9793
9794 !! test
9795 Parser hook: case insensitive
9796 !! input
9797 <TAG>input</TAG>
9798 !! result
9799 <pre>
9800 'input'
9801 array (
9802 )
9803 </pre>
9804
9805 !! end
9806
9807
9808 !! test
9809 Parser hook: case insensitive, redux
9810 !! input
9811 <TaG>input</TAg>
9812 !! result
9813 <pre>
9814 'input'
9815 array (
9816 )
9817 </pre>
9818
9819 !! end
9820
9821 !! test
9822 Parser hook: nested tags
9823 !! options
9824 noxml
9825 !! input
9826 <tag><tag></tag></tag>
9827 !! result
9828 <pre>
9829 '<tag>'
9830 array (
9831 )
9832 </pre>&lt;/tag&gt;
9833
9834 !! end
9835
9836 !! test
9837 Parser hook: basic arguments
9838 !! input
9839 <tag width=200 height = "100" depth = '50' square></tag>
9840 !! result
9841 <pre>
9842 ''
9843 array (
9844 'width' => '200',
9845 'height' => '100',
9846 'depth' => '50',
9847 'square' => 'square',
9848 )
9849 </pre>
9850
9851 !! end
9852
9853 !! test
9854 Parser hook: argument containing a forward slash (bug 5344)
9855 !! input
9856 <tag filename='/tmp/bla'></tag>
9857 !! result
9858 <pre>
9859 ''
9860 array (
9861 'filename' => '/tmp/bla',
9862 )
9863 </pre>
9864
9865 !! end
9866
9867 !! test
9868 Parser hook: empty input using terminated empty elements (bug 2374)
9869 !! input
9870 <tag foo=bar/>text
9871 !! result
9872 <pre>
9873 NULL
9874 array (
9875 'foo' => 'bar',
9876 )
9877 </pre>text
9878
9879 !! end
9880
9881 # </tag> should be output literally since there is no matching tag that begins it
9882 !! test
9883 Parser hook: basic arguments using terminated empty elements (bug 2374)
9884 !! input
9885 <tag width=200 height = "100" depth = '50' square/>
9886 other stuff
9887 </tag>
9888 !! result
9889 <pre>
9890 NULL
9891 array (
9892 'width' => '200',
9893 'height' => '100',
9894 'depth' => '50',
9895 'square' => 'square',
9896 )
9897 </pre>
9898 <p>other stuff
9899 &lt;/tag&gt;
9900 </p>
9901 !! end
9902
9903 ###
9904 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
9905 ###
9906
9907 !! test
9908 Parser hook: static parser hook not inside a comment
9909 !! input
9910 <statictag>hello, world</statictag>
9911 <statictag action=flush/>
9912 !! result
9913 <p>hello, world
9914 </p>
9915 !! end
9916
9917
9918 !! test
9919 Parser hook: static parser hook inside a comment
9920 !! input
9921 <!-- <statictag>hello, world</statictag> -->
9922 <statictag action=flush/>
9923 !! result
9924 <p><br />
9925 </p>
9926 !! end
9927
9928 # Nested template calls; this case was broken by Parser.php rev 1.506,
9929 # since reverted.
9930
9931 !! article
9932 Template:One-parameter
9933 !! text
9934 (My parameter is: {{{1}}})
9935 !! endarticle
9936
9937 !! article
9938 Template:Map-one-parameter
9939 !! text
9940 {{{{{1}}}|{{{2}}}}}
9941 !! endarticle
9942
9943 !! test
9944 Nested template calls
9945 !! input
9946 {{Map-one-parameter|One-parameter|param}}
9947 !! result
9948 <p>(My parameter is: param)
9949 </p>
9950 !! end
9951
9952
9953 ###
9954 ### Sanitizer
9955 ###
9956 !! test
9957 Sanitizer: Closing of open tags
9958 !! input
9959 <s></s><table></table>
9960 !! result
9961 <s></s><table></table>
9962
9963 !! end
9964
9965 !! test
9966 Sanitizer: Closing of open but not closed tags
9967 !! input
9968 <s>foo
9969 !! result
9970 <p><s>foo</s>
9971 </p>
9972 !! end
9973
9974 !! test
9975 Sanitizer: Closing of closed but not open tags
9976 !! input
9977 </s>
9978 !! result
9979 <p>&lt;/s&gt;
9980 </p>
9981 !! end
9982
9983 !! test
9984 Sanitizer: Closing of closed but not open table tags
9985 !! input
9986 Table not started</td></tr></table>
9987 !! result
9988 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
9989 </p>
9990 !! end
9991
9992 !! test
9993 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
9994 !! input
9995 <span id="æ: v">byte</span>[[#æ: v|backlink]]
9996 !! result
9997 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
9998 </p>
9999 !! end
10000
10001 !! test
10002 Sanitizer: Validating the contents of the id attribute (bug 4515)
10003 !! options
10004 disabled
10005 !! input
10006 <br id=9 />
10007 !! result
10008 Something, but definitely not <br id="9" />...
10009 !! end
10010
10011 !! test
10012 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
10013 !! options
10014 disabled
10015 !! input
10016 <br id="foo" /><br id="foo" />
10017 !! result
10018 Something need to be done. foo-2 ?
10019 !! end
10020
10021 !! test
10022 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
10023 !! input
10024 <div itemscope>
10025 <meta itemprop="hello" content="world">
10026 <meta http-equiv="refresh" content="5">
10027 <meta itemprop="hello" http-equiv="refresh" content="5">
10028 <link itemprop="hello" href="{{SERVER}}">
10029 <link rel="stylesheet" href="{{SERVER}}">
10030 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
10031 </div>
10032 !! result
10033 <div itemscope="itemscope">
10034 <p> <meta itemprop="hello" content="world" />
10035 &lt;meta http-equiv="refresh" content="5"&gt;
10036 <meta itemprop="hello" content="5" />
10037 </p>
10038 <link itemprop="hello" href="http&#58;//example.org" />
10039 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
10040 <link itemprop="hello" href="http&#58;//example.org" />
10041 </div>
10042
10043 !! end
10044
10045 !! test
10046 Language converter: output gets cut off unexpectedly (bug 5757)
10047 !! options
10048 language=zh
10049 !! input
10050 this bit is safe: }-
10051
10052 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
10053
10054 then we get cut off here: }-
10055
10056 all additional text is vanished
10057 !! result
10058 <p>this bit is safe: }-
10059 </p><p>but if we add a conversion instance: xxx
10060 </p><p>then we get cut off here: }-
10061 </p><p>all additional text is vanished
10062 </p>
10063 !! end
10064
10065 !! test
10066 Self closed html pairs (bug 5487)
10067 !! options
10068 !! input
10069 <center><font id="bug" />Centered text</center>
10070 <div><font id="bug2" />In div text</div>
10071 !! result
10072 <center>&lt;font id="bug" /&gt;Centered text</center>
10073 <div>&lt;font id="bug2" /&gt;In div text</div>
10074
10075 !! end
10076
10077 #
10078 #
10079 #
10080
10081 !! test
10082 Punctuation: nbsp before exclamation
10083 !! input
10084 C'est grave !
10085 !! result
10086 <p>C'est grave&#160;!
10087 </p>
10088 !! end
10089
10090 !! test
10091 Punctuation: CSS !important (bug 11874)
10092 !! input
10093 <div style="width:50% !important">important</div>
10094 !! result
10095 <div style="width:50% !important">important</div>
10096
10097 !!end
10098
10099 !! test
10100 Punctuation: CSS ! important (bug 11874; with space after)
10101 !! input
10102 <div style="width:50% ! important">important</div>
10103 !! result
10104 <div style="width:50% ! important">important</div>
10105
10106 !!end
10107
10108
10109 !! test
10110 HTML bullet list, closed tags (bug 5497)
10111 !! input
10112 <ul>
10113 <li>One</li>
10114 <li>Two</li>
10115 </ul>
10116 !! result
10117 <ul>
10118 <li>One</li>
10119 <li>Two</li>
10120 </ul>
10121
10122 !! end
10123
10124 !! test
10125 HTML bullet list, unclosed tags (bug 5497)
10126 !! options
10127 disabled
10128 !! input
10129 <ul>
10130 <li>One
10131 <li>Two
10132 </ul>
10133 !! result
10134 <ul>
10135 <li>One
10136 </li><li>Two
10137 </li></ul>
10138
10139 !! end
10140
10141 !! test
10142 HTML ordered list, closed tags (bug 5497)
10143 !! input
10144 <ol>
10145 <li>One</li>
10146 <li>Two</li>
10147 </ol>
10148 !! result
10149 <ol>
10150 <li>One</li>
10151 <li>Two</li>
10152 </ol>
10153
10154 !! end
10155
10156 !! test
10157 HTML ordered list, unclosed tags (bug 5497)
10158 !! options
10159 disabled
10160 !! input
10161 <ol>
10162 <li>One
10163 <li>Two
10164 </ol>
10165 !! result
10166 <ol>
10167 <li>One
10168 </li><li>Two
10169 </li></ol>
10170
10171 !! end
10172
10173 !! test
10174 HTML nested bullet list, closed tags (bug 5497)
10175 !! input
10176 <ul>
10177 <li>One</li>
10178 <li>Two:
10179 <ul>
10180 <li>Sub-one</li>
10181 <li>Sub-two</li>
10182 </ul>
10183 </li>
10184 </ul>
10185 !! result
10186 <ul>
10187 <li>One</li>
10188 <li>Two:
10189 <ul>
10190 <li>Sub-one</li>
10191 <li>Sub-two</li>
10192 </ul>
10193 </li>
10194 </ul>
10195
10196 !! end
10197
10198 !! test
10199 HTML nested bullet list, open tags (bug 5497)
10200 !! options
10201 disabled
10202 !! input
10203 <ul>
10204 <li>One
10205 <li>Two:
10206 <ul>
10207 <li>Sub-one
10208 <li>Sub-two
10209 </ul>
10210 </ul>
10211 !! result
10212 <ul>
10213 <li>One
10214 </li><li>Two:
10215 <ul>
10216 <li>Sub-one
10217 </li><li>Sub-two
10218 </li></ul>
10219 </li></ul>
10220
10221 !! end
10222
10223 !! test
10224 HTML nested ordered list, closed tags (bug 5497)
10225 !! input
10226 <ol>
10227 <li>One</li>
10228 <li>Two:
10229 <ol>
10230 <li>Sub-one</li>
10231 <li>Sub-two</li>
10232 </ol>
10233 </li>
10234 </ol>
10235 !! result
10236 <ol>
10237 <li>One</li>
10238 <li>Two:
10239 <ol>
10240 <li>Sub-one</li>
10241 <li>Sub-two</li>
10242 </ol>
10243 </li>
10244 </ol>
10245
10246 !! end
10247
10248 !! test
10249 HTML nested ordered list, open tags (bug 5497)
10250 !! options
10251 disabled
10252 !! input
10253 <ol>
10254 <li>One
10255 <li>Two:
10256 <ol>
10257 <li>Sub-one
10258 <li>Sub-two
10259 </ol>
10260 </ol>
10261 !! result
10262 <ol>
10263 <li>One
10264 </li><li>Two:
10265 <ol>
10266 <li>Sub-one
10267 </li><li>Sub-two
10268 </li></ol>
10269 </li></ol>
10270
10271 !! end
10272
10273 !! test
10274 HTML ordered list item with parameters oddity
10275 !! input
10276 <ol><li id="fragment">One</li></ol>
10277 !! result
10278 <ol><li id="fragment">One</li></ol>
10279
10280 !! end
10281
10282 !!test
10283 bug 5918: autonumbering
10284 !! input
10285 [http://first/] [http://second] [ftp://ftp]
10286
10287 ftp://inlineftp
10288
10289 [mailto:enclosed@mail.tld With target]
10290
10291 [mailto:enclosed@mail.tld]
10292
10293 mailto:inline@mail.tld
10294 !! result
10295 <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>
10296 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
10297 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
10298 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
10299 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
10300 </p>
10301 !! end
10302
10303
10304 #
10305 # Security and HTML correctness
10306 # From Nick Jenkins' fuzz testing
10307 #
10308
10309 !! test
10310 Fuzz testing: Parser13
10311 !! input
10312 {|
10313 | http://a|
10314 !! result
10315 <table>
10316 <tr>
10317 <td>
10318 </td>
10319 </tr>
10320 </table>
10321
10322 !! end
10323
10324 !! test
10325 Fuzz testing: Parser14
10326 !! input
10327 == onmouseover= ==
10328 http://__TOC__
10329 !! result
10330 <h2><span class="mw-headline" id="onmouseover.3D">onmouseover=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
10331 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10332 <ul>
10333 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
10334 </ul>
10335 </div>
10336
10337 !! end
10338
10339 !! test
10340 Fuzz testing: Parser14-table
10341 !! input
10342 ==a==
10343 {| STYLE=__TOC__
10344 !! result
10345 <h2><span class="mw-headline" id="a">a</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
10346 <table style="&#95;_TOC&#95;_">
10347 <tr><td></td></tr>
10348 </table>
10349
10350 !! end
10351
10352 # Known to produce bogus xml (extra </td>)
10353 !! test
10354 Fuzz testing: Parser16
10355 !! options
10356 noxml
10357 !! input
10358 {|
10359 !https://||||||
10360 !! result
10361 <table>
10362 <tr>
10363 <th>https://</th>
10364 <th></th>
10365 <th></th>
10366 <th>
10367 </td>
10368 </tr>
10369 </table>
10370
10371 !! end
10372
10373 !! test
10374 Fuzz testing: Parser21
10375 !! input
10376 {|
10377 ! irc://{{ftp://a" onmouseover="alert('hello world');"
10378 |
10379 !! result
10380 <table>
10381 <tr>
10382 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
10383 </th>
10384 <td>
10385 </td>
10386 </tr>
10387 </table>
10388
10389 !! end
10390
10391 !! test
10392 Fuzz testing: Parser22
10393 !! input
10394 http://===r:::https://b
10395
10396 {|
10397 !!result
10398 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
10399 </p>
10400 <table>
10401 <tr><td></td></tr>
10402 </table>
10403
10404 !! end
10405
10406 # Known to produce bad XML for now
10407 !! test
10408 Fuzz testing: Parser24
10409 !! options
10410 noxml
10411 !! input
10412 {|
10413 {{{|
10414 <u CLASS=
10415 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
10416 <br style="onmouseover='alert(document.cookie);' " />
10417
10418 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10419 |
10420 !! result
10421 <table>
10422 {{{|
10423 <u class="&#124;">}}}} &gt;
10424 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
10425
10426 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10427 <tr>
10428 <td></u>
10429 </td>
10430 </tr>
10431 </table>
10432
10433 !! end
10434
10435 # Note: the current result listed for this is not what the original one was,
10436 # but the original bug was JavaScript injection, which is fixed in any case.
10437 # It's not clear that the original result listed was any more correct than the
10438 # current one. Original result:
10439 # <p>{{{|
10440 # </p>
10441 # <li class="&#124;&#124;">
10442 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10443 !!test
10444 Fuzz testing: Parser25 (bug 6055)
10445 !! input
10446 {{{
10447 |
10448 <LI CLASS=||
10449 >
10450 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
10451 !! result
10452 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10453 </p>
10454 !! end
10455
10456 !!test
10457 Fuzz testing: URL adjacent extension (with space, clean)
10458 !! options
10459 !! input
10460 http://example.com <nowiki>junk</nowiki>
10461 !! result
10462 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
10463 </p>
10464 !!end
10465
10466 !!test
10467 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
10468 !! options
10469 !! input
10470 http://example.com<nowiki>junk</nowiki>
10471 !! result
10472 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
10473 </p>
10474 !!end
10475
10476 !!test
10477 Fuzz testing: URL adjacent extension (no space, dirty; pre)
10478 !! options
10479 !! input
10480 http://example.com<pre>junk</pre>
10481 !! result
10482 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
10483
10484 !!end
10485
10486 !!test
10487 Fuzz testing: image with bogus manual thumbnail
10488 !!input
10489 [[Image:foobar.jpg|thumbnail= ]]
10490 !!result
10491 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
10492
10493 !!end
10494
10495 !! test
10496 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
10497 !! input
10498 <pre dir="&#10;"></pre>
10499 !! result
10500 <pre dir="&#10;"></pre>
10501
10502 !! end
10503
10504 !! test
10505 Parsing optional HTML elements (Bug 6171)
10506 !! options
10507 !! input
10508 <table>
10509 <tr>
10510 <td> Some tabular data</td>
10511 <td> More tabular data ...
10512 <td> And yet som tabular data</td>
10513 </tr>
10514 </table>
10515 !! result
10516 <table>
10517 <tr>
10518 <td> Some tabular data</td>
10519 <td> More tabular data ...
10520 </td><td> And yet som tabular data</td>
10521 </tr>
10522 </table>
10523
10524 !! end
10525
10526 !! test
10527 Correct handling of <td>, <tr> (Bug 6171)
10528 !! options
10529 !! input
10530 <table>
10531 <tr>
10532 <td> Some tabular data</td>
10533 <td> More tabular data ...</td>
10534 <td> And yet som tabular data</td>
10535 </tr>
10536 </table>
10537 !! result
10538 <table>
10539 <tr>
10540 <td> Some tabular data</td>
10541 <td> More tabular data ...</td>
10542 <td> And yet som tabular data</td>
10543 </tr>
10544 </table>
10545
10546 !! end
10547
10548
10549 !! test
10550 Parsing crashing regression (fr:JavaScript)
10551 !! input
10552 </body></x>
10553 !! result
10554 <p>&lt;/body&gt;&lt;/x&gt;
10555 </p>
10556 !! end
10557
10558 !! test
10559 Inline wiki vs wiki block nesting
10560 !! input
10561 '''Bold paragraph
10562
10563 New wiki paragraph
10564 !! result
10565 <p><b>Bold paragraph</b>
10566 </p><p>New wiki paragraph
10567 </p>
10568 !! end
10569
10570 !! test
10571 Inline HTML vs wiki block nesting
10572 !! options
10573 disabled
10574 !! input
10575 <b>Bold paragraph
10576
10577 New wiki paragraph
10578 !! result
10579 <p><b>Bold paragraph</b>
10580 </p><p>New wiki paragraph
10581 </p>
10582 !! end
10583
10584 # Original result was this:
10585 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
10586 # </p>
10587 # While that might be marginally more intuitive, maybe, the six-apostrophe
10588 # construct is clearly pathological and the result stated here (which is what
10589 # the parser actually does) is about as reasonable as anything.
10590 !!test
10591 Mixing markup for italics and bold
10592 !! options
10593 !! input
10594 '''bold''''''bold''bolditalics'''''
10595 !! result
10596 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
10597 </p>
10598 !! end
10599
10600
10601 !! article
10602 Xyzzyx
10603 !! text
10604 Article for special page transclusion test
10605 !! endarticle
10606
10607 !! test
10608 Special page transclusion
10609 !! options
10610 !! input
10611 {{Special:Prefixindex/Xyzzyx}}
10612 !! result
10613 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10614
10615 !! end
10616
10617 !! test
10618 Special page transclusion twice (bug 5021)
10619 !! options
10620 !! input
10621 {{Special:Prefixindex/Xyzzyx}}
10622 {{Special:Prefixindex/Xyzzyx}}
10623 !! result
10624 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10625 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10626
10627 !! end
10628
10629 !! test
10630 Transclusion of default MediaWiki message
10631 !! input
10632 {{MediaWiki:Mainpage}}
10633 !!result
10634 <p>Main Page
10635 </p>
10636 !! end
10637
10638 !! test
10639 Transclusion of nonexistent MediaWiki message
10640 !! input
10641 {{MediaWiki:Mainpagexxx}}
10642 !!result
10643 <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>
10644 </p>
10645 !! end
10646
10647 !! test
10648 Transclusion of MediaWiki message with underscore
10649 !! input
10650 {{MediaWiki:history_short}}
10651 !! result
10652 <p>History
10653 </p>
10654 !! end
10655
10656 !! test
10657 Transclusion of MediaWiki message with space
10658 !! input
10659 {{MediaWiki:history short}}
10660 !! result
10661 <p>History
10662 </p>
10663 !! end
10664
10665 !! test
10666 Invalid header with following text
10667 !! input
10668 = x = y
10669 !! result
10670 <p>= x = y
10671 </p>
10672 !! end
10673
10674
10675 !! test
10676 Section extraction test (section 0)
10677 !! options
10678 section=0
10679 !! input
10680 start
10681 ==a==
10682 ===aa===
10683 ====aaa====
10684 ==b==
10685 ===ba===
10686 ===bb===
10687 ====bba====
10688 ===bc===
10689 ==c==
10690 ===ca===
10691 !! result
10692 start
10693 !! end
10694
10695 !! test
10696 Section extraction test (section 1)
10697 !! options
10698 section=1
10699 !! input
10700 start
10701 ==a==
10702 ===aa===
10703 ====aaa====
10704 ==b==
10705 ===ba===
10706 ===bb===
10707 ====bba====
10708 ===bc===
10709 ==c==
10710 ===ca===
10711 !! result
10712 ==a==
10713 ===aa===
10714 ====aaa====
10715 !! end
10716
10717 !! test
10718 Section extraction test (section 2)
10719 !! options
10720 section=2
10721 !! input
10722 start
10723 ==a==
10724 ===aa===
10725 ====aaa====
10726 ==b==
10727 ===ba===
10728 ===bb===
10729 ====bba====
10730 ===bc===
10731 ==c==
10732 ===ca===
10733 !! result
10734 ===aa===
10735 ====aaa====
10736 !! end
10737
10738 !! test
10739 Section extraction test (section 3)
10740 !! options
10741 section=3
10742 !! input
10743 start
10744 ==a==
10745 ===aa===
10746 ====aaa====
10747 ==b==
10748 ===ba===
10749 ===bb===
10750 ====bba====
10751 ===bc===
10752 ==c==
10753 ===ca===
10754 !! result
10755 ====aaa====
10756 !! end
10757
10758 !! test
10759 Section extraction test (section 4)
10760 !! options
10761 section=4
10762 !! input
10763 start
10764 ==a==
10765 ===aa===
10766 ====aaa====
10767 ==b==
10768 ===ba===
10769 ===bb===
10770 ====bba====
10771 ===bc===
10772 ==c==
10773 ===ca===
10774 !! result
10775 ==b==
10776 ===ba===
10777 ===bb===
10778 ====bba====
10779 ===bc===
10780 !! end
10781
10782 !! test
10783 Section extraction test (section 5)
10784 !! options
10785 section=5
10786 !! input
10787 start
10788 ==a==
10789 ===aa===
10790 ====aaa====
10791 ==b==
10792 ===ba===
10793 ===bb===
10794 ====bba====
10795 ===bc===
10796 ==c==
10797 ===ca===
10798 !! result
10799 ===ba===
10800 !! end
10801
10802 !! test
10803 Section extraction test (section 6)
10804 !! options
10805 section=6
10806 !! input
10807 start
10808 ==a==
10809 ===aa===
10810 ====aaa====
10811 ==b==
10812 ===ba===
10813 ===bb===
10814 ====bba====
10815 ===bc===
10816 ==c==
10817 ===ca===
10818 !! result
10819 ===bb===
10820 ====bba====
10821 !! end
10822
10823 !! test
10824 Section extraction test (section 7)
10825 !! options
10826 section=7
10827 !! input
10828 start
10829 ==a==
10830 ===aa===
10831 ====aaa====
10832 ==b==
10833 ===ba===
10834 ===bb===
10835 ====bba====
10836 ===bc===
10837 ==c==
10838 ===ca===
10839 !! result
10840 ====bba====
10841 !! end
10842
10843 !! test
10844 Section extraction test (section 8)
10845 !! options
10846 section=8
10847 !! input
10848 start
10849 ==a==
10850 ===aa===
10851 ====aaa====
10852 ==b==
10853 ===ba===
10854 ===bb===
10855 ====bba====
10856 ===bc===
10857 ==c==
10858 ===ca===
10859 !! result
10860 ===bc===
10861 !! end
10862
10863 !! test
10864 Section extraction test (section 9)
10865 !! options
10866 section=9
10867 !! input
10868 start
10869 ==a==
10870 ===aa===
10871 ====aaa====
10872 ==b==
10873 ===ba===
10874 ===bb===
10875 ====bba====
10876 ===bc===
10877 ==c==
10878 ===ca===
10879 !! result
10880 ==c==
10881 ===ca===
10882 !! end
10883
10884 !! test
10885 Section extraction test (section 10)
10886 !! options
10887 section=10
10888 !! input
10889 start
10890 ==a==
10891 ===aa===
10892 ====aaa====
10893 ==b==
10894 ===ba===
10895 ===bb===
10896 ====bba====
10897 ===bc===
10898 ==c==
10899 ===ca===
10900 !! result
10901 ===ca===
10902 !! end
10903
10904 !! test
10905 Section extraction test (nonexistent section 11)
10906 !! options
10907 section=11
10908 !! input
10909 start
10910 ==a==
10911 ===aa===
10912 ====aaa====
10913 ==b==
10914 ===ba===
10915 ===bb===
10916 ====bba====
10917 ===bc===
10918 ==c==
10919 ===ca===
10920 !! result
10921 !! end
10922
10923 !! test
10924 Section extraction test with bogus heading (section 1)
10925 !! options
10926 section=1
10927 !! input
10928 ==a==
10929 ==bogus== not a legal section
10930 ==b==
10931 !! result
10932 ==a==
10933 ==bogus== not a legal section
10934 !! end
10935
10936 !! test
10937 Section extraction test with bogus heading (section 2)
10938 !! options
10939 section=2
10940 !! input
10941 ==a==
10942 ==bogus== not a legal section
10943 ==b==
10944 !! result
10945 ==b==
10946 !! end
10947
10948 !! test
10949 Section extraction test with comment after heading (section 1)
10950 !! options
10951 section=1
10952 !! input
10953 ==a==
10954 ==b== <!-- -->
10955 ==c==
10956 !! result
10957 ==a==
10958 !! end
10959
10960 !! test
10961 Section extraction test with comment after heading (section 2)
10962 !! options
10963 section=2
10964 !! input
10965 ==a==
10966 ==b== <!-- -->
10967 ==c==
10968 !! result
10969 ==b== <!-- -->
10970 !! end
10971
10972 !! test
10973 Section extraction test with bogus <nowiki> heading (section 1)
10974 !! options
10975 section=1
10976 !! input
10977 ==a==
10978 ==bogus== <nowiki>not a legal section</nowiki>
10979 ==b==
10980 !! result
10981 ==a==
10982 ==bogus== <nowiki>not a legal section</nowiki>
10983 !! end
10984
10985 !! test
10986 Section extraction test with bogus <nowiki> heading (section 2)
10987 !! options
10988 section=2
10989 !! input
10990 ==a==
10991 ==bogus== <nowiki>not a legal section</nowiki>
10992 ==b==
10993 !! result
10994 ==b==
10995 !! end
10996
10997
10998 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
10999 # instead of respecting commented sections
11000 !! test
11001 Section extraction prefixed by comment (section 1)
11002 !! options
11003 section=1
11004 !! input
11005 <!-- -->==sec1==
11006 ==sec2==
11007 !!result
11008 ==sec2==
11009 !!end
11010
11011 !! test
11012 Section extraction prefixed by comment (section 2)
11013 !! options
11014 section=2
11015 !! input
11016 <!-- -->==sec1==
11017 ==sec2==
11018 !!result
11019
11020 !!end
11021
11022
11023 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
11024 # instead of respecting HTML-style headings
11025 !! test
11026 Section extraction, mixed wiki and html (section 1)
11027 !! options
11028 section=1
11029 !! input
11030 <h2>unmarked</h2>
11031 unmarked
11032 ==1==
11033 one
11034 ==2==
11035 two
11036 !! result
11037 ==1==
11038 one
11039 !! end
11040
11041 !! test
11042 Section extraction, mixed wiki and html (section 2)
11043 !! options
11044 section=2
11045 !! input
11046 <h2>unmarked</h2>
11047 unmarked
11048 ==1==
11049 one
11050 ==2==
11051 two
11052 !! result
11053 ==2==
11054 two
11055 !! end
11056
11057
11058 # Formerly testing for bug 3342
11059 !! test
11060 Section extraction, heading surrounded by <noinclude>
11061 !! options
11062 section=1
11063 !! input
11064 <noinclude>==unmarked==</noinclude>
11065 ==marked==
11066 !! result
11067 ==marked==
11068 !!end
11069
11070 # Test behavior of bug 19910
11071 !! test
11072 Sectiion with all-equals
11073 !! options
11074 section=2
11075 !! input
11076 ===
11077 The line above must have a trailing space
11078 === <!--
11079 --> <!-- -->
11080 But just in case it doesn't...
11081 !! result
11082 === <!--
11083 --> <!-- -->
11084 But just in case it doesn't...
11085 !! end
11086
11087 !! test
11088 Section replacement test (section 0)
11089 !! options
11090 replace=0,"xxx"
11091 !! input
11092 start
11093 ==a==
11094 ===aa===
11095 ====aaa====
11096 ==b==
11097 ===ba===
11098 ===bb===
11099 ====bba====
11100 ===bc===
11101 ==c==
11102 ===ca===
11103 !! result
11104 xxx
11105
11106 ==a==
11107 ===aa===
11108 ====aaa====
11109 ==b==
11110 ===ba===
11111 ===bb===
11112 ====bba====
11113 ===bc===
11114 ==c==
11115 ===ca===
11116 !! end
11117
11118 !! test
11119 Section replacement test (section 1)
11120 !! options
11121 replace=1,"xxx"
11122 !! input
11123 start
11124 ==a==
11125 ===aa===
11126 ====aaa====
11127 ==b==
11128 ===ba===
11129 ===bb===
11130 ====bba====
11131 ===bc===
11132 ==c==
11133 ===ca===
11134 !! result
11135 start
11136 xxx
11137
11138 ==b==
11139 ===ba===
11140 ===bb===
11141 ====bba====
11142 ===bc===
11143 ==c==
11144 ===ca===
11145 !! end
11146
11147 !! test
11148 Section replacement test (section 2)
11149 !! options
11150 replace=2,"xxx"
11151 !! input
11152 start
11153 ==a==
11154 ===aa===
11155 ====aaa====
11156 ==b==
11157 ===ba===
11158 ===bb===
11159 ====bba====
11160 ===bc===
11161 ==c==
11162 ===ca===
11163 !! result
11164 start
11165 ==a==
11166 xxx
11167
11168 ==b==
11169 ===ba===
11170 ===bb===
11171 ====bba====
11172 ===bc===
11173 ==c==
11174 ===ca===
11175 !! end
11176
11177 !! test
11178 Section replacement test (section 3)
11179 !! options
11180 replace=3,"xxx"
11181 !! input
11182 start
11183 ==a==
11184 ===aa===
11185 ====aaa====
11186 ==b==
11187 ===ba===
11188 ===bb===
11189 ====bba====
11190 ===bc===
11191 ==c==
11192 ===ca===
11193 !! result
11194 start
11195 ==a==
11196 ===aa===
11197 xxx
11198
11199 ==b==
11200 ===ba===
11201 ===bb===
11202 ====bba====
11203 ===bc===
11204 ==c==
11205 ===ca===
11206 !! end
11207
11208 !! test
11209 Section replacement test (section 4)
11210 !! options
11211 replace=4,"xxx"
11212 !! input
11213 start
11214 ==a==
11215 ===aa===
11216 ====aaa====
11217 ==b==
11218 ===ba===
11219 ===bb===
11220 ====bba====
11221 ===bc===
11222 ==c==
11223 ===ca===
11224 !! result
11225 start
11226 ==a==
11227 ===aa===
11228 ====aaa====
11229 xxx
11230
11231 ==c==
11232 ===ca===
11233 !! end
11234
11235 !! test
11236 Section replacement test (section 5)
11237 !! options
11238 replace=5,"xxx"
11239 !! input
11240 start
11241 ==a==
11242 ===aa===
11243 ====aaa====
11244 ==b==
11245 ===ba===
11246 ===bb===
11247 ====bba====
11248 ===bc===
11249 ==c==
11250 ===ca===
11251 !! result
11252 start
11253 ==a==
11254 ===aa===
11255 ====aaa====
11256 ==b==
11257 xxx
11258
11259 ===bb===
11260 ====bba====
11261 ===bc===
11262 ==c==
11263 ===ca===
11264 !! end
11265
11266 !! test
11267 Section replacement test (section 6)
11268 !! options
11269 replace=6,"xxx"
11270 !! input
11271 start
11272 ==a==
11273 ===aa===
11274 ====aaa====
11275 ==b==
11276 ===ba===
11277 ===bb===
11278 ====bba====
11279 ===bc===
11280 ==c==
11281 ===ca===
11282 !! result
11283 start
11284 ==a==
11285 ===aa===
11286 ====aaa====
11287 ==b==
11288 ===ba===
11289 xxx
11290
11291 ===bc===
11292 ==c==
11293 ===ca===
11294 !! end
11295
11296 !! test
11297 Section replacement test (section 7)
11298 !! options
11299 replace=7,"xxx"
11300 !! input
11301 start
11302 ==a==
11303 ===aa===
11304 ====aaa====
11305 ==b==
11306 ===ba===
11307 ===bb===
11308 ====bba====
11309 ===bc===
11310 ==c==
11311 ===ca===
11312 !! result
11313 start
11314 ==a==
11315 ===aa===
11316 ====aaa====
11317 ==b==
11318 ===ba===
11319 ===bb===
11320 xxx
11321
11322 ===bc===
11323 ==c==
11324 ===ca===
11325 !! end
11326
11327 !! test
11328 Section replacement test (section 8)
11329 !! options
11330 replace=8,"xxx"
11331 !! input
11332 start
11333 ==a==
11334 ===aa===
11335 ====aaa====
11336 ==b==
11337 ===ba===
11338 ===bb===
11339 ====bba====
11340 ===bc===
11341 ==c==
11342 ===ca===
11343 !! result
11344 start
11345 ==a==
11346 ===aa===
11347 ====aaa====
11348 ==b==
11349 ===ba===
11350 ===bb===
11351 ====bba====
11352 xxx
11353
11354 ==c==
11355 ===ca===
11356 !!end
11357
11358 !! test
11359 Section replacement test (section 9)
11360 !! options
11361 replace=9,"xxx"
11362 !! input
11363 start
11364 ==a==
11365 ===aa===
11366 ====aaa====
11367 ==b==
11368 ===ba===
11369 ===bb===
11370 ====bba====
11371 ===bc===
11372 ==c==
11373 ===ca===
11374 !! result
11375 start
11376 ==a==
11377 ===aa===
11378 ====aaa====
11379 ==b==
11380 ===ba===
11381 ===bb===
11382 ====bba====
11383 ===bc===
11384 xxx
11385 !! end
11386
11387 !! test
11388 Section replacement test (section 10)
11389 !! options
11390 replace=10,"xxx"
11391 !! input
11392 start
11393 ==a==
11394 ===aa===
11395 ====aaa====
11396 ==b==
11397 ===ba===
11398 ===bb===
11399 ====bba====
11400 ===bc===
11401 ==c==
11402 ===ca===
11403 !! result
11404 start
11405 ==a==
11406 ===aa===
11407 ====aaa====
11408 ==b==
11409 ===ba===
11410 ===bb===
11411 ====bba====
11412 ===bc===
11413 ==c==
11414 xxx
11415 !! end
11416
11417 !! test
11418 Section replacement test with initial whitespace (bug 13728)
11419 !! options
11420 replace=2,"xxx"
11421 !! input
11422 Preformatted initial line
11423 ==a==
11424 ===a===
11425 !! result
11426 Preformatted initial line
11427 ==a==
11428 xxx
11429 !! end
11430
11431
11432 !! test
11433 Section extraction, heading followed by pre with 20 spaces (bug 6398)
11434 !! options
11435 section=1
11436 !! input
11437 ==a==
11438 a
11439 !! result
11440 ==a==
11441 a
11442 !! end
11443
11444 !! test
11445 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
11446 !! options
11447 section=1
11448 !! input
11449 ==a==
11450 a
11451 !! result
11452 ==a==
11453 a
11454 !! end
11455
11456
11457 !! test
11458 Section extraction, <pre> around bogus header (bug 10309)
11459 !! options
11460 noxml section=2
11461 !! input
11462 == Section One ==
11463 <pre>
11464 =======
11465 </pre>
11466
11467 == Section Two ==
11468 stuff
11469 !! result
11470 == Section Two ==
11471 stuff
11472 !! end
11473
11474 !! test
11475 Section replacement, <pre> around bogus header (bug 10309)
11476 !! options
11477 noxml replace=2,"xxx"
11478 !! input
11479 == Section One ==
11480 <pre>
11481 =======
11482 </pre>
11483
11484 == Section Two ==
11485 stuff
11486 !! result
11487 == Section One ==
11488 <pre>
11489 =======
11490 </pre>
11491
11492 xxx
11493 !! end
11494
11495
11496
11497 !! test
11498 Handling of &#x0A; in URLs
11499 !! input
11500 **irc://&#x0A;a
11501 !! result
11502 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
11503 </li></ul>
11504 </li></ul>
11505
11506 !!end
11507
11508 !! test
11509 5 quotes, code coverage +1 line (php)
11510 !! options
11511 php
11512 !! input
11513 '''''
11514 !! result
11515 !! end
11516 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
11517 !! test
11518 5 quotes, code coverage +1 line (parsoid)
11519 !! options
11520 parsoid
11521 !! input
11522 '''''
11523 !! result
11524 <p><i><b></b></i></p>
11525 !! end
11526
11527 !! test
11528 Special:Search page linking.
11529 !! input
11530 {{Special:search}}
11531 !! result
11532 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
11533 </p>
11534 !! end
11535
11536 !! test
11537 Say the magic word
11538 !! input
11539 * {{PAGENAME}}
11540 * {{BASEPAGENAME}}
11541 * {{SUBPAGENAME}}
11542 * {{SUBPAGENAMEE}}
11543 * {{ROOTPAGENAME}}
11544 * {{ROOTPAGENAMEE}}
11545 * {{BASEPAGENAME}}
11546 * {{BASEPAGENAMEE}}
11547 * {{TALKPAGENAME}}
11548 * {{TALKPAGENAMEE}}
11549 * {{SUBJECTPAGENAME}}
11550 * {{SUBJECTPAGENAMEE}}
11551 * {{NAMESPACEE}}
11552 * {{NAMESPACE}}
11553 * {{TALKSPACE}}
11554 * {{TALKSPACEE}}
11555 * {{SUBJECTSPACE}}
11556 * {{SUBJECTSPACEE}}
11557 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
11558 !! result
11559 <ul><li> Parser test
11560 </li><li> Parser test
11561 </li><li> Parser test
11562 </li><li> Parser_test
11563 </li><li> Parser test
11564 </li><li> Parser_test
11565 </li><li> Parser test
11566 </li><li> Parser_test
11567 </li><li> Talk:Parser test
11568 </li><li> Talk:Parser_test
11569 </li><li> Parser test
11570 </li><li> Parser_test
11571 </li><li>
11572 </li><li>
11573 </li><li> Talk
11574 </li><li> Talk
11575 </li><li>
11576 </li><li>
11577 </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>
11578 </li></ul>
11579
11580 !! end
11581 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
11582
11583 !! test
11584 Gallery
11585 !! input
11586 <gallery>
11587 image1.png |
11588 image2.gif|||||
11589
11590 image3|
11591 image4 |300px| centre
11592 image5.svg| http://///////
11593 [[x|xx]]]]
11594 * image6
11595 </gallery>
11596 !! result
11597 <ul class="gallery">
11598 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11599 <div style="height: 150px;">Image1.png</div>
11600 <div class="gallerytext">
11601 </div>
11602 </div></li>
11603 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11604 <div style="height: 150px;">Image2.gif</div>
11605 <div class="gallerytext">
11606 <p>||||
11607 </p>
11608 </div>
11609 </div></li>
11610 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11611 <div style="height: 150px;">Image3</div>
11612 <div class="gallerytext">
11613 </div>
11614 </div></li>
11615 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11616 <div style="height: 150px;">Image4</div>
11617 <div class="gallerytext">
11618 <p>300px| centre
11619 </p>
11620 </div>
11621 </div></li>
11622 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11623 <div style="height: 150px;">Image5.svg</div>
11624 <div class="gallerytext">
11625 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
11626 </p>
11627 </div>
11628 </div></li>
11629 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11630 <div style="height: 150px;">* image6</div>
11631 <div class="gallerytext">
11632 </div>
11633 </div></li>
11634 </ul>
11635
11636 !! end
11637
11638 !! test
11639 Gallery (with options)
11640 !! input
11641 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
11642 File:Nonexistant.jpg|caption
11643 File:Nonexistant.jpg
11644 image:foobar.jpg|some '''caption''' [[Main Page]]
11645 image:foobar.jpg
11646 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
11647 </gallery>
11648 !! result
11649 <ul class="gallery" style="max-width: 226px;_width: 226px;">
11650 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
11651 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11652 <div style="height: 70px;">Nonexistant.jpg</div>
11653 <div class="gallerytext">
11654 <p>caption
11655 </p>
11656 </div>
11657 </div></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 </div>
11662 </div></li>
11663 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11664 <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>
11665 <div class="gallerytext">
11666 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11667 </p>
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="Foobar.jpg" 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 </div>
11674 </div></li>
11675 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11676 <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>
11677 <div class="gallerytext">
11678 <p>Blabla|blabla.
11679 </p>
11680 </div>
11681 </div></li>
11682 </ul>
11683
11684 !! end
11685
11686 !! test
11687 Gallery with wikitext inside caption
11688 !! input
11689 <gallery>
11690 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
11691 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
11692 </gallery>
11693 !! result
11694 <ul class="gallery">
11695 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11696 <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>
11697 <div class="gallerytext">
11698 <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>
11699 </p>
11700 </div>
11701 </div></li>
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>This is a test template
11706 </p>
11707 </div>
11708 </div></li>
11709 </ul>
11710
11711 !! end
11712
11713 !! test
11714 gallery (with showfilename option)
11715 !! input
11716 <gallery showfilename>
11717 File:Nonexistant.jpg|caption
11718 File:Nonexistant.jpg
11719 image:foobar.jpg|some '''caption''' [[Main Page]]
11720 File:Foobar.jpg
11721 </gallery>
11722 !! result
11723 <ul class="gallery">
11724 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11725 <div style="height: 150px;">Nonexistant.jpg</div>
11726 <div class="gallerytext">
11727 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11728 caption
11729 </p>
11730 </div>
11731 </div></li>
11732 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11733 <div style="height: 150px;">Nonexistant.jpg</div>
11734 <div class="gallerytext">
11735 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11736 </p>
11737 </div>
11738 </div></li>
11739 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11740 <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>
11741 <div class="gallerytext">
11742 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11743 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11744 </p>
11745 </div>
11746 </div></li>
11747 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11748 <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>
11749 <div class="gallerytext">
11750 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11751 </p>
11752 </div>
11753 </div></li>
11754 </ul>
11755
11756 !! end
11757
11758 !! test
11759 Gallery (with namespace-less filenames)
11760 !! input
11761 <gallery>
11762 File:Nonexistant.jpg
11763 Nonexistant.jpg
11764 image:foobar.jpg
11765 foobar.jpg
11766 </gallery>
11767 !! result
11768 <ul class="gallery">
11769 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11770 <div style="height: 150px;">Nonexistant.jpg</div>
11771 <div class="gallerytext">
11772 </div>
11773 </div></li>
11774 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11775 <div style="height: 150px;">Nonexistant.jpg</div>
11776 <div class="gallerytext">
11777 </div>
11778 </div></li>
11779 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11780 <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>
11781 <div class="gallerytext">
11782 </div>
11783 </div></li>
11784 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11785 <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>
11786 <div class="gallerytext">
11787 </div>
11788 </div></li>
11789 </ul>
11790
11791 !! end
11792
11793 !! test
11794 HTML Hex character encoding (spells the word "JavaScript")
11795 !! input
11796 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
11797 !! result
11798 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
11799 </p>
11800 !! end
11801
11802 !! test
11803 HTML Hex character encoding bogus encoding (bug 26437 regression check)
11804 !! input
11805 &#xsee;&#XSEE;
11806 !! result
11807 <p>&amp;#xsee;&amp;#XSEE;
11808 </p>
11809 !! end
11810
11811 !! test
11812 HTML Hex character encoding mixed case
11813 !! input
11814 &#xEE;&#Xee;
11815 !! result
11816 <p>&#xee;&#xee;
11817 </p>
11818 !! end
11819
11820 !! test
11821 __FORCETOC__ override
11822 !! input
11823 __NEWSECTIONLINK__
11824 __FORCETOC__
11825 !! result
11826 <p><br />
11827 </p>
11828 !! end
11829
11830 !! test
11831 ISBN code coverage
11832 !! input
11833 ISBN 978-0-1234-56&#x20;789
11834 !! result
11835 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
11836 </p>
11837 !! end
11838
11839 !! test
11840 ISBN followed by 5 spaces
11841 !! input
11842 ISBN
11843 !! result
11844 <p>ISBN
11845 </p>
11846 !! end
11847
11848 !! test
11849 Double ISBN
11850 !! input
11851 ISBN ISBN 1234567890
11852 !! result
11853 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
11854 </p>
11855 !! end
11856
11857 !! test
11858 Bug 22905: <abbr> followed by ISBN followed by </a>
11859 !! input
11860 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
11861 !! result
11862 <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>
11863 </p>
11864 !! end
11865
11866 !! test
11867 Double RFC
11868 !! input
11869 RFC RFC 1234
11870 !! result
11871 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
11872 </p>
11873 !! end
11874
11875 !! test
11876 Double RFC with a wiki link
11877 !! input
11878 RFC [[RFC 1234]]
11879 !! result
11880 <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>
11881 </p>
11882 !! end
11883
11884 !! test
11885 RFC code coverage
11886 !! input
11887 RFC 983&#x20;987
11888 !! result
11889 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
11890 </p>
11891 !! end
11892
11893 !! test
11894 Centre-aligned image
11895 !! input
11896 [[Image:foobar.jpg|centre]]
11897 !! result
11898 <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>
11899
11900 !!end
11901
11902 !! test
11903 None-aligned image
11904 !! input
11905 [[Image:foobar.jpg|none]]
11906 !! result
11907 <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>
11908
11909 !!end
11910
11911 !! test
11912 Width + Height sized image (using px) (height is ignored)
11913 !! input
11914 [[Image:foobar.jpg|640x480px]]
11915 !! result
11916 <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>
11917 </p>
11918 !!end
11919
11920 !! test
11921 Width-sized image (using px, no following whitespace)
11922 !! input
11923 [[Image:foobar.jpg|640px]]
11924 !! result
11925 <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>
11926 </p>
11927 !!end
11928
11929 !! test
11930 Width-sized image (using px, with following whitespace - test regression from r39467)
11931 !! input
11932 [[Image:foobar.jpg|640px ]]
11933 !! result
11934 <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>
11935 </p>
11936 !!end
11937
11938 !! test
11939 Width-sized image (using px, with preceding whitespace - test regression from r39467)
11940 !! input
11941 [[Image:foobar.jpg| 640px]]
11942 !! result
11943 <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>
11944 </p>
11945 !!end
11946
11947 !! test
11948 Another italics / bold test
11949 !! input
11950 ''' ''x'
11951 !! result
11952 <pre>'<i> </i>x'
11953 </pre>
11954 !!end
11955
11956 # Note the results may be incorrect, as parserTest output included this:
11957 # XML error: Mismatched tag at byte 6120:
11958 # ...<dd> </dt></dl> </dd...
11959 !! test
11960 dt/dd/dl test
11961 !! options
11962 disabled
11963 !! input
11964 :;;;::
11965 !! result
11966 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
11967 </dd></dl>
11968 </dd></dl>
11969 </dt></dl>
11970 </dt></dl>
11971 </dt></dl>
11972 </dd></dl>
11973
11974 !!end
11975
11976
11977 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
11978 !! test
11979 Images with the "|" character in the comment
11980 !! input
11981 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
11982 !! result
11983 <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>
11984
11985 !!end
11986
11987 !! test
11988 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
11989 !! input
11990 <html><script>alert(1);</script></html>
11991 !! result
11992 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
11993 </p>
11994 !! end
11995
11996 !! test
11997 HTML with raw HTML ($wgRawHtml==true)
11998 !! options
11999 rawhtml
12000 !! input
12001 <html><script>alert(1);</script></html>
12002 !! result
12003 <p><script>alert(1);</script>
12004 </p>
12005 !! end
12006
12007 !! test
12008 Parents of subpages, one level up
12009 !! options
12010 subpage title=[[Subpage test/L1/L2/L3]]
12011 !! input
12012 [[../|L2]]
12013 !! result
12014 <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>
12015 </p>
12016 !! end
12017
12018
12019 !! test
12020 Parents of subpages, one level up, not named
12021 !! options
12022 subpage title=[[Subpage test/L1/L2/L3]]
12023 !! input
12024 [[../]]
12025 !! result
12026 <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>
12027 </p>
12028 !! end
12029
12030
12031
12032 !! test
12033 Parents of subpages, two levels up
12034 !! options
12035 subpage title=[[Subpage test/L1/L2/L3]]
12036 !! input
12037 [[../../|L1]]2
12038
12039 [[../../|L1]]l
12040 !! result
12041 <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
12042 </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>
12043 </p>
12044 !! end
12045
12046 !! test
12047 Parents of subpages, two levels up, without trailing slash or name.
12048 !! options
12049 subpage title=[[Subpage test/L1/L2/L3]]
12050 !! input
12051 [[../..]]
12052 !! result
12053 <p>[[../..]]
12054 </p>
12055 !! end
12056
12057 !! test
12058 Parents of subpages, two levels up, with lots of extra trailing slashes.
12059 !! options
12060 subpage title=[[Subpage test/L1/L2/L3]]
12061 !! input
12062 [[../../////]]
12063 !! result
12064 <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>
12065 </p>
12066 !! end
12067
12068 !! article
12069 Subpage test/L1/L2/L3Sibling
12070 !! text
12071 Sibling article
12072 !! endarticle
12073
12074 !! test
12075 Transclusion of a sibling page (one level up)
12076 !! options
12077 subpage title=[[Subpage test/L1/L2/L3]]
12078 !! input
12079 {{../L3Sibling}}
12080 !! result
12081 <p>Sibling article
12082 </p>
12083 !! end
12084
12085 !! test
12086 Transclusion of a child page
12087 !! options
12088 subpage title=[[Subpage test/L1/L2]]
12089 !! input
12090 {{/L3Sibling}}
12091 !! result
12092 <p>Sibling article
12093 </p>
12094 !! end
12095
12096 !! test
12097 Non-transclusion because of too many up levels
12098 !! options
12099 subpage title=[[Subpage test/L1/L2/L3]]
12100 !! input
12101 {{../../../../More than parent}}
12102 !! result
12103 <p>{{../../../../More than parent}}
12104 </p>
12105 !! end
12106
12107 !! test
12108 Definition list code coverage
12109 !! input
12110 ; title : def
12111 ; title : def
12112 ;title: def
12113 !! result
12114 <dl><dt> title &#160;</dt><dd> def
12115 </dd><dt> title&#160;</dt><dd> def
12116 </dd><dt>title</dt><dd> def
12117 </dd></dl>
12118
12119 !! end
12120
12121 !! test
12122 Don't fall for the self-closing div
12123 !! input
12124 <div>hello world</div/>
12125 !! result
12126 <div>hello world</div>
12127
12128 !! end
12129
12130 !! test
12131 MSGNW magic word
12132 !! input
12133 {{MSGNW:msg}}
12134 !! result
12135 <p>&#91;&#91;:Template:Msg&#93;&#93;
12136 </p>
12137 !! end
12138
12139 !! test
12140 RAW magic word
12141 !! input
12142 {{RAW:QUERTY}}
12143 !! result
12144 <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>
12145 </p>
12146 !! end
12147
12148 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
12149 !! test
12150 Always escape literal '>' in output, not just after '<'
12151 !! input
12152 ><>
12153 !! result
12154 <p>&gt;&lt;&gt;
12155 </p>
12156 !! end
12157
12158 !! test
12159 Template caching
12160 !! input
12161 {{Test}}
12162 {{Test}}
12163 !! result
12164 <p>This is a test template
12165 This is a test template
12166 </p>
12167 !! end
12168
12169
12170 !! article
12171 MediaWiki:Fake
12172 !! text
12173 ==header==
12174 !! endarticle
12175
12176 !! test
12177 Inclusion of !userCanEdit() content
12178 !! input
12179 {{MediaWiki:Fake}}
12180 !! result
12181 <h2><span class="mw-headline" id="header">header</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=MediaWiki:Fake&amp;action=edit&amp;section=T-1" title="MediaWiki:Fake">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12182
12183 !! end
12184
12185
12186 !! test
12187 Out-of-order TOC heading levels
12188 !! input
12189 ==2==
12190 ======6======
12191 ===3===
12192 =1=
12193 =====5=====
12194 ==2==
12195 !! result
12196 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12197 <ul>
12198 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
12199 <ul>
12200 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
12201 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
12202 </ul>
12203 </li>
12204 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
12205 <ul>
12206 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
12207 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
12208 </ul>
12209 </li>
12210 </ul>
12211 </div>
12212 <h2><span class="mw-headline" id="2">2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12213 <h6><span class="mw-headline" id="6">6</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: 6">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
12214 <h3><span class="mw-headline" id="3">3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: 3">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
12215 <h1><span class="mw-headline" id="1">1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 1">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
12216 <h5><span class="mw-headline" id="5">5</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: 5">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
12217 <h2><span class="mw-headline" id="2_2">2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12218
12219 !! end
12220
12221
12222 !! test
12223 ISBN with a dummy number
12224 !! input
12225 ISBN ---
12226 !! result
12227 <p>ISBN ---
12228 </p>
12229 !! end
12230
12231
12232 !! test
12233 ISBN with space-delimited number
12234 !! input
12235 ISBN 92 9017 032 8
12236 !! result
12237 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
12238 </p>
12239 !! end
12240
12241
12242 !! test
12243 ISBN with multiple spaces, no number
12244 !! input
12245 ISBN foo
12246 !! result
12247 <p>ISBN foo
12248 </p>
12249 !! end
12250
12251
12252 !! test
12253 ISBN length
12254 !! input
12255 ISBN 123456789
12256
12257 ISBN 1234567890
12258
12259 ISBN 12345678901
12260 !! result
12261 <p>ISBN 123456789
12262 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
12263 </p><p>ISBN 12345678901
12264 </p>
12265 !! end
12266
12267
12268 !! test
12269 ISBN with trailing year (bug 8110)
12270 !! input
12271 ISBN 1-234-56789-0 - 2006
12272
12273 ISBN 1 234 56789 0 - 2006
12274 !! result
12275 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
12276 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
12277 </p>
12278 !! end
12279
12280
12281 !! test
12282 anchorencode
12283 !! input
12284 {{anchorencode:foo bar©#%n}}
12285 !! result
12286 <p>foo_bar.C2.A9.23.25n
12287 </p>
12288 !! end
12289
12290 !! test
12291 anchorencode trims spaces
12292 !! input
12293 {{anchorencode: __pretty__please__}}
12294 !! result
12295 <p>pretty_please
12296 </p>
12297 !! end
12298
12299 !! test
12300 anchorencode deals with links
12301 !! input
12302 {{anchorencode: [[hello|world]] [[hi]]}}
12303 !! result
12304 <p>world_hi
12305 </p>
12306 !! end
12307
12308 !! test
12309 anchorencode deals with templates
12310 !! input
12311 {{anchorencode: {{Foo}} }}
12312 !! result
12313 <p>FOO
12314 </p>
12315 !! end
12316
12317 !! test
12318 anchorencode encodes like the TOC generator: (bug 18431)
12319 !! input
12320 === _ +:.3A%3A&&amp;]] ===
12321 {{anchorencode: _ +:.3A%3A&&amp;]] }}
12322 __NOEDITSECTION__
12323 !! result
12324 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
12325 <p>.2B:.3A.253A.26.26.5D.5D
12326 </p>
12327 !! end
12328
12329 # Expected output in the following test is not necessarily expected (there
12330 # should probably be <p> tags inside the <blockquote> in the output) -- it's
12331 # only testing for well-formedness.
12332 !! test
12333 Bug 6200: blockquotes and paragraph formatting
12334 !! input
12335 <blockquote>
12336 foo
12337 </blockquote>
12338
12339 bar
12340
12341 baz
12342 !! result
12343 <blockquote>
12344 foo
12345 </blockquote>
12346 <p>bar
12347 </p>
12348 <pre>baz
12349 </pre>
12350 !! end
12351
12352 !! test
12353 Bug 8293: Use of center tag ruins paragraph formatting
12354 !! input
12355 <center>
12356 foo
12357 </center>
12358
12359 bar
12360
12361 baz
12362 !! result
12363 <center>
12364 <p>foo
12365 </p>
12366 </center>
12367 <p>bar
12368 </p>
12369 <pre>baz
12370 </pre>
12371 !! end
12372
12373 !!test
12374 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
12375 !!options
12376 php
12377 !!input
12378 <span><s>x</span></s>
12379 !!result
12380 <p><span><s>x&lt;/span&gt;</s></span>
12381 </p>
12382 !!end
12383
12384 !!test
12385 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
12386 !!options
12387 parsoid
12388 !!input
12389 <span><s>x</span></s>
12390 !!result
12391 <p><span><s>x</s></span><s></s>
12392 </p>
12393 !!end
12394
12395 ###
12396 ### Language variants related tests
12397 ###
12398 !! test
12399 Self-link in language variants
12400 !! options
12401 title=[[Dunav]] language=sr
12402 !! input
12403 Both [[Dunav]] and [[Дунав]] are names for this river.
12404 !! result
12405 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
12406 </p>
12407 !!end
12408
12409 !! article
12410 Дуна
12411 !! text
12412 content
12413 !! endarticle
12414
12415 !! test
12416 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
12417 !! options
12418 title=[[Duna]] language=sr
12419 !! input
12420 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
12421 !! result
12422 <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.
12423 </p>
12424 !! end
12425
12426 !! test
12427 Link to pages in language variants
12428 !! options
12429 language=sr
12430 !! input
12431 Main Page can be written as [[Маин Паге]]
12432 !! result
12433 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
12434 </p>
12435 !!end
12436
12437
12438 !! test
12439 Multiple links to pages in language variants
12440 !! options
12441 language=sr
12442 !! input
12443 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
12444 !! result
12445 <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>.
12446 </p>
12447 !!end
12448
12449
12450 !! test
12451 Simple template in language variants
12452 !! options
12453 language=sr
12454 !! input
12455 {{тест}}
12456 !! result
12457 <p>This is a test template
12458 </p>
12459 !! end
12460
12461
12462 !! test
12463 Template with explicit namespace in language variants
12464 !! options
12465 language=sr
12466 !! input
12467 {{Template:тест}}
12468 !! result
12469 <p>This is a test template
12470 </p>
12471 !! end
12472
12473
12474 !! test
12475 Basic test for template parameter in language variants
12476 !! options
12477 language=sr
12478 !! input
12479 {{парамтест|param=foo}}
12480 !! result
12481 <p>This is a test template with parameter foo
12482 </p>
12483 !! end
12484
12485
12486 !! test
12487 Simple category in language variants
12488 !! options
12489 language=sr cat
12490 !! input
12491 [[Category:МедиаWики Усер'с Гуиде]]
12492 !! result
12493 <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>
12494 !! end
12495
12496
12497 !! article
12498 Category:分类
12499 !! text
12500 blah
12501 !! endarticle
12502
12503 !! article
12504 Category:分類
12505 !! text
12506 blah
12507 !! endarticle
12508
12509 !! test
12510 Don't convert blue categorylinks to another variant (bug 33210)
12511 !! options
12512 language=zh cat
12513 !! input
12514 [[A]][[Category:分类]]
12515 !! result
12516 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
12517 !! end
12518
12519
12520 !! test
12521 Stripping -{}- tags (language variants)
12522 !! options
12523 language=sr
12524 !! input
12525 Latin proverb: -{Ne nuntium necare}-
12526 !! result
12527 <p>Latin proverb: Ne nuntium necare
12528 </p>
12529 !! end
12530
12531
12532 !! test
12533 Prevent conversion with -{}- tags (language variants)
12534 !! options
12535 language=sr variant=sr-ec
12536 !! input
12537 Latinski: -{Ne nuntium necare}-
12538 !! result
12539 <p>Латински: Ne nuntium necare
12540 </p>
12541 !! end
12542
12543
12544 !! test
12545 Prevent conversion of text with -{}- tags (language variants)
12546 !! options
12547 language=sr variant=sr-ec
12548 !! input
12549 Latinski: -{Ne nuntium necare}-
12550 !! result
12551 <p>Латински: Ne nuntium necare
12552 </p>
12553 !! end
12554
12555
12556 !! test
12557 Prevent conversion of links with -{}- tags (language variants)
12558 !! options
12559 language=sr variant=sr-ec
12560 !! input
12561 -{[[Main Page]]}-
12562 !! result
12563 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12564 </p>
12565 !! end
12566
12567
12568 !! test
12569 -{}- tags within headlines (within html for parserConvert())
12570 !! options
12571 language=sr variant=sr-ec
12572 !! input
12573 == -{Naslov}- ==
12574 !! result
12575 <h2><span class="mw-headline" id="-.7BNaslov.7D-">Naslov</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Уредите одељак „Naslov“">уреди</a><span class="mw-editsection-bracket">]</span></span></h2>
12576
12577 !! end
12578
12579
12580 !! test
12581 Explicit definition of language variant alternatives
12582 !! options
12583 language=zh variant=zh-tw
12584 !! input
12585 -{zh:China;zh-tw:Taiwan}-, not China
12586 !! result
12587 <p>Taiwan, not China
12588 </p>
12589 !! end
12590
12591
12592 !! test
12593 Conversion around HTML tags
12594 !! options
12595 language=sr variant=sr-ec
12596 !! input
12597 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
12598 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
12599 !! result
12600 <p>
12601 <span title="ЛаCтин">ски</span>
12602 </p>
12603 !! end
12604
12605
12606 !! test
12607 Explicit session-wise language variant mapping (A flag and - flag)
12608 !! options
12609 language=zh variant=zh-tw
12610 !! input
12611 Taiwan is not China.
12612 But -{A|zh:China;zh-tw:Taiwan}- is China,
12613 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
12614 and -{China}- is China.
12615 !! result
12616 <p>Taiwan is not China.
12617 But Taiwan is Taiwan,
12618 (This should be stripped!)
12619 and China is China.
12620 </p>
12621 !! end
12622
12623 !! test
12624 Explicit session-wise language variant mapping (H flag for hide)
12625 !! options
12626 language=zh variant=zh-tw
12627 !! input
12628 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
12629 Taiwan is China.
12630 !! result
12631 <p>(This should be stripped!)
12632 Taiwan is Taiwan.
12633 </p>
12634 !! end
12635
12636 !! test
12637 Adding explicit conversion rule for title (T flag)
12638 !! options
12639 language=zh variant=zh-tw showtitle
12640 !! input
12641 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12642 !! result
12643 Taiwan
12644 <p>Should be stripped!
12645 </p>
12646 !! end
12647
12648 !! test
12649 Testing that changing the language variant here in the tests actually works
12650 !! options
12651 language=zh variant=zh showtitle
12652 !! input
12653 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12654 !! result
12655 China
12656 <p>Should be stripped!
12657 </p>
12658 !! end
12659
12660 !! test
12661 Recursive conversion of alt and title attrs shouldn't clear converter state
12662 !! options
12663 language=zh variant=zh-cn showtitle
12664 !! input
12665 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
12666 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
12667 !! result
12668 China
12669 <p>
12670 Should be stripped<span title="Exclamation">!</span>
12671 </p>
12672 !! end
12673
12674 !! test
12675 Bug 24072: more test on conversion rule for title
12676 !! options
12677 language=zh variant=zh-tw showtitle
12678 !! input
12679 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12680 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
12681 !! result
12682 Taiwan
12683 <p>This should be stripped!
12684 This won't take interferes with the title rule.
12685 </p>
12686 !! end
12687
12688 !! test
12689 Partly disable title conversion if variant == main language code
12690 !! options
12691 language=zh variant=zh title=[[ZH]] showtitle
12692 !! input
12693 -{T|zh-cn:CN;zh-tw:TW}-
12694 !! result
12695 ZH
12696 <p>
12697 </p>
12698 !! end
12699
12700 !! test
12701 Partly disable title conversion if variant == main language code, more
12702 !! options
12703 language=zh variant=zh title=[[ZH]] showtitle
12704 !! input
12705 -{T|TW}-
12706 !! result
12707 ZH
12708 <p>
12709 </p>
12710 !! end
12711
12712 !! test
12713 Raw output of variant escape tags (R flag)
12714 !! options
12715 language=zh variant=zh-tw
12716 !! input
12717 Raw: -{R|zh:China;zh-tw:Taiwan}-
12718 !! result
12719 <p>Raw: zh:China;zh-tw:Taiwan
12720 </p>
12721 !! end
12722
12723 !! test
12724 Nested using of manual convert syntax
12725 !! options
12726 language=zh variant=zh-hk
12727 !! input
12728 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
12729 !! result
12730 <p>Nested: Hello Hong Kong!
12731 </p>
12732 !! end
12733
12734 !! test
12735 Proper conversion of text in external links
12736 !! options
12737 language=sr variant=sr-ec
12738 !! input
12739 http://www.google.com
12740 gopher://www.google.com
12741 [http://www.google.com http://www.google.com]
12742 [gopher://www.google.com gopher://www.google.com]
12743 [https://www.google.com irc://www.google.com]
12744 [ftp://www.google.com www.google.com/ftp://dir]
12745 [//www.google.com www.google.com]
12746 !! result
12747 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12748 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12749 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12750 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12751 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
12752 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
12753 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
12754 </p>
12755 !! end
12756
12757 !! test
12758 Do not convert roman numbers to language variants
12759 !! options
12760 language=sr variant=sr-ec
12761 !! input
12762 Fridrih IV je car.
12763 !! result
12764 <p>Фридрих IV је цар.
12765 </p>
12766 !! end
12767
12768 !! test
12769 Unclosed language converter markup "-{"
12770 !! options
12771 language=sr
12772 !! input
12773 -{T|hello
12774 !! result
12775 <p>-{T|hello
12776 </p>
12777 !! end
12778
12779 !! test
12780 Don't convert raw rule "-{R|=&gt;}-" to "=>"
12781 !! options
12782 language=sr
12783 !! input
12784 -{R|=&gt;}-
12785 !! result
12786 <p>=&gt;
12787 </p>
12788 !!end
12789
12790 !!article
12791 Template:Bullet
12792 !!text
12793 * Bar
12794 !!endarticle
12795
12796 !! test
12797 Bug 529: Uncovered bullet
12798 !! input
12799 * Foo {{bullet}}
12800 !! result
12801 <ul><li> Foo
12802 </li><li> Bar
12803 </li></ul>
12804
12805 !! end
12806
12807 # Plain MediaWiki does not remove empty lists, but tidy actually does.
12808 # Templates in Wikipedia rely on this behavior, as tidy has always been
12809 # enabled there. These tests are normally run *without* tidy, so specify the
12810 # full output here.
12811 # To test realistic parsing behavior, apply a tidy-like transformation to both
12812 # the expected output and your parser's output.
12813 !! test
12814 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
12815 !! input
12816 ******* Foo {{bullet}}
12817 !! result
12818 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
12819 </li></ul>
12820 </li></ul>
12821 </li></ul>
12822 </li></ul>
12823 </li></ul>
12824 </li></ul>
12825 </li><li> Bar
12826 </li></ul>
12827
12828 !! end
12829
12830 !! test
12831 Bug 529: Uncovered table already at line-start
12832 !! input
12833 x
12834
12835 {{table}}
12836 y
12837 !! result
12838 <p>x
12839 </p>
12840 <table>
12841 <tr>
12842 <td> 1 </td>
12843 <td> 2
12844 </td></tr>
12845 <tr>
12846 <td> 3 </td>
12847 <td> 4
12848 </td></tr></table>
12849 <p>y
12850 </p>
12851 !! end
12852
12853 !! test
12854 Bug 529: Uncovered bullet in parser function result
12855 !! input
12856 * Foo {{lc:{{bullet}} }}
12857 !! result
12858 <ul><li> Foo
12859 </li><li> bar
12860 </li></ul>
12861
12862 !! end
12863
12864 !! test
12865 Bug 5678: Double-parsed template argument
12866 !! input
12867 {{lc:{{{1}}}|hello}}
12868 !! result
12869 <p>{{{1}}}
12870 </p>
12871 !! end
12872
12873 !! test
12874 Bug 5678: Double-parsed template invocation
12875 !! input
12876 {{lc:{{paramtest {{!}} param = hello }} }}
12877 !! result
12878 <p>{{paramtest | param = hello }}
12879 </p>
12880 !! end
12881
12882 !! test
12883 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
12884 !! options
12885 language=cs
12886 title=[[Main Page]]
12887 !! input
12888 {{PRVNÍVELKÉ:ěščř}}
12889 {{prvnívelké:ěščř}}
12890 {{PRVNÍMALÉ:ěščř}}
12891 {{prvnímalé:ěščř}}
12892 {{MALÁ:ěščř}}
12893 {{malá:ěščř}}
12894 {{VELKÁ:ěščř}}
12895 {{velká:ěščř}}
12896 !! result
12897 <p>Ěščř
12898 Ěščř
12899 ěščř
12900 ěščř
12901 ěščř
12902 ěščř
12903 ĚŠČŘ
12904 ĚŠČŘ
12905 </p>
12906 !! end
12907
12908 !! test
12909 Morwen/13: Unclosed link followed by heading
12910 !! input
12911 [[link
12912 ==heading==
12913 !! result
12914 <p>[[link
12915 </p>
12916 <h2><span class="mw-headline" id="heading">heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12917
12918 !! end
12919
12920 !! test
12921 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
12922 !! input
12923 {{foo|
12924 =heading=
12925 !! result
12926 <p>{{foo|
12927 </p>
12928 <h1><span class="mw-headline" id="heading">heading</span></h1>
12929
12930 !! end
12931
12932 !! test
12933 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
12934 !! input
12935 {{foo|
12936 ==heading==
12937 !! result
12938 <p>{{foo|
12939 </p>
12940 <h2><span class="mw-headline" id="heading">heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12941
12942 !! end
12943
12944 !! test
12945 Tildes in comments
12946 !! options
12947 pst
12948 !! input
12949 <!-- ~~~~ -->
12950 !! result
12951 <!-- ~~~~ -->
12952 !! end
12953
12954 !! test
12955 Paragraphs inside divs (no extra line breaks)
12956 !! input
12957 <div>Line one
12958
12959 Line two</div>
12960 !! result
12961 <div>Line one
12962 Line two</div>
12963
12964 !! end
12965
12966 !! test
12967 Paragraphs inside divs (extra line break on open)
12968 !! input
12969 <div>
12970 Line one
12971
12972 Line two</div>
12973 !! result
12974 <div>
12975 <p>Line one
12976 </p>
12977 Line two</div>
12978
12979 !! end
12980
12981 !! test
12982 Paragraphs inside divs (extra line break on close)
12983 !! input
12984 <div>Line one
12985
12986 Line two
12987 </div>
12988 !! result
12989 <div>Line one
12990 <p>Line two
12991 </p>
12992 </div>
12993
12994 !! end
12995
12996 !! test
12997 Paragraphs inside divs (extra line break on open and close)
12998 !! input
12999 <div>
13000 Line one
13001
13002 Line two
13003 </div>
13004 !! result
13005 <div>
13006 <p>Line one
13007 </p><p>Line two
13008 </p>
13009 </div>
13010
13011 !! end
13012
13013 !! test
13014 Nesting tags, paragraphs on lines which begin with <div>
13015 !! options
13016 disabled
13017 !! input
13018 <div></div><strong>A
13019 B</strong>
13020 !! result
13021 <div></div>
13022 <p><strong>A
13023 B</strong>
13024 </p>
13025 !! end
13026
13027 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
13028 !! test
13029 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
13030 !! options
13031 disabled
13032 !! input
13033 <blockquote>Line one
13034
13035 Line two</blockquote>
13036 !! result
13037 <blockquote>Line one
13038 Line two</blockquote>
13039
13040 !! end
13041
13042 !! test
13043 Bug 6200: paragraphs inside blockquotes (extra line break on open)
13044 !! options
13045 disabled
13046 !! input
13047 <blockquote>
13048 Line one
13049
13050 Line two</blockquote>
13051 !! result
13052 <blockquote>
13053 <p>Line one
13054 </p>
13055 Line two</blockquote>
13056
13057 !! end
13058
13059 !! test
13060 Bug 6200: paragraphs inside blockquotes (extra line break on close)
13061 !! options
13062 disabled
13063 !! input
13064 <blockquote>Line one
13065
13066 Line two
13067 </blockquote>
13068 !! result
13069 <blockquote>Line one
13070 <p>Line two
13071 </p>
13072 </blockquote>
13073
13074 !! end
13075
13076 !! test
13077 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
13078 !! options
13079 disabled
13080 !! input
13081 <blockquote>
13082 Line one
13083
13084 Line two
13085 </blockquote>
13086 !! result
13087 <blockquote>
13088 <p>Line one
13089 </p><p>Line two
13090 </p>
13091 </blockquote>
13092
13093 !! end
13094
13095 !! test
13096 Paragraphs inside blockquotes/divs (no extra line breaks)
13097 !! input
13098 <blockquote><div>Line one
13099
13100 Line two</div></blockquote>
13101 !! result
13102 <blockquote><div>Line one
13103 Line two</div></blockquote>
13104
13105 !! end
13106
13107 !! test
13108 Paragraphs inside blockquotes/divs (extra line break on open)
13109 !! input
13110 <blockquote><div>
13111 Line one
13112
13113 Line two</div></blockquote>
13114 !! result
13115 <blockquote><div>
13116 <p>Line one
13117 </p>
13118 Line two</div></blockquote>
13119
13120 !! end
13121
13122 !! test
13123 Paragraphs inside blockquotes/divs (extra line break on close)
13124 !! input
13125 <blockquote><div>Line one
13126
13127 Line two
13128 </div></blockquote>
13129 !! result
13130 <blockquote><div>Line one
13131 <p>Line two
13132 </p>
13133 </div></blockquote>
13134
13135 !! end
13136
13137 !! test
13138 Paragraphs inside blockquotes/divs (extra line break on open and close)
13139 !! input
13140 <blockquote><div>
13141 Line one
13142
13143 Line two
13144 </div></blockquote>
13145 !! result
13146 <blockquote><div>
13147 <p>Line one
13148 </p><p>Line two
13149 </p>
13150 </div></blockquote>
13151
13152 !! end
13153
13154 !! test
13155 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
13156 !! options
13157 wgLinkHolderBatchSize=0
13158 !! input
13159 [[meatball:1]]
13160 [[meatball:2]]
13161 [[meatball:3]]
13162 !! result
13163 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
13164 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
13165 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
13166 </p>
13167 !! end
13168
13169 !! test
13170 Free external link invading image caption
13171 !! input
13172 [[Image:Foobar.jpg|thumb|http://x|hello]]
13173 !! result
13174 <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>
13175
13176 !! end
13177
13178 !! test
13179 Bug 15196: localised external link numbers
13180 !! options
13181 language=fa
13182 !! input
13183 [http://en.wikipedia.org/]
13184 !! result
13185 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
13186 </p>
13187 !! end
13188
13189 !! test
13190 Multibyte character in padleft
13191 !! input
13192 {{padleft:-Hello|7|Æ}}
13193 !! result
13194 <p>Æ-Hello
13195 </p>
13196 !! end
13197
13198 !! test
13199 Multibyte character in padright
13200 !! input
13201 {{padright:Hello-|7|Æ}}
13202 !! result
13203 <p>Hello-Æ
13204 </p>
13205 !! end
13206
13207 !!test
13208 formatdate parser function
13209 !!input
13210 {{#formatdate:2009-03-24}}
13211 !! result
13212 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
13213 </p>
13214 !! end
13215
13216 !!test
13217 formatdate parser function, with default format
13218 !!input
13219 {{#formatdate:2009-03-24|mdy}}
13220 !! result
13221 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
13222 </p>
13223 !! end
13224
13225 !! test
13226 Spacing of numbers in formatted dates
13227 !! input
13228 {{#formatdate:January 15}}
13229 !! result
13230 <p><span class="mw-formatted-date" title="01-15">January 15</span>
13231 </p>
13232 !! end
13233
13234 !! test
13235 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
13236 !! options
13237 language=nl title=[[MediaWiki:Common.css]]
13238 !! input
13239 {{#formatdate:2009-03-24|dmy}}
13240 !! result
13241 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
13242 </p>
13243 !! end
13244
13245 #
13246 #
13247 #
13248
13249 #
13250 # Edit comments
13251 #
13252
13253 !! test
13254 Edit comment with link
13255 !! options
13256 comment
13257 !! input
13258 I like the [[Main Page]] a lot
13259 !! result
13260 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
13261 !!end
13262
13263 !! test
13264 Edit comment with link and link text
13265 !! options
13266 comment
13267 !! input
13268 I like the [[Main Page|best pages]] a lot
13269 !! result
13270 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13271 !!end
13272
13273 !! test
13274 Edit comment with link and link text with suffix
13275 !! options
13276 comment
13277 !! input
13278 I like the [[Main Page|best page]]s a lot
13279 !! result
13280 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13281 !!end
13282
13283 !! test
13284 Edit comment with section link (non-local, eg in history list)
13285 !! options
13286 comment title=[[Main Page]]
13287 !! input
13288 /* External links */ removed bogus entries
13289 !! result
13290 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13291 !!end
13292
13293 !! test
13294 Edit comment with section link and text before it (non-local, eg in history list)
13295 !! options
13296 comment title=[[Main Page]]
13297 !! input
13298 pre-comment text /* External links */ removed bogus entries
13299 !! result
13300 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>
13301 !!end
13302
13303 !! test
13304 Edit comment with section link (local, eg in diff view)
13305 !! options
13306 comment local title=[[Main Page]]
13307 !! input
13308 /* External links */ removed bogus entries
13309 !! result
13310 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13311 !!end
13312
13313 !! test
13314 Edit comment with subpage link (bug 14080)
13315 !! options
13316 comment
13317 subpage
13318 title=[[Subpage test]]
13319 !! input
13320 Poked at a [[/subpage]] here...
13321 !! result
13322 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
13323 !!end
13324
13325 !! test
13326 Edit comment with subpage link and link text (bug 14080)
13327 !! options
13328 comment
13329 subpage
13330 title=[[Subpage test]]
13331 !! input
13332 Poked at a [[/subpage|neat little page]] here...
13333 !! result
13334 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
13335 !!end
13336
13337 !! test
13338 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
13339 !! options
13340 comment
13341 title=[[Subpage test]]
13342 !! input
13343 Poked at a [[/subpage]] here...
13344 !! result
13345 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...
13346 !!end
13347
13348 !! test
13349 Edit comment with bare anchor link (local, as on diff)
13350 !! options
13351 comment
13352 local
13353 title=[[Main Page]]
13354 !!input
13355 [[#section]]
13356 !! result
13357 <a href="#section">#section</a>
13358 !! end
13359
13360 !! test
13361 Edit comment with bare anchor link (non-local, as on history)
13362 !! options
13363 comment
13364 title=[[Main Page]]
13365 !!input
13366 [[#section]]
13367 !! result
13368 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
13369 !! end
13370
13371 !! test
13372 Anchor starting with underscore
13373 !!input
13374 [[#_ref|One]]
13375 !! result
13376 <p><a href="#_ref">One</a>
13377 </p>
13378 !! end
13379
13380 !! test
13381 Id starting with underscore
13382 !!input
13383 <div id="_ref"></div>
13384 !! result
13385 <div id="_ref"></div>
13386
13387 !! end
13388
13389 !! test
13390 Space normalisation on autocomment (bug 22784)
13391 !! options
13392 comment
13393 title=[[Main Page]]
13394 !!input
13395 /* __hello__world__ */
13396 !! result
13397 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
13398 !! end
13399
13400 !! test
13401 percent-encoding and + signs in comments (Bug 26410)
13402 !! options
13403 comment
13404 !!input
13405 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
13406 !! result
13407 <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>
13408 !! end
13409
13410 !! test
13411 Bad images - basic functionality
13412 !! options
13413 disabled
13414 !! input
13415 [[File:Bad.jpg]]
13416 !! result
13417 !! end
13418
13419 !! test
13420 Bad images - bug 16039: text after bad image disappears
13421 !! options
13422 disabled
13423 !! input
13424 Foo bar
13425 [[File:Bad.jpg]]
13426 Bar foo
13427 !! result
13428 <p>Foo bar
13429 </p><p>Bar foo
13430 </p>
13431 !! end
13432
13433 !! test
13434 Verify that displaytitle works (bug #22501) no displaytitle
13435 !! options
13436 showtitle
13437 !! config
13438 wgAllowDisplayTitle=true
13439 wgRestrictDisplayTitle=false
13440 !! input
13441 this is not the the title
13442 !! result
13443 Parser test
13444 <p>this is not the the title
13445 </p>
13446 !! end
13447
13448 !! test
13449 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
13450 !! options
13451 showtitle
13452 title=[[Screen]]
13453 !! config
13454 wgAllowDisplayTitle=true
13455 wgRestrictDisplayTitle=false
13456 !! input
13457 this is not the the title
13458 {{DISPLAYTITLE:whatever}}
13459 !! result
13460 whatever
13461 <p>this is not the the title
13462 </p>
13463 !! end
13464
13465 !! test
13466 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
13467 !! options
13468 showtitle
13469 title=[[Screen]]
13470 !! config
13471 wgAllowDisplayTitle=true
13472 wgRestrictDisplayTitle=true
13473 !! input
13474 this is not the the title
13475 {{DISPLAYTITLE:whatever}}
13476 !! result
13477 Screen
13478 <p>this is not the the title
13479 </p>
13480 !! end
13481
13482 !! test
13483 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
13484 !! options
13485 showtitle
13486 title=[[Screen]]
13487 !! config
13488 wgAllowDisplayTitle=true
13489 wgRestrictDisplayTitle=true
13490 !! input
13491 this is not the the title
13492 {{DISPLAYTITLE:screen}}
13493 !! result
13494 screen
13495 <p>this is not the the title
13496 </p>
13497 !! end
13498
13499 !! test
13500 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
13501 !! options
13502 showtitle
13503 title=[[Screen]]
13504 !! config
13505 wgAllowDisplayTitle=false
13506 !! input
13507 this is not the the title
13508 {{DISPLAYTITLE:screen}}
13509 !! result
13510 Screen
13511 <p>this is not the the title
13512 <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>
13513 </p>
13514 !! end
13515
13516 !! test
13517 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
13518 !! options
13519 showtitle
13520 title=[[Screen]]
13521 !! config
13522 wgAllowDisplayTitle=false
13523 !! input
13524 this is not the the title
13525 !! result
13526 Screen
13527 <p>this is not the the title
13528 </p>
13529 !! end
13530
13531 !! test
13532 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
13533 !! options
13534 showtitle
13535 title=[[Screen]]
13536 !! config
13537 wgAllowDisplayTitle=true
13538 wgRestrictDisplayTitle=true
13539 !! input
13540 this is not the the title
13541 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
13542 !! result
13543 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
13544 <p>this is not the the title
13545 </p>
13546 !! end
13547
13548 !! test
13549 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
13550 !! options
13551 showtitle
13552 title=[[Screen]]
13553 !! config
13554 wgAllowDisplayTitle=true
13555 wgRestrictDisplayTitle=true
13556 !! input
13557 this is not the the title
13558 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
13559 !! result
13560 <span style="color: red;">s</span>creen
13561 <p>this is not the the title
13562 </p>
13563 !! end
13564
13565 !! test
13566 preload: check <noinclude> and <includeonly>
13567 !! options
13568 preload
13569 !! input
13570 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
13571 !! result
13572 Hello kind world.
13573 !! end
13574
13575 !! test
13576 preload: check <onlyinclude>
13577 !! options
13578 preload
13579 !! input
13580 Goodbye <onlyinclude>Hello world</onlyinclude>
13581 !! result
13582 Hello world
13583 !! end
13584
13585 !! test
13586 preload: can pass tags through if we want to
13587 !! options
13588 preload
13589 !! input
13590 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
13591 !! result
13592 <includeonly>Hello world</includeonly>
13593 !! end
13594
13595 !! test
13596 preload: check that it doesn't try to do tricks
13597 !! options
13598 preload
13599 !! input
13600 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13601 !! result
13602 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13603 !! end
13604
13605 !! test
13606 Play a bit with r67090 and bug 3158
13607 !! options
13608 disabled
13609 !! input
13610 <div style="width:50% !important">&nbsp;</div>
13611 <div style="width:50%&nbsp;!important">&nbsp;</div>
13612 <div style="width:50%&#160;!important">&nbsp;</div>
13613 <div style="border : solid;">&nbsp;</div>
13614 !! result
13615 <div style="width:50% !important">&nbsp;</div>
13616 <div style="width:50% !important">&nbsp;</div>
13617 <div style="width:50% !important">&nbsp;</div>
13618 <div style="border&#160;: solid;">&nbsp;</div>
13619
13620 !! end
13621
13622 !! test
13623 HTML5 data attributes
13624 !! input
13625 <span data-foo="bar">Baz</span>
13626 <p data-abc-def_hij="">Quuz</p>
13627 !! result
13628 <p><span data-foo="bar">Baz</span>
13629 </p>
13630 <p data-abc-def_hij="">Quuz</p>
13631
13632 !! end
13633
13634 !! test
13635 percent-encoding and + signs in internal links (Bug 26410)
13636 !! input
13637 [[User:+%]] [[Page+title%]]
13638 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
13639 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
13640 [[%33%45]] [[%33%45+]]
13641 !! result
13642 <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>
13643 <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>
13644 <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>
13645 <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>
13646 </p>
13647 !! end
13648
13649 !! test
13650 Special characters in embedded file links (bug 27679)
13651 !! input
13652 [[File:Contains & ampersand.jpg]]
13653 [[File:Does not exist.jpg|Title with & ampersand]]
13654 !! result
13655 <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>
13656 <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>
13657 </p>
13658 !! end
13659
13660
13661 !! test
13662 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
13663 !! input
13664 Text&apos;s been normalized?
13665 !! result
13666 <p>Text&#39;s been normalized?
13667 </p>
13668 !! end
13669
13670 !! test
13671 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
13672 !! input
13673 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
13674 !! result
13675 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
13676 </p>
13677 !! end
13678
13679 !! test
13680 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
13681 !! input
13682 [http://www.example.org/ ideograms]
13683 !! result
13684 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
13685 </p>
13686 !! end
13687
13688 !! test
13689 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
13690 !! input
13691 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
13692 !! result
13693 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
13694 </p>
13695 !! end
13696
13697 !! article
13698 Mediawiki:loop1
13699 !! text
13700 {{Identical|A}}
13701 !! endarticle
13702
13703 !! article
13704 Mediawiki:loop2
13705 !! text
13706 {{Identical|B}}
13707 !! endarticle
13708
13709 !! article
13710 Template:Identical
13711 !! text
13712 {{int:loop1}}
13713 {{int:loop2}}
13714 !! endarticle
13715
13716 !! test
13717 Bug 31098 Template which includes system messages which includes the template
13718 !! input
13719 {{Identical}}
13720 !! result
13721 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13722 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13723 </p>
13724 !! end
13725
13726 !! test
13727 Bug31490 Turkish: ucfirst 'blah'
13728 !! options
13729 language=tr
13730 !! input
13731 {{ucfirst:blah}}
13732 !! result
13733 <p>Blah
13734 </p>
13735 !! end
13736
13737 !! test
13738 Bug31490 Turkish: ucfirst 'ix'
13739 !! options
13740 language=tr
13741 !! input
13742 {{ucfirst:ix}}
13743 !! result
13744 <p>İx
13745 </p>
13746 !! end
13747
13748 !! test
13749 Bug31490 Turkish: lcfirst 'BLAH'
13750 !! options
13751 language=tr
13752 !! input
13753 {{lcfirst:BLAH}}
13754 !! result
13755 <p>bLAH
13756 </p>
13757 !! end
13758
13759 !! test
13760 Bug31490 Turkish: ucfırst (with a dotless i)
13761 !! options
13762 language=tr
13763 !! input
13764 {{ucfırst:blah}}
13765 !! result
13766 <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>
13767 </p>
13768 !! end
13769
13770 !! test
13771 Bug31490 ucfırst (with a dotless i) with English language
13772 !! options
13773 language=en
13774 !! input
13775 {{ucfırst:blah}}
13776 !! result
13777 <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>
13778 </p>
13779 !! end
13780
13781 !! test
13782 Bug 26375: TOC with italics
13783 !! options
13784 title=[[Main Page]]
13785 !! input
13786 __TOC__
13787 == ''Lost'' episodes ==
13788 !! result
13789 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13790 <ul>
13791 <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>
13792 </ul>
13793 </div>
13794 <h2><span class="mw-headline" id="Lost_episodes"><i>Lost</i> episodes</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Lost episodes">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13795
13796 !! end
13797
13798 !! test
13799 Bug 26375: TOC with bold
13800 !! options
13801 title=[[Main Page]]
13802 !! input
13803 __TOC__
13804 == '''should be bold''' then normal text ==
13805 !! result
13806 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13807 <ul>
13808 <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>
13809 </ul>
13810 </div>
13811 <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"><span class="mw-editsection-bracket">[</span><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 class="mw-editsection-bracket">]</span></span></h2>
13812
13813 !! end
13814
13815 !! test
13816 Bug 33845: Headings become cursive in TOC when they contain an image
13817 !! options
13818 title=[[Main Page]]
13819 !! input
13820 __TOC__
13821 == Image [[Image:foobar.jpg]] ==
13822 !! result
13823 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13824 <ul>
13825 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
13826 </ul>
13827 </div>
13828 <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"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Image">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13829
13830 !! end
13831
13832 !! test
13833 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
13834 !! options
13835 title=[[Main Page]]
13836 !! input
13837 __TOC__
13838 == <blockquote>Quote</blockquote> ==
13839 !! result
13840 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13841 <ul>
13842 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
13843 </ul>
13844 </div>
13845 <h2><span class="mw-headline" id="Quote"><blockquote>Quote</blockquote></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Quote">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13846
13847 !! end
13848
13849 !! test
13850 Unclosed tags in TOC
13851 !! options
13852 title=[[Main Page]]
13853 !! input
13854 __TOC__
13855 == Proof: 2 < 3 ==
13856 <small>Hanc marginis exiguitas non caperet.</small>
13857 QED
13858 !! result
13859 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13860 <ul>
13861 <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>
13862 </ul>
13863 </div>
13864 <h2><span class="mw-headline" id="Proof:_2_.3C_3">Proof: 2 &lt; 3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Proof: 2 &lt; 3">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13865 <p><small>Hanc marginis exiguitas non caperet.</small>
13866 QED
13867 </p>
13868 !! end
13869
13870 !! test
13871 Multiple tags in TOC
13872 !! input
13873 __TOC__
13874 == <i>Foo</i> <b>Bar</b> ==
13875
13876 == <i>Foo</i> <blockquote>Bar</blockquote> ==
13877 !! result
13878 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13879 <ul>
13880 <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>
13881 <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>
13882 </ul>
13883 </div>
13884 <h2><span class="mw-headline" id="Foo_Bar"><i>Foo</i> <b>Bar</b></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13885 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i> <blockquote>Bar</blockquote></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13886
13887 !! end
13888
13889 !! test
13890 Tags with parameters in TOC
13891 !! input
13892 __TOC__
13893 == <sup class="in-h2">Hello</sup> ==
13894
13895 == <sup class="a > b">Evilbye</sup> ==
13896 !! result
13897 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13898 <ul>
13899 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
13900 <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>
13901 </ul>
13902 </div>
13903 <h2><span class="mw-headline" id="Hello"><sup class="in-h2">Hello</sup></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Hello">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13904 <h2><span class="mw-headline" id="b.22.3EEvilbye"><sup> b"&gt;Evilbye</sup></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b&quot;>Evilbye">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13905
13906 !! end
13907
13908 !! test
13909 span tags with directionality in TOC
13910 !! input
13911 __TOC__
13912 == <span dir="ltr">C++</span> ==
13913
13914 == <span dir="rtl">זבנג!</span> ==
13915
13916 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
13917
13918 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
13919
13920 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
13921 !! result
13922 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13923 <ul>
13924 <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>
13925 <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>
13926 <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>
13927 <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>
13928 <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>
13929 </ul>
13930 </div>
13931 <h2><span class="mw-headline" id="C.2B.2B"><span dir="ltr">C++</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: C++">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13932 <h2><span class="mw-headline" id=".D7.96.D7.91.D7.A0.D7.92.21"><span dir="rtl">זבנג!</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: זבנג!">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13933 <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"><span class="mw-editsection-bracket">[</span><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 class="mw-editsection-bracket">]</span></span></h2>
13934 <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"><span class="mw-editsection-bracket">[</span><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 class="mw-editsection-bracket">]</span></span></h2>
13935 <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"><span class="mw-editsection-bracket">[</span><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 class="mw-editsection-bracket">]</span></span></h2>
13936
13937 !! end
13938
13939 !! article
13940 MediaWiki:Bug32057
13941 !! text
13942 == {{int:headline_sample}} ==
13943 !! endarticle
13944
13945 !! test
13946 Bug 32057: Title needed when expanding <h> nodes.
13947 !! options
13948 title=[[Main Page]]
13949 !! input
13950 {{int:Bug32057}}
13951 !! result
13952 <h2><span class="mw-headline" id="Headline_text">Headline text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Headline text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13953
13954 !! end
13955
13956 !! test
13957 Strip marker in urlencode
13958 !! input
13959 {{urlencode:x<nowiki/>y}}
13960 {{urlencode:x<nowiki/>y|wiki}}
13961 {{urlencode:x<nowiki/>y|path}}
13962 !! result
13963 <p>xy
13964 xy
13965 xy
13966 </p>
13967 !! end
13968
13969 !! test
13970 Strip marker in lc
13971 !! input
13972 {{lc:x<nowiki/>y}}
13973 !! result
13974 <p>xy
13975 </p>
13976 !! end
13977
13978 !! test
13979 Strip marker in uc
13980 !! input
13981 {{uc:x<nowiki/>y}}
13982 !! result
13983 <p>XY
13984 </p>
13985 !! end
13986
13987 !! test
13988 Strip marker in formatNum
13989 !! input
13990 {{formatnum:1<nowiki/>2}}
13991 {{formatnum:1<nowiki/>2|R}}
13992 !! result
13993 <p>12
13994 12
13995 </p>
13996 !! end
13997
13998 !! test
13999 Check noCommafy in formatNum
14000 !! options
14001 language=be-tarask
14002 !! input
14003 {{formatnum:123456.78}}
14004 {{formatnum:123456.78|NOSEP}}
14005 !! result
14006 <p>123 456,78
14007 123456.78
14008 </p>
14009 !! end
14010
14011 !! test
14012 Strip marker in grammar
14013 !! options
14014 language=fi
14015 !! input
14016 {{grammar:elative|foo<nowiki/>bar}}
14017 !! result
14018 <p>foobarista
14019 </p>
14020 !! end
14021
14022 !! test
14023 Strip marker in padleft
14024 !! input
14025 {{padleft:|2|x<nowiki/>y}}
14026 !! result
14027 <p>xy
14028 </p>
14029 !! end
14030
14031 !! test
14032 Strip marker in padright
14033 !! input
14034 {{padright:|2|x<nowiki/>y}}
14035 !! result
14036 <p>xy
14037 </p>
14038 !! end
14039
14040 !! test
14041 Strip marker in anchorencode
14042 !! input
14043 {{anchorencode:x<nowiki/>y}}
14044 !! result
14045 <p>xy
14046 </p>
14047 !! end
14048
14049 !! test
14050 nowiki inside link inside heading (bug 18295)
14051 !! input
14052 ==[[foo|x<nowiki>y</nowiki>z]]==
14053 !! result
14054 <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"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: xyz">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14055
14056 !! end
14057
14058 !! test
14059 new support for bdi element (bug 31817)
14060 !! input
14061 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14062 !! result
14063 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14064
14065 !!end
14066
14067 !! test
14068 Ignore pipe between table row attributes
14069 !! input
14070 {|
14071 | quux
14072 |- id=foo | style='color: red'
14073 | bar
14074 |}
14075 !! result
14076 <table>
14077 <tr>
14078 <td> quux
14079 </td></tr>
14080 <tr id="foo" style="color: red">
14081 <td> bar
14082 </td></tr></table>
14083
14084 !! end
14085
14086 !!test
14087 Gallery override link with WikiLink (bug 34852)
14088 !! input
14089 <gallery>
14090 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
14091 </gallery>
14092 !! result
14093 <ul class="gallery">
14094 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14095 <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>
14096 <div class="gallerytext">
14097 <p>caption
14098 </p>
14099 </div>
14100 </div></li>
14101 </ul>
14102
14103 !! end
14104
14105 !!test
14106 Gallery override link with absolute external link (bug 34852)
14107 !! input
14108 <gallery>
14109 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
14110 </gallery>
14111 !! result
14112 <ul class="gallery">
14113 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14114 <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>
14115 <div class="gallerytext">
14116 <p>caption
14117 </p>
14118 </div>
14119 </div></li>
14120 </ul>
14121
14122 !! end
14123
14124 !!test
14125 Gallery override link with malicious javascript (bug 34852)
14126 !! input
14127 <gallery>
14128 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
14129 </gallery>
14130 !! result
14131 <ul class="gallery">
14132 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14133 <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>
14134 <div class="gallerytext">
14135 <p>caption
14136 </p>
14137 </div>
14138 </div></li>
14139 </ul>
14140
14141 !! end
14142
14143 !!test
14144 Gallery with invalid title as link (bug 43964)
14145 !! input
14146 <gallery>
14147 File:foobar.jpg|link=<
14148 </gallery>
14149 !! result
14150 <ul class="gallery">
14151 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14152 <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>
14153 <div class="gallerytext">
14154 </div>
14155 </div></li>
14156 </ul>
14157
14158 !! end
14159
14160 !!test
14161 Language parser function
14162 !! input
14163 {{#language:ar}}
14164 !! result
14165 <p>العربية
14166 </p>
14167 !! end
14168
14169 !!test
14170 Padleft and padright as substr
14171 !! input
14172 {{padleft:|3|abcde}}
14173 {{padright:|3|abcde}}
14174 !! result
14175 <p>abc
14176 abc
14177 </p>
14178 !! end
14179
14180 !!test
14181 Special parser function
14182 !! input
14183 {{#special:RandomPage}}
14184 {{#special:BaDtItLe}}
14185 {{#special:Foobar}}
14186 !! result
14187 <p>Special:Random
14188 Special:Badtitle
14189 Special:Foobar
14190 </p>
14191 !! end
14192
14193 !!test
14194 Bug 34939 - Case insensitive link parsing ([HttP://])
14195 !! input
14196 [HttP://MediaWiki.Org/]
14197 !! result
14198 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
14199 </p>
14200 !! end
14201
14202 !!test
14203 Bug 34939 - Case insensitive link parsing ([HttP:// title])
14204 !! input
14205 [HttP://MediaWiki.Org/ MediaWiki]
14206 !! result
14207 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
14208 </p>
14209 !! end
14210
14211 !!test
14212 Bug 34939 - Case insensitive link parsing (HttP://)
14213 !! input
14214 HttP://MediaWiki.Org/
14215 !! result
14216 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
14217 </p>
14218 !! end
14219
14220 ###
14221 ### Parsoids-specific tests
14222 ### Parsoid-PHP parser incompatibilities
14223 ###
14224 !!test
14225 1. SOL-sensitive wikitext tokens as template-args
14226 !!options
14227 parsoid=wt2html,wt2wt
14228 !!input
14229 {{echo|*a}}
14230 {{echo|#a}}
14231 {{echo|:a}}
14232 !!result
14233 <span about="#mwt1" typeof="mw:Transclusion">
14234 </span><ul about="#mwt1"><li>a</li></ul>
14235 <span about="#mwt2" typeof="mw:Transclusion">
14236 </span><ol about="#mwt2"><li>a</li></ol>
14237 <span about="#mwt3" typeof="mw:Transclusion">
14238 </span><dl about="#mwt3"><dd>a</dd></dl>
14239 !!end
14240
14241 #### ----------------------------------------------------------------
14242 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
14243 #### tags. Parsoid's output for these tags differs from that of the
14244 #### PHP parser.
14245 #### ----------------------------------------------------------------
14246
14247 !!test
14248 Ref: 1. ref-location should be replaced with an index span
14249 !!options
14250 parsoid
14251 !!input
14252 A <ref>foo</ref>
14253 B <ref name="x">foo</ref>
14254 C <ref name="y" />
14255 !!result
14256 <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>
14257 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>
14258 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>
14259 !!end
14260
14261 !!test
14262 Ref: 2. ref-tags with identical names should all get the same index
14263 !!options
14264 parsoid
14265 !!input
14266 A <ref name="x">foo</ref>
14267 B <ref name="x" />
14268 !!result
14269 <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>
14270 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>
14271 !!end
14272
14273 !!test
14274 Ref: 3. spaces in ref-names should be ignored
14275 !!options
14276 parsoid
14277 !!input
14278 A <ref name="x">foo</ref>
14279 B <ref name=" x " />
14280 C <ref name= x />
14281 !!result
14282 <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>
14283 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>
14284 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>
14285 !!end
14286
14287 !!test
14288 Ref: 4. 'constructor' should be accepted as a valid ref-name
14289 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
14290 !!options
14291 parsoid
14292 !!input
14293 A <ref name="constructor">foo</ref>
14294 !!result
14295 <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>
14296 !!end
14297
14298 !!test
14299 Ref: 5. body should accept generic wikitext
14300 !!options
14301 parsoid
14302 !!input
14303 A <ref>
14304 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
14305 </ref>
14306
14307 <references />
14308 !!result
14309 <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>
14310
14311 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14312 <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>
14313 </li></ol>
14314 !!end
14315
14316 !!test
14317 Ref: 6. indent-pres should not be output in ref-body
14318 !!options
14319 parsoid
14320 !!input
14321 A <ref>
14322 foo
14323 bar
14324 baz
14325 </ref>
14326
14327 <references />
14328 !!result
14329 <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>
14330
14331 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14332 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
14333 bar
14334 baz
14335 </li></ol>
14336 !!end
14337
14338 !!test
14339 Ref: 6. No p-wrapping in ref-body
14340 !!options
14341 parsoid
14342 !!input
14343 A <ref>
14344 foo
14345
14346 bar
14347
14348
14349 baz
14350
14351
14352
14353 booz
14354 </ref>
14355
14356 <references />
14357 !!result
14358 <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>
14359
14360 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14361 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
14362
14363 bar
14364
14365
14366 baz
14367
14368
14369
14370 booz
14371 </li></ol>
14372 !!end
14373
14374 !!test
14375 Ref: 8. transclusion wikitext has lower precedence
14376 !!options
14377 parsoid
14378 !!input
14379 A <ref> foo {{echo|</ref> B C}}
14380
14381 <references />
14382 !!result
14383 <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>
14384
14385 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14386 <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>
14387 !!end
14388
14389 !!test
14390 Ref: 9. unclosed comments should not leak out of ref-body
14391 !!options
14392 parsoid
14393 !!input
14394 A <ref> foo <!--</ref> B C
14395
14396 <references />
14397 !!result
14398 <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>
14399
14400 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14401 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li></ol>
14402 !!end
14403
14404 !!test
14405 Ref: 10. Unclosed HTML tags should not leak out of ref-body
14406 !!options
14407 parsoid
14408 !!input
14409 A <ref> <b> foo </ref> B C
14410
14411 <references />
14412 !!result
14413 <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>
14414
14415 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14416 <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>
14417 !!end
14418
14419 !!test
14420 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
14421 !!options
14422 parsoid
14423 !!input
14424 A <ref>foo</ref> B
14425 C <ref>bar</ref> D
14426 !!result
14427 <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
14428 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>
14429 !!end
14430
14431 !!test
14432 Ref: 12. ref-tags act as trailing newline migration barrier
14433 !!options
14434 parsoid
14435 !!input
14436 <!--the newline at the end of this line moves out of the p-tag-->a
14437
14438 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
14439 <ref />
14440
14441 c
14442 !!result
14443 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
14444
14445
14446 <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>
14447 <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>
14448
14449
14450 <p>c</p>
14451 !!end
14452
14453 !!test
14454 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
14455 !!options
14456 parsoid
14457 !!input
14458 <ref>foo</ref> A
14459 <ref>bar
14460 </ref> B
14461 !!result
14462 <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
14463 <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>
14464 !!end
14465
14466 !!test
14467 Ref: 14. A nested ref-tag should be emitted as plain text
14468 !!options
14469 parsoid
14470 !!input
14471 <ref>foo <ref>bar</ref> baz</ref>
14472
14473 <references />
14474 !!result
14475 <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>
14476
14477 <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>
14478 !!end
14479
14480 !!test
14481 Ref: 15. ref-tags with identical names should get identical indexes
14482 !!options
14483 parsoid
14484 !!input
14485 A1 <ref name="a">foo</ref> A2 <ref name="a" />
14486 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
14487
14488 <references />
14489 !!result
14490 <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>
14491 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>
14492
14493 <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>
14494 !!end
14495
14496 !!test
14497 References: 1. references tag without any refs should be handled properly
14498 !!options
14499 parsoid
14500 !!input
14501 <references />
14502 !!result
14503 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"></ol>
14504 !!end
14505
14506 !!test
14507 References: 2. references tag with group only outputs references from that group
14508 !!options
14509 parsoid
14510 !!input
14511 A <ref group="a">foo</ref>
14512 B <ref group="b">bar</ref>
14513
14514 <references group='a' />
14515 !!result
14516 <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>
14517 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>
14518
14519 <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>
14520 !!end
14521
14522 !!test
14523 References: 3. ref list should be cleared after processing references
14524 !!options
14525 parsoid
14526 !!input
14527 A <ref>foo</ref>
14528
14529 <references />
14530
14531 B <ref>bar</ref>
14532
14533 <references />
14534 !!result
14535 <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>
14536
14537 <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>
14538
14539 <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>
14540
14541 <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>
14542 !!end
14543
14544 !!test
14545 References: 4. only referenced group should be cleared after processing references
14546 !!options
14547 parsoid
14548 !!input
14549 A <ref group="a">afoo</ref>
14550 B <ref>bfoo</ref>
14551
14552 <references group="a"/>
14553
14554 C <ref>cfoo</ref>
14555
14556 <references />
14557 !!result
14558 <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>
14559 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>
14560
14561 <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>
14562
14563 <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>
14564
14565 <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>
14566 !!end
14567
14568 !!test
14569 References: 5. ref tags in references should be processed while ignoring all other content
14570 !!options
14571 parsoid
14572 !!input
14573 A <ref name="a" />
14574 B <ref name="b">bar</ref>
14575
14576 <references>
14577 <ref name="a">foo</ref>
14578 This should just get lost.
14579 </references>
14580 !!result
14581 <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>
14582 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>
14583
14584 <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>
14585 !!end
14586
14587 #### ----------------------------------------------------------------
14588 #### The following section of tests are primarily to test
14589 #### wikitext escaping capabilities of Parsoid. Given that
14590 #### escaping can be done any number of ways, the wikitext (input)
14591 #### is always adjusted to reflect how Parsoid adds nowiki
14592 #### escape tags.
14593 ####
14594 #### We are marking several tests as parsoid-only since the
14595 #### HTML in the result section is different from what the
14596 #### PHP parser generates for it.
14597 #### ----------------------------------------------------------------
14598
14599
14600 #### --------------- Headings ---------------
14601 #### 0. Unnested
14602 #### 1. Nested inside html <h1>=foo=</h1>
14603 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
14604 #### 3. Nested inside html with wikitext split by html tags
14605 #### 4. No escape needed
14606 #### 5. Empty headings <h1></h1>
14607 #### 6. Heading chars in SOL context
14608 #### ----------------------------------------
14609 !! test
14610 Headings: 0. Unnested
14611 !! options
14612 parsoid
14613 !! input
14614 <nowiki>=foo=</nowiki>
14615
14616 <nowiki> =foo= </nowiki>
14617 <!--cmt-->
14618 <nowiki>=foo=</nowiki>
14619
14620 =foo''a''<nowiki>=</nowiki>
14621 !! result
14622 <p><span typeof="mw:Nowiki">=foo=</span></p>
14623
14624 <p><span typeof="mw:Nowiki"> =foo= </span>
14625 <!--cmt-->
14626 <span typeof="mw:Nowiki">=foo=</span></p>
14627
14628 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
14629 !!end
14630
14631 !! test
14632 Headings: 1. Nested inside html
14633 !! options
14634 parsoid
14635 !! input
14636 =<nowiki>=foo=</nowiki>=
14637 ==<nowiki>=foo=</nowiki>==
14638 ===<nowiki>=foo=</nowiki>===
14639 ====<nowiki>=foo=</nowiki>====
14640 =====<nowiki>=foo=</nowiki>=====
14641 ======<nowiki>=foo=</nowiki>======
14642 !! result
14643 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
14644 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
14645 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
14646 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
14647 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
14648 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
14649 !!end
14650
14651 !! test
14652 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
14653 !! options
14654 parsoid
14655 !! input
14656 =foo=
14657 <nowiki>*bar</nowiki>
14658 =foo=
14659 =bar
14660 =foo=
14661 <nowiki>=bar=</nowiki>
14662 !! result
14663 <h1>foo</h1>*bar
14664 <h1>foo</h1>=bar
14665 <h1>foo</h1>=bar=
14666 !!end
14667
14668 !! test
14669 Headings: 3. Nested inside html with wikitext split by html tags
14670 !! options
14671 parsoid
14672 !! input
14673 =='''bold'''<nowiki>foo=</nowiki>=
14674 !! result
14675 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
14676 !!end
14677
14678 !! test
14679 Headings: 4a. No escaping needed (testing just h1 and h2)
14680 !! options
14681 parsoid
14682 !! input
14683 ==foo=
14684 =foo==
14685 = =foo= =
14686 ==foo= bar=
14687 ===foo==
14688 ==foo===
14689 =''=''foo==
14690 =<nowiki>=</nowiki>=
14691 !! result
14692 <h1>=foo</h1>
14693 <h1>foo=</h1>
14694 <h1> =foo= </h1>
14695 <h1>=foo= bar</h1>
14696 <h2>=foo</h2>
14697 <h2>foo=</h2>
14698 <h1><i>=</i>foo=</h1>
14699 <h1><span typeof="mw:Nowiki">=</span></h1>
14700 !!end
14701
14702 !! test
14703 Headings: 4b. No escaping needed (inside p-tags)
14704 !! options
14705 parsoid
14706 !! input
14707 ===
14708 =foo= x
14709 =foo= <s></s>
14710 !! result
14711 <p>===
14712 =foo= x
14713 =foo= <s></s>
14714 </p>
14715 !!end
14716
14717 !! test
14718 Headings: 5. Empty headings
14719 !! options
14720 parsoid
14721 !! input
14722 =<nowiki/>=
14723 ==<nowiki/>==
14724 ===<nowiki/>===
14725 ====<nowiki/>====
14726 =====<nowiki/>=====
14727 ======<nowiki/>======
14728 !! result
14729 <h1></h1>
14730 <h2></h2>
14731 <h3></h3>
14732 <h4></h4>
14733 <h5></h5>
14734 <h6></h6>
14735 !!end
14736
14737 !! test
14738 Headings: 6a. Heading chars in SOL context (with trailing spaces)
14739 !! options
14740 parsoid
14741 !! input
14742 <nowiki>=a=</nowiki>
14743
14744 <nowiki>=a= </nowiki>
14745
14746 <nowiki>=a= </nowiki>
14747
14748 <nowiki>=a= </nowiki>
14749 !! result
14750 <p>=a=</p>
14751 <p>=a= </p>
14752 <p>=a= </p>
14753 <p>=a= </p>
14754 !!end
14755
14756 !! test
14757 Headings: 6b. Heading chars in SOL context (with trailing newlines)
14758 !! options
14759 parsoid
14760 !! input
14761 <nowiki>=a=
14762 b</nowiki>
14763
14764 <nowiki>=a=
14765 b</nowiki>
14766
14767 <nowiki>=a=
14768 b</nowiki>
14769
14770 <nowiki>=a=
14771 b</nowiki>
14772 !! result
14773 <p>=a=
14774 b</p>
14775 <p>=a=
14776 b</p>
14777 <p>=a=
14778 b</p>
14779 <p>=a=
14780 b</p>
14781 </p>
14782 !!end
14783
14784 !! test
14785 Headings: 6c. Heading chars in SOL context (leading newline break)
14786 !! options
14787 parsoid
14788 !! input
14789 <nowiki>a
14790 =b=</nowiki>
14791 !! result
14792 <p>a
14793 =b=</p>
14794 !!end
14795
14796 !! test
14797 Headings: 6d. Heading chars in SOL context (with interspersed comments)
14798 !! options
14799 parsoid
14800 !! input
14801 <!--c0--><nowiki>=a=</nowiki>
14802 <!--c1-->
14803 <nowiki>=a= </nowiki><!--c2--> <!--c3-->
14804 !! result
14805 <p><!--c0-->=a=</p>
14806 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
14807 !!end
14808
14809 !! test
14810 Headings: 6d. Heading chars in SOL context (No escaping needed)
14811 !! options
14812 parsoid=html2wt
14813 !! input
14814 =a=<div>b</div>
14815 !! result
14816 =a=<div>b</div>
14817 !!end
14818
14819 #### --------------- Lists ---------------
14820 #### 0. Outside nests (*foo, etc.)
14821 #### 1. Nested inside html <ul><li>*foo</li></ul>
14822 #### 2. Inside definition lists
14823 #### 3. Only bullets at start should be escaped
14824 #### 4. No escapes needed
14825 #### 5. No unnecessary escapes
14826 #### 6. Escape bullets in SOL position
14827 #### 7. Escape bullets in a multi-line context
14828 #### ----------------------------------------
14829
14830 !! test
14831 Lists: 0. Outside nests
14832 !! input
14833 <nowiki>*foo</nowiki>
14834
14835 <nowiki>#foo</nowiki>
14836 !! result
14837 <p>*foo
14838 </p><p>#foo
14839 </p>
14840 !!end
14841
14842 !! test
14843 Lists: 1. Nested inside html
14844 !! input
14845 *<nowiki>*foo</nowiki>
14846
14847 *<nowiki>#foo</nowiki>
14848
14849 *<nowiki>:foo</nowiki>
14850
14851 *<nowiki>;foo</nowiki>
14852
14853 #<nowiki>*foo</nowiki>
14854
14855 #<nowiki>#foo</nowiki>
14856
14857 #<nowiki>:foo</nowiki>
14858
14859 #<nowiki>;foo</nowiki>
14860 !! result
14861 <ul><li>*foo
14862 </li></ul>
14863 <ul><li>#foo
14864 </li></ul>
14865 <ul><li>:foo
14866 </li></ul>
14867 <ul><li>;foo
14868 </li></ul>
14869 <ol><li>*foo
14870 </li></ol>
14871 <ol><li>#foo
14872 </li></ol>
14873 <ol><li>:foo
14874 </li></ol>
14875 <ol><li>;foo
14876 </li></ol>
14877
14878 !!end
14879
14880 !! test
14881 Lists: 2. Inside definition lists
14882 !! input
14883 ;<nowiki>;foo</nowiki>
14884
14885 ;<nowiki>:foo</nowiki>
14886
14887 ;<nowiki>:foo</nowiki>
14888 :bar
14889
14890 :<nowiki>:foo</nowiki>
14891 !! result
14892 <dl><dt>;foo
14893 </dt></dl>
14894 <dl><dt>:foo
14895 </dt></dl>
14896 <dl><dt>:foo
14897 </dt><dd>bar
14898 </dd></dl>
14899 <dl><dd>:foo
14900 </dd></dl>
14901
14902 !!end
14903
14904 !! test
14905 Lists: 3. Only bullets at start of text should be escaped
14906 !! input
14907 *<nowiki>*foo*bar</nowiki>
14908
14909 *<nowiki>*foo</nowiki>''it''*bar
14910 !! result
14911 <ul><li>*foo*bar
14912 </li></ul>
14913 <ul><li>*foo<i>it</i>*bar
14914 </li></ul>
14915
14916 !!end
14917
14918 !! test
14919 Lists: 4. No escapes needed
14920 !! options
14921 parsoid
14922 !! input
14923 *foo*bar
14924
14925 *''foo''*bar
14926
14927 *[[Foo]]: bar
14928 !! result
14929 <ul><li>foo*bar
14930 </li></ul>
14931 <ul><li><i>foo</i>*bar
14932 </li></ul>
14933 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
14934 </li></ul>
14935 !!end
14936
14937 !! test
14938 Lists: 5. No unnecessary escapes
14939 !! input
14940 * bar <span><nowiki>[[foo]]</nowiki></span>
14941
14942 *=bar <span><nowiki>[[foo]]</nowiki></span>
14943
14944 *[[bar <span><nowiki>[[foo]]</nowiki></span>
14945
14946 *]]bar <span><nowiki>[[foo]]</nowiki></span>
14947
14948 *=bar <span>foo]]</span>=
14949
14950 * <s></s>: a
14951 !! result
14952 <ul><li> bar <span>[[foo]]</span>
14953 </li></ul>
14954 <ul><li>=bar <span>[[foo]]</span>
14955 </li></ul>
14956 <ul><li>[[bar <span>[[foo]]</span>
14957 </li></ul>
14958 <ul><li>]]bar <span>[[foo]]</span>
14959 </li></ul>
14960 <ul><li>=bar <span>foo]]</span>=
14961 </li></ul>
14962 <ul><li> <s></s>: a
14963 </li></ul>
14964
14965 !!end
14966
14967 !! test
14968 Lists: 6. Escape bullets in SOL position
14969 !! options
14970 parsoid
14971 !! input
14972 <!--cmt--><nowiki>*foo</nowiki>
14973 !! result
14974 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
14975 !!end
14976
14977 !! test
14978 Lists: 7. Escape bullets in a multi-line context
14979 !! input
14980 <nowiki>a
14981 *b</nowiki>
14982 !! result
14983 <p>a
14984 *b
14985 </p>
14986 !!end
14987
14988 #### --------------- HRs ---------------
14989 #### 1. Single line
14990 #### -----------------------------------
14991
14992 !! test
14993 HRs: 1. Single line
14994 !! options
14995 parsoid
14996 !! input
14997 ----<nowiki>----</nowiki>
14998 ----=foo=
14999 ----*foo
15000 !! result
15001 <hr><span typeof="mw:Nowiki">----</span>
15002 <hr>=foo=
15003 <hr>*foo
15004 !! end
15005
15006 #### --------------- Tables ---------------
15007 #### 1a. Simple example
15008 #### 1b. No escaping needed (!foo)
15009 #### 1c. No escaping needed (|foo)
15010 #### 1d. No escaping needed (|}foo)
15011 ####
15012 #### 2a. Nested in td (<td>foo|bar</td>)
15013 #### 2b. Nested in td (<td>foo||bar</td>)
15014 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
15015 ####
15016 #### 3a. Nested in th (<th>foo!bar</th>)
15017 #### 3b. Nested in th (<th>foo!!bar</th>)
15018 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
15019 ####
15020 #### 4a. Escape -
15021 #### 4b. Escape +
15022 #### 4c. No escaping needed
15023 #### --------------------------------------
15024
15025 !! test
15026 Tables: 1a. Simple example
15027 !! input
15028 <nowiki>{|
15029 |}</nowiki>
15030 !! result
15031 <p>{|
15032 |}
15033 </p>
15034 !! end
15035
15036 !! test
15037 Tables: 1b. No escaping needed
15038 !! input
15039 !foo
15040 !! result
15041 <p>!foo
15042 </p>
15043 !! end
15044
15045 !! test
15046 Tables: 1c. No escaping needed
15047 !! input
15048 |foo
15049 !! result
15050 <p>|foo
15051 </p>
15052 !! end
15053
15054 !! test
15055 Tables: 1d. No escaping needed
15056 !! input
15057 |}foo
15058 !! result
15059 <p>|}foo
15060 </p>
15061 !! end
15062
15063 !! test
15064 Tables: 2a. Nested in td
15065 !! options
15066 parsoid
15067 !! input
15068 {|
15069 |<nowiki>foo|bar</nowiki>
15070 |}
15071 !! result
15072 <table><tbody><tr>
15073 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
15074 !! end
15075
15076 !! test
15077 Tables: 2b. Nested in td
15078 !! options
15079 parsoid
15080 !! input
15081 {|
15082 |<nowiki>foo||bar</nowiki>
15083 |''it''<nowiki>foo||bar</nowiki>
15084 |}
15085 !! result
15086 <table><tbody><tr>
15087 <td><span typeof="mw:Nowiki">foo||bar</span></td>
15088 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
15089 !! end
15090
15091 !! test
15092 Tables: 2c. Nested in td -- no escaping needed
15093 !! options
15094 parsoid
15095 !! input
15096 {|
15097 |foo!!bar
15098 |}
15099 !! result
15100 <table><tbody><tr><td>foo!!bar
15101 </td></tr></tbody></table>
15102
15103 !! end
15104
15105 !! test
15106 Tables: 3a. Nested in th
15107 !! options
15108 parsoid
15109 !! input
15110 {|
15111 !foo!bar
15112 |}
15113 !! result
15114 <table><tbody><tr><th>foo!bar
15115 </th></tr></tbody></table>
15116
15117 !! end
15118
15119 !! test
15120 Tables: 3b. Nested in th
15121 !! options
15122 parsoid
15123 !! input
15124 {|
15125 !<nowiki>foo!!bar</nowiki>
15126 |}
15127 !! result
15128 <table>
15129 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
15130 </tbody></table>
15131 !! end
15132
15133 !! test
15134 Tables: 3c. Nested in th -- no escaping needed
15135 !! options
15136 parsoid
15137 !! input
15138 {|
15139 !<nowiki>foo||bar</nowiki>
15140 |}
15141 !! result
15142 <table><tbody><tr>
15143 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
15144 !! end
15145
15146 !! test
15147 Tables: 4a. Escape -
15148 !! options
15149 parsoid
15150 !! input
15151 {|
15152 |-
15153 !-bar
15154 |-
15155 |<nowiki>-bar</nowiki>
15156 |}
15157 !! result
15158 <table><tbody>
15159 <tr><th>-bar</th></tr>
15160 <tr>
15161 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
15162 !! end
15163
15164 !! test
15165 Tables: 4b. Escape +
15166 !! options
15167 parsoid
15168 !! input
15169 {|
15170 |-
15171 !+bar
15172 |-
15173 |<nowiki>+bar</nowiki>
15174 |}
15175 !! result
15176 <table><tbody>
15177 <tr><th>+bar</th></tr>
15178 <tr>
15179 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
15180 !! end
15181
15182 !! test
15183 Tables: 4c. No escaping needed
15184 !! options
15185 parsoid
15186 !! input
15187 {|
15188 |-
15189 |foo-bar
15190 |foo+bar
15191 |-
15192 |''foo''-bar
15193 |''foo''+bar
15194 |}
15195 !! result
15196 <table><tbody>
15197 <tr><td>foo-bar</td><td>foo+bar</td></tr>
15198 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
15199 </tbody></table>
15200 !! end
15201
15202 ### SSS FIXME: Disabled right now because accurate html2wt
15203 ### on this snippet requires data-parsoid flags that we've
15204 ### stripped out of these tests. We should scheme how we
15205 ### we want to handle these kind of tests that require
15206 ### data-parsoid flags for accurate html2wt serialization
15207
15208 !! test
15209 Tables: 4d. No escaping needed
15210 !! options
15211 disabled
15212 !! input
15213 {|
15214 ||+1
15215 ||-2
15216 |}
15217 !! result
15218 <table>
15219 <tr>
15220 <td>+1
15221 </td>
15222 <td>-2
15223 </td></tr></table>
15224
15225 !! end
15226
15227 #### --------------- Links ----------------
15228 #### 1. Quote marks in link text
15229 #### 2. Wikilinks: Escapes needed
15230 #### 3. Wikilinks: No escapes needed
15231 #### 4. Extlinks: Escapes needed
15232 #### 5. Extlinks: No escapes needed
15233 #### --------------------------------------
15234 !! test
15235 Links 1. Quote marks in link text
15236 !! options
15237 parsoid
15238 !! input
15239 [[Foo|<nowiki>Foo''boo''</nowiki>]]
15240 !! result
15241 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
15242 !! end
15243
15244 !! test
15245 Links 2. WikiLinks: Escapes needed
15246 !! options
15247 parsoid
15248 !! input
15249 [[Foo|<nowiki>[Foobar]</nowiki>]]
15250 [[Foo|<nowiki>Foobar]</nowiki>]]
15251 [[Foo|x [Foobar] x]]
15252 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
15253 [[Foo|<nowiki>[[Bar]]</nowiki>]]
15254 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
15255 [[Foo|<nowiki>|Bar</nowiki>]]
15256 [[Foo|<nowiki>]]bar</nowiki>]]
15257 [[Foo|<nowiki>[[bar</nowiki>]]
15258 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
15259 !! result
15260 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
15261 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
15262 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
15263 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
15264 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
15265 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
15266 <a href="Foo" rel="mw:WikiLink">|Bar</a>
15267 <a href="Foo" rel="mw:WikiLink">]]bar</a>
15268 <a href="Foo" rel="mw:WikiLink">[[bar</a>
15269 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
15270 !! end
15271
15272 !! test
15273 Links 3. WikiLinks: No escapes needed
15274 !! options
15275 parsoid
15276 !! input
15277 [[Foo|[Foobar]]
15278 [[Foo|foo|bar]]
15279 !! result
15280 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
15281 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
15282 !! end
15283
15284 !! test
15285 Links 4. ExtLinks: Escapes needed
15286 !! options
15287 parsoid
15288 !! input
15289 [http://google.com <nowiki>[google]</nowiki>]
15290 [http://google.com <nowiki>google]</nowiki>]
15291 !! result
15292 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
15293 <a href="http://google.com" rel="mw:ExtLink">google]</a>
15294 !! end
15295
15296 !! test
15297 Links 5. ExtLinks: No escapes needed
15298 !! options
15299 parsoid
15300 !! input
15301 [http://google.com [google]
15302 !! result
15303 <a href="http://google.com" rel="mw:ExtLink">[google</a>
15304 !! end
15305
15306 #### --------------- Quotes ---------------
15307 #### 1. Quotes inside <b> and <i>
15308 #### 2. Link fragments separated by <i> and <b> tags
15309 #### 3. Link fragments inside <i> and <b>
15310 #### --------------------------------------
15311 !! test
15312 1. Quotes inside <b> and <i>
15313 !! input
15314 ''<nowiki>'foo'</nowiki>''
15315 ''<nowiki>''foo''</nowiki>''
15316 ''<nowiki>'''foo'''</nowiki>''
15317 ''foo''<nowiki>'s</nowiki>
15318 '''<nowiki>'foo'</nowiki>'''
15319 '''<nowiki>''foo''</nowiki>'''
15320 '''<nowiki>'''foo'''</nowiki>'''
15321 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
15322 '''foo'''<nowiki>'s</nowiki>
15323 !! result
15324 <p><i>'foo'</i>
15325 <i>''foo''</i>
15326 <i>'''foo'''</i>
15327 <i>foo</i>'s
15328 <b>'foo'</b>
15329 <b>''foo''</b>
15330 <b>'''foo'''</b>
15331 <b>foo'<i>bar'</i>baz</b>
15332 <b>foo</b>'s
15333 </p>
15334 !! end
15335
15336 !! test
15337 2. Link fragments separated by <i> and <b> tags
15338 !! input
15339 [[''foo''<nowiki>hello]]</nowiki>
15340
15341 [['''foo'''<nowiki>hello]]</nowiki>
15342 !! result
15343 <p>[[<i>foo</i>hello]]
15344 </p><p>[[<b>foo</b>hello]]
15345 </p>
15346 !! end
15347
15348 !! test
15349 2. Link fragments inside <i> and <b>
15350 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
15351 this is one of the shortcomings of this format)
15352 !! input
15353 ''[[foo''<nowiki>]]</nowiki>
15354
15355 '''[[foo'''<nowiki>]]</nowiki>
15356 !! result
15357 <p><i>[[foo</i>]]
15358 </p><p><b>[[foo</b>]]
15359 </p>
15360 !! end
15361
15362 #### ----------- Paragraphs ---------------
15363 #### 1. No unnecessary escapes
15364 #### --------------------------------------
15365
15366 !! test
15367 1. No unnecessary escapes
15368 !! input
15369 bar <span><nowiki>[[foo]]</nowiki></span>
15370
15371 =bar <span><nowiki>[[foo]]</nowiki></span>
15372
15373 [[bar <span><nowiki>[[foo]]</nowiki></span>
15374
15375 ]]bar <span><nowiki>[[foo]]</nowiki></span>
15376
15377 =bar <span>foo]]</span><nowiki>=</nowiki>
15378 !! result
15379 <p>bar <span>[[foo]]</span>
15380 </p><p>=bar <span>[[foo]]</span>
15381 </p><p>[[bar <span>[[foo]]</span>
15382 </p><p>]]bar <span>[[foo]]</span>
15383 </p><p>=bar <span>foo]]</span>=
15384 </p>
15385 !!end
15386
15387 #### ----------------------- PRE --------------------------
15388 #### 1. Leading whitespace in SOL context should be escaped
15389 #### ------------------------------------------------------
15390 !! test
15391 1. Leading whitespace in SOL context should be escaped
15392 !! options
15393 parsoid
15394 !! input
15395 <nowiki> a</nowiki>
15396
15397 <nowiki> a</nowiki>
15398
15399 <nowiki> a(tab)</nowiki>
15400
15401 <nowiki> a</nowiki>
15402 <!--cmt-->
15403 <nowiki> a</nowiki>
15404
15405 <nowiki>a
15406 b</nowiki>
15407
15408 <nowiki>a
15409 b</nowiki>
15410
15411 <nowiki>a
15412 b</nowiki>
15413 !! result
15414 <p> a</p>
15415 <p> a</p>
15416 <p> a(tab)</p>
15417 <p> a</p>
15418 <p><!--cmt--> a</p>
15419 <p>a
15420 b</p>
15421 <p>a
15422 b</p>
15423 <p>a
15424 b</p>
15425 !! end
15426
15427 #### --------------- HTML tags ---------------
15428 #### 1. a tags
15429 #### 2. other tags
15430 #### 3. multi-line html tag
15431 #### -----------------------------------------
15432 !! test
15433 1. a tags
15434 !! options
15435 parsoid
15436 !! input
15437 <a href="http://google.com">google</a>
15438 !! result
15439 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
15440 !! end
15441
15442 !! test
15443 2. other tags
15444 !! input
15445 <nowiki><div>foo</div>
15446 <div style="color:red">foo</div></nowiki>
15447 !! result
15448 <p>&lt;div&gt;foo&lt;/div&gt;
15449 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
15450 </p>
15451 !! end
15452
15453 !! test
15454 3. multi-line html tag
15455 !! input
15456 <nowiki><div
15457 >foo</div
15458 ></nowiki>
15459 !! result
15460 <p>&lt;div
15461 &gt;foo&lt;/div
15462 &gt;
15463 </p>
15464 !! end
15465
15466 #### --------------- Others ---------------
15467 !! test
15468 Escaping nowikis
15469 !! input
15470 &lt;nowiki&gt;foo&lt;/nowiki&gt;
15471 !! result
15472 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
15473 </p>
15474 !! end
15475 !! test
15476
15477 Tag-like HTML structures are passed through as text
15478 !! input
15479 <x y>
15480
15481 <x.y>
15482
15483 <x-y>
15484
15485 1>2
15486
15487 x<y
15488
15489 a>b
15490
15491 1<d e>f
15492 !! result
15493 <p>&lt;x y&gt;
15494 </p><p>&lt;x.y&gt;
15495 </p><p>&lt;x-y&gt;
15496 </p><p>1&gt;2
15497 </p><p>x&lt;y
15498 </p><p>a&gt;b
15499 </p><p>1&lt;d e&gt;f
15500 </p>
15501 !! end
15502
15503
15504 # This fails in the PHP parser (see bug 40670,
15505 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
15506 !! test
15507 Tag names followed by punctuation should not be recognized as tags
15508 !! options
15509 parsoid
15510 !! input
15511 <s.ome> text
15512 !! result
15513 <p>&lt;s.ome&gt; text
15514 </p>
15515 !! end
15516
15517 !! test
15518 HTML tag with necessary entities in attributes
15519 !! input
15520 <span title="&amp;amp;">foo</span>
15521 !! result
15522 <p><span title="&amp;amp;">foo</span>
15523 </p>
15524 !! end
15525
15526 !! test
15527 HTML tag with 'unnecessary' entity encoding in attributes
15528 !! input
15529 <span title="&amp;">foo</span>
15530 !! result
15531 <p><span title="&amp;">foo</span>
15532 </p>
15533 !! end
15534
15535 !! test
15536 HTML tag with broken attribute value quoting
15537 !! input
15538 <span title="Hello world>Foo</span>
15539 !! result
15540 <p><span>Foo</span>
15541 </p>
15542 !! end
15543
15544 !! test
15545 Parsoid-only: HTML tag with broken attribute value quoting
15546 !! options
15547 parsoid
15548 !! input
15549 <span title="Hello world>Foo</span>
15550 !! result
15551 <p><span title="Hello world">Foo</span>
15552 </p>
15553 !! end
15554
15555 !! test
15556 Table with broken attribute value quoting
15557 !! input
15558 {|
15559 | title="Hello world|Foo
15560 |}
15561 !! result
15562 <table>
15563 <tr>
15564 <td>Foo
15565 </td></tr></table>
15566
15567 !! end
15568
15569 !! test
15570 Table with broken attribute value quoting on consecutive lines
15571 !! input
15572 {|
15573 | title="Hello world|Foo
15574 | style="color:red|Bar
15575 |}
15576 !! result
15577 <table>
15578 <tr>
15579 <td>Foo
15580 </td>
15581 <td>Bar
15582 </td></tr></table>
15583
15584 !! end
15585
15586 !! test
15587 Parsoid-only: Table with broken attribute value quoting on consecutive lines
15588 !! options
15589 parsoid
15590 !! input
15591 {|
15592 | title="Hello world|Foo
15593 | style="color:red|Bar
15594 |}
15595 !! result
15596 <table><tbody>
15597 <tr>
15598 <td title="Hello world">Foo
15599 </td><td style="color: red">Bar
15600 </td></tr></tbody></table>
15601
15602 !! end
15603
15604 !! test
15605 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
15606 !! options
15607 parsoid
15608 !! input
15609 {{}}
15610 !! result
15611 {{}}
15612 !! end
15613
15614 !! test
15615 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
15616 !! options
15617 parsoid
15618 !! input
15619 }}{{
15620 !! result
15621 }}{{
15622 !! end
15623
15624 !!test
15625 Accept empty td cell attribute
15626 !!input
15627 {|
15628 | align="center" | foo || |
15629 |}
15630 !!result
15631 <table>
15632 <tr>
15633 <td align="center"> foo </td>
15634 <td>
15635 </td></tr></table>
15636
15637 !!end
15638
15639 !!test
15640 Non-empty attributes in th-cells
15641 !!input
15642 {|
15643 ! Foo !! style="color: red" | Bar
15644 |}
15645 !!result
15646 <table>
15647 <tr>
15648 <th> Foo </th>
15649 <th style="color: red"> Bar
15650 </th></tr></table>
15651
15652 !!end
15653
15654 !!test
15655 Accept empty attributes in th-cells
15656 !!input
15657 {|
15658 !| foo !!| bar
15659 |}
15660 !!result
15661 <table>
15662 <tr>
15663 <th> foo </th>
15664 <th> bar
15665 </th></tr></table>
15666
15667 !!end
15668
15669 !!test
15670 Empty table rows go away
15671 !!input
15672 {|
15673 | Hello
15674 | there
15675 |- class="foo"
15676 |-
15677 |}
15678 !! result
15679 <table>
15680 <tr>
15681 <td> Hello
15682 </td>
15683 <td> there
15684 </td></tr>
15685
15686 </table>
15687
15688 !! end
15689
15690 ###
15691 ### Parsoid-centric tests for testing RTing of inter-element separators
15692 ### Edge cases not tested by existing parser tests and specific to
15693 ### Parsoid-specific serialization strategies.
15694 ###
15695
15696 !!test
15697 RT-ed inter-element separators should be valid separators
15698 !!input
15699 {|
15700 |- [[foo]]
15701 |}
15702 !!result
15703 <table>
15704
15705 </table>
15706
15707 !!end
15708
15709 !!test
15710 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
15711 (Parsoid-only since PHP parser relies on Tidy for correct output)
15712 !!options
15713 parsoid
15714 !!input
15715 {|
15716 |<small>foo
15717 bar
15718 |}
15719
15720 {|
15721 |<small>foo<small>
15722 |}
15723 !!result
15724 !!end
15725
15726 !!test
15727 Empty TD followed by TD with tpl-generated attribute
15728 !!input
15729 {|
15730 |-
15731 |
15732 |{{echo|style='color:red'}}|foo
15733 |}
15734 !!result
15735 <table>
15736
15737 <tr>
15738 <td>
15739 </td>
15740 <td>foo
15741 </td></tr></table>
15742
15743 !!end
15744
15745 !!test
15746 Indented table with an empty td
15747 !!input
15748 {|
15749 |-
15750 |
15751 |foo
15752 |}
15753 !!result
15754 <table>
15755
15756 <tr>
15757 <td>
15758 </td>
15759 <td>foo
15760 </td></tr></table>
15761
15762 !!end
15763
15764 !!test
15765 Empty TR followed by a template-generated TR
15766 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
15767 !!options
15768 parsoid=wt2html,wt2wt
15769 !!input
15770 {|
15771 |-
15772 {{echo|<tr><td>foo</td></tr>}}
15773 |}
15774 !!result
15775 <table>
15776 <tbody>
15777 <tr></tr>
15778 <tr typeof="mw:Transclusion">
15779 <td>foo</td></tr></tbody></table>
15780 !!end
15781
15782 ## PHP and parsoid output differ for this, and since this is primarily
15783 ## for testing Parsoid's serializer, marking this Parsoid only
15784 !!test
15785 Empty TR followed by mixed-ws-comment line should RT correctly
15786 !!options
15787 parsoid
15788 !!input
15789 {|
15790 |-
15791 <!--c-->
15792 |-
15793 <!--c--> <!--d-->
15794 |}
15795 !!result
15796 <table>
15797 <tbody>
15798 <tr>
15799 <td> <!--c--></td></tr>
15800 <tr>
15801 <td><!--c--> <!--d--></td></tr>
15802 </tbody></table>
15803
15804 !!end
15805
15806 !!test
15807 Multi-line image caption generated by templates with/without trailing newlines
15808 !!options
15809 parsoid
15810 !!input
15811 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
15812 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
15813 !!result
15814 <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>
15815 <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>
15816
15817 !!end
15818
15819 ## PHP emits broken html for this, and since this is primarily
15820 ## a Parsoid serializer test, marking this Parsoid only
15821 !!test
15822 Improperly nested inline or quotes tags with whitespace in between
15823 !!options
15824 parsoid
15825 !!input
15826 <span> <s>x</span> </s>
15827 ''' ''x''' ''
15828 !!result
15829 <p><span> <s>x</s></span><s> </s>
15830 <b> <i>x</i></b><i> </i>
15831 </p>
15832 !!end
15833
15834 TODO:
15835 more images
15836 more tables
15837 character entities
15838 and much more
15839 Try for 100% code coverage