Add wgAllowExternalImages option to parser tests.
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-only test (not run by PHP parser)
25 # php php-only test (not run by the parsoid parser)
26 # showtitle make the first line the title
27 # comment run through Linker::formatComment() instead of main parser
28 # local format section links in edit comment text as local links
29 #
30 # You can also set the following parser properties via test options:
31 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
32 # wgLinkHolderBatchSize, wgRawHtml
33 #
34 # For testing purposes, temporary articles can created:
35 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
36 # where '/' denotes a newline.
37
38 # This is the standard article assumed to exist.
39 !! article
40 Main Page
41 !! text
42 blah blah
43 !! endarticle
44
45 !!article
46 Template:Foo
47 !!text
48 FOO
49 !!endarticle
50
51 !! article
52 Template:Blank
53 !! text
54 !! endarticle
55
56 !! article
57 Template:pipe
58 !! text
59 |
60 !! endarticle
61
62 !!article
63 MediaWiki:bad image list
64 !!text
65 * [[File:Bad.jpg]] except [[Nasty page]]
66 !!endarticle
67
68 !! article
69 Template:inner list
70 !! text
71 * item 1
72 !! endarticle
73
74 !! article
75 Template:tbl-start
76 !! text
77 {|
78 !! endarticle
79
80 !! article
81 Template:tbl-end
82 !! text
83 |}
84 !! endarticle
85
86 !! article
87 Template:!
88 !! text
89 |
90 !! endarticle
91
92 !! article
93 Template:echo
94 !! text
95 {{{1}}}
96 !! endarticle
97
98 !! article
99 Template:echo_with_span
100 !! text
101 <span>{{{1}}}</span>
102 !! endarticle
103
104 !! article
105 Template:echo_with_div
106 !! text
107 <div>{{{1}}}</div>
108 !! endarticle
109
110 !! article
111 Template:attr_str
112 !! text
113 {{{1}}}="{{{2}}}"
114 !! endarticle
115
116 !! article
117 Template:table_attribs
118 !! text
119 <noinclude>
120 |</noinclude>style="color: red"| Foo
121 !! endarticle
122
123 !! article
124 A?b
125 !! text
126 Weirdo titles!
127 !! endarticle
128
129 ###
130 ### Basic tests
131 ###
132 !! test
133 Blank input
134 !! input
135 !! result
136 !! end
137
138
139 !! test
140 Simple paragraph
141 !! input
142 This is a simple paragraph.
143 !! result
144 <p>This is a simple paragraph.
145 </p>
146 !! end
147
148 !! test
149 Paragraphs with extra newline spacing
150 !! input
151 foo
152
153 bar
154
155
156 baz
157
158
159
160 booz
161 !! result
162 <p>foo
163 </p><p>bar
164 </p><p><br />
165 baz
166 </p><p><br />
167 </p><p>booz
168 </p>
169 !! end
170
171 !! test
172 Paragraphs with newline spacing with comment lines in between
173 !! input
174 ----
175 a
176 <!--foo-->
177 b
178 ----
179 a
180 <!--foo--><!--More than 1 comment disables stripping of this line!-->
181 b
182 ----
183 a
184 <!--foo-->
185
186 b
187 ----
188 a
189
190 <!--foo-->
191 b
192 ----
193 a
194 <!--foo-->
195
196
197 b
198 ----
199 a
200
201
202 <!--foo-->
203 b
204 ----
205 !! result
206 <hr />
207 <p>a
208 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>b
221 </p>
222 <hr />
223 <p>a
224 </p><p><br />
225 b
226 </p>
227 <hr />
228 <p>a
229 </p><p><br />
230 b
231 </p>
232 <hr />
233
234 !! end
235
236 !! test
237 Paragraphs with newline spacing with non-empty white-space lines in between
238 !! input
239 ----
240 a
241
242 b
243 ----
244 a
245
246
247 b
248 ----
249 !! result
250 <hr />
251 <p>a
252 </p><p>b
253 </p>
254 <hr />
255 <p>a
256 </p><p><br />
257 b
258 </p>
259 <hr />
260
261 !! end
262
263 !! test
264 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
265 !! input
266 ----
267 a
268 <!--foo-->
269 b
270 ----
271 a
272 <!--foo--><!--More than 1 comment disables stripping of this line!-->
273 b
274 ----
275 a
276
277 <!--foo-->
278 <!--bar-->
279 b
280 ----
281 a
282
283 <!--foo-->
284 <!--bar-->
285
286 b
287 ----
288 !! result
289 <hr />
290 <p>a
291 b
292 </p>
293 <hr />
294 <p>a
295 </p><p>b
296 </p>
297 <hr />
298 <p>a
299 </p><p>b
300 </p>
301 <hr />
302 <p>a
303 </p><p><br />
304 b
305 </p>
306 <hr />
307
308 !! end
309
310 !! test
311 Extra newlines: More paragraphs with indented comment
312 !! input
313 a
314
315 <!--boo-->
316
317 b
318 !!result
319 <p>a
320 </p><p><br />
321 b
322 </p>
323 !!end
324
325 !! test
326 Extra newlines followed by heading
327 !! input
328 a
329
330
331
332 =b=
333 [[a]]
334
335
336 =b=
337 !! result
338 <p>a
339 </p><p><br />
340 </p>
341 <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>
342 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
343 </p><p><br />
344 </p>
345 <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>
346
347 !! end
348
349 !! test
350 Extra newlines between heading and content are swallowed
351 !! input
352 =b=
353
354
355
356 [[a]]
357 !! result
358 <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>
359 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
360 </p>
361 !! end
362
363 !! test
364 Parsing an URL
365 !! input
366 http://fr.wikipedia.org/wiki/🍺
367 <!-- EasterEgg we love beer, better be able be able to link to it -->
368 !! result
369 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
370 </p>
371 !! end
372
373 !! test
374 Simple list
375 !! input
376 * Item 1
377 * Item 2
378 !! result
379 <ul><li> Item 1
380 </li><li> Item 2
381 </li></ul>
382
383 !! end
384
385 !! test
386 Italics and bold
387 !! input
388 * plain
389 * plain''italic''plain
390 * plain''italic''plain''italic''plain
391 * plain'''bold'''plain
392 * plain'''bold'''plain'''bold'''plain
393 * plain''italic''plain'''bold'''plain
394 * plain'''bold'''plain''italic''plain
395 * plain''italic'''bold-italic'''italic''plain
396 * plain'''bold''bold-italic''bold'''plain
397 * plain'''''bold-italic'''italic''plain
398 * plain'''''bold-italic''bold'''plain
399 * plain''italic'''bold-italic'''''plain
400 * plain'''bold''bold-italic'''''plain
401 * plain l'''italic''plain
402 * plain l''''bold''' plain
403 !! result
404 <ul><li> plain
405 </li><li> plain<i>italic</i>plain
406 </li><li> plain<i>italic</i>plain<i>italic</i>plain
407 </li><li> plain<b>bold</b>plain
408 </li><li> plain<b>bold</b>plain<b>bold</b>plain
409 </li><li> plain<i>italic</i>plain<b>bold</b>plain
410 </li><li> plain<b>bold</b>plain<i>italic</i>plain
411 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
412 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
413 </li><li> plain<i><b>bold-italic</b>italic</i>plain
414 </li><li> plain<b><i>bold-italic</i>bold</b>plain
415 </li><li> plain<i>italic<b>bold-italic</b></i>plain
416 </li><li> plain<b>bold<i>bold-italic</i></b>plain
417 </li><li> plain l'<i>italic</i>plain
418 </li><li> plain l'<b>bold</b> plain
419 </li></ul>
420
421 !! end
422
423 # this example taken from the simple/Moon article
424 !! test
425 Italics and possessives
426 !! input
427 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
428 !! result
429 <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
430 </p>
431 !! end
432
433 ###
434 ### 2-quote opening sequence tests
435 ###
436 !! test
437 Italics and bold: 2-quote opening sequence: (2,2)
438 !! input
439 ''foo''
440 !! result
441 <p><i>foo</i>
442 </p>
443 !!end
444
445
446 !! test
447 Italics and bold: 2-quote opening sequence: (2,3)
448 !! input
449 ''foo'''
450 !! result
451 <p><i>foo'</i>
452 </p>
453 !!end
454
455
456 !! test
457 Italics and bold: 2-quote opening sequence: (2,4)
458 !! input
459 ''foo''''
460 !! result
461 <p><i>foo''</i>
462 </p>
463 !!end
464
465
466 !! test
467 Italics and bold: 2-quote opening sequence: (2,5) (php)
468 !! options
469 php
470 !! input
471 ''foo'''''
472 !! result
473 <p><i>foo</i>
474 </p>
475 !!end
476 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
477 !! test
478 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
479 !! options
480 parsoid
481 !! input
482 ''foo'''''
483 !! result
484 <p><i>foo</i><b></b>
485 </p>
486 !!end
487
488
489 ###
490 ### 3-quote opening sequence tests
491 ###
492
493 !! test
494 Italics and bold: 3-quote opening sequence: (3,2)
495 !! input
496 '''foo''
497 !! result
498 <p>'<i>foo</i>
499 </p>
500 !!end
501
502
503 !! test
504 Italics and bold: 3-quote opening sequence: (3,3)
505 !! input
506 '''foo'''
507 !! result
508 <p><b>foo</b>
509 </p>
510 !!end
511
512
513 !! test
514 Italics and bold: 3-quote opening sequence: (3,4)
515 !! input
516 '''foo''''
517 !! result
518 <p><b>foo'</b>
519 </p>
520 !!end
521
522
523 !! test
524 Italics and bold: 3-quote opening sequence: (3,5) (php)
525 !! options
526 php
527 !! input
528 '''foo'''''
529 !! result
530 <p><b>foo</b>
531 </p>
532 !!end
533 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
534 !! test
535 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
536 !! options
537 parsoid
538 !! input
539 '''foo'''''
540 !! result
541 <p><b>foo<i></i></b>
542 </p>
543 !!end
544
545
546 ###
547 ### 4-quote opening sequence tests
548 ###
549
550 !! test
551 Italics and bold: 4-quote opening sequence: (4,2)
552 !! input
553 ''''foo''
554 !! result
555 <p>''<i>foo</i>
556 </p>
557 !!end
558
559
560 !! test
561 Italics and bold: 4-quote opening sequence: (4,3)
562 !! input
563 ''''foo'''
564 !! result
565 <p>'<b>foo</b>
566 </p>
567 !!end
568
569
570 !! test
571 Italics and bold: 4-quote opening sequence: (4,4)
572 !! input
573 ''''foo''''
574 !! result
575 <p>'<b>foo'</b>
576 </p>
577 !!end
578
579
580 !! test
581 Italics and bold: 4-quote opening sequence: (4,5) (php)
582 !! options
583 php
584 !! input
585 ''''foo'''''
586 !! result
587 <p>'<b>foo</b>
588 </p>
589 !!end
590 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
591 !! test
592 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
593 !! options
594 parsoid
595 !! input
596 ''''foo'''''
597 !! result
598 <p>'<b>foo<i></i></b>
599 </p>
600 !!end
601
602
603 ###
604 ### 5-quote opening sequence tests
605 ###
606
607 !! test
608 Italics and bold: 5-quote opening sequence: (5,2) (php)
609 !! options
610 php
611 !! input
612 '''''foo''
613 !! result
614 <p><b><i>foo</i></b>
615 </p>
616 !!end
617 # Parsoid reverses the nesting order, compared to the PHP parser
618 !! test
619 Italics and bold: 5-quote opening sequence: (5,2) (parsoid)
620 !! options
621 parsoid
622 !! input
623 '''''foo''
624 !! result
625 <p><i><b>foo</b></i>
626 </p>
627 !!end
628
629
630 !! test
631 Italics and bold: 5-quote opening sequence: (5,3)
632 !! input
633 '''''foo'''
634 !! result
635 <p><i><b>foo</b></i>
636 </p>
637 !!end
638
639
640 !! test
641 Italics and bold: 5-quote opening sequence: (5,4)
642 !! input
643 '''''foo''''
644 !! result
645 <p><i><b>foo'</b></i>
646 </p>
647 !!end
648
649
650 !! test
651 Italics and bold: 5-quote opening sequence: (5,5)
652 !! input
653 '''''foo'''''
654 !! result
655 <p><i><b>foo</b></i>
656 </p>
657 !!end
658
659 ###
660 ### multiple quote sequences in a line
661 ###
662 !! test
663 Italics and bold: multiple quote sequences: (2,4,2)
664 !! input
665 ''foo''''bar''
666 !! result
667 <p><i>foo'<b>bar</b></i>
668 </p>
669 !!end
670
671
672 !! test
673 Italics and bold: multiple quote sequences: (2,4,3)
674 !! input
675 ''foo''''bar'''
676 !! result
677 <p><i>foo'<b>bar</b></i>
678 </p>
679 !!end
680
681
682 !! test
683 Italics and bold: multiple quote sequences: (2,4,4)
684 !! input
685 ''foo''''bar''''
686 !! result
687 <p><i>foo'<b>bar'</b></i>
688 </p>
689 !!end
690
691
692 !! test
693 Italics and bold: multiple quote sequences: (3,4,2) (php)
694 !! options
695 php
696 !! input
697 '''foo''''bar''
698 !! result
699 <p><b>foo'</b>bar
700 </p>
701 !!end
702 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
703 !! test
704 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
705 !! options
706 parsoid
707 !! input
708 '''foo''''bar''
709 !! result
710 <p><b>foo'</b>bar<i></i>
711 </p>
712 !!end
713
714
715 !! test
716 Italics and bold: multiple quote sequences: (3,4,3) (php)
717 !! options
718 php
719 !! input
720 '''foo''''bar'''
721 !! result
722 <p><b>foo'</b>bar
723 </p>
724 !!end
725 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
726 !! test
727 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
728 !! options
729 parsoid
730 !! input
731 '''foo''''bar'''
732 !! result
733 <p><b>foo'</b>bar<b></b>
734 </p>
735 !!end
736
737 ###
738 ### other quote tests
739 ###
740 !! test
741 Italics and bold: other quote tests: (2,3,5)
742 !! input
743 ''this is about '''foo's family'''''
744 !! result
745 <p><i>this is about <b>foo's family</b></i>
746 </p>
747 !!end
748
749
750 !! test
751 Italics and bold: other quote tests: (2,(3,3),2)
752 !! input
753 ''this is about '''foo's''' family''
754 !! result
755 <p><i>this is about <b>foo's</b> family</i>
756 </p>
757 !!end
758
759
760 !! test
761 Italics and bold: other quote tests: (3,2,3,2)
762 !! input
763 '''this is about ''foo'''s family''
764 !! result
765 <p><b>this is about <i>foo</i></b><i>s family</i>
766 </p>
767 !!end
768
769
770 # The Parsoid team believes the PHP parser's output on this test is wrong.
771 # It only checks for convert-to-bold-on-single-character-word when the word
772 # matches with a bold tag ("'''") that is *odd* in the list of quote tokens.
773 # This means that the bold token in position 2 (0-indexed) gets converted by
774 # parsoid, but doesn't get changed by the PHP parser.
775 !! test
776 Italics and bold: other quote tests: (3,2,3,3) (php)
777 !! options
778 php
779 !! input
780 '''this is about ''foo'''s family'''
781 !! result
782 <p>'<i>this is about </i>foo<b>s family</b>
783 </p>
784 !!end
785 # This is the output the Parsoid team believes to be correct.
786 !! test
787 Italics and bold: other quote tests: (3,2,3,3) (parsoid)
788 !! options
789 parsoid
790 !! input
791 '''this is about ''foo'''s family'''
792 !! result
793 <p><b>this is about <i>foo'</i>s family</b>
794 </p>
795 !!end
796
797
798 !! test
799 Italics and bold: other quote tests: (3,(2,2),3)
800 !! input
801 '''this is about ''foo's'' family'''
802 !! result
803 <p><b>this is about <i>foo's</i> family</b>
804 </p>
805 !!end
806
807
808 !! test
809 Italicized possessive
810 !! input
811 The ''[[Main Page]]'''s talk page.
812 !! result
813 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
814 </p>
815 !! end
816
817 !! test
818 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
819 (Requires tidy for PHP parser output to be fixed up)
820 !! options
821 parsoid=wt2html,wt2wt
822 !! input
823 {|
824 !''a!!''b
825 |''a||''b
826 |}
827 !! result
828 <table>
829 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
830 <td><i>a</i></td><td><i>b</i></td></tr>
831 </tbody></table>
832 !! end
833
834 ###
835 ### Non-html5 tags
836 ###
837
838 !! test
839 Non-html5 tags should be accepted
840 !! input
841 <center>''foo''</center>
842 <big>''foo''</big>
843 <font>''foo''</font>
844 <strike>''foo''</strike>
845 <tt>''foo''</tt>
846 !! result
847 <center><i>foo</i></center>
848 <p><big><i>foo</i></big>
849 <font><i>foo</i></font>
850 <strike><i>foo</i></strike>
851 <tt><i>foo</i></tt>
852 </p>
853 !! end
854
855 ###
856 ### <nowiki> test cases
857 ###
858
859 !! test
860 <nowiki> unordered list
861 !! input
862 <nowiki>* This is not an unordered list item.</nowiki>
863 !! result
864 <p>* This is not an unordered list item.
865 </p>
866 !! end
867
868 !! test
869 <nowiki> spacing
870 !! input
871 <nowiki>Lorem ipsum dolor
872
873 sed abit.
874 sed nullum.
875
876 :and a colon
877 </nowiki>
878 !! result
879 <p>Lorem ipsum dolor
880
881 sed abit.
882 sed nullum.
883
884 :and a colon
885
886 </p>
887 !! end
888
889 !! test
890 nowiki 3
891 !! input
892 :There is not nowiki.
893 :There is <nowiki>nowiki</nowiki>.
894
895 #There is not nowiki.
896 #There is <nowiki>nowiki</nowiki>.
897
898 *There is not nowiki.
899 *There is <nowiki>nowiki</nowiki>.
900 !! result
901 <dl><dd>There is not nowiki.
902 </dd><dd>There is nowiki.
903 </dd></dl>
904 <ol><li>There is not nowiki.
905 </li><li>There is nowiki.
906 </li></ol>
907 <ul><li>There is not nowiki.
908 </li><li>There is nowiki.
909 </li></ul>
910
911 !! end
912
913 !! test
914 Entities inside <nowiki>
915 !! input
916 <nowiki>&lt;</nowiki>
917 !! result
918 <p>&lt;
919 </p>
920 !! end
921
922 !! test
923 Entities inside template parameters
924 !! options
925 parsoid
926 !! input
927 {{echo|&ndash;}}
928 !! result
929 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}'>&ndash;</span>
930 </p>
931 !! end
932
933 ###
934 ### Comments
935 ###
936 !! test
937 Comments and Indent-Pre
938 !! input
939 <!-- comment 1 --> asdf
940
941 <!-- comment 1 --> asdf
942 <!-- comment 2 -->
943
944 <!-- comment 1 --> asdf
945 <!-- comment 2 -->xyz
946
947 <!-- comment 1 --> asdf
948 <!-- comment 2 --> xyz
949 !! result
950 <pre>asdf
951 </pre>
952 <pre>asdf
953 </pre>
954 <pre>asdf
955 </pre>
956 <p>xyz
957 </p>
958 <pre>asdf
959 xyz
960 </pre>
961 !! end
962
963 !! test
964 Comment test 2a
965 !! input
966 asdf
967 <!-- comment 1 -->
968 jkl
969 !! result
970 <p>asdf
971 jkl
972 </p>
973 !! end
974
975 !! test
976 Comment test 2b
977 !! input
978 asdf
979 <!-- comment 1 -->
980
981 jkl
982 !! result
983 <p>asdf
984 </p><p>jkl
985 </p>
986 !! end
987
988 !! test
989 Comment test 3
990 !! input
991 asdf
992 <!-- comment 1 -->
993 <!-- comment 2 -->
994 jkl
995 !! result
996 <p>asdf
997 jkl
998 </p>
999 !! end
1000
1001 !! test
1002 Comment test 4
1003 !! input
1004 asdf<!-- comment 1 -->jkl
1005 !! result
1006 <p>asdfjkl
1007 </p>
1008 !! end
1009
1010 !! test
1011 Comment spacing
1012 !! input
1013 a
1014 <!-- foo --> b <!-- bar -->
1015 c
1016 !! result
1017 <p>a
1018 </p>
1019 <pre> b
1020 </pre>
1021 <p>c
1022 </p>
1023 !! end
1024
1025 !! test
1026 Comment whitespace
1027 !! input
1028 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1029 !! result
1030
1031 !! end
1032
1033 !! test
1034 Comment semantics and delimiters
1035 !! input
1036 <!-- --><!----><!-----><!------>
1037 !! result
1038
1039 !! end
1040
1041 !! test
1042 Comment semantics and delimiters, redux
1043 !! input
1044 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1045 -- foo -- funky huh? ... -->
1046 !! result
1047
1048 !! end
1049
1050 !! test
1051 Comment semantics and delimiters: directors cut
1052 !! input
1053 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1054 everything starting with < followed by !-- until the first -- and > we see,
1055 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1056 -->-->
1057 !! result
1058 <p>--&gt;
1059 </p>
1060 !! end
1061
1062 !! test
1063 Comment semantics: nesting
1064 !! input
1065 <!--<!-- no, we're not going to do anything fancy here -->-->
1066 !! result
1067 <p>--&gt;
1068 </p>
1069 !! end
1070
1071 !! test
1072 Comment semantics: unclosed comment at end
1073 !! input
1074 <!--This comment will run out to the end of the document
1075 !! result
1076
1077 !! end
1078
1079 !! test
1080 Comment in template title
1081 !! input
1082 {{f<!---->oo}}
1083 !! result
1084 <p>FOO
1085 </p>
1086 !! end
1087
1088 !! test
1089 Comment on its own line post-expand
1090 !! input
1091 a
1092 {{blank}}<!---->
1093 b
1094 !! result
1095 <p>a
1096 </p><p>b
1097 </p>
1098 !! end
1099
1100 !! test
1101 Comment on its own line post-expand with non-significant whitespace
1102 !! input
1103 a
1104 {{blank}} <!---->
1105 b
1106 !! result
1107 <p>a
1108 </p><p>b
1109 </p>
1110 !! end
1111
1112 ###
1113 ### paragraph wraping tests
1114 ###
1115 !! test
1116 No block tags
1117 !! input
1118 a
1119
1120 b
1121 !! result
1122 <p>a
1123 </p><p>b
1124 </p>
1125 !! end
1126 !! test
1127 Block tag on one line
1128 !! input
1129 a <div>foo</div>
1130
1131 b
1132 !! result
1133 a <div>foo</div>
1134 <p>b
1135 </p>
1136 !! end
1137
1138 !! test
1139 Block tag on both lines
1140 !! input
1141 a <div>foo</div>
1142
1143 b <div>foo</div>
1144 !! result
1145 a <div>foo</div>
1146 b <div>foo</div>
1147
1148 !! end
1149
1150 !! test
1151 Multiple lines without block tags
1152 !! input
1153 <div>foo</div> a
1154 b
1155 c
1156 d<!--foo--> e
1157 x <div>foo</div> z
1158 !! result
1159 <div>foo</div> a
1160 <p>b
1161 c
1162 d e
1163 </p>
1164 x <div>foo</div> z
1165
1166 !! end
1167
1168 !! test
1169 Empty lines between lines with block tags
1170 !! input
1171 <div></div>
1172
1173
1174 <div></div>a
1175
1176 b
1177 <div>a</div>b
1178
1179 <div>b</div>d
1180
1181
1182 <div>e</div>
1183 !! result
1184 <div></div>
1185 <p><br />
1186 </p>
1187 <div></div>a
1188 <p>b
1189 </p>
1190 <div>a</div>b
1191 <div>b</div>d
1192 <p><br />
1193 </p>
1194 <div>e</div>
1195
1196 !! end
1197
1198 ###
1199 ### Preformatted text
1200 ###
1201 !! test
1202 Preformatted text
1203 !! input
1204 This is some
1205 Preformatted text
1206 With ''italic''
1207 And '''bold'''
1208 And a [[Main Page|link]]
1209 !! result
1210 <pre>This is some
1211 Preformatted text
1212 With <i>italic</i>
1213 And <b>bold</b>
1214 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1215 </pre>
1216 !! end
1217
1218 !! test
1219 Ident preformatting with inline content
1220 !! input
1221 a
1222 ''b''
1223 !! result
1224 <pre>a
1225 <i>b</i>
1226 </pre>
1227 !! end
1228
1229 !! test
1230 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1231 !! input
1232 <pre><nowiki>
1233 <b>
1234 <cite>
1235 <em>
1236 </nowiki></pre>
1237 !! result
1238 <pre>
1239 &lt;b&gt;
1240 &lt;cite&gt;
1241 &lt;em&gt;
1242 </pre>
1243
1244 !! end
1245
1246 !! test
1247 Regression with preformatted in <center>
1248 !! input
1249 <center>
1250 Blah
1251 </center>
1252 !! result
1253 <center>
1254 <pre>Blah
1255 </pre>
1256 </center>
1257
1258 !! end
1259
1260 # Expected output in the following test is not really expected (there should be
1261 # <pre> in the output) -- it's only testing for well-formedness.
1262 !! test
1263 Bug 6200: Preformatted in <blockquote>
1264 !! input
1265 <blockquote>
1266 Blah
1267 </blockquote>
1268 !! result
1269 <blockquote>
1270 Blah
1271 </blockquote>
1272
1273 !! end
1274
1275 !! test
1276 <pre> with attributes (bug 3202)
1277 !! input
1278 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1279 !! result
1280 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1281
1282 !! end
1283
1284 !! test
1285 <pre> with width attribute (bug 3202)
1286 !! input
1287 <pre width="8">Narrow screen goodies</pre>
1288 !! result
1289 <pre width="8">Narrow screen goodies</pre>
1290
1291 !! end
1292
1293 !! test
1294 <pre> with forbidden attribute (bug 3202)
1295 !! input
1296 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1297 !! result
1298 <pre width="8">Narrow screen goodies</pre>
1299
1300 !! end
1301
1302 !! test
1303 Entities inside <pre>
1304 !! input
1305 <pre>&lt;</pre>
1306 !! result
1307 <pre>&lt;</pre>
1308
1309 !! end
1310
1311 !! test
1312 <pre> with forbidden attribute values (bug 3202)
1313 !! input
1314 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1315 !! result
1316 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1317
1318 !! end
1319
1320 !! test
1321 <nowiki> inside <pre> (bug 13238)
1322 !! input
1323 <pre>
1324 <nowiki>
1325 </pre>
1326 <pre>
1327 <nowiki></nowiki>
1328 </pre>
1329 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1330 !! result
1331 <pre>
1332 &lt;nowiki&gt;
1333 </pre>
1334 <pre>
1335
1336 </pre>
1337 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1338
1339 !! end
1340
1341 !! test
1342 <nowiki> and <pre> preference (first one wins)
1343 !! input
1344 <pre>
1345 <nowiki>
1346 </pre>
1347 </nowiki>
1348 </pre>
1349
1350 <nowiki>
1351 <pre>
1352 <nowiki>
1353 </pre>
1354 </nowiki>
1355 </pre>
1356
1357 !! result
1358 <pre>
1359 &lt;nowiki&gt;
1360 </pre>
1361 <p>&lt;/nowiki&gt;
1362 &lt;/pre&gt;
1363 </p><p>
1364 &lt;pre&gt;
1365 &lt;nowiki&gt;
1366 &lt;/pre&gt;
1367
1368 &lt;/pre&gt;
1369 </p>
1370 !! end
1371
1372 !! test
1373 </pre> inside nowiki
1374 !! input
1375 <nowiki></pre></nowiki>
1376 !! result
1377 <p>&lt;/pre&gt;
1378 </p>
1379 !! end
1380
1381 !!test
1382 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1383 !!input
1384 {{echo|}}
1385 !!result
1386
1387 !!end
1388
1389 !!test
1390 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1391 !!input
1392 {{echo|
1393 foo}}
1394 !!result
1395 <p>foo
1396 </p>
1397 !!end
1398
1399 !! test
1400 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1401 !! input
1402 {{echo|a
1403 b}}
1404 !!result
1405 <pre>a
1406 </pre>
1407 <p>b
1408 </p>
1409 !!end
1410
1411 !! test
1412 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1413 !! input
1414 {{echo|a
1415 b
1416 c
1417 d
1418 e
1419 }}
1420 !!result
1421 <pre>a
1422 </pre>
1423 <p>b
1424 c
1425 </p>
1426 <pre>d
1427 </pre>
1428 <p>e
1429 </p>
1430 !!end
1431
1432 !!test
1433 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1434 !!input
1435 {{echo| foo}}
1436
1437 {{echo| foo}}{{echo| bar}}
1438
1439 {{echo| foo}}
1440 {{echo| bar}}
1441
1442 {{echo|<!--cmt--> foo}}
1443
1444 <!--cmt-->{{echo| foo}}
1445
1446 {{echo|{{echo| }}bar}}
1447 !!result
1448 <pre>foo
1449 </pre>
1450 <pre>foo bar
1451 </pre>
1452 <pre>foo
1453 bar
1454 </pre>
1455 <pre>foo
1456 </pre>
1457 <pre>foo
1458 </pre>
1459 <pre>bar
1460 </pre>
1461 !!end
1462
1463 !! test
1464 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1465 !! input
1466 {{echo| }}a
1467
1468 {{echo|
1469 }}a
1470
1471 {{echo|
1472 b}}
1473
1474 {{echo|a
1475 }}b
1476
1477 {{echo|a
1478 }} b
1479 !!result
1480 <pre>a
1481 </pre>
1482 <p><br />
1483 </p>
1484 <pre>a
1485 </pre>
1486 <p><br />
1487 </p>
1488 <pre>b
1489 </pre>
1490 <p>a
1491 </p>
1492 <pre>b
1493 </pre>
1494 <p>a
1495 </p>
1496 <pre>b
1497 </pre>
1498 !!end
1499
1500 !! test
1501 Templates: Single-line variant of parameter whitespace stripping test
1502 !! input
1503 {{echo| a}}
1504
1505 {{echo|1= a}}
1506
1507 {{echo|{{echo| a}}}}
1508
1509 {{echo|1={{echo| a}}}}
1510 !! result
1511 <pre>a
1512 </pre>
1513 <p>a
1514 </p>
1515 <pre>a
1516 </pre>
1517 <p>a
1518 </p>
1519 !! end
1520
1521 !! test
1522 Templates: Strip whitespace from named parameters, but not positional ones
1523 !! input
1524 {{echo|
1525 foo}}
1526
1527 {{echo|
1528 * foo}}
1529
1530 {{echo| 1 =
1531 foo}}
1532
1533 {{echo| 1 =
1534 * foo}}
1535 !! result
1536 <pre>foo
1537 </pre>
1538 <p><br />
1539 </p>
1540 <ul><li> foo
1541 </li></ul>
1542 <p>foo
1543 </p>
1544 <ul><li> foo
1545 </li></ul>
1546
1547 !! end
1548
1549 !! test
1550 Templates: Dont strip whitespace from whitespace/comment-only arguments
1551 !! input
1552 {{echo| }}
1553 {{echo|<!--cmt-->}}
1554 {{echo| <!--cmt--> }}
1555 !! result
1556 <p><br />
1557 </p>
1558 !! end
1559
1560 !! test
1561 Templates: Parsoid parameter escaping test 1
1562 !! options
1563 parsoid
1564 !! input
1565 {{echo|[foo]|{{echo|[bar]}}}}
1566 !! result
1567 <p about="#mwt1" typeof="mw:Transclusion"
1568 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>
1569 !! end
1570
1571 !! test
1572 Parsoid: Pipes in external links in template parameter
1573 !! options
1574 parsoid
1575 !! input
1576 {{echo|[{{echo|http://example.com}} link]}}
1577 !! result
1578 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" 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;[{{echo|http://example.com}} link]&quot;}},&quot;i&quot;:0}">link</a></p>
1579 !! end
1580
1581 !! test
1582 Parsoid: pipe in transclusion parameter
1583 !! options
1584 parsoid
1585 !! input
1586 {{echo|http://foo.com/a&#124;b}}
1587 !! result
1588 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1589 typeof="mw:Transclusion"
1590 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a|b"}},"i":0}'>http://foo.com/a|b</a></p>
1591 !! end
1592
1593 !! test
1594 Parsoid: Pipe in external link target and content in template parameter
1595 !! options
1596 parsoid=html2wt,wt2wt
1597 !! input
1598 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
1599 !! result
1600 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1601 typeof="mw:Transclusion"
1602 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},
1603 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}'>a|b</a></p>
1604 !! end
1605
1606 !! test
1607 Templates: Dont escape already nowiki-escaped text in template parameters
1608 !! options
1609 parsoid=html2wt,wt2wt
1610 !! input
1611 {{echo|foo<nowiki>|</nowiki>bar}}
1612 !! result
1613 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}'>foo<span typeof="mw:Nowiki" data-parsoid="{}">|</span>bar</p>
1614 !! end
1615
1616 ###
1617 ### Parsoid-centric tests for testing RT edge cases for pre
1618 ###
1619
1620 !!test
1621 1a. Indent-Pre and Comments
1622 !!input
1623 a
1624 <!--a-->
1625 c
1626 !!result
1627 <pre>a
1628 </pre>
1629 <p>c
1630 </p>
1631 !!end
1632
1633 !!test
1634 1b. Indent-Pre and Comments
1635 !!input
1636 a
1637 <!--a-->
1638 c
1639 !!result
1640 <pre>a
1641 </pre>
1642 <p>c
1643 </p>
1644 !!end
1645
1646 !!test
1647 1c. Indent-Pre and Comments
1648 !!input
1649 <!--a--> a
1650
1651 <!--a--> a
1652 !!result
1653 <pre> a
1654 </pre>
1655 <pre> a
1656 </pre>
1657 !!end
1658
1659 !!test
1660 2a. Indent-Pre and tables
1661 !!input
1662 {|
1663 |-
1664 !h1!!h2
1665 |foo||bar
1666 |}
1667 !!result
1668 <table>
1669
1670 <tr>
1671 <th>h1</th>
1672 <th>h2
1673 </th>
1674 <td>foo</td>
1675 <td>bar
1676 </td></tr></table>
1677
1678 !!end
1679
1680 !!test
1681 2b. Indent-Pre and tables
1682 !!input
1683 {|
1684 |-
1685 |foo
1686 |}
1687 !!result
1688 <table>
1689
1690 <tr>
1691 <td>foo
1692 </td></tr></table>
1693
1694 !!end
1695
1696 !!test
1697 2c. Indent-Pre and tables (bug 42252)
1698 !!input
1699 {|
1700 |+ foo
1701 ! | bar
1702 |}
1703 !!result
1704 <table>
1705 <caption> foo
1706 </caption>
1707 <tr>
1708 <th> bar
1709 </th></tr></table>
1710
1711 !!end
1712
1713 !!test
1714 3a. Indent-Pre and block tags (single-line html)
1715 !!input
1716 <p> foo </p>
1717 <div> foo </div>
1718 <span> foo </span>
1719 !!result
1720 <p> foo </p>
1721 <div> foo </div>
1722 <pre><span> foo </span>
1723 </pre>
1724 !!end
1725
1726 !!test
1727 3b. Indent-Pre and block tags (pre-content on separate line)
1728 !!input
1729 <p>
1730 foo
1731 </p>
1732
1733 <div>
1734 foo
1735 </div>
1736
1737 <center>
1738 foo
1739 </center>
1740
1741 <blockquote>
1742 foo
1743 </blockquote>
1744
1745 <table><tr><td>
1746 foo
1747 </td></tr></table>
1748
1749 <ul><li>
1750 foo
1751 </li></ul>
1752
1753 !!result
1754 <p>
1755 foo
1756 </p>
1757 <div>
1758 <pre>foo
1759 </pre>
1760 </div>
1761 <center>
1762 <pre>foo
1763 </pre>
1764 </center>
1765 <blockquote>
1766 foo
1767 </blockquote>
1768 <table><tr><td>
1769 <pre>foo
1770 </pre>
1771 </td></tr></table>
1772 <ul><li>
1773 foo
1774 </li></ul>
1775
1776 !!end
1777
1778 !!test
1779 4. Multiple spaces at start-of-line
1780 !!input
1781 <p> foo </p>
1782 foo
1783 {|
1784 |foo
1785 |}
1786 !!result
1787 <p> foo </p>
1788 <pre> foo
1789 </pre>
1790 <table>
1791 <tr>
1792 <td>foo
1793 </td></tr></table>
1794
1795 !!end
1796
1797 !! test
1798 5. White-space in indent-pre
1799 NOTE: the white-space char on 2nd line is significant
1800 !! input
1801 a<br/>
1802
1803 b
1804 !! result
1805 <pre>a<br />
1806
1807 b
1808 </pre>
1809 !! end
1810
1811 ###
1812 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1813 ###
1814
1815 !!test
1816 HTML-pre: 1. embedded newlines
1817 !!input
1818 <pre>foo</pre>
1819
1820 <pre>
1821 foo
1822 </pre>
1823
1824 <pre>
1825
1826 foo
1827 </pre>
1828
1829 <pre>
1830
1831
1832 foo
1833 </pre>
1834 !!result
1835 <pre>foo</pre>
1836 <pre>
1837 foo
1838 </pre>
1839 <pre>
1840
1841 foo
1842 </pre>
1843 <pre>
1844
1845
1846 foo
1847 </pre>
1848
1849 !!end
1850
1851 !!test
1852 HTML-pre: 2: indented text
1853 !!input
1854 <pre>
1855 foo
1856 </pre>
1857 !!result
1858 <pre>
1859 foo
1860 </pre>
1861
1862 !!end
1863
1864 !!test
1865 HTML-pre: 3: other wikitext
1866 !!input
1867 <pre>
1868 * foo
1869 # bar
1870 = no-h =
1871 '' no-italic ''
1872 [[ NoLink ]]
1873 </pre>
1874 !!result
1875 <pre>
1876 * foo
1877 # bar
1878 = no-h =
1879 '' no-italic ''
1880 [[ NoLink ]]
1881 </pre>
1882
1883 !!end
1884
1885 ###
1886 ### Definition lists
1887 ###
1888 !! test
1889 Simple definition
1890 !! input
1891 ; name : Definition
1892 !! result
1893 <dl><dt> name&#160;</dt><dd> Definition
1894 </dd></dl>
1895
1896 !! end
1897
1898 !! test
1899 Definition list for indentation only
1900 !! input
1901 : Indented text
1902 !! result
1903 <dl><dd> Indented text
1904 </dd></dl>
1905
1906 !! end
1907
1908 !! test
1909 Definition list with no space
1910 !! input
1911 ;name:Definition
1912 !! result
1913 <dl><dt>name</dt><dd>Definition
1914 </dd></dl>
1915
1916 !!end
1917
1918 !! test
1919 Definition list with URL link
1920 !! input
1921 ; http://example.com/ : definition
1922 !! result
1923 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
1924 </dd></dl>
1925
1926 !! end
1927
1928 !! test
1929 Definition list with bracketed URL link
1930 !! input
1931 ;[http://www.example.com/ Example]:Something about it
1932 !! result
1933 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
1934 </dd></dl>
1935
1936 !! end
1937
1938 !! test
1939 Definition list with wikilink containing colon
1940 !! input
1941 ; [[Help:FAQ]]: The least-read page on Wikipedia
1942 !! result
1943 <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
1944 </dd></dl>
1945
1946 !! end
1947
1948 # At Brion's and JeLuF's insistence... :)
1949 !! test
1950 Definition list with news link containing colon
1951 !! input
1952 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
1953 !! result
1954 <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!
1955 </dd></dl>
1956
1957 !! end
1958
1959 !! test
1960 Malformed definition list with colon
1961 !! input
1962 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
1963 !! result
1964 <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
1965 </dt></dl>
1966
1967 !! end
1968
1969 !! test
1970 Definition lists: colon in external link text
1971 !! input
1972 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
1973 !! result
1974 <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
1975 </dd></dl>
1976
1977 !! end
1978
1979 !! test
1980 Definition lists: colon in HTML attribute
1981 !! input
1982 ;<b style="display: inline">bold</b>
1983 !! result
1984 <dl><dt><b style="display: inline">bold</b>
1985 </dt></dl>
1986
1987 !! end
1988
1989 !! test
1990 Definition lists: self-closed tag
1991 !! input
1992 ;one<br/>two : two-line fun
1993 !! result
1994 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
1995 </dd></dl>
1996
1997 !! end
1998
1999 !! test
2000 Bug 11748: Literal closing tags
2001 !! input
2002 <dl>
2003 <dt>test 1</dt>
2004 <dd>test test test test test</dd>
2005 <dt>test 2</dt>
2006 <dd>test test test test test</dd>
2007 </dl>
2008 !! result
2009 <dl>
2010 <dt>test 1</dt>
2011 <dd>test test test test test</dd>
2012 <dt>test 2</dt>
2013 <dd>test test test test test</dd>
2014 </dl>
2015
2016 !! end
2017
2018 !! test
2019 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2020 !! input
2021 <ul><li>
2022 ; term : description
2023 * unordered
2024 </li>
2025 </ul>
2026 !! result
2027 <ul><li>
2028 <dl><dt> term&#160;</dt><dd> description
2029 </dd></dl>
2030 <ul><li> unordered
2031 </li></ul>
2032 </li>
2033 </ul>
2034
2035 !! end
2036
2037 !! test
2038
2039 Definition list with empty definition and following paragraph
2040 !! input
2041 ; term:
2042 Paragraph text
2043 !! result
2044 <dl><dt> term</dt><dd>
2045 </dd></dl>
2046 <p>Paragraph text
2047 </p>
2048 !! end
2049
2050 !! test
2051 Nested definition lists using html syntax
2052 !! input
2053 <dl><dd>
2054 <dl>
2055 <dd>Foo</dd>
2056 </dl>
2057 </dd></dl>
2058 !! result
2059 <dl><dd>
2060 <dl>
2061 <dd>Foo</dd>
2062 </dl>
2063 </dd></dl>
2064
2065 !! end
2066
2067 !! test
2068 Definition Lists: No nesting: Multiple dd's
2069 !! input
2070 ;x
2071 :a
2072 :b
2073 !! result
2074 <dl><dt>x
2075 </dt><dd>a
2076 </dd><dd>b
2077 </dd></dl>
2078
2079 !! end
2080
2081 !! test
2082 Definition Lists: Indentation: Regular
2083 !! input
2084 :i1
2085 ::i2
2086 :::i3
2087 !! result
2088 <dl><dd>i1
2089 <dl><dd>i2
2090 <dl><dd>i3
2091 </dd></dl>
2092 </dd></dl>
2093 </dd></dl>
2094
2095 !! end
2096
2097 !! test
2098 Definition Lists: Indentation: Missing 1st level
2099 !! input
2100 ::i2
2101 :::i3
2102 !! result
2103 <dl><dd><dl><dd>i2
2104 <dl><dd>i3
2105 </dd></dl>
2106 </dd></dl>
2107 </dd></dl>
2108
2109 !! end
2110
2111 !! test
2112 Definition Lists: Indentation: Multi-level indent
2113 !! input
2114 :::i3
2115 !! result
2116 <dl><dd><dl><dd><dl><dd>i3
2117 </dd></dl>
2118 </dd></dl>
2119 </dd></dl>
2120
2121 !! end
2122
2123 !! test
2124 Definition Lists: Hacky use to indent tables
2125 !! input
2126 ::{|
2127 |foo
2128 |bar
2129 |}
2130 this text
2131 should be left alone
2132 !! result
2133 <dl><dd><dl><dd><table>
2134 <tr>
2135 <td>foo
2136 </td>
2137 <td>bar
2138 </td></tr></table></dd></dl></dd></dl>
2139 <p>this text
2140 should be left alone
2141 </p>
2142 !! end
2143 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2144 ## as an empty dt item. It also ignores all but the last ";" when followed
2145 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2146 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2147 ## ";"s.
2148 ##
2149 ## Ex: ";;t2 ::d2" is transformed into:
2150 ##
2151 ## <dl>
2152 ## <dt>t2 </dt>
2153 ## <dd>
2154 ## <dl>
2155 ## <dt></dt>
2156 ## <dd>d2</dd>
2157 ## </dl>
2158 ## </dd>
2159 ## </dl>
2160 ##
2161 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2162 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2163 ##
2164 ## <dl>
2165 ## <dt>
2166 ## <dl>
2167 ## <dt>t2 </dt>
2168 ## <dd>:d2</dd>
2169 ## </dl>
2170 ## </dt>
2171 ## </dl>
2172 ##
2173 ## All Parsoid only definition list tests have this difference.
2174 ##
2175 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2176 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2177
2178 !! test
2179 Table / list interaction: indented table with lists in table contents
2180 !! input
2181 :{|
2182 |-
2183 | a
2184 * b
2185 |-
2186 | c
2187 * d
2188 |}
2189 !! result
2190 <dl><dd><table>
2191
2192 <tr>
2193 <td> a
2194 <ul><li> b
2195 </li></ul>
2196 </td></tr>
2197 <tr>
2198 <td> c
2199 <ul><li> d
2200 </li></ul>
2201 </td></tr></table></dd></dl>
2202
2203 !! end
2204
2205 !!test
2206 Table / list interaction: lists nested in tables nested in indented lists
2207 !!input
2208 :{|
2209 |
2210 :a
2211 :b
2212 |
2213 *c
2214 *d
2215 |}
2216
2217 *e
2218 *f
2219 !!result
2220 <dl><dd><table>
2221 <tr>
2222 <td>
2223 <dl><dd>a
2224 </dd><dd>b
2225 </dd></dl>
2226 </td>
2227 <td>
2228 <ul><li>c
2229 </li><li>d
2230 </li></ul>
2231 </td></tr></table></dd></dl>
2232 <ul><li>e
2233 </li><li>f
2234 </li></ul>
2235
2236 !!end
2237
2238 !! test
2239 Definition Lists: Nesting: Multi-level (Parsoid only)
2240 !! options
2241 parsoid
2242 !! input
2243 ;t1 :d1
2244 ;;t2 ::d2
2245 ;;;t3 :::d3
2246 !! result
2247 <dl>
2248 <dt>t1 </dt>
2249 <dd>d1</dd>
2250 <dt>
2251 <dl>
2252 <dt>t2 </dt>
2253 <dd>:d2</dd>
2254 <dt>
2255 <dl>
2256 <dt>t3 </dt>
2257 <dd>::d3</dd>
2258 </dl>
2259 </dt>
2260 </dl>
2261 </dt>
2262 </dl>
2263
2264
2265 !! end
2266
2267
2268 !! test
2269 Definition Lists: Nesting: Test 2 (Parsoid only)
2270 !! options
2271 parsoid
2272 !! input
2273 ;t1
2274 ::d2
2275 !! result
2276 <dl>
2277 <dt>t1</dt>
2278 <dd>
2279 <dl>
2280 <dd>d2</dd>
2281 </dl>
2282 </dd>
2283 </dl>
2284
2285 !! end
2286
2287
2288 !! test
2289 Definition Lists: Nesting: Test 3 (Parsoid only)
2290 !! options
2291 parsoid
2292 !! input
2293 :;t1
2294 ::::d2
2295 !! result
2296 <dl>
2297 <dd>
2298 <dl>
2299 <dt>t1</dt>
2300 <dd>
2301 <dl>
2302 <dd>
2303 <dl>
2304 <dd>d2</dd>
2305 </dl>
2306 </dd>
2307 </dl>
2308 </dd>
2309 </dl>
2310 </dd>
2311 </dl>
2312
2313 !! end
2314
2315
2316 !! test
2317 Definition Lists: Nesting: Test 4
2318 !! input
2319 ::;t3
2320 :::d3
2321 !! result
2322 <dl><dd><dl><dd><dl><dt>t3
2323 </dt><dd>d3
2324 </dd></dl>
2325 </dd></dl>
2326 </dd></dl>
2327
2328 !! end
2329
2330
2331 ## The Parsoid team believes the following three test exposes a
2332 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2333 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2334 !! test
2335 Definition Lists: Mixed Lists: Test 1 (php)
2336 !! options
2337 php
2338 !! input
2339 :;* foo
2340 ::* bar
2341 :; baz
2342 !! result
2343 <dl><dd><dl><dt><ul><li> foo
2344 </li><li> bar
2345 </li></ul>
2346 </dt></dl>
2347 <dl><dt> baz
2348 </dt></dl>
2349 </dd></dl>
2350
2351 !! end
2352 !! test
2353 Definition Lists: Mixed Lists: Test 1 (parsoid)
2354 !! options
2355 parsoid
2356 !! input
2357 :;* foo
2358 ::* bar
2359 :; baz
2360 !! result
2361 <dl><dd><dl><dt><ul><li> foo
2362 </li></ul></dt><dd><ul><li> bar
2363 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2364 !! end
2365
2366 !! test
2367 Definition Lists: Mixed Lists: Test 2
2368 !! input
2369 *: d1
2370 *: d2
2371 !! result
2372 <ul><li><dl><dd> d1
2373 </dd><dd> d2
2374 </dd></dl>
2375 </li></ul>
2376
2377 !! end
2378
2379
2380 !! test
2381 Definition Lists: Mixed Lists: Test 3
2382 !! input
2383 *::: d1
2384 *::: d2
2385 !! result
2386 <ul><li><dl><dd><dl><dd><dl><dd> d1
2387 </dd><dd> d2
2388 </dd></dl>
2389 </dd></dl>
2390 </dd></dl>
2391 </li></ul>
2392
2393 !! end
2394
2395
2396 !! test
2397 Definition Lists: Mixed Lists: Test 4
2398 !! input
2399 *;d1 :d2
2400 *;d3 :d4
2401 !! result
2402 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2403 </dd><dt>d3&#160;</dt><dd>d4
2404 </dd></dl>
2405 </li></ul>
2406
2407 !! end
2408
2409
2410 !! test
2411 Definition Lists: Mixed Lists: Test 5
2412 !! input
2413 *:d1
2414 *:: d2
2415 !! result
2416 <ul><li><dl><dd>d1
2417 <dl><dd> d2
2418 </dd></dl>
2419 </dd></dl>
2420 </li></ul>
2421
2422 !! end
2423
2424
2425 !! test
2426 Definition Lists: Mixed Lists: Test 6
2427 !! input
2428 #*:d1
2429 #*::: d3
2430 !! result
2431 <ol><li><ul><li><dl><dd>d1
2432 <dl><dd><dl><dd> d3
2433 </dd></dl>
2434 </dd></dl>
2435 </dd></dl>
2436 </li></ul>
2437 </li></ol>
2438
2439 !! end
2440
2441
2442 !! test
2443 Definition Lists: Mixed Lists: Test 7
2444 !! input
2445 :* d1
2446 :* d2
2447 !! result
2448 <dl><dd><ul><li> d1
2449 </li><li> d2
2450 </li></ul>
2451 </dd></dl>
2452
2453 !! end
2454
2455
2456 !! test
2457 Definition Lists: Mixed Lists: Test 8
2458 !! input
2459 :* d1
2460 ::* d2
2461 !! result
2462 <dl><dd><ul><li> d1
2463 </li></ul>
2464 <dl><dd><ul><li> d2
2465 </li></ul>
2466 </dd></dl>
2467 </dd></dl>
2468
2469 !! end
2470
2471
2472 !! test
2473 Definition Lists: Mixed Lists: Test 9
2474 !! input
2475 *;foo :bar
2476 !! result
2477 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2478 </dd></dl>
2479 </li></ul>
2480
2481 !! end
2482
2483
2484 !! test
2485 Definition Lists: Mixed Lists: Test 10
2486 !! input
2487 *#;foo :bar
2488 !! result
2489 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2490 </dd></dl>
2491 </li></ol>
2492 </li></ul>
2493
2494 !! end
2495
2496 # The Parsoid team disagrees with the PHP parser's seemingly-random
2497 # rules regarding dd/dt on the next two tests. Parsoid is more
2498 # consistent, and recognizes the shared nesting and keeps the
2499 # still-open tags around until the nesting is complete.
2500
2501 !! test
2502 Definition Lists: Mixed Lists: Test 11 (php)
2503 !! options
2504 php
2505 !! input
2506 *#*#;*;;foo :bar
2507 *#*#;boo :baz
2508 !! result
2509 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2510 </dt></dl>
2511 </dd></dl>
2512 </li></ul>
2513 </dd></dl>
2514 <dl><dt>boo&#160;</dt><dd>baz
2515 </dd></dl>
2516 </li></ol>
2517 </li></ul>
2518 </li></ol>
2519 </li></ul>
2520
2521 !! end
2522 !! test
2523 Definition Lists: Mixed Lists: Test 11 (parsoid)
2524 !! options
2525 parsoid
2526 !! input
2527 *#*#;*;;foo :bar
2528 *#*#;boo :baz
2529 !! result
2530 <ul>
2531 <li>
2532 <ol>
2533 <li>
2534 <ul>
2535 <li>
2536 <ol>
2537 <li>
2538 <dl>
2539 <dt>
2540 <ul>
2541 <li>
2542 <dl>
2543 <dt>
2544 <dl>
2545 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2546 <dd data-parsoid='{"stx":"row"}'>bar</dd></dl></dt></dl></li></ul></dt>
2547 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2548 <dd data-parsoid='{"stx":"row"}'>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2549 !! end
2550
2551
2552 !! test
2553 Definition Lists: Weird Ones: Test 1 (php)
2554 !! options
2555 php
2556 !! input
2557 *#;*::;; foo : bar (who uses this?)
2558 !! result
2559 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2560 </dt></dl>
2561 </dd></dl>
2562 </dd></dl>
2563 </dd></dl>
2564 </li></ul>
2565 </dd></dl>
2566 </li></ol>
2567 </li></ul>
2568
2569 !! end
2570 !! test
2571 Definition Lists: Weird Ones: Test 1 (parsoid)
2572 !! options
2573 parsoid
2574 !! input
2575 *#;*::;; foo : bar (who uses this?)
2576 !! result
2577 <ul>
2578 <li>
2579 <ol>
2580 <li>
2581 <dl>
2582 <dt>
2583 <ul>
2584 <li>
2585 <dl>
2586 <dd>
2587 <dl>
2588 <dd>
2589 <dl>
2590 <dt>
2591 <dl>
2592 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2593 <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>
2594 !! end
2595
2596 ###
2597 ### External links
2598 ###
2599 !! test
2600 External links: non-bracketed
2601 !! input
2602 Non-bracketed: http://example.com
2603 !! result
2604 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2605 </p>
2606 !! end
2607
2608 !! test
2609 External links: numbered
2610 !! input
2611 Numbered: [http://example.com]
2612 Numbered: [http://example.net]
2613 Numbered: [http://example.com]
2614 !! result
2615 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2616 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2617 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2618 </p>
2619 !!end
2620
2621 !! test
2622 External links: specified text
2623 !! input
2624 Specified text: [http://example.com link]
2625 !! result
2626 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2627 </p>
2628 !!end
2629
2630 !! test
2631 External links: trail
2632 !! input
2633 Linktrails should not work for external links: [http://example.com link]s
2634 !! result
2635 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2636 </p>
2637 !! end
2638
2639 !! test
2640 External links: dollar sign in URL
2641 !! input
2642 http://example.com/1$2345
2643 !! result
2644 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2645 </p>
2646 !! end
2647
2648 !! test
2649 External links: dollar sign in URL (named)
2650 !! input
2651 [http://example.com/1$2345]
2652 !! result
2653 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2654 </p>
2655 !!end
2656
2657 !! test
2658 External links: open square bracket forbidden in URL (bug 4377)
2659 !! input
2660 http://example.com/1[2345
2661 !! result
2662 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2663 </p>
2664 !! end
2665
2666 !! test
2667 External links: open square bracket forbidden in URL (named) (bug 4377)
2668 !! input
2669 [http://example.com/1[2345]
2670 !! result
2671 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2672 </p>
2673 !!end
2674
2675 !! test
2676 External links: nowiki in URL link text (bug 6230)
2677 !!input
2678 [http://example.com/ <nowiki>''example site''</nowiki>]
2679 !! result
2680 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2681 </p>
2682 !! end
2683
2684 !! test
2685 External links: newline forbidden in text (bug 6230 regression check)
2686 !! input
2687 [http://example.com/ first
2688 second]
2689 !! result
2690 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2691 second]
2692 </p>
2693 !!end
2694
2695 !! test
2696 External links: Pipe char between url and text
2697 !! input
2698 [http://example.com | link]
2699 !! result
2700 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2701 </p>
2702 !!end
2703
2704 !! test
2705 External links: protocol-relative URL in brackets
2706 !! input
2707 [//example.com/ Test]
2708 !! result
2709 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2710 </p>
2711 !! end
2712
2713 !! test
2714 External links: protocol-relative URL in brackets without text
2715 !! input
2716 [//example.com]
2717 !! result
2718 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2719 </p>
2720 !! end
2721
2722 !! test
2723 External links: protocol-relative URL in free text is left alone
2724 !! input
2725 //example.com/Foo
2726 !! result
2727 <p>//example.com/Foo
2728 </p>
2729 !!end
2730
2731 !! test
2732 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2733 !! input
2734 foo//example.com/Foo
2735 !! result
2736 <p>foo//example.com/Foo
2737 </p>
2738 !! end
2739
2740 !! test
2741 External image
2742 !! input
2743 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2744 !! result
2745 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2746 </p>
2747 !! end
2748
2749 !! test
2750 External image from https
2751 !! input
2752 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2753 !! result
2754 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2755 </p>
2756 !! end
2757
2758 !! test
2759 External image (when not allowed)
2760 !! options
2761 wgAllowExternalImages=0
2762 !! input
2763 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2764 !! result
2765 <p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
2766 </p>
2767 !! end
2768
2769 !! test
2770 Link to non-http image, no img tag
2771 !! input
2772 Link to non-http image, no img tag: ftp://example.com/test.jpg
2773 !! result
2774 <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>
2775 </p>
2776 !! end
2777
2778 !! test
2779 External links: terminating separator
2780 !! input
2781 Terminating separator: http://example.com/thing,
2782 !! result
2783 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2784 </p>
2785 !! end
2786
2787 !! test
2788 External links: intervening separator
2789 !! input
2790 Intervening separator: http://example.com/1,2,3
2791 !! result
2792 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2793 </p>
2794 !! end
2795
2796 !! test
2797 External links: old bug with URL in query
2798 !! input
2799 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2800 !! result
2801 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2802 </p>
2803 !! end
2804
2805 !! test
2806 External links: old URL-in-URL bug, mixed protocols
2807 !! input
2808 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2809 !! result
2810 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2811 </p>
2812 !!end
2813
2814 !! test
2815 External links: URL in text
2816 !! input
2817 URL in text: [http://example.com http://example.com]
2818 !! result
2819 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2820 </p>
2821 !! end
2822
2823 !! test
2824 External links: Clickable images
2825 !! input
2826 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2827 !! result
2828 <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>
2829 </p>
2830 !!end
2831
2832 !! test
2833 External links: raw ampersand
2834 !! input
2835 Old &amp; use: http://x&y
2836 !! result
2837 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2838 </p>
2839 !! end
2840
2841 !! test
2842 External links: encoded ampersand
2843 !! input
2844 Old &amp; use: http://x&amp;y
2845 !! result
2846 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2847 </p>
2848 !! end
2849
2850 !! test
2851 External links: encoded equals (bug 6102)
2852 !! input
2853 http://example.com/?foo&#61;bar
2854 !! result
2855 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2856 </p>
2857 !! end
2858
2859 !! test
2860 External links: [raw ampersand]
2861 !! input
2862 Old &amp; use: [http://x&y]
2863 !! result
2864 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2865 </p>
2866 !! end
2867
2868 !! test
2869 External links: [encoded ampersand]
2870 !! input
2871 Old &amp; use: [http://x&amp;y]
2872 !! result
2873 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2874 </p>
2875 !! end
2876
2877 !! test
2878 External links: [encoded equals] (bug 6102)
2879 !! input
2880 [http://example.com/?foo&#61;bar]
2881 !! result
2882 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2883 </p>
2884 !! end
2885
2886 !! test
2887 External links: [IDN ignored character reference in hostname; strip it right off]
2888 !! input
2889 [http://e&zwnj;xample.com/]
2890 !! result
2891 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2892 </p>
2893 !! end
2894
2895 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2896 # Where an external link could easily circumvent the sanitization of the text of
2897 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2898 # test demands a higher standard. That's a bit strange.
2899 #
2900 # Example:
2901 #
2902 # http://e‌xample.com -> [http://example.com|http://example.com]
2903 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2904 #
2905 # The first example is sanitized, but the second is not. Any security benefits
2906 # from this production are trivial to circumvent. Either remove this test and
2907 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2908 # the test accordingly.
2909 #
2910 # All our love,
2911 # The Parsoid team.
2912 !! test
2913 External links: IDN ignored character reference in hostname; strip it right off
2914 !! input
2915 http://e&zwnj;xample.com/
2916 !! result
2917 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
2918 </p>
2919 !! end
2920
2921 !! test
2922 External links: www.jpeg.org (bug 554)
2923 !! input
2924 http://www.jpeg.org
2925 !!result
2926 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
2927 </p>
2928 !! end
2929
2930 !! test
2931 External links: URL within URL (original bug 2)
2932 !! input
2933 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
2934 !! result
2935 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
2936 </p>
2937 !! end
2938
2939 !! test
2940 BUG 361: URL inside bracketed URL
2941 !! input
2942 [http://www.example.com/foo http://www.example.com/bar]
2943 !! result
2944 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
2945 </p>
2946 !! end
2947
2948 !! test
2949 BUG 361: URL within URL, not bracketed
2950 !! input
2951 http://www.example.com/foo?=http://www.example.com/bar
2952 !! result
2953 <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>
2954 </p>
2955 !! end
2956
2957 !! test
2958 BUG 289: ">"-token in URL-tail
2959 !! input
2960 http://www.example.com/<hello>
2961 !! result
2962 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
2963 </p>
2964 !!end
2965
2966 !! test
2967 BUG 289: literal ">"-token in URL-tail
2968 !! input
2969 http://www.example.com/<b>html</b>
2970 !! result
2971 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
2972 </p>
2973 !!end
2974
2975 !! test
2976 BUG 289: ">"-token in bracketed URL
2977 !! input
2978 [http://www.example.com/<hello> stuff]
2979 !! result
2980 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
2981 </p>
2982 !!end
2983
2984 !! test
2985 BUG 289: literal ">"-token in bracketed URL
2986 !! input
2987 [http://www.example.com/<b>html</b> stuff]
2988 !! result
2989 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
2990 </p>
2991 !!end
2992
2993 !! test
2994 BUG 289: literal double quote at end of URL
2995 !! input
2996 http://www.example.com/"hello"
2997 !! result
2998 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
2999 </p>
3000 !!end
3001
3002 !! test
3003 BUG 289: literal double quote in bracketed URL
3004 !! input
3005 [http://www.example.com/"hello" stuff]
3006 !! result
3007 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
3008 </p>
3009 !!end
3010
3011 !! test
3012 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
3013 !! input
3014 [http://www.example.com test]
3015 !! result
3016 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3017 </p>
3018 !! end
3019
3020 !! test
3021 External links: link text with spaces
3022 !! input
3023 [http://www.example.com a b c]
3024 [http://www.example.com ''a'' ''b'']
3025 !! result
3026 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3027 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3028 </p>
3029 !! end
3030
3031 !! test
3032 External links: wiki links within external link (Bug 3695)
3033 !! input
3034 [http://example.com [[wikilink]] embedded in ext link]
3035 !! result
3036 <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>
3037 </p>
3038 !! end
3039
3040 !! test
3041 BUG 787: Links with one slash after the url protocol are invalid
3042 !! input
3043 http:/example.com
3044
3045 [http:/example.com title]
3046 !! result
3047 <p>http:/example.com
3048 </p><p>[http:/example.com title]
3049 </p>
3050 !! end
3051
3052 !! test
3053 Bracketed external links with template-generated invalid target
3054 !! input
3055 [{{echo|http:/example.com}} title]
3056 !! result
3057 <p>[http:/example.com title]
3058 </p>
3059 !! end
3060
3061 !! test
3062 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3063 !! input
3064 ''[http://example.com text'']
3065 [http://example.com '''text]'''
3066 ''Something [http://example.com in italic'']
3067 ''Something [http://example.com mixed''''', even bold]'''
3068 '''''Now [http://example.com both''''']
3069 !! result
3070 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3071 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3072 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3073 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3074 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3075 </p>
3076 !! end
3077
3078
3079 !! test
3080 Bug 4781: %26 in URL
3081 !! input
3082 http://www.example.com/?title=AT%26T
3083 !! result
3084 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3085 </p>
3086 !! end
3087
3088 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3089 # % is actually legal in HTML5. Any change in output would need testing though.
3090 !! test
3091 Bug 4781, 5267: %25 in URL
3092 !! input
3093 http://www.example.com/?title=100%25_Bran
3094 !! result
3095 <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>
3096 </p>
3097 !! end
3098
3099 !! test
3100 Bug 4781, 5267: %28, %29 in URL
3101 !! input
3102 http://www.example.com/?title=Ben-Hur_%281959_film%29
3103 !! result
3104 <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>
3105 </p>
3106 !! end
3107
3108
3109 !! test
3110 Bug 4781: %26 in autonumber URL
3111 !! input
3112 [http://www.example.com/?title=AT%26T]
3113 !! result
3114 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3115 </p>
3116 !! end
3117
3118 !! test
3119 Bug 4781, 5267: %26 in autonumber URL
3120 !! input
3121 [http://www.example.com/?title=100%25_Bran]
3122 !! result
3123 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3124 </p>
3125 !! end
3126
3127 !! test
3128 Bug 4781, 5267: %28, %29 in autonumber URL
3129 !! input
3130 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3131 !! result
3132 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3133 </p>
3134 !! end
3135
3136
3137 !! test
3138 Bug 4781: %26 in bracketed URL
3139 !! input
3140 [http://www.example.com/?title=AT%26T link]
3141 !! result
3142 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3143 </p>
3144 !! end
3145
3146 !! test
3147 Bug 4781, 5267: %26 in bracketed URL
3148 !! input
3149 [http://www.example.com/?title=100%25_Bran link]
3150 !! result
3151 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3152 </p>
3153 !! end
3154
3155 !! test
3156 Bug 4781, 5267: %28, %29 in bracketed URL
3157 !! input
3158 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3159 !! result
3160 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3161 </p>
3162 !! end
3163
3164 !! test
3165 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3166 !! input
3167 Some [http://example.com/ pretty ''italics'' and stuff]!
3168 !! result
3169 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3170 </p>
3171 !! end
3172
3173 !! test
3174 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3175 !! input
3176 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3177 !! result
3178 <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>
3179 </p>
3180 !! end
3181
3182 !! test
3183 External link containing double-single-quotes with no space separating the url from text in italics
3184 !! input
3185 [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]].]
3186 !! result
3187 <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>
3188 </p>
3189 !! end
3190
3191 !! test
3192 External link with comments in link text
3193 !! input
3194 [http://www.google.com Google <!-- comment -->]
3195 !! result
3196 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3197 </p>
3198 !! end
3199
3200 !! test
3201 URL-encoding in URL functions (single parameter)
3202 !! input
3203 {{localurl:Some page|amp=&}}
3204 !! result
3205 <p>/index.php?title=Some_page&amp;amp=&amp;
3206 </p>
3207 !! end
3208
3209 !! test
3210 URL-encoding in URL functions (multiple parameters)
3211 !! input
3212 {{localurl:Some page|q=?&amp=&}}
3213 !! result
3214 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3215 </p>
3216 !! end
3217
3218 !! test
3219 Brackets in urls
3220 !! input
3221 http://example.com/index.php?foozoid%5B%5D=bar
3222
3223 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3224 !! result
3225 <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>
3226 </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>
3227 </p>
3228 !! end
3229
3230 !! test
3231 IPv6 urls (bug 21261)
3232 !! options
3233 disabled
3234 !! input
3235 http://[2404:130:0:1000::187:2]/index.php
3236 !! result
3237 <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>
3238 </p>
3239 !! end
3240
3241 !! test
3242 Non-extlinks in brackets
3243 !! input
3244 [foo]
3245 [foo bar]
3246 [foo ''bar'']
3247 [fool's] errand
3248 [fool's errand]
3249 [{{echo|foo}}]
3250 [{{echo|foo}} bar]
3251 [{{echo|foo}} ''bar'']
3252 [{{echo|foo}}l's] errand
3253 [{{echo|foo}}l's errand]
3254 [url={{echo|foo}}]
3255 [url=http://example.com]
3256 !! result
3257 <p>[foo]
3258 [foo bar]
3259 [foo <i>bar</i>]
3260 [fool's] errand
3261 [fool's errand]
3262 [foo]
3263 [foo bar]
3264 [foo <i>bar</i>]
3265 [fool's] errand
3266 [fool's errand]
3267 [url=foo]
3268 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3269 </p>
3270 !! end
3271
3272 !! test
3273 Parsoid: Percent encoding in external links
3274 !! options
3275 parsoid
3276 !! input
3277 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
3278 !! result
3279 <p><a rel="mw:ExtLink"
3280 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
3281 !! end
3282
3283 !! test
3284 Parsoid: use url link syntax for links where the content is equal the link
3285 target
3286 !! options
3287 parsoid
3288 !! input
3289 http://example.com
3290 !! result
3291 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
3292 !! end
3293
3294 ###
3295 ### Quotes
3296 ###
3297
3298 !! test
3299 Quotes
3300 !! input
3301 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3302
3303 Normal text. '''''Bold italic text.''''' Normal text.
3304 !!result
3305 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3306 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3307 </p>
3308 !! end
3309
3310
3311 !! test
3312 Unclosed and unmatched quotes (php)
3313 !! options
3314 php
3315 !! input
3316 '''''Bold italic text '''with bold deactivated''' in between.'''''
3317
3318 '''''Bold italic text ''with italic deactivated'' in between.'''''
3319
3320 '''Bold text..
3321
3322 ..spanning two paragraphs (should not work).'''
3323
3324 '''Bold tag left open
3325
3326 ''Italic tag left open
3327
3328 Normal text.
3329
3330 <!-- Unmatching number of opening, closing tags: -->
3331 '''This year''''s election ''should'' beat '''last year''''s.
3332
3333 ''Tom'''s car is bigger than ''Susan'''s.
3334
3335 Plain ''italic'''s plain
3336 !! result
3337 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3338 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3339 </p><p><b>Bold text..</b>
3340 </p><p>..spanning two paragraphs (should not work).
3341 </p><p><b>Bold tag left open</b>
3342 </p><p><i>Italic tag left open</i>
3343 </p><p>Normal text.
3344 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3345 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3346 </p><p>Plain <i>italic'</i>s plain
3347 </p>
3348 !! end
3349 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3350 # parser strips. The wikitext contains just the first half of the bold
3351 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3352 # differently than the PHP parser.)
3353 !! test
3354 Unclosed and unmatched quotes (parsoid)
3355 !! options
3356 parsoid
3357 !! input
3358 '''''Bold italic text '''with bold deactivated''' in between.'''''
3359
3360 '''''Bold italic text ''with italic deactivated'' in between.'''''
3361
3362 '''Bold text..
3363
3364 ..spanning two paragraphs (should not work).'''
3365
3366 '''Bold tag left open
3367
3368 ''Italic tag left open
3369
3370 Normal text.
3371
3372 <!-- Unmatching number of opening, closing tags: -->
3373 '''This year''''s election ''should'' beat '''last year''''s.
3374
3375 ''Tom'''s car is bigger than ''Susan'''s.
3376
3377 Plain ''italic'''s plain
3378 !! result
3379 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3380 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3381 </p><p><b>Bold text..</b>
3382 </p><p>..spanning two paragraphs (should not work).<b></b>
3383 </p><p><b>Bold tag left open</b>
3384 </p><p><i>Italic tag left open</i>
3385 </p><p>Normal text.
3386 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3387 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3388 </p><p>Plain <i>italic'</i>s plain
3389 </p>
3390 !! end
3391
3392 ###
3393 ### Tables
3394 ###
3395 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3396 ###
3397
3398 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3399 # is the bare minimum required by the spec, see:
3400 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3401 !! test
3402 A table with no data. (php)
3403 !! options
3404 php
3405 !! input
3406 {||}
3407 !! result
3408 !! end
3409 # Parsoid team replies: empty table tags are legal in HTML5
3410 !! test
3411 A table with no data. (parsoid)
3412 !! options
3413 parsoid
3414 !! input
3415 {||}
3416 !! result
3417 <table></table>
3418 !! end
3419
3420 # A table with nothing but a caption is invalid XHTML, we might want to render
3421 # this as <p>caption</p>
3422 !! test
3423 A table with nothing but a caption (php)
3424 !! options
3425 php
3426 !! input
3427 {|
3428 |+ caption
3429 |}
3430 !! result
3431 <table>
3432 <caption> caption
3433 </caption><tr><td></td></tr></table>
3434
3435 !! end
3436 # Parsoid team replies: table with only a caption is legal in HTML5
3437 !! test
3438 A table with nothing but a caption (parsoid)
3439 !! options
3440 parsoid
3441 !! input
3442 {|
3443 |+ caption
3444 |}
3445 !! result
3446 <table><caption> caption</caption></table>
3447 !! end
3448
3449 !! test
3450 A table with caption with default-spaced attributes and a table row
3451 !! input
3452 {|
3453 |+ style="color: red;" | caption1
3454 |-
3455 | foo
3456 |}
3457 !! result
3458 <table>
3459 <caption style="color: red;"> caption1
3460 </caption>
3461 <tr>
3462 <td> foo
3463 </td></tr></table>
3464
3465 !! end
3466
3467 !! test
3468 A table with captions with non-default spaced attributes and a table row
3469 !! input
3470 {|
3471 |+style="color: red;"|caption2
3472 |+ style="color: red;"| caption3
3473 |-
3474 | foo
3475 |}
3476 !! result
3477 <table>
3478 <caption style="color: red;">caption2
3479 </caption>
3480 <caption style="color: red;"> caption3
3481 </caption>
3482 <tr>
3483 <td> foo
3484 </td></tr></table>
3485
3486 !! end
3487
3488 !! test
3489 Table td-cell syntax variations
3490 !! input
3491 {|
3492 | foo bar foo | baz
3493 | foo bar foo || baz
3494 | style='color:red;' | baz
3495 | style='color:red;' || baz
3496 |}
3497 !! result
3498 <table>
3499 <tr>
3500 <td> baz
3501 </td>
3502 <td> foo bar foo </td>
3503 <td> baz
3504 </td>
3505 <td style="color:red;"> baz
3506 </td>
3507 <td> style='color:red;' </td>
3508 <td> baz
3509 </td></tr></table>
3510
3511 !! end
3512
3513 !! test
3514 Simple table
3515 !! input
3516 {|
3517 | 1 || 2
3518 |-
3519 | 3 || 4
3520 |}
3521 !! result
3522 <table>
3523 <tr>
3524 <td> 1 </td>
3525 <td> 2
3526 </td></tr>
3527 <tr>
3528 <td> 3 </td>
3529 <td> 4
3530 </td></tr></table>
3531
3532 !! end
3533
3534 !! test
3535 Simple table but with multiple dashes for row wikitext
3536 !! input
3537 {|
3538 | foo
3539 |-----
3540 | bar
3541 |}
3542 !! result
3543 <table>
3544 <tr>
3545 <td> foo
3546 </td></tr>
3547 <tr>
3548 <td> bar
3549 </td></tr></table>
3550
3551 !! end
3552 !! test
3553 Multiplication table
3554 !! input
3555 {| border="1" cellpadding="2"
3556 |+Multiplication table
3557 |-
3558 ! &times; !! 1 !! 2 !! 3
3559 |-
3560 ! 1
3561 | 1 || 2 || 3
3562 |-
3563 ! 2
3564 | 2 || 4 || 6
3565 |-
3566 ! 3
3567 | 3 || 6 || 9
3568 |-
3569 ! 4
3570 | 4 || 8 || 12
3571 |-
3572 ! 5
3573 | 5 || 10 || 15
3574 |}
3575 !! result
3576 <table border="1" cellpadding="2">
3577 <caption>Multiplication table
3578 </caption>
3579 <tr>
3580 <th> &#215; </th>
3581 <th> 1 </th>
3582 <th> 2 </th>
3583 <th> 3
3584 </th></tr>
3585 <tr>
3586 <th> 1
3587 </th>
3588 <td> 1 </td>
3589 <td> 2 </td>
3590 <td> 3
3591 </td></tr>
3592 <tr>
3593 <th> 2
3594 </th>
3595 <td> 2 </td>
3596 <td> 4 </td>
3597 <td> 6
3598 </td></tr>
3599 <tr>
3600 <th> 3
3601 </th>
3602 <td> 3 </td>
3603 <td> 6 </td>
3604 <td> 9
3605 </td></tr>
3606 <tr>
3607 <th> 4
3608 </th>
3609 <td> 4 </td>
3610 <td> 8 </td>
3611 <td> 12
3612 </td></tr>
3613 <tr>
3614 <th> 5
3615 </th>
3616 <td> 5 </td>
3617 <td> 10 </td>
3618 <td> 15
3619 </td></tr></table>
3620
3621 !! end
3622
3623 !! test
3624 Accept "||" in table headings
3625 !! input
3626 {|
3627 !h1 || h2
3628 |}
3629 !! result
3630 <table>
3631 <tr>
3632 <th>h1 </th>
3633 <th> h2
3634 </th></tr></table>
3635
3636 !! end
3637
3638 !! test
3639 Accept "||" in indented table headings
3640 !! input
3641 :{|
3642 !h1 || h2
3643 |}
3644 !! result
3645 <dl><dd><table>
3646 <tr>
3647 <th>h1 </th>
3648 <th> h2
3649 </th></tr></table></dd></dl>
3650
3651 !! end
3652
3653 !! test
3654 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3655 !! input
3656 {|
3657 !| h1
3658 || a
3659 |}
3660 !! result
3661 <table>
3662 <tr>
3663 <th> h1
3664 </th>
3665 <td> a
3666 </td></tr></table>
3667
3668 !! end
3669
3670 !!test
3671 Accept "| !" at start of line in tables (ignore !-attribute)
3672 !!input
3673 {|
3674 |-
3675 | !style="color:red" | bar
3676 |}
3677 !!result
3678 <table>
3679
3680 <tr>
3681 <td> bar
3682 </td></tr></table>
3683
3684 !!end
3685
3686 !!test
3687 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 +/-
3688 !!input
3689 {|
3690 |-
3691 |style='color:red;'|+1
3692 |style='color:blue;'|-1
3693 |-
3694 | 1 || 2 || 3
3695 | 1 ||+2 ||-3
3696 |-
3697 | +1
3698 | -1
3699 |}
3700 !!result
3701 <table>
3702
3703 <tr>
3704 <td style="color:red;">+1
3705 </td>
3706 <td style="color:blue;">-1
3707 </td></tr>
3708 <tr>
3709 <td> 1 </td>
3710 <td> 2 </td>
3711 <td> 3
3712 </td>
3713 <td> 1 </td>
3714 <td>+2 </td>
3715 <td>-3
3716 </td></tr>
3717 <tr>
3718 <td> +1
3719 </td>
3720 <td> -1
3721 </td></tr></table>
3722
3723 !!end
3724
3725 !! test
3726 Table rowspan
3727 !! input
3728 {| border=1
3729 | Cell 1, row 1
3730 |rowspan=2| Cell 2, row 1 (and 2)
3731 | Cell 3, row 1
3732 |-
3733 | Cell 1, row 2
3734 | Cell 3, row 2
3735 |}
3736 !! result
3737 <table border="1">
3738 <tr>
3739 <td> Cell 1, row 1
3740 </td>
3741 <td rowspan="2"> Cell 2, row 1 (and 2)
3742 </td>
3743 <td> Cell 3, row 1
3744 </td></tr>
3745 <tr>
3746 <td> Cell 1, row 2
3747 </td>
3748 <td> Cell 3, row 2
3749 </td></tr></table>
3750
3751 !! end
3752
3753 !! test
3754 Nested table
3755 !! input
3756 {| border=1
3757 | &alpha;
3758 |
3759 {| bgcolor=#ABCDEF border=2
3760 |nested
3761 |-
3762 |table
3763 |}
3764 |the original table again
3765 |}
3766 !! result
3767 <table border="1">
3768 <tr>
3769 <td> &#945;
3770 </td>
3771 <td>
3772 <table bgcolor="#ABCDEF" border="2">
3773 <tr>
3774 <td>nested
3775 </td></tr>
3776 <tr>
3777 <td>table
3778 </td></tr></table>
3779 </td>
3780 <td>the original table again
3781 </td></tr></table>
3782
3783 !! end
3784
3785 !! test
3786 Invalid attributes in table cell (bug 1830)
3787 !! input
3788 {|
3789 |Cell:|broken
3790 |}
3791 !! result
3792 <table>
3793 <tr>
3794 <td>broken
3795 </td></tr></table>
3796
3797 !! end
3798
3799
3800 !! test
3801 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3802 !! input
3803 {|
3804 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3805 !! result
3806 <table>
3807 <tr>
3808 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3809 <td>]" onmouseover="alert(document.cookie)"&gt;test
3810 </td>
3811 </tr>
3812 </table>
3813
3814 !! end
3815
3816
3817 !! test
3818 Indented table markup mixed with indented pre content (proposed in bug 6200)
3819 !! input
3820 <table>
3821 <tr>
3822 <td>
3823 Text that should be rendered preformatted
3824 </td>
3825 </tr>
3826 </table>
3827 !! result
3828 <table>
3829 <tr>
3830 <td>
3831 <pre>Text that should be rendered preformatted
3832 </pre>
3833 </td>
3834 </tr>
3835 </table>
3836
3837 !! end
3838
3839 !! test
3840 Template-generated table cell attributes and cell content
3841 !! input
3842 {|
3843 |{{table_attribs}}
3844 |}
3845 !! result
3846 <table>
3847 <tr>
3848 <td style="color: red"> Foo
3849 </td></tr></table>
3850
3851 !! end
3852
3853 !! test
3854 Table with row followed by newlines and table heading
3855 !! input
3856 {|
3857 |-
3858
3859 ! foo
3860 |}
3861 !! result
3862 <table>
3863
3864
3865 <tr>
3866 <th> foo
3867 </th></tr></table>
3868
3869 !! end
3870
3871 !! test
3872 Table with empty line following the start tag
3873 !! input
3874 {|
3875
3876 |-
3877 | foo
3878 |}
3879 !! result
3880 <table>
3881
3882
3883 <tr>
3884 <td> foo
3885 </td></tr></table>
3886
3887 !! end
3888
3889 # FIXME: Preserve the attribute properly (with an empty string as value) in
3890 # the PHP parser. Parsoid implements the behavior below.
3891 !! test
3892 Table attributes with empty value
3893 !! options
3894 parsoid
3895 !! input
3896 {|
3897 | style=| hello
3898 |}
3899 !! result
3900 <table>
3901 <tbody>
3902 <tr>
3903 <td style=""> hello
3904 </td></tr></tbody></table>
3905
3906 !! end
3907
3908 !! test
3909 Wikitext table with a lot of comments
3910 !! input
3911 {|
3912 <!-- c0 -->
3913 | foo
3914 <!-- c1 -->
3915 |- <!-- c2 -->
3916 <!-- c3 -->
3917 |<!-- c4 -->
3918 <!-- c5 -->
3919 |}
3920 !! result
3921 <table>
3922 <tr>
3923 <td> foo
3924 </td></tr>
3925 <tr>
3926 <td>
3927 </td></tr></table>
3928
3929 !! end
3930
3931 !! test
3932 Wikitext table with double-line table cell
3933 !! input
3934 {|
3935 |a
3936 b
3937 |}
3938 !! result
3939 <table>
3940 <tr>
3941 <td>a
3942 <p>b
3943 </p>
3944 </td></tr></table>
3945
3946 !! end
3947
3948 !! test
3949 Table cell with a single comment
3950 !! input
3951 {|
3952 | <!-- c1 -->
3953 | a
3954 |}
3955 !! result
3956 <table>
3957 <tr>
3958 <td>
3959 </td>
3960 <td> a
3961 </td></tr></table>
3962
3963 !! end
3964
3965 # The expected HTML structure in this test is debatable. The PHP parser does
3966 # not parse this kind of table at all. The main focus for Parsoid is on
3967 # round-tripping, so this output is ok for now. TODO: revisit!
3968 !! test
3969 Wikitext table with html-syntax row (Parsoid)
3970 !! options
3971 parsoid
3972 !! input
3973 {|
3974 |-
3975 <td>foo</td>
3976 |}
3977 !! result
3978 <table>
3979 <tbody>
3980 <tr>
3981 <td>foo</td></tr></tbody></table>
3982 !! end
3983
3984 !! test
3985 Implicit <td> after a |-
3986 (PHP parser relies on Tidy to add the missing <td> tags)
3987 !! options
3988 parsoid=wt2html,wt2wt
3989 !! input
3990 {|
3991 |-
3992 a
3993 |}
3994 !! result
3995 <table>
3996 <tr><td>a</td></tr>
3997 </table>
3998 !! end
3999
4000 !! test
4001 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
4002 (PHP parser relies on Tidy to add the missing <td> tags)
4003 !! options
4004 parsoid=wt2html,wt2wt
4005 !! input
4006 {|
4007 |-
4008 |
4009 a
4010 |-
4011 b
4012 |}
4013 !! result
4014 <table>
4015 <tbody>
4016 <tr><td><pre>a</pre></td></tr>
4017 <tr><td> b</td></tr>
4018 </tbody>
4019 </table>
4020 !! end
4021
4022 !! test
4023 Lists should be recognized in an implicit <td> context
4024 (PHP parser relies on Tidy to add the missing <td> tags)
4025 !! options
4026 parsoid=wt2html,wt2wt
4027 !! input
4028 {|
4029 |-
4030 *a
4031 |}
4032 !! result
4033 <table>
4034 <tr>
4035 <td><ul><li>a</li></ul></td>
4036 </tr>
4037 </table>
4038 !! end
4039
4040 ###
4041 ### Internal links
4042 ###
4043 !! test
4044 Plain link, capitalized
4045 !! input
4046 [[Main Page]]
4047 !! result
4048 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4049 </p>
4050 !! end
4051
4052 !! test
4053 Plain link, uncapitalized
4054 !! input
4055 [[main Page]]
4056 !! result
4057 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
4058 </p>
4059 !! end
4060
4061 !! test
4062 Piped link
4063 !! input
4064 [[Main Page|The Main Page]]
4065 !! result
4066 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4067 </p>
4068 !! end
4069
4070 !! test
4071 Piped link with comment in link text
4072 !! input
4073 [[Main Page|The Main<!--front--> Page]]
4074 !! result
4075 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4076 </p>
4077 !! end
4078
4079 !! test
4080 Broken link
4081 !! input
4082 [[Zigzagzogzagzig]]
4083 !! result
4084 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
4085 </p>
4086 !! end
4087
4088 !! test
4089 Broken link with fragment
4090 !! input
4091 [[Zigzagzogzagzig#zug]]
4092 !! result
4093 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
4094 </p>
4095 !! end
4096
4097 !! test
4098 Special page link with fragment
4099 !! input
4100 [[Special:Version#anchor]]
4101 !! result
4102 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
4103 </p>
4104 !! end
4105
4106 !! test
4107 Nonexistent special page link with fragment
4108 !! input
4109 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
4110 !! result
4111 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
4112 </p>
4113 !! end
4114
4115 !! test
4116 Link with prefix
4117 !! input
4118 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
4119 !! result
4120 <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>
4121 </p>
4122 !! end
4123
4124 !! test
4125 Link with suffix
4126 !! input
4127 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
4128 !! result
4129 <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>!!!
4130 </p>
4131 !! end
4132
4133 !! article
4134 prefixed article
4135 !! text
4136 Some text
4137 !! endarticle
4138
4139 !! test
4140 Bug 43661: Piped links with identical prefixes
4141 !! input
4142 [[prefixed article|prefixed articles with spaces]]
4143
4144 [[prefixed article|prefixed articlesaoeu]]
4145
4146 [[Main Page|Main Page test]]
4147 !! result
4148 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
4149 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
4150 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
4151 </p>
4152 !! end
4153
4154
4155 !! test
4156 Link with HTML entity in suffix / tail
4157 !! input
4158 [[Main Page]]&quot;, [[Main Page]]&#97;
4159 !! result
4160 <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;
4161 </p>
4162 !! end
4163
4164 !! test
4165 Link with 3 brackets
4166 !! input
4167 [[[main page]]]
4168 !! result
4169 <p>[[[main page]]]
4170 </p>
4171 !! end
4172
4173 !! test
4174 Piped link with 3 brackets
4175 !! input
4176 [[[main page|the main page]]]
4177 !! result
4178 <p>[[[main page|the main page]]]
4179 </p>
4180 !! end
4181
4182 !! test
4183 Link with multiple pipes
4184 !! input
4185 [[Main Page|The|Main|Page]]
4186 !! result
4187 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
4188 </p>
4189 !! end
4190
4191 !! test
4192 Link to namespaces
4193 !! input
4194 [[Talk:Parser testing]], [[Meta:Disclaimers]]
4195 !! result
4196 <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>
4197 </p>
4198 !! end
4199
4200 !! test
4201 Piped link to namespace
4202 !! input
4203 [[Meta:Disclaimers|The disclaimers]]
4204 !! result
4205 <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>
4206 </p>
4207 !! end
4208
4209 !! test
4210 Link containing }
4211 !! input
4212 [[Usually caused by a typo (oops}]]
4213 !! result
4214 <p>[[Usually caused by a typo (oops}]]
4215 </p>
4216 !! end
4217
4218 !! test
4219 Link containing % (not as a hex sequence)
4220 !! input
4221 [[7% Solution]]
4222 !! result
4223 <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>
4224 </p>
4225 !! end
4226
4227 !! test
4228 Link containing % as a single hex sequence interpreted to char
4229 !! input
4230 [[7%25 Solution]]
4231 !! result
4232 <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>
4233 </p>
4234 !!end
4235
4236 !! test
4237 Link containing % as a double hex sequence interpreted to hex sequence
4238 !! input
4239 [[7%2525 Solution]]
4240 !! result
4241 <p>[[7%2525 Solution]]
4242 </p>
4243 !!end
4244
4245 !! test
4246 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
4247 Example for such a section: == < ==
4248 !! input
4249 [[%23%3c]][[%23%3e]]
4250 !! result
4251 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
4252 </p>
4253 !! end
4254
4255 !! test
4256 Link containing "<#" and ">#" as a hex sequences
4257 !! input
4258 [[%3c%23]][[%3e%23]]
4259 !! result
4260 <p>[[%3c%23]][[%3e%23]]
4261 </p>
4262 !! end
4263
4264 !! test
4265 Link containing an equals sign
4266 !! input
4267 [[Special:BookSources/isbn=4-00-026157-6]]
4268 !! result
4269 <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>
4270 </p>
4271 !! end
4272
4273 !! article
4274 Foo~bar
4275 !! text
4276 Just a test of an article title containing a tilde.
4277 !! endarticle
4278
4279 # note that links containing signatures, like [[Foo~~~~]], are
4280 # massaged by the pre-save transform (PST) and so the tildes are never
4281 # seen by the parser.
4282 !! test
4283 Link containing a tilde
4284 !! input
4285 [[Foo~bar]]
4286 !! result
4287 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
4288 </p>
4289 !! end
4290
4291 !! test
4292 Link containing double-single-quotes '' (bug 4598)
4293 !! input
4294 [[Lista d''e paise d''o munno]]
4295 !! result
4296 <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>
4297 </p>
4298 !! end
4299
4300 !! test
4301 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4302 !! input
4303 Some [[Link|pretty ''italics'' and stuff]]!
4304 !! result
4305 <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>!
4306 </p>
4307 !! end
4308
4309 !! test
4310 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4311 !! input
4312 ''Some [[Link|pretty ''italics'' and stuff]]!
4313 !! result
4314 <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>
4315 </p>
4316 !! end
4317
4318 !! test
4319 Link with double quotes in title part (literal) and alternate part (interpreted)
4320 !! input
4321 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4322
4323 [[''Pentecoste'']]
4324
4325 [[''Pentecoste''|Pentecoste]]
4326
4327 [[''Pentecoste''|''Pentecoste'']]
4328 !! result
4329 <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>
4330 </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>
4331 </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>
4332 </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>
4333 </p>
4334 !! end
4335
4336 !! test
4337 Broken image links with HTML captions (bug 39700)
4338 !! input
4339 [[File:Nonexistent|<script></script>]]
4340 [[File:Nonexistent|100px|<script></script>]]
4341 [[File:Nonexistent|&lt;]]
4342 [[File:Nonexistent|a<i>b</i>c]]
4343 !! result
4344 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4345 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4346 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4347 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4348 </p>
4349 !! end
4350
4351 !! test
4352 Plain link to URL
4353 !! input
4354 [[http://www.example.com]]
4355 !! result
4356 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4357 </p>
4358 !! end
4359
4360 !! test
4361 Plain link to URL with link text
4362 !! input
4363 [[http://www.example.com Link text]]
4364 !! result
4365 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4366 </p>
4367 !! end
4368
4369 !! test
4370 Plain link to protocol-relative URL
4371 !! input
4372 [[//www.example.com]]
4373 !! result
4374 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4375 </p>
4376 !! end
4377
4378 !! test
4379 Plain link to protocol-relative URL with link text
4380 !! input
4381 [[//www.example.com Link text]]
4382 !! result
4383 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4384 </p>
4385 !! end
4386
4387 !! test
4388 Plain link to page with question mark in title
4389 !! input
4390 [[A?b]]
4391
4392 [[A?b|Baz]]
4393 !! result
4394 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4395 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4396 </p>
4397 !! end
4398
4399
4400 # I'm fairly sure the expected result here is wrong.
4401 # We want these to be URL links, not pseudo-pages with URLs for titles....
4402 # However the current output is also pretty screwy.
4403 #
4404 # ----
4405 # I'm changing it to match the current output--it arguably makes more
4406 # sense in the light of the test above. Old expected result was:
4407 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4408 #</p>
4409 # But I think this test is bordering on "garbage in, garbage out" anyway.
4410 # -- wtm
4411 !! test
4412 Piped link to URL
4413 !! input
4414 Piped link to URL: [[http://www.example.com|an example URL]]
4415 !! result
4416 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4417 </p>
4418 !! end
4419
4420 !! test
4421 BUG 2: [[page|http://url/]] should link to page, not http://url/
4422 !! input
4423 [[Main Page|http://url/]]
4424 !! result
4425 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4426 </p>
4427 !! end
4428
4429 !! test
4430 BUG 337: Escaped self-links should be bold
4431 !! options
4432 title=[[Bug462]]
4433 !! input
4434 [[Bu&#103;462]] [[Bug462]]
4435 !! result
4436 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4437 </p>
4438 !! end
4439
4440 !! test
4441 Self-link to section should not be bold
4442 !! options
4443 title=[[Main Page]]
4444 !! input
4445 [[Main Page#section]]
4446 !! result
4447 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4448 </p>
4449 !! end
4450
4451 !! article
4452 00
4453 !! text
4454 This is 00.
4455 !! endarticle
4456
4457 !!test
4458 Self-link to numeric title
4459 !!options
4460 title=[[0]]
4461 !!input
4462 [[0]]
4463 !!result
4464 <p><strong class="selflink">0</strong>
4465 </p>
4466 !!end
4467
4468 !!test
4469 Link to numeric-equivalent title
4470 !!options
4471 title=[[0]]
4472 !!input
4473 [[00]]
4474 !!result
4475 <p><a href="/wiki/00" title="00">00</a>
4476 </p>
4477 !!end
4478
4479 !! test
4480 <nowiki> inside a link
4481 !! input
4482 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4483 !! result
4484 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4485 </p>
4486 !! end
4487
4488 !! test
4489 Non-breaking spaces in title
4490 !! input
4491 [[&nbsp; Main &nbsp; Page &nbsp;]]
4492 !! result
4493 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4494 </p>
4495 !!end
4496
4497 !! test
4498 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4499 !! options
4500 language=ca
4501 !! input
4502 '''[[Main Page]]'''
4503 !! result
4504 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4505 </p>
4506 !! end
4507
4508 !! test
4509 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4510 !! options
4511 language=ca
4512 !! input
4513 ''[[Main Page]]''
4514 !! result
4515 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4516 </p>
4517 !! end
4518
4519 !! test
4520 Internal link with en linktrail: no apostrophes (bug 27473)
4521 !! options
4522 language=en
4523 !! input
4524 [[Something]]'nice
4525 !! result
4526 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4527 </p>
4528 !! end
4529
4530 !! test
4531 Internal link with ca linktrail with apostrophes (bug 27473)
4532 !! options
4533 language=ca
4534 !! input
4535 [[Something]]'nice
4536 !! result
4537 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4538 </p>
4539 !! end
4540
4541 !! test
4542 Internal link with kaa linktrail with apostrophes (bug 27473)
4543 !! options
4544 language=kaa
4545 !! input
4546 [[Something]]'nice
4547 !! result
4548 <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>
4549 </p>
4550 !! end
4551
4552 !! article
4553 Söfnuður
4554 !! text
4555 Test.
4556 !! endarticle
4557
4558 !! test
4559 Internal link with is link prefix
4560 !! options
4561 language=is
4562 !! input
4563 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
4564 !! result
4565 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
4566 </p>
4567 !! end
4568
4569 !! article
4570 Mótmælendatrú
4571 !! text
4572 Test.
4573 !! endarticle
4574
4575 !! test
4576 Internal link with is link trail and link prefix
4577 !! options
4578 language=is
4579 !! input
4580 [[mótmælendatrú|xxx]]ar
4581 [[mótmælendatrú]]ar
4582 mótmælenda[[söfnuður]]
4583 mótmælenda[[söfnuður|söfnuðir]]
4584 mótmælenda[[söfnuður|söfnuðir]]xxx
4585 !! result
4586 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
4587 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
4588 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
4589 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
4590 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
4591 </p>
4592 !! end
4593
4594 !! test
4595 Parsoid link trail escaping
4596 !! options
4597 parsoid=html2wt,html2html
4598 !! input
4599 [[apple]]<nowiki/>s
4600 !! result
4601 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
4602 !! end
4603
4604 !! test
4605 Parsoid link prefix escaping
4606 !! options
4607 language=is
4608 parsoid=html2wt,html2html
4609 !! input
4610 Aðrir mótmælenda<nowiki/>[[söfnuður]]
4611 !! result
4612 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
4613 !! end
4614
4615 !! test
4616 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4617 !! input
4618 [[Foo| bar]]
4619
4620 [[Foo| ''bar'']]
4621
4622 [http://wp.org foo]
4623
4624 [http://wp.org ''foo'']
4625 !! result
4626 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
4627 </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>
4628 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4629 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4630 </p>
4631 !! end
4632
4633 ###
4634 ### Interwiki links (see maintenance/interwiki.sql)
4635 ###
4636
4637 !! test
4638 Inline interwiki link
4639 !! input
4640 [[MeatBall:SoftSecurity]]
4641 !! result
4642 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4643 </p>
4644 !! end
4645
4646 !! test
4647 Inline interwiki link with empty title (bug 2372)
4648 !! input
4649 [[MeatBall:]]
4650 !! result
4651 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4652 </p>
4653 !! end
4654
4655 !! test
4656 Interwiki link encoding conversion (bug 1636)
4657 !! input
4658 *[[Wikipedia:ro:Olteni&#0355;a]]
4659 *[[Wikipedia:ro:Olteni&#355;a]]
4660 !! result
4661 <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>
4662 </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>
4663 </li></ul>
4664
4665 !! end
4666
4667 !! test
4668 Interwiki link with fragment (bug 2130)
4669 !! input
4670 [[MeatBall:SoftSecurity#foo]]
4671 !! result
4672 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4673 </p>
4674 !! end
4675
4676 !! test
4677 Interlanguage link
4678 !! input
4679 Blah blah blah
4680 [[zh:Chinese]]
4681 !!result
4682 <p>Blah blah blah
4683 </p>
4684 !! end
4685
4686 !! test
4687 Double interlanguage link
4688 !! input
4689 Blah blah blah
4690 [[es:Spanish]]
4691 [[zh:Chinese]]
4692 !!result
4693 <p>Blah blah blah
4694 </p>
4695 !! end
4696
4697 !! test
4698 Interlanguage link, with prefix links
4699 !! options
4700 language=ln
4701 !! input
4702 Blah blah blah
4703 [[zh:Chinese]]
4704 !!result
4705 <p>Blah blah blah
4706 </p>
4707 !! end
4708
4709 !! test
4710 Double interlanguage link, with prefix links (bug 8897)
4711 !! options
4712 language=ln
4713 !! input
4714 Blah blah blah
4715 [[es:Spanish]]
4716 [[zh:Chinese]]
4717 !!result
4718 <p>Blah blah blah
4719 </p>
4720 !! end
4721
4722 !! test
4723 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4724 !! options
4725 language=ln
4726 !! input
4727 [[WW&nbsp;II]]
4728 !!result
4729 <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>
4730 </p>
4731 !! end
4732
4733 !! test
4734 Parsoid: handle constructor well
4735 !! options
4736 parsoid
4737 !! input
4738 [[constructor]]
4739
4740 [[constructor:foo]]
4741 !! result
4742 <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>
4743
4744
4745 <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>
4746 !! end
4747
4748 ##
4749 ## Redirects, Parsoid-only
4750 ##
4751 !! test
4752 Simple redirect to page
4753 !! options
4754 parsoid
4755 !! input
4756 #REDIRECT [[Main Page]]
4757 !! result
4758 <link rel="mw:PageProp/redirect" href="./Main_Page">
4759 !! end
4760
4761 !! test
4762 Redirect to category
4763 !! options
4764 parsoid=wt2html
4765 !! input
4766 #REDIRECT [[Category:Foo]]
4767 !! result
4768 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
4769 !! end
4770
4771 !! test
4772 Redirect to category page
4773 !! options
4774 parsoid=wt2html,html2html
4775 !! input
4776 #REDIRECT [[:Category:Foo]]
4777 !! result
4778 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
4779 !! end
4780
4781 !! test
4782 Redirect to image page
4783 !! options
4784 parsoid
4785 !! input
4786 #REDIRECT [[File:Wiki.png]]
4787 !! result
4788 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
4789 !! end
4790
4791 !! test
4792 Redirect to language
4793 !! options
4794 parsoid
4795 !! input
4796 #REDIRECT [[en:File:Wiki.png]]
4797 !! result
4798 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
4799 !! end
4800
4801 !! test
4802 Redirect to interwiki
4803 !! options
4804 parsoid
4805 !! input
4806 #REDIRECT [[meatball:File:Wiki.png]]
4807 !! result
4808 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
4809 !! end
4810
4811 ##
4812 ## XHTML tidiness
4813 ###
4814
4815 !! test
4816 <br> to <br />
4817 !! input
4818 1<br>2<br />3
4819 !! result
4820 <p>1<br />2<br />3
4821 </p>
4822 !! end
4823
4824 !! test
4825 Broken br tag sanitization
4826 !! options
4827 php
4828 !! input
4829 </br>
4830 !! result
4831 <p>&lt;/br&gt;
4832 </p>
4833 !! end
4834
4835 # TODO: Fix html2html mode (bug 51055)!
4836 !! test
4837 Parsoid: Broken br tag recognition
4838 !! options
4839 parsoid=wt2html
4840 !! input
4841 </br>
4842 !! result
4843 <p><br></p>
4844 !! end
4845
4846 !! test
4847 Incorrecly removing closing slashes from correctly formed XHTML
4848 !! input
4849 <br style="clear:both;" />
4850 !! result
4851 <p><br style="clear:both;" />
4852 </p>
4853 !! end
4854
4855 !! test
4856 Failing to transform badly formed HTML into correct XHTML
4857 !! input
4858 <br style="clear: left;">
4859 <br style="clear: right;">
4860 <br style="clear: both;">
4861 !! result
4862 <p><br style="clear: left;" />
4863 <br style="clear: right;" />
4864 <br style="clear: both;" />
4865 </p>
4866 !!end
4867
4868 !! test
4869 Handling html with a div self-closing tag
4870 !! input
4871 <div title />
4872 <div title/>
4873 <div title/ >
4874 <div title=bar />
4875 <div title=bar/>
4876 <div title=bar/ >
4877 !! result
4878 <p>&lt;div title /&gt;
4879 &lt;div title/&gt;
4880 </p>
4881 <div>
4882 <p>&lt;div title=bar /&gt;
4883 &lt;div title=bar/&gt;
4884 </p>
4885 <div title="bar/"></div>
4886 </div>
4887
4888 !! end
4889
4890 !! test
4891 Handling html with a br self-closing tag
4892 !! input
4893 <br title />
4894 <br title/>
4895 <br title/ >
4896 <br title=bar />
4897 <br title=bar/>
4898 <br title=bar/ >
4899 !! result
4900 <p><br title="title" />
4901 <br title="title" />
4902 <br />
4903 <br title="bar" />
4904 <br title="bar" />
4905 <br title="bar/" />
4906 </p>
4907 !! end
4908
4909 !! test
4910 Horizontal ruler (should it add that extra space?)
4911 !! input
4912 <hr>
4913 <hr >
4914 foo <hr
4915 > bar
4916 !! result
4917 <hr />
4918 <hr />
4919 foo <hr /> bar
4920
4921 !! end
4922
4923 !! test
4924 Horizontal ruler -- 4+ dashes render hr
4925 !! input
4926 ----
4927 !! result
4928 <hr />
4929
4930 !! end
4931
4932 !! test
4933 Horizontal ruler -- eats additional dashes on the same line
4934 !! input
4935 ---------
4936 !! result
4937 <hr />
4938
4939 !! end
4940
4941 !! test
4942 Horizontal ruler -- does not collapse dashes on consecutive lines
4943 !! input
4944 ----
4945 ----
4946 !! result
4947 <hr />
4948 <hr />
4949
4950 !! end
4951
4952 !! test
4953 Horizontal ruler -- <4 dashes render as plain text
4954 !! input
4955 ---
4956 !! result
4957 <p>---
4958 </p>
4959 !! end
4960
4961 !! test
4962 Horizontal ruler -- Supports content following dashes on same line
4963 !! input
4964 ---- Foo
4965 !! result
4966 <hr /> Foo
4967
4968 !! end
4969
4970 ###
4971 ### Block-level elements
4972 ###
4973 !! test
4974 Common list
4975 !! input
4976 *Common list
4977 * item 2
4978 *item 3
4979 !! result
4980 <ul><li>Common list
4981 </li><li> item 2
4982 </li><li>item 3
4983 </li></ul>
4984
4985 !! end
4986
4987 !! test
4988 Numbered list
4989 !! input
4990 #Numbered list
4991 #item 2
4992 # item 3
4993 !! result
4994 <ol><li>Numbered list
4995 </li><li>item 2
4996 </li><li> item 3
4997 </li></ol>
4998
4999 !! end
5000
5001 !! test
5002 Mixed list
5003 !! input
5004 *Mixed list
5005 *# with numbers
5006 ** and bullets
5007 *# and numbers
5008 *bullets again
5009 **bullet level 2
5010 ***bullet level 3
5011 ***#Number on level 4
5012 **bullet level 2
5013 **#Number on level 3
5014 **#Number on level 3
5015 *#number level 2
5016 *Level 1
5017 *** Level 3
5018 #** Level 3, but ordered
5019 !! result
5020 <ul><li>Mixed list
5021 <ol><li> with numbers
5022 </li></ol>
5023 <ul><li> and bullets
5024 </li></ul>
5025 <ol><li> and numbers
5026 </li></ol>
5027 </li><li>bullets again
5028 <ul><li>bullet level 2
5029 <ul><li>bullet level 3
5030 <ol><li>Number on level 4
5031 </li></ol>
5032 </li></ul>
5033 </li><li>bullet level 2
5034 <ol><li>Number on level 3
5035 </li><li>Number on level 3
5036 </li></ol>
5037 </li></ul>
5038 <ol><li>number level 2
5039 </li></ol>
5040 </li><li>Level 1
5041 <ul><li><ul><li> Level 3
5042 </li></ul>
5043 </li></ul>
5044 </li></ul>
5045 <ol><li><ul><li><ul><li> Level 3, but ordered
5046 </li></ul>
5047 </li></ul>
5048 </li></ol>
5049
5050 !! end
5051
5052 !! test
5053 Nested lists 1
5054 !! input
5055 *foo
5056 **bar
5057 !! result
5058 <ul><li>foo
5059 <ul><li>bar
5060 </li></ul>
5061 </li></ul>
5062
5063 !! end
5064
5065 !! test
5066 Nested lists 2
5067 !! input
5068 **foo
5069 *bar
5070 !! result
5071 <ul><li><ul><li>foo
5072 </li></ul>
5073 </li><li>bar
5074 </li></ul>
5075
5076 !! end
5077
5078 !! test
5079 Nested lists 3 (first element empty)
5080 !! input
5081 *
5082 **bar
5083 !! result
5084 <ul><li>
5085 <ul><li>bar
5086 </li></ul>
5087 </li></ul>
5088
5089 !! end
5090
5091 !! test
5092 Nested lists 4 (first element empty)
5093 !! input
5094 **
5095 *bar
5096 !! result
5097 <ul><li><ul><li>
5098 </li></ul>
5099 </li><li>bar
5100 </li></ul>
5101
5102 !! end
5103
5104 !! test
5105 Nested lists 5 (both elements empty)
5106 !! input
5107 **
5108 *
5109 !! result
5110 <ul><li><ul><li>
5111 </li></ul>
5112 </li><li>
5113 </li></ul>
5114
5115 !! end
5116
5117 !! test
5118 Nested lists 6 (both elements empty)
5119 !! input
5120 *
5121 **
5122 !! result
5123 <ul><li>
5124 <ul><li>
5125 </li></ul>
5126 </li></ul>
5127
5128 !! end
5129
5130 !! test
5131 Nested lists 7 (skip initial nesting levels)
5132 !! input
5133 *** foo
5134 !! result
5135 <ul><li><ul><li><ul><li> foo
5136 </li></ul>
5137 </li></ul>
5138 </li></ul>
5139
5140 !! end
5141
5142 !! test
5143 Nested lists 8 (multiple nesting transitions)
5144 !! input
5145 * foo
5146 *** bar
5147 ** baz
5148 * boo
5149 !! result
5150 <ul><li> foo
5151 <ul><li><ul><li> bar
5152 </li></ul>
5153 </li><li> baz
5154 </li></ul>
5155 </li><li> boo
5156 </li></ul>
5157
5158 !! end
5159
5160 !! test
5161 1. Lists with start-of-line-transparent tokens before bullets: Comments
5162 !! input
5163 *foo
5164 *<!--cmt-->bar
5165 <!--cmt-->*baz
5166 !! result
5167 <ul><li>foo
5168 </li><li>bar
5169 </li><li>baz
5170 </li></ul>
5171
5172 !! end
5173
5174 !! test
5175 2. Lists with start-of-line-transparent tokens before bullets: Template close
5176 !! input
5177 *foo {{echo|bar
5178 }}*baz
5179 !! result
5180 <ul><li>foo bar
5181 </li><li>baz
5182 </li></ul>
5183
5184 !! end
5185
5186 !! test
5187 Unbalanced closing block tags break a list
5188 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5189 !! options
5190 parsoid
5191 !! input
5192 <div>
5193 *a</div><div>
5194 *b</div>
5195 !! result
5196 <div>
5197 <ul><li>a
5198 </li></ul></div><div>
5199 <ul><li>b
5200 </li></ul></div>
5201 !! end
5202
5203 !! test
5204 Unbalanced closing non-block tags don't break a list
5205 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5206 !! options
5207 parsoid
5208 !! input
5209 <span>
5210 *a</span><span>
5211 *b</span>
5212 !! result
5213 <p><span></span>
5214 </p>
5215 <ul><li>a<span></span>
5216 </li><li>b
5217 </li></ul>
5218 !! end
5219
5220 !! test
5221 Unclosed formatting tags that straddle lists are closed and reopened
5222 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5223 !! options
5224 parsoid
5225 !! input
5226 # <s> a
5227 # b </s>
5228 !! result
5229 <ol><li> <s> a </s>
5230 </li><li> <s> b </s>
5231 </li></ol>
5232 !! end
5233
5234 !!test
5235 List embedded in a non-block tag
5236 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
5237 !! options
5238 parsoid
5239 !!input
5240 <small>
5241 * foo
5242 </small>
5243 !!result
5244 <p><small></small></p>
5245 <small>
5246 <ul>
5247 <li> foo</li>
5248 </ul>
5249 </small>
5250 <p><small></small></p>
5251 !!end
5252
5253 !! test
5254 List items are not parsed correctly following a <pre> block (bug 785)
5255 !! input
5256 * <pre>foo</pre>
5257 * <pre>bar</pre>
5258 * zar
5259 !! result
5260 <ul><li> <pre>foo</pre>
5261 </li><li> <pre>bar</pre>
5262 </li><li> zar
5263 </li></ul>
5264
5265 !! end
5266
5267 !! test
5268 List items from template
5269 !! input
5270
5271 {{inner list}}
5272 * item 2
5273
5274 * item 0
5275 {{inner list}}
5276 * item 2
5277
5278 * item 0
5279 * notSOL{{inner list}}
5280 * item 2
5281 !! result
5282 <ul><li> item 1
5283 </li><li> item 2
5284 </li></ul>
5285 <ul><li> item 0
5286 </li><li> item 1
5287 </li><li> item 2
5288 </li></ul>
5289 <ul><li> item 0
5290 </li><li> notSOL
5291 </li><li> item 1
5292 </li><li> item 2
5293 </li></ul>
5294
5295 !! end
5296
5297 !! test
5298 List interrupted by empty line or heading
5299 !! input
5300 * foo
5301
5302 ** bar
5303 == A heading ==
5304 * Another list item
5305 !! result
5306 <ul><li> foo
5307 </li></ul>
5308 <ul><li><ul><li> bar
5309 </li></ul>
5310 </li></ul>
5311 <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>
5312 <ul><li> Another list item
5313 </li></ul>
5314
5315 !!end
5316
5317 !!test
5318 Multiple list tags generated by templates
5319 !!input
5320 {{echo|<li>}}a
5321 {{echo|<li>}}b
5322 {{echo|<li>}}c
5323 !!result
5324 <li>a
5325 <li>b
5326 <li>c</li>
5327 </li>
5328 </li>
5329
5330 !!end
5331
5332 !!test
5333 Single-comment whitespace lines dont break lists, but multi-comment whitespace lines do
5334 !!input
5335 *a
5336 <!--This line will NOT split the list-->
5337 *b
5338 <!--This line will NOT split the list either-->
5339 *c
5340 <!--foo--> <!--This line with more than 1 comment will split the list-->
5341 *d
5342 !!result
5343 <ul><li>a
5344 </li><li>b
5345 </li><li>c
5346 </li></ul>
5347 <ul><li>d
5348 </li></ul>
5349
5350 !!end
5351
5352 !!test
5353 Test the li-hack
5354 (Cannot test this with PHP parser since it relies on Tidy for the hack)
5355 !!options
5356 parsoid=wt2html,wt2wt
5357 !!input
5358 * foo
5359 * <li>li-hack
5360 * {{echo|<li>templated li-hack}}
5361 * <!--foo--> <li> unsupported li-hack with preceding comments
5362
5363 <ul>
5364 <li><li>not a li-hack
5365 </li>
5366 </ul>
5367 !!result
5368 <ul><li> foo</li>
5369 <li>li-hack</li>
5370 <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>
5371 <li> <!--foo--> </li><li> li-hack with preceding comments</li></ul>
5372
5373 <ul>
5374 <li></li><li>not a li-hack
5375 </li>
5376 </ul>
5377 !!end
5378
5379 !! test
5380 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
5381 !! options
5382 parsoid
5383 !! input
5384 # foo
5385 ## bar
5386 * foo
5387 ** bar
5388 : foo
5389 :: bar
5390 !! result
5391 <ol><li> foo<ol><li> bar</li></ol></li></ol><ul><li> foo<ul><li> bar</li></ul></li></ul><dl><dd> foo<dl><dd> bar</dd></dl></dd></dl>
5392 !! end
5393
5394
5395 ###
5396 ### Magic Words
5397 ###
5398
5399 !! test
5400 Magic Word: {{CURRENTDAY}}
5401 !! input
5402 {{CURRENTDAY}}
5403 !! result
5404 <p>1
5405 </p>
5406 !! end
5407
5408 !! test
5409 Magic Word: {{CURRENTDAY2}}
5410 !! input
5411 {{CURRENTDAY2}}
5412 !! result
5413 <p>01
5414 </p>
5415 !! end
5416
5417 !! test
5418 Magic Word: {{CURRENTDAYNAME}}
5419 !! input
5420 {{CURRENTDAYNAME}}
5421 !! result
5422 <p>Thursday
5423 </p>
5424 !! end
5425
5426 !! test
5427 Magic Word: {{CURRENTDOW}}
5428 !! input
5429 {{CURRENTDOW}}
5430 !! result
5431 <p>4
5432 </p>
5433 !! end
5434
5435 !! test
5436 Magic Word: {{CURRENTMONTH}}
5437 !! input
5438 {{CURRENTMONTH}}
5439 !! result
5440 <p>01
5441 </p>
5442 !! end
5443
5444 !! test
5445 Magic Word: {{CURRENTMONTHABBREV}}
5446 !! input
5447 {{CURRENTMONTHABBREV}}
5448 !! result
5449 <p>Jan
5450 </p>
5451 !! end
5452
5453 !! test
5454 Magic Word: {{CURRENTMONTHNAME}}
5455 !! input
5456 {{CURRENTMONTHNAME}}
5457 !! result
5458 <p>January
5459 </p>
5460 !! end
5461
5462 !! test
5463 Magic Word: {{CURRENTMONTHNAMEGEN}}
5464 !! input
5465 {{CURRENTMONTHNAMEGEN}}
5466 !! result
5467 <p>January
5468 </p>
5469 !! end
5470
5471 !! test
5472 Magic Word: {{CURRENTTIME}}
5473 !! input
5474 {{CURRENTTIME}}
5475 !! result
5476 <p>00:02
5477 </p>
5478 !! end
5479
5480 !! test
5481 Magic Word: {{CURRENTWEEK}} (@bug 4594)
5482 !! input
5483 {{CURRENTWEEK}}
5484 !! result
5485 <p>1
5486 </p>
5487 !! end
5488
5489 !! test
5490 Magic Word: {{CURRENTYEAR}}
5491 !! input
5492 {{CURRENTYEAR}}
5493 !! result
5494 <p>1970
5495 </p>
5496 !! end
5497
5498 !! test
5499 Magic Word: {{FULLPAGENAME}}
5500 !! options
5501 title=[[User:Ævar Arnfjörð Bjarmason]]
5502 !! input
5503 {{FULLPAGENAME}}
5504 !! result
5505 <p>User:Ævar Arnfjörð Bjarmason
5506 </p>
5507 !! end
5508
5509 !! test
5510 Magic Word: {{FULLPAGENAMEE}}
5511 !! options
5512 title=[[User:Ævar Arnfjörð Bjarmason]]
5513 !! input
5514 {{FULLPAGENAMEE}}
5515 !! result
5516 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5517 </p>
5518 !! end
5519
5520 !! test
5521 Magic Word: {{NAMESPACE}}
5522 !! options
5523 title=[[User:Ævar Arnfjörð Bjarmason]]
5524 !! input
5525 {{NAMESPACE}}
5526 !! result
5527 <p>User
5528 </p>
5529 !! end
5530
5531 !! test
5532 Magic Word: {{NAMESPACEE}}
5533 !! options
5534 title=[[User:Ævar Arnfjörð Bjarmason]]
5535 !! input
5536 {{NAMESPACEE}}
5537 !! result
5538 <p>User
5539 </p>
5540 !! end
5541
5542 !! test
5543 Magic Word: {{NAMESPACENUMBER}}
5544 !! options
5545 title=[[User:Ævar Arnfjörð Bjarmason]]
5546 !! input
5547 {{NAMESPACENUMBER}}
5548 !! result
5549 <p>2
5550 </p>
5551 !! end
5552
5553 !! test
5554 Magic Word: {{NUMBEROFFILES}}
5555 !! input
5556 {{NUMBEROFFILES}}
5557 !! result
5558 <p>4
5559 </p>
5560 !! end
5561
5562 !! test
5563 Magic Word: {{PAGENAME}}
5564 !! options
5565 title=[[User:Ævar Arnfjörð Bjarmason]]
5566 !! input
5567 {{PAGENAME}}
5568 !! result
5569 <p>Ævar Arnfjörð Bjarmason
5570 </p>
5571 !! end
5572
5573 !! test
5574 Magic Word: {{PAGENAME}} with metacharacters
5575 !! options
5576 title=[['foo & bar = baz']]
5577 !! input
5578 ''{{PAGENAME}}''
5579 !! result
5580 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
5581 </p>
5582 !! end
5583
5584 !! test
5585 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
5586 !! options
5587 title=[[*RFC 1234 http://example.com/]]
5588 !! input
5589 {{PAGENAME}}
5590 !! result
5591 <p>&#42;RFC&#32;1234 http&#58;//example.com/
5592 </p>
5593 !! end
5594
5595 !! test
5596 Magic Word: {{PAGENAMEE}}
5597 !! options
5598 title=[[User:Ævar Arnfjörð Bjarmason]]
5599 !! input
5600 {{PAGENAMEE}}
5601 !! result
5602 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5603 </p>
5604 !! end
5605
5606 !! test
5607 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
5608 !! options
5609 title=[[*RFC 1234 http://example.com/]]
5610 !! input
5611 {{PAGENAMEE}}
5612 !! result
5613 <p>&#42;RFC_1234_http&#58;//example.com/
5614 </p>
5615 !! end
5616
5617 !! test
5618 Magic Word: {{REVISIONID}}
5619 !! input
5620 {{REVISIONID}}
5621 !! result
5622 <p>1337
5623 </p>
5624 !! end
5625
5626 !! test
5627 Magic Word: {{SCRIPTPATH}}
5628 !! input
5629 {{SCRIPTPATH}}
5630 !! result
5631 <p>/
5632 </p>
5633 !! end
5634
5635 !! test
5636 Magic Word: {{SERVER}}
5637 !! input
5638 {{SERVER}}
5639 !! result
5640 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5641 </p>
5642 !! end
5643
5644 !! test
5645 Magic Word: {{SERVERNAME}}
5646 !! input
5647 {{SERVERNAME}}
5648 !! result
5649 <p>example.org
5650 </p>
5651 !! end
5652
5653 !! test
5654 Magic Word: {{SITENAME}}
5655 !! input
5656 {{SITENAME}}
5657 !! result
5658 <p>MediaWiki
5659 </p>
5660 !! end
5661
5662 !! test
5663 Case-sensitive magic words, when cased differently, should just be template transclusions
5664 !! input
5665 {{CurrentMonth}}
5666 {{currentday}}
5667 {{cURreNTweEK}}
5668 {{currentHour}}
5669 !! result
5670 <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>
5671 <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>
5672 <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>
5673 <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>
5674 </p>
5675 !! end
5676
5677 !! test
5678 Case-insensitive magic words should still work with weird casing.
5679 !! input
5680 {{sErVeRNaMe}}
5681 {{LCFirst:AOEU}}
5682 {{ucFIRST:aoeu}}
5683 {{SERver}}
5684 !! result
5685 <p>example.org
5686 aOEU
5687 Aoeu
5688 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5689 </p>
5690 !! end
5691
5692 !! test
5693 Namespace 1 {{ns:1}}
5694 !! input
5695 {{ns:1}}
5696 !! result
5697 <p>Talk
5698 </p>
5699 !! end
5700
5701 !! test
5702 Namespace 1 {{ns:01}}
5703 !! input
5704 {{ns:01}}
5705 !! result
5706 <p>Talk
5707 </p>
5708 !! end
5709
5710 !! test
5711 Namespace 0 {{ns:0}} (bug 4783)
5712 !! input
5713 {{ns:0}}
5714 !! result
5715
5716 !! end
5717
5718 !! test
5719 Namespace 0 {{ns:00}} (bug 4783)
5720 !! input
5721 {{ns:00}}
5722 !! result
5723
5724 !! end
5725
5726 !! test
5727 Namespace -1 {{ns:-1}}
5728 !! input
5729 {{ns:-1}}
5730 !! result
5731 <p>Special
5732 </p>
5733 !! end
5734
5735 !! test
5736 Namespace User {{ns:User}}
5737 !! input
5738 {{ns:User}}
5739 !! result
5740 <p>User
5741 </p>
5742 !! end
5743
5744 !! test
5745 Namespace User talk {{ns:User_talk}}
5746 !! input
5747 {{ns:User_talk}}
5748 !! result
5749 <p>User talk
5750 </p>
5751 !! end
5752
5753 !! test
5754 Namespace User talk {{ns:uSeR tAlK}}
5755 !! input
5756 {{ns:uSeR tAlK}}
5757 !! result
5758 <p>User talk
5759 </p>
5760 !! end
5761
5762 !! test
5763 Namespace File {{ns:File}}
5764 !! input
5765 {{ns:File}}
5766 !! result
5767 <p>File
5768 </p>
5769 !! end
5770
5771 !! test
5772 Namespace File {{ns:Image}}
5773 !! input
5774 {{ns:Image}}
5775 !! result
5776 <p>File
5777 </p>
5778 !! end
5779
5780 !! test
5781 Namespace (lang=de) Benutzer {{ns:User}}
5782 !! options
5783 language=de
5784 !! input
5785 {{ns:User}}
5786 !! result
5787 <p>Benutzer
5788 </p>
5789 !! end
5790
5791 !! test
5792 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
5793 !! options
5794 language=de
5795 !! input
5796 {{ns:3}}
5797 !! result
5798 <p>Benutzer Diskussion
5799 </p>
5800 !! end
5801
5802
5803 !! test
5804 Urlencode
5805 !! input
5806 {{urlencode:hi world?!}}
5807 {{urlencode:hi world?!|WIKI}}
5808 {{urlencode:hi world?!|PATH}}
5809 {{urlencode:hi world?!|QUERY}}
5810 !! result
5811 <p>hi+world%3F%21
5812 hi_world%3F!
5813 hi%20world%3F%21
5814 hi+world%3F%21
5815 </p>
5816 !! end
5817
5818 ###
5819 ### Magic links
5820 ###
5821 !! test
5822 Magic links: internal link to RFC (bug 479)
5823 !! input
5824 [[RFC 123]]
5825 !! result
5826 <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>
5827 </p>
5828 !! end
5829
5830 !! test
5831 Magic links: RFC (bug 479)
5832 !! input
5833 RFC 822
5834 !! result
5835 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
5836 </p>
5837 !! end
5838
5839 !! test
5840 Magic links: ISBN (bug 1937)
5841 !! input
5842 ISBN 0-306-40615-2
5843 !! result
5844 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
5845 </p>
5846 !! end
5847
5848 !! test
5849 Magic links: PMID incorrectly converts space to underscore
5850 !! input
5851 PMID 1234
5852 !! result
5853 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
5854 </p>
5855 !! end
5856
5857 ###
5858 ### Templates
5859 ####
5860
5861 !! test
5862 Nonexistent template
5863 !! input
5864 {{thistemplatedoesnotexist}}
5865 !! result
5866 <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>
5867 </p>
5868 !! end
5869
5870 !! test
5871 Template with invalid target containing tags
5872 !! input
5873 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5874 !! result
5875 <p>{{a<b>b</b>|foo|a=b|a = b}}
5876 </p>
5877 !! end
5878
5879 !! test
5880 Template with invalid target containing unclosed tag
5881 !! input
5882 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5883 !! result
5884 <p>{{a<b>|foo|a=b|a = b}}</b>
5885 </p>
5886 !! end
5887
5888 !! article
5889 Template:test
5890 !! text
5891 This is a test template
5892 !! endarticle
5893
5894 !! test
5895 Simple template
5896 !! input
5897 {{test}}
5898 !! result
5899 <p>This is a test template
5900 </p>
5901 !! end
5902
5903 !! test
5904 Template with explicit namespace
5905 !! input
5906 {{Template:test}}
5907 !! result
5908 <p>This is a test template
5909 </p>
5910 !! end
5911
5912
5913 !! article
5914 Template:paramtest
5915 !! text
5916 This is a test template with parameter {{{param}}}
5917 !! endarticle
5918
5919 !! test
5920 Template parameter
5921 !! input
5922 {{paramtest|param=foo}}
5923 !! result
5924 <p>This is a test template with parameter foo
5925 </p>
5926 !! end
5927
5928 !! article
5929 Template:paramtestnum
5930 !! text
5931 [[{{{1}}}|{{{2}}}]]
5932 !! endarticle
5933
5934 !! test
5935 Template unnamed parameter
5936 !! input
5937 {{paramtestnum|Main Page|the main page}}
5938 !! result
5939 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
5940 </p>
5941 !! end
5942
5943 !! article
5944 Template:templatesimple
5945 !! text
5946 (test)
5947 !! endarticle
5948
5949 !! article
5950 Template:templateredirect
5951 !! text
5952 #redirect [[Template:templatesimple]]
5953 !! endarticle
5954
5955 !! article
5956 Template:templateasargtestnum
5957 !! text
5958 {{{{{1}}}}}
5959 !! endarticle
5960
5961 !! article
5962 Template:templateasargtest
5963 !! text
5964 {{template{{{templ}}}}}
5965 !! endarticle
5966
5967 !! article
5968 Template:templateasargtest2
5969 !! text
5970 {{{{{templ}}}}}
5971 !! endarticle
5972
5973 !! test
5974 Template with template name as unnamed argument
5975 !! input
5976 {{templateasargtestnum|templatesimple}}
5977 !! result
5978 <p>(test)
5979 </p>
5980 !! end
5981
5982 !! test
5983 Template with template name as argument
5984 !! input
5985 {{templateasargtest|templ=simple}}
5986 !! result
5987 <p>(test)
5988 </p>
5989 !! end
5990
5991 !! test
5992 Template with template name as argument (2)
5993 !! input
5994 {{templateasargtest2|templ=templatesimple}}
5995 !! result
5996 <p>(test)
5997 </p>
5998 !! end
5999
6000 !! article
6001 Template:templateasargtestdefault
6002 !! text
6003 {{{{{templ|templatesimple}}}}}
6004 !! endarticle
6005
6006 !! article
6007 Template:templa
6008 !! text
6009 '''templ'''
6010 !! endarticle
6011
6012 !! test
6013 Template with default value
6014 !! input
6015 {{templateasargtestdefault}}
6016 !! result
6017 <p>(test)
6018 </p>
6019 !! end
6020
6021 !! test
6022 Template with default value (value set)
6023 !! input
6024 {{templateasargtestdefault|templ=templa}}
6025 !! result
6026 <p><b>templ</b>
6027 </p>
6028 !! end
6029
6030 !! test
6031 Template redirect
6032 !! input
6033 {{templateredirect}}
6034 !! result
6035 <p>(test)
6036 </p>
6037 !! end
6038
6039 !! test
6040 Template with argument in separate line
6041 !! input
6042 {{ templateasargtest |
6043 templ = simple }}
6044 !! result
6045 <p>(test)
6046 </p>
6047 !! end
6048
6049 !! test
6050 Template with complex template as argument
6051 !! input
6052 {{paramtest|
6053 param ={{ templateasargtest |
6054 templ = simple }}}}
6055 !! result
6056 <p>This is a test template with parameter (test)
6057 </p>
6058 !! end
6059
6060 !! test
6061 Template with thumb image (with link in description)
6062 !! input
6063 {{paramtest|
6064 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
6065 !! result
6066 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>
6067
6068 !! end
6069
6070 !! article
6071 Template:complextemplate
6072 !! text
6073 {{{1}}} {{paramtest|
6074 param ={{{param}}}}}
6075 !! endarticle
6076
6077 !! test
6078 Template with complex arguments
6079 !! input
6080 {{complextemplate|
6081 param ={{ templateasargtest |
6082 templ = simple }}|[[Template:complextemplate|link]]}}
6083 !! result
6084 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
6085 </p>
6086 !! end
6087
6088 !! test
6089 BUG 553: link with two variables in a piped link
6090 !! input
6091 {|
6092 |[[{{{1}}}|{{{2}}}]]
6093 |}
6094 !! result
6095 <table>
6096 <tr>
6097 <td>[[{{{1}}}|{{{2}}}]]
6098 </td></tr></table>
6099
6100 !! end
6101
6102 !! test
6103 Magic variable as template parameter
6104 !! input
6105 {{paramtest|param={{SITENAME}}}}
6106 !! result
6107 <p>This is a test template with parameter MediaWiki
6108 </p>
6109 !! end
6110
6111 !! article
6112 Template:linktest
6113 !! text
6114 [[{{{param}}}|link]]
6115 !! endarticle
6116
6117 !! test
6118 Template parameter as link source
6119 !! input
6120 {{linktest|param=Main Page}}
6121 !! result
6122 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
6123 </p>
6124 !! end
6125
6126 !!test
6127 Template-generated attribute string (k='v')
6128 !!input
6129 <span {{attr_str|id|v1}}>bar</span>
6130 !!result
6131 <p><span id="v1">bar</span>
6132 </p>
6133 !!end
6134
6135 !!article
6136 Template:paramtest2
6137 !! text
6138 including another template, {{paramtest|param={{{arg}}}}}
6139 !! endarticle
6140
6141 !! test
6142 Template passing argument to another template
6143 !! input
6144 {{paramtest2|arg='hmm'}}
6145 !! result
6146 <p>including another template, This is a test template with parameter 'hmm'
6147 </p>
6148 !! end
6149
6150 !! article
6151 Template:Linktest2
6152 !! text
6153 Main Page
6154 !! endarticle
6155
6156 !! test
6157 Template as link source
6158 !! input
6159 [[{{linktest2}}]]
6160
6161 [[{{linktest2}}|Main Page]]
6162
6163 [[{{linktest2}}]]Page
6164 !! result
6165 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6166 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6167 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
6168 </p>
6169 !! end
6170
6171
6172 !! article
6173 Template:loop1
6174 !! text
6175 {{loop2}}
6176 !! endarticle
6177
6178 !! article
6179 Template:loop2
6180 !! text
6181 {{loop1}}
6182 !! endarticle
6183
6184 !! test
6185 Template infinite loop
6186 !! input
6187 {{loop1}}
6188 !! result
6189 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
6190 </p>
6191 !! end
6192
6193 !! test
6194 Template from main namespace
6195 !! input
6196 {{:Main Page}}
6197 !! result
6198 <p>blah blah
6199 </p>
6200 !! end
6201
6202 !! article
6203 Template:table
6204 !! text
6205 {|
6206 | 1 || 2
6207 |-
6208 | 3 || 4
6209 |}
6210 !! endarticle
6211
6212 !! test
6213 BUG 529: Template with table, not included at beginning of line
6214 !! input
6215 foo {{table}}
6216 !! result
6217 <p>foo
6218 </p>
6219 <table>
6220 <tr>
6221 <td> 1 </td>
6222 <td> 2
6223 </td></tr>
6224 <tr>
6225 <td> 3 </td>
6226 <td> 4
6227 </td></tr></table>
6228
6229 !! end
6230
6231 !! test
6232 BUG 523: Template shouldn't eat newline (or add an extra one before table)
6233 !! input
6234 foo
6235 {{table}}
6236 !! result
6237 <p>foo
6238 </p>
6239 <table>
6240 <tr>
6241 <td> 1 </td>
6242 <td> 2
6243 </td></tr>
6244 <tr>
6245 <td> 3 </td>
6246 <td> 4
6247 </td></tr></table>
6248
6249 !! end
6250
6251 !! test
6252 BUG 41: Template parameters shown as broken links
6253 !! input
6254 {{{parameter}}}
6255 !! result
6256 <p>{{{parameter}}}
6257 </p>
6258 !! end
6259
6260 !! test
6261 Template with targets containing wikilinks
6262 !! input
6263 {{[[foo]]}}
6264
6265 {{[[{{echo|foo}}]]}}
6266
6267 {{{{echo|[[foo}}]]}}
6268 !! result
6269 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6270 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6271 </p><p>{{[[foo}}]]
6272 </p>
6273 !! end
6274
6275 !! article
6276 Template:MSGNW test
6277 !! text
6278 ''None'' of '''this''' should be
6279 * interpreted
6280 but rather passed unmodified
6281 {{test}}
6282 !! endarticle
6283
6284 # hmm, fix this or just deprecate msgnw and document its behavior?
6285 !! test
6286 msgnw keyword
6287 !! options
6288 disabled
6289 !! input
6290 {{msgnw:MSGNW test}}
6291 !! result
6292 <p>''None'' of '''this''' should be
6293 * interpreted
6294 but rather passed unmodified
6295 {{test}}
6296 </p>
6297 !! end
6298
6299 !! test
6300 int keyword
6301 !! input
6302 {{int:youhavenewmessages|lots of money|not!}}
6303 !! result
6304 <p>You have lots of money (not!).
6305 </p>
6306 !! end
6307
6308 !! article
6309 Template:Includes
6310 !! text
6311 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6312 !! endarticle
6313
6314 !! test
6315 <includeonly> and <noinclude> being included
6316 !! input
6317 {{Includes}}
6318 !! result
6319 <p>Foobar
6320 </p>
6321 !! end
6322
6323 !! article
6324 Template:Includes2
6325 !! text
6326 <onlyinclude>Foo</onlyinclude>bar
6327 !! endarticle
6328
6329 !! test
6330 <onlyinclude> being included
6331 !! input
6332 {{Includes2}}
6333 !! result
6334 <p>Foo
6335 </p>
6336 !! end
6337
6338
6339 !! article
6340 Template:Includes3
6341 !! text
6342 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
6343 !! endarticle
6344
6345 !! test
6346 <onlyinclude> and <includeonly> being included
6347 !! input
6348 {{Includes3}}
6349 !! result
6350 <p>Foo
6351 </p>
6352 !! end
6353
6354 !! test
6355 <includeonly> and <noinclude> on a page
6356 !! input
6357 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6358 !! result
6359 <p>Foozar
6360 </p>
6361 !! end
6362
6363 !! test
6364 Un-closed <noinclude>
6365 !! input
6366 <noinclude>
6367 !! result
6368 !! end
6369
6370 !! test
6371 <onlyinclude> on a page
6372 !! input
6373 <onlyinclude>Foo</onlyinclude>bar
6374 !! result
6375 <p>Foobar
6376 </p>
6377 !! end
6378
6379 !! test
6380 Un-closed <onlyinclude>
6381 !! input
6382 <onlyinclude>
6383 !! result
6384 !! end
6385
6386 !!test
6387 Self-closed noinclude, includeonly, onlyinclude tags
6388 !!input
6389 <noinclude />
6390 <includeonly />
6391 <onlyinclude />
6392 !!result
6393 <p><br />
6394 </p>
6395 !!end
6396
6397 !!test
6398 Unbalanced includeonly and noinclude tags
6399 !!input
6400 {|
6401 |a</noinclude>
6402 |b</noinclude></noinclude>
6403 |c</noinclude></includeonly>
6404 |d</includeonly></includeonly>
6405 |}
6406 !!result
6407 <table>
6408 <tr>
6409 <td>a
6410 </td>
6411 <td>b
6412 </td>
6413 <td>c&lt;/includeonly&gt;
6414 </td>
6415 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
6416 </td></tr></table>
6417
6418 !!end
6419
6420 !! article
6421 Template:Includeonly section
6422 !! text
6423 <includeonly>
6424 ==Includeonly section==
6425 </includeonly>
6426 ==Section T-1==
6427 !!endarticle
6428
6429 !! test
6430 Bug 6563: Edit link generation for section shown by <includeonly>
6431 !! input
6432 {{includeonly section}}
6433 !! result
6434 <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>
6435 <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>
6436
6437 !! end
6438
6439 # Uses same input as the contents of [[Template:Includeonly section]]
6440 !! test
6441 Bug 6563: Section extraction for section shown by <includeonly>
6442 !! options
6443 section=T-2
6444 !! input
6445 <includeonly>
6446 ==Includeonly section==
6447 </includeonly>
6448 ==Section T-2==
6449 !! result
6450 ==Section T-2==
6451 !! end
6452
6453 !! test
6454 Bug 6563: Edit link generation for section suppressed by <includeonly>
6455 !! input
6456 <includeonly>
6457 ==Includeonly section==
6458 </includeonly>
6459 ==Section 1==
6460 !! result
6461 <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>
6462
6463 !! end
6464
6465 !! test
6466 Bug 6563: Section extraction for section suppressed by <includeonly>
6467 !! options
6468 section=1
6469 !! input
6470 <includeonly>
6471 ==Includeonly section==
6472 </includeonly>
6473 ==Section 1==
6474 !! result
6475 ==Section 1==
6476 !! end
6477
6478 !! test
6479 Un-closed <includeonly>
6480 !! input
6481 <includeonly>
6482 !! result
6483 !! end
6484
6485 ###
6486 ### <includeonly> and <noinclude> in attributes
6487 ###
6488 !!test
6489 0. includeonly around the entire attribute
6490 !!input
6491 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
6492 !!result
6493 <p><span id="v2">bar</span>
6494 </p>
6495 !!end
6496
6497 !!test
6498 1. includeonly in html attr key
6499 !!input
6500 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
6501 !!result
6502 <p><span id="foo">bar</span>
6503 </p>
6504 !!end
6505
6506 !!test
6507 2. includeonly in html attr value
6508 !!input
6509 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
6510 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
6511 !!result
6512 <p><span id="v1">bar</span>
6513 <span id="v1">bar</span>
6514 </p>
6515 !!end
6516
6517 !!test
6518 3. includeonly in part of an attr value
6519 !!input
6520 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
6521 !!result
6522 <p><span style="color:red;">bar</span>
6523 </p>
6524 !!end
6525
6526 ###
6527 ### Testing parsing of templates where a template arg
6528 ### has the same name as the template itself.
6529 ###
6530
6531 !! article
6532 Template:quote
6533 !! text
6534 {{{quote|{{{1}}}}}}
6535 !! endarticle
6536
6537 !!test
6538 Templates: Template Name/Arg clash: 1. Use of positional param
6539 !!input
6540 {{quote|foo}}
6541 !!result
6542 <p>foo
6543 </p>
6544 !!end
6545
6546 !!test
6547 Templates: Template Name/Arg clash: 2. Use of named param
6548 !!input
6549 {{quote|quote=foo}}
6550 !!result
6551 <p>foo
6552 </p>
6553 !!end
6554
6555 !!test
6556 Templates: Template Name/Arg clash: 3. Use of named param with empty input
6557 !!input
6558 {{quote|quote}}
6559 !!result
6560 <p>quote
6561 </p>
6562 !!end
6563
6564 ###
6565 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
6566 ###
6567
6568 !!test
6569 Templates: 1. Simple use
6570 !!input
6571 {{echo|Foo}}
6572 !!result
6573 <p>Foo
6574 </p>
6575 !!end
6576
6577 !!test
6578 Templates: 2. Inside a block tag
6579 !!input
6580 <div>{{echo|Foo}}</div>
6581 !!result
6582 <div>Foo</div>
6583
6584 !!end
6585
6586 !!test
6587 Templates: P-wrapping: 1a. Templates on consecutive lines
6588 !!input
6589 {{echo|Foo}}
6590 {{echo|bar}}
6591 !!result
6592 <p>Foo
6593 bar
6594 </p>
6595 !!end
6596
6597 !!test
6598 Templates: P-wrapping: 1b. Templates on consecutive lines
6599 !!input
6600 Foo
6601
6602 {{echo|bar}}
6603 {{echo|baz}}
6604 !!result
6605 <p>Foo
6606 </p><p>bar
6607 baz
6608 </p>
6609 !!end
6610
6611 !!test
6612 Templates: P-wrapping: 1c. Templates on consecutive lines
6613 !!input
6614 {{echo|Foo}}
6615 {{echo|bar}} <div>baz</div>
6616 !!result
6617 <p>Foo
6618 </p>
6619 bar <div>baz</div>
6620
6621 !!end
6622
6623 !!test
6624 Templates: P-wrapping: 1d. Template preceded by comment-only line
6625 !!options
6626 parsoid=wt2html,wt2wt
6627 !!input
6628 <!-- foo -->
6629 {{echo|Bar}}
6630 !!result
6631 <!-- foo -->
6632 <p typeof="mw:Transclusion">Bar
6633 </p>
6634 !!end
6635
6636 !!test
6637 Templates: Inline Text: 1. Multiple tmeplate uses
6638 !!input
6639 {{echo|Foo}}bar{{echo|baz}}
6640 !!result
6641 <p>Foobarbaz
6642 </p>
6643 !!end
6644
6645 !!test
6646 Templates: Inline Text: 2. Back-to-back template uses
6647 !!input
6648 {{echo|Foo}}{{echo|bar}}
6649 !!result
6650 <p>Foobar
6651 </p>
6652 !!end
6653
6654 !!test
6655 Templates: Block Tags: 1. Multiple template uses
6656 !!input
6657 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
6658 !!result
6659 <div>Foo</div><div>bar</div><div>baz</div>
6660
6661 !!end
6662
6663 !!test
6664 Templates: Block Tags: 2. Back-to-back template uses
6665 !!input
6666 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
6667 !!result
6668 <div>Foo</div><div>bar</div>
6669
6670 !!end
6671
6672 !!test
6673 Templates: Links: 1. Simple example
6674 !!input
6675 {{echo|[[Foo|bar]]}}
6676 !!result
6677 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6678 </p>
6679 !!end
6680
6681 !!test
6682 Templates: Links: 2. Generation of link href
6683 !!input
6684 [[{{echo|Foo}}|bar]]
6685 !!result
6686 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6687 </p>
6688 !!end
6689
6690 !!test
6691 Templates: Links: 3. Generation of part of a link href
6692 !!input
6693 [[Fo{{echo|o}}|bar]]
6694
6695 [[Foo{{echo|bar}}]]
6696
6697 [[Foo{{echo|bar}}baz]]
6698
6699 [[Foo{{echo|bar}}|bar]]
6700
6701 [[:Foo{{echo|bar}}]]
6702
6703 [[:Foo{{echo|bar}}|bar]]
6704 !!result
6705 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6706 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6707 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
6708 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6709 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6710 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6711 </p>
6712 !!end
6713
6714 !!test
6715 Templates: Links: 4. Multiple templates generating link href
6716 !!input
6717 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
6718 !!result
6719 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6720 </p>
6721 !!end
6722
6723 !!test
6724 Templates: Links: 5. Generation of link text
6725 !!input
6726 [[Foo|{{echo|bar}}]]
6727 !!result
6728 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6729 </p>
6730 !!end
6731
6732 !!test
6733 Templates: Links: 5. Nested templates (only outermost template should be marked)
6734 !!input
6735 {{echo|[[{{echo|Foo}}|bar]]}}
6736 !!result
6737 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6738 </p>
6739 !!end
6740
6741 !!test
6742 Templates: HTML Tag: 1. Generation of HTML attr. key
6743 !!input
6744 <div {{echo|style}}="color:red;">foo</div>
6745 !!result
6746 <div style="color:red;">foo</div>
6747
6748 !!end
6749
6750 !!test
6751 Templates: HTML Tag: 2. Generation of HTML attr. value
6752 !!input
6753 <div style={{echo|'color:red;'}}>foo</div>
6754 !!result
6755 <div style="color:red;">foo</div>
6756
6757 !!end
6758
6759 !!test
6760 Templates: HTML Tag: 3. Generation of HTML attr key and value
6761 !!input
6762 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
6763 !!result
6764 <div style="color:red;">foo</div>
6765
6766 !!end
6767
6768 !!test
6769 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
6770 !!input
6771 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
6772 !!result
6773 <div title="This is a long title with just one piece templated">foo</div>
6774
6775 !!end
6776
6777 !!test
6778 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
6779 !!input
6780 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
6781 !!result
6782 <div title="This is a long title with just one piece templated">foo</div>
6783
6784 !!end
6785
6786 !!test
6787 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
6788 !!input
6789 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
6790 !!result
6791 <div title="This is a long title with just one piece templated">foo</div>
6792
6793 !!end
6794
6795 !!test
6796 Templates: HTML Tag: 7. Generation of partial attribute key string
6797 !!input
6798 <div st{{echo|yle}}="color:red;">foo</div>
6799 !!result
6800 <div style="color:red;">foo</div>
6801
6802 !!end
6803
6804 !!test
6805 Templates: HTML Tables: 1. Generating start of a HTML table
6806 !!input
6807 {{echo|<table><tr><td>foo</td>}}</tr></table>
6808 !!result
6809 <table><tr><td>foo</td></tr></table>
6810
6811 !!end
6812
6813 !!test
6814 Templates: HTML Tables: 2a. Generating middle of a HTML table
6815 !!input
6816 <table><tr>{{echo|<td>foo</td>}}</tr></table>
6817 !!result
6818 <table><tr><td>foo</td></tr></table>
6819
6820 !!end
6821
6822 !!test
6823 Templates: HTML Tables: 2b. Generating middle of a HTML table
6824 !!input
6825 <table>{{echo|<tr><td>foo</td></tr>}}</table>
6826 !!result
6827 <table><tr><td>foo</td></tr></table>
6828
6829 !!end
6830
6831 !!test
6832 Templates: HTML Tables: 3. Generating end of a HTML table
6833 !!input
6834 <table><tr>{{echo|<td>foo</td></tr></table>}}
6835 !!result
6836 <table><tr><td>foo</td></tr></table>
6837
6838 !!end
6839
6840 !!test
6841 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
6842 !!input
6843 {{echo|<table>}}<tr><td>foo</td></tr></table>
6844 !!result
6845 <table><tr><td>foo</td></tr></table>
6846
6847 !!end
6848
6849 !!test
6850 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
6851 !!input
6852 <table>{{echo|<tr>}}<td>foo</td></tr></table>
6853 !!result
6854 <table><tr><td>foo</td></tr></table>
6855
6856 !!end
6857
6858 !!test
6859 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
6860 !!input
6861 <table><tr>{{echo|<td>}}foo</td></tr></table>
6862 !!result
6863 <table><tr><td>foo</td></tr></table>
6864
6865 !!end
6866
6867 !!test
6868 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
6869 !!input
6870 <table><tr><td>foo{{echo|</td>}}</tr></table>
6871 !!result
6872 <table><tr><td>foo</td></tr></table>
6873
6874 !!end
6875
6876 !!test
6877 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
6878 !!input
6879 <table><tr><td>foo</td>{{echo|</tr>}}</table>
6880 !!result
6881 <table><tr><td>foo</td></tr></table>
6882
6883 !!end
6884
6885 !!test
6886 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
6887 !!input
6888 <table><tr><td>foo</td></tr>{{echo|</table>}}
6889 !!result
6890 <table><tr><td>foo</td></tr></table>
6891
6892 !!end
6893
6894 !!test
6895 Templates: HTML Tables: 5. Proper fostering of categories from inside
6896 !!options
6897 parsoid=wt2html,wt2wt
6898 !!input
6899 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
6900 <!--Two categories (Bug 50330)-->
6901 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
6902 !!result
6903 <link rel="mw:WikiLink/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
6904 <!--Two categories (Bug 50330)-->
6905 <link rel="mw:WikiLink/Category" href="./Category:Bar1"><link rel="mw:WikiLink/Category" href="./Category:Bar2"><table><tbody><tr><td>foo</td></tr></tbody></table>
6906 !!end
6907
6908 !!test
6909 Templates: Wiki Tables: 1a. Fostering of entire template content
6910 !!input
6911 {|
6912 {{echo|a}}
6913 |}
6914 !!result
6915 <table>
6916 a
6917 <tr><td></td></tr></table>
6918
6919 !!end
6920
6921 !!test
6922 Templates: Wiki Tables: 1b. Fostering of entire template content
6923 !!input
6924 {|
6925 {{echo|<div>}}
6926 foo
6927 {{echo|</div>}}
6928 |}
6929 !!result
6930 <table>
6931 <div>
6932 <p>foo
6933 </p>
6934 </div>
6935 <tr><td></td></tr></table>
6936
6937 !!end
6938
6939 !!test
6940 Templates: Wiki Tables: 2. Fostering of partial template content
6941 !!input
6942 {|
6943 {{echo|a
6944 <div>b</div>}}
6945 |}
6946 !!result
6947 <table>
6948 a
6949 <div>b</div>
6950 <tr><td></td></tr></table>
6951
6952 !!end
6953
6954 !!test
6955 Templates: Wiki Tables: 3. td-content via multiple templates
6956 !!input
6957 {|
6958 {{echo|{{pipe}}a}}{{echo|b}}
6959 |}
6960 !!result
6961 <table>
6962 <tr>
6963 <td>ab
6964 </td></tr></table>
6965
6966 !!end
6967
6968 !!test
6969 Templates: Wiki Tables: 4. Templated tags, no content
6970 !!input
6971 {{tbl-start}}
6972 {{tbl-end}}
6973 !!result
6974 <table>
6975 <tr><td></td></tr></table>
6976
6977 !!end
6978
6979 !!test
6980 Templates: Wiki Tables: 5. Templated tags, regular td-tags
6981 !!input
6982 {{tbl-start}}
6983 |foo
6984 {{tbl-end}}
6985 !!result
6986 <table>
6987 <tr>
6988 <td>foo
6989 </td></tr></table>
6990
6991 !!end
6992
6993 !!test
6994 Templates: Wiki Tables: 6. Templated tags, templated td-tags
6995 !!input
6996 {{tbl-start}}
6997 {{!}}foo
6998 {{tbl-end}}
6999 !!result
7000 <table>
7001 <tr>
7002 <td>foo
7003 </td></tr></table>
7004
7005 !!end
7006
7007 !!test
7008 Templates: Lists: Multi-line list-items via templates
7009 !!input
7010 *{{echo|a {{nonexistent|
7011 unused}}}}
7012 *{{echo|b {{nonexistent|
7013 unused}}}}
7014 !!result
7015 <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>
7016 </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>
7017 </li></ul>
7018
7019 !!end
7020
7021 !!test
7022 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
7023 !!input
7024 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
7025 !!result
7026 <p><i>ab</i>c<i>d</i>e
7027 </p>
7028 !!end
7029
7030 !!test
7031 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
7032 (PHP parser generates misnested html)
7033 !! options
7034 parsoid=wt2html,wt2wt
7035 !!input
7036 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
7037 !!result
7038 <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>
7039 !!end
7040
7041 !!test
7042 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
7043 (PHP parser generates misnested html)
7044 !! options
7045 parsoid=wt2html,wt2wt
7046 !!input
7047 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
7048 !!result
7049 <div typeof="mw:Transclusion"><i>a</i></div>
7050 <div typeof="mw:Transclusion"><i>b</i>c<i>d</i></div>
7051 <div typeof="mw:Transclusion">e</div>
7052 !!end
7053
7054 !!test
7055 Templates: Ugly nesting: 4. Divs opened/closed across templates
7056 !!input
7057 a<div>b{{echo|c</div>d}}e
7058 !!result
7059 a<div>bc</div>de
7060
7061 !!end
7062
7063 !!test
7064 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
7065 (Parsoid-centric)
7066 !! options
7067 parsoid
7068 !!input
7069 {|
7070 |{{echo|foo</table>}}
7071 |bar
7072 |}
7073 !!result
7074 <table typeof="mw:Transclusion">
7075 <tbody>
7076 <tr>
7077 <td>foo</td></tr></tbody></table><span>bar</span>
7078 !!end
7079
7080 !!test
7081 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
7082 (Parsoid-centric)
7083 !! options
7084 parsoid
7085 !!input
7086 <table>
7087 <tr>
7088 <td>
7089 <table>
7090 <tr>
7091 <td>1. {{echo|foo </table>}}</td>
7092 <td> bar </td>
7093 <td>2. {{echo|baz </table>}}</td>
7094 </tr>
7095 <tr>
7096 <td>abc</td>
7097 </tr>
7098 </table>
7099 </td>
7100 </tr>
7101 <tr>
7102 <td>xyz</td>
7103 </tr>
7104 </table>
7105 !!result
7106 <table about="#mwt1" typeof="mw:Transclusion">
7107 <tbody><tr >
7108 <td >
7109 <table >
7110 <tbody><tr >
7111 <td >1. foo </td></tr></tbody></table></td>
7112 <td > bar </td>
7113 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
7114 </span><span about="#mwt1">
7115
7116 abc</span><span about="#mwt1">
7117 </span><span about="#mwt1">
7118 </span><span about="#mwt1">
7119 </span><span about="#mwt1">
7120 </span><span about="#mwt1">
7121
7122 xyz</span><span about="#mwt1">
7123 </span><span about="#mwt1">
7124 </span>
7125 !!end
7126
7127 !! test
7128 Templates: Ugly templates: 3. newline-only template parameter
7129 !! input
7130 foo {{echo|
7131 }}
7132 !! result
7133 <p>foo
7134 </p>
7135 !! end
7136
7137 # This looks like a bug: a single newline triggers p/br for some reason.
7138 !! test
7139 Templates: Ugly templates: 4. newline-only template parameter inconsistency
7140 !! input
7141 {{echo|
7142 }}
7143 !! result
7144 <p><br />
7145 </p>
7146 !! end
7147
7148
7149 !!test
7150 Parser Functions: 1. Simple example
7151 !!input
7152 {{uc:foo}}
7153 !!result
7154 <p>FOO
7155 </p>
7156 !!end
7157
7158 !!test
7159 Parser Functions: 2. Nested use (only outermost should be marked up)
7160 !!input
7161 {{uc:{{lc:FOO}}}}
7162 !!result
7163 <p>FOO
7164 </p>
7165 !!end
7166
7167 ###
7168 ### Pre-save transform tests
7169 ###
7170 !! test
7171 pre-save transform: subst:
7172 !! options
7173 PST
7174 !! input
7175 {{subst:test}}
7176 !! result
7177 This is a test template
7178 !! end
7179
7180 !! test
7181 pre-save transform: normal template
7182 !! options
7183 PST
7184 !! input
7185 {{test}}
7186 !! result
7187 {{test}}
7188 !! end
7189
7190 !! test
7191 pre-save transform: nonexistent template
7192 !! options
7193 PST
7194 !! input
7195 {{thistemplatedoesnotexist}}
7196 !! result
7197 {{thistemplatedoesnotexist}}
7198 !! end
7199
7200
7201 !! test
7202 pre-save transform: subst magic variables
7203 !! options
7204 PST
7205 !! input
7206 {{subst:SITENAME}}
7207 !! result
7208 MediaWiki
7209 !! end
7210
7211 # This is bug 89, which I fixed. -- wtm
7212 !! test
7213 pre-save transform: subst: templates with parameters
7214 !! options
7215 pst
7216 !! input
7217 {{subst:paramtest|param="something else"}}
7218 !! result
7219 This is a test template with parameter "something else"
7220 !! end
7221
7222 !! article
7223 Template:nowikitest
7224 !! text
7225 <nowiki>'''not wiki'''</nowiki>
7226 !! endarticle
7227
7228 !! test
7229 pre-save transform: nowiki in subst (bug 1188)
7230 !! options
7231 pst
7232 !! input
7233 {{subst:nowikitest}}
7234 !! result
7235 <nowiki>'''not wiki'''</nowiki>
7236 !! end
7237
7238
7239 !! article
7240 Template:commenttest
7241 !! text
7242 This template has <!-- a comment --> in it.
7243 !! endarticle
7244
7245 !! test
7246 pre-save transform: comment in subst (bug 1936)
7247 !! options
7248 pst
7249 !! input
7250 {{subst:commenttest}}
7251 !! result
7252 This template has <!-- a comment --> in it.
7253 !! end
7254
7255 !! test
7256 pre-save transform: unclosed tag
7257 !! options
7258 pst noxml
7259 !! input
7260 <nowiki>'''not wiki'''
7261 !! result
7262 <nowiki>'''not wiki'''
7263 !! end
7264
7265 !! test
7266 pre-save transform: mixed tag case
7267 !! options
7268 pst noxml
7269 !! input
7270 <NOwiki>'''not wiki'''</noWIKI>
7271 !! result
7272 <NOwiki>'''not wiki'''</noWIKI>
7273 !! end
7274
7275 !! test
7276 pre-save transform: unclosed comment in <nowiki>
7277 !! options
7278 pst noxml
7279 !! input
7280 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7281 !! result
7282 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7283 !!end
7284
7285 # Leading @ in this template definition works around a limitation
7286 # in parsoid's parserTests which otherwise strips the <span> from the
7287 # result (confusing it for a template wrapper)
7288 !! article
7289 Template:dangerous
7290 !!text
7291 @<span onmouseover="alert('crap')">Oh no</span>
7292 !!endarticle
7293
7294 !!test
7295 (confirming safety of fix for subst bug 1936)
7296 !! input
7297 {{Template:dangerous}}
7298 !! result
7299 <p>@<span>Oh no</span>
7300 </p>
7301 !! end
7302
7303 !! test
7304 pre-save transform: comment containing gallery (bug 5024)
7305 !! options
7306 pst
7307 !! input
7308 <!-- <gallery>data</gallery> -->
7309 !!result
7310 <!-- <gallery>data</gallery> -->
7311 !!end
7312
7313 !! test
7314 pre-save transform: comment containing extension
7315 !! options
7316 pst
7317 !! input
7318 <!-- <tag>data</tag> -->
7319 !!result
7320 <!-- <tag>data</tag> -->
7321 !!end
7322
7323 !! test
7324 pre-save transform: comment containing nowiki
7325 !! options
7326 pst
7327 !! input
7328 <!-- <nowiki>data</nowiki> -->
7329 !!result
7330 <!-- <nowiki>data</nowiki> -->
7331 !!end
7332
7333 !! test
7334 pre-save transform: <noinclude> in subst (bug 3298)
7335 !! options
7336 pst
7337 !! input
7338 {{subst:Includes}}
7339 !! result
7340 Foobar
7341 !! end
7342
7343 !! test
7344 pre-save transform: <onlyinclude> in subst (bug 3298)
7345 !! options
7346 pst
7347 !! input
7348 {{subst:Includes2}}
7349 !! result
7350 Foo
7351 !! end
7352
7353 !! article
7354 Template:SubstTest
7355 !!text
7356 {{<includeonly>subst:</includeonly>Includes}}
7357 !! endarticle
7358
7359 !! article
7360 Template:SafeSubstTest
7361 !! text
7362 {{<includeonly>safesubst:</includeonly>Includes}}
7363 !! endarticle
7364
7365 !! test
7366 bug 22297: safesubst: works during PST
7367 !! options
7368 pst
7369 !! input
7370 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
7371 !! result
7372 FoobarFoobar
7373 !! end
7374
7375 !! test
7376 bug 22297: safesubst: works during normal parse
7377 !! input
7378 {{SafeSubstTest}}
7379 !! result
7380 <p>Foobar
7381 </p>
7382 !! end
7383
7384 !! test:
7385 subst: does not work during normal parse
7386 !! input
7387 {{SubstTest}}
7388 !! result
7389 <p>{{subst:Includes}}
7390 </p>
7391 !! end
7392
7393 !! test
7394 pre-save transform: context links ("pipe trick")
7395 !! options
7396 pst
7397 !! input
7398 [[Article (context)|]]
7399 [[Bar:Article|]]
7400 [[:Bar:Article|]]
7401 [[Bar:Article (context)|]]
7402 [[:Bar:Article (context)|]]
7403 [[|Article]]
7404 [[|Article (context)]]
7405 [[Bar:X (Y) Z|]]
7406 [[:Bar:X (Y) Z|]]
7407 !! result
7408 [[Article (context)|Article]]
7409 [[Bar:Article|Article]]
7410 [[:Bar:Article|Article]]
7411 [[Bar:Article (context)|Article]]
7412 [[:Bar:Article (context)|Article]]
7413 [[Article]]
7414 [[Article (context)]]
7415 [[Bar:X (Y) Z|X (Y) Z]]
7416 [[:Bar:X (Y) Z|X (Y) Z]]
7417 !! end
7418
7419 !! test
7420 pre-save transform: context links ("pipe trick") with interwiki prefix
7421 !! options
7422 pst
7423 !! input
7424 [[interwiki:Article|]]
7425 [[:interwiki:Article|]]
7426 [[interwiki:Bar:Article|]]
7427 [[:interwiki:Bar:Article|]]
7428 !! result
7429 [[interwiki:Article|Article]]
7430 [[:interwiki:Article|Article]]
7431 [[interwiki:Bar:Article|Bar:Article]]
7432 [[:interwiki:Bar:Article|Bar:Article]]
7433 !! end
7434
7435 !! test
7436 pre-save transform: context links ("pipe trick") with parens in title
7437 !! options
7438 pst title=[[Somearticle (context)]]
7439 !! input
7440 [[|Article]]
7441 !! result
7442 [[Article (context)|Article]]
7443 !! end
7444
7445 !! test
7446 pre-save transform: context links ("pipe trick") with comma in title
7447 !! options
7448 pst title=[[Someplace, Somewhere]]
7449 !! input
7450 [[|Otherplace]]
7451 [[Otherplace, Elsewhere|]]
7452 [[Otherplace, Elsewhere, Anywhere|]]
7453 !! result
7454 [[Otherplace, Somewhere|Otherplace]]
7455 [[Otherplace, Elsewhere|Otherplace]]
7456 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
7457 !! end
7458
7459 !! test
7460 pre-save transform: context links ("pipe trick") with parens and comma
7461 !! options
7462 pst title=[[Someplace (IGNORED), Somewhere]]
7463 !! input
7464 [[|Otherplace]]
7465 [[Otherplace (place), Elsewhere|]]
7466 !! result
7467 [[Otherplace, Somewhere|Otherplace]]
7468 [[Otherplace (place), Elsewhere|Otherplace]]
7469 !! end
7470
7471 !! test
7472 pre-save transform: context links ("pipe trick") with comma and parens
7473 !! options
7474 pst title=[[Who, me? (context)]]
7475 !! input
7476 [[|Yes, you.]]
7477 [[Me, Myself, and I (1937 song)|]]
7478 !! result
7479 [[Yes, you. (context)|Yes, you.]]
7480 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
7481 !! end
7482
7483 !! test
7484 pre-save transform: context links ("pipe trick") with namespace
7485 !! options
7486 pst title=[[Ns:Somearticle]]
7487 !! input
7488 [[|Article]]
7489 !! result
7490 [[Ns:Article|Article]]
7491 !! end
7492
7493 !! test
7494 pre-save transform: context links ("pipe trick") with namespace and parens
7495 !! options
7496 pst title=[[Ns:Somearticle (context)]]
7497 !! input
7498 [[|Article]]
7499 !! result
7500 [[Ns:Article (context)|Article]]
7501 !! end
7502
7503 !! test
7504 pre-save transform: context links ("pipe trick") with namespace and comma
7505 !! options
7506 pst title=[[Ns:Somearticle, Context, Whatever]]
7507 !! input
7508 [[|Article]]
7509 !! result
7510 [[Ns:Article, Context, Whatever|Article]]
7511 !! end
7512
7513 !! test
7514 pre-save transform: context links ("pipe trick") with namespace, comma and parens
7515 !! options
7516 pst title=[[Ns:Somearticle, Context (context)]]
7517 !! input
7518 [[|Article]]
7519 !! result
7520 [[Ns:Article (context)|Article]]
7521 !! end
7522
7523 !! test
7524 pre-save transform: context links ("pipe trick") with namespace, parens and comma
7525 !! options
7526 pst title=[[Ns:Somearticle (IGNORED), Context]]
7527 !! input
7528 [[|Article]]
7529 !! result
7530 [[Ns:Article, Context|Article]]
7531 !! end
7532
7533 !! test
7534 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
7535 !! options
7536 pst
7537 !! input
7538 [[Article(context)|]]
7539 [[Bar:Article(context)|]]
7540 [[:Bar:Article(context)|]]
7541 [[|Article(context)]]
7542 [[Bar:X(Y)Z|]]
7543 [[:Bar:X(Y)Z|]]
7544 !! result
7545 [[Article(context)|Article]]
7546 [[Bar:Article(context)|Article]]
7547 [[:Bar:Article(context)|Article]]
7548 [[Article(context)]]
7549 [[Bar:X(Y)Z|X(Y)Z]]
7550 [[:Bar:X(Y)Z|X(Y)Z]]
7551 !! end
7552
7553 !! test
7554 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
7555 !! options
7556 pst
7557 !! input
7558 [[Article (context)|]]
7559 [[Bar:Article (context)|]]
7560 [[:Bar:Article (context)|]]
7561 [[|Article (context)]]
7562 [[Bar:X (Y) Z|]]
7563 [[:Bar:X (Y) Z|]]
7564 !! result
7565 [[Article (context)|Article]]
7566 [[Bar:Article (context)|Article]]
7567 [[:Bar:Article (context)|Article]]
7568 [[Article (context)]]
7569 [[Bar:X (Y) Z|X (Y) Z]]
7570 [[:Bar:X (Y) Z|X (Y) Z]]
7571 !! end
7572
7573 !! test
7574 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
7575 !! options
7576 pst
7577 !! input
7578 [[Article(context)|]]
7579 [[Bar:Article(context)|]]
7580 [[:Bar:Article(context)|]]
7581 [[|Article(context)]]
7582 [[Bar:X(Y)Z|]]
7583 [[:Bar:X(Y)Z|]]
7584 !! result
7585 [[Article(context)|Article]]
7586 [[Bar:Article(context)|Article]]
7587 [[:Bar:Article(context)|Article]]
7588 [[Article(context)]]
7589 [[Bar:X(Y)Z|X(Y)Z]]
7590 [[:Bar:X(Y)Z|X(Y)Z]]
7591 !! end
7592
7593 !! test
7594 pre-save transform: context links ("pipe trick") with commas (bug 21660)
7595 !! options
7596 pst
7597 !! input
7598 [[Article (context), context|]]
7599 [[Article (context),context|]]
7600 [[Bar:Article (context), context|]]
7601 [[Bar:Article (context),context|]]
7602 [[:Bar:Article (context), context|]]
7603 [[:Bar:Article (context),context|]]
7604 !! result
7605 [[Article (context), context|Article]]
7606 [[Article (context),context|Article]]
7607 [[Bar:Article (context), context|Article]]
7608 [[Bar:Article (context),context|Article]]
7609 [[:Bar:Article (context), context|Article]]
7610 [[:Bar:Article (context),context|Article]]
7611 !! end
7612
7613 !! test
7614 pre-save transform: trim trailing empty lines
7615 !! options
7616 pst
7617 !! input
7618 Empty lines are trimmed
7619
7620
7621
7622
7623 !! result
7624 Empty lines are trimmed
7625 !! end
7626
7627 !! test
7628 pre-save transform: Signature expansion
7629 !! options
7630 pst
7631 !! input
7632 * ~~~
7633 * <noinclude>~~~</noinclude>
7634 * <includeonly>~~~</includeonly>
7635 * <onlyinclude>~~~</onlyinclude>
7636 !! result
7637 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
7638 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
7639 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
7640 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
7641 !! end
7642
7643
7644 !! test
7645 pre-save transform: Signature expansion in nowiki tags (bug 93)
7646 !! options
7647 pst disabled
7648 !! input
7649 Shall not expand:
7650
7651 <nowiki>~~~~</nowiki>
7652
7653 <includeonly><nowiki>~~~~</nowiki></includeonly>
7654
7655 <noinclude><nowiki>~~~~</nowiki></noinclude>
7656
7657 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7658
7659 {{subst:Foo}} shall be converted to FOO
7660
7661 As well as inside noinclude/onlyinclude
7662 <noinclude>{{subst:Foo}}</noinclude>
7663 <onlyinclude>{{subst:Foo}}</onlyinclude>
7664
7665 But not inside includeonly
7666 <includeonly>{{subst:Foo}}</includeonly>
7667 !! result
7668 Shall not expand:
7669
7670 <nowiki>~~~~</nowiki>
7671
7672 <includeonly><nowiki>~~~~</nowiki></includeonly>
7673
7674 <noinclude><nowiki>~~~~</nowiki></noinclude>
7675
7676 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7677
7678 FOO shall be converted to FOO
7679
7680 As well as inside noinclude/onlyinclude
7681 <noinclude>FOO</noinclude>
7682 <onlyinclude>FOO</onlyinclude>
7683
7684 But not inside includeonly
7685 <includeonly>{{subst:Foo}}</includeonly>
7686 !! end
7687
7688 ###
7689 ### Message transform tests
7690 ###
7691 !! test
7692 message transform: magic variables
7693 !! options
7694 msg
7695 !! input
7696 {{SITENAME}}
7697 !! result
7698 MediaWiki
7699 !! end
7700
7701 !! test
7702 message transform: should not transform wiki markup
7703 !! options
7704 msg
7705 !! input
7706 ''test''
7707 !! result
7708 ''test''
7709 !! end
7710
7711 !! test
7712 message transform: <noinclude> in transcluded template (bug 4926)
7713 !! options
7714 msg
7715 !! input
7716 {{Includes}}
7717 !! result
7718 Foobar
7719 !! end
7720
7721 !! test
7722 message transform: <onlyinclude> in transcluded template (bug 4926)
7723 !! options
7724 msg
7725 !! input
7726 {{Includes2}}
7727 !! result
7728 Foo
7729 !! end
7730
7731 !! test
7732 {{#special:}} page name, known
7733 !! options
7734 msg
7735 !! input
7736 {{#special:Recentchanges}}
7737 !! result
7738 Special:RecentChanges
7739 !! end
7740
7741 !! test
7742 {{#special:}} page name with subpage, known
7743 !! options
7744 msg
7745 !! input
7746 {{#special:Recentchanges/param}}
7747 !! result
7748 Special:RecentChanges/param
7749 !! end
7750
7751 !! test
7752 {{#special:}} page name, unknown
7753 !! options
7754 msg
7755 !! input
7756 {{#special:foobar nonexistent}}
7757 !! result
7758 Special:Foobar nonexistent
7759 !! end
7760
7761 !! test
7762 {{#speciale:}} page name, known
7763 !! options
7764 msg
7765 !! input
7766 {{#speciale:Recentchanges}}
7767 !! result
7768 Special:RecentChanges
7769 !! end
7770
7771 !! test
7772 {{#speciale:}} page name with subpage, known
7773 !! options
7774 msg
7775 !! input
7776 {{#speciale:Recentchanges/param}}
7777 !! result
7778 Special:RecentChanges/param
7779 !! end
7780
7781 !! test
7782 {{#speciale:}} page name, unknown
7783 !! options
7784 msg
7785 !! input
7786 {{#speciale:foobar nonexistent}}
7787 !! result
7788 Special:Foobar_nonexistent
7789 !! end
7790
7791 ###
7792 ### Images
7793 ###
7794 !! test
7795 Simple image
7796 !! input
7797 [[Image:foobar.jpg]]
7798 !! result
7799 <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>
7800 </p>
7801 !! end
7802
7803 !! test
7804 Right-aligned image
7805 !! input
7806 [[Image:foobar.jpg|right]]
7807 !! result
7808 <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>
7809
7810 !! end
7811
7812 !! test
7813 Simple image (using File: namespace, now canonical)
7814 !! input
7815 [[File:foobar.jpg]]
7816 !! result
7817 <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>
7818 </p>
7819 !! end
7820
7821 !! test
7822 Image with caption
7823 !! input
7824 [[Image:foobar.jpg|right|Caption text]]
7825 !! result
7826 <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>
7827
7828 !! end
7829
7830 !! test
7831 Image with empty attribute
7832 !! input
7833 [[Image:foobar.jpg|right||Caption text]]
7834 !! result
7835 <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>
7836
7837 !! end
7838
7839 !! test
7840 Image with link tails
7841 !! input
7842 123[[Image:foobar.jpg]]456
7843 123[[Image:foobar.jpg|right]]456
7844 123[[Image:foobar.jpg|thumb]]456
7845 !! result
7846 <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
7847 </p>
7848 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
7849 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
7850
7851 !! end
7852
7853 !! test
7854 Image with multiple captions -- only last one is accepted
7855 !! input
7856 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
7857 !! result
7858 <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>
7859
7860 !! end
7861
7862 !! test
7863 Image with width attribute at different positions
7864 !! input
7865 [[Image:foobar.jpg|200px|right|Caption]]
7866 [[Image:foobar.jpg|right|200px|Caption]]
7867 [[Image:foobar.jpg|right|Caption|200px]]
7868 !! result
7869 <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>
7870 <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>
7871 <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>
7872
7873 !! end
7874
7875 !! test
7876 Image with link parameter, wiki target
7877 !! input
7878 [[Image:foobar.jpg|link=Target page]]
7879 !! result
7880 <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>
7881 </p>
7882 !! end
7883
7884 !! test
7885 Image with link parameter, URL target
7886 !! input
7887 [[Image:foobar.jpg|link=http://example.com/]]
7888 !! result
7889 <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>
7890 </p>
7891 !! end
7892
7893 !! test
7894 Image with link parameter, wgExternalLinkTarget
7895 !! input
7896 [[Image:foobar.jpg|link=http://example.com/]]
7897 !! config
7898 wgExternalLinkTarget='foobar'
7899 !! result
7900 <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>
7901 </p>
7902 !! end
7903
7904 !! test
7905 Image with link parameter, wgNoFollowLinks set to false
7906 !! input
7907 [[Image:foobar.jpg|link=http://example.com/]]
7908 !! config
7909 wgNoFollowLinks=false
7910 !! result
7911 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7912 </p>
7913 !! end
7914
7915 !! test
7916 Image with link parameter, wgNoFollowDomainExceptions
7917 !! input
7918 [[Image:foobar.jpg|link=http://example.com/]]
7919 !! config
7920 wgNoFollowDomainExceptions='example.com'
7921 !! result
7922 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7923 </p>
7924 !! end
7925
7926 !! test
7927 Image with link parameter, wgExternalLinkTarget, unnamed parameter
7928 !! input
7929 [[Image:foobar.jpg|link=http://example.com/|Title]]
7930 !! config
7931 wgExternalLinkTarget='foobar'
7932 !! result
7933 <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>
7934 </p>
7935 !! end
7936
7937 !! test
7938 Image with empty link parameter
7939 !! input
7940 [[Image:foobar.jpg|link=]]
7941 !! result
7942 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
7943 </p>
7944 !! end
7945
7946 !! test
7947 Image with link parameter (wiki target) and unnamed parameter
7948 !! input
7949 [[Image:foobar.jpg|link=Target page|Title]]
7950 !! result
7951 <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>
7952 </p>
7953 !! end
7954
7955 !! test
7956 Image with link parameter (URL target) and unnamed parameter
7957 !! input
7958 [[Image:foobar.jpg|link=http://example.com/|Title]]
7959 !! result
7960 <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>
7961 </p>
7962 !! end
7963
7964 !! test
7965 Thumbnail image with link parameter
7966 !! options
7967 php
7968 !! input
7969 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
7970 !! result
7971 <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>
7972
7973 !! end
7974
7975 !! test
7976 Manually-specified thumbnail image
7977 !! options
7978 php
7979 !! input
7980 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
7981 !! result
7982 <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>
7983
7984 !! end
7985
7986 !! test
7987 Manually-specified thumbnail image with explicit link to wiki page
7988 !! options
7989 php
7990 !! input
7991 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
7992 !! result
7993 <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>
7994
7995 !! end
7996
7997 !! test
7998 Manually-specified thumbnail image with explicit link to url
7999 !! options
8000 php
8001 !! input
8002 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
8003 !! result
8004 <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>
8005
8006 !! end
8007
8008 !! test
8009 Manually-specified thumbnail image with explicit no link
8010 !! options
8011 php
8012 !! input
8013 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
8014 !! result
8015 <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>
8016
8017 !! end
8018
8019 !! test
8020 Manually-specified thumbnail image with explicit link and alt text
8021 !! options
8022 php
8023 !! input
8024 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
8025 !! result
8026 <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>
8027
8028 !! end
8029
8030 !! test
8031 Image with frame and link
8032 !! input
8033 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
8034 !! result
8035 <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>
8036
8037 !! end
8038
8039 !! test
8040 Image with frame and link and explicit alt
8041 !! input
8042 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
8043 !! result
8044 <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>
8045
8046 !! end
8047
8048 !! test
8049 Image with wiki markup in implicit alt
8050 !! input
8051 [[Image:Foobar.jpg|testing '''bold''' in alt]]
8052 !! result
8053 <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>
8054 </p>
8055 !! end
8056
8057 !! test
8058 Image with wiki markup in explicit alt
8059 !! input
8060 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
8061 !! result
8062 <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>
8063 </p>
8064 !! end
8065
8066 !! test
8067 Link to image page- image page normally doesn't exists, hence edit link
8068 Add test with existing image page
8069 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
8070 !! input
8071 [[:Image:test]]
8072 !! result
8073 <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>
8074 </p>
8075 !! end
8076
8077 !! test
8078 bug 18784 Link to non-existent image page with caption should use caption as link text
8079 !! input
8080 [[:Image:test|caption]]
8081 !! result
8082 <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>
8083 </p>
8084 !! end
8085
8086 !! test
8087 Frameless image caption with a free URL
8088 !! input
8089 [[Image:foobar.jpg|http://example.com]]
8090 !! result
8091 <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>
8092 </p>
8093 !! end
8094
8095 !! test
8096 Thumbnail image caption with a free URL
8097 !! input
8098 [[Image:foobar.jpg|thumb|http://example.com]]
8099 !! result
8100 <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>
8101
8102 !! end
8103
8104 !! test
8105 Thumbnail image caption with a free URL and explicit alt
8106 !! input
8107 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
8108 !! result
8109 <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>
8110
8111 !! end
8112
8113 !! test
8114 SVG thumbnails with no language set
8115 !! options
8116 !! input
8117 [[File:Foobar.svg|thumb|width=200]]
8118 !! result
8119 <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>
8120
8121 !! end
8122
8123 !! test
8124 SVG thumbnails with language de
8125 !! options
8126 !! input
8127 [[File:Foobar.svg|thumb|width=200|lang=de]]
8128 !! result
8129 <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>
8130
8131 !! end
8132
8133 !! test
8134 SVG thumbnails with invalid language code
8135 !! options
8136 !! input
8137 [[File:Foobar.svg|thumb|width=200|lang=invalid.language.code]]
8138 !! result
8139 <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>
8140
8141 !! end
8142
8143 !! test
8144 BUG 1887: A ISBN with a thumbnail
8145 !! input
8146 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
8147 !! result
8148 <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>
8149
8150 !! end
8151
8152 !! test
8153 BUG 1887: A RFC with a thumbnail
8154 !! input
8155 [[Image:foobar.jpg|thumb|This is RFC 12354]]
8156 !! result
8157 <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>
8158
8159 !! end
8160
8161 !! test
8162 BUG 1887: A mailto link with a thumbnail
8163 !! input
8164 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
8165 !! result
8166 <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>
8167
8168 !! end
8169
8170 # Pending resolution to bug 368
8171 !! test
8172 BUG 648: Frameless image caption with a link
8173 !! input
8174 [[Image:foobar.jpg|text with a [[link]] in it]]
8175 !! result
8176 <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>
8177 </p>
8178 !! end
8179
8180 !! test
8181 BUG 648: Frameless image caption with a link (suffix)
8182 !! input
8183 [[Image:foobar.jpg|text with a [[link]]foo in it]]
8184 !! result
8185 <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>
8186 </p>
8187 !! end
8188
8189 !! test
8190 BUG 648: Frameless image caption with an interwiki link
8191 !! input
8192 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
8193 !! result
8194 <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>
8195 </p>
8196 !! end
8197
8198 !! test
8199 BUG 648: Frameless image caption with a piped interwiki link
8200 !! input
8201 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
8202 !! result
8203 <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>
8204 </p>
8205 !! end
8206
8207 !! test
8208 Escape HTML special chars in image alt text
8209 !! input
8210 [[Image:foobar.jpg|& < > "]]
8211 !! result
8212 <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>
8213 </p>
8214 !! end
8215
8216 !! test
8217 BUG 499: Alt text should have &#1234;, not &amp;1234;
8218 !! input
8219 [[Image:foobar.jpg|&#9792;]]
8220 !! result
8221 <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>
8222 </p>
8223 !! end
8224
8225 !! test
8226 Broken image caption with link
8227 !! input
8228 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
8229 !! result
8230 <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.
8231 </p>
8232 !! end
8233
8234 !! test
8235 Image caption containing another image
8236 !! input
8237 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
8238 !! result
8239 <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>
8240
8241 !! end
8242
8243 !! test
8244 Image caption containing a newline
8245 !! input
8246 [[Image:Foobar.jpg|This
8247 *is some text]]
8248 !! result
8249 <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>
8250 </p>
8251 !!end
8252
8253 !!test
8254 Parsoid: Image caption containing leading space
8255 (The leading space should not trigger nowiki escaping in wt2wt mode)
8256 !! input
8257 [[Image:Foobar.jpg|thumb| bar]]
8258 !! result
8259 <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>
8260
8261 !!end
8262
8263 !! test
8264 Bug 3090: External links other than http: in image captions
8265 !! input
8266 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
8267 !! result
8268 <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>
8269
8270 !! end
8271
8272 !! test
8273 Custom class
8274 !! input
8275 [[Image:foobar.jpg|a|class=b]]
8276 !! result
8277 <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>
8278 </p>
8279 !! end
8280
8281 !! test
8282 Localized image handling (1).
8283 !! options
8284 language=es
8285 !! input
8286 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
8287 !! result
8288 <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>
8289
8290 !! end
8291
8292 !! test
8293 Localized image handling (2).
8294 !! options
8295 language=es
8296 !! input
8297 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
8298 !! result
8299 <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>
8300
8301 !! end
8302
8303 !! test
8304 "border", "frameless" and "class" attributes on an image.
8305 !! input
8306 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
8307 !! result
8308 <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>
8309 </p>
8310 !! end
8311
8312 !! article
8313 File:Barfoo.jpg
8314 !! text
8315 #REDIRECT [[File:Barfoo.jpg]]
8316 !! endarticle
8317
8318 !! test
8319 Redirected image
8320 !! input
8321 [[Image:Barfoo.jpg]]
8322 !! result
8323 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
8324 </p>
8325 !! end
8326
8327 !! test
8328 Missing image with uploads disabled
8329 !! options
8330 wgEnableUploads=0
8331 !! input
8332 [[Image:Foobaz.jpg]]
8333 !! result
8334 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
8335 </p>
8336 !! end
8337
8338 # Parsoid-specific testing for images
8339 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
8340 # Currently imperfect due to a flaw in the Parsoid testrunner
8341 # Work in progress
8342
8343 !! test
8344 Parsoid-specific image handling - simple image
8345 !! options
8346 parsoid
8347 !! input
8348 [[Image:Foobar.jpg]]
8349 !! result
8350 <p>
8351 <span class="mw-default-size" typeof="mw:Image">
8352 <a href="File:Foobar.jpg">
8353 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8354 </a>
8355 </span>
8356 </p>
8357 !! end
8358
8359 !! test
8360 Parsoid-specific image handling - simple image without link
8361 !! options
8362 parsoid
8363 !! input
8364 [[Image:Foobar.jpg|link=]]
8365 !! result
8366 <p>
8367 <span class="mw-default-size" typeof="mw:Image">
8368 <span>
8369 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8370 </span>
8371 </span>
8372 </p>
8373 !! end
8374
8375 !! test
8376 Parsoid-specific image handling - simple image with specific link
8377 !! options
8378 parsoid
8379 !! input
8380 [[Image:Foobar.jpg|link=Main Page]]
8381 !! result
8382 <p>
8383 <span class="mw-default-size" typeof="mw:Image">
8384 <a href="Main_Page">
8385 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8386 </a>
8387 </span>
8388 </p>
8389 !! end
8390
8391 !! test
8392 Parsoid-specific image handling - simple image with size and middle alignment
8393 !! options
8394 parsoid
8395 !! input
8396 [[Image:Foobar.jpg|50px|middle]]
8397 !! result
8398 <p>
8399 <span class="mw-valign-middle" typeof="mw:Image">
8400 <a href="File:Foobar.jpg">
8401 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8402 </a>
8403 </span>
8404 </p>
8405 !! end
8406
8407 !! test
8408 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
8409 !! options
8410 parsoid
8411 !! input
8412 [[Image:Foobar.jpg|500x10px|baseline|caption]]
8413 !! result
8414 <p>
8415 <span class="mw-valign-baseline" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8416 <a href="File:Foobar.jpg">
8417 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89">
8418 </a>
8419 </span>
8420 </p>
8421 !! end
8422
8423 !! test
8424 Parsoid-specific image handling - simple image with border and size spec
8425 !! options
8426 parsoid
8427 !! input
8428 [[Image:Foobar.jpg|50px|border|caption]]
8429 !! result
8430 <p>
8431 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8432 <a href="File:Foobar.jpg">
8433 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8434 </a>
8435 </span>
8436 </p>
8437 !! end
8438
8439 !! test
8440 Parsoid-specific image handling - thumbnail with halign, valign, and caption
8441 !! options
8442 parsoid
8443 !! input
8444 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
8445 !! result
8446 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
8447 <a href="File:Foobar.jpg">
8448 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/180px-Foobar.jpg" height="21" width="180" />
8449 </a>
8450 <figcaption>caption content</figcaption>
8451 </figure>
8452 !! end
8453
8454 !! test
8455 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
8456 !! options
8457 parsoid
8458 !! input
8459 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
8460 !! result
8461 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
8462 <a href="File:Foobar.jpg">
8463 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
8464 </a>
8465 <figcaption>caption</figcaption>
8466 </figure>
8467 !! end
8468
8469 !! test
8470 Parsoid-specific image handling - framed image with specific size and caption
8471 !! options
8472 parsoid
8473 !! input
8474 [[Image:Foobar.jpg|500x50px|frame|caption]]
8475 !! result
8476 <figure typeof="mw:Image/Frame">
8477 <a href="File:Foobar.jpg">
8478 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8479 </a>
8480 <figcaption>caption</figcaption>
8481 </figure>
8482 !! end
8483
8484 !! test
8485 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
8486 !! options
8487 parsoid
8488 !! input
8489 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
8490 !! result
8491 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
8492 <a href="File:Foobar.jpg">
8493 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8494 </a>
8495 <figcaption>caption</figcaption>
8496 </figure>
8497 !! end
8498
8499 !! test
8500 Parsoid-specific image handling - frameless image with specific size, border, and caption
8501 !! options
8502 parsoid
8503 !! input
8504 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
8505 !! result
8506 <p>
8507 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8508 <a href="File:Foobar.jpg">
8509 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8510 </a>
8511 </p>
8512 !! end
8513
8514 #!! test
8515 #Parsoid-specific image handling - simple image with a formatted caption
8516 #!! options
8517 #parsoid
8518 #!! input
8519 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
8520 #!! result
8521 #<p>
8522 #<span typeof="mw:Image">
8523 #<a class="mw-default-size" href="Image:Foobar.jpg">
8524 #<img alt="Foobar.jpg" class="mw-default-size" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8525 #</a>
8526 #<span>abc</span>
8527 #</span>
8528 #</p>
8529
8530
8531 ###
8532 ### Subpages
8533 ###
8534 !! article
8535 Subpage test/subpage
8536 !! text
8537 foo
8538 !! endarticle
8539
8540 !! test
8541 Subpage link
8542 !! options
8543 subpage title=[[Subpage test]]
8544 !! input
8545 [[/subpage]]
8546 !! result
8547 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
8548 </p>
8549 !! end
8550
8551 !! test
8552 Subpage noslash link
8553 !! options
8554 subpage title=[[Subpage test]]
8555 !!input
8556 [[/subpage/]]
8557 !! result
8558 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
8559 </p>
8560 !! end
8561
8562 # TODO: make this PHP-parser compatible!
8563 !! test
8564 Relative subpage noslash link
8565 !! options
8566 parsoid=wt2wt,wt2html,html2html
8567 subpage title=[[Subpage test/1/2/3/4]]
8568 !!input
8569 [[../../subpage/]]
8570
8571 [[../../subpage]]
8572 !! result
8573 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
8574 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
8575 !! end
8576
8577 # TODO: make this PHP-parser compatible!
8578 !! test
8579 Parsoid: dot-slash prefixed wikilinks
8580 !! options
8581 parsoid=wt2wt,wt2html,html2html
8582 !!input
8583 [[./foo]]
8584
8585 [[././bar]]
8586
8587 [[././baz/]]
8588 !! result
8589 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
8590 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
8591 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
8592 !! end
8593
8594 !! test
8595 Disabled subpages
8596 !! input
8597 [[/subpage]]
8598 !! result
8599 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
8600 </p>
8601 !! end
8602
8603 !! test
8604 BUG 561: {{/Subpage}}
8605 !! options
8606 subpage title=[[Page]]
8607 !! input
8608 {{/Subpage}}
8609 !! result
8610 <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>
8611 </p>
8612 !! end
8613
8614 ###
8615 ### Categories
8616 ###
8617 !! article
8618 Category:MediaWiki User's Guide
8619 !! text
8620 blah
8621 !! endarticle
8622
8623 !! test
8624 Link to category
8625 !! input
8626 [[:Category:MediaWiki User's Guide]]
8627 !! result
8628 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
8629 </p>
8630 !! end
8631
8632 !! test
8633 Simple category
8634 !! options
8635 cat
8636 !! input
8637 [[Category:MediaWiki User's Guide]]
8638 !! result
8639 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8640 !! end
8641
8642 !! test
8643 PAGESINCATEGORY invalid title fatal (r33546 fix)
8644 !! input
8645 {{PAGESINCATEGORY:<bogus>}}
8646 !! result
8647 <p>0
8648 </p>
8649 !! end
8650
8651 !! test
8652 Category with different sort key
8653 !! options
8654 cat
8655 !! input
8656 [[Category:MediaWiki User's Guide|Foo]]
8657 !! result
8658 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8659 !! end
8660
8661 !! test
8662 Category with identical sort key
8663 !! options
8664 cat
8665 !! input
8666 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8667 !! result
8668 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8669 !! end
8670
8671 !! test
8672 Category with empty sort key
8673 !! options
8674 cat
8675 pst
8676 !! input
8677 [[Category:MediaWiki User's Guide|]]
8678 !! result
8679 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8680 !! end
8681
8682 !! test
8683 Category with empty sort key and parentheses
8684 !! options
8685 cat
8686 pst
8687 !! input
8688 [[Category:Foo (bar)|]]
8689 !! result
8690 [[Category:Foo (bar)|Foo]]
8691 !! end
8692
8693 !! test
8694 Category with link tail
8695 !! options
8696 cat
8697 pst
8698 !! input
8699 123[[Category:Foo]]456
8700 !! result
8701 123[[Category:Foo]]456
8702 !! end
8703
8704 !! test
8705 Category with template
8706 !! options
8707 cat
8708 pst
8709 !! input
8710 [[Category:{{echo|Foo}}]]
8711 !! result
8712 [[Category:{{echo|Foo}}]]
8713 !! end
8714
8715 !! test
8716 Category with template in sort key
8717 !! options
8718 cat
8719 pst
8720 !! input
8721 [[Category:Foo|{{echo|Bar}}]]
8722 !! result
8723 [[Category:Foo|{{echo|Bar}}]]
8724 !! end
8725
8726 !! test
8727 Category with template in sort key and title
8728 !! options
8729 cat
8730 pst
8731 !! input
8732 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8733 !! result
8734 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8735 !! end
8736
8737 !! test
8738 Category / paragraph interactions
8739 !! input
8740 Foo [[Category:Baz]] Bar
8741
8742 Foo [[Category:Baz]]
8743 Bar
8744
8745 Foo
8746 [[Category:Baz]]
8747 Bar
8748
8749 Foo
8750 [[Category:Baz]] Bar
8751
8752 Foo
8753 [[Category:Baz]]
8754 [[Category:Baz]]
8755 [[Category:Baz]]
8756 Bar
8757
8758 [[Category:Baz]]
8759 [[Category:Baz]]
8760 [[Category:Baz]]
8761
8762 [[Category:Baz]]
8763 {{echo|[[Category:Baz]]}}
8764 [[Category:Baz]]
8765 !! result
8766 <p>Foo Bar
8767 </p><p>Foo
8768 Bar
8769 </p><p>Foo
8770 Bar
8771 </p><p>Foo Bar
8772 </p><p>Foo
8773 Bar
8774 </p>
8775 !! end
8776
8777 !! test
8778 Parsoid: Serialize link to category page with colon escape
8779 !! options
8780 parsoid
8781 !! input
8782
8783 [[:Category:Foo]]
8784 [[:Category:Foo|Bar]]
8785 !! result
8786 <p>
8787 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
8788 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
8789 </p>
8790 !! end
8791
8792 !! test
8793 Parsoid: Serialize link to file page with colon escape
8794 !! options
8795 parsoid
8796 !! input
8797
8798 [[:File:Foo.png]]
8799 [[:File:Foo.png|Bar]]
8800 !! result
8801 <p>
8802 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
8803 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
8804 </p>
8805 !! end
8806
8807 !! test
8808 Parsoid: Serialize a genuine category link without colon escape
8809 !! options
8810 parsoid
8811 !! input
8812 [[Category:Foo]]
8813 [[Category:Foo|Bar]]
8814 !! result
8815 <link rel="mw:WikiLink/Category" href="Category:Foo">
8816 <link rel="mw:WikiLink/Category" href="Category:Foo#Bar">
8817 !! end
8818
8819 ###
8820 ### Inter-language links
8821 ###
8822 !! test
8823 Inter-language links
8824 !! options
8825 ill
8826 !! input
8827 [[es:Alimento]]
8828 [[fr:Nourriture]]
8829 [[zh:&#39135;&#21697;]]
8830 !! result
8831 es:Alimento fr:Nourriture zh:食品
8832 !! end
8833
8834 !! test
8835 Duplicate interlanguage links (bug 24502)
8836 !! options
8837 ill
8838 !! input
8839 [[es:1]]
8840 [[es:2]]
8841 [[fr:1]]
8842 [[fr:2]]
8843 !! result
8844 es:1 fr:1
8845 !! end
8846
8847 ###
8848 ### Sections
8849 ###
8850 !! test
8851 Basic section headings
8852 !! input
8853 == Headline 1 ==
8854 Some text
8855
8856 ==Headline 2==
8857 More
8858 ===Smaller headline===
8859 Blah blah
8860 !! result
8861 <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>
8862 <p>Some text
8863 </p>
8864 <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>
8865 <p>More
8866 </p>
8867 <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>
8868 <p>Blah blah
8869 </p>
8870 !! end
8871
8872 !! test
8873 Section headings with TOC
8874 !! input
8875 == Headline 1 ==
8876 === Subheadline 1 ===
8877 ===== Skipping a level =====
8878 ====== Skipping a level ======
8879
8880 == Headline 2 ==
8881 Some text
8882 ===Another headline===
8883 !! result
8884 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8885 <ul>
8886 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
8887 <ul>
8888 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
8889 <ul>
8890 <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>
8891 <ul>
8892 <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>
8893 </ul>
8894 </li>
8895 </ul>
8896 </li>
8897 </ul>
8898 </li>
8899 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
8900 <ul>
8901 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
8902 </ul>
8903 </li>
8904 </ul>
8905 </div>
8906 <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>
8907 <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>
8908 <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>
8909 <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>
8910 <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>
8911 <p>Some text
8912 </p>
8913 <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>
8914
8915 !! end
8916
8917 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
8918 !! test
8919 Handling of sections up to level 6 and beyond
8920 !! input
8921 = Level 1 Heading=
8922 == Level 2 Heading==
8923 === Level 3 Heading===
8924 ==== Level 4 Heading====
8925 ===== Level 5 Heading=====
8926 ====== Level 6 Heading======
8927 ======= Level 7 Heading=======
8928 ======== Level 8 Heading========
8929 ========= Level 9 Heading=========
8930 ========== Level 10 Heading==========
8931 !! result
8932 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8933 <ul>
8934 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
8935 <ul>
8936 <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>
8937 <ul>
8938 <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>
8939 <ul>
8940 <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>
8941 <ul>
8942 <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>
8943 <ul>
8944 <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>
8945 <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>
8946 <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>
8947 <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>
8948 <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>
8949 </ul>
8950 </li>
8951 </ul>
8952 </li>
8953 </ul>
8954 </li>
8955 </ul>
8956 </li>
8957 </ul>
8958 </li>
8959 </ul>
8960 </div>
8961 <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>
8962 <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>
8963 <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>
8964 <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>
8965 <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>
8966 <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>
8967 <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>
8968 <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>
8969 <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>
8970 <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>
8971
8972 !! end
8973
8974 !! test
8975 TOC regression (bug 9764)
8976 !! input
8977 == title 1 ==
8978 === title 1.1 ===
8979 ==== title 1.1.1 ====
8980 === title 1.2 ===
8981 == title 2 ==
8982 === title 2.1 ===
8983 !! result
8984 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8985 <ul>
8986 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8987 <ul>
8988 <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>
8989 <ul>
8990 <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>
8991 </ul>
8992 </li>
8993 <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>
8994 </ul>
8995 </li>
8996 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8997 <ul>
8998 <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>
8999 </ul>
9000 </li>
9001 </ul>
9002 </div>
9003 <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>
9004 <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>
9005 <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>
9006 <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>
9007 <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>
9008 <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>
9009
9010 !! end
9011
9012 !! test
9013 TOC with wgMaxTocLevel=3 (bug 6204)
9014 !! options
9015 wgMaxTocLevel=3
9016 !! input
9017 == title 1 ==
9018 === title 1.1 ===
9019 ==== title 1.1.1 ====
9020 === title 1.2 ===
9021 == title 2 ==
9022 === title 2.1 ===
9023 !! result
9024 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9025 <ul>
9026 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9027 <ul>
9028 <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>
9029 <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>
9030 </ul>
9031 </li>
9032 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9033 <ul>
9034 <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>
9035 </ul>
9036 </li>
9037 </ul>
9038 </div>
9039 <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>
9040 <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>
9041 <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>
9042 <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>
9043 <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>
9044 <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>
9045
9046 !! end
9047
9048 !! test
9049 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
9050 !! options
9051 wgMaxTocLevel=3
9052 !! input
9053 ==Section 1==
9054 ===Section 1.1===
9055 ====Section 1.1.1====
9056 ====Section 1.1.1.1====
9057 ==Section 2==
9058 !! result
9059 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9060 <ul>
9061 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
9062 <ul>
9063 <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>
9064 </ul>
9065 </li>
9066 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
9067 </ul>
9068 </div>
9069 <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>
9070 <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>
9071 <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>
9072 <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>
9073 <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>
9074
9075 !! end
9076
9077
9078 !! test
9079 Resolving duplicate section names
9080 !! input
9081 == Foo bar ==
9082 == Foo bar ==
9083 !! result
9084 <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>
9085 <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>
9086
9087 !! end
9088
9089 !! test
9090 Resolving duplicate section names with differing case (bug 10721)
9091 !! input
9092 == Foo bar ==
9093 == Foo Bar ==
9094 !! result
9095 <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>
9096 <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>
9097
9098 !! end
9099
9100 !! article
9101 Template:sections
9102 !! text
9103 ===Section 1===
9104 ==Section 2==
9105 !! endarticle
9106
9107 !! test
9108 Template with sections, __NOTOC__
9109 !! input
9110 __NOTOC__
9111 ==Section 0==
9112 {{sections}}
9113 ==Section 4==
9114 !! result
9115 <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>
9116 <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>
9117 <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>
9118 <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>
9119
9120 !! end
9121
9122 !! test
9123 __NOEDITSECTION__ keyword
9124 !! input
9125 __NOEDITSECTION__
9126 ==Section 1==
9127 ==Section 2==
9128 !! result
9129 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
9130 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
9131
9132 !! end
9133
9134 !! test
9135 Link inside a section heading
9136 !! input
9137 ==Section with a [[Main Page|link]] in it==
9138 !! result
9139 <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>
9140
9141 !! end
9142
9143 !! test
9144 TOC regression (bug 12077)
9145 !! input
9146 __TOC__
9147 == title 1 ==
9148 === title 1.1 ===
9149 == title 2 ==
9150 !! result
9151 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9152 <ul>
9153 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9154 <ul>
9155 <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>
9156 </ul>
9157 </li>
9158 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
9159 </ul>
9160 </div>
9161 <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>
9162 <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>
9163 <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>
9164
9165 !! end
9166
9167 !! test
9168 BUG 1219 URL next to image (good)
9169 !! input
9170 http://example.com [[Image:foobar.jpg]]
9171 !! result
9172 <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>
9173 </p>
9174 !!end
9175
9176 !! test
9177 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
9178 !! input
9179 ===
9180 The line above must have a trailing space!
9181 === <!--
9182 --> <!-- -->
9183 But just in case it doesn't...
9184 !! result
9185 <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>
9186 <p>The line above must have a trailing space!
9187 </p>
9188 <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>
9189 <p>But just in case it doesn't...
9190 </p>
9191 !! end
9192
9193 !! test
9194 Header with special characters (bug 25462)
9195 !! input
9196 The tooltips shall not show entities to the user (ie. be double escaped)
9197
9198 == text > text ==
9199 section 1
9200
9201 == text < text ==
9202 section 2
9203
9204 == text & text ==
9205 section 3
9206
9207 == text ' text ==
9208 section 4
9209
9210 == text " text ==
9211 section 5
9212 !! result
9213 <p>The tooltips shall not show entities to the user (ie. be double escaped)
9214 </p>
9215 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9216 <ul>
9217 <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>
9218 <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>
9219 <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>
9220 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
9221 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
9222 </ul>
9223 </div>
9224 <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>
9225 <p>section 1
9226 </p>
9227 <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>
9228 <p>section 2
9229 </p>
9230 <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>
9231 <p>section 3
9232 </p>
9233 <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>
9234 <p>section 4
9235 </p>
9236 <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>
9237 <p>section 5
9238 </p>
9239 !! end
9240
9241 !! test
9242 Headers with excess '=' characters
9243 (Are similar tests necessary beyond the 1st level?)
9244 !! input
9245 =foo==
9246 ==foo=
9247 =''italic'' heading==
9248 ==''italic'' heading=
9249 !! result
9250 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9251 <ul>
9252 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
9253 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
9254 <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>
9255 <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>
9256 </ul>
9257 </div>
9258 <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>
9259 <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>
9260 <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>
9261 <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>
9262
9263 !! end
9264
9265 !! test
9266 HTML headers vs TOC (bug 23393)
9267 (__NOEDITSECTION__ for clearer output, doesn't matter here)
9268 !! input
9269 <h1>Header 1</h1>
9270 == Header 1.1 ==
9271 == Header 1.2 ==
9272
9273 <h1>Header 2
9274 </h1>
9275 == Header 2.1 ==
9276 == Header 2.2 ==
9277 __NOEDITSECTION__
9278 !! result
9279 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9280 <ul>
9281 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
9282 <ul>
9283 <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>
9284 <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>
9285 </ul>
9286 </li>
9287 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
9288 <ul>
9289 <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>
9290 <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>
9291 </ul>
9292 </li>
9293 </ul>
9294 </div>
9295 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
9296 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
9297 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
9298 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
9299 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
9300 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
9301
9302 !! end
9303
9304 !! test
9305 BUG 1219 URL next to image (broken)
9306 !! input
9307 http://example.com[[Image:foobar.jpg]]
9308 !! result
9309 <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>
9310 </p>
9311 !!end
9312
9313 !! test
9314 Bug 1186 news: in the middle of text
9315 !! input
9316 http://en.wikinews.org/wiki/Wikinews:Workplace
9317 !! result
9318 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
9319 </p>
9320 !!end
9321
9322
9323 !! test
9324 Namespaced link must have a title
9325 !! input
9326 [[Project:]]
9327 !! result
9328 <p>[[Project:]]
9329 </p>
9330 !!end
9331
9332 !! test
9333 Namespaced link must have a title (bad fragment version)
9334 !! input
9335 [[Project:#fragment]]
9336 !! result
9337 <p>[[Project:#fragment]]
9338 </p>
9339 !!end
9340
9341
9342 ###
9343 ### HTML tags and HTML attributes
9344 ###
9345
9346 !! test
9347 div with no attributes
9348 !! input
9349 <div>HTML rocks</div>
9350 !! result
9351 <div>HTML rocks</div>
9352
9353 !! end
9354
9355 !! test
9356 div with double-quoted attribute
9357 !! input
9358 <div id="rock">HTML rocks</div>
9359 !! result
9360 <div id="rock">HTML rocks</div>
9361
9362 !! end
9363
9364 !! test
9365 div with single-quoted attribute
9366 !! input
9367 <div id='rock'>HTML rocks</div>
9368 !! result
9369 <div id="rock">HTML rocks</div>
9370
9371 !! end
9372
9373 !! test
9374 div with unquoted attribute
9375 !! input
9376 <div id=rock>HTML rocks</div>
9377 !! result
9378 <div id="rock">HTML rocks</div>
9379
9380 !! end
9381
9382 !! test
9383 div with illegal double attributes
9384 !! input
9385 <div id="a" id="b">HTML rocks</div>
9386 !! result
9387 <div id="b">HTML rocks</div>
9388
9389 !!end
9390
9391 # FIXME: produce empty string instead of "class" in the PHP parser, following
9392 # the HTML5 spec.
9393 !! test
9394 div with empty attribute value, space before equals
9395 !! options
9396 parsoid
9397 !! input
9398 <div class =>HTML rocks</div>
9399 !! result
9400 <div class="">HTML rocks</div>
9401
9402 !! end
9403
9404 # The PHP parser escapes the opening brace to &#123; for some reason, so
9405 # disabled this test for it.
9406 !! test
9407 div with braces in attribute value
9408 !! options
9409 parsoid
9410 !! input
9411 <div title="{}">Foo</div>
9412 !! result
9413 <div title="{}">Foo</div>
9414 !! end
9415
9416 # This it very inconsistent in the PHP parser: it returns
9417 # class="class" if there is a space between the name and the equal sign (see
9418 # 'div with empty attribute value, space before equals'), but strips the
9419 # attribute completely if the space is missing. We hope that not much content
9420 # depends on this, so are implementing the behavior below in Parsoid for
9421 # consistencies' sake. Disabled for the PHP parser.
9422 # FIXME: fix this behavior in the PHP parser?
9423 !! test
9424 div with empty attribute value, no space before equals
9425 !! options
9426 parsoid
9427 !! input
9428 <div class=>HTML rocks</div>
9429 !! result
9430 <div class="">HTML rocks</div>
9431
9432 !! end
9433
9434 !! test
9435 HTML multiple attributes correction
9436 !! input
9437 <p class="error" class="awesome">Awesome!</p>
9438 !! result
9439 <p class="awesome">Awesome!</p>
9440
9441 !!end
9442
9443 !! test
9444 Table multiple attributes correction
9445 !! input
9446 {|
9447 !+ class="error" class="awesome"| status
9448 |}
9449 !! result
9450 <table>
9451 <tr>
9452 <th class="awesome"> status
9453 </th></tr></table>
9454
9455 !!end
9456
9457 !! test
9458 DIV IN UPPERCASE
9459 !! input
9460 <DIV ID="x">HTML ROCKS</DIV>
9461 !! result
9462 <div id="x">HTML ROCKS</div>
9463
9464 !!end
9465
9466 !! test
9467 Non-ASCII pseudo-tags are rendered as text
9468 !! input
9469 <khyô>
9470 !! result
9471 <p>&lt;khyô&gt;
9472 </p>
9473 !! end
9474
9475 !! test
9476 Pseudo-tag with URL 'name' renders as url link
9477 !! input
9478 <http://example.com/>
9479 !! result
9480 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
9481 </p>
9482 !! end
9483
9484 !! test
9485 text with amp in the middle of nowhere
9486 !! input
9487 Remember AT&T?
9488 !!result
9489 <p>Remember AT&amp;T?
9490 </p>
9491 !! end
9492
9493 !! test
9494 text with character entity: eacute
9495 !! input
9496 I always thought &eacute; was a cute letter.
9497 !! result
9498 <p>I always thought &#233; was a cute letter.
9499 </p>
9500 !! end
9501
9502 !! test
9503 text with entity-escaped character entity-like string: eacute
9504 !! input
9505 I always thought &amp;eacute; was a cute letter.
9506 !! result
9507 <p>I always thought &amp;eacute; was a cute letter.
9508 </p>
9509 !! end
9510
9511 !! test
9512 text with undefined character entity: xacute
9513 !! input
9514 I always thought &xacute; was a cute letter.
9515 !! result
9516 <p>I always thought &amp;xacute; was a cute letter.
9517 </p>
9518 !! end
9519
9520
9521 ###
9522 ### Media links
9523 ###
9524
9525 !! test
9526 Media link
9527 !! input
9528 [[Media:Foobar.jpg]]
9529 !! result
9530 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
9531 </p>
9532 !! end
9533
9534 !! test
9535 Media link with text
9536 !! input
9537 [[Media:Foobar.jpg|A neat file to look at]]
9538 !! result
9539 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
9540 </p>
9541 !! end
9542
9543 # FIXME: this is still bad HTML tag nesting
9544 !! test
9545 Media link with nasty text
9546 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
9547 !! input
9548 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
9549 !! result
9550 <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>
9551
9552 !! end
9553
9554 !! test
9555 Media link to nonexistent file (bug 1702)
9556 !! input
9557 [[Media:No such.jpg]]
9558 !! result
9559 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
9560 </p>
9561 !! end
9562
9563 !! test
9564 Image link to nonexistent file (bug 1850 - good)
9565 !! input
9566 [[Image:No such.jpg]]
9567 !! result
9568 <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>
9569 </p>
9570 !! end
9571
9572 !! test
9573 :Image link to nonexistent file (bug 1850 - bad)
9574 !! input
9575 [[:Image:No such.jpg]]
9576 !! result
9577 <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>
9578 </p>
9579 !! end
9580
9581
9582
9583 !! test
9584 Character reference normalization in link text (bug 1938)
9585 !! input
9586 [[Main Page|this&that]]
9587 !! result
9588 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
9589 </p>
9590 !!end
9591
9592 !! article
9593 אַ
9594 !! text
9595 Test for unicode normalization
9596
9597 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
9598 !! endarticle
9599
9600 !! test
9601 (bug 19451) Links should refer to the normalized form.
9602 !! input
9603 [[&#xFB2E;]]
9604 [[&#x5d0;&#x5b7;]]
9605 [[&#x5d0;ַ]]
9606 [[א&#x5b7;]]
9607 [[אַ]]
9608 !! result
9609 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
9610 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
9611 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
9612 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
9613 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
9614 </p>
9615 !! end
9616
9617 !! test
9618 Empty attribute crash test (bug 2067)
9619 !! input
9620 <font color="">foo</font>
9621 !! result
9622 <p><font color="">foo</font>
9623 </p>
9624 !! end
9625
9626 !! test
9627 Empty attribute crash test single-quotes (bug 2067)
9628 !! input
9629 <font color=''>foo</font>
9630 !! result
9631 <p><font color="">foo</font>
9632 </p>
9633 !! end
9634
9635 !! test
9636 Attribute test: equals, then nothing
9637 !! input
9638 <font color=>foo</font>
9639 !! result
9640 <p><font>foo</font>
9641 </p>
9642 !! end
9643
9644 !! test
9645 Attribute test: unquoted value
9646 !! input
9647 <font color=x>foo</font>
9648 !! result
9649 <p><font color="x">foo</font>
9650 </p>
9651 !! end
9652
9653 !! test
9654 Attribute test: unquoted but illegal value (hash)
9655 !! input
9656 <font color=#x>foo</font>
9657 !! result
9658 <p><font color="#x">foo</font>
9659 </p>
9660 !! end
9661
9662 !! test
9663 Attribute test: no value
9664 !! input
9665 <font color>foo</font>
9666 !! result
9667 <p><font color="color">foo</font>
9668 </p>
9669 !! end
9670
9671 !! test
9672 Bug 2095: link with three closing brackets
9673 !! input
9674 [[Main Page]]]
9675 !! result
9676 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
9677 </p>
9678 !! end
9679
9680 !! test
9681 Bug 2095: link with pipe and three closing brackets
9682 !! input
9683 [[Main Page|link]]]
9684 !! result
9685 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
9686 </p>
9687 !! end
9688
9689 !! test
9690 Bug 2095: link with pipe and three closing brackets, version 2
9691 !! input
9692 [[Main Page|[http://example.com/]]]
9693 !! result
9694 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
9695 </p>
9696 !! end
9697
9698
9699 ###
9700 ### Safety
9701 ###
9702
9703 !! article
9704 Template:Dangerous attribute
9705 !! text
9706 " onmouseover="alert(document.cookie)
9707 !! endarticle
9708
9709 !! article
9710 Template:Dangerous style attribute
9711 !! text
9712 border-size: expression(alert(document.cookie))
9713 !! endarticle
9714
9715 !! article
9716 Template:Div style
9717 !! text
9718 <div style="float: right; {{{1}}}">Magic div</div>
9719 !! endarticle
9720
9721 !! test
9722 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
9723 !! input
9724 <div title="{{test}}"></div>
9725 !! result
9726 <div title="This is a test template"></div>
9727
9728 !! end
9729
9730 !! test
9731 Bug 2304: HTML attribute safety (dangerous template; 2309)
9732 !! input
9733 <div title="{{dangerous attribute}}"></div>
9734 !! result
9735 <div title=""></div>
9736
9737 !! end
9738
9739 !! test
9740 Bug 2304: HTML attribute safety (dangerous style template; 2309)
9741 !! input
9742 <div style="{{dangerous style attribute}}"></div>
9743 !! result
9744 <div style="/* insecure input */"></div>
9745
9746 !! end
9747
9748 !! test
9749 Bug 2304: HTML attribute safety (safe parameter; 2309)
9750 !! input
9751 {{div style|width: 200px}}
9752 !! result
9753 <div style="float: right; width: 200px">Magic div</div>
9754
9755 !! end
9756
9757 !! test
9758 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
9759 !! input
9760 {{div style|width: expression(alert(document.cookie))}}
9761 !! result
9762 <div style="/* insecure input */">Magic div</div>
9763
9764 !! end
9765
9766 !! test
9767 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
9768 !! input
9769 {{div style|"><script>alert(document.cookie)</script>}}
9770 !! result
9771 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9772
9773 !! end
9774
9775 !! test
9776 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
9777 !! input
9778 {{div style|" ><script>alert(document.cookie)</script>}}
9779 !! result
9780 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9781
9782 !! end
9783
9784 !! test
9785 Bug 2304: HTML attribute safety (link)
9786 !! input
9787 <div title="[[Main Page]]"></div>
9788 !! result
9789 <div title="&#91;&#91;Main Page]]"></div>
9790
9791 !! end
9792
9793 !! test
9794 Bug 2304: HTML attribute safety (italics)
9795 !! input
9796 <div title="''foobar''"></div>
9797 !! result
9798 <div title="&#39;&#39;foobar&#39;&#39;"></div>
9799
9800 !! end
9801
9802 !! test
9803 Bug 2304: HTML attribute safety (bold)
9804 !! input
9805 <div title="'''foobar'''"></div>
9806 !! result
9807 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
9808
9809 !! end
9810
9811
9812 !! test
9813 Bug 2304: HTML attribute safety (ISBN)
9814 !! input
9815 <div title="ISBN 1234567890"></div>
9816 !! result
9817 <div title="&#73;SBN 1234567890"></div>
9818
9819 !! end
9820
9821 !! test
9822 Bug 2304: HTML attribute safety (RFC)
9823 !! input
9824 <div title="RFC 1234"></div>
9825 !! result
9826 <div title="&#82;FC 1234"></div>
9827
9828 !! end
9829
9830 !! test
9831 Bug 2304: HTML attribute safety (PMID)
9832 !! input
9833 <div title="PMID 1234567890"></div>
9834 !! result
9835 <div title="&#80;MID 1234567890"></div>
9836
9837 !! end
9838
9839 !! test
9840 Bug 2304: HTML attribute safety (web link)
9841 !! input
9842 <div title="http://example.com/"></div>
9843 !! result
9844 <div title="http&#58;//example.com/"></div>
9845
9846 !! end
9847
9848 !! test
9849 Bug 2304: HTML attribute safety (named web link)
9850 !! input
9851 <div title="[http://example.com/ link]"></div>
9852 !! result
9853 <div title="&#91;http&#58;//example.com/ link]"></div>
9854
9855 !! end
9856
9857 !! test
9858 Bug 3244: HTML attribute safety (extension; safe)
9859 !! input
9860 <div style="<nowiki>background:blue</nowiki>"></div>
9861 !! result
9862 <div style="background:blue"></div>
9863
9864 !! end
9865
9866 !! test
9867 Bug 3244: HTML attribute safety (extension; unsafe)
9868 !! input
9869 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
9870 !! result
9871 <div style="/* insecure input */"></div>
9872
9873 !! end
9874
9875 # More MSIE fun discovered by Tom Gilder
9876
9877 !! test
9878 MSIE CSS safety test: spurious slash
9879 !! input
9880 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
9881 !! result
9882 <div style="/* insecure input */">evil</div>
9883
9884 !! end
9885
9886 !! test
9887 MSIE CSS safety test: hex code
9888 !! input
9889 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
9890 !! result
9891 <div style="/* insecure input */">evil</div>
9892
9893 !! end
9894
9895 !! test
9896 MSIE CSS safety test: comment in url
9897 !! input
9898 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
9899 !! result
9900 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
9901
9902 !! end
9903
9904 !! test
9905 MSIE CSS safety test: comment in expression
9906 !! input
9907 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
9908 !! result
9909 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
9910
9911 !! end
9912
9913
9914 !! test
9915 Table attribute legitimate extension
9916 !! input
9917 {|
9918 !+ style="<nowiki>color:blue</nowiki>"| status
9919 |}
9920 !! result
9921 <table>
9922 <tr>
9923 <th style="color:blue"> status
9924 </th></tr></table>
9925
9926 !!end
9927
9928 !! test
9929 Table attribute safety
9930 !! input
9931 {|
9932 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
9933 |}
9934 !! result
9935 <table>
9936 <tr>
9937 <th style="/* insecure input */"> status
9938 </th></tr></table>
9939
9940 !! end
9941
9942 !! test
9943 CSS line continuation 1
9944 !! input
9945 <div style="background-image: u\&#10;rl(test.jpg);"></div>
9946 !! result
9947 <div style="/* insecure input */"></div>
9948
9949 !! end
9950
9951 !! test
9952 CSS line continuation 2
9953 !! input
9954 <div style="background-image: u\&#13;rl(test.jpg); "></div>
9955 !! result
9956 <div style="/* insecure input */"></div>
9957
9958 !! end
9959
9960 !! article
9961 Template:Identity
9962 !! text
9963 {{{1}}}
9964 !! endarticle
9965
9966 !! test
9967 Expansion of multi-line templates in attribute values (bug 6255)
9968 !! input
9969 <div style="background: {{identity|#00FF00}}">-</div>
9970 !! result
9971 <div style="background: #00FF00">-</div>
9972
9973 !! end
9974
9975
9976 !! test
9977 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
9978 !! input
9979 <div style="background:
9980 #00FF00">-</div>
9981 !! result
9982 <div style="background: #00FF00">-</div>
9983
9984 !! end
9985
9986 !! test
9987 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
9988 !! input
9989 <div style="background: &#10;#00FF00">-</div>
9990 !! result
9991 <div style="background: &#10;#00FF00">-</div>
9992
9993 !! end
9994
9995 ###
9996 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
9997 ###
9998 !! test
9999 Parser hook: empty input
10000 !! input
10001 <tag></tag>
10002 !! result
10003 <pre>
10004 ''
10005 array (
10006 )
10007 </pre>
10008
10009 !! end
10010
10011 !! test
10012 Parser hook: empty input using terminated empty elements
10013 !! input
10014 <tag/>
10015 !! result
10016 <pre>
10017 NULL
10018 array (
10019 )
10020 </pre>
10021
10022 !! end
10023
10024 !! test
10025 Parser hook: empty input using terminated empty elements (space before)
10026 !! input
10027 <tag />
10028 !! result
10029 <pre>
10030 NULL
10031 array (
10032 )
10033 </pre>
10034
10035 !! end
10036
10037 !! test
10038 Parser hook: basic input
10039 !! input
10040 <tag>input</tag>
10041 !! result
10042 <pre>
10043 'input'
10044 array (
10045 )
10046 </pre>
10047
10048 !! end
10049
10050
10051 !! test
10052 Parser hook: case insensitive
10053 !! input
10054 <TAG>input</TAG>
10055 !! result
10056 <pre>
10057 'input'
10058 array (
10059 )
10060 </pre>
10061
10062 !! end
10063
10064
10065 !! test
10066 Parser hook: case insensitive, redux
10067 !! input
10068 <TaG>input</TAg>
10069 !! result
10070 <pre>
10071 'input'
10072 array (
10073 )
10074 </pre>
10075
10076 !! end
10077
10078 !! test
10079 Parser hook: nested tags
10080 !! options
10081 noxml
10082 !! input
10083 <tag><tag></tag></tag>
10084 !! result
10085 <pre>
10086 '<tag>'
10087 array (
10088 )
10089 </pre>&lt;/tag&gt;
10090
10091 !! end
10092
10093 !! test
10094 Parser hook: basic arguments
10095 !! input
10096 <tag width=200 height = "100" depth = '50' square></tag>
10097 !! result
10098 <pre>
10099 ''
10100 array (
10101 'width' => '200',
10102 'height' => '100',
10103 'depth' => '50',
10104 'square' => 'square',
10105 )
10106 </pre>
10107
10108 !! end
10109
10110 !! test
10111 Parser hook: argument containing a forward slash (bug 5344)
10112 !! input
10113 <tag filename='/tmp/bla'></tag>
10114 !! result
10115 <pre>
10116 ''
10117 array (
10118 'filename' => '/tmp/bla',
10119 )
10120 </pre>
10121
10122 !! end
10123
10124 !! test
10125 Parser hook: empty input using terminated empty elements (bug 2374)
10126 !! input
10127 <tag foo=bar/>text
10128 !! result
10129 <pre>
10130 NULL
10131 array (
10132 'foo' => 'bar',
10133 )
10134 </pre>text
10135
10136 !! end
10137
10138 # </tag> should be output literally since there is no matching tag that begins it
10139 !! test
10140 Parser hook: basic arguments using terminated empty elements (bug 2374)
10141 !! input
10142 <tag width=200 height = "100" depth = '50' square/>
10143 other stuff
10144 </tag>
10145 !! result
10146 <pre>
10147 NULL
10148 array (
10149 'width' => '200',
10150 'height' => '100',
10151 'depth' => '50',
10152 'square' => 'square',
10153 )
10154 </pre>
10155 <p>other stuff
10156 &lt;/tag&gt;
10157 </p>
10158 !! end
10159
10160 ###
10161 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
10162 ###
10163
10164 !! test
10165 Parser hook: static parser hook not inside a comment
10166 !! input
10167 <statictag>hello, world</statictag>
10168 <statictag action=flush/>
10169 !! result
10170 <p>hello, world
10171 </p>
10172 !! end
10173
10174
10175 !! test
10176 Parser hook: static parser hook inside a comment
10177 !! input
10178 <!-- <statictag>hello, world</statictag> -->
10179 <statictag action=flush/>
10180 !! result
10181 <p><br />
10182 </p>
10183 !! end
10184
10185 # Nested template calls; this case was broken by Parser.php rev 1.506,
10186 # since reverted.
10187
10188 !! article
10189 Template:One-parameter
10190 !! text
10191 (My parameter is: {{{1}}})
10192 !! endarticle
10193
10194 !! article
10195 Template:Map-one-parameter
10196 !! text
10197 {{{{{1}}}|{{{2}}}}}
10198 !! endarticle
10199
10200 !! test
10201 Nested template calls
10202 !! input
10203 {{Map-one-parameter|One-parameter|param}}
10204 !! result
10205 <p>(My parameter is: param)
10206 </p>
10207 !! end
10208
10209
10210 ###
10211 ### Sanitizer
10212 ###
10213 !! test
10214 Sanitizer: Closing of open tags
10215 !! input
10216 <s></s><table></table>
10217 !! result
10218 <s></s><table></table>
10219
10220 !! end
10221
10222 !! test
10223 Sanitizer: Closing of open but not closed tags
10224 !! input
10225 <s>foo
10226 !! result
10227 <p><s>foo</s>
10228 </p>
10229 !! end
10230
10231 !! test
10232 Sanitizer: Closing of closed but not open tags
10233 !! input
10234 </s>
10235 !! result
10236 <p>&lt;/s&gt;
10237 </p>
10238 !! end
10239
10240 !! test
10241 Sanitizer: Closing of closed but not open table tags
10242 !! input
10243 Table not started</td></tr></table>
10244 !! result
10245 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
10246 </p>
10247 !! end
10248
10249 !! test
10250 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
10251 !! input
10252 <span id="æ: v">byte</span>[[#æ: v|backlink]]
10253 !! result
10254 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
10255 </p>
10256 !! end
10257
10258 !! test
10259 Sanitizer: Validating the contents of the id attribute (bug 4515)
10260 !! options
10261 disabled
10262 !! input
10263 <br id=9 />
10264 !! result
10265 Something, but definitely not <br id="9" />...
10266 !! end
10267
10268 !! test
10269 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
10270 !! options
10271 disabled
10272 !! input
10273 <br id="foo" /><br id="foo" />
10274 !! result
10275 Something need to be done. foo-2 ?
10276 !! end
10277
10278 !! test
10279 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
10280 !! input
10281 <div itemscope>
10282 <meta itemprop="hello" content="world">
10283 <meta http-equiv="refresh" content="5">
10284 <meta itemprop="hello" http-equiv="refresh" content="5">
10285 <link itemprop="hello" href="{{SERVER}}">
10286 <link rel="stylesheet" href="{{SERVER}}">
10287 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
10288 </div>
10289 !! result
10290 <div itemscope="itemscope">
10291 <p> <meta itemprop="hello" content="world" />
10292 &lt;meta http-equiv="refresh" content="5"&gt;
10293 <meta itemprop="hello" content="5" />
10294 </p>
10295 <link itemprop="hello" href="http&#58;//example.org" />
10296 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
10297 <link itemprop="hello" href="http&#58;//example.org" />
10298 </div>
10299
10300 !! end
10301
10302 !! test
10303 Language converter: output gets cut off unexpectedly (bug 5757)
10304 !! options
10305 language=zh
10306 !! input
10307 this bit is safe: }-
10308
10309 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
10310
10311 then we get cut off here: }-
10312
10313 all additional text is vanished
10314 !! result
10315 <p>this bit is safe: }-
10316 </p><p>but if we add a conversion instance: xxx
10317 </p><p>then we get cut off here: }-
10318 </p><p>all additional text is vanished
10319 </p>
10320 !! end
10321
10322 !! test
10323 Self closed html pairs (bug 5487)
10324 !! options
10325 !! input
10326 <center><font id="bug" />Centered text</center>
10327 <div><font id="bug2" />In div text</div>
10328 !! result
10329 <center>&lt;font id="bug" /&gt;Centered text</center>
10330 <div>&lt;font id="bug2" /&gt;In div text</div>
10331
10332 !! end
10333
10334 #
10335 #
10336 #
10337
10338 !! test
10339 Punctuation: nbsp before exclamation
10340 !! input
10341 C'est grave !
10342 !! result
10343 <p>C'est grave&#160;!
10344 </p>
10345 !! end
10346
10347 !! test
10348 Punctuation: CSS !important (bug 11874)
10349 !! input
10350 <div style="width:50% !important">important</div>
10351 !! result
10352 <div style="width:50% !important">important</div>
10353
10354 !!end
10355
10356 !! test
10357 Punctuation: CSS ! important (bug 11874; with space after)
10358 !! input
10359 <div style="width:50% ! important">important</div>
10360 !! result
10361 <div style="width:50% ! important">important</div>
10362
10363 !!end
10364
10365
10366 !! test
10367 HTML bullet list, closed tags (bug 5497)
10368 !! input
10369 <ul>
10370 <li>One</li>
10371 <li>Two</li>
10372 </ul>
10373 !! result
10374 <ul>
10375 <li>One</li>
10376 <li>Two</li>
10377 </ul>
10378
10379 !! end
10380
10381 !! test
10382 HTML bullet list, unclosed tags (bug 5497)
10383 !! options
10384 disabled
10385 !! input
10386 <ul>
10387 <li>One
10388 <li>Two
10389 </ul>
10390 !! result
10391 <ul>
10392 <li>One
10393 </li><li>Two
10394 </li></ul>
10395
10396 !! end
10397
10398 !! test
10399 HTML ordered list, closed tags (bug 5497)
10400 !! input
10401 <ol>
10402 <li>One</li>
10403 <li>Two</li>
10404 </ol>
10405 !! result
10406 <ol>
10407 <li>One</li>
10408 <li>Two</li>
10409 </ol>
10410
10411 !! end
10412
10413 !! test
10414 HTML ordered list, unclosed tags (bug 5497)
10415 !! options
10416 disabled
10417 !! input
10418 <ol>
10419 <li>One
10420 <li>Two
10421 </ol>
10422 !! result
10423 <ol>
10424 <li>One
10425 </li><li>Two
10426 </li></ol>
10427
10428 !! end
10429
10430 !! test
10431 HTML nested bullet list, closed tags (bug 5497)
10432 !! input
10433 <ul>
10434 <li>One</li>
10435 <li>Two:
10436 <ul>
10437 <li>Sub-one</li>
10438 <li>Sub-two</li>
10439 </ul>
10440 </li>
10441 </ul>
10442 !! result
10443 <ul>
10444 <li>One</li>
10445 <li>Two:
10446 <ul>
10447 <li>Sub-one</li>
10448 <li>Sub-two</li>
10449 </ul>
10450 </li>
10451 </ul>
10452
10453 !! end
10454
10455 !! test
10456 HTML nested bullet list, open tags (bug 5497)
10457 !! options
10458 disabled
10459 !! input
10460 <ul>
10461 <li>One
10462 <li>Two:
10463 <ul>
10464 <li>Sub-one
10465 <li>Sub-two
10466 </ul>
10467 </ul>
10468 !! result
10469 <ul>
10470 <li>One
10471 </li><li>Two:
10472 <ul>
10473 <li>Sub-one
10474 </li><li>Sub-two
10475 </li></ul>
10476 </li></ul>
10477
10478 !! end
10479
10480 !! test
10481 HTML nested ordered list, closed tags (bug 5497)
10482 !! input
10483 <ol>
10484 <li>One</li>
10485 <li>Two:
10486 <ol>
10487 <li>Sub-one</li>
10488 <li>Sub-two</li>
10489 </ol>
10490 </li>
10491 </ol>
10492 !! result
10493 <ol>
10494 <li>One</li>
10495 <li>Two:
10496 <ol>
10497 <li>Sub-one</li>
10498 <li>Sub-two</li>
10499 </ol>
10500 </li>
10501 </ol>
10502
10503 !! end
10504
10505 !! test
10506 HTML nested ordered list, open tags (bug 5497)
10507 !! options
10508 disabled
10509 !! input
10510 <ol>
10511 <li>One
10512 <li>Two:
10513 <ol>
10514 <li>Sub-one
10515 <li>Sub-two
10516 </ol>
10517 </ol>
10518 !! result
10519 <ol>
10520 <li>One
10521 </li><li>Two:
10522 <ol>
10523 <li>Sub-one
10524 </li><li>Sub-two
10525 </li></ol>
10526 </li></ol>
10527
10528 !! end
10529
10530 !! test
10531 HTML ordered list item with parameters oddity
10532 !! input
10533 <ol><li id="fragment">One</li></ol>
10534 !! result
10535 <ol><li id="fragment">One</li></ol>
10536
10537 !! end
10538
10539 !!test
10540 bug 5918: autonumbering
10541 !! input
10542 [http://first/] [http://second] [ftp://ftp]
10543
10544 ftp://inlineftp
10545
10546 [mailto:enclosed@mail.tld With target]
10547
10548 [mailto:enclosed@mail.tld]
10549
10550 mailto:inline@mail.tld
10551 !! result
10552 <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>
10553 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
10554 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
10555 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
10556 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
10557 </p>
10558 !! end
10559
10560
10561 #
10562 # Security and HTML correctness
10563 # From Nick Jenkins' fuzz testing
10564 #
10565
10566 !! test
10567 Fuzz testing: Parser13
10568 !! input
10569 {|
10570 | http://a|
10571 !! result
10572 <table>
10573 <tr>
10574 <td>
10575 </td>
10576 </tr>
10577 </table>
10578
10579 !! end
10580
10581 !! test
10582 Fuzz testing: Parser14
10583 !! input
10584 == onmouseover= ==
10585 http://__TOC__
10586 !! result
10587 <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>
10588 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10589 <ul>
10590 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
10591 </ul>
10592 </div>
10593
10594 !! end
10595
10596 !! test
10597 Fuzz testing: Parser14-table
10598 !! input
10599 ==a==
10600 {| STYLE=__TOC__
10601 !! result
10602 <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>
10603 <table style="&#95;_TOC&#95;_">
10604 <tr><td></td></tr>
10605 </table>
10606
10607 !! end
10608
10609 # Known to produce bogus xml (extra </td>)
10610 !! test
10611 Fuzz testing: Parser16
10612 !! options
10613 noxml
10614 !! input
10615 {|
10616 !https://||||||
10617 !! result
10618 <table>
10619 <tr>
10620 <th>https://</th>
10621 <th></th>
10622 <th></th>
10623 <th>
10624 </td>
10625 </tr>
10626 </table>
10627
10628 !! end
10629
10630 !! test
10631 Fuzz testing: Parser21
10632 !! input
10633 {|
10634 ! irc://{{ftp://a" onmouseover="alert('hello world');"
10635 |
10636 !! result
10637 <table>
10638 <tr>
10639 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
10640 </th>
10641 <td>
10642 </td>
10643 </tr>
10644 </table>
10645
10646 !! end
10647
10648 !! test
10649 Fuzz testing: Parser22
10650 !! input
10651 http://===r:::https://b
10652
10653 {|
10654 !!result
10655 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
10656 </p>
10657 <table>
10658 <tr><td></td></tr>
10659 </table>
10660
10661 !! end
10662
10663 # Known to produce bad XML for now
10664 !! test
10665 Fuzz testing: Parser24
10666 !! options
10667 noxml
10668 !! input
10669 {|
10670 {{{|
10671 <u CLASS=
10672 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
10673 <br style="onmouseover='alert(document.cookie);' " />
10674
10675 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10676 |
10677 !! result
10678 <table>
10679 {{{|
10680 <u class="&#124;">}}}} &gt;
10681 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
10682
10683 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10684 <tr>
10685 <td></u>
10686 </td>
10687 </tr>
10688 </table>
10689
10690 !! end
10691
10692 # Note: the current result listed for this is not what the original one was,
10693 # but the original bug was JavaScript injection, which is fixed in any case.
10694 # It's not clear that the original result listed was any more correct than the
10695 # current one. Original result:
10696 # <p>{{{|
10697 # </p>
10698 # <li class="&#124;&#124;">
10699 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10700 !!test
10701 Fuzz testing: Parser25 (bug 6055)
10702 !! input
10703 {{{
10704 |
10705 <LI CLASS=||
10706 >
10707 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
10708 !! result
10709 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10710 </p>
10711 !! end
10712
10713 !!test
10714 Fuzz testing: URL adjacent extension (with space, clean)
10715 !! options
10716 !! input
10717 http://example.com <nowiki>junk</nowiki>
10718 !! result
10719 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
10720 </p>
10721 !!end
10722
10723 !!test
10724 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
10725 !! options
10726 !! input
10727 http://example.com<nowiki>junk</nowiki>
10728 !! result
10729 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
10730 </p>
10731 !!end
10732
10733 !!test
10734 Fuzz testing: URL adjacent extension (no space, dirty; pre)
10735 !! options
10736 !! input
10737 http://example.com<pre>junk</pre>
10738 !! result
10739 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
10740
10741 !!end
10742
10743 !!test
10744 Fuzz testing: image with bogus manual thumbnail
10745 !!input
10746 [[Image:foobar.jpg|thumbnail= ]]
10747 !!result
10748 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
10749
10750 !!end
10751
10752 !! test
10753 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
10754 !! input
10755 <pre dir="&#10;"></pre>
10756 !! result
10757 <pre dir="&#10;"></pre>
10758
10759 !! end
10760
10761 !! test
10762 Parsing optional HTML elements (Bug 6171)
10763 !! options
10764 !! input
10765 <table>
10766 <tr>
10767 <td> Some tabular data</td>
10768 <td> More tabular data ...
10769 <td> And yet som tabular data</td>
10770 </tr>
10771 </table>
10772 !! result
10773 <table>
10774 <tr>
10775 <td> Some tabular data</td>
10776 <td> More tabular data ...
10777 </td><td> And yet som tabular data</td>
10778 </tr>
10779 </table>
10780
10781 !! end
10782
10783 !! test
10784 Correct handling of <td>, <tr> (Bug 6171)
10785 !! options
10786 !! input
10787 <table>
10788 <tr>
10789 <td> Some tabular data</td>
10790 <td> More tabular data ...</td>
10791 <td> And yet som tabular data</td>
10792 </tr>
10793 </table>
10794 !! result
10795 <table>
10796 <tr>
10797 <td> Some tabular data</td>
10798 <td> More tabular data ...</td>
10799 <td> And yet som tabular data</td>
10800 </tr>
10801 </table>
10802
10803 !! end
10804
10805
10806 !! test
10807 Parsing crashing regression (fr:JavaScript)
10808 !! input
10809 </body></x>
10810 !! result
10811 <p>&lt;/body&gt;&lt;/x&gt;
10812 </p>
10813 !! end
10814
10815 !! test
10816 Inline wiki vs wiki block nesting
10817 !! input
10818 '''Bold paragraph
10819
10820 New wiki paragraph
10821 !! result
10822 <p><b>Bold paragraph</b>
10823 </p><p>New wiki paragraph
10824 </p>
10825 !! end
10826
10827 !! test
10828 Inline HTML vs wiki block nesting
10829 !! options
10830 disabled
10831 !! input
10832 <b>Bold paragraph
10833
10834 New wiki paragraph
10835 !! result
10836 <p><b>Bold paragraph</b>
10837 </p><p>New wiki paragraph
10838 </p>
10839 !! end
10840
10841 # Original result was this:
10842 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
10843 # </p>
10844 # While that might be marginally more intuitive, maybe, the six-apostrophe
10845 # construct is clearly pathological and the result stated here (which is what
10846 # the parser actually does) is about as reasonable as anything.
10847 !!test
10848 Mixing markup for italics and bold
10849 !! options
10850 !! input
10851 '''bold''''''bold''bolditalics'''''
10852 !! result
10853 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
10854 </p>
10855 !! end
10856
10857
10858 !! article
10859 Xyzzyx
10860 !! text
10861 Article for special page transclusion test
10862 !! endarticle
10863
10864 !! test
10865 Special page transclusion
10866 !! options
10867 !! input
10868 {{Special:Prefixindex/Xyzzyx}}
10869 !! result
10870 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10871
10872 !! end
10873
10874 !! test
10875 Special page transclusion twice (bug 5021)
10876 !! options
10877 !! input
10878 {{Special:Prefixindex/Xyzzyx}}
10879 {{Special:Prefixindex/Xyzzyx}}
10880 !! result
10881 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10882 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10883
10884 !! end
10885
10886 !! test
10887 Transclusion of default MediaWiki message
10888 !! input
10889 {{MediaWiki:Mainpage}}
10890 !!result
10891 <p>Main Page
10892 </p>
10893 !! end
10894
10895 !! test
10896 Transclusion of nonexistent MediaWiki message
10897 !! input
10898 {{MediaWiki:Mainpagexxx}}
10899 !!result
10900 <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>
10901 </p>
10902 !! end
10903
10904 !! test
10905 Transclusion of MediaWiki message with underscore
10906 !! input
10907 {{MediaWiki:history_short}}
10908 !! result
10909 <p>History
10910 </p>
10911 !! end
10912
10913 !! test
10914 Transclusion of MediaWiki message with space
10915 !! input
10916 {{MediaWiki:history short}}
10917 !! result
10918 <p>History
10919 </p>
10920 !! end
10921
10922 !! test
10923 Invalid header with following text
10924 !! input
10925 = x = y
10926 !! result
10927 <p>= x = y
10928 </p>
10929 !! end
10930
10931
10932 !! test
10933 Section extraction test (section 0)
10934 !! options
10935 section=0
10936 !! input
10937 start
10938 ==a==
10939 ===aa===
10940 ====aaa====
10941 ==b==
10942 ===ba===
10943 ===bb===
10944 ====bba====
10945 ===bc===
10946 ==c==
10947 ===ca===
10948 !! result
10949 start
10950 !! end
10951
10952 !! test
10953 Section extraction test (section 1)
10954 !! options
10955 section=1
10956 !! input
10957 start
10958 ==a==
10959 ===aa===
10960 ====aaa====
10961 ==b==
10962 ===ba===
10963 ===bb===
10964 ====bba====
10965 ===bc===
10966 ==c==
10967 ===ca===
10968 !! result
10969 ==a==
10970 ===aa===
10971 ====aaa====
10972 !! end
10973
10974 !! test
10975 Section extraction test (section 2)
10976 !! options
10977 section=2
10978 !! input
10979 start
10980 ==a==
10981 ===aa===
10982 ====aaa====
10983 ==b==
10984 ===ba===
10985 ===bb===
10986 ====bba====
10987 ===bc===
10988 ==c==
10989 ===ca===
10990 !! result
10991 ===aa===
10992 ====aaa====
10993 !! end
10994
10995 !! test
10996 Section extraction test (section 3)
10997 !! options
10998 section=3
10999 !! input
11000 start
11001 ==a==
11002 ===aa===
11003 ====aaa====
11004 ==b==
11005 ===ba===
11006 ===bb===
11007 ====bba====
11008 ===bc===
11009 ==c==
11010 ===ca===
11011 !! result
11012 ====aaa====
11013 !! end
11014
11015 !! test
11016 Section extraction test (section 4)
11017 !! options
11018 section=4
11019 !! input
11020 start
11021 ==a==
11022 ===aa===
11023 ====aaa====
11024 ==b==
11025 ===ba===
11026 ===bb===
11027 ====bba====
11028 ===bc===
11029 ==c==
11030 ===ca===
11031 !! result
11032 ==b==
11033 ===ba===
11034 ===bb===
11035 ====bba====
11036 ===bc===
11037 !! end
11038
11039 !! test
11040 Section extraction test (section 5)
11041 !! options
11042 section=5
11043 !! input
11044 start
11045 ==a==
11046 ===aa===
11047 ====aaa====
11048 ==b==
11049 ===ba===
11050 ===bb===
11051 ====bba====
11052 ===bc===
11053 ==c==
11054 ===ca===
11055 !! result
11056 ===ba===
11057 !! end
11058
11059 !! test
11060 Section extraction test (section 6)
11061 !! options
11062 section=6
11063 !! input
11064 start
11065 ==a==
11066 ===aa===
11067 ====aaa====
11068 ==b==
11069 ===ba===
11070 ===bb===
11071 ====bba====
11072 ===bc===
11073 ==c==
11074 ===ca===
11075 !! result
11076 ===bb===
11077 ====bba====
11078 !! end
11079
11080 !! test
11081 Section extraction test (section 7)
11082 !! options
11083 section=7
11084 !! input
11085 start
11086 ==a==
11087 ===aa===
11088 ====aaa====
11089 ==b==
11090 ===ba===
11091 ===bb===
11092 ====bba====
11093 ===bc===
11094 ==c==
11095 ===ca===
11096 !! result
11097 ====bba====
11098 !! end
11099
11100 !! test
11101 Section extraction test (section 8)
11102 !! options
11103 section=8
11104 !! input
11105 start
11106 ==a==
11107 ===aa===
11108 ====aaa====
11109 ==b==
11110 ===ba===
11111 ===bb===
11112 ====bba====
11113 ===bc===
11114 ==c==
11115 ===ca===
11116 !! result
11117 ===bc===
11118 !! end
11119
11120 !! test
11121 Section extraction test (section 9)
11122 !! options
11123 section=9
11124 !! input
11125 start
11126 ==a==
11127 ===aa===
11128 ====aaa====
11129 ==b==
11130 ===ba===
11131 ===bb===
11132 ====bba====
11133 ===bc===
11134 ==c==
11135 ===ca===
11136 !! result
11137 ==c==
11138 ===ca===
11139 !! end
11140
11141 !! test
11142 Section extraction test (section 10)
11143 !! options
11144 section=10
11145 !! input
11146 start
11147 ==a==
11148 ===aa===
11149 ====aaa====
11150 ==b==
11151 ===ba===
11152 ===bb===
11153 ====bba====
11154 ===bc===
11155 ==c==
11156 ===ca===
11157 !! result
11158 ===ca===
11159 !! end
11160
11161 !! test
11162 Section extraction test (nonexistent section 11)
11163 !! options
11164 section=11
11165 !! input
11166 start
11167 ==a==
11168 ===aa===
11169 ====aaa====
11170 ==b==
11171 ===ba===
11172 ===bb===
11173 ====bba====
11174 ===bc===
11175 ==c==
11176 ===ca===
11177 !! result
11178 !! end
11179
11180 !! test
11181 Section extraction test with bogus heading (section 1)
11182 !! options
11183 section=1
11184 !! input
11185 ==a==
11186 ==bogus== not a legal section
11187 ==b==
11188 !! result
11189 ==a==
11190 ==bogus== not a legal section
11191 !! end
11192
11193 !! test
11194 Section extraction test with bogus heading (section 2)
11195 !! options
11196 section=2
11197 !! input
11198 ==a==
11199 ==bogus== not a legal section
11200 ==b==
11201 !! result
11202 ==b==
11203 !! end
11204
11205 !! test
11206 Section extraction test with comment after heading (section 1)
11207 !! options
11208 section=1
11209 !! input
11210 ==a==
11211 ==b== <!-- -->
11212 ==c==
11213 !! result
11214 ==a==
11215 !! end
11216
11217 !! test
11218 Section extraction test with comment after heading (section 2)
11219 !! options
11220 section=2
11221 !! input
11222 ==a==
11223 ==b== <!-- -->
11224 ==c==
11225 !! result
11226 ==b== <!-- -->
11227 !! end
11228
11229 !! test
11230 Section extraction test with bogus <nowiki> heading (section 1)
11231 !! options
11232 section=1
11233 !! input
11234 ==a==
11235 ==bogus== <nowiki>not a legal section</nowiki>
11236 ==b==
11237 !! result
11238 ==a==
11239 ==bogus== <nowiki>not a legal section</nowiki>
11240 !! end
11241
11242 !! test
11243 Section extraction test with bogus <nowiki> heading (section 2)
11244 !! options
11245 section=2
11246 !! input
11247 ==a==
11248 ==bogus== <nowiki>not a legal section</nowiki>
11249 ==b==
11250 !! result
11251 ==b==
11252 !! end
11253
11254
11255 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
11256 # instead of respecting commented sections
11257 !! test
11258 Section extraction prefixed by comment (section 1)
11259 !! options
11260 section=1
11261 !! input
11262 <!-- -->==sec1==
11263 ==sec2==
11264 !!result
11265 ==sec2==
11266 !!end
11267
11268 !! test
11269 Section extraction prefixed by comment (section 2)
11270 !! options
11271 section=2
11272 !! input
11273 <!-- -->==sec1==
11274 ==sec2==
11275 !!result
11276
11277 !!end
11278
11279
11280 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
11281 # instead of respecting HTML-style headings
11282 !! test
11283 Section extraction, mixed wiki and html (section 1)
11284 !! options
11285 section=1
11286 !! input
11287 <h2>unmarked</h2>
11288 unmarked
11289 ==1==
11290 one
11291 ==2==
11292 two
11293 !! result
11294 ==1==
11295 one
11296 !! end
11297
11298 !! test
11299 Section extraction, mixed wiki and html (section 2)
11300 !! options
11301 section=2
11302 !! input
11303 <h2>unmarked</h2>
11304 unmarked
11305 ==1==
11306 one
11307 ==2==
11308 two
11309 !! result
11310 ==2==
11311 two
11312 !! end
11313
11314
11315 # Formerly testing for bug 3342
11316 !! test
11317 Section extraction, heading surrounded by <noinclude>
11318 !! options
11319 section=1
11320 !! input
11321 <noinclude>==unmarked==</noinclude>
11322 ==marked==
11323 !! result
11324 ==marked==
11325 !!end
11326
11327 # Test behavior of bug 19910
11328 !! test
11329 Sectiion with all-equals
11330 !! options
11331 section=2
11332 !! input
11333 ===
11334 The line above must have a trailing space
11335 === <!--
11336 --> <!-- -->
11337 But just in case it doesn't...
11338 !! result
11339 === <!--
11340 --> <!-- -->
11341 But just in case it doesn't...
11342 !! end
11343
11344 !! test
11345 Section replacement test (section 0)
11346 !! options
11347 replace=0,"xxx"
11348 !! input
11349 start
11350 ==a==
11351 ===aa===
11352 ====aaa====
11353 ==b==
11354 ===ba===
11355 ===bb===
11356 ====bba====
11357 ===bc===
11358 ==c==
11359 ===ca===
11360 !! result
11361 xxx
11362
11363 ==a==
11364 ===aa===
11365 ====aaa====
11366 ==b==
11367 ===ba===
11368 ===bb===
11369 ====bba====
11370 ===bc===
11371 ==c==
11372 ===ca===
11373 !! end
11374
11375 !! test
11376 Section replacement test (section 1)
11377 !! options
11378 replace=1,"xxx"
11379 !! input
11380 start
11381 ==a==
11382 ===aa===
11383 ====aaa====
11384 ==b==
11385 ===ba===
11386 ===bb===
11387 ====bba====
11388 ===bc===
11389 ==c==
11390 ===ca===
11391 !! result
11392 start
11393 xxx
11394
11395 ==b==
11396 ===ba===
11397 ===bb===
11398 ====bba====
11399 ===bc===
11400 ==c==
11401 ===ca===
11402 !! end
11403
11404 !! test
11405 Section replacement test (section 2)
11406 !! options
11407 replace=2,"xxx"
11408 !! input
11409 start
11410 ==a==
11411 ===aa===
11412 ====aaa====
11413 ==b==
11414 ===ba===
11415 ===bb===
11416 ====bba====
11417 ===bc===
11418 ==c==
11419 ===ca===
11420 !! result
11421 start
11422 ==a==
11423 xxx
11424
11425 ==b==
11426 ===ba===
11427 ===bb===
11428 ====bba====
11429 ===bc===
11430 ==c==
11431 ===ca===
11432 !! end
11433
11434 !! test
11435 Section replacement test (section 3)
11436 !! options
11437 replace=3,"xxx"
11438 !! input
11439 start
11440 ==a==
11441 ===aa===
11442 ====aaa====
11443 ==b==
11444 ===ba===
11445 ===bb===
11446 ====bba====
11447 ===bc===
11448 ==c==
11449 ===ca===
11450 !! result
11451 start
11452 ==a==
11453 ===aa===
11454 xxx
11455
11456 ==b==
11457 ===ba===
11458 ===bb===
11459 ====bba====
11460 ===bc===
11461 ==c==
11462 ===ca===
11463 !! end
11464
11465 !! test
11466 Section replacement test (section 4)
11467 !! options
11468 replace=4,"xxx"
11469 !! input
11470 start
11471 ==a==
11472 ===aa===
11473 ====aaa====
11474 ==b==
11475 ===ba===
11476 ===bb===
11477 ====bba====
11478 ===bc===
11479 ==c==
11480 ===ca===
11481 !! result
11482 start
11483 ==a==
11484 ===aa===
11485 ====aaa====
11486 xxx
11487
11488 ==c==
11489 ===ca===
11490 !! end
11491
11492 !! test
11493 Section replacement test (section 5)
11494 !! options
11495 replace=5,"xxx"
11496 !! input
11497 start
11498 ==a==
11499 ===aa===
11500 ====aaa====
11501 ==b==
11502 ===ba===
11503 ===bb===
11504 ====bba====
11505 ===bc===
11506 ==c==
11507 ===ca===
11508 !! result
11509 start
11510 ==a==
11511 ===aa===
11512 ====aaa====
11513 ==b==
11514 xxx
11515
11516 ===bb===
11517 ====bba====
11518 ===bc===
11519 ==c==
11520 ===ca===
11521 !! end
11522
11523 !! test
11524 Section replacement test (section 6)
11525 !! options
11526 replace=6,"xxx"
11527 !! input
11528 start
11529 ==a==
11530 ===aa===
11531 ====aaa====
11532 ==b==
11533 ===ba===
11534 ===bb===
11535 ====bba====
11536 ===bc===
11537 ==c==
11538 ===ca===
11539 !! result
11540 start
11541 ==a==
11542 ===aa===
11543 ====aaa====
11544 ==b==
11545 ===ba===
11546 xxx
11547
11548 ===bc===
11549 ==c==
11550 ===ca===
11551 !! end
11552
11553 !! test
11554 Section replacement test (section 7)
11555 !! options
11556 replace=7,"xxx"
11557 !! input
11558 start
11559 ==a==
11560 ===aa===
11561 ====aaa====
11562 ==b==
11563 ===ba===
11564 ===bb===
11565 ====bba====
11566 ===bc===
11567 ==c==
11568 ===ca===
11569 !! result
11570 start
11571 ==a==
11572 ===aa===
11573 ====aaa====
11574 ==b==
11575 ===ba===
11576 ===bb===
11577 xxx
11578
11579 ===bc===
11580 ==c==
11581 ===ca===
11582 !! end
11583
11584 !! test
11585 Section replacement test (section 8)
11586 !! options
11587 replace=8,"xxx"
11588 !! input
11589 start
11590 ==a==
11591 ===aa===
11592 ====aaa====
11593 ==b==
11594 ===ba===
11595 ===bb===
11596 ====bba====
11597 ===bc===
11598 ==c==
11599 ===ca===
11600 !! result
11601 start
11602 ==a==
11603 ===aa===
11604 ====aaa====
11605 ==b==
11606 ===ba===
11607 ===bb===
11608 ====bba====
11609 xxx
11610
11611 ==c==
11612 ===ca===
11613 !!end
11614
11615 !! test
11616 Section replacement test (section 9)
11617 !! options
11618 replace=9,"xxx"
11619 !! input
11620 start
11621 ==a==
11622 ===aa===
11623 ====aaa====
11624 ==b==
11625 ===ba===
11626 ===bb===
11627 ====bba====
11628 ===bc===
11629 ==c==
11630 ===ca===
11631 !! result
11632 start
11633 ==a==
11634 ===aa===
11635 ====aaa====
11636 ==b==
11637 ===ba===
11638 ===bb===
11639 ====bba====
11640 ===bc===
11641 xxx
11642 !! end
11643
11644 !! test
11645 Section replacement test (section 10)
11646 !! options
11647 replace=10,"xxx"
11648 !! input
11649 start
11650 ==a==
11651 ===aa===
11652 ====aaa====
11653 ==b==
11654 ===ba===
11655 ===bb===
11656 ====bba====
11657 ===bc===
11658 ==c==
11659 ===ca===
11660 !! result
11661 start
11662 ==a==
11663 ===aa===
11664 ====aaa====
11665 ==b==
11666 ===ba===
11667 ===bb===
11668 ====bba====
11669 ===bc===
11670 ==c==
11671 xxx
11672 !! end
11673
11674 !! test
11675 Section replacement test with initial whitespace (bug 13728)
11676 !! options
11677 replace=2,"xxx"
11678 !! input
11679 Preformatted initial line
11680 ==a==
11681 ===a===
11682 !! result
11683 Preformatted initial line
11684 ==a==
11685 xxx
11686 !! end
11687
11688
11689 !! test
11690 Section extraction, heading followed by pre with 20 spaces (bug 6398)
11691 !! options
11692 section=1
11693 !! input
11694 ==a==
11695 a
11696 !! result
11697 ==a==
11698 a
11699 !! end
11700
11701 !! test
11702 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
11703 !! options
11704 section=1
11705 !! input
11706 ==a==
11707 a
11708 !! result
11709 ==a==
11710 a
11711 !! end
11712
11713
11714 !! test
11715 Section extraction, <pre> around bogus header (bug 10309)
11716 !! options
11717 noxml section=2
11718 !! input
11719 == Section One ==
11720 <pre>
11721 =======
11722 </pre>
11723
11724 == Section Two ==
11725 stuff
11726 !! result
11727 == Section Two ==
11728 stuff
11729 !! end
11730
11731 !! test
11732 Section replacement, <pre> around bogus header (bug 10309)
11733 !! options
11734 noxml replace=2,"xxx"
11735 !! input
11736 == Section One ==
11737 <pre>
11738 =======
11739 </pre>
11740
11741 == Section Two ==
11742 stuff
11743 !! result
11744 == Section One ==
11745 <pre>
11746 =======
11747 </pre>
11748
11749 xxx
11750 !! end
11751
11752
11753
11754 !! test
11755 Handling of &#x0A; in URLs
11756 !! input
11757 **irc://&#x0A;a
11758 !! result
11759 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
11760 </li></ul>
11761 </li></ul>
11762
11763 !!end
11764
11765 !! test
11766 5 quotes, code coverage +1 line (php)
11767 !! options
11768 php
11769 !! input
11770 '''''
11771 !! result
11772 !! end
11773 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
11774 !! test
11775 5 quotes, code coverage +1 line (parsoid)
11776 !! options
11777 parsoid
11778 !! input
11779 '''''
11780 !! result
11781 <p><i><b></b></i></p>
11782 !! end
11783
11784 !! test
11785 Special:Search page linking.
11786 !! input
11787 {{Special:search}}
11788 !! result
11789 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
11790 </p>
11791 !! end
11792
11793 !! test
11794 Say the magic word
11795 !! input
11796 * {{PAGENAME}}
11797 * {{BASEPAGENAME}}
11798 * {{SUBPAGENAME}}
11799 * {{SUBPAGENAMEE}}
11800 * {{ROOTPAGENAME}}
11801 * {{ROOTPAGENAMEE}}
11802 * {{BASEPAGENAME}}
11803 * {{BASEPAGENAMEE}}
11804 * {{TALKPAGENAME}}
11805 * {{TALKPAGENAMEE}}
11806 * {{SUBJECTPAGENAME}}
11807 * {{SUBJECTPAGENAMEE}}
11808 * {{NAMESPACEE}}
11809 * {{NAMESPACE}}
11810 * {{TALKSPACE}}
11811 * {{TALKSPACEE}}
11812 * {{SUBJECTSPACE}}
11813 * {{SUBJECTSPACEE}}
11814 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
11815 !! result
11816 <ul><li> Parser test
11817 </li><li> Parser test
11818 </li><li> Parser test
11819 </li><li> Parser_test
11820 </li><li> Parser test
11821 </li><li> Parser_test
11822 </li><li> Parser test
11823 </li><li> Parser_test
11824 </li><li> Talk:Parser test
11825 </li><li> Talk:Parser_test
11826 </li><li> Parser test
11827 </li><li> Parser_test
11828 </li><li>
11829 </li><li>
11830 </li><li> Talk
11831 </li><li> Talk
11832 </li><li>
11833 </li><li>
11834 </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>
11835 </li></ul>
11836
11837 !! end
11838 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
11839
11840 !! test
11841 Gallery
11842 !! input
11843 <gallery>
11844 image1.png |
11845 image2.gif|||||
11846
11847 image3|
11848 image4 |300px| centre
11849 image5.svg| http://///////
11850 [[x|xx]]]]
11851 * image6
11852 </gallery>
11853 !! result
11854 <ul class="gallery">
11855 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11856 <div style="height: 150px;">Image1.png</div>
11857 <div class="gallerytext">
11858 </div>
11859 </div></li>
11860 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11861 <div style="height: 150px;">Image2.gif</div>
11862 <div class="gallerytext">
11863 <p>||||
11864 </p>
11865 </div>
11866 </div></li>
11867 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11868 <div style="height: 150px;">Image3</div>
11869 <div class="gallerytext">
11870 </div>
11871 </div></li>
11872 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11873 <div style="height: 150px;">Image4</div>
11874 <div class="gallerytext">
11875 <p>300px| centre
11876 </p>
11877 </div>
11878 </div></li>
11879 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11880 <div style="height: 150px;">Image5.svg</div>
11881 <div class="gallerytext">
11882 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
11883 </p>
11884 </div>
11885 </div></li>
11886 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11887 <div style="height: 150px;">* image6</div>
11888 <div class="gallerytext">
11889 </div>
11890 </div></li>
11891 </ul>
11892
11893 !! end
11894
11895 !! test
11896 Gallery (with options)
11897 !! input
11898 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
11899 File:Nonexistant.jpg|caption
11900 File:Nonexistant.jpg
11901 image:foobar.jpg|some '''caption''' [[Main Page]]
11902 image:foobar.jpg
11903 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
11904 </gallery>
11905 !! result
11906 <ul class="gallery" style="max-width: 226px;_width: 226px;">
11907 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
11908 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11909 <div style="height: 70px;">Nonexistant.jpg</div>
11910 <div class="gallerytext">
11911 <p>caption
11912 </p>
11913 </div>
11914 </div></li>
11915 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11916 <div style="height: 70px;">Nonexistant.jpg</div>
11917 <div class="gallerytext">
11918 </div>
11919 </div></li>
11920 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11921 <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>
11922 <div class="gallerytext">
11923 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11924 </p>
11925 </div>
11926 </div></li>
11927 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11928 <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>
11929 <div class="gallerytext">
11930 </div>
11931 </div></li>
11932 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11933 <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>
11934 <div class="gallerytext">
11935 <p>Blabla|blabla.
11936 </p>
11937 </div>
11938 </div></li>
11939 </ul>
11940
11941 !! end
11942
11943 !! test
11944 Gallery with wikitext inside caption
11945 !! input
11946 <gallery>
11947 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
11948 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
11949 </gallery>
11950 !! result
11951 <ul class="gallery">
11952 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11953 <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>
11954 <div class="gallerytext">
11955 <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>
11956 </p>
11957 </div>
11958 </div></li>
11959 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11960 <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>
11961 <div class="gallerytext">
11962 <p>This is a test template
11963 </p>
11964 </div>
11965 </div></li>
11966 </ul>
11967
11968 !! end
11969
11970 !! test
11971 gallery (with showfilename option)
11972 !! input
11973 <gallery showfilename>
11974 File:Nonexistant.jpg|caption
11975 File:Nonexistant.jpg
11976 image:foobar.jpg|some '''caption''' [[Main Page]]
11977 File:Foobar.jpg
11978 </gallery>
11979 !! result
11980 <ul class="gallery">
11981 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11982 <div style="height: 150px;">Nonexistant.jpg</div>
11983 <div class="gallerytext">
11984 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11985 caption
11986 </p>
11987 </div>
11988 </div></li>
11989 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11990 <div style="height: 150px;">Nonexistant.jpg</div>
11991 <div class="gallerytext">
11992 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11993 </p>
11994 </div>
11995 </div></li>
11996 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11997 <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>
11998 <div class="gallerytext">
11999 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12000 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12001 </p>
12002 </div>
12003 </div></li>
12004 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12005 <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>
12006 <div class="gallerytext">
12007 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12008 </p>
12009 </div>
12010 </div></li>
12011 </ul>
12012
12013 !! end
12014
12015 !! test
12016 Gallery (with namespace-less filenames)
12017 !! input
12018 <gallery>
12019 File:Nonexistant.jpg
12020 Nonexistant.jpg
12021 image:foobar.jpg
12022 foobar.jpg
12023 </gallery>
12024 !! result
12025 <ul class="gallery">
12026 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12027 <div style="height: 150px;">Nonexistant.jpg</div>
12028 <div class="gallerytext">
12029 </div>
12030 </div></li>
12031 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12032 <div style="height: 150px;">Nonexistant.jpg</div>
12033 <div class="gallerytext">
12034 </div>
12035 </div></li>
12036 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12037 <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>
12038 <div class="gallerytext">
12039 </div>
12040 </div></li>
12041 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12042 <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>
12043 <div class="gallerytext">
12044 </div>
12045 </div></li>
12046 </ul>
12047
12048 !! end
12049
12050 !! test
12051 HTML Hex character encoding (spells the word "JavaScript")
12052 !! input
12053 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
12054 !! result
12055 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
12056 </p>
12057 !! end
12058
12059 !! test
12060 HTML Hex character encoding bogus encoding (bug 26437 regression check)
12061 !! input
12062 &#xsee;&#XSEE;
12063 !! result
12064 <p>&amp;#xsee;&amp;#XSEE;
12065 </p>
12066 !! end
12067
12068 !! test
12069 HTML Hex character encoding mixed case
12070 !! input
12071 &#xEE;&#Xee;
12072 !! result
12073 <p>&#xee;&#xee;
12074 </p>
12075 !! end
12076
12077 !! test
12078 __FORCETOC__ override
12079 !! input
12080 __NEWSECTIONLINK__
12081 __FORCETOC__
12082 !! result
12083 <p><br />
12084 </p>
12085 !! end
12086
12087 !! test
12088 ISBN code coverage
12089 !! input
12090 ISBN 978-0-1234-56&#x20;789
12091 !! result
12092 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
12093 </p>
12094 !! end
12095
12096 !! test
12097 ISBN followed by 5 spaces
12098 !! input
12099 ISBN
12100 !! result
12101 <p>ISBN
12102 </p>
12103 !! end
12104
12105 !! test
12106 Double ISBN
12107 !! input
12108 ISBN ISBN 1234567890
12109 !! result
12110 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
12111 </p>
12112 !! end
12113
12114 !! test
12115 Bug 22905: <abbr> followed by ISBN followed by </a>
12116 !! input
12117 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
12118 !! result
12119 <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>
12120 </p>
12121 !! end
12122
12123 !! test
12124 Double RFC
12125 !! input
12126 RFC RFC 1234
12127 !! result
12128 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
12129 </p>
12130 !! end
12131
12132 !! test
12133 Double RFC with a wiki link
12134 !! input
12135 RFC [[RFC 1234]]
12136 !! result
12137 <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>
12138 </p>
12139 !! end
12140
12141 !! test
12142 RFC code coverage
12143 !! input
12144 RFC 983&#x20;987
12145 !! result
12146 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
12147 </p>
12148 !! end
12149
12150 !! test
12151 Centre-aligned image
12152 !! input
12153 [[Image:foobar.jpg|centre]]
12154 !! result
12155 <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>
12156
12157 !!end
12158
12159 !! test
12160 None-aligned image
12161 !! input
12162 [[Image:foobar.jpg|none]]
12163 !! result
12164 <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>
12165
12166 !!end
12167
12168 !! test
12169 Width + Height sized image (using px) (height is ignored)
12170 !! input
12171 [[Image:foobar.jpg|640x480px]]
12172 !! result
12173 <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>
12174 </p>
12175 !!end
12176
12177 !! test
12178 Width-sized image (using px, no following whitespace)
12179 !! input
12180 [[Image:foobar.jpg|640px]]
12181 !! result
12182 <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>
12183 </p>
12184 !!end
12185
12186 !! test
12187 Width-sized image (using px, with following whitespace - test regression from r39467)
12188 !! input
12189 [[Image:foobar.jpg|640px ]]
12190 !! result
12191 <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>
12192 </p>
12193 !!end
12194
12195 !! test
12196 Width-sized image (using px, with preceding whitespace - test regression from r39467)
12197 !! input
12198 [[Image:foobar.jpg| 640px]]
12199 !! result
12200 <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>
12201 </p>
12202 !!end
12203
12204 !! test
12205 Another italics / bold test
12206 !! input
12207 ''' ''x'
12208 !! result
12209 <pre>'<i> </i>x'
12210 </pre>
12211 !!end
12212
12213 # Note the results may be incorrect, as parserTest output included this:
12214 # XML error: Mismatched tag at byte 6120:
12215 # ...<dd> </dt></dl> </dd...
12216 !! test
12217 dt/dd/dl test
12218 !! options
12219 disabled
12220 !! input
12221 :;;;::
12222 !! result
12223 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
12224 </dd></dl>
12225 </dd></dl>
12226 </dt></dl>
12227 </dt></dl>
12228 </dt></dl>
12229 </dd></dl>
12230
12231 !!end
12232
12233
12234 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
12235 !! test
12236 Images with the "|" character in the comment
12237 !! input
12238 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
12239 !! result
12240 <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>
12241
12242 !!end
12243
12244 !! test
12245 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
12246 !! input
12247 <html><script>alert(1);</script></html>
12248 !! result
12249 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
12250 </p>
12251 !! end
12252
12253 !! test
12254 HTML with raw HTML ($wgRawHtml==true)
12255 !! options
12256 wgRawHtml=1
12257 !! input
12258 <html><script>alert(1);</script></html>
12259 !! result
12260 <p><script>alert(1);</script>
12261 </p>
12262 !! end
12263
12264 !! test
12265 Parents of subpages, one level up
12266 !! options
12267 subpage title=[[Subpage test/L1/L2/L3]]
12268 !! input
12269 [[../|L2]]
12270 !! result
12271 <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>
12272 </p>
12273 !! end
12274
12275
12276 !! test
12277 Parents of subpages, one level up, not named
12278 !! options
12279 subpage title=[[Subpage test/L1/L2/L3]]
12280 !! input
12281 [[../]]
12282 !! result
12283 <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>
12284 </p>
12285 !! end
12286
12287
12288
12289 !! test
12290 Parents of subpages, two levels up
12291 !! options
12292 subpage title=[[Subpage test/L1/L2/L3]]
12293 !! input
12294 [[../../|L1]]2
12295
12296 [[../../|L1]]l
12297 !! result
12298 <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
12299 </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>
12300 </p>
12301 !! end
12302
12303 !! test
12304 Parents of subpages, two levels up, without trailing slash or name.
12305 !! options
12306 subpage title=[[Subpage test/L1/L2/L3]]
12307 !! input
12308 [[../..]]
12309 !! result
12310 <p>[[../..]]
12311 </p>
12312 !! end
12313
12314 !! test
12315 Parents of subpages, two levels up, with lots of extra trailing slashes.
12316 !! options
12317 subpage title=[[Subpage test/L1/L2/L3]]
12318 !! input
12319 [[../../////]]
12320 !! result
12321 <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>
12322 </p>
12323 !! end
12324
12325 !! article
12326 Subpage test/L1/L2/L3Sibling
12327 !! text
12328 Sibling article
12329 !! endarticle
12330
12331 !! test
12332 Transclusion of a sibling page (one level up)
12333 !! options
12334 subpage title=[[Subpage test/L1/L2/L3]]
12335 !! input
12336 {{../L3Sibling}}
12337 !! result
12338 <p>Sibling article
12339 </p>
12340 !! end
12341
12342 !! test
12343 Transclusion of a child page
12344 !! options
12345 subpage title=[[Subpage test/L1/L2]]
12346 !! input
12347 {{/L3Sibling}}
12348 !! result
12349 <p>Sibling article
12350 </p>
12351 !! end
12352
12353 !! test
12354 Non-transclusion because of too many up levels
12355 !! options
12356 subpage title=[[Subpage test/L1/L2/L3]]
12357 !! input
12358 {{../../../../More than parent}}
12359 !! result
12360 <p>{{../../../../More than parent}}
12361 </p>
12362 !! end
12363
12364 !! test
12365 Definition list code coverage
12366 !! input
12367 ; title : def
12368 ; title : def
12369 ;title: def
12370 !! result
12371 <dl><dt> title &#160;</dt><dd> def
12372 </dd><dt> title&#160;</dt><dd> def
12373 </dd><dt>title</dt><dd> def
12374 </dd></dl>
12375
12376 !! end
12377
12378 !! test
12379 Don't fall for the self-closing div
12380 !! input
12381 <div>hello world</div/>
12382 !! result
12383 <div>hello world</div>
12384
12385 !! end
12386
12387 !! test
12388 MSGNW magic word
12389 !! input
12390 {{MSGNW:msg}}
12391 !! result
12392 <p>&#91;&#91;:Template:Msg&#93;&#93;
12393 </p>
12394 !! end
12395
12396 !! test
12397 RAW magic word
12398 !! input
12399 {{RAW:QUERTY}}
12400 !! result
12401 <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>
12402 </p>
12403 !! end
12404
12405 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
12406 !! test
12407 Always escape literal '>' in output, not just after '<'
12408 !! input
12409 ><>
12410 !! result
12411 <p>&gt;&lt;&gt;
12412 </p>
12413 !! end
12414
12415 !! test
12416 Template caching
12417 !! input
12418 {{Test}}
12419 {{Test}}
12420 !! result
12421 <p>This is a test template
12422 This is a test template
12423 </p>
12424 !! end
12425
12426
12427 !! article
12428 MediaWiki:Fake
12429 !! text
12430 ==header==
12431 !! endarticle
12432
12433 !! test
12434 Inclusion of !userCanEdit() content
12435 !! input
12436 {{MediaWiki:Fake}}
12437 !! result
12438 <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>
12439
12440 !! end
12441
12442
12443 !! test
12444 Out-of-order TOC heading levels
12445 !! input
12446 ==2==
12447 ======6======
12448 ===3===
12449 =1=
12450 =====5=====
12451 ==2==
12452 !! result
12453 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12454 <ul>
12455 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
12456 <ul>
12457 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
12458 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
12459 </ul>
12460 </li>
12461 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
12462 <ul>
12463 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
12464 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
12465 </ul>
12466 </li>
12467 </ul>
12468 </div>
12469 <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>
12470 <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>
12471 <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>
12472 <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>
12473 <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>
12474 <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>
12475
12476 !! end
12477
12478
12479 !! test
12480 ISBN with a dummy number
12481 !! input
12482 ISBN ---
12483 !! result
12484 <p>ISBN ---
12485 </p>
12486 !! end
12487
12488
12489 !! test
12490 ISBN with space-delimited number
12491 !! input
12492 ISBN 92 9017 032 8
12493 !! result
12494 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
12495 </p>
12496 !! end
12497
12498
12499 !! test
12500 ISBN with multiple spaces, no number
12501 !! input
12502 ISBN foo
12503 !! result
12504 <p>ISBN foo
12505 </p>
12506 !! end
12507
12508
12509 !! test
12510 ISBN length
12511 !! input
12512 ISBN 123456789
12513
12514 ISBN 1234567890
12515
12516 ISBN 12345678901
12517 !! result
12518 <p>ISBN 123456789
12519 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
12520 </p><p>ISBN 12345678901
12521 </p>
12522 !! end
12523
12524
12525 !! test
12526 ISBN with trailing year (bug 8110)
12527 !! input
12528 ISBN 1-234-56789-0 - 2006
12529
12530 ISBN 1 234 56789 0 - 2006
12531 !! result
12532 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
12533 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
12534 </p>
12535 !! end
12536
12537
12538 !! test
12539 anchorencode
12540 !! input
12541 {{anchorencode:foo bar©#%n}}
12542 !! result
12543 <p>foo_bar.C2.A9.23.25n
12544 </p>
12545 !! end
12546
12547 !! test
12548 anchorencode trims spaces
12549 !! input
12550 {{anchorencode: __pretty__please__}}
12551 !! result
12552 <p>pretty_please
12553 </p>
12554 !! end
12555
12556 !! test
12557 anchorencode deals with links
12558 !! input
12559 {{anchorencode: [[hello|world]] [[hi]]}}
12560 !! result
12561 <p>world_hi
12562 </p>
12563 !! end
12564
12565 !! test
12566 anchorencode deals with templates
12567 !! input
12568 {{anchorencode: {{Foo}} }}
12569 !! result
12570 <p>FOO
12571 </p>
12572 !! end
12573
12574 !! test
12575 anchorencode encodes like the TOC generator: (bug 18431)
12576 !! input
12577 === _ +:.3A%3A&&amp;]] ===
12578 {{anchorencode: _ +:.3A%3A&&amp;]] }}
12579 __NOEDITSECTION__
12580 !! result
12581 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
12582 <p>.2B:.3A.253A.26.26.5D.5D
12583 </p>
12584 !! end
12585
12586 # Expected output in the following test is not necessarily expected (there
12587 # should probably be <p> tags inside the <blockquote> in the output) -- it's
12588 # only testing for well-formedness.
12589 !! test
12590 Bug 6200: blockquotes and paragraph formatting
12591 !! input
12592 <blockquote>
12593 foo
12594 </blockquote>
12595
12596 bar
12597
12598 baz
12599 !! result
12600 <blockquote>
12601 foo
12602 </blockquote>
12603 <p>bar
12604 </p>
12605 <pre>baz
12606 </pre>
12607 !! end
12608
12609 !! test
12610 Bug 8293: Use of center tag ruins paragraph formatting
12611 !! input
12612 <center>
12613 foo
12614 </center>
12615
12616 bar
12617
12618 baz
12619 !! result
12620 <center>
12621 <p>foo
12622 </p>
12623 </center>
12624 <p>bar
12625 </p>
12626 <pre>baz
12627 </pre>
12628 !! end
12629
12630 !!test
12631 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
12632 !!options
12633 php
12634 !!input
12635 <span><s>x</span></s>
12636 !!result
12637 <p><span><s>x&lt;/span&gt;</s></span>
12638 </p>
12639 !!end
12640
12641 !!test
12642 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
12643 !!options
12644 parsoid
12645 !!input
12646 <span><s>x</span></s>
12647 !!result
12648 <p><span><s>x</s></span><s></s>
12649 </p>
12650 !!end
12651
12652 ###
12653 ### Language variants related tests
12654 ###
12655 !! test
12656 Self-link in language variants
12657 !! options
12658 title=[[Dunav]] language=sr
12659 !! input
12660 Both [[Dunav]] and [[Дунав]] are names for this river.
12661 !! result
12662 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
12663 </p>
12664 !!end
12665
12666 !! article
12667 Дуна
12668 !! text
12669 content
12670 !! endarticle
12671
12672 !! test
12673 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
12674 !! options
12675 title=[[Duna]] language=sr
12676 !! input
12677 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
12678 !! result
12679 <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.
12680 </p>
12681 !! end
12682
12683 !! test
12684 Link to pages in language variants
12685 !! options
12686 language=sr
12687 !! input
12688 Main Page can be written as [[Маин Паге]]
12689 !! result
12690 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
12691 </p>
12692 !!end
12693
12694
12695 !! test
12696 Multiple links to pages in language variants
12697 !! options
12698 language=sr
12699 !! input
12700 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
12701 !! result
12702 <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>.
12703 </p>
12704 !!end
12705
12706
12707 !! test
12708 Simple template in language variants
12709 !! options
12710 language=sr
12711 !! input
12712 {{тест}}
12713 !! result
12714 <p>This is a test template
12715 </p>
12716 !! end
12717
12718
12719 !! test
12720 Template with explicit namespace in language variants
12721 !! options
12722 language=sr
12723 !! input
12724 {{Template:тест}}
12725 !! result
12726 <p>This is a test template
12727 </p>
12728 !! end
12729
12730
12731 !! test
12732 Basic test for template parameter in language variants
12733 !! options
12734 language=sr
12735 !! input
12736 {{парамтест|param=foo}}
12737 !! result
12738 <p>This is a test template with parameter foo
12739 </p>
12740 !! end
12741
12742
12743 !! test
12744 Simple category in language variants
12745 !! options
12746 language=sr cat
12747 !! input
12748 [[Category:МедиаWики Усер'с Гуиде]]
12749 !! result
12750 <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>
12751 !! end
12752
12753
12754 !! article
12755 Category:分类
12756 !! text
12757 blah
12758 !! endarticle
12759
12760 !! article
12761 Category:分類
12762 !! text
12763 blah
12764 !! endarticle
12765
12766 !! test
12767 Don't convert blue categorylinks to another variant (bug 33210)
12768 !! options
12769 language=zh cat
12770 !! input
12771 [[A]][[Category:分类]]
12772 !! result
12773 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
12774 !! end
12775
12776
12777 !! test
12778 Stripping -{}- tags (language variants)
12779 !! options
12780 language=sr
12781 !! input
12782 Latin proverb: -{Ne nuntium necare}-
12783 !! result
12784 <p>Latin proverb: Ne nuntium necare
12785 </p>
12786 !! end
12787
12788
12789 !! test
12790 Prevent conversion with -{}- tags (language variants)
12791 !! options
12792 language=sr variant=sr-ec
12793 !! input
12794 Latinski: -{Ne nuntium necare}-
12795 !! result
12796 <p>Латински: Ne nuntium necare
12797 </p>
12798 !! end
12799
12800
12801 !! test
12802 Prevent conversion of text with -{}- tags (language variants)
12803 !! options
12804 language=sr variant=sr-ec
12805 !! input
12806 Latinski: -{Ne nuntium necare}-
12807 !! result
12808 <p>Латински: Ne nuntium necare
12809 </p>
12810 !! end
12811
12812
12813 !! test
12814 Prevent conversion of links with -{}- tags (language variants)
12815 !! options
12816 language=sr variant=sr-ec
12817 !! input
12818 -{[[Main Page]]}-
12819 !! result
12820 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12821 </p>
12822 !! end
12823
12824
12825 !! test
12826 -{}- tags within headlines (within html for parserConvert())
12827 !! options
12828 language=sr variant=sr-ec
12829 !! input
12830 == -{Naslov}- ==
12831 !! result
12832 <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>
12833
12834 !! end
12835
12836
12837 !! test
12838 Explicit definition of language variant alternatives
12839 !! options
12840 language=zh variant=zh-tw
12841 !! input
12842 -{zh:China;zh-tw:Taiwan}-, not China
12843 !! result
12844 <p>Taiwan, not China
12845 </p>
12846 !! end
12847
12848
12849 !! test
12850 Conversion around HTML tags
12851 !! options
12852 language=sr variant=sr-ec
12853 !! input
12854 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
12855 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
12856 !! result
12857 <p>
12858 <span title="ЛаCтин">ски</span>
12859 </p>
12860 !! end
12861
12862
12863 !! test
12864 Explicit session-wise language variant mapping (A flag and - flag)
12865 !! options
12866 language=zh variant=zh-tw
12867 !! input
12868 Taiwan is not China.
12869 But -{A|zh:China;zh-tw:Taiwan}- is China,
12870 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
12871 and -{China}- is China.
12872 !! result
12873 <p>Taiwan is not China.
12874 But Taiwan is Taiwan,
12875 (This should be stripped!)
12876 and China is China.
12877 </p>
12878 !! end
12879
12880 !! test
12881 Explicit session-wise language variant mapping (H flag for hide)
12882 !! options
12883 language=zh variant=zh-tw
12884 !! input
12885 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
12886 Taiwan is China.
12887 !! result
12888 <p>(This should be stripped!)
12889 Taiwan is Taiwan.
12890 </p>
12891 !! end
12892
12893 !! test
12894 Adding explicit conversion rule for title (T flag)
12895 !! options
12896 language=zh variant=zh-tw showtitle
12897 !! input
12898 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12899 !! result
12900 Taiwan
12901 <p>Should be stripped!
12902 </p>
12903 !! end
12904
12905 !! test
12906 Testing that changing the language variant here in the tests actually works
12907 !! options
12908 language=zh variant=zh showtitle
12909 !! input
12910 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12911 !! result
12912 China
12913 <p>Should be stripped!
12914 </p>
12915 !! end
12916
12917 !! test
12918 Recursive conversion of alt and title attrs shouldn't clear converter state
12919 !! options
12920 language=zh variant=zh-cn showtitle
12921 !! input
12922 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
12923 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
12924 !! result
12925 China
12926 <p>
12927 Should be stripped<span title="Exclamation">!</span>
12928 </p>
12929 !! end
12930
12931 !! test
12932 Bug 24072: more test on conversion rule for title
12933 !! options
12934 language=zh variant=zh-tw showtitle
12935 !! input
12936 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12937 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
12938 !! result
12939 Taiwan
12940 <p>This should be stripped!
12941 This won't take interferes with the title rule.
12942 </p>
12943 !! end
12944
12945 !! test
12946 Partly disable title conversion if variant == main language code
12947 !! options
12948 language=zh variant=zh title=[[ZH]] showtitle
12949 !! input
12950 -{T|zh-cn:CN;zh-tw:TW}-
12951 !! result
12952 ZH
12953 <p>
12954 </p>
12955 !! end
12956
12957 !! test
12958 Partly disable title conversion if variant == main language code, more
12959 !! options
12960 language=zh variant=zh title=[[ZH]] showtitle
12961 !! input
12962 -{T|TW}-
12963 !! result
12964 ZH
12965 <p>
12966 </p>
12967 !! end
12968
12969 !! test
12970 Raw output of variant escape tags (R flag)
12971 !! options
12972 language=zh variant=zh-tw
12973 !! input
12974 Raw: -{R|zh:China;zh-tw:Taiwan}-
12975 !! result
12976 <p>Raw: zh:China;zh-tw:Taiwan
12977 </p>
12978 !! end
12979
12980 !! test
12981 Nested using of manual convert syntax
12982 !! options
12983 language=zh variant=zh-hk
12984 !! input
12985 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
12986 !! result
12987 <p>Nested: Hello Hong Kong!
12988 </p>
12989 !! end
12990
12991 !! test
12992 Proper conversion of text in external links
12993 !! options
12994 language=sr variant=sr-ec
12995 !! input
12996 http://www.google.com
12997 gopher://www.google.com
12998 [http://www.google.com http://www.google.com]
12999 [gopher://www.google.com gopher://www.google.com]
13000 [https://www.google.com irc://www.google.com]
13001 [ftp://www.google.com www.google.com/ftp://dir]
13002 [//www.google.com www.google.com]
13003 !! result
13004 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13005 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13006 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13007 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13008 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
13009 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
13010 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
13011 </p>
13012 !! end
13013
13014 !! test
13015 Do not convert roman numbers to language variants
13016 !! options
13017 language=sr variant=sr-ec
13018 !! input
13019 Fridrih IV je car.
13020 !! result
13021 <p>Фридрих IV је цар.
13022 </p>
13023 !! end
13024
13025 !! test
13026 Unclosed language converter markup "-{"
13027 !! options
13028 language=sr
13029 !! input
13030 -{T|hello
13031 !! result
13032 <p>-{T|hello
13033 </p>
13034 !! end
13035
13036 !! test
13037 Don't convert raw rule "-{R|=&gt;}-" to "=>"
13038 !! options
13039 language=sr
13040 !! input
13041 -{R|=&gt;}-
13042 !! result
13043 <p>=&gt;
13044 </p>
13045 !!end
13046
13047 !!article
13048 Template:Bullet
13049 !!text
13050 * Bar
13051 !!endarticle
13052
13053 !! test
13054 Bug 529: Uncovered bullet
13055 !! input
13056 * Foo {{bullet}}
13057 !! result
13058 <ul><li> Foo
13059 </li><li> Bar
13060 </li></ul>
13061
13062 !! end
13063
13064 # Plain MediaWiki does not remove empty lists, but tidy actually does.
13065 # Templates in Wikipedia rely on this behavior, as tidy has always been
13066 # enabled there. These tests are normally run *without* tidy, so specify the
13067 # full output here.
13068 # To test realistic parsing behavior, apply a tidy-like transformation to both
13069 # the expected output and your parser's output.
13070 !! test
13071 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
13072 !! input
13073 ******* Foo {{bullet}}
13074 !! result
13075 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
13076 </li></ul>
13077 </li></ul>
13078 </li></ul>
13079 </li></ul>
13080 </li></ul>
13081 </li></ul>
13082 </li><li> Bar
13083 </li></ul>
13084
13085 !! end
13086
13087 !! test
13088 Bug 529: Uncovered table already at line-start
13089 !! input
13090 x
13091
13092 {{table}}
13093 y
13094 !! result
13095 <p>x
13096 </p>
13097 <table>
13098 <tr>
13099 <td> 1 </td>
13100 <td> 2
13101 </td></tr>
13102 <tr>
13103 <td> 3 </td>
13104 <td> 4
13105 </td></tr></table>
13106 <p>y
13107 </p>
13108 !! end
13109
13110 !! test
13111 Bug 529: Uncovered bullet in parser function result
13112 !! input
13113 * Foo {{lc:{{bullet}} }}
13114 !! result
13115 <ul><li> Foo
13116 </li><li> bar
13117 </li></ul>
13118
13119 !! end
13120
13121 !! test
13122 Bug 5678: Double-parsed template argument
13123 !! input
13124 {{lc:{{{1}}}|hello}}
13125 !! result
13126 <p>{{{1}}}
13127 </p>
13128 !! end
13129
13130 !! test
13131 Bug 5678: Double-parsed template invocation
13132 !! input
13133 {{lc:{{paramtest {{!}} param = hello }} }}
13134 !! result
13135 <p>{{paramtest | param = hello }}
13136 </p>
13137 !! end
13138
13139 !! test
13140 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
13141 !! options
13142 language=cs
13143 title=[[Main Page]]
13144 !! input
13145 {{PRVNÍVELKÉ:ěščř}}
13146 {{prvnívelké:ěščř}}
13147 {{PRVNÍMALÉ:ěščř}}
13148 {{prvnímalé:ěščř}}
13149 {{MALÁ:ěščř}}
13150 {{malá:ěščř}}
13151 {{VELKÁ:ěščř}}
13152 {{velká:ěščř}}
13153 !! result
13154 <p>Ěščř
13155 Ěščř
13156 ěščř
13157 ěščř
13158 ěščř
13159 ěščř
13160 ĚŠČŘ
13161 ĚŠČŘ
13162 </p>
13163 !! end
13164
13165 !! test
13166 Morwen/13: Unclosed link followed by heading
13167 !! input
13168 [[link
13169 ==heading==
13170 !! result
13171 <p>[[link
13172 </p>
13173 <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>
13174
13175 !! end
13176
13177 !! test
13178 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
13179 !! input
13180 {{foo|
13181 =heading=
13182 !! result
13183 <p>{{foo|
13184 </p>
13185 <h1><span class="mw-headline" id="heading">heading</span></h1>
13186
13187 !! end
13188
13189 !! test
13190 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
13191 !! input
13192 {{foo|
13193 ==heading==
13194 !! result
13195 <p>{{foo|
13196 </p>
13197 <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>
13198
13199 !! end
13200
13201 !! test
13202 Tildes in comments
13203 !! options
13204 pst
13205 !! input
13206 <!-- ~~~~ -->
13207 !! result
13208 <!-- ~~~~ -->
13209 !! end
13210
13211 !! test
13212 Paragraphs inside divs (no extra line breaks)
13213 !! input
13214 <div>Line one
13215
13216 Line two</div>
13217 !! result
13218 <div>Line one
13219 Line two</div>
13220
13221 !! end
13222
13223 !! test
13224 Paragraphs inside divs (extra line break on open)
13225 !! input
13226 <div>
13227 Line one
13228
13229 Line two</div>
13230 !! result
13231 <div>
13232 <p>Line one
13233 </p>
13234 Line two</div>
13235
13236 !! end
13237
13238 !! test
13239 Paragraphs inside divs (extra line break on close)
13240 !! input
13241 <div>Line one
13242
13243 Line two
13244 </div>
13245 !! result
13246 <div>Line one
13247 <p>Line two
13248 </p>
13249 </div>
13250
13251 !! end
13252
13253 !! test
13254 Paragraphs inside divs (extra line break on open and close)
13255 !! input
13256 <div>
13257 Line one
13258
13259 Line two
13260 </div>
13261 !! result
13262 <div>
13263 <p>Line one
13264 </p><p>Line two
13265 </p>
13266 </div>
13267
13268 !! end
13269
13270 !! test
13271 Nesting tags, paragraphs on lines which begin with <div>
13272 !! options
13273 disabled
13274 !! input
13275 <div></div><strong>A
13276 B</strong>
13277 !! result
13278 <div></div>
13279 <p><strong>A
13280 B</strong>
13281 </p>
13282 !! end
13283
13284 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
13285 !! test
13286 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
13287 !! options
13288 disabled
13289 !! input
13290 <blockquote>Line one
13291
13292 Line two</blockquote>
13293 !! result
13294 <blockquote>Line one
13295 Line two</blockquote>
13296
13297 !! end
13298
13299 !! test
13300 Bug 6200: paragraphs inside blockquotes (extra line break on open)
13301 !! options
13302 disabled
13303 !! input
13304 <blockquote>
13305 Line one
13306
13307 Line two</blockquote>
13308 !! result
13309 <blockquote>
13310 <p>Line one
13311 </p>
13312 Line two</blockquote>
13313
13314 !! end
13315
13316 !! test
13317 Bug 6200: paragraphs inside blockquotes (extra line break on close)
13318 !! options
13319 disabled
13320 !! input
13321 <blockquote>Line one
13322
13323 Line two
13324 </blockquote>
13325 !! result
13326 <blockquote>Line one
13327 <p>Line two
13328 </p>
13329 </blockquote>
13330
13331 !! end
13332
13333 !! test
13334 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
13335 !! options
13336 disabled
13337 !! input
13338 <blockquote>
13339 Line one
13340
13341 Line two
13342 </blockquote>
13343 !! result
13344 <blockquote>
13345 <p>Line one
13346 </p><p>Line two
13347 </p>
13348 </blockquote>
13349
13350 !! end
13351
13352 !! test
13353 Paragraphs inside blockquotes/divs (no extra line breaks)
13354 !! input
13355 <blockquote><div>Line one
13356
13357 Line two</div></blockquote>
13358 !! result
13359 <blockquote><div>Line one
13360 Line two</div></blockquote>
13361
13362 !! end
13363
13364 !! test
13365 Paragraphs inside blockquotes/divs (extra line break on open)
13366 !! input
13367 <blockquote><div>
13368 Line one
13369
13370 Line two</div></blockquote>
13371 !! result
13372 <blockquote><div>
13373 <p>Line one
13374 </p>
13375 Line two</div></blockquote>
13376
13377 !! end
13378
13379 !! test
13380 Paragraphs inside blockquotes/divs (extra line break on close)
13381 !! input
13382 <blockquote><div>Line one
13383
13384 Line two
13385 </div></blockquote>
13386 !! result
13387 <blockquote><div>Line one
13388 <p>Line two
13389 </p>
13390 </div></blockquote>
13391
13392 !! end
13393
13394 !! test
13395 Paragraphs inside blockquotes/divs (extra line break on open and close)
13396 !! input
13397 <blockquote><div>
13398 Line one
13399
13400 Line two
13401 </div></blockquote>
13402 !! result
13403 <blockquote><div>
13404 <p>Line one
13405 </p><p>Line two
13406 </p>
13407 </div></blockquote>
13408
13409 !! end
13410
13411 !! test
13412 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
13413 !! options
13414 wgLinkHolderBatchSize=0
13415 !! input
13416 [[meatball:1]]
13417 [[meatball:2]]
13418 [[meatball:3]]
13419 !! result
13420 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
13421 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
13422 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
13423 </p>
13424 !! end
13425
13426 !! test
13427 Free external link invading image caption
13428 !! input
13429 [[Image:Foobar.jpg|thumb|http://x|hello]]
13430 !! result
13431 <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>
13432
13433 !! end
13434
13435 !! test
13436 Bug 15196: localised external link numbers
13437 !! options
13438 language=fa
13439 !! input
13440 [http://en.wikipedia.org/]
13441 !! result
13442 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
13443 </p>
13444 !! end
13445
13446 !! test
13447 Multibyte character in padleft
13448 !! input
13449 {{padleft:-Hello|7|Æ}}
13450 !! result
13451 <p>Æ-Hello
13452 </p>
13453 !! end
13454
13455 !! test
13456 Multibyte character in padright
13457 !! input
13458 {{padright:Hello-|7|Æ}}
13459 !! result
13460 <p>Hello-Æ
13461 </p>
13462 !! end
13463
13464 !!test
13465 formatdate parser function
13466 !!input
13467 {{#formatdate:2009-03-24}}
13468 !! result
13469 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
13470 </p>
13471 !! end
13472
13473 !!test
13474 formatdate parser function, with default format
13475 !!input
13476 {{#formatdate:2009-03-24|mdy}}
13477 !! result
13478 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
13479 </p>
13480 !! end
13481
13482 !! test
13483 Spacing of numbers in formatted dates
13484 !! input
13485 {{#formatdate:January 15}}
13486 !! result
13487 <p><span class="mw-formatted-date" title="01-15">January 15</span>
13488 </p>
13489 !! end
13490
13491 !! test
13492 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
13493 !! options
13494 language=nl title=[[MediaWiki:Common.css]]
13495 !! input
13496 {{#formatdate:2009-03-24|dmy}}
13497 !! result
13498 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
13499 </p>
13500 !! end
13501
13502 #
13503 #
13504 #
13505
13506 #
13507 # Edit comments
13508 #
13509
13510 !! test
13511 Edit comment with link
13512 !! options
13513 comment
13514 !! input
13515 I like the [[Main Page]] a lot
13516 !! result
13517 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
13518 !!end
13519
13520 !! test
13521 Edit comment with link and link text
13522 !! options
13523 comment
13524 !! input
13525 I like the [[Main Page|best pages]] a lot
13526 !! result
13527 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13528 !!end
13529
13530 !! test
13531 Edit comment with link and link text with suffix
13532 !! options
13533 comment
13534 !! input
13535 I like the [[Main Page|best page]]s a lot
13536 !! result
13537 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13538 !!end
13539
13540 !! test
13541 Edit comment with section link (non-local, eg in history list)
13542 !! options
13543 comment title=[[Main Page]]
13544 !! input
13545 /* External links */ removed bogus entries
13546 !! result
13547 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13548 !!end
13549
13550 !! test
13551 Edit comment with section link and text before it (non-local, eg in history list)
13552 !! options
13553 comment title=[[Main Page]]
13554 !! input
13555 pre-comment text /* External links */ removed bogus entries
13556 !! result
13557 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>
13558 !!end
13559
13560 !! test
13561 Edit comment with section link (local, eg in diff view)
13562 !! options
13563 comment local title=[[Main Page]]
13564 !! input
13565 /* External links */ removed bogus entries
13566 !! result
13567 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13568 !!end
13569
13570 !! test
13571 Edit comment with subpage link (bug 14080)
13572 !! options
13573 comment
13574 subpage
13575 title=[[Subpage test]]
13576 !! input
13577 Poked at a [[/subpage]] here...
13578 !! result
13579 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
13580 !!end
13581
13582 !! test
13583 Edit comment with subpage link and link text (bug 14080)
13584 !! options
13585 comment
13586 subpage
13587 title=[[Subpage test]]
13588 !! input
13589 Poked at a [[/subpage|neat little page]] here...
13590 !! result
13591 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
13592 !!end
13593
13594 !! test
13595 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
13596 !! options
13597 comment
13598 title=[[Subpage test]]
13599 !! input
13600 Poked at a [[/subpage]] here...
13601 !! result
13602 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...
13603 !!end
13604
13605 !! test
13606 Edit comment with bare anchor link (local, as on diff)
13607 !! options
13608 comment
13609 local
13610 title=[[Main Page]]
13611 !!input
13612 [[#section]]
13613 !! result
13614 <a href="#section">#section</a>
13615 !! end
13616
13617 !! test
13618 Edit comment with bare anchor link (non-local, as on history)
13619 !! options
13620 comment
13621 title=[[Main Page]]
13622 !!input
13623 [[#section]]
13624 !! result
13625 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
13626 !! end
13627
13628 !! test
13629 Anchor starting with underscore
13630 !!input
13631 [[#_ref|One]]
13632 !! result
13633 <p><a href="#_ref">One</a>
13634 </p>
13635 !! end
13636
13637 !! test
13638 Id starting with underscore
13639 !!input
13640 <div id="_ref"></div>
13641 !! result
13642 <div id="_ref"></div>
13643
13644 !! end
13645
13646 !! test
13647 Space normalisation on autocomment (bug 22784)
13648 !! options
13649 comment
13650 title=[[Main Page]]
13651 !!input
13652 /* __hello__world__ */
13653 !! result
13654 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
13655 !! end
13656
13657 !! test
13658 percent-encoding and + signs in comments (Bug 26410)
13659 !! options
13660 comment
13661 !!input
13662 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
13663 !! result
13664 <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>
13665 !! end
13666
13667 !! test
13668 Bad images - basic functionality
13669 !! options
13670 disabled
13671 !! input
13672 [[File:Bad.jpg]]
13673 !! result
13674 !! end
13675
13676 !! test
13677 Bad images - bug 16039: text after bad image disappears
13678 !! options
13679 disabled
13680 !! input
13681 Foo bar
13682 [[File:Bad.jpg]]
13683 Bar foo
13684 !! result
13685 <p>Foo bar
13686 </p><p>Bar foo
13687 </p>
13688 !! end
13689
13690 !! test
13691 Verify that displaytitle works (bug #22501) no displaytitle
13692 !! options
13693 showtitle
13694 !! config
13695 wgAllowDisplayTitle=true
13696 wgRestrictDisplayTitle=false
13697 !! input
13698 this is not the the title
13699 !! result
13700 Parser test
13701 <p>this is not the the title
13702 </p>
13703 !! end
13704
13705 !! test
13706 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
13707 !! options
13708 showtitle
13709 title=[[Screen]]
13710 !! config
13711 wgAllowDisplayTitle=true
13712 wgRestrictDisplayTitle=false
13713 !! input
13714 this is not the the title
13715 {{DISPLAYTITLE:whatever}}
13716 !! result
13717 whatever
13718 <p>this is not the the title
13719 </p>
13720 !! end
13721
13722 !! test
13723 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
13724 !! options
13725 showtitle
13726 title=[[Screen]]
13727 !! config
13728 wgAllowDisplayTitle=true
13729 wgRestrictDisplayTitle=true
13730 !! input
13731 this is not the the title
13732 {{DISPLAYTITLE:whatever}}
13733 !! result
13734 Screen
13735 <p>this is not the the title
13736 </p>
13737 !! end
13738
13739 !! test
13740 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
13741 !! options
13742 showtitle
13743 title=[[Screen]]
13744 !! config
13745 wgAllowDisplayTitle=true
13746 wgRestrictDisplayTitle=true
13747 !! input
13748 this is not the the title
13749 {{DISPLAYTITLE:screen}}
13750 !! result
13751 screen
13752 <p>this is not the the title
13753 </p>
13754 !! end
13755
13756 !! test
13757 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
13758 !! options
13759 showtitle
13760 title=[[Screen]]
13761 !! config
13762 wgAllowDisplayTitle=false
13763 !! input
13764 this is not the the title
13765 {{DISPLAYTITLE:screen}}
13766 !! result
13767 Screen
13768 <p>this is not the the title
13769 <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>
13770 </p>
13771 !! end
13772
13773 !! test
13774 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
13775 !! options
13776 showtitle
13777 title=[[Screen]]
13778 !! config
13779 wgAllowDisplayTitle=false
13780 !! input
13781 this is not the the title
13782 !! result
13783 Screen
13784 <p>this is not the the title
13785 </p>
13786 !! end
13787
13788 !! test
13789 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
13790 !! options
13791 showtitle
13792 title=[[Screen]]
13793 !! config
13794 wgAllowDisplayTitle=true
13795 wgRestrictDisplayTitle=true
13796 !! input
13797 this is not the the title
13798 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
13799 !! result
13800 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
13801 <p>this is not the the title
13802 </p>
13803 !! end
13804
13805 !! test
13806 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
13807 !! options
13808 showtitle
13809 title=[[Screen]]
13810 !! config
13811 wgAllowDisplayTitle=true
13812 wgRestrictDisplayTitle=true
13813 !! input
13814 this is not the the title
13815 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
13816 !! result
13817 <span style="color: red;">s</span>creen
13818 <p>this is not the the title
13819 </p>
13820 !! end
13821
13822 !! test
13823 preload: check <noinclude> and <includeonly>
13824 !! options
13825 preload
13826 !! input
13827 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
13828 !! result
13829 Hello kind world.
13830 !! end
13831
13832 !! test
13833 preload: check <onlyinclude>
13834 !! options
13835 preload
13836 !! input
13837 Goodbye <onlyinclude>Hello world</onlyinclude>
13838 !! result
13839 Hello world
13840 !! end
13841
13842 !! test
13843 preload: can pass tags through if we want to
13844 !! options
13845 preload
13846 !! input
13847 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
13848 !! result
13849 <includeonly>Hello world</includeonly>
13850 !! end
13851
13852 !! test
13853 preload: check that it doesn't try to do tricks
13854 !! options
13855 preload
13856 !! input
13857 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13858 !! result
13859 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13860 !! end
13861
13862 !! test
13863 Play a bit with r67090 and bug 3158
13864 !! options
13865 disabled
13866 !! input
13867 <div style="width:50% !important">&nbsp;</div>
13868 <div style="width:50%&nbsp;!important">&nbsp;</div>
13869 <div style="width:50%&#160;!important">&nbsp;</div>
13870 <div style="border : solid;">&nbsp;</div>
13871 !! result
13872 <div style="width:50% !important">&nbsp;</div>
13873 <div style="width:50% !important">&nbsp;</div>
13874 <div style="width:50% !important">&nbsp;</div>
13875 <div style="border&#160;: solid;">&nbsp;</div>
13876
13877 !! end
13878
13879 !! test
13880 HTML5 data attributes
13881 !! input
13882 <span data-foo="bar">Baz</span>
13883 <p data-abc-def_hij="">Quuz</p>
13884 !! result
13885 <p><span data-foo="bar">Baz</span>
13886 </p>
13887 <p data-abc-def_hij="">Quuz</p>
13888
13889 !! end
13890
13891 !! test
13892 percent-encoding and + signs in internal links (Bug 26410)
13893 !! input
13894 [[User:+%]] [[Page+title%]]
13895 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
13896 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
13897 [[%33%45]] [[%33%45+]]
13898 !! result
13899 <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>
13900 <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>
13901 <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>
13902 <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>
13903 </p>
13904 !! end
13905
13906 !! test
13907 Special characters in embedded file links (bug 27679)
13908 !! input
13909 [[File:Contains & ampersand.jpg]]
13910 [[File:Does not exist.jpg|Title with & ampersand]]
13911 !! result
13912 <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>
13913 <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>
13914 </p>
13915 !! end
13916
13917
13918 !! test
13919 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
13920 !! input
13921 Text&apos;s been normalized?
13922 !! result
13923 <p>Text&#39;s been normalized?
13924 </p>
13925 !! end
13926
13927 !! test
13928 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
13929 !! input
13930 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
13931 !! result
13932 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
13933 </p>
13934 !! end
13935
13936 !! test
13937 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
13938 !! input
13939 [http://www.example.org/ ideograms]
13940 !! result
13941 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
13942 </p>
13943 !! end
13944
13945 !! test
13946 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
13947 !! input
13948 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
13949 !! result
13950 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
13951 </p>
13952 !! end
13953
13954 !! article
13955 Mediawiki:loop1
13956 !! text
13957 {{Identical|A}}
13958 !! endarticle
13959
13960 !! article
13961 Mediawiki:loop2
13962 !! text
13963 {{Identical|B}}
13964 !! endarticle
13965
13966 !! article
13967 Template:Identical
13968 !! text
13969 {{int:loop1}}
13970 {{int:loop2}}
13971 !! endarticle
13972
13973 !! test
13974 Bug 31098 Template which includes system messages which includes the template
13975 !! input
13976 {{Identical}}
13977 !! result
13978 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13979 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13980 </p>
13981 !! end
13982
13983 !! test
13984 Bug31490 Turkish: ucfirst 'blah'
13985 !! options
13986 language=tr
13987 !! input
13988 {{ucfirst:blah}}
13989 !! result
13990 <p>Blah
13991 </p>
13992 !! end
13993
13994 !! test
13995 Bug31490 Turkish: ucfirst 'ix'
13996 !! options
13997 language=tr
13998 !! input
13999 {{ucfirst:ix}}
14000 !! result
14001 <p>İx
14002 </p>
14003 !! end
14004
14005 !! test
14006 Bug31490 Turkish: lcfirst 'BLAH'
14007 !! options
14008 language=tr
14009 !! input
14010 {{lcfirst:BLAH}}
14011 !! result
14012 <p>bLAH
14013 </p>
14014 !! end
14015
14016 !! test
14017 Bug31490 Turkish: ucfırst (with a dotless i)
14018 !! options
14019 language=tr
14020 !! input
14021 {{ucfırst:blah}}
14022 !! result
14023 <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>
14024 </p>
14025 !! end
14026
14027 !! test
14028 Bug31490 ucfırst (with a dotless i) with English language
14029 !! options
14030 language=en
14031 !! input
14032 {{ucfırst:blah}}
14033 !! result
14034 <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>
14035 </p>
14036 !! end
14037
14038 !! test
14039 Bug 26375: TOC with italics
14040 !! options
14041 title=[[Main Page]]
14042 !! input
14043 __TOC__
14044 == ''Lost'' episodes ==
14045 !! result
14046 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14047 <ul>
14048 <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>
14049 </ul>
14050 </div>
14051 <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>
14052
14053 !! end
14054
14055 !! test
14056 Bug 26375: TOC with bold
14057 !! options
14058 title=[[Main Page]]
14059 !! input
14060 __TOC__
14061 == '''should be bold''' then normal text ==
14062 !! result
14063 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14064 <ul>
14065 <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>
14066 </ul>
14067 </div>
14068 <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>
14069
14070 !! end
14071
14072 !! test
14073 Bug 33845: Headings become cursive in TOC when they contain an image
14074 !! options
14075 title=[[Main Page]]
14076 !! input
14077 __TOC__
14078 == Image [[Image:foobar.jpg]] ==
14079 !! result
14080 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14081 <ul>
14082 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
14083 </ul>
14084 </div>
14085 <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>
14086
14087 !! end
14088
14089 !! test
14090 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
14091 !! options
14092 title=[[Main Page]]
14093 !! input
14094 __TOC__
14095 == <blockquote>Quote</blockquote> ==
14096 !! result
14097 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14098 <ul>
14099 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
14100 </ul>
14101 </div>
14102 <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>
14103
14104 !! end
14105
14106 !! test
14107 Unclosed tags in TOC
14108 !! options
14109 title=[[Main Page]]
14110 !! input
14111 __TOC__
14112 == Proof: 2 < 3 ==
14113 <small>Hanc marginis exiguitas non caperet.</small>
14114 QED
14115 !! result
14116 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14117 <ul>
14118 <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>
14119 </ul>
14120 </div>
14121 <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>
14122 <p><small>Hanc marginis exiguitas non caperet.</small>
14123 QED
14124 </p>
14125 !! end
14126
14127 !! test
14128 Multiple tags in TOC
14129 !! input
14130 __TOC__
14131 == <i>Foo</i> <b>Bar</b> ==
14132
14133 == <i>Foo</i> <blockquote>Bar</blockquote> ==
14134 !! result
14135 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14136 <ul>
14137 <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>
14138 <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>
14139 </ul>
14140 </div>
14141 <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>
14142 <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>
14143
14144 !! end
14145
14146 !! test
14147 Tags with parameters in TOC
14148 !! input
14149 __TOC__
14150 == <sup class="in-h2">Hello</sup> ==
14151
14152 == <sup class="a > b">Evilbye</sup> ==
14153 !! result
14154 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14155 <ul>
14156 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
14157 <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>
14158 </ul>
14159 </div>
14160 <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>
14161 <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>
14162
14163 !! end
14164
14165 !! test
14166 span tags with directionality in TOC
14167 !! input
14168 __TOC__
14169 == <span dir="ltr">C++</span> ==
14170
14171 == <span dir="rtl">זבנג!</span> ==
14172
14173 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
14174
14175 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
14176
14177 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
14178 !! result
14179 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14180 <ul>
14181 <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>
14182 <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>
14183 <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>
14184 <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>
14185 <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>
14186 </ul>
14187 </div>
14188 <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>
14189 <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>
14190 <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>
14191 <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>
14192 <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>
14193
14194 !! end
14195
14196 !! article
14197 MediaWiki:Bug32057
14198 !! text
14199 == {{int:headline_sample}} ==
14200 !! endarticle
14201
14202 !! test
14203 Bug 32057: Title needed when expanding <h> nodes.
14204 !! options
14205 title=[[Main Page]]
14206 !! input
14207 {{int:Bug32057}}
14208 !! result
14209 <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>
14210
14211 !! end
14212
14213 !! test
14214 Strip marker in urlencode
14215 !! input
14216 {{urlencode:x<nowiki/>y}}
14217 {{urlencode:x<nowiki/>y|wiki}}
14218 {{urlencode:x<nowiki/>y|path}}
14219 !! result
14220 <p>xy
14221 xy
14222 xy
14223 </p>
14224 !! end
14225
14226 !! test
14227 Strip marker in lc
14228 !! input
14229 {{lc:x<nowiki/>y}}
14230 !! result
14231 <p>xy
14232 </p>
14233 !! end
14234
14235 !! test
14236 Strip marker in uc
14237 !! input
14238 {{uc:x<nowiki/>y}}
14239 !! result
14240 <p>XY
14241 </p>
14242 !! end
14243
14244 !! test
14245 Strip marker in formatNum
14246 !! input
14247 {{formatnum:1<nowiki/>2}}
14248 {{formatnum:1<nowiki/>2|R}}
14249 !! result
14250 <p>12
14251 12
14252 </p>
14253 !! end
14254
14255 !! test
14256 Check noCommafy in formatNum
14257 !! options
14258 language=be-tarask
14259 !! input
14260 {{formatnum:123456.78}}
14261 {{formatnum:123456.78|NOSEP}}
14262 !! result
14263 <p>123 456,78
14264 123456.78
14265 </p>
14266 !! end
14267
14268 !! test
14269 Strip marker in grammar
14270 !! options
14271 language=fi
14272 !! input
14273 {{grammar:elative|foo<nowiki/>bar}}
14274 !! result
14275 <p>foobarista
14276 </p>
14277 !! end
14278
14279 !! test
14280 Strip marker in padleft
14281 !! input
14282 {{padleft:|2|x<nowiki/>y}}
14283 !! result
14284 <p>xy
14285 </p>
14286 !! end
14287
14288 !! test
14289 Strip marker in padright
14290 !! input
14291 {{padright:|2|x<nowiki/>y}}
14292 !! result
14293 <p>xy
14294 </p>
14295 !! end
14296
14297 !! test
14298 Strip marker in anchorencode
14299 !! input
14300 {{anchorencode:x<nowiki/>y}}
14301 !! result
14302 <p>xy
14303 </p>
14304 !! end
14305
14306 !! test
14307 nowiki inside link inside heading (bug 18295)
14308 !! input
14309 ==[[foo|x<nowiki>y</nowiki>z]]==
14310 !! result
14311 <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>
14312
14313 !! end
14314
14315 !! test
14316 new support for bdi element (bug 31817)
14317 !! input
14318 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14319 !! result
14320 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14321
14322 !!end
14323
14324 !! test
14325 Ignore pipe between table row attributes
14326 !! input
14327 {|
14328 | quux
14329 |- id=foo | style='color: red'
14330 | bar
14331 |}
14332 !! result
14333 <table>
14334 <tr>
14335 <td> quux
14336 </td></tr>
14337 <tr id="foo" style="color: red">
14338 <td> bar
14339 </td></tr></table>
14340
14341 !! end
14342
14343 !!test
14344 Gallery override link with WikiLink (bug 34852)
14345 !! input
14346 <gallery>
14347 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
14348 </gallery>
14349 !! result
14350 <ul class="gallery">
14351 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14352 <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>
14353 <div class="gallerytext">
14354 <p>caption
14355 </p>
14356 </div>
14357 </div></li>
14358 </ul>
14359
14360 !! end
14361
14362 !!test
14363 Gallery override link with absolute external link (bug 34852)
14364 !! input
14365 <gallery>
14366 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
14367 </gallery>
14368 !! result
14369 <ul class="gallery">
14370 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14371 <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>
14372 <div class="gallerytext">
14373 <p>caption
14374 </p>
14375 </div>
14376 </div></li>
14377 </ul>
14378
14379 !! end
14380
14381 !!test
14382 Gallery override link with malicious javascript (bug 34852)
14383 !! input
14384 <gallery>
14385 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
14386 </gallery>
14387 !! result
14388 <ul class="gallery">
14389 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14390 <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>
14391 <div class="gallerytext">
14392 <p>caption
14393 </p>
14394 </div>
14395 </div></li>
14396 </ul>
14397
14398 !! end
14399
14400 !!test
14401 Gallery with invalid title as link (bug 43964)
14402 !! input
14403 <gallery>
14404 File:foobar.jpg|link=<
14405 </gallery>
14406 !! result
14407 <ul class="gallery">
14408 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14409 <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>
14410 <div class="gallerytext">
14411 </div>
14412 </div></li>
14413 </ul>
14414
14415 !! end
14416
14417 !!test
14418 Language parser function
14419 !! input
14420 {{#language:ar}}
14421 !! result
14422 <p>العربية
14423 </p>
14424 !! end
14425
14426 !!test
14427 Padleft and padright as substr
14428 !! input
14429 {{padleft:|3|abcde}}
14430 {{padright:|3|abcde}}
14431 !! result
14432 <p>abc
14433 abc
14434 </p>
14435 !! end
14436
14437 !!test
14438 Special parser function
14439 !! input
14440 {{#special:RandomPage}}
14441 {{#special:BaDtItLe}}
14442 {{#special:Foobar}}
14443 !! result
14444 <p>Special:Random
14445 Special:Badtitle
14446 Special:Foobar
14447 </p>
14448 !! end
14449
14450 !!test
14451 Bug 34939 - Case insensitive link parsing ([HttP://])
14452 !! input
14453 [HttP://MediaWiki.Org/]
14454 !! result
14455 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
14456 </p>
14457 !! end
14458
14459 !!test
14460 Bug 34939 - Case insensitive link parsing ([HttP:// title])
14461 !! input
14462 [HttP://MediaWiki.Org/ MediaWiki]
14463 !! result
14464 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
14465 </p>
14466 !! end
14467
14468 !!test
14469 Bug 34939 - Case insensitive link parsing (HttP://)
14470 !! input
14471 HttP://MediaWiki.Org/
14472 !! result
14473 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
14474 </p>
14475 !! end
14476
14477
14478 ###
14479 ### Parsoids-specific tests
14480 ### Parsoid-PHP parser incompatibilities
14481 ###
14482 !!test
14483 1. SOL-sensitive wikitext tokens as template-args
14484 !!options
14485 parsoid=wt2html,wt2wt
14486 !!input
14487 {{echo|*a}}
14488 {{echo|#a}}
14489 {{echo|:a}}
14490 !!result
14491 <span about="#mwt1" typeof="mw:Transclusion">
14492 </span><ul about="#mwt1"><li>a</li></ul>
14493 <span about="#mwt2" typeof="mw:Transclusion">
14494 </span><ol about="#mwt2"><li>a</li></ol>
14495 <span about="#mwt3" typeof="mw:Transclusion">
14496 </span><dl about="#mwt3"><dd>a</dd></dl>
14497 !!end
14498
14499 #### ----------------------------------------------------------------
14500 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
14501 #### tags. Parsoid's output for these tags differs from that of the
14502 #### PHP parser.
14503 #### ----------------------------------------------------------------
14504
14505 !!test
14506 Ref: 1. ref-location should be replaced with an index span
14507 !!options
14508 parsoid
14509 !!input
14510 A <ref>foo</ref>
14511 B <ref name="x">foo</ref>
14512 C <ref name="y" />
14513 !!result
14514 <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>
14515 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>
14516 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>
14517 !!end
14518
14519 !!test
14520 Ref: 2. ref-tags with identical names should all get the same index
14521 !!options
14522 parsoid
14523 !!input
14524 A <ref name="x">foo</ref>
14525 B <ref name="x" />
14526 !!result
14527 <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>
14528 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>
14529 !!end
14530
14531 !!test
14532 Ref: 3. spaces in ref-names should be ignored
14533 !!options
14534 parsoid
14535 !!input
14536 A <ref name="x">foo</ref>
14537 B <ref name=" x " />
14538 C <ref name= x />
14539 !!result
14540 <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>
14541 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>
14542 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>
14543 !!end
14544
14545 !!test
14546 Ref: 4. 'constructor' should be accepted as a valid ref-name
14547 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
14548 !!options
14549 parsoid
14550 !!input
14551 A <ref name="constructor">foo</ref>
14552 !!result
14553 <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>
14554 !!end
14555
14556 !!test
14557 Ref: 5. body should accept generic wikitext
14558 !!options
14559 parsoid
14560 !!input
14561 A <ref>
14562 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
14563 </ref>
14564
14565 <references />
14566 !!result
14567 <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>
14568
14569 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14570 <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>
14571 </li></ol>
14572 !!end
14573
14574 !!test
14575 Ref: 6. indent-pres should not be output in ref-body
14576 !!options
14577 parsoid
14578 !!input
14579 A <ref>
14580 foo
14581 bar
14582 baz
14583 </ref>
14584
14585 <references />
14586 !!result
14587 <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>
14588
14589 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14590 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
14591 bar
14592 baz
14593 </li></ol>
14594 !!end
14595
14596 !!test
14597 Ref: 6. No p-wrapping in ref-body
14598 !!options
14599 parsoid
14600 !!input
14601 A <ref>
14602 foo
14603
14604 bar
14605
14606
14607 baz
14608
14609
14610
14611 booz
14612 </ref>
14613
14614 <references />
14615 !!result
14616 <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>
14617
14618 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14619 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
14620
14621 bar
14622
14623
14624 baz
14625
14626
14627
14628 booz
14629 </li></ol>
14630 !!end
14631
14632 !!test
14633 Ref: 8. transclusion wikitext has lower precedence
14634 !!options
14635 parsoid
14636 !!input
14637 A <ref> foo {{echo|</ref> B C}}
14638
14639 <references />
14640 !!result
14641 <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>
14642
14643 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14644 <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>
14645 !!end
14646
14647 !!test
14648 Ref: 9. unclosed comments should not leak out of ref-body
14649 !!options
14650 parsoid
14651 !!input
14652 A <ref> foo <!--</ref> B C
14653
14654 <references />
14655 !!result
14656 <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>
14657
14658 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14659 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li></ol>
14660 !!end
14661
14662 !!test
14663 Ref: 10. Unclosed HTML tags should not leak out of ref-body
14664 !!options
14665 parsoid
14666 !!input
14667 A <ref> <b> foo </ref> B C
14668
14669 <references />
14670 !!result
14671 <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>
14672
14673 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14674 <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>
14675 !!end
14676
14677 !!test
14678 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
14679 !!options
14680 parsoid
14681 !!input
14682 A <ref>foo</ref> B
14683 C <ref>bar</ref> D
14684 !!result
14685 <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
14686 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>
14687 !!end
14688
14689 !!test
14690 Ref: 12. ref-tags act as trailing newline migration barrier
14691 !!options
14692 parsoid
14693 !!input
14694 <!--the newline at the end of this line moves out of the p-tag-->a
14695
14696 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
14697 <ref />
14698
14699 c
14700 !!result
14701 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
14702
14703
14704 <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>
14705 <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>
14706
14707
14708 <p>c</p>
14709 !!end
14710
14711 !!test
14712 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
14713 !!options
14714 parsoid
14715 !!input
14716 <ref>foo</ref> A
14717 <ref>bar
14718 </ref> B
14719 !!result
14720 <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
14721 <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>
14722 !!end
14723
14724 !!test
14725 Ref: 14. A nested ref-tag should be emitted as plain text
14726 !!options
14727 parsoid
14728 !!input
14729 <ref>foo <ref>bar</ref> baz</ref>
14730
14731 <references />
14732 !!result
14733 <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>
14734
14735 <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>
14736 !!end
14737
14738 !!test
14739 Ref: 15. ref-tags with identical names should get identical indexes
14740 !!options
14741 parsoid
14742 !!input
14743 A1 <ref name="a">foo</ref> A2 <ref name="a" />
14744 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
14745
14746 <references />
14747 !!result
14748 <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>
14749 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>
14750
14751 <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>
14752 !!end
14753
14754 !!test
14755 References: 1. references tag without any refs should be handled properly
14756 !!options
14757 parsoid
14758 !!input
14759 <references />
14760 !!result
14761 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"></ol>
14762 !!end
14763
14764 !!test
14765 References: 2. references tag with group only outputs references from that group
14766 !!options
14767 parsoid
14768 !!input
14769 A <ref group="a">foo</ref>
14770 B <ref group="b">bar</ref>
14771
14772 <references group='a' />
14773 !!result
14774 <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>
14775 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>
14776
14777 <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>
14778 !!end
14779
14780 !!test
14781 References: 3. ref list should be cleared after processing references
14782 !!options
14783 parsoid
14784 !!input
14785 A <ref>foo</ref>
14786
14787 <references />
14788
14789 B <ref>bar</ref>
14790
14791 <references />
14792 !!result
14793 <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>
14794
14795 <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>
14796
14797 <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>
14798
14799 <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>
14800 !!end
14801
14802 !!test
14803 References: 4. only referenced group should be cleared after processing references
14804 !!options
14805 parsoid
14806 !!input
14807 A <ref group="a">afoo</ref>
14808 B <ref>bfoo</ref>
14809
14810 <references group="a"/>
14811
14812 C <ref>cfoo</ref>
14813
14814 <references />
14815 !!result
14816 <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>
14817 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>
14818
14819 <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>
14820
14821 <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>
14822
14823 <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>
14824 !!end
14825
14826 !!test
14827 References: 5. ref tags in references should be processed while ignoring all other content
14828 !!options
14829 parsoid
14830 !!input
14831 A <ref name="a" />
14832 B <ref name="b">bar</ref>
14833
14834 <references>
14835 <ref name="a">foo</ref>
14836 This should just get lost.
14837 </references>
14838 !!result
14839 <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>
14840 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>
14841
14842 <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>
14843 !!end
14844
14845 !!test
14846 References: 6. <references /> from a transclusion
14847 !!options
14848 parsoid
14849 !!input
14850 {{echo|<references />}}
14851 !!result
14852 <ol class="references" about="#mwt2" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<references />"}},"i":0}'></ol>
14853 !!end
14854
14855 #### ----------------------------------------------------------------
14856 #### The following section of tests are primarily to test
14857 #### wikitext escaping capabilities of Parsoid. Given that
14858 #### escaping can be done any number of ways, the wikitext (input)
14859 #### is always adjusted to reflect how Parsoid adds nowiki
14860 #### escape tags.
14861 ####
14862 #### We are marking several tests as parsoid-only since the
14863 #### HTML in the result section is different from what the
14864 #### PHP parser generates for it.
14865 #### ----------------------------------------------------------------
14866
14867
14868 #### --------------- Headings ---------------
14869 #### 0. Unnested
14870 #### 1. Nested inside html <h1>=foo=</h1>
14871 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
14872 #### 3. Nested inside html with wikitext split by html tags
14873 #### 4. No escape needed
14874 #### 5. Empty headings <h1></h1>
14875 #### 6. Heading chars in SOL context
14876 #### ----------------------------------------
14877 !! test
14878 Headings: 0. Unnested
14879 !! options
14880 parsoid
14881 !! input
14882 <nowiki>=foo=</nowiki>
14883
14884 <nowiki> =foo= </nowiki>
14885 <!--cmt-->
14886 <nowiki>=foo=</nowiki>
14887
14888 =foo''a''<nowiki>=</nowiki>
14889 !! result
14890 <p><span typeof="mw:Nowiki">=foo=</span></p>
14891
14892 <p><span typeof="mw:Nowiki"> =foo= </span>
14893 <!--cmt-->
14894 <span typeof="mw:Nowiki">=foo=</span></p>
14895
14896 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
14897 !!end
14898
14899 !! test
14900 Headings: 1. Nested inside html
14901 !! options
14902 parsoid
14903 !! input
14904 =<nowiki>=foo=</nowiki>=
14905
14906 ==<nowiki>=foo=</nowiki>==
14907
14908 ===<nowiki>=foo=</nowiki>===
14909
14910 ====<nowiki>=foo=</nowiki>====
14911
14912 =====<nowiki>=foo=</nowiki>=====
14913
14914 ======<nowiki>=foo=</nowiki>======
14915 !! result
14916 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
14917 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
14918 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
14919 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
14920 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
14921 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
14922 !!end
14923
14924 !! test
14925 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
14926 !! options
14927 parsoid
14928 !! input
14929 =foo=
14930 <nowiki>*bar</nowiki>
14931
14932 =foo=
14933 =bar
14934
14935 =foo=
14936 <nowiki>=bar=</nowiki>
14937 !! result
14938 <h1>foo</h1>*bar
14939 <h1>foo</h1>=bar
14940 <h1>foo</h1>=bar=
14941 !!end
14942
14943 !! test
14944 Headings: 3. Nested inside html with wikitext split by html tags
14945 !! options
14946 parsoid
14947 !! input
14948 =='''bold'''<nowiki>foo=</nowiki>=
14949 !! result
14950 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
14951 !!end
14952
14953 !! test
14954 Headings: 4a. No escaping needed (testing just h1 and h2)
14955 !! options
14956 parsoid
14957 !! input
14958 ==foo=
14959
14960 =foo==
14961
14962 = =foo= =
14963
14964 ==foo= bar=
14965
14966 ===foo==
14967
14968 ==foo===
14969
14970 =''=''foo==
14971
14972 =<nowiki>=</nowiki>=
14973 !! result
14974 <h1>=foo</h1>
14975 <h1>foo=</h1>
14976 <h1> =foo= </h1>
14977 <h1>=foo= bar</h1>
14978 <h2>=foo</h2>
14979 <h2>foo=</h2>
14980 <h1><i>=</i>foo=</h1>
14981 <h1><span typeof="mw:Nowiki">=</span></h1>
14982 !!end
14983
14984 !! test
14985 Headings: 4b. No escaping needed (inside p-tags)
14986 !! options
14987 parsoid
14988 !! input
14989 ===
14990 =foo= x
14991 =foo= <s></s>
14992 !! result
14993 <p>===
14994 =foo= x
14995 =foo= <s></s>
14996 </p>
14997 !!end
14998
14999 !! test
15000 Headings: 5. Empty headings
15001 !! options
15002 parsoid
15003 !! input
15004 =<nowiki/>=
15005
15006 ==<nowiki/>==
15007
15008 ===<nowiki/>===
15009
15010 ====<nowiki/>====
15011
15012 =====<nowiki/>=====
15013
15014 ======<nowiki/>======
15015 !! result
15016 <h1></h1>
15017 <h2></h2>
15018 <h3></h3>
15019 <h4></h4>
15020 <h5></h5>
15021 <h6></h6>
15022 !!end
15023
15024 !! test
15025 Headings: 6a. Heading chars in SOL context (with trailing spaces)
15026 !! options
15027 parsoid
15028 !! input
15029 <nowiki>=a=</nowiki>
15030
15031 <nowiki>=a= </nowiki>
15032
15033 <nowiki>=a= </nowiki>
15034
15035 <nowiki>=a= </nowiki>
15036 !! result
15037 <p>=a=</p>
15038 <p>=a= </p>
15039 <p>=a= </p>
15040 <p>=a= </p>
15041 !!end
15042
15043 !! test
15044 Headings: 6b. Heading chars in SOL context (with trailing newlines)
15045 !! options
15046 parsoid
15047 !! input
15048 <nowiki>=a=
15049 b</nowiki>
15050
15051 <nowiki>=a=
15052 b</nowiki>
15053
15054 <nowiki>=a=
15055 b</nowiki>
15056
15057 <nowiki>=a=
15058 b</nowiki>
15059 !! result
15060 <p>=a=
15061 b</p>
15062 <p>=a=
15063 b</p>
15064 <p>=a=
15065 b</p>
15066 <p>=a=
15067 b</p>
15068 </p>
15069 !!end
15070
15071 !! test
15072 Headings: 6c. Heading chars in SOL context (leading newline break)
15073 !! options
15074 parsoid
15075 !! input
15076 <nowiki>a
15077 =b=</nowiki>
15078 !! result
15079 <p>a
15080 =b=</p>
15081 !!end
15082
15083 !! test
15084 Headings: 6d. Heading chars in SOL context (with interspersed comments)
15085 !! options
15086 parsoid
15087 !! input
15088 <!--c0--><nowiki>=a=</nowiki>
15089 <!--c1-->
15090 <nowiki>=a= </nowiki><!--c2--> <!--c3-->
15091 !! result
15092 <p><!--c0-->=a=</p>
15093 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
15094 !!end
15095
15096 !! test
15097 Headings: 6d. Heading chars in SOL context (No escaping needed)
15098 !! options
15099 parsoid=html2wt
15100 !! input
15101 =a=<div>b</div>
15102 !! result
15103 =a=<div>b</div>
15104 !!end
15105
15106 #### --------------- Lists ---------------
15107 #### 0. Outside nests (*foo, etc.)
15108 #### 1. Nested inside html <ul><li>*foo</li></ul>
15109 #### 2. Inside definition lists
15110 #### 3. Only bullets at start should be escaped
15111 #### 4. No escapes needed
15112 #### 5. No unnecessary escapes
15113 #### 6. Escape bullets in SOL position
15114 #### 7. Escape bullets in a multi-line context
15115 #### ----------------------------------------
15116
15117 !! test
15118 Lists: 0. Outside nests
15119 !! input
15120 <nowiki>*foo</nowiki>
15121
15122 <nowiki>#foo</nowiki>
15123 !! result
15124 <p>*foo
15125 </p><p>#foo
15126 </p>
15127 !!end
15128
15129 !! test
15130 Lists: 1. Nested inside html
15131 !! input
15132 *<nowiki>*foo</nowiki>
15133
15134 *<nowiki>#foo</nowiki>
15135
15136 *<nowiki>:foo</nowiki>
15137
15138 *<nowiki>;foo</nowiki>
15139
15140 #<nowiki>*foo</nowiki>
15141
15142 #<nowiki>#foo</nowiki>
15143
15144 #<nowiki>:foo</nowiki>
15145
15146 #<nowiki>;foo</nowiki>
15147 !! result
15148 <ul><li>*foo
15149 </li></ul>
15150 <ul><li>#foo
15151 </li></ul>
15152 <ul><li>:foo
15153 </li></ul>
15154 <ul><li>;foo
15155 </li></ul>
15156 <ol><li>*foo
15157 </li></ol>
15158 <ol><li>#foo
15159 </li></ol>
15160 <ol><li>:foo
15161 </li></ol>
15162 <ol><li>;foo
15163 </li></ol>
15164
15165 !!end
15166
15167 !! test
15168 Lists: 2. Inside definition lists
15169 !! input
15170 ;<nowiki>;foo</nowiki>
15171
15172 ;<nowiki>:foo</nowiki>
15173
15174 ;<nowiki>:foo</nowiki>
15175 :bar
15176
15177 :<nowiki>:foo</nowiki>
15178 !! result
15179 <dl><dt>;foo
15180 </dt></dl>
15181 <dl><dt>:foo
15182 </dt></dl>
15183 <dl><dt>:foo
15184 </dt><dd>bar
15185 </dd></dl>
15186 <dl><dd>:foo
15187 </dd></dl>
15188
15189 !!end
15190
15191 !! test
15192 Lists: 3. Only bullets at start of text should be escaped
15193 !! input
15194 *<nowiki>*foo*bar</nowiki>
15195
15196 *<nowiki>*foo</nowiki>''it''*bar
15197 !! result
15198 <ul><li>*foo*bar
15199 </li></ul>
15200 <ul><li>*foo<i>it</i>*bar
15201 </li></ul>
15202
15203 !!end
15204
15205 !! test
15206 Lists: 4. No escapes needed
15207 !! options
15208 parsoid
15209 !! input
15210 *foo*bar
15211
15212 *''foo''*bar
15213
15214 *[[Foo]]: bar
15215 !! result
15216 <ul><li>foo*bar
15217 </li></ul>
15218 <ul><li><i>foo</i>*bar
15219 </li></ul>
15220 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
15221 </li></ul>
15222 !!end
15223
15224 !! test
15225 Lists: 5. No unnecessary escapes
15226 !! input
15227 * bar <span><nowiki>[[foo]]</nowiki></span>
15228
15229 *=bar <span><nowiki>[[foo]]</nowiki></span>
15230
15231 *[[bar <span><nowiki>[[foo]]</nowiki></span>
15232
15233 *]]bar <span><nowiki>[[foo]]</nowiki></span>
15234
15235 *=bar <span>foo]]</span>=
15236
15237 * <s></s>: a
15238 !! result
15239 <ul><li> bar <span>[[foo]]</span>
15240 </li></ul>
15241 <ul><li>=bar <span>[[foo]]</span>
15242 </li></ul>
15243 <ul><li>[[bar <span>[[foo]]</span>
15244 </li></ul>
15245 <ul><li>]]bar <span>[[foo]]</span>
15246 </li></ul>
15247 <ul><li>=bar <span>foo]]</span>=
15248 </li></ul>
15249 <ul><li> <s></s>: a
15250 </li></ul>
15251
15252 !!end
15253
15254 !! test
15255 Lists: 6. Escape bullets in SOL position
15256 !! options
15257 parsoid
15258 !! input
15259 <!--cmt--><nowiki>*foo</nowiki>
15260 !! result
15261 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
15262 !!end
15263
15264 !! test
15265 Lists: 7. Escape bullets in a multi-line context
15266 !! input
15267 <nowiki>a
15268 *b</nowiki>
15269 !! result
15270 <p>a
15271 *b
15272 </p>
15273 !!end
15274
15275 #### --------------- HRs ---------------
15276 #### 1. Single line
15277 #### -----------------------------------
15278
15279 !! test
15280 HRs: 1. Single line
15281 !! options
15282 parsoid
15283 !! input
15284 ----<nowiki>----</nowiki>
15285 ----=foo=
15286 ----*foo
15287 !! result
15288 <hr><span typeof="mw:Nowiki">----</span>
15289 <hr>=foo=
15290 <hr>*foo
15291 !! end
15292
15293 #### --------------- Tables ---------------
15294 #### 1a. Simple example
15295 #### 1b. No escaping needed (!foo)
15296 #### 1c. No escaping needed (|foo)
15297 #### 1d. No escaping needed (|}foo)
15298 ####
15299 #### 2a. Nested in td (<td>foo|bar</td>)
15300 #### 2b. Nested in td (<td>foo||bar</td>)
15301 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
15302 ####
15303 #### 3a. Nested in th (<th>foo!bar</th>)
15304 #### 3b. Nested in th (<th>foo!!bar</th>)
15305 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
15306 ####
15307 #### 4a. Escape -
15308 #### 4b. Escape +
15309 #### 4c. No escaping needed
15310 #### --------------------------------------
15311
15312 !! test
15313 Tables: 1a. Simple example
15314 !! input
15315 <nowiki>{|
15316 |}</nowiki>
15317 !! result
15318 <p>{|
15319 |}
15320 </p>
15321 !! end
15322
15323 !! test
15324 Tables: 1b. No escaping needed
15325 !! input
15326 !foo
15327 !! result
15328 <p>!foo
15329 </p>
15330 !! end
15331
15332 !! test
15333 Tables: 1c. No escaping needed
15334 !! input
15335 |foo
15336 !! result
15337 <p>|foo
15338 </p>
15339 !! end
15340
15341 !! test
15342 Tables: 1d. No escaping needed
15343 !! input
15344 |}foo
15345 !! result
15346 <p>|}foo
15347 </p>
15348 !! end
15349
15350 !! test
15351 Tables: 2a. Nested in td
15352 !! options
15353 parsoid
15354 !! input
15355 {|
15356 |<nowiki>foo|bar</nowiki>
15357 |}
15358 !! result
15359 <table><tbody><tr>
15360 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
15361 !! end
15362
15363 !! test
15364 Tables: 2b. Nested in td
15365 !! options
15366 parsoid
15367 !! input
15368 {|
15369 |<nowiki>foo||bar</nowiki>
15370 |''it''<nowiki>foo||bar</nowiki>
15371 |}
15372 !! result
15373 <table><tbody><tr>
15374 <td><span typeof="mw:Nowiki">foo||bar</span></td>
15375 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
15376 !! end
15377
15378 !! test
15379 Tables: 2c. Nested in td -- no escaping needed
15380 !! options
15381 parsoid
15382 !! input
15383 {|
15384 |foo!!bar
15385 |}
15386 !! result
15387 <table><tbody><tr><td>foo!!bar
15388 </td></tr></tbody></table>
15389
15390 !! end
15391
15392 !! test
15393 Tables: 3a. Nested in th
15394 !! options
15395 parsoid
15396 !! input
15397 {|
15398 !foo!bar
15399 |}
15400 !! result
15401 <table><tbody><tr><th>foo!bar
15402 </th></tr></tbody></table>
15403
15404 !! end
15405
15406 !! test
15407 Tables: 3b. Nested in th
15408 !! options
15409 parsoid
15410 !! input
15411 {|
15412 !<nowiki>foo!!bar</nowiki>
15413 |}
15414 !! result
15415 <table>
15416 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
15417 </tbody></table>
15418 !! end
15419
15420 !! test
15421 Tables: 3c. Nested in th -- no escaping needed
15422 !! options
15423 parsoid
15424 !! input
15425 {|
15426 !<nowiki>foo||bar</nowiki>
15427 |}
15428 !! result
15429 <table><tbody><tr>
15430 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
15431 !! end
15432
15433 !! test
15434 Tables: 4a. Escape -
15435 !! options
15436 parsoid
15437 !! input
15438 {|
15439 |-
15440 !-bar
15441 |-
15442 |<nowiki>-bar</nowiki>
15443 |}
15444 !! result
15445 <table><tbody>
15446 <tr><th>-bar</th></tr>
15447 <tr>
15448 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
15449 !! end
15450
15451 !! test
15452 Tables: 4b. Escape +
15453 !! options
15454 parsoid
15455 !! input
15456 {|
15457 |-
15458 !+bar
15459 |-
15460 |<nowiki>+bar</nowiki>
15461 |}
15462 !! result
15463 <table><tbody>
15464 <tr><th>+bar</th></tr>
15465 <tr>
15466 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
15467 !! end
15468
15469 !! test
15470 Tables: 4c. No escaping needed
15471 !! options
15472 parsoid
15473 !! input
15474 {|
15475 |-
15476 |foo-bar
15477 |foo+bar
15478 |-
15479 |''foo''-bar
15480 |''foo''+bar
15481 |}
15482 !! result
15483 <table><tbody>
15484 <tr><td>foo-bar</td><td>foo+bar</td></tr>
15485 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
15486 </tbody></table>
15487 !! end
15488
15489 ### SSS FIXME: Disabled right now because accurate html2wt
15490 ### on this snippet requires data-parsoid flags that we've
15491 ### stripped out of these tests. We should scheme how we
15492 ### we want to handle these kind of tests that require
15493 ### data-parsoid flags for accurate html2wt serialization
15494
15495 !! test
15496 Tables: 4d. No escaping needed
15497 !! options
15498 disabled
15499 !! input
15500 {|
15501 ||+1
15502 ||-2
15503 |}
15504 !! result
15505 <table>
15506 <tr>
15507 <td>+1
15508 </td>
15509 <td>-2
15510 </td></tr></table>
15511
15512 !! end
15513
15514 #### --------------- Links ----------------
15515 #### 1. Quote marks in link text
15516 #### 2. Wikilinks: Escapes needed
15517 #### 3. Wikilinks: No escapes needed
15518 #### 4. Extlinks: Escapes needed
15519 #### 5. Extlinks: No escapes needed
15520 #### --------------------------------------
15521 !! test
15522 Links 1. Quote marks in link text
15523 !! options
15524 parsoid
15525 !! input
15526 [[Foo|<nowiki>Foo''boo''</nowiki>]]
15527 !! result
15528 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
15529 !! end
15530
15531 !! test
15532 Links 2. WikiLinks: Escapes needed
15533 !! options
15534 parsoid
15535 !! input
15536 [[Foo|<nowiki>[Foobar]</nowiki>]]
15537 [[Foo|<nowiki>Foobar]</nowiki>]]
15538 [[Foo|x [Foobar] x]]
15539 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
15540 [[Foo|<nowiki>[[Bar]]</nowiki>]]
15541 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
15542 [[Foo|<nowiki>|Bar</nowiki>]]
15543 [[Foo|<nowiki>]]bar</nowiki>]]
15544 [[Foo|<nowiki>[[bar</nowiki>]]
15545 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
15546 !! result
15547 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
15548 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
15549 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
15550 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
15551 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
15552 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
15553 <a href="Foo" rel="mw:WikiLink">|Bar</a>
15554 <a href="Foo" rel="mw:WikiLink">]]bar</a>
15555 <a href="Foo" rel="mw:WikiLink">[[bar</a>
15556 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
15557 !! end
15558
15559 !! test
15560 Links 3. WikiLinks: No escapes needed
15561 !! options
15562 parsoid
15563 !! input
15564 [[Foo|[Foobar]]
15565 [[Foo|foo|bar]]
15566 !! result
15567 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
15568 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
15569 !! end
15570
15571 !! test
15572 Links 4. ExtLinks: Escapes needed
15573 !! options
15574 parsoid
15575 !! input
15576 [http://google.com <nowiki>[google]</nowiki>]
15577 [http://google.com <nowiki>google]</nowiki>]
15578 !! result
15579 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
15580 <a href="http://google.com" rel="mw:ExtLink">google]</a>
15581 !! end
15582
15583 !! test
15584 Links 5. ExtLinks: No escapes needed
15585 !! options
15586 parsoid
15587 !! input
15588 [http://google.com [google]
15589 !! result
15590 <a href="http://google.com" rel="mw:ExtLink">[google</a>
15591 !! end
15592
15593 #### --------------- Quotes ---------------
15594 #### 1. Quotes inside <b> and <i>
15595 #### 2. Link fragments separated by <i> and <b> tags
15596 #### 3. Link fragments inside <i> and <b>
15597 #### --------------------------------------
15598 !! test
15599 1. Quotes inside <b> and <i>
15600 !! input
15601 ''<nowiki>'foo'</nowiki>''
15602 ''<nowiki>''foo''</nowiki>''
15603 ''<nowiki>'''foo'''</nowiki>''
15604 ''foo''<nowiki>'s</nowiki>
15605 '''<nowiki>'foo'</nowiki>'''
15606 '''<nowiki>''foo''</nowiki>'''
15607 '''<nowiki>'''foo'''</nowiki>'''
15608 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
15609 '''foo'''<nowiki>'s</nowiki>
15610 !! result
15611 <p><i>'foo'</i>
15612 <i>''foo''</i>
15613 <i>'''foo'''</i>
15614 <i>foo</i>'s
15615 <b>'foo'</b>
15616 <b>''foo''</b>
15617 <b>'''foo'''</b>
15618 <b>foo'<i>bar'</i>baz</b>
15619 <b>foo</b>'s
15620 </p>
15621 !! end
15622
15623 !! test
15624 2. Link fragments separated by <i> and <b> tags
15625 !! input
15626 [[''foo''<nowiki>hello]]</nowiki>
15627
15628 [['''foo'''<nowiki>hello]]</nowiki>
15629 !! result
15630 <p>[[<i>foo</i>hello]]
15631 </p><p>[[<b>foo</b>hello]]
15632 </p>
15633 !! end
15634
15635 !! test
15636 2. Link fragments inside <i> and <b>
15637 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
15638 this is one of the shortcomings of this format)
15639 !! input
15640 ''[[foo''<nowiki>]]</nowiki>
15641
15642 '''[[foo'''<nowiki>]]</nowiki>
15643 !! result
15644 <p><i>[[foo</i>]]
15645 </p><p><b>[[foo</b>]]
15646 </p>
15647 !! end
15648
15649 #### ----------- Paragraphs ---------------
15650 #### 1. No unnecessary escapes
15651 #### --------------------------------------
15652
15653 !! test
15654 1. No unnecessary escapes
15655 !! input
15656 bar <span><nowiki>[[foo]]</nowiki></span>
15657
15658 =bar <span><nowiki>[[foo]]</nowiki></span>
15659
15660 [[bar <span><nowiki>[[foo]]</nowiki></span>
15661
15662 ]]bar <span><nowiki>[[foo]]</nowiki></span>
15663
15664 =bar <span>foo]]</span><nowiki>=</nowiki>
15665 !! result
15666 <p>bar <span>[[foo]]</span>
15667 </p><p>=bar <span>[[foo]]</span>
15668 </p><p>[[bar <span>[[foo]]</span>
15669 </p><p>]]bar <span>[[foo]]</span>
15670 </p><p>=bar <span>foo]]</span>=
15671 </p>
15672 !!end
15673
15674 #### ----------------------- PRE --------------------------
15675 #### 1. Leading whitespace in SOL context should be escaped
15676 #### ------------------------------------------------------
15677 !! test
15678 1. Leading whitespace in SOL context should be escaped
15679 !! options
15680 parsoid
15681 !! input
15682 <nowiki> a</nowiki>
15683
15684 <nowiki> a</nowiki>
15685
15686 <nowiki> a(tab)</nowiki>
15687
15688 <nowiki> a</nowiki>
15689 <!--cmt-->
15690 <nowiki> a</nowiki>
15691
15692 <nowiki>a
15693 b</nowiki>
15694
15695 <nowiki>a
15696 b</nowiki>
15697
15698 <nowiki>a
15699 b</nowiki>
15700 !! result
15701 <p> a</p>
15702 <p> a</p>
15703 <p> a(tab)</p>
15704 <p> a</p>
15705 <p><!--cmt--> a</p>
15706 <p>a
15707 b</p>
15708 <p>a
15709 b</p>
15710 <p>a
15711 b</p>
15712 !! end
15713
15714 #### --------------- HTML tags ---------------
15715 #### 1. a tags
15716 #### 2. other tags
15717 #### 3. multi-line html tag
15718 #### -----------------------------------------
15719 !! test
15720 1. a tags
15721 !! options
15722 parsoid
15723 !! input
15724 <a href="http://google.com">google</a>
15725 !! result
15726 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
15727 !! end
15728
15729 !! test
15730 2. other tags
15731 !! input
15732 <nowiki><div>foo</div>
15733 <div style="color:red">foo</div></nowiki>
15734 !! result
15735 <p>&lt;div&gt;foo&lt;/div&gt;
15736 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
15737 </p>
15738 !! end
15739
15740 !! test
15741 3. multi-line html tag
15742 !! input
15743 <nowiki><div
15744 >foo</div
15745 ></nowiki>
15746 !! result
15747 <p>&lt;div
15748 &gt;foo&lt;/div
15749 &gt;
15750 </p>
15751 !! end
15752
15753 !! test
15754 4. extension tags
15755 !! input
15756 <nowiki><ref>foo</ref></nowiki>
15757 !! result
15758 <p>&lt;ref&gt;foo&lt;/ref&gt;
15759 </p>
15760 !! end
15761
15762 #### --------------- Others ---------------
15763 !! test
15764 Escaping nowikis
15765 !! input
15766 &lt;nowiki&gt;foo&lt;/nowiki&gt;
15767 !! result
15768 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
15769 </p>
15770 !! end
15771 !! test
15772
15773 Tag-like HTML structures are passed through as text
15774 !! input
15775 <x y>
15776
15777 <x.y>
15778
15779 <x-y>
15780
15781 1>2
15782
15783 x<y
15784
15785 a>b
15786
15787 1<d e>f
15788 !! result
15789 <p>&lt;x y&gt;
15790 </p><p>&lt;x.y&gt;
15791 </p><p>&lt;x-y&gt;
15792 </p><p>1&gt;2
15793 </p><p>x&lt;y
15794 </p><p>a&gt;b
15795 </p><p>1&lt;d e&gt;f
15796 </p>
15797 !! end
15798
15799
15800 # This fails in the PHP parser (see bug 40670,
15801 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
15802 !! test
15803 Tag names followed by punctuation should not be recognized as tags
15804 !! options
15805 parsoid
15806 !! input
15807 <s.ome> text
15808 !! result
15809 <p>&lt;s.ome&gt; text
15810 </p>
15811 !! end
15812
15813 !! test
15814 HTML tag with necessary entities in attributes
15815 !! input
15816 <span title="&amp;amp;">foo</span>
15817 !! result
15818 <p><span title="&amp;amp;">foo</span>
15819 </p>
15820 !! end
15821
15822 !! test
15823 HTML tag with 'unnecessary' entity encoding in attributes
15824 !! input
15825 <span title="&amp;">foo</span>
15826 !! result
15827 <p><span title="&amp;">foo</span>
15828 </p>
15829 !! end
15830
15831 !! test
15832 HTML tag with broken attribute value quoting
15833 !! input
15834 <span title="Hello world>Foo</span>
15835 !! result
15836 <p><span>Foo</span>
15837 </p>
15838 !! end
15839
15840 !! test
15841 Parsoid-only: HTML tag with broken attribute value quoting
15842 !! options
15843 parsoid
15844 !! input
15845 <span title="Hello world>Foo</span>
15846 !! result
15847 <p><span title="Hello world">Foo</span>
15848 </p>
15849 !! end
15850
15851 !! test
15852 Table with broken attribute value quoting
15853 !! input
15854 {|
15855 | title="Hello world|Foo
15856 |}
15857 !! result
15858 <table>
15859 <tr>
15860 <td>Foo
15861 </td></tr></table>
15862
15863 !! end
15864
15865 !! test
15866 Table with broken attribute value quoting on consecutive lines
15867 !! input
15868 {|
15869 | title="Hello world|Foo
15870 | style="color:red|Bar
15871 |}
15872 !! result
15873 <table>
15874 <tr>
15875 <td>Foo
15876 </td>
15877 <td>Bar
15878 </td></tr></table>
15879
15880 !! end
15881
15882 !! test
15883 Parsoid-only: Table with broken attribute value quoting on consecutive lines
15884 !! options
15885 parsoid
15886 !! input
15887 {|
15888 | title="Hello world|Foo
15889 | style="color:red|Bar
15890 |}
15891 !! result
15892 <table><tbody>
15893 <tr>
15894 <td title="Hello world">Foo
15895 </td><td style="color: red">Bar
15896 </td></tr></tbody></table>
15897
15898 !! end
15899
15900 !! test
15901 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
15902 !! options
15903 parsoid
15904 !! input
15905 {{}}
15906 !! result
15907 {{}}
15908 !! end
15909
15910 !! test
15911 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
15912 !! options
15913 parsoid
15914 !! input
15915 }}{{
15916 !! result
15917 }}{{
15918 !! end
15919
15920 !!test
15921 Accept empty td cell attribute
15922 !!input
15923 {|
15924 | align="center" | foo || |
15925 |}
15926 !!result
15927 <table>
15928 <tr>
15929 <td align="center"> foo </td>
15930 <td>
15931 </td></tr></table>
15932
15933 !!end
15934
15935 !!test
15936 Non-empty attributes in th-cells
15937 !!input
15938 {|
15939 ! Foo !! style="color: red" | Bar
15940 |}
15941 !!result
15942 <table>
15943 <tr>
15944 <th> Foo </th>
15945 <th style="color: red"> Bar
15946 </th></tr></table>
15947
15948 !!end
15949
15950 !!test
15951 Accept empty attributes in th-cells
15952 !!input
15953 {|
15954 !| foo !!| bar
15955 |}
15956 !!result
15957 <table>
15958 <tr>
15959 <th> foo </th>
15960 <th> bar
15961 </th></tr></table>
15962
15963 !!end
15964
15965 !!test
15966 Empty table rows go away
15967 !!input
15968 {|
15969 | Hello
15970 | there
15971 |- class="foo"
15972 |-
15973 |}
15974 !! result
15975 <table>
15976 <tr>
15977 <td> Hello
15978 </td>
15979 <td> there
15980 </td></tr>
15981
15982 </table>
15983
15984 !! end
15985
15986 ###
15987 ### Parsoid-centric tests for testing RTing of inter-element separators
15988 ### Edge cases not tested by existing parser tests and specific to
15989 ### Parsoid-specific serialization strategies.
15990 ###
15991
15992 !!test
15993 RT-ed inter-element separators should be valid separators
15994 !!input
15995 {|
15996 |- [[foo]]
15997 |}
15998 !!result
15999 <table>
16000
16001 </table>
16002
16003 !!end
16004
16005 !!test
16006 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
16007 (Parsoid-only since PHP parser relies on Tidy for correct output)
16008 !!options
16009 parsoid
16010 !!input
16011 {|
16012 |<small>foo
16013 bar
16014 |}
16015
16016 {|
16017 |<small>foo<small>
16018 |}
16019 !!result
16020 !!end
16021
16022 !!test
16023 Empty TD followed by TD with tpl-generated attribute
16024 !!input
16025 {|
16026 |-
16027 |
16028 |{{echo|style='color:red'}}|foo
16029 |}
16030 !!result
16031 <table>
16032
16033 <tr>
16034 <td>
16035 </td>
16036 <td>foo
16037 </td></tr></table>
16038
16039 !!end
16040
16041 !!test
16042 Indented table with an empty td
16043 !!input
16044 {|
16045 |-
16046 |
16047 |foo
16048 |}
16049 !!result
16050 <table>
16051
16052 <tr>
16053 <td>
16054 </td>
16055 <td>foo
16056 </td></tr></table>
16057
16058 !!end
16059
16060 !!test
16061 Empty TR followed by a template-generated TR
16062 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
16063 !!options
16064 parsoid=wt2html,wt2wt
16065 !!input
16066 {|
16067 |-
16068 {{echo|<tr><td>foo</td></tr>}}
16069 |}
16070 !!result
16071 <table>
16072 <tbody>
16073 <tr></tr>
16074 <tr typeof="mw:Transclusion">
16075 <td>foo</td></tr></tbody></table>
16076 !!end
16077
16078 ## PHP and parsoid output differ for this, and since this is primarily
16079 ## for testing Parsoid's serializer, marking this Parsoid only
16080 !!test
16081 Empty TR followed by mixed-ws-comment line should RT correctly
16082 !!options
16083 parsoid
16084 !!input
16085 {|
16086 |-
16087 <!--c-->
16088 |-
16089 <!--c--> <!--d-->
16090 |}
16091 !!result
16092 <table>
16093 <tbody>
16094 <tr>
16095 <td> <!--c--></td></tr>
16096 <tr>
16097 <td><!--c--> <!--d--></td></tr>
16098 </tbody></table>
16099
16100 !!end
16101
16102 !!test
16103 Multi-line image caption generated by templates with/without trailing newlines
16104 !!options
16105 parsoid
16106 !!input
16107 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
16108 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
16109 !!result
16110 <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>
16111 <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>
16112
16113 !!end
16114
16115 ## PHP emits broken html for this, and since this is primarily
16116 ## a Parsoid serializer test, marking this Parsoid only
16117 !!test
16118 Improperly nested inline or quotes tags with whitespace in between
16119 !!options
16120 parsoid
16121 !!input
16122 <span> <s>x</span> </s>
16123 ''' ''x''' ''
16124 !!result
16125 <p><span> <s>x</s></span><s> </s>
16126 <b> <i>x</i></b><i> </i>
16127 </p>
16128 !!end
16129
16130 # -----------------------------------------------------------------
16131 # The following section of tests are primarily to spec requirements
16132 # around serialization of new/edited content.
16133 #
16134 # All these tests are marked Parsoid html2wt and html2html only
16135 # ----------------------------------------------------------------
16136
16137 !! test
16138 Image: Modifying size of an image
16139 !! options
16140 parsoid=html2wt
16141 !! input
16142 [[Image:Wiki.png|230x230px]]
16143 !! result
16144 <p data-parsoid='{"dsr":[0,24,0,0]}'><span typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"100px"}],"cacheKey":"[[Image:Wiki.png|100px]]","img":{"h":115,"w":100,"wdset":true},"dsr":[0,24,null,null]}'><a href="./File:Wiki.png" data-parsoid='{"a":{"href":"./File:Wiki.png"}}'><img resource="./File:Wiki.png" src="//upload.wikimedia.org/wikipedia/en/thumb/b/bc/Wiki.png/100px-Wiki.png" height="230" width="200" data-parsoid='{"a":{"resource":"./File:Wiki.png"},"sa":{"resource":"Image:Wiki.png"}}'></a></span></p>
16145 !!end
16146
16147 !! test
16148 Image: New block level image should have \n before and after
16149 !! options
16150 parsoid=html2wt
16151 !! input
16152 123
16153 [[File:Wiki.png|right|thumb|150x150px]]
16154 456
16155 !! result
16156 <p>123</p><figure typeof="mw:Image/Thumb" class="mw-halign-right"><a href="./File:Wiki.png"><img src="http://192.168.142.128/mw/images/thumb/b/bc/Wiki.png/131px-Wiki.png" width="131" height="150" resource="./File:Wiki.png"></a></figure><p>456</p>
16157 !!end
16158
16159 !! test
16160 Lists: Add space after bullets
16161 !! options
16162 parsoid=html2wt
16163 !! input
16164
16165 * foo
16166 * bar
16167 * <span> baz</span>
16168 !! result
16169 <ul>
16170 <li>foo</li>
16171 <li> bar</li>
16172 <li><span> baz</span></li>
16173 </ul>
16174 !! end
16175
16176 # This test case is fixed by domino 1.0.12.
16177 # Note that html2wt is considerably more difficult if we use <b> in
16178 # the test case, instead of <big>
16179 !! test
16180 Ensure that HTML adoption agency algorithm is properly implemented.
16181 !! options
16182 !! input
16183 <big>X<big>Y</big>Z</big>
16184 !! result
16185 <p><big>X<big>Y</big>Z</big>
16186 </p>
16187 !! end
16188
16189 # The parsoid team believes the below behavior of the PHP parser to be
16190 # a bug.
16191 !! test
16192 Document PHP parser behavior for HTML adoption agency test case.
16193 !! options
16194 php
16195 !! input
16196 <em>X<em>Y</em>Z</em>
16197 !! result
16198 <p><em>X&lt;em&gt;Y</em>Z&lt;/em&gt;
16199 </p>
16200 !! end
16201
16202 TODO:
16203 more images
16204 more tables
16205 character entities
16206 and much more
16207 Try for 100% code coverage